OpenCSI

copied

Background

copied

OpenCSI stands for Open Command Set Interface. Similar to how OpenAPI decribes an API, OpenCSI describes a set of commands.

An OpenCSI description is YAML format file that describes a set of commands, the parameters they take and (usually) the location for the source code for each command.

You can install an OpenCSI-described command set into a messaging app in Commander using the csm_install command.

This command set containing these 3 commands:

  1. host_add <hostname> <ip_address> -ttl <seconds> -just_a_flag This first command has a description of "Adds a host" and the source code of the command is located at https://cdn.jsdelivr.net/gh/ericswildens/shepard@latest/src/host_add.js
  2. host_delete <hostname> This second command has a description of "Deletes a host" and the source code of the command is located at https://cdn.jsdelivr.net/gh/ericswildens/shepard@latest/src/host_delete.js
  3. host_list <match> This third command has a description of host_list "Lists hosts" and the source code of the command is located at https://cdn.jsdelivr.net/gh/ericswildens/shepard@latest/src/host_list.js

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: demo@nimbella.com
  license:
     name: Apache 2.0
     url: 'http://www.apache.org/licenses/LICENSE-2.0.html'
sourceBasePath: https://cdn.jsdelivr.net/gh/ericswildens/shepard@latest/src
commands:
  host_add:
     sourcePath: /host_add.js
     description: Adds a host
     parameters:
        - name: hostname
        - name: ip_address
          optional: true
     options:
        - name: ttl
          value: seconds
        - name: just_a_flag
  host_delete:
     sourcePath: /host_delete.js
     description: Deletes a host
     parameters:
        - name: hostname
  host_list:
     sourcePath: /host_list.js
     description: Lists hosts
     parameters:
        - name: match