@samva/cli 0.9.0 → 0.11.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 -3
  2. package/README.md +20 -1
  3. package/dist/bin.mjs +7850 -5366
  4. package/package.json +7 -7
package/AGENTS.md CHANGED
@@ -27,6 +27,13 @@ a template written in a format the compiler rejects. Templates live in `template
27
27
  `emails/`; a template is a `.tsx` file that default-exports `defineTemplate`, and the compiler reads
28
28
  it without running it.
29
29
 
30
+ `samva email send --attach <path>` (repeatable) attaches local files; the filename is the basename and
31
+ the content type comes from the extension (`application/octet-stream` when unknown). The CLI reads
32
+ and budget-checks every file before any request (at most 10 files, 25 MiB each and in total) and
33
+ exits `2` naming the path or limit. Past the 4 MiB inline limit, the largest files upload through
34
+ `/v1/media` first and travel by `mediaId`; the send's retries reuse them, and rerunning the command
35
+ uploads again. `--dry-run` lists each attachment and uploads nothing.
36
+
30
37
  `--publication-id` and `--input-contract-id` on `email send`, `scheduled-messages create`, and
31
38
  `campaigns create`/`update` choose which publication a template send renders: one exact publication,
32
39
  or the newest publication that still validates input identically. They are mutually exclusive and
@@ -90,21 +97,43 @@ Standalone callers supply their own resolver. The README owns resolution order a
90
97
  `dev` handles mailbox events locally, `publish` records an immutable version, and `install` grants
91
98
  that version scoped mailbox permissions. Hosted extensions run on Samva; webhook extensions use
92
99
  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
100
+ require a person signed in with `samva login`. `upgrade <installation-id>` selects the latest
101
+ published version, or `--version <version-or-id>` selects one. `--dry-run` asks the API for the
102
+ from/to versions and added/removed grants without changing the installation; the installation
103
+ shown in a preview is its current state. Applying requires confirmation (`--yes` outside a
104
+ terminal) and an exact, repeatable `--accept-permissions` acknowledgement for each added grant,
105
+ such as `permission:send` or `event:mailbox.message.sent`. Local development with that login attributes tool
94
106
  calls to you, rather than to an installation. Read what exists with `list`, `versions <name>`,
95
107
  `version <name> <version>`, `installations`, `installation <id>`, `runs <id>` (outcomes only), and
96
108
  `run <id> <run-id>` (adds the handler's log lines); the list commands page with `--limit`,
97
109
  `--cursor`, and `--all --jsonl`.
98
110
 
99
111
  `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
112
+ and `--before`. `get <id>` inspects a mailbox; `update <id> --data <JSON-or-@file>` changes
113
+ `displayName`, `defaultFrom`, or `metadata` (merges by key, `null` deletes a key). `pause <id>`
114
+ stops sending and receiving, and `resume <id>` resumes without backfilling mail received while
115
+ paused. These mutations support `--dry-run`. `remove <id>` deletes a mailbox (`--yes` outside a terminal, `--dry-run` to
116
+ preview), `threads` searches, `read` prints a message (human output marks the body as
101
117
  untrusted email), and `send` and `reply` take `--idempotency-key` so a retry cannot send twice.
102
118
  Quarantine `list` pages the same way, bounded by `--after` and `--before` on when a message was
103
119
  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
120
+ `samva login`. Discard requires confirmation (`--yes` outside a terminal) and supports `--dry-run`.
121
+ `actions list --mailbox <id>` filters by `--state` and pages with `--limit`, `--cursor`, and
122
+ `--all --jsonl`. `actions approve <action-id> --mailbox <id>` and `actions deny <action-id>
123
+ --mailbox <id> [--reason <text>]` require a person different from the proposer, confirmation
124
+ (`--yes` outside a terminal), and offer `--dry-run`.
125
+ Human mailbox and extension results retain the same facts as JSON: mailbox addresses and sending
126
+ identity, thread state and activity, message bodies, attachments, authentication and actor,
127
+ receipt waits and skipped recipients, held-mail results, and installation/run details.
128
+ `samva mailboxes events` reads the SDK event stream with reconnects off and prints
105
129
  one record per event, `{cursor, id, event}` (`--jsonl` wraps each in a result envelope, `--quiet`
106
130
  prints none, `--json` is refused). A drop or refusal ends the command with the server's `_tag` as
107
131
  the error `reason`, its `status` and `details`, and a `Try:` line; the last handled cursor, which
108
132
  `--cursor` resumes from, goes to stderr in human mode and into `details.lastCursor` otherwise.
109
133
  `samva extensions dev` follows the same output modes. 401 and 403 exit 4. An expired
110
134
  cursor exits 1 and the next step is to start without `--cursor`. Ctrl+C exits cleanly.
135
+
136
+ `samva subscriptions subscribe` requests one email confirmation with `--email`,
137
+ `--contact-group-id`, and `--from`. Optional flags record signup context, select a template, or
138
+ name the unsubscribe group whose opt-out confirmation clears. A successful receipt means the
139
+ request was accepted; group membership waits for recipient confirmation on the hosted page.
package/README.md CHANGED
@@ -339,6 +339,25 @@ samva campaigns runs recipients <campaign-id> <run-id> --status failed
339
339
  scheduled message. Campaign definitions freeze after their first run. Cancelling a scheduled
340
340
  message or campaign run requires confirmation, and dispatch already in progress may still finish.
341
341
 
342
+ ## Contacts
343
+
344
+ ```sh
345
+ samva contacts list --search ada --limit 25
346
+ samva contacts list --fields plan,score --json
347
+ samva contacts list --custom-field plan --custom-field-value '"pro"' --json
348
+ samva contacts list --all --jsonl
349
+ samva contacts get contact_7q2xk9mvt4znw8rh --json
350
+ ```
351
+
352
+ `list` returns a bounded page with a `nextCursor`; pass it as `--cursor` to resume. `--fields`
353
+ selects the custom-field keys included in each summary. Exact custom-field filtering requires
354
+ both `--custom-field` and `--custom-field-value`, with the value encoded as a JSON scalar
355
+ (for example `'"pro"'`, `42`, `true`, or `null`). `--search`, `--status`, `--after`, and `--before`
356
+ combine with that filter. `get` returns the contact's identities, profile, custom fields, and metadata.
357
+ If a list page fails, machine-readable stderr includes `details.cursor`. Retry with that
358
+ `--cursor` and the same filters to resume after the contacts already printed; a null cursor means
359
+ the first page failed, so retry without `--cursor`.
360
+
342
361
  ## Automation contract
343
362
 
344
363
  Use `--dry-run` on supported mutations to validate input and preview the intended request. `email
@@ -402,7 +421,7 @@ samva email send --help
402
421
  ```
403
422
 
404
423
  Released top-level commands are `login`, `logout`, `org`, `email`, `messages`, `campaigns`,
405
- `scheduled-messages`, `templates`, `brands`, `webhooks`, `profile`, and `help`. Use `samva <command> --help`
424
+ `contacts`, `scheduled-messages`, `templates`, `brands`, `webhooks`, `profile`, and `help`. Use `samva <command> --help`
406
425
  for flags and runnable examples.
407
426
 
408
427
  Test a configured webhook against its real endpoint with an optional JSON payload. `--data` accepts