@samva/cli 0.21.0 → 0.22.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.
Files changed (3) hide show
  1. package/AGENTS.md +14 -4
  2. package/dist/bin.mjs +847 -260
  3. package/package.json +9 -9
package/AGENTS.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Samva CLI consumer guide
2
2
 
3
- Use `samva --help` and `samva <command> --help` as the command contract. For automation, prefer
3
+ Use `samva --help` and `samva <command> --help` as the command contract. `--help --json` (or
4
+ `--jsonl`) prints that contract as one result envelope: `data` carries `description`, `usage`,
5
+ `flags`, `globalFlags`, `args`, `subcommands`, and `examples`. For automation, prefer
4
6
  `SAMVA_API_KEY`, `--json` for one bounded result, and `--jsonl` with `--all` for streamed lists.
5
7
  Machine-readable results go to stdout; warnings and typed errors go to stderr. Error envelopes carry
6
8
  `schemaVersion`, `type`, `command`, `reason`, `message`, and optional `next`. For API failures,
@@ -60,7 +62,10 @@ The developer loop for a template project is `samva templates dev` (the local vi
60
62
  `vite.config.ts`), `check` (type-check, compile, and render every fixture), `render <template>
61
63
  --fixture <name>` (subject, preheader, and plain-text body; `--format html`, `--channel sms|whatsapp`),
62
64
  and `snapshot <template> --fixture <name>` (desktop and mobile PNGs, light and dark, in
63
- `.samva/snapshots`, needing `playwright` in the project or a system Chrome). With `--json`, every
65
+ `.samva/snapshots`, needing `playwright` in the project or a system Chrome; imported images come
66
+ from the project's own files unless an HTTPS `--asset-base` is given). The commands run the project's
67
+ installed `@samva/markup` and `@samva/vite`, which must be on the release line the CLI drives; any
68
+ other line stops with the `npm install` command that fixes it. With `--json`, every
64
69
  finding carries `code`, `severity`, `message`, `file`, `line`/`column`, `range`, and, where the
65
70
  compiler has them, `fix`, a machine-applicable `edit`, and `upgrade`, the instructions for migrating
66
71
  a template written in a format the compiler rejects. Templates live in `templates/` and
@@ -94,7 +99,8 @@ and finish it in the other; `add-asset` alone has no MCP twin, because a chat cl
94
99
  bytes to send. Every subcommand prints its complete
95
100
  result as JSON because these outputs — revisions, digests, diagnostics — are inputs to the next
96
101
  call. `open` returns the revision every other subcommand is fenced to; a workspace that moved refuses
97
- them, and reopening is the recovery. A source that does not build is a successful call carrying a
102
+ them, and reopening is the recovery. The reads (`diff`, `check`, `fixture`) fence to the current
103
+ revision when `--revision` is omitted. A source that does not build is a successful call carrying a
98
104
  null declaration and located findings, not a failed one. `add-asset <template-id> <file>` writes one
99
105
  image or font as unsaved bytes at `assets/<file name>` unless `--path` names another project path;
100
106
  `--replace` is required to change a path that already holds a file. The Git commands remain the way
@@ -110,7 +116,11 @@ CSS of the brand `--brand <slug>` names, or of the default brand. `--dry-run` va
110
116
  catalog: the input each published template accepts, and the reference a send carries. The default
111
117
  reference is each template's current publication, so a generated file keeps sending the same
112
118
  message until it is regenerated; `--reference contract-latest` follows new publications while the
113
- input contract holds. `--check` writes nothing and exits `1` when the file no longer describes the
119
+ input contract holds. `--by slug` writes the helper for callers that send by template slug: it
120
+ returns `{ templateSlug, templateData }`, renders the template's current publication (the API takes a
121
+ publication or contract reference only beside a template id), types the input from the current input
122
+ contract, and refuses `--reference`. Both modes export `TemplateSlug`, and `templateData` is typed to
123
+ what `email.send` accepts. `--check` writes nothing and exits `1` when the file no longer describes the
114
124
  catalog, naming what moved. A schema the generator cannot express as a checking type is refused
115
125
  with the template and the JSON pointer rather than generated as `unknown`.
116
126