@tonbo/cli 0.11.1 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -3
- package/dist/bin/tonbo.js +2046 -1028
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -13,15 +13,20 @@ tonbo --version
|
|
|
13
13
|
tonbo login
|
|
14
14
|
tonbo database create notes
|
|
15
15
|
tonbo database list --json
|
|
16
|
+
tonbo database list --account acme
|
|
16
17
|
```
|
|
17
18
|
|
|
18
|
-
`tonbo --help` prints the rules every command shares (output and `--json`, pages, exit status,
|
|
19
|
+
`tonbo --help` prints the rules every command shares (output and `--json`, pages, exit status, the login, accounts and keys, retried creations, destructive commands) and the environment variables the CLI reads; `tonbo <command> --help` prints what one command does, its arguments, each flag with its default, and an example. The same words, with the operation each command calls and what its `--json` prints, are the CLI reference at [tonbo.dev/docs/reference/cli](https://tonbo.dev/docs/reference/cli).
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
## Sign in
|
|
22
|
+
|
|
23
|
+
`tonbo login` signs this computer in as you, once ([ADR-0018](../../apps/user-center/docs/decisions/adr-0018-one-cli-login-per-person.md)): every account you belong to is reachable with `--account <name>`, with your role in each, and joining an organization needs no new login. A command acts in `--account`, else `TONBO_ACCOUNT`, else the default `tonbo account use <name>` sets, else your personal account; `tonbo account list` lists your accounts. For each request the CLI exchanges the login for a short-lived token of that one account, so the login itself never reaches a resource server. It works only on the computer that logged in, ends after 30 days unused or 180 days at most, and is listed and revoked on the console's Sign-in sessions page. `TONBO_API_KEY` takes its place for CI and Agents: an API key reaches only its own account.
|
|
24
|
+
|
|
25
|
+
The login file, `login.json`, and the device id it is tied to are shared with [`yield`](../yield) through `@tonbo/cli-core`, by the contract [`credentials-v2.json`](../../contracts/cli/credentials-v2.json). A login an earlier release saved, `credentials.json` ([`credentials-v1.json`](../../contracts/cli/credentials-v1.json)), is read only when there is no `login.json`.
|
|
21
26
|
|
|
22
27
|
## Commands and the Management API
|
|
23
28
|
|
|
24
|
-
Every command other than `login` and `logout` is named by one operation of the [Management API](../../contracts/management/openapi-v1.yaml) through its `x-tonbo-cli` and calls that operation, plus reads of the same resource (a `--wait`, the Machine a `name_taken` refusal names, the activations `machine show` reads for the last end, or the Volume a `machine create` or `update --volume` names, read for its id and region); `tonbo machine logs`, once it ships, is the named Streams exception, reading the stream at the Machine's `logs.url`. The command set and the operations tagged with a command are the same set, which `test/commands.test.ts` checks in both directions. The CLI resolves each request from the operation table of the internal package [`@tonbo/cli-core`](../../packages/tonbo-cli-core) (`src/generated/contracts.ts`, which `pnpm --filter @tonbo/cli-core generate:contracts` derives from the contract). `login` and `
|
|
29
|
+
Every command other than `login` and `logout` is named by one operation of the [Management API](../../contracts/management/openapi-v1.yaml) through its `x-tonbo-cli` and calls that operation, plus reads of the same resource (a `--wait`, the Machine a `name_taken` refusal names, the activations `machine show` reads for the last end, or the Volume a `machine create` or `update --volume` names, read for its id and region); `tonbo machine logs`, once it ships, is the named Streams exception, reading the stream at the Machine's `logs.url`. The command set and the operations tagged with a command are the same set, which `test/commands.test.ts` checks in both directions. The CLI resolves each request from the operation table of the internal package [`@tonbo/cli-core`](../../packages/tonbo-cli-core) (`src/generated/contracts.ts`, which `pnpm --filter @tonbo/cli-core generate:contracts` derives from the contract). `login`, `logout`, `account list` and `account use` are the named exception: they obtain, choose among and discard what the other commands present as their Bearer credential. What a command may do is what your role in the account it acts in allows; the CLI never decides it.
|
|
25
30
|
|
|
26
31
|
The help lives with the commands: [`src/app.ts`](src/app.ts) defines each command, its arguments and flags with their one-line descriptions, and [`src/help.ts`](src/help.ts) holds the long help, each flag's default, the examples, the shared rules and the environment. [`commands.json`](commands.json) is all of it as `--help` prints it, which the docs' CLI reference renders; `test/commands.test.ts` holds it to the program, and holds every runnable command to its details and example and the environment list to the variables the code reads, so after changing a command run `pnpm --filter @tonbo/cli commands`.
|
|
27
32
|
|