UNPKG

8.79 kBMarkdownView Raw
1# ops
2
3💻 CTO.ai Ops - The CLI built for Teams 🚀
4
5[![oclif](https://img.shields.io/badge/cli-oclif-brightgreen.svg)](https://oclif.io)
6[![Version](https://img.shields.io/npm/v/ops.svg)](https://npmjs.org/package/ops)
7[![Downloads/week](https://img.shields.io/npm/dw/ops.svg)](https://npmjs.org/package/ops)
8[![License](https://img.shields.io/npm/l/ops.svg)](https://github.com/cto.ai/ops/blob/master/package.json)
9
10<!-- toc -->
11* [ops](#ops)
12* [Usage](#usage)
13* [Commands](#commands)
14* [Testing](#testing)
15<!-- tocstop -->
16
17# Usage
18
19<!-- usage -->
20```sh-session
21$ npm install -g @cto.ai/ops
22$ ops COMMAND
23running command...
24$ ops (-v|--version|version)
25@cto.ai/ops/1.5.18 darwin-x64 node-v12.9.1
26$ ops --help [COMMAND]
27USAGE
28 $ ops COMMAND
29...
30```
31<!-- usagestop -->
32
33# Commands
34
35<!-- commands -->
36* [`ops account:reset`](#ops-accountreset)
37* [`ops account:signin`](#ops-accountsignin)
38* [`ops account:signout`](#ops-accountsignout)
39* [`ops account:signup`](#ops-accountsignup)
40* [`ops account:support`](#ops-accountsupport)
41* [`ops build [PATH]`](#ops-build-path)
42* [`ops cleanup [OPNAME]`](#ops-cleanup-opname)
43* [`ops help [COMMAND]`](#ops-help-command)
44* [`ops init`](#ops-init)
45* [`ops list`](#ops-list)
46* [`ops publish PATH`](#ops-publish-path)
47* [`ops remove [OPNAME]`](#ops-remove-opname)
48* [`ops run [NAMEORPATH]`](#ops-run-nameorpath)
49* [`ops search [FILTER]`](#ops-search-filter)
50* [`ops team:create`](#ops-teamcreate)
51* [`ops team:invite`](#ops-teaminvite)
52* [`ops team:join`](#ops-teamjoin)
53* [`ops team:switch`](#ops-teamswitch)
54* [`ops update`](#ops-update)
55* [`ops whoami`](#ops-whoami)
56
57## `ops account:reset`
58
59Reset your password.
60
61```
62USAGE
63 $ ops account:reset
64```
65
66_See code: [src/commands/account/reset.ts](https://github.com/cto.ai/ops/blob/v1.5.18/src/commands/account/reset.ts)_
67
68## `ops account:signin`
69
70Logs in to your account.
71
72```
73USAGE
74 $ ops account:signin
75
76OPTIONS
77 -h, --help show CLI help
78```
79
80_See code: [src/commands/account/signin.ts](https://github.com/cto.ai/ops/blob/v1.5.18/src/commands/account/signin.ts)_
81
82## `ops account:signout`
83
84Log out from your account.
85
86```
87USAGE
88 $ ops account:signout
89
90OPTIONS
91 -h, --help show CLI help
92```
93
94_See code: [src/commands/account/signout.ts](https://github.com/cto.ai/ops/blob/v1.5.18/src/commands/account/signout.ts)_
95
96## `ops account:signup`
97
98Creates an account to use with ops CLI.
99
100```
101USAGE
102 $ ops account:signup
103
104OPTIONS
105 -h, --help show CLI help
106```
107
108_See code: [src/commands/account/signup.ts](https://github.com/cto.ai/ops/blob/v1.5.18/src/commands/account/signup.ts)_
109
110## `ops account:support`
111
112Contact our support team with questions.
113
114```
115USAGE
116 $ ops account:support
117
118OPTIONS
119 -h, --help show CLI help
120```
121
122_See code: [src/commands/account/support.ts](https://github.com/cto.ai/ops/blob/v1.5.18/src/commands/account/support.ts)_
123
124## `ops build [PATH]`
125
126Build your op for sharing.
127
128```
129USAGE
130 $ ops build [PATH]
131
132ARGUMENTS
133 PATH Path to the op you want to build.
134
135OPTIONS
136 -h, --help show CLI help
137```
138
139_See code: [src/commands/build.ts](https://github.com/cto.ai/ops/blob/v1.5.18/src/commands/build.ts)_
140
141## `ops cleanup [OPNAME]`
142
143Clean up locally cached docker images.
144
145```
146USAGE
147 $ ops cleanup [OPNAME]
148
149ARGUMENTS
150 OPNAME Name of the op to be cleaned up
151
152OPTIONS
153 -h, --help show CLI help
154```
155
156_See code: [src/commands/cleanup.ts](https://github.com/cto.ai/ops/blob/v1.5.18/src/commands/cleanup.ts)_
157
158## `ops help [COMMAND]`
159
160display help for ops
161
162```
163USAGE
164 $ ops help [COMMAND]
165
166ARGUMENTS
167 COMMAND command to show help for
168
169OPTIONS
170 --all see all commands in CLI
171```
172
173_See code: [@oclif/plugin-help](https://github.com/oclif/plugin-help/blob/v2.1.6/src/commands/help.ts)_
174
175## `ops init`
176
177Easily create a new op.
178
179```
180USAGE
181 $ ops init
182
183OPTIONS
184 -h, --help show CLI help
185```
186
187_See code: [src/commands/init.ts](https://github.com/cto.ai/ops/blob/v1.5.18/src/commands/init.ts)_
188
189## `ops list`
190
191Lists the ops you have in your team
192
193```
194USAGE
195 $ ops list
196
197OPTIONS
198 -h, --help show CLI help
199```
200
201_See code: [src/commands/list.ts](https://github.com/cto.ai/ops/blob/v1.5.18/src/commands/list.ts)_
202
203## `ops publish PATH`
204
205Publish an op to a team.
206
207```
208USAGE
209 $ ops publish PATH
210
211ARGUMENTS
212 PATH Path to the op you want to publish.
213
214OPTIONS
215 -h, --help show CLI help
216```
217
218_See code: [src/commands/publish.ts](https://github.com/cto.ai/ops/blob/v1.5.18/src/commands/publish.ts)_
219
220## `ops remove [OPNAME]`
221
222Remove an op from a team.
223
224```
225USAGE
226 $ ops remove [OPNAME]
227
228ARGUMENTS
229 OPNAME A part of the name or description of the command or workflow you want to remove.
230
231OPTIONS
232 -h, --help show CLI help
233```
234
235_See code: [src/commands/remove.ts](https://github.com/cto.ai/ops/blob/v1.5.18/src/commands/remove.ts)_
236
237## `ops run [NAMEORPATH]`
238
239Run an op from the registry.
240
241```
242USAGE
243 $ ops run [NAMEORPATH]
244
245ARGUMENTS
246 NAMEORPATH Name or path of the command or workflow you want to run.
247
248OPTIONS
249 -b, --build Builds the op before running. Must provide a path to the op.
250 -h, --help show CLI help
251```
252
253_See code: [src/commands/run.ts](https://github.com/cto.ai/ops/blob/v1.5.18/src/commands/run.ts)_
254
255## `ops search [FILTER]`
256
257Search for ops in your workspaces.
258
259```
260USAGE
261 $ ops search [FILTER]
262
263ARGUMENTS
264 FILTER Filters op results which include filter text in op name or description.
265
266OPTIONS
267 -h, --help show CLI help
268```
269
270_See code: [src/commands/search.ts](https://github.com/cto.ai/ops/blob/v1.5.18/src/commands/search.ts)_
271
272## `ops team:create`
273
274Create your team.
275
276```
277USAGE
278 $ ops team:create
279
280OPTIONS
281 -h, --help show CLI help
282 -n, --name=name
283```
284
285_See code: [src/commands/team/create.ts](https://github.com/cto.ai/ops/blob/v1.5.18/src/commands/team/create.ts)_
286
287## `ops team:invite`
288
289Invite your team members.
290
291```
292USAGE
293 $ ops team:invite
294
295OPTIONS
296 -h, --help show CLI help
297
298 -i, --invitees=invitees A comma-separated string of usernames/emails we want to invite. E.g. ("user1,
299 user2@gmail.com, user3@something")
300```
301
302_See code: [src/commands/team/invite.ts](https://github.com/cto.ai/ops/blob/v1.5.18/src/commands/team/invite.ts)_
303
304## `ops team:join`
305
306Accept an invite to join a team.
307
308```
309USAGE
310 $ ops team:join
311```
312
313_See code: [src/commands/team/join.ts](https://github.com/cto.ai/ops/blob/v1.5.18/src/commands/team/join.ts)_
314
315## `ops team:switch`
316
317Shows the list of your teams.
318
319```
320USAGE
321 $ ops team:switch
322
323OPTIONS
324 -h, --help show CLI help
325```
326
327_See code: [src/commands/team/switch.ts](https://github.com/cto.ai/ops/blob/v1.5.18/src/commands/team/switch.ts)_
328
329## `ops update`
330
331Update the ops CLI.
332
333```
334USAGE
335 $ ops update
336
337OPTIONS
338 -h, --help show CLI help
339```
340
341_See code: [src/commands/update.ts](https://github.com/cto.ai/ops/blob/v1.5.18/src/commands/update.ts)_
342
343## `ops whoami`
344
345Display your user information
346
347```
348USAGE
349 $ ops whoami
350
351OPTIONS
352 -h, --help show CLI help
353```
354
355_See code: [src/commands/whoami.ts](https://github.com/cto.ai/ops/blob/v1.5.18/src/commands/whoami.ts)_
356<!-- commandsstop -->
357
358
359
360### OClif Source Repo
361
362Useful reference for writing tests:
363
364 * https://github.com/oclif/command/blob/master/src/command.ts
365 * https://github.com/oclif/config/blob/master/src/plugin.ts
366
367
368# Testing
369
370Isolate tests (run only specific tests in that file):
371
372 test.only('it should run only tests suffixed with .only', async () => {
373
374## Unit Tests (`test` directory)
375
376### How to run Unit Tests
377
378 1. `npm test` or `npm t`
379
380### Tips
381
382Run a single unit test, or filter them by filename:
383
384 npx jest --testPathPattern=keycloak
385
386## E2E Tests (`test_e2e` directory)
387
388These are known as "cli-acceptance-tests" in Concourse: https://concourse.stg-platform.hc.ai/teams/main/pipelines/ci/jobs/cli-acceptance/
389
390### How to run E2E tests locally
391
392The 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.
393
394Run tests against staging:
395
396 1. Run `npm run configdev` to point the ops binary at the development Typescript app (instead of the production Javascript bundle)
397 2. Ensure you have a `.env.staging` file (you can generate one by running scripts/make-env.sh)
398 3. Set your `NODE_ENV` to 'staging': `export NODE_ENV=staging`
399 4. `npm run test:e2e`
400
401Run tests against Minikube:
402
403 1. Run `npm run configdev` to point the ops binary at the development Typescript app (instead of the production Javascript bundle)
404 2. Ensure you have a `.env.test` file (you can generate one by running scripts/make-env.sh)
405 3. Modify the vars in `.env.test` to match your minikube IP
406 4. Set your `NODE_ENV` to 'test': `export NODE_ENV=test`
407 5. `npm run test:e2e`
408
409### Tips
410
411Run a single E2E test, or filter test files by filename:
412
413 npm run test:e2e -- --testPathPattern=signin