@primitivedotdev/cli 3.0.0-preview.2 → 3.0.0-preview.20
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 +81 -26
- package/dist/api-command-DXiAX_N2.js +60960 -0
- package/dist/help-inputs-NGARVZL_.js +109 -0
- package/dist/{json-output-BzSBR-KX.js → json-output-xgN0ZLWP.js} +31 -6
- package/dist/{listen-background-C0F9gNDD.js → listen-background-DyBYca28.js} +323 -36
- package/dist/{machine-session-g-xPd3X0.js → machine-session-Cvo9BqYB.js} +7 -7
- package/dist/{notify-session-Bo8WgG3q.js → notify-session-C8USviF_.js} +71 -32
- package/dist/oclif/auto-signal-worker.js +3 -3
- package/dist/oclif/auto-signals.js +1 -1
- package/dist/oclif/command-not-found.js +129 -0
- package/dist/oclif/help.js +70 -13
- package/dist/oclif/index.js +36758 -71899
- package/dist/oclif/listen-supervisor.js +1 -1
- package/dist/oclif/proxy-auto-detect.js +1 -1
- package/dist/oclif/receiver-heal.js +4 -3
- package/dist/oclif/root-signup-hint.js +15 -15
- package/dist/{repeats-Dj_o6c-X-BzXj5ICh.js → repeats-Dj_o6c-X-CliyH3ge.js} +14615 -13905
- package/dist/retry-ids-04ZPJCZY.js +59 -0
- package/dist/{scoped-chat-TJlyUTi7.js → scoped-chat-CUy0Ta_y.js} +1 -1
- package/dist/{signal-command-BO93dM2Q.js → signal-command-DHwFky03.js} +12 -6
- package/man/primitive.1 +27 -11
- package/package.json +22 -7
- package/dist/api-command-B37DPKFA.js +0 -3634
package/README.md
CHANGED
|
@@ -71,8 +71,9 @@ primitive listen --subscription local-webhook --forward-to http://localhost:3000
|
|
|
71
71
|
```
|
|
72
72
|
|
|
73
73
|
This mode forwards the exact signed body and existing webhook headers. Configure
|
|
74
|
-
the handler with
|
|
75
|
-
|
|
74
|
+
the handler with the secret the webhook signs with (the account webhook secret,
|
|
75
|
+
or the webhook's own secret when its `signed_with` is `own_secret`) and normal
|
|
76
|
+
signature verification. The CLI never forwards your API credentials. It does not follow
|
|
76
77
|
redirects or disable TLS verification. A response must finish within 30 seconds
|
|
77
78
|
and remain within 1 MiB. Existing confirmation headers retain their meaning,
|
|
78
79
|
including account content-discard behavior; exec and stdout do not confirm
|
|
@@ -140,7 +141,7 @@ primitive emails latest --limit 5
|
|
|
140
141
|
primitive inbox next
|
|
141
142
|
```
|
|
142
143
|
|
|
143
|
-
Run `primitive --help` for the full command list. Per-command help (`primitive functions deploy --help`, or `-h`) is one screen: a summary, usage,
|
|
144
|
+
Run `primitive --help` for the full command list. Per-command help (`primitive functions deploy --help`, or `-h`) is one screen: a summary, usage, required inputs, command options, common flags, and up to two examples. Common flags compact to names when needed to fit. Required request-body fields can be supplied as flags or JSON. `primitive functions deploy --help-full` prints the complete text, with every flag's full description, behavior notes, and all examples, so an agent can compose any operation without leaving the terminal.
|
|
144
145
|
|
|
145
146
|
## Verification codes and sign-in links
|
|
146
147
|
|
|
@@ -218,15 +219,15 @@ boundary to at most 60 characters. The whole message is the body.
|
|
|
218
219
|
|
|
219
220
|
## Authentication
|
|
220
221
|
|
|
221
|
-
Use `primitive signin` or `primitive login`
|
|
222
|
+
Use `primitive signin` or `primitive login` to log in. With no email, both use browser approval; `primitive signin browser` and `primitive login browser` are the explicit browser forms.
|
|
222
223
|
|
|
223
|
-
Use `primitive signin <email> --accept-terms`, then `primitive signin confirm <email> <code>` for email-code sign-in. `primitive login <email>` and `primitive otp <email>` support the same email-code flow with matching `confirm` and `resend` subcommands.
|
|
224
|
+
Use `primitive signin <email> --accept-terms`, then `primitive signin confirm <email> <code>` for email-code sign-in. `primitive login <email>` and `primitive otp <email>` support the same email-code flow with matching `confirm` and `resend` subcommands. The code logs you in to the account that uses the address, or creates a new account when none does. Primitive sends no emailed code to an address on a domain it receives mail for; log in with `primitive login browser` instead. Without a terminal to answer the terms prompt, these commands stop and ask for `--accept-terms`.
|
|
224
225
|
|
|
225
226
|
Use `primitive logout --force` to remove local CLI credentials, pending email-code auth state, and stale credential locks without contacting Primitive. This is the recovery command when an interrupted auth command leaves the CLI saying another credential operation is already in progress.
|
|
226
227
|
|
|
227
|
-
Use `primitive org leave` to leave the organization you are signed in to. It asks for confirmation first; pass `--yes` to skip the prompt in scripts. Leaving is final. Only a person signed in with `primitive login` can leave; API keys are refused. The only owner of an organization cannot leave it until someone else is made an owner. If the server asks you to confirm in the dashboard, the command prints the confirmation page and, in a terminal, asks for the token it shows; in a script, pass the token with `--step-up-token`. Refusals from the server are printed as returned, and the command exits 1.
|
|
228
|
+
Use `primitive org leave` to leave the organization you are signed in to. It asks for confirmation first; pass `--yes` to skip the prompt in scripts. Leaving is final. Only a person signed in with `primitive login` can leave; API keys are refused. The only owner of an organization cannot leave it until someone else is made an owner. If the server asks you to confirm in the dashboard, the command prints the confirmation page and, in a terminal, asks for the token it shows; in a script, pass the token with `--step-up-token`. Refusals from the server are printed as returned, and the command exits 1. Without a terminal and without `--yes`, it exits 2 before anything is sent.
|
|
228
229
|
|
|
229
|
-
Use `primitive signup <email>` for new account creation, then `primitive signup confirm <email> <code>` with the emailed verification code.
|
|
230
|
+
Use `primitive signup <email>` for new account creation, then `primitive signup confirm <email> <code>` with the emailed verification code. Without a terminal, pass `--accept-terms`.
|
|
230
231
|
|
|
231
232
|
### Switching organizations
|
|
232
233
|
|
|
@@ -244,30 +245,46 @@ Against a server without organization switching, and for logins saved by earlier
|
|
|
244
245
|
|
|
245
246
|
`primitive login --permission <permission>` asks for a narrowed login. A server that does not offer narrowed CLI logins refuses it, and the CLI stops rather than logging in with a wider grant.
|
|
246
247
|
|
|
248
|
+
### Focusing on some domains
|
|
249
|
+
|
|
250
|
+
When a credential reads mail on more than one domain, a mail listing or search without a focus stops (exit 2, error code `focus_required`), names the domains and asks for a choice. It keeps stopping until a focus is chosen; the choice is saved, so it is made once. A credential with one domain never sees any of this.
|
|
251
|
+
|
|
252
|
+
```bash
|
|
253
|
+
primitive focus set support.example.com sales.example.com # list and search only these domains
|
|
254
|
+
primitive focus set --all # every domain
|
|
255
|
+
primitive focus # show the saved focus and the domains
|
|
256
|
+
primitive focus clear # forget it
|
|
257
|
+
```
|
|
258
|
+
|
|
259
|
+
The focus is saved per profile: for the member login in the CLI config directory, for a connected agent in its profile directory. It is never written to a credential file. `PRIMITIVE_FOCUS_DOMAINS=<name,...>` (or `all`) overrides it for a session, and `--domain <name>` or `--all-domains` for one command.
|
|
260
|
+
|
|
261
|
+
It applies to `emails list`, `emails latest`, `emails search`, `search`, `emails watch`, `inbox next`, `sent list` and `semantic-search`. Each prints one stderr line naming the focus, where it came from and how to widen it; `--json` carries `meta.focus` instead. An empty focused result also says how much matching mail is on the other domains. `sent list` filters by the sending domain. `semantic-search` with a focus searches received mail only; with `--corpus outbound` it covers every domain and says the focus was not applied. A command given its own scope (`--domain-ids` on `emails list` and `emails search`, `--domain-id` on `search` and `emails watch`, `--recipient`, `--to`, `--thread-id`, or a `domain:` or `to:` search filter) ignores the saved focus. Reads by id, notifications (`listen`, `wait`, `emails wait`, `agent check-mail`) and the CLI's own reply bookkeeping never follow it.
|
|
262
|
+
|
|
247
263
|
### Grants and keys
|
|
248
264
|
|
|
249
|
-
`primitive whoami` shows your organization, role and grant when the server reports them. `primitive whoami --check mail:send` asks whether the current credential may use a permission, prints the decision, and exits 1 when it may not; nothing is enforced by asking. A request refused because the credential's grant lacks a permission fails with `grant_forbidden`, and the CLI names the permission.
|
|
265
|
+
`primitive whoami` shows your member address, your organization, your built-in role and the credential's grant when the server reports them; only a person's own login has a role line. `primitive whoami --check mail:send` asks whether the current credential may use a permission, prints the decision, and exits 1 when it may not; nothing is enforced by asking. A request refused because the credential's grant lacks a permission fails with `grant_forbidden`, and the CLI names the permission.
|
|
250
266
|
|
|
251
267
|
```bash
|
|
252
268
|
primitive keys list
|
|
253
269
|
primitive keys get <id> --json
|
|
254
270
|
primitive keys create --name orders --permission mail:read --rule <rule-id>
|
|
255
271
|
primitive keys update <id> --add mail:send,mail:reply
|
|
272
|
+
primitive keys update <id> --expires-at 2027-02-08T00:00:00Z
|
|
256
273
|
primitive keys rotate <id>
|
|
257
274
|
primitive keys revoke <id>
|
|
258
275
|
```
|
|
259
276
|
|
|
260
|
-
`keys list` shows each key's id, prefix, name, permissions, the mail it reaches, expiry and last use, and `keys get` shows one key in full. Neither shows a secret. You see your own keys, and every key if your role may read them all.
|
|
277
|
+
`keys list` shows each key's id, prefix, name, permissions, the mail it reaches, expiry and last use, and `keys get` shows one key in full. Neither shows a secret. Revoked keys are left out of `keys list` unless you pass `--include-revoked`, which marks each `[revoked]` with when it was revoked. You see your own keys, and every key if your role may read them all.
|
|
261
278
|
|
|
262
|
-
`keys create` needs you to say what the key can do: a `--preset`, or `--permission` with the mail it reaches (`--address`, `--domain`, `--rule`, each repeatable, or `--all-mailboxes`). There is no default, and a super admin key needs `--preset super_admin`. A key never holds more than you do, and your organization's credential policy applies. `keys update` adds or removes permissions (`--add`, `--remove`) or
|
|
279
|
+
`keys create` needs you to say what the key can do: a `--preset`, or `--permission` with the mail it reaches (`--address`, `--domain`, `--rule`, each repeatable, or `--all-mailboxes`). There is no default, and a super admin key needs `--preset super_admin`. A key never holds more than you do, and your organization's credential policy applies. `keys update` adds or removes permissions (`--add`, `--remove`), adds or removes email rules (`--add-rule`, `--remove-rule`), or replaces them all (`--rule`); the key keeps its id and secret. A request already held open with that key, such as a long poll or a wait, ends once when its permissions change. `keys update --expires-at <time>` extends a key before it expires, within your organization's credential policy, and `--no-expiry` removes its expiry where the policy allows. Rotating keeps the expiry: `keys rotate` gives the new key the old key's expiry unless you pass `--expires-at` or `--no-expiry`. An expired key cannot be extended.
|
|
263
280
|
|
|
264
|
-
Creating, rotating and changing a key
|
|
281
|
+
Creating, rotating and changing a key run directly. If your organization requires approval, the command prints the approval link, opens it where it can, and waits for the one-time token the page shows. In a script it prints the link and exits: approve, then run it again with `--step-up-token`. The new secret is printed once, alone on stdout (or in the JSON with `--json`), and the CLI never saves it, so store it right away. `keys revoke` asks for confirmation; pass `--yes` in scripts.
|
|
265
282
|
|
|
266
|
-
`primitive roles list`, `primitive roles groups`, `primitive roles mailbox-access` and `primitive roles access-mode` read roles, groups, mailbox access and the access mode. Where the server has not enabled them, they print `feature_disabled`. The built-in roles are `owner`, `admin
|
|
283
|
+
`primitive roles list`, `primitive roles groups`, `primitive roles mailbox-access` and `primitive roles access-mode` read roles, groups, mailbox access and the access mode. `primitive roles members` (also `primitive members list`) lists the members and their roles. Where the server has not enabled them, they print `feature_disabled`. The built-in roles are `owner`, `admin` and `member`. Operator is a template with every permission `admin` has except managing members, changing roles, managing mailbox delegations, sending invitations and billing. By default, owners, admins and operators may use the CLI. An organization can open it to every member by setting `cli_access` to `all_members` in its credential policy.
|
|
267
284
|
|
|
268
285
|
### Trying the preview
|
|
269
286
|
|
|
270
|
-
Install the 3.0.0 preview with `npm install -g primitive@preview`. `npm install -g primitive` stays on the latest stable version.
|
|
287
|
+
Install the 3.0.0 preview with `npm install -g primitive@preview`. `npm install -g primitive` stays on the latest stable version. Code that uses the SDK alongside the preview CLI, such as a webhook handler reading `email.analysis.understanding`, needs the preview SDK too: `npm install @primitivedotdev/sdk@preview`, or the Python and Go previews their READMEs name. The 2.x SDK does not type the email rules payload.
|
|
271
288
|
|
|
272
289
|
### Downgrading after signing in as yourself
|
|
273
290
|
|
|
@@ -359,7 +376,7 @@ primitive emails list
|
|
|
359
376
|
primitive emails get --id <inbound-email-id>
|
|
360
377
|
primitive emails get --id <inbound-email-id> --context
|
|
361
378
|
primitive emails get --id <inbound-email-id> --compact
|
|
362
|
-
primitive sent list
|
|
379
|
+
primitive sent list # your own sends; --all-senders for every send you can read
|
|
363
380
|
primitive sent delete --id <sent-email-id>
|
|
364
381
|
primitive domains list
|
|
365
382
|
primitive billing
|
|
@@ -491,15 +508,34 @@ With `--json`, stdout is exactly one JSON document, on success and on failure,
|
|
|
491
508
|
and stderr stays empty. Output merged with `2>&1` therefore still parses:
|
|
492
509
|
|
|
493
510
|
- Notices the command would otherwise print on stderr (hints, progress, prior
|
|
494
|
-
reply warnings) go in the document's `warnings` array
|
|
511
|
+
reply warnings) go in the document's `warnings` array, or in `cli_warnings`
|
|
512
|
+
when the document already has a `warnings` of its own.
|
|
495
513
|
- A failure adds `error` and `exit_code`. If the command printed no document of
|
|
496
|
-
its own, the CLI prints `{ "error": ..., "exit_code": ... }`.
|
|
514
|
+
its own, the CLI prints `{ "error": ..., "exit_code": ... }`. An error the
|
|
515
|
+
CLI raises itself carries a `code`: `usage_error` (exit 2) when it refused
|
|
516
|
+
before sending anything, such as a bad flag or an unreadable file, and
|
|
517
|
+
`cli_error` otherwise.
|
|
518
|
+
- Generated commands check missing required request-body fields after merging
|
|
519
|
+
flags and JSON, before authentication or HTTP requests. Their `usage_error` includes
|
|
520
|
+
`error.details.missing`: an array of `{ field, flag, json_path }`, such as
|
|
521
|
+
`{ "field": "email", "flag": "--email", "json_path": "$.email" }`.
|
|
522
|
+
`flag` is null when the field must be supplied in JSON.
|
|
523
|
+
- For UUID input fields explicitly marked `x-primitive-retry-id` in the API
|
|
524
|
+
contract, generated commands create a retry ID when omitted. Caller values
|
|
525
|
+
are preserved. The ID is reused during approval and printed before requests
|
|
526
|
+
in human output. With `--json`, `cli_retry_ids` lists generated values as
|
|
527
|
+
`{ field, flag, json_path, value, source: "generated" }` on success or failure.
|
|
528
|
+
Retry the same operation and inputs with that value explicitly supplied.
|
|
529
|
+
Unmarked fields, including resource IDs named `request_id`, have no default.
|
|
530
|
+
- Unknown commands exit 2 with `error.code` `command_not_found`. When nearby
|
|
531
|
+
commands exist, `error.details.suggestions` lists their full invocations.
|
|
497
532
|
- Generated API commands (`primitive sent list`, `primitive emails list`, ...)
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
533
|
+
print the API's response body with `--json`: `data`, and `meta` with
|
|
534
|
+
`meta.cursor` for the next page where the route sends it, plus the CLI's own
|
|
535
|
+
`summary` (such as an empty-result hint). Read a list as `.data[]` and an
|
|
536
|
+
object's fields as `.data.<field>`. Without `--json`, stdout is the data
|
|
537
|
+
payload and the `next cursor: <cursor>` line goes to stderr.
|
|
538
|
+
- Hand-written commands whose `--json` output is a bare array keep that shape.
|
|
503
539
|
- `primitive listen` streams JSONL and is not covered by this rule.
|
|
504
540
|
|
|
505
541
|
## Searching mail
|
|
@@ -512,7 +548,7 @@ prints a table (header on stderr). Each result in `--json` output carries
|
|
|
512
548
|
primitive search "invoice" --from acme.com
|
|
513
549
|
primitive search "contract" --thread-id <thread-uuid> # one conversation
|
|
514
550
|
primitive search "quarterly invoi" --prefix # last word matches as a prefix
|
|
515
|
-
primitive search "a" --prefix --no-count
|
|
551
|
+
primitive search "a" --prefix --no-count # skip the total count
|
|
516
552
|
```
|
|
517
553
|
|
|
518
554
|
- `--thread-id <uuid>` only returns emails in that thread. It combines with
|
|
@@ -521,11 +557,11 @@ primitive search "a" --prefix --no-count --envelope # skip the total count
|
|
|
521
557
|
`invoi` matches invoice and invoicing. Only the final unquoted word is
|
|
522
558
|
affected.
|
|
523
559
|
- `--no-count` skips computing the total match count, which makes broad
|
|
524
|
-
queries cheaper. `meta.total` is then null in `--json` output, and
|
|
525
|
-
|
|
560
|
+
queries cheaper. `meta.total` is then null in `--json` output, and the
|
|
561
|
+
table's footer says `Total: not counted (--no-count)`. Use `meta.cursor`
|
|
526
562
|
to tell whether another page exists.
|
|
527
|
-
-
|
|
528
|
-
next-page cursor
|
|
563
|
+
- Below the table, stderr gives the total (with `+` when the count was capped)
|
|
564
|
+
and the next-page cursor.
|
|
529
565
|
|
|
530
566
|
These flags apply to the default lexical search only and are rejected with
|
|
531
567
|
`--mode`.
|
|
@@ -1142,6 +1178,25 @@ pass, immediately before claiming. To keep both on
|
|
|
1142
1178
|
purpose, rerun with `--keep-existing`. `--resume` continues a claim that
|
|
1143
1179
|
already happened and is never refused.
|
|
1144
1180
|
|
|
1181
|
+
### Install the bundled skills
|
|
1182
|
+
|
|
1183
|
+
`primitive skills install` copies the skills bundled in this package into a
|
|
1184
|
+
runtime's skills folder, for sessions that use a member login instead of
|
|
1185
|
+
`agent connect`:
|
|
1186
|
+
|
|
1187
|
+
```sh
|
|
1188
|
+
primitive skills install --runtime claude
|
|
1189
|
+
primitive skills install primitive-connect --runtime codex --json
|
|
1190
|
+
```
|
|
1191
|
+
|
|
1192
|
+
It installs every bundled skill, or only the one named, into the runtime's
|
|
1193
|
+
`skills` folder (`$CLAUDE_CONFIG_DIR` or `~/.claude` for Claude, `$CODEX_HOME`
|
|
1194
|
+
or `~/.codex` for Codex; `--project` uses `.claude/skills`
|
|
1195
|
+
or `.agents/skills` in the current directory), and reports each skill's path,
|
|
1196
|
+
state (`installed`, `updated`, `unchanged` or `failed`) and content version.
|
|
1197
|
+
A copy already at the bundled version is left unchanged, and a symlinked copy
|
|
1198
|
+
is replaced by a real directory. A name that is not bundled exits 2.
|
|
1199
|
+
|
|
1145
1200
|
### Set up a machine for every coding session
|
|
1146
1201
|
|
|
1147
1202
|
`primitive machine doctor` checks what lets each Claude Code, Codex and omp
|