@zanfia/cli 0.3.5 → 0.3.26

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/README.md +52 -0
  2. package/dist/index.js +9410 -3668
  3. package/package.json +2 -1
package/README.md ADDED
@@ -0,0 +1,52 @@
1
+ # @zanfia/cli (`zanfia`)
2
+
3
+ Thin HTTP client over the Zanfia Public API.
4
+
5
+ > **Status:** published to npm as `@zanfia/cli` (bin `zanfia`), talking to the production Workspace API by default (`ZANFIA_CLI_TARGET=prod` bakes the URLs at build time). Set `ZANFIA_API_URL` to target another environment; local `tsx` runs without baked defaults fall back to the in-memory mock.
6
+
7
+ ## Local usage
8
+
9
+ ```bash
10
+ # from the monorepo root, after `pnpm install`
11
+ pnpm --filter @zanfia/cli dev products list
12
+
13
+ # or run a one-off
14
+ pnpm --filter @zanfia/cli dev auth whoami
15
+
16
+ # global flags (--json, --verbose, --api-key) must come BEFORE the subcommand:
17
+ pnpm --filter @zanfia/cli dev --json products list
18
+ ```
19
+
20
+ ## System emails
21
+
22
+ `zanfia emails` manages the customer-facing emails Zanfia sends in your name (Site → Emails):
23
+
24
+ ```bash
25
+ zanfia emails list # key, group, status, subject
26
+ zanfia emails get purchase-confirmation # subject/headline EN+PL, layout blocks, variables
27
+ zanfia emails set purchase-confirmation --subject-pl "Dzięki za zakup {{productName}}"
28
+ zanfia emails set access-ending-reminder --disable # optional emails only
29
+ zanfia emails set login-code --layout ./layout.json # full EmailBlock[] (inline JSON or file)
30
+ zanfia emails set login-code --reset # back to the stock email
31
+ zanfia emails branding get
32
+ zanfia emails branding set --accent-color "#2563eb" --reply-to none
33
+ zanfia emails test purchase-confirmation --lang en # queued to YOUR own address
34
+ ```
35
+
36
+ Raw HTTP: `GET|PATCH /email-templates`, `POST /email-templates/{key}/test-sends`. Full reference for every
37
+ command group: `.claude/skills/zanfia-cli/SKILL.md`.
38
+
39
+ ## Auth resolution order
40
+
41
+ 1. `--api-key` flag
42
+ 2. `ZANFIA_API_KEY` environment variable
43
+ 3. Stored key in `~/.config/zanfia/credentials.json`
44
+ 4. Prompt to run `zanfia auth set-key`
45
+
46
+ ## Environment
47
+
48
+ | Variable | Purpose |
49
+ | ----------------- | ------------------------------------------------ |
50
+ | `ZANFIA_API_URL` | Public API base URL. Unset → mock mode. |
51
+ | `ZANFIA_API_KEY` | API key (overrides stored credentials). |
52
+ | `ZANFIA_CLI_MOCK` | Force mock mode even if `ZANFIA_API_URL` is set. |