{"id":24627892,"url":"https://github.com/suttna/botbuilder-command-line","last_synced_at":"2025-05-07T20:05:18.010Z","repository":{"id":26492511,"uuid":"102664040","full_name":"suttna/botbuilder-command-line","owner":"suttna","description":"Easy creation of command line tools for your BotBuilder bot.","archived":false,"fork":false,"pushed_at":"2025-04-13T11:04:00.000Z","size":137,"stargazers_count":4,"open_issues_count":11,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-07T20:02:04.293Z","etag":null,"topics":["botbuilder","command-line","nodejs","typescript"],"latest_commit_sha":null,"homepage":"https://suttna.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/suttna.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2017-09-06T22:25:19.000Z","updated_at":"2021-02-07T20:58:07.000Z","dependencies_parsed_at":"2023-01-14T04:46:55.208Z","dependency_job_id":"3e18d4fd-1912-4fb3-8f24-a68bafd710cd","html_url":"https://github.com/suttna/botbuilder-command-line","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suttna%2Fbotbuilder-command-line","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suttna%2Fbotbuilder-command-line/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suttna%2Fbotbuilder-command-line/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/suttna%2Fbotbuilder-command-line/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/suttna","download_url":"https://codeload.github.com/suttna/botbuilder-command-line/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252949271,"owners_count":21830151,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["botbuilder","command-line","nodejs","typescript"],"created_at":"2025-01-25T05:13:38.603Z","updated_at":"2025-05-07T20:05:17.409Z","avatar_url":"https://github.com/suttna.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"![https://suttna.com](logo.png)\n\n# botbuilder-command-line [![npm version](https://badge.fury.io/js/botbuilder-command-line.svg)](https://badge.fury.io/js/botbuilder-command-line) [![CircleCI](https://circleci.com/gh/suttna/botbuilder-command-line.svg?style=svg)](https://circleci.com/gh/suttna/botbuilder-command-line)\n\nbotbuilder-command-line makes really easy the creation of command line tools for your BotBuilder bot.\n\nFeatures:\n\n- Nice DSL for creating command line dialogs\n- Arguments and options parsing\n- Configurable authentication for command\n\n## Install\n\n```\nyarn add botbuilder-command-line\n```\n\n\u003e This library was only tested in Slack. It should work in other channels too.\n\n## Usage\n\n```javascript\nconst { UniversalBot } = require('botbuilder')\nconst { CommandLineLibrary } = require('botbuilder-command-line')\n\nconst bot = new UniversalBot(connector)\n\nconst lib = new CommandLineLibrary(\"operations\", {\n  isAuthorized: async (user) =\u003e {\n    return user.id === process.env.SUPER_USER_ID\n  },\n})\n\nlib.command(\"list-active-dialogs\", {\n  description: \"List the active dialogs\",\n  handler: async (session, context) =\u003e {\n    const activeDialogs = await DialogRepository.activeDialog()\n\n    session.endDialog(formatDialogList(activeDialogs))\n  },\n})\n\nlib.command(\"destroy-dialog\", {\n  description: \"Destroy the given dialog.\",\n  options: [\n    {\n      name: \"id\",\n      description: \"The dialog identifier\",\n      required: true,\n    },\n  ],\n  handler: async (session, context) =\u003e {\n    await DialogRepository.destroy(context.options.id)\n\n    session.endDialog('I have destroy your dialog')\n  }\n})\n\nbot.library(lib)\n```\n\nWe have created a new CommandLineLibrary with the name operations. `operations` will be the name to use when invoking a command. The `operations` CommandLineLibrary will only be triggered if a recognizer emits the `operations` intent. This means you will need to create a custom recognizer in your bot and emit the `operations` intent yourself.\n\nThis will look like this probably:\n\n```javascript\nbot.recognize({\n  recognize: (context, done) =\u003e {\n    if (context.message.text.startsWith('operations')) {\n      done(null, { score: 1.0, intent: 'operations' })\n    } else {\n      done(null, { score: 0.0 })\n    }\n  }\n})\n```\n\n\u003e We are going to move this logic inside the library to make the library experience more friendly.\n\nAfter adding the previous recognizer you can now invoke the command like this:\n\n```\noperations list-active-dialogs\n\nor\n\noperations destroy-dialog --id 10\n```\n## Todo\n\n- [ ] Implement recognizer inside library\n- [ ] Add boolean flags\n\n## Contact\n\n- Martín Ferández \u003cmartin@suttna.com\u003e\n- Santiago Doldán \u003csantiago@suttna.com\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuttna%2Fbotbuilder-command-line","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsuttna%2Fbotbuilder-command-line","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsuttna%2Fbotbuilder-command-line/lists"}