@samva/cli 0.7.1 → 0.9.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.
Files changed (4) hide show
  1. package/AGENTS.md +30 -1
  2. package/README.md +15 -6
  3. package/dist/bin.mjs +11022 -2983
  4. package/package.json +10 -8
package/AGENTS.md CHANGED
@@ -2,13 +2,19 @@
2
2
 
3
3
  Use `samva --help` and `samva <command> --help` as the command contract. For automation, prefer
4
4
  `SAMVA_API_KEY`, `--json` for one bounded result, and `--jsonl` with `--all` for streamed lists.
5
- Machine-readable results go to stdout; warnings and typed errors go to stderr.
5
+ Machine-readable results go to stdout; warnings and typed errors go to stderr. Error envelopes carry
6
+ `schemaVersion`, `type`, `command`, `reason`, `message`, and optional `next`. For API failures,
7
+ `reason` is the API `_tag`, `status` is the HTTP status, and `details` preserves the public error
8
+ fields. Follow `next` and fix `details.fields` before retrying. API 401 and 403 exit with code `4`;
9
+ other operational failures exit with code `1`. Human mode prints the same message and recovery step.
6
10
 
7
11
  `samva templates export --out <dir>` renders every local template's fixtures to HTML
8
12
  and text with the asset manifest, needing a Samva credential only to resolve a live `samva:brand`; `--asset-base <origin>` is for an
9
13
  export that will be delivered, which cannot carry a relative reference.
10
14
  `samva templates check --watch` is the continuous authoring gate. Human mode prints observations;
11
15
  machine watch output uses `--jsonl`. `--json` remains one-shot.
16
+ `samva mailboxes events` is a stream: human mode prints one raw record per line, `--jsonl` one result
17
+ envelope per event, `--quiet` nothing, and `--json` is refused (exit 2) with a pointer to `--jsonl`.
12
18
 
13
19
  The developer loop for a template project is `samva templates dev` (the local visual editor, no
14
20
  `vite.config.ts`), `check` (type-check, compile, and render every fixture), `render <template>
@@ -79,3 +85,26 @@ artifact directly.
79
85
  Keep Samva brand resolution in the CLI and pass `samvaBrandPlugin` to the project's authoring
80
86
  toolchain, so standalone `@samva/vite` stays independent of Samva authentication and storage.
81
87
  Standalone callers supply their own resolver. The README owns resolution order and configuration.
88
+
89
+ `samva extensions` is the mailbox extension developer loop: `init` scaffolds an authoring project,
90
+ `dev` handles mailbox events locally, `publish` records an immutable version, and `install` grants
91
+ that version scoped mailbox permissions. Hosted extensions run on Samva; webhook extensions use
92
+ the installation credentials returned once at install. Publishing and installation management
93
+ require a person signed in with `samva login`. Local development with that login attributes tool
94
+ calls to you, rather than to an installation. Read what exists with `list`, `versions <name>`,
95
+ `version <name> <version>`, `installations`, `installation <id>`, `runs <id>` (outcomes only), and
96
+ `run <id> <run-id>` (adds the handler's log lines); the list commands page with `--limit`,
97
+ `--cursor`, and `--all --jsonl`.
98
+
99
+ `samva mailboxes` reads and sends as a mailbox: `list` pages with `--limit`, `--cursor`, `--after`,
100
+ and `--before`, `threads` searches, `read` prints a message (human output marks the body as
101
+ untrusted email), and `send` and `reply` take `--idempotency-key` so a retry cannot send twice.
102
+ Quarantine `list` pages the same way, bounded by `--after` and `--before` on when a message was
103
+ held; `release` and `discard` take the held message's `id` and require a person signed in with
104
+ `samva login`. `samva mailboxes events` reads the SDK event stream with reconnects off and prints
105
+ one record per event, `{cursor, id, event}` (`--jsonl` wraps each in a result envelope, `--quiet`
106
+ prints none, `--json` is refused). A drop or refusal ends the command with the server's `_tag` as
107
+ the error `reason`, its `status` and `details`, and a `Try:` line; the last handled cursor, which
108
+ `--cursor` resumes from, goes to stderr in human mode and into `details.lastCursor` otherwise.
109
+ `samva extensions dev` follows the same output modes. 401 and 403 exit 4. An expired
110
+ cursor exits 1 and the next step is to start without `--cursor`. Ctrl+C exits cleanly.
package/README.md CHANGED
@@ -360,12 +360,14 @@ samva --quiet profile use acme
360
360
  `--json` writes one bounded, versioned result envelope to stdout:
361
361
  `{schemaVersion:1,type:"result",command,data}`. For resource lists, `--jsonl` writes one flat,
362
362
  independently parseable outer result envelope per resource. Errors use the corresponding
363
- `{schemaVersion:1,type:"error",command,reason,message,next?}` envelope on stderr and exit
364
- non-zero. `--json`, `--jsonl`, and `--quiet` are mutually exclusive; assignment forms such as
363
+ `{schemaVersion:1,type:"error",command,reason,message,status?,details?,next?}` envelope on stderr and exit
364
+ non-zero. API errors use their `_tag` as `reason`, their HTTP status as `status`, and their
365
+ public fields as `details`. Fix `details.fields` and follow `next` before retrying. API 401 and 403
366
+ exit with code `4`. Human mode prints the same message and a `Try:` line. `--json`, `--jsonl`, and `--quiet` are mutually exclusive; assignment forms such as
365
367
  `--json=true` are usage errors. `--quiet` suppresses successful output only. In machine modes,
366
368
  stdout contains only result data; warnings and errors go to stderr.
367
369
 
368
- Lists are paginated by default. Use `--page` and `--limit` for a bounded page. `--all` requires
370
+ Lists are paginated by default. Use `--limit` for a bounded page and `--cursor` with the printed `nextCursor` for the next one. `--all` requires
369
371
  `--jsonl`, so an automated traversal stays streamable rather than producing an unbounded JSON
370
372
  document. `--all` changes traversal only: bounded and unbounded JSONL records have the same outer
371
373
  envelope, with the resource itself in `data`. Empty lists emit no records.
@@ -418,13 +420,20 @@ review decision, sendable domain and verified sender counts, and domain-verifica
418
420
  `readyToSend` is true when a production send would be admitted and at least one domain or sender can
419
421
  carry it. It is read-only and does not inspect receiving configuration, check DNS itself, send an
420
422
  email, or replay fixtures.
421
- Use `samva email receiving status <domain-id>` to read a domain's receiving prerequisite status.
422
- `samva email receiving enable <domain-id> ...` acts by default; its `--dry-run` is offline and does
423
- not require credentials or call the API. Each check is `passed`, `failed`, or
423
+ Each check is `passed`, `failed`, or
424
424
  `unavailable`. A `failed` check carries the underlying error detail; `unavailable`, such as no
425
425
  sending domain yet or a review in progress, is informational; a rejected review fails. The command always prints the full report, then
426
426
  exits `1` if any check failed and `0` otherwise. The `--json` result's `data` adds an aggregate
427
427
  `ok` boolean, and human output marks checks with `✓`, `!`, and `✗` respectively.
428
428
 
429
+ Use `samva email receiving status <domain-id>` to read a domain's receiving prerequisites in
430
+ order: sending verified, a destination, receiving enabled, and the inbound MX, which it looks up
431
+ live and names when mail is routed elsewhere.
432
+ `samva email receiving enable <domain-id> --domain <name> --catch-all [--endpoint <webhook-id>]`
433
+ routes every address on a verified domain. A catch-all needs a destination, either `--endpoint` or
434
+ an active forwarding rule that covers the domain; mail that matches neither is rejected. Pass
435
+ `--address` for exact recipients instead. The command acts by default; its `--dry-run` is offline
436
+ and does not require credentials or call the API.
437
+
429
438
  A command that needs a subcommand, such as a bare `samva` or a group like `samva email`, prints its
430
439
  help to stdout and exits `2`, so a script never mistakes a missing subcommand for success.