Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: adds plugin feature for extending cli with new commands #435

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

rmauge
Copy link

@rmauge rmauge commented Jun 28, 2022

Updates the CLI to allow adding new commands.

New commands are discovered simply by being present on the path. This implementation is similar to other cli tools that support plugins: any executable that is found on the path that is named “ask-” is considered a plugin. Guard rails are in place to ensure that a plugin cannot override an internal command. Plugins with the same names are also detected and a warning given to the user. 

You can test the feature with a sample plugin. This plugin can generate a new Intent and handler on a skill created with "ask new".

Install the beta CLI  based on ask-cli 2.27.0:
npm install git+https://github.com/rmauge/ask-cli.git\#plugin-feature-qa -g

The executable "ask_plugin" should now available to be used as a drop-in replacement for "ask".

Install a sample plugin for generating skill artifacts:
npm install git+https://github.com/rmauge/ask-generate.git -g

The ask-generate command should now be available. Verify by running "ask_plugin" and look for the "generate" command.

Generate a new Intent:
Navigate to a new skill that follows the same layout as created by "ask new".
ask_plugin generate intent StartOrder "begin my order" "place Order" "start order" "new order"

Your skill IM model should now have a new Intent added and a new Handler under lambda/handlers.

To uninstall:
npm uninstall --location=global ask-cli-plugin
npm uninstall --location=global ask-generate

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@CamdenFoucht
Copy link
Contributor

Hi @rmauge, thank you for the pull request! We will try to review it soon 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants