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 |
|
11 | * [ops](#ops)
|
12 | * [Usage](#usage)
|
13 | * [Commands](#commands)
|
14 | * [Testing](#testing)
|
15 |
|
16 |
|
17 | # Usage
|
18 |
|
19 |
|
20 | ```sh-session
|
21 | $ npm install -g @cto.ai/ops
|
22 | $ ops COMMAND
|
23 | running command...
|
24 | $ ops (-v|--version|version)
|
25 | @cto.ai/ops/1.5.18 darwin-x64 node-v12.9.1
|
26 | $ ops --help [COMMAND]
|
27 | USAGE
|
28 | $ ops COMMAND
|
29 | ...
|
30 | ```
|
31 |
|
32 |
|
33 | # Commands
|
34 |
|
35 |
|
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 |
|
59 | Reset your password.
|
60 |
|
61 | ```
|
62 | USAGE
|
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 |
|
70 | Logs in to your account.
|
71 |
|
72 | ```
|
73 | USAGE
|
74 | $ ops account:signin
|
75 |
|
76 | OPTIONS
|
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 |
|
84 | Log out from your account.
|
85 |
|
86 | ```
|
87 | USAGE
|
88 | $ ops account:signout
|
89 |
|
90 | OPTIONS
|
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 |
|
98 | Creates an account to use with ops CLI.
|
99 |
|
100 | ```
|
101 | USAGE
|
102 | $ ops account:signup
|
103 |
|
104 | OPTIONS
|
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 |
|
112 | Contact our support team with questions.
|
113 |
|
114 | ```
|
115 | USAGE
|
116 | $ ops account:support
|
117 |
|
118 | OPTIONS
|
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 |
|
126 | Build your op for sharing.
|
127 |
|
128 | ```
|
129 | USAGE
|
130 | $ ops build [PATH]
|
131 |
|
132 | ARGUMENTS
|
133 | PATH Path to the op you want to build.
|
134 |
|
135 | OPTIONS
|
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 |
|
143 | Clean up locally cached docker images.
|
144 |
|
145 | ```
|
146 | USAGE
|
147 | $ ops cleanup [OPNAME]
|
148 |
|
149 | ARGUMENTS
|
150 | OPNAME Name of the op to be cleaned up
|
151 |
|
152 | OPTIONS
|
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 |
|
160 | display help for ops
|
161 |
|
162 | ```
|
163 | USAGE
|
164 | $ ops help [COMMAND]
|
165 |
|
166 | ARGUMENTS
|
167 | COMMAND command to show help for
|
168 |
|
169 | OPTIONS
|
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 |
|
177 | Easily create a new op.
|
178 |
|
179 | ```
|
180 | USAGE
|
181 | $ ops init
|
182 |
|
183 | OPTIONS
|
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 |
|
191 | Lists the ops you have in your team
|
192 |
|
193 | ```
|
194 | USAGE
|
195 | $ ops list
|
196 |
|
197 | OPTIONS
|
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 |
|
205 | Publish an op to a team.
|
206 |
|
207 | ```
|
208 | USAGE
|
209 | $ ops publish PATH
|
210 |
|
211 | ARGUMENTS
|
212 | PATH Path to the op you want to publish.
|
213 |
|
214 | OPTIONS
|
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 |
|
222 | Remove an op from a team.
|
223 |
|
224 | ```
|
225 | USAGE
|
226 | $ ops remove [OPNAME]
|
227 |
|
228 | ARGUMENTS
|
229 | OPNAME A part of the name or description of the command or workflow you want to remove.
|
230 |
|
231 | OPTIONS
|
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 |
|
239 | Run an op from the registry.
|
240 |
|
241 | ```
|
242 | USAGE
|
243 | $ ops run [NAMEORPATH]
|
244 |
|
245 | ARGUMENTS
|
246 | NAMEORPATH Name or path of the command or workflow you want to run.
|
247 |
|
248 | OPTIONS
|
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 |
|
257 | Search for ops in your workspaces.
|
258 |
|
259 | ```
|
260 | USAGE
|
261 | $ ops search [FILTER]
|
262 |
|
263 | ARGUMENTS
|
264 | FILTER Filters op results which include filter text in op name or description.
|
265 |
|
266 | OPTIONS
|
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 |
|
274 | Create your team.
|
275 |
|
276 | ```
|
277 | USAGE
|
278 | $ ops team:create
|
279 |
|
280 | OPTIONS
|
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 |
|
289 | Invite your team members.
|
290 |
|
291 | ```
|
292 | USAGE
|
293 | $ ops team:invite
|
294 |
|
295 | OPTIONS
|
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 |
|
306 | Accept an invite to join a team.
|
307 |
|
308 | ```
|
309 | USAGE
|
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 |
|
317 | Shows the list of your teams.
|
318 |
|
319 | ```
|
320 | USAGE
|
321 | $ ops team:switch
|
322 |
|
323 | OPTIONS
|
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 |
|
331 | Update the ops CLI.
|
332 |
|
333 | ```
|
334 | USAGE
|
335 | $ ops update
|
336 |
|
337 | OPTIONS
|
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 |
|
345 | Display your user information
|
346 |
|
347 | ```
|
348 | USAGE
|
349 | $ ops whoami
|
350 |
|
351 | OPTIONS
|
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 |
|
357 |
|
358 |
|
359 |
|
360 | ### OClif Source Repo
|
361 |
|
362 | Useful 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 |
|
370 | Isolate 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 |
|
382 | Run a single unit test, or filter them by filename:
|
383 |
|
384 | npx jest --testPathPattern=keycloak
|
385 |
|
386 | ## E2E Tests (`test_e2e` directory)
|
387 |
|
388 | These 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 |
|
392 | 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.
|
393 |
|
394 | Run 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 |
|
401 | Run 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 |
|
411 | Run a single E2E test, or filter test files by filename:
|
412 |
|
413 | npm run test:e2e -- --testPathPattern=signin
|