๐ป CTO.ai Ops - The CLI built for Teams ๐
$ npm install -g @cto.ai/ops
$ ops COMMAND
running command...
$ ops (-v|--version|version)
@cto.ai/ops/1.8.6 darwin-x64 node-v11.14.0
$ ops --help [COMMAND]
USAGE
$ ops COMMAND
...ops account:resetops account:signinops account:signoutops account:signupops account:supportops add [OPNAME]ops build [PATH]ops cleanup [OPNAME]ops configs:deleteops configs:listops configs:setops help [COMMAND]ops init [NAME]ops listops publish PATHops remove OPops run [NAMEORPATH]ops search [FILTER]ops secrets:deleteops secrets:listops secrets:registerops secrets:setops secrets:unregisterops team:createops team:infoops team:inviteops team:joinops team:listops team:remove [MEMBER]ops team:switchops updateops whoami
Reset your password.
USAGE
$ ops account:reset
Log in to your account.
USAGE
$ ops account:signin
OPTIONS
-h, --help show CLI help
Log out from your account.
USAGE
$ ops account:signout
OPTIONS
-h, --help show CLI help
Creates an account to use with ops CLI.
USAGE
$ ops account:signup
OPTIONS
-h, --help show CLI help
Contact our support team with questions.
USAGE
$ ops account:support
OPTIONS
-h, --help show CLI help
Add an op to your team.
USAGE
$ ops add [OPNAME]
ARGUMENTS
OPNAME Name of the public op to be added to your team. It should be of the format - @teamname/opName:versionName
OPTIONS
-h, --help show CLI help
Build your op for sharing.
USAGE
$ ops build [PATH]
ARGUMENTS
PATH Path to the op you want to build.
OPTIONS
-h, --help show CLI help
Clean up locally cached docker images.
USAGE
$ ops cleanup [OPNAME]
ARGUMENTS
OPNAME Name of the op to be cleaned up
OPTIONS
-h, --help show CLI help
Delete a config stored for the active team
USAGE
$ ops configs:delete
OPTIONS
-h, --help show CLI help
-k, --key=key Secret Key Name
List all the configs that are stored for the active team
USAGE
$ ops configs:list
OPTIONS
-h, --help show CLI help
Add a new config key & value
USAGE
$ ops configs:set
OPTIONS
-f, --from-file=from-file path to a file containing the value of the config to set
-k, --key=key the key of the config to set
-v, --value=value the value of the config to set
display help for ops
USAGE
$ ops help [COMMAND]
ARGUMENTS
COMMAND command to show help for
OPTIONS
--all see all commands in CLI
See code: @oclif/plugin-help
Easily create a new Op.
USAGE
$ ops init [NAME]
ARGUMENTS
NAME the name of the op to create
OPTIONS
-h, --help show CLI help
Lists the Ops you have in your team.
USAGE
$ ops list
OPTIONS
-h, --help show CLI help
Publish an Op to your team.
USAGE
$ ops publish PATH
ARGUMENTS
PATH Path to the op you want to publish.
OPTIONS
-h, --help show CLI help
Remove an Op from your team.
USAGE
$ ops remove OP
ARGUMENTS
OP The name and version of the command or workflow you want to remove. E.g. my-command:0.1.0
OPTIONS
-h, --help show CLI help
Run an Op from your team or the registry.
USAGE
$ ops run [NAMEORPATH]
ARGUMENTS
NAMEORPATH Name or path of the Op you want to run.
OPTIONS
-B, --batch Runs the op in non-interactive batch mode.
-b, --build Builds the op before running. Must provide a path to the op.
-h, --help show CLI help
Search for ops in your workspaces.
USAGE
$ ops search [FILTER]
ARGUMENTS
FILTER Filters Op results which include filter text in Op name or description.
OPTIONS
-h, --help show CLI help
Delete a secret stored for the active team
USAGE
$ ops secrets:delete
OPTIONS
-h, --help show CLI help
-k, --key=key Secret Key Name
List all the keys that are stored for the active team
USAGE
$ ops secrets:list
OPTIONS
-h, --help show CLI help
Register a secrets provider for a team
USAGE
$ ops secrets:register
Add a key & value
USAGE
$ ops secrets:set
OPTIONS
-f, --from-file=from-file path to a file containing the value of the secret to set
-k, --key=key the key of the secret to set
-v, --value=value the value of the secret to set
Unregister a secrets provider for a team
USAGE
$ ops secrets:unregister
Create your team.
USAGE
$ ops team:create
OPTIONS
-h, --help show CLI help
-n, --name=name
Shows basic team information for the team you are currently on.
USAGE
$ ops team:info
OPTIONS
-h, --help show CLI help
Invite your team members.
USAGE
$ ops team:invite
OPTIONS
-h, --help show CLI help
-i, --invitees=invitees A comma-separated string of usernames/emails we want to invite. E.g. ("user1,
user2@gmail.com, user3@something")
Accept an invite to join a team.
USAGE
$ ops team:join
Shows the list of your teams.
USAGE
$ ops team:list
OPTIONS
-h, --help show CLI help
Remove your team members.
USAGE
$ ops team:remove [MEMBER]
ARGUMENTS
MEMBER The username of the team member you want to remove from the team.
OPTIONS
-h, --help show CLI help
Switch your currently active team.
USAGE
$ ops team:switch
OPTIONS
-h, --help show CLI help
Update the Ops CLI.
USAGE
$ ops update
OPTIONS
-h, --help show CLI help
Display your user information
USAGE
$ ops whoami
OPTIONS
-h, --help show CLI help
Useful reference for writing tests:
- https://github.com/oclif/command/blob/master/src/command.ts
- https://github.com/oclif/config/blob/master/src/plugin.ts
Isolate tests (run only specific tests in that file):
test.only('it should run only tests suffixed with .only', async () => {
npm testornpm t
Run a single unit test, or filter them by filename:
npx jest --testPathPattern=keycloak
The CLI has a number of robused E2E tests that are hosted inside of CTO.ai's private CI/CD infra.
We are planning to expose this system via Github Actions in the future, but for now, a CTO.ai team member will review your PR and test coverage.
The default test server is staging, but you can override this by passing in your own OPS_REGISTRY_HOST and OPS_API_HOST values from your shell config.
Run tests against staging (as part of the CTO.ai platform developer workflow):
- Run
npm run configdevto point the ops binary at the development Typescript app (instead of the production Javascript bundle) - Ensure you have a
.env.stagingfile (you can generate one by running scripts/make-env.sh) - Set your
NODE_ENVto 'staging':export NODE_ENV=staging npm run test:e2e
Run tests against Minikube (as part of the CTO.ai platform developer workflow):
- Create a user in Keycloak with the following credentials:
- username: 'existing_user'
- email: 'e2e_existing_user1@cto.ai'
- password: 'password'
- Change the userID in
test_e2e/utils/constants.ts EXISTING_USER_IDto Step 1's userID - Create
existing_userteam in Database if haven't already - Change the teamID in
teste2e/utils/constants.ts EXISTING_TEAM_IDto step 3's teamID - Create a
cto.aiteam in Database if haven't already - Publish this following command:
- Team: โcto.aiโ
- name: โgithubโ
- version: โlatestโ
- public: true
- Publish the
write_a_file_opcommand found intest_e2e/sample_ops/write_a_file_op - Publish the
echo_message_workflowworkflow found intest_e2e/sample_ops/echo_message_workflow - Add the
ops-cli-confidentialclient to Keycloak. Theops-cli-confidential.jsonfile can be found in Keybase - Run
npm run configdevto point the ops binary at the development Typescript app (instead of the production Javascript bundle) - Ensure you have a
.env.testfile (you can generate one by running scripts/make-env.sh) - Modify the vars in
.env.testto match your minikube IP - Update
OPS_CLIENT_SECRETin the.env.testto be thesecret valuefound under thecredentialstab in theops-cli-confidentialclient - Set your
NODE_ENVto 'test':export NODE_ENV=test npm run test:e2e
Run a single E2E test, or filter test files by filename:
npm run test:e2e --testPathPattern=signin
