Giter VIP home page Giter VIP logo

botframework-cli's Introduction

Bot Framework CLI

BF Command Line Interface

Build Status

BF Command Line Interface (CLI) tool replaces and aggregates the collection of standalone tools used to manage Bot Framework bots and related services into one cohesive and consistent interface.

The old tools have been deprecated. All new investments, bug fixes, and new features will be implemented in the new consolidated BF CLI alone.

Installation

BF is based on the Node.js platform and the OClif framework where it inherits its command line parsing style, and plugin architecture platform.

You must download the following prerequisites:

Install the tool using the following command:

$ npm i -g @microsoft/botframework-cli
$ bf

Troubleshooting

For installation failures in some Linux platforms, try one of the following workarounds:

  • Upgrade npm to version 7.9
  • Install without the '-g' option and use npx
$ npm i @microsoft/botframework-cli
$ npx bf

Available Commands

The following commands are currently available:

See Porting Map for a mapping reference between old and new tools

Overview

The Bot Framework Command Line Interface (BF CLI) cross-platform tool is used to manage Bot Framework bots and related services. It is part of the Microsoft Bot Framework, a comprehensive framework for building enterprise-grade conversational AI experiences. In particular, BF CLI provides fundamental functionality when used in conjunction with Continuous Integration, and Continuous Deployment (CI/CD) pipelines.

As you build your bot, you may also need to integrate AI services like LUIS.ai for language understanding, QnAMaker.ai for your bot to respond to simple questions in a Q&A format, and more. The bf luis command is used to convert, and translate language definition .lu files or generate corresponding source (C# or JavaScript) code as well as deploy the local files, train, test, and publish them as Language Understanding models within the LUIS service. If used to define QnAMaker question/answer Knowledgebase, use the bf qnamaker command to create and manage QnAMaker assets both locally, and on the QnAMaker service. Please refer to the lu library documentation for extended discussion on how to work with .lu file formats. Note: You may be familiar with the Luis command if you used the legacy LuDown and LuisGen tools.

As your bot grows in sophistication, use bf orchestrator command to generate a dispatcher LU from the language assets in your solution similar to the legacy dispatch CLI. Then, you may use the Orchestrator recognizer for dispatching across subsequent services and skills. Use bf orchestrator command to evaluate language model quality. Use Orchestrator to to route intents across multiple bot modules such as LUIS models, QnA knowledgebases, and assist in routing messages to backend bot skills.

To test and refine your bot, you can use the new V4 Bot Framework Emulator. The Bot Framework Emulator is a cross-platform Electron application that enables you to test and debug your bots on local machine or in the cloud.

Also, during early designs stages you may want to create mockup of conversations between the user and the bot for the specific scenarios your bot will support. Use bf chatdown command to author conversation mockup .chat files and convert them into rich transcripts and view the conversations in the the Emulator.

With the Azure CLI Bot extension (az bot command), you can create, download, publish, configure channels with the Azure Bot Service. It is a plugin that extends the functionality of Azure CLI to manage your Azure Bot Service assets.

Lastly, although the CLI is primarily used in code-first solutions and CI/CD pipeline automation, since the underlying libraries are also used in Bot Framework Composer, it can be used to provision and organize some assets for Bot Framework Composer (such as .dialog generation, Orchestrator evaluation, exporting LUIS & QnAMaker models).

See Also

Issues and Feature Requests

Please file issues and feature requests here.

Also, see current known issues.

Thank you for your support.

Privacy

Privacy is very important to us. BF CLI contains optional instrumentation that is designed to help us improve the tool based on anonymous usage patterns. It is disabled, opted-out by default. If you elect to opt-in, we will gather some usage data as follows:

  • Command group calls
  • Flags used excluding specific values (i.e. if used parameter --folder:name, we will only gather the use of --folder but will not capture name).

To disable data collection see the bf config command.

Please refer to Microsoft Privacy Statement for more details.

Enable Telemetry in Continuous Integration Pipelines

Per above, Microsoft will only collect anonymous data to help improve the CLI. To set your CI/CD pipeline telemetry collection behavior set the following OS environment variable:

  • set BF_CLI_TELEMETRY = true : Bypass prompts and enables telemetry collection.
  • set BF_CLI_TELEMETRY = false : Bypass prompts and disables telemetry collection (default).
  • BF_CLI_TELEMETRY = null (absent) : If no value is set in configuration file defaults to false - disabled.

Nightly builds

Nightly builds are generated using the latest code. Therefore, they may not be stable, and most likely lack up to date documentation. These builds are better suited for more experienced users, although everyone is welcome to use them and provide feedback.

Install using npm:

npm i -g @microsoft/botframework-cli@next

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.

Reporting Security Issues

Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) at [email protected]. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the Security TechCenter.

Copyright (c) Microsoft Corporation. All rights reserved.

botframework-cli's People

Contributors

axelsrz avatar chrimc62 avatar christopheranderson avatar cleemullins avatar cosmicshuai avatar danieladu avatar edwardmcleodjones avatar feich-ms avatar gabog avatar hcyang avatar jhontsouth avatar joshgummersall avatar luhan2017 avatar mdrichardson avatar microsoft-github-policy-service[bot] avatar microsoftopensource avatar msftgits avatar munozemilio avatar ninggao avatar scheyal avatar sehajduggal avatar sgellock avatar stevengum avatar sw-joelmut avatar tony-xia avatar tracyboehrer avatar tsuwandy avatar vishwacsena avatar washingtonkayaker avatar xhr0804 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

botframework-cli's Issues

Need Dialog CLI Spec

This is a request for help with spec for the dialog CLI.

See Specs folder for sample templates, but at the very least we need to know what should come there, the list of command groups, options, corresponding functionality and existing implementations reference.
The spec must be reviewed before any substantial coding begins (other than maybe preparatory work).

Create a contribution guide. Use spec guidelines

The Contribution Guide should provide sufficient guidance for Microsoft developer (first, and maybe eventually OSS community) to add a command group from scratch to manage a related Bot management functionality.

The guide should include:
• Pre-requisites, and dependencies
• Required prior knowledge
• Structure orientation
• Step by step contribution "get started" guide along with source code snippets or pointers as necessary
• Acceptance requirements:
○ Style, lint
○ Test coverage requirements
○ Best practices
○ Authorized review any special submissions requirements
• Usage of common utilities such as global configuration

(Pre)Review CLI Foundation Spec

Please review the initial spec (draft placeholder) for CLI Foundation Spec.

  • Provide further guidance to what should or should not be there.
  • Trim as needed (this is to inspire, not mandate)
  • Ensure sufficiency for spec review
  • Consider to use a sample for future specs (for CLI plugins or otherwise).
  • Examine corresponding new-cli-feature dev spec template
    Note: @cleemullins

ludown parse toluis fails

Tool

Name: Ludown
Version: 1.3.3
OS: Windows 10

Describe the bug

Ludown cannot parse utterance "[[this]is] a new form (a | b)"

To Reproduce

1- Create lu file
2- Add Intention with utterance "[[this]is] a new form (a | b)"
3- Run command "ludown parse toluis ..."

Expected behavior

The file is parsed and the json file is generated

Screenshots

[ERROR]: Invalid LU File Ref: "[[this]is] a new form (a | b)".
 Reference needs a qualifier - either a #Intent-Name or #?
Stopping further processing.

[bug]

Programmatic ludown translate fails

Tool

  • Name: Ludown
  • Version: 1.3.3
  • OS: macOS 10.14.6

Describe the bug

Ludown cannot translate text when used as a library, most likely due to the use of this and export

To Reproduce

Steps to reproduce the behavior:

const ludown = require('ludown');

// valid values not need to reproduce
const key = 'abc';
const text = '# Intent';
const lang = 'xx';
ludown.translate.parseAndTranslate(text, key, lang).then(console.log, console.error)

Expected behavior

The text is translated

Screenshots

TypeError: this.addSegment is not a function
    at Object.parseAndTranslate (/<snip>/node_modules/ludown/lib/translate-helpers.js:76:26)

Additional context

The functions parseAndTranslate and addSegment are both methods of the translateHelpers object, however parseAndTranslate is being exported alone, which is probably why this.anything cannot be resolved. Exports.js should export the full object, not just a method, or else the functions should be converted to not use this

A workaround is to import the helper directly:

const translateHelpers = require('ludown/lib/translate-helpers')
translateHelpers.parseAndTranslate(text, key, 'xx').then(console.log, console.error)

[bug]

CLI Microsoft Documentation Update (BF ...)

Tracking.

Although most CLI will be within GitHub repos, I think we need some basic documentation, maybe full sample scenarios or pointers to basic tool usage, downloads?

Consider/discuss?

Implement tool to register skill in parent bot

Automate the process of adding, removing, and updating skill configuration for a Bot Framework Bot.

Operation Description Parameters
Add Register a skill with a Bot Framework bot. Manifest file (local remote) Endpoint to use (manifest has multiple potentially) Programming Language (different languages have different config files - could be resolved through probing)  [Optional] Local folder to resolve required LU files
Remove Unregister a skill from a Bot Framework bot. SkillID Programming Language (different languages have different config files - could be resolved through probing)
Update Refresh a skill registration with any changes from a connected skill (only relevant for Orchestrator/Dispatch scenarios) Manifest file (local remote) Programming Language (different languages have different config files - could be resolved through probing)
List List all skill registrations Programming Language (different languages have different config files - could be resolved through probing)

Core Skill Registration Steps (Action and Utterance Invocation)

  1. Validate Skill Manifest. Specifically to ensure Id, AppId, SkillEndpoint, etc. is valid. Given the current SDK approach requires developers to create this manually it leads to many errors.

  2. Extract core manifest information and update Bot configuration. Id, AppId, Endpoint, Name and Description are required on the Bot side. AppId is used as part of the secure skill communication mechanism.

"botFrameworkSkills": {
"id": "<SKILL_ID>",
"appId": "<SKILL_APPID>",
"skillEndpoint": "<SKILL_ENDPOINT>",
"name": "<SKILL_NAME>",
"description": "<SKILL_DESCRIPTION>"
}

  1. Populate skillHostEndpoint Uri. This setting is part of the Bots configuration file and provides the endpoint that a Skill calls back with response activities. Not setting this leads to obscure HTTP 500 errors and is highly confusing to developers. As developers move from dev envrionments through to production this needs to be set as part of CI/CD. Can also be looked up based on other information in configuration.

    "skillHostEndpoint": "<VA-SKILL_ENDPOINT>"

Additional Skill Registration Steps required for Utterance Invocation scenarios

  1. Retrieve LU training data. Manifest will point to LU source(s), one per supported locale. These need to be resolved and contents downloaded. Local File, Remote File and also directly from the LUIS model for Microsoft-centric and enterprise scenarios whereby a separate static file is not required.

  2. Filter out unneeded intents. Manifest optionally enables certain intents to be "exposed" (made public) so LU data may be filtered down to just the intents the manifest specifies. May not be needed. No intents specified will default to all intents.

  3. Train Dispatcher. A new "label" is added to Dispatcher/Orchestrator and the training utterances from previous step are added. This label is mapped to the Skill Name enabling the Skill to be identified at runtime.

  4. Multi-Locale. Above steps are repeated for each and every locale. Each locale will have a different dispatch model.

  5. Strongly typed class. Generated an updated Dispatch "model" class ensuring the (now extended) Dispatch result can be deserialized by the assistant. This avoids any code changes when adding a Skill.

Additional Considerations for Utterance Invocation Scenarios

  • Utterance Invocation in multi-locale scenarios requires a consistent way of modelling the cognitive models in your configuration (e.g. Each locale will have a Dispatcher, N LUIS Models and N QnAMaker knowledgebases). These need to be reliably retrieved at runtime for both the bot but also CLIs that are refreshing dispatcher. This is problematic for a "SDK" which doesn't want to impose too much structure/regiment on developers - easier for an assistant platform layered on the SDK.

  • When registering a series of Skills the dispatch retraining cycle between each skill is less than ideal especially in CI/CD pipelines. We have implemented a "noRefresh" flag where you can skip dispatch refresh until say the last skill registration in a batch meaning you only refresh dispatch once.

DCR: As a bot developer, I would like to be able to get training evaluation analytics about my LUIS model programmatically

The LUIS portal provides some useful training evaluation analytics about my LUIS model:

image

As a developer, I would like to have an API that returns this data so I can invoke it from my integration tests and perform assertions on the status of the training model, for example:

[Fact]
public async Task AnalyticThresholds()
{
    var analyzer = new LuisAnalyzer();
    var sut = await analyzer.AnalyzeAsync("flightbooking.lu");

    Assert.True(sut.IncorrectPredictions.Count == 0);
    Assert.True(sut.ImbalancedIntents.Count == 0);
    Assert.True(sut.UnclearPredictions.Count == 0);
}

Preferably, I would like the LuisAnalyzer to work locally on my machine, but it may also acceptable to pass an authoring key and have the analyzer create, train and tear down my model based on the lu file or a json file.

ludown translate to zh-Hans using ,、 instead of , in phraselist

Tool

Name: Ludown
Version: 1.3.3
OS: Windows 10

Describe the bug

When traslating to zh-Hans, ',' in phraselist is translated to chinese ',', '、'.

To Reproduce

Steps to reproduce the behavior:

  1. add phraselist to lu file
  2. ludown translate --to_lang zh-Hans

Expected behavior

Still ','.

[bug]

Foundation: CLI Shell

  • Linting, Parser, Pattern for cmd line (file struct for opts):
    • Version, Help, Learna or equivalent

Create a deprecation message for old tools

We need to have a consistent deprecation message for all old tools (along with deprecation roadmap).

Example:

|-------------------------------------------------------------|
|                         DEPRECATED                                           
| Ludown CLI has been deprecated.                                  
| All functionality has been migrated to the new BF CLI.  
| See also: https://aka.ms/newbfcli                                   
|-------------------------------------------------------------|

npm run build fails due to rm command

When trying to create a new plugin:

c:\botroot\cli>npm run build

> root@ build c:\\botroot\cli
> lerna bootstrap && lerna run build && lerna bootstrap

lerna notice cli v3.13.2
lerna info Bootstrapping 6 packages
lerna info Symlinking packages and binaries
lerna info lifecycle @microsoft/[email protected]~postinstall: @microsoft/[email protected]

> @microsoft/[email protected] postinstall c:\workspace\botroot\cli\packages\cli
> node scripts/postinstall.js

lerna success Bootstrapped 6 packages
lerna notice cli v3.13.2
lerna info Executing command in 1 package: "npm run build"
lerna ERR! npm run build exited 1 in '@microsoft/bf-cli-command'
lerna ERR! npm run build stdout:

> @microsoft/[email protected] build c:\workspace\botroot\cli\packages\command
> rm -rf lib && tsc -b


lerna ERR! npm run build stderr:
'rm' is not recognized as an internal or external command,
operable program or batch file.

Create BF config:show

Create a way to view my current configuration settings, and update corresponding privacy section in the readme.

bf config:show

Adding an appazureaccount to a LUIS app should support taking an ARM token via file.

Per this issue: microsoft/botbuilder-tools#1227

We should add the ability to pass in an ARM token via file to get around the problem with Windows taking in command lines with a length of less than 8192 characters.

After testing the command in VS Code, it's not a problem in the code base. The dummy token wasn't rejected because of its length, just because it was an invalid token.

This requirement on length is actually due to Windows: https://support.microsoft.com/en-us/help/830473/command-prompt-cmd-exe-command-line-string-limitation

After searching for workarounds, it seems that using a relatively unladen service principal might be a valid workaround. Alternatively there could be an enhancement to the CLI tool in the future that makes it possible to pass in a file that contains the ARM token instead of passing it in directly via the cmd.

@emiliomunoz FYI

Comment from the relevant issue.

DCR: as a bot developer, I would like to be able to have a way of programmatically push and pull LUIS models from the LUIS portal

The current luis CLI provides some primitives to create, publish, train, etc. LUIS models but these are too granular and require writing some additional powershell to wrap them into common operations.

As a developer, I would like to simply say:

luis push -luFile FlightBooking.lu -luisAppId MyAppId-luisAuthoringKey myAuthoringKey -luisSubscriptionKey mySubscriptionKey -luisAppVersion myVersion

And have my model created, trained, published and ready to use.

  • luisSubscriptionKey: can be optional but it should get assigned to my app if provided
  • luisAppVersion should be optional and If it is not provided, it should just overwrite the latest or create a 0.1 one.

To get a a model, I would like to just say:

luis pull-luFile FlightBooking.lu -luisAppId MyAppId-luisAuthoringKey myAuthoringKey -luisAppVersion myVersion

And get a lu file with the app from LUIS:

  • luisAppVersion should be optional and If it is not provided, it should just get the currently active and published model.

Additional info

  • A sample LuisPull written in powershell can be found here
  • A sample LuisPush written in powershell can be found here
  • These two scripts rely on a helper powershell file that uses the LUIS primitives and can be found here

DCR: Create command line tool for working with transcript stores

Issue

We have multiple implementations of transcript stores

  • Azure Blob Storage
  • CosmosDb
  • File system
  • etc.
    But we don't have a way to easily access transcripts from my developer box.

Proposed change

We should create a transcripts cli which allows you to consume and manipulate transcript stores.

Operation description
list conversations retrieve conversations on a channel
get conversation get .transcript with activities for a conversation
delete conversation delete the activities for a conversation

Example usage

c:\ transcripts list conversations --channel=teams --azureStorageKey=xxxxx --botId MyBot
<show list of conversations Ids>
c:\ transcripts get conversation -channel=skype --convereation=conversationId --folder=folderPath 
<outputs the .transcript file>
c:\ transcripts delete conversation -channel=skype --conversation=conversationId 
transcript activities have been deleted for skype/conversationId

Component Impact

No component updates, it's a new component.

Customer Impact

None

Tracking Status

Docs

  • PR
  • Merged

Tools

  • PR
  • Merged

[dcr]

Need MSLG PM Spec

We need a PM spec for MSLG.

See Mini Spec template and Contribution guidelines in specs folder

Add instructions to contribution guide

We need more guidance on how to create a plugin, how to answer these questions in prompt (for internal contributions)

? npm package name 
? description 
? author 
? version 
? license 
? Who is the GitHub owner of repository (https://github.com/OWNER/repo) 
? What is the GitHub name of repository (https://github.com/owner/REPO) 
? Select a package manager 
? TypeScript 
? Use tslint (linter for TypeScript) 
? Use mocha (testing framework) 
? Add CI service config (Press <space> to select, <a> to toggle all, <i> to invert selection)

[Ludown] Translate failed due to nested entity references

Tool

Name: Ludown
Version: 1.3.3
OS: os version

Describe the bug

Hospitality.txt
See attached. Failed to translate this by
ludown translate -k XXX --in Hospitality.lu -t zh

The error is :
image

Other options like parse ToLuis works well.

Expected:
Ludown translate support composite entity like:

  • stay {NumNights=three more {HotelNights=days}}
    Which is generated by ludown itself.

ludown translate should handle List entities specially

Tool

Name: Ludown

Describe the problem

In lu file, list entities is defined as

$Name:Value=
- Synonyms

However, only Synonyms are translated since Value must not be translated (or it will be confusing when using).
So in the other language, it does not detect Value.

Describe the solution you'd like

Add Value automatically to Synonyms when translating.

Describe alternatives you've considered

Output a warning to inform user to add Value to Synonyms.

Additional context

[enhancement]

All options should indicate if they're mandatory/optional

When displaying help, all commands must specify whether they're mandatory or optional and any default values.

Example

bf SomeCommand
Perform some command....
USAGE
$ bf SomeCommand [SUB-COMMANDS] [OPTIONS]
SUB-COMMANDS
All sub-commands are separated by ':'
$ SubCmd1 Performs sub command
$ SubCmd2 Performs sub command 2
OPTIONS
-x, --xyz Modifies SomeCommand to do xyz [mandatory]
-y, --yzx Modifies SomeCommand to do yzx [optional]
-z, --zxy=number Modifies SomeCommand to do zxy [default=123]

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.