OpenCSI stands for Open Command Set Interface. Similar to how OpenAPI describes an API, OpenCSI describes a set of commands.
An OpenCSI description is YAML format file that describes a set of commands and the parameters they take.
The YAML file is expected to be placed in a directory structure that includes the source for the commands described in the YAML file under a "packages" subdirectory.
As an example, if we created a command set called "hoststuff" that included commands "host_add", "host_delete" and "host_list", we would put the commands.yaml in the top level directory.
The full directory structure of the "hoststuff" command set would be:
/commands.yaml /packages/hoststuff/host_add/index.js /packages/hoststuff/host_add/package.json /packages/hoststuff/host_delete/index.js /packages/hoststuff/host_delete/package.json /packages/hoststuff/host_list/index.js /packages/hoststuff/host_list/package.json
With the commands.yaml containing the OpenCSI specification describing the commands and the other files being the source code and dependent packages for each command.
One quick way to start creating your own command set is with one of the examples in the command set registry here:
You can install an OpenCSI-described command set into a Slack app in Commander using the csm_install command.
This command set containing these 3 commands:
- host_add <hostname> <ip_address> [-just_a_flag] This first command requires a hostname parameter, has an optional ip address parameter and 2 options. It has a description of "Adds a host"
- host_delete <hostname> This second command requires a single hostname parameter. It has a description of "Deletes a host"
- host_list <match> This third command requires a single match parameter. It has a description of host_list "Lists hosts"
All 3 commands in this example command set are configured to require an "aws" OAuth provider due to the "oauth: aws" setting. Please read the OAuth Guide for more information about Commander's OAuth integration.
Can be described in OpenCSI with:
OpenCSI: 1.0 info: description: This is the description of the Command Set version: 1.0.0 title: My Command Set termsOfService: 'http://nimbella.com/demo/terms' contact: firstname.lastname@example.org license: name: Apache 2.0 url: 'http://www.apache.org/licenses/LICENSE-2.0.html' commands: host_add: description: Adds a host oauth: aws parameters: - name: hostname - name: ip_address optional: true options: - name: ttl value: seconds - name: just_a_flag host_delete: description: Deletes a host oauth: aws parameters: - name: hostname host_list: description: Lists hosts oauth: aws parameters: - name: match