{"id":21152565,"url":"https://github.com/nimbella/commander-cli","last_synced_at":"2025-07-09T10:32:56.674Z","repository":{"id":47541725,"uuid":"280346108","full_name":"nimbella/commander-cli","owner":"nimbella","description":"Commander CLI is a Nimbella Commander development tool that allows you to create, run \u0026 publish your serverless functions as commands that can run in Slack, Microsoft Teams, and Mattermost.","archived":false,"fork":false,"pushed_at":"2021-08-24T18:44:40.000Z","size":7844,"stargazers_count":3,"open_issues_count":10,"forks_count":3,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-16T00:19:34.936Z","etag":null,"topics":["command-line-tool","commander","mattermost","microsoft-teams","nimbella","slack"],"latest_commit_sha":null,"homepage":"https://nimbella.com/product/commander","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nimbella.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-17T06:33:12.000Z","updated_at":"2021-08-02T14:51:32.000Z","dependencies_parsed_at":"2022-09-26T16:20:23.619Z","dependency_job_id":null,"html_url":"https://github.com/nimbella/commander-cli","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimbella%2Fcommander-cli","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimbella%2Fcommander-cli/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimbella%2Fcommander-cli/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nimbella%2Fcommander-cli/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nimbella","download_url":"https://codeload.github.com/nimbella/commander-cli/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225533676,"owners_count":17484346,"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":["command-line-tool","commander","mattermost","microsoft-teams","nimbella","slack"],"created_at":"2024-11-20T10:42:59.248Z","updated_at":"2024-11-20T10:42:59.945Z","avatar_url":"https://github.com/nimbella.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Commander CLI\n\n[![Total Command Sets](https://img.shields.io/endpoint?url=https://apigcp.nimbella.io/api/v1/web/mesatyar-yzpbtecwigu/default/command-sets-count\u0026style=flat)](https://github.com/nimbella/command-sets)\n[![Join Slack](https://img.shields.io/badge/join-slack-9B69A0.svg)](https://nimbella-community.slack.com/)\n[![Twitter](https://img.shields.io/twitter/follow/nimbella.svg?style=social\u0026logo=twitter)](https://twitter.com/intent/follow?screen_name=nimbella)\n[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](http://www.apache.org/licenses/LICENSE-2.0)\n\nCommander CLI is a [Nimbella Commander](https://nimbella.com/product/commander) development tool that allows you to create, run \u0026 publish your serverless functions as commands that can run in Slack, Microsoft Teams, and Mattermost.\n\nHere's a glimse of what you can achieve with Commander CLI:\n\n- Run Slash commands, built for messaging platforms, from your terminal.\n- Login to different Commander clients (Slack, Mattermost, Teams) directly from the terminal.\n- Bootstrap Command Set development (with auto generation of the necessary files and code templates).\n- Install Command Sets from your local machines onto messaging platforms.\n\nCommander introduces the following terminology:\n\n- **Command:** A serverless function that executes some business logic and returns output formatted for a messaging platform.\n- **Command Set:** A set of related commands grouped together for easy installation and sharing.\n\nVisit our [website](https://nimbella.com/resources-commander/overview#what-is-commander) to learn more about Commander and how it can help you extend your messaging environment with new and rich APIs.\n\nThe following guide provides details for getting started using the Commander CLI.\n\n## Contents\n\n- [Quick Start](#quick-start)\n- [Install a Command Set](#install-a-command-set)\n- [Develop a Command Set](#develop-a-command-set)\n- [Login to Your Messaging Platform](#login-to-your-messaging-platform)\n- [Install a Local Command Set](#install-a-local-command-set)\n- [Publish a Command Set](#publish-a-command-set)\n- [Invoke Commands Using API](#Invoke-Commands-Using-API)\n- [Support](#support)\n- [License](#license)\n\n## Quick Start\n\nThe Nimbella CLI provides a convenient command-line and REPL-interface for [Commander](https://nimbella.com/product/commander). Please follow [this guide](https://nimbella.io/downloads/nim/nim.html#install-nim-globally) to install the Nimbella CLI.\n\nYou need to run the following login command before you can use the Nimbella CLI.\n\n```sh\n$ nim login\n```\n\nRun `nim commander help` to learn how to use Commander from your terminal.\n\n```\n$ nim commander help\nCommander CLI\nA CLI to interact with Commander from your terminal.\n\nUSAGE\n$ nim commander - launch Commander REPL\n$ nim commander help - display help for Commander CLI\n$ nim commander docs - open documentation\n$ nim commander \u003ccommand\u003e [command_params/command_options] - run commander commands\n\nREPL Commands\nexit - exit the repl\nclear - clear the repl\nhelp - display help in repl\nhistory - show recently executed commands\n\nCommander Commands\ncommand_create \u003ccommand\u003e [\u003cparameters\u003e] ... - Creates a command \u0026 opens online source editor\ncsm_install \u003ccommand-set\u003e - Install from Nimbella Command Set Registry: https://github.com/nimbella/command-sets\ncsm_install /path/to/your/command-set - Install a local Command Set\ncsm_install github:\u003cowner\u003e/\u003crepository\u003e - Install a Command Set hosted on GitHub\n\nPlease refer https://nimbella.com/resources-commander/reference to learn about Commander commands.\n```\n\n## Install a Command Set\n\nThere are two ways to interact with Commander from the terminal. The first is the read–eval–print loop or REPL interface and the second is executing Commander commands as subcommands of `nim commander` (ex: `nim commander csm_list`). We will use the REPL to show you how to install a new Command Set.\n\nRun the following to enter the REPL:\n\n```sh\n$ nim commander\n```\n\n**Note:** It may take up to 30 seconds to complete this command the first time you run it, as the system may need to perform some configuration to enable your Nimbella account for Commander.\n\nCommand Sets are installed using the `csm_install` command followed by the name of the Command Set. For example, to install the [`dig` Command Set](https://github.com/nimbella/command-sets/tree/master/dig), execute the command shown below.\n\n```\nnc\u003e csm_install dig\n```\n\nThe output will resemble what is shown below.\n\n```\nnc\u003e csm_install dig\nInstalled dig command-set for app nc, containing the following commands:\ndig: Perform DNS queries.\n```\n\nThe Unix `dig` command allows you to query DNS records for hostnames. Now we can run it as a Command as in the example below.\n\n```\nnc\u003e dig nimbella.com A\nnimbella.com Type: A TTL: 19 IP: 157.245.130.6\n```\n\nCheckout [Nimbella Command Set Registry](https://github.com/nimbella/command-sets) for more Command Sets.\n\n## Develop a Command Set\n\nThe Nimbella CLI helps you develop and test Command Sets for Commander directly from your laptop or personal machine.\n\nLet's kick start the development process with `command_set create`. The command requires an additional parameter which is the name of the Command Set.\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg alt=\"command_set create demo\" src=\".github/media/commandset_create.gif\" \u003e\n\u003c/div\u003e\n\nAfter you've run the command in the REPL and answered the questions, a directory is created with all the necessary files generated so you can get started.\n\nThe directory structure for the `greet` example will be resemble the following:\n\n```sh\ngreet\n├── README.md\n├── commands.yaml\n└── packages\n    └── greet\n        ├── hello.js\n        └── hola.js\n```\n\nThe template generation includes sample code, so you can immediately install the Command Set and try it out. The same project contains two commands, one called `hello` and the other called `hola`. Try running the commands shown next. Each command runs a function with returns a standard place holder response.\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg alt=\"command_set create demo\" src=\".github/media/install_and_run.gif\" \u003e\n\u003c/div\u003e\n\nYou may edit the sample code to implement your desired logic for each command. Each command corresponds to a function in the corresponding file. The function accepts certain parameters which may be used in the code. For example, the change below will modify the command `hello` to greet a user by name. To make this change, edit `greet/packages/greet/hello.js` using your favorite code editor, and edit the `text` property inside the object returned by `_command`.\n\n```diff\nreturn {\n    response_type: 'in_channel', // or `ephemeral` for private response\n-    text:\n-      'This is a default response for a newly created command with text: ' +\n-     commandText,\n+    text: `Hello, ${params.name}!`,\n  };\n```\n\nFor this to take effect in Commander, we need to update the code using `csm_update`.\n\n\u003cdiv align=\"center\"\u003e\n\u003cimg alt=\"command_set create demo\" src=\".github/media/update_and_run.gif\" \u003e\n\u003c/div\u003e\n\nCongrats! You now know how to develop a Command Set using the Commander CLI. Try to modify `hola` now on your own.\n\n## Login to Your Messaging Platform\n\nYou need a `cli-login` token to login to your messaging platform (Slack, Mattermost, Teams) from Commander CLI.\n\n**Run `/nc app_info` in your messaging platform to obtain the `cli-login` token.**\n\nAfter you've obtained the token, run the below command with your token in Commander CLI to login to your messaging platform.\n\n```\nnc\u003e client login \u003cyour_login_token\u003e\n```\n\nYou can also switch the login context between CLI and messaging platform by running `client switch`.\n\n```\nnc\u003e client switch\n```\n\n## Install a Local Command Set\n\nIn this section, you will learn how to install a Command Set whose code is on your local machine.\n\nYou need to provide the location of the Command Set to `csm_install` to install it.\n\n```\nnc\u003e csm_install /your/path/to/greet\n```\n\n\u003e **Note**: even relative paths work.\n\nThat’s it. You can now run the commands available in your locally developed command set from the Commander CLI.\n\nTo be able to access these commands from messaging platforms, you need to run the same command, but you should do it **after** you've logged in to your messaging platform from Commander CLI.\n\n## Publish a Command Set\n\nThere are two options to distribute and share a Command Set that you develop: via your GitHub Repository or via the Nimbella Command Set Registry.\n\n1. Publish as a GitHub Repository\n\n   Create a GitHub repository with your code and make sure `commands.yaml` is at the root of the repository.\n\n   To install Command Sets that are published as GitHub repositories, you need to run `/nc csm_install github:\u003cyour_github_username\u003e/\u003crepository_name\u003e`. Ex: `/nc csm_install github:nimbella/greet`\n\n2. Publish to Nimbella Command Set Registry\n\n   Make a Pull Request to our [registry](https://github.com/nimbella/command-sets) with your Command Set. See our [contribution](https://github.com/nimbella/command-sets/blob/master/CONTRIBUTING.md) guide on the registry to learn more.\n\n   After your Command Set is in the registry, you can install it by running: `/nc csm_install \u003ccommand_set_name\u003e`. Ex: `/nc csm_install greet`\n\n## Invoke Commands Using API\n\nAny command of a Command Set that's installed can be invoked programmatically.\n\nUse `api_get` to get an endpoint for a command.\n\nThe output will also include the credentials required to execute the command. I've redacted them here.\n\n```\nnc\u003e api_get hello Nimbella\nCommand parameters:\n    {\n      \"user_id\": \"...\",\n      \"team_id\": \"...\",\n      \"command\": \"/nc\",\n      \"syncRequest\": \"true\",\n      \"text\": \" hello Nimbella\"\n    }\n\n    You can invoke the command with nim by running:\n\n    nim action invoke --auth=...:... /nc/portal/cli-gateway --result  -p __ow_headers '{\"accept\": \"application/json\", \"content-type\": \"application/x-www-form-urlencoded\", \"user-agent\": \"commander-cli\" }' -p command /nc -p syncRequest '\"true\"' -p text ' hello Nimbella' -p user_id ... -p team_id ...\n\n    You can also invoke the command with curl by running:\n\n    curl -H \"Content-Type: application/json\" -H \"User-Agent: commander-cli\" --user \"...:...\" --data '{\"user_id\":\"...\",\"team_id\":\"...\",\"command\":\"/nc\",\"syncRequest\":\"true\",\"text\":\" hello Nimbella\"}' -X POST https://apigcp.nimbella.io/api/v1/web/nc/portal/cli-gateway\n```\n\n## Support\n\nWe're always happy to help you with any issues you encounter. You may want to [join our Slack community](https://nimbella-community.slack.com) to engage with us for a more rapid response.\n\n## License\n\nApache-2.0. See [LICENSE](LICENSE) to learn more.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnimbella%2Fcommander-cli","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnimbella%2Fcommander-cli","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnimbella%2Fcommander-cli/lists"}