@kutrion/cli 1.1.6 → 1.2.1
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 +57 -9
- package/dist/index.js +5044 -667
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -17,15 +17,21 @@ kt --version
|
|
|
17
17
|
|
|
18
18
|
`npm i -g @kutrion/cli` does not work: the package is not on the public npm registry.
|
|
19
19
|
|
|
20
|
-
## First
|
|
20
|
+
## First sign-in
|
|
21
21
|
|
|
22
22
|
```sh
|
|
23
23
|
kt --base https://kutrion.com login --email you@example.com
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
`login` prompts for the password (and a 2FA code when the account has one), so neither lands in shell
|
|
27
|
-
history
|
|
28
|
-
|
|
27
|
+
history. A script pipes the password instead, with `--code` when the account has a second factor:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
printf '%s\n' "$KT_PASSWORD" | kt login --email you@example.com --password-stdin
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
A successful login saves the server to `~/.config/kutrion/config.json`, so every command after it
|
|
34
|
+
needs no `--base`:
|
|
29
35
|
|
|
30
36
|
```sh
|
|
31
37
|
kt whoami
|
|
@@ -36,6 +42,23 @@ kt ssh <connId>
|
|
|
36
42
|
kt --help
|
|
37
43
|
```
|
|
38
44
|
|
|
45
|
+
`kt get` prints a credential with its value hidden; add `--reveal` to print the value. `kt cred add`
|
|
46
|
+
and `kt cred set` prompt for the value, or read it from stdin with `--value-stdin`. `kt export <vaultId>
|
|
47
|
+
<file>` and `kt audit export <file>` write the file owner-only (mode 0600), tightening an existing file
|
|
48
|
+
before writing to it.
|
|
49
|
+
|
|
50
|
+
Secrets passed as flags (`--password`, `--value`, and `--token` on `kt run`, `kt mcp` and
|
|
51
|
+
`kt ci-login`) are refused before anything is sent: a flag lands in shell history and in the process
|
|
52
|
+
list. Use `--password-stdin`, `--value-stdin`, `KT_AGENT_TOKEN` or `KT_ID_TOKEN` instead.
|
|
53
|
+
|
|
54
|
+
Saved layouts, the account-synced arrangement the web app opens at sign-in, are `kt layouts`,
|
|
55
|
+
`kt layout create <name> [--default]` and `kt layout rm <id>`.
|
|
56
|
+
|
|
57
|
+
Snippets, the saved commands kept in vaults, are `kt snippets`, `kt snippet show <name|id>` and
|
|
58
|
+
`kt snippet run <name|id> --conn <connId> [--insert]`. `run` prints the whole command, opens a
|
|
59
|
+
brokered shell and has the server type it there, with the use recorded in the audit log; `--insert`
|
|
60
|
+
places it at the prompt without pressing Enter.
|
|
61
|
+
|
|
39
62
|
Use the address exactly as written. The CLI does not follow a redirect on a login: a redirected POST
|
|
40
63
|
is re-sent without its body, so `kt` stops and prints the address the server pointed to instead.
|
|
41
64
|
|
|
@@ -46,16 +69,41 @@ keychain, `KT_TOKEN_STORE=file` keeps the token in `~/.config/kutrion/token` (mo
|
|
|
46
69
|
|
|
47
70
|
Precedence is `--base`, then `KT_API_BASE`, then the saved server, and only `login` writes it:
|
|
48
71
|
`--base` on any other command is a one-off that reads a different server without changing the saved
|
|
49
|
-
one. To switch servers,
|
|
50
|
-
never crossed and
|
|
72
|
+
one. To switch servers, sign in again; each server's token is filed under its own URL, so sessions are
|
|
73
|
+
never crossed and signing in to one does not end the other. `logout` clears the token for the current
|
|
51
74
|
server and leaves the saved URL, so the next `login` needs no flag either.
|
|
52
75
|
|
|
53
76
|
Environment variables set under the names earlier CLI releases used are still read when the `KT_`
|
|
54
77
|
name is not set, so an existing shell profile or assistant config keeps working.
|
|
55
78
|
|
|
79
|
+
## Scripting: exit status and `--json`
|
|
80
|
+
|
|
81
|
+
The exit status says what kind of failure it was, so a script can branch without parsing text:
|
|
82
|
+
|
|
83
|
+
| Status | Meaning |
|
|
84
|
+
|---|---|
|
|
85
|
+
| 0 | Success |
|
|
86
|
+
| 1 | Any other failure: bad usage, an unknown flag, a transport error, another 4xx |
|
|
87
|
+
| 2, 3 | Transfer commands only: partial transfer, and a job still running after the wait |
|
|
88
|
+
| 10 | Not signed in, or the session was refused (HTTP 401) |
|
|
89
|
+
| 11 | Needs a plan the organization does not have (402) |
|
|
90
|
+
| 12 | Refused: permission, policy or step-up (403) |
|
|
91
|
+
| 13 | Not found (404) |
|
|
92
|
+
| 14 | Conflict with the current state (409) |
|
|
93
|
+
| 15 | Rate limited (429) |
|
|
94
|
+
| 16 | Server error (5xx) |
|
|
95
|
+
|
|
96
|
+
`kt exec` exits with the remote command's own status, with or without `--json`.
|
|
97
|
+
|
|
98
|
+
With `--json`, stdout carries only JSON. A failure is one object on stdout,
|
|
99
|
+
`{ "error": "<code>", "status": <http status>, "exit_code": <n>, "message": "<text>" }` (`status` only
|
|
100
|
+
when the server answered), and prompts go to stderr. A flag no command takes is refused before
|
|
101
|
+
anything is sent. Answers to prompts can be piped, one per line; a prompt with no line left fails
|
|
102
|
+
instead of exiting 0.
|
|
103
|
+
|
|
56
104
|
## Connect an AI assistant (`kt mcp install`)
|
|
57
105
|
|
|
58
|
-
Once
|
|
106
|
+
Once signed in, wire an assistant to Kutrion through the CLI's MCP bridge. Your organization's plan
|
|
59
107
|
needs agent access:
|
|
60
108
|
|
|
61
109
|
```sh
|
|
@@ -121,17 +169,17 @@ On GitLab, the job's OIDC token comes from an `id_tokens:` block that exposes it
|
|
|
121
169
|
with the audience your trust is registered for. On GitHub Actions, give the job
|
|
122
170
|
`permissions: id-token: write` and `ci-login` requests the token itself.
|
|
123
171
|
|
|
124
|
-
**How a pipeline authenticates.** With `KT_AGENT_TOKEN` set
|
|
172
|
+
**How a pipeline authenticates.** With `KT_AGENT_TOKEN` set, `kt run` runs
|
|
125
173
|
as that pipeline principal and sends its steps to the server's agent endpoint (`/mcp`) rather than to
|
|
126
174
|
the REST API. It has to: a principal from `ci-login` is an opaque `vta_` token, and every REST route
|
|
127
175
|
verifies a JWT, so an exchanged principal authenticates nothing there. Routing through the agent
|
|
128
|
-
endpoint is also what subjects each step to the
|
|
176
|
+
endpoint is also what subjects each step to the organization's agent tool policy and records it in
|
|
129
177
|
the flight recorder against the pipeline's identity. Without that variable `kt run` uses your own
|
|
130
178
|
stored session over REST, unchanged. `--dry-run` needs neither.
|
|
131
179
|
|
|
132
180
|
Two things differ on the pipeline path. A `get` step receives the file as broker-redacted UTF-8 text
|
|
133
181
|
capped at 1MB rather than raw bytes, and the step says so in its output — do not use it to move a
|
|
134
|
-
binary. And a step the
|
|
182
|
+
binary. And a step the organization gates on a human approval is refused rather than waited on, since
|
|
135
183
|
a pipeline has nobody to ask.
|
|
136
184
|
|
|
137
185
|
Reporters are `console`, `junit` and `json`. The JUnit document is standard `<testsuites>` XML; a
|