@samva/cli 0.7.0 → 0.8.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 +32 -2
  2. package/README.md +5 -3
  3. package/dist/bin.mjs +10862 -3011
  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>
@@ -16,7 +22,8 @@ The developer loop for a template project is `samva templates dev` (the local vi
16
22
  and `snapshot <template> --fixture <name>` (desktop and mobile PNGs, light and dark, in
17
23
  `.samva/snapshots`, needing `playwright` in the project or a system Chrome). With `--json`, every
18
24
  finding carries `code`, `severity`, `message`, `file`, `line`/`column`, `range`, and, where the
19
- compiler has them, `fix` and a machine-applicable `edit`. Templates live in `templates/` and
25
+ compiler has them, `fix`, a machine-applicable `edit`, and `upgrade`, the instructions for migrating
26
+ a template written in a format the compiler rejects. Templates live in `templates/` and
20
27
  `emails/`; a template is a `.tsx` file that default-exports `defineTemplate`, and the compiler reads
21
28
  it without running it.
22
29
 
@@ -78,3 +85,26 @@ artifact directly.
78
85
  Keep Samva brand resolution in the CLI and pass `samvaBrandPlugin` to the project's authoring
79
86
  toolchain, so standalone `@samva/vite` stays independent of Samva authentication and storage.
80
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.