@checkbox-site/cli 0.0.0-stage → 0.2.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/LICENSE +21 -0
  2. package/README.md +113 -2
  3. package/dist/checkbox.js +26424 -0
  4. package/package.json +43 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Checkbox
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,114 @@
1
- # Temporary Holding Version
1
+ # `checkbox` CLI (`@checkbox-site/cli`)
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Subscription compliance (automatic-renewal laws: ROSCA, California ARL, New York GBL § 527-a and the other state
4
+ laws) from a terminal, a CI job or an AI coding agent. Node 20+.
5
+
6
+ ```sh
7
+ npx @checkbox-site/cli ci init --yes # checkbox.json + .github/workflows/checkbox.yml from your project
8
+ npx @checkbox-site/cli ci # run every check in checkbox.json (offline: no key, no network)
9
+ ```
10
+
11
+ Never install the unscoped npm package `checkbox`: it is an unrelated project. The binary this package installs is
12
+ called `checkbox`:
13
+
14
+ ```sh
15
+ checkbox check disclosure --text "…" --price 19.99 --interval month --consent-checkbox --offline
16
+ checkbox check stripe-session --file session-params.json --cancel-url https://example.com/account/cancel --offline
17
+ checkbox check email --kind trial_reminder --file emails/trial-ending.txt --price 19.99 --interval month --trial-days 14
18
+ checkbox check page --file dist/checkout.html --price 19.99 --interval month
19
+ checkbox init # connect this project to a Checkbox account (one browser approval)
20
+ ```
21
+
22
+ Every command prints short human output, or exactly one JSON document with `--json` (what agents should use).
23
+
24
+ ## `checkbox ci` — checks on every code change
25
+
26
+ `checkbox.json` at the project root lists what to check: the merchant, the plans the checkout sells, and the files
27
+ that produce the Stripe Checkout params, the disclosure next to the pay button, checkout / pricing pages and the
28
+ lifecycle emails. `checkbox ci` runs every check with the rules engine bundled in this package (offline by default;
29
+ `--online` uses the API with `CHECKBOX_SECRET_KEY`, for preview URLs), prints one line per check and exits non-zero
30
+ when one needs a fix. In GitHub Actions it annotates the file each check reads and writes a job summary with the fix
31
+ and the corrected params / text.
32
+
33
+ ```json
34
+ {
35
+ "$schema": "https://checkbox.site/schemas/checkbox.json",
36
+ "merchant": { "name": "Acme", "cancel_url": "https://acme.example/account/cancel" },
37
+ "plans": [{ "name": "Pro", "price": 19.99, "currency": "usd", "interval": "month", "trial_days": 14 }],
38
+ "checks": {
39
+ "stripe_checkout": [{ "name": "Pro checkout", "source": "app/api/checkout/route.ts" }],
40
+ "emails": [{ "name": "Welcome email", "kind": "acknowledgment", "file": "emails/welcome.html" }],
41
+ "notice_schedule": true
42
+ }
43
+ }
44
+ ```
45
+
46
+ GitHub Actions (`.github/workflows/checkbox.yml`, written by `checkbox ci init`):
47
+
48
+ ```yaml
49
+ steps:
50
+ - uses: actions/checkout@v4
51
+ - uses: checkbox-site/checkbox@v1
52
+ ```
53
+
54
+ Config reference, exit codes and an example summary: https://checkbox.site/docs/guides/ci
55
+
56
+ ## Exit codes (stable)
57
+
58
+ | Code | Meaning |
59
+ |---|---|
60
+ | 0 | OK (checks: everything passed — or only `needs_review` without `--strict`) |
61
+ | 1 | A compliance check failed |
62
+ | 2 | A check needs review and `--strict` was given |
63
+ | 3 | Usage or config error (unknown command / flag, invalid checkbox.json, missing file) |
64
+ | 4 | Not logged in / API key rejected |
65
+ | 5 | API, network or local error |
66
+
67
+ ## Credentials
68
+
69
+ Only `--online` checks and the account commands need a key. Resolution order: `--api-key` flag → `CHECKBOX_API_KEY`
70
+ → `CHECKBOX_SECRET_KEY` → the key saved by `checkbox login` (`~/.config/checkbox/config.json`, honouring
71
+ `XDG_CONFIG_HOME`; `CHECKBOX_CONFIG_DIR` overrides; file mode 0600). The API base is `--api-base` →
72
+ `CHECKBOX_API_BASE` → stored `api_base` → `https://app.checkbox.site`.
73
+
74
+ | Command | What it does |
75
+ |---|---|
76
+ | `checkbox init [--yes] [--json]` | one browser approval (device login), then keys in `.env.local`, snippet in the root layout, site + Terms / policies registered, Stripe test subscription (with permission), first checks, owner email; `--verify` re-checks after a deploy; `--ci` only adds CI (`checkbox ci init`) |
77
+ | `checkbox login [--api-key <key>\|--stdin]` | verifies the key with `GET /v1/account`, then saves it |
78
+ | `checkbox whoami` | account, mode (test/live) and where the key came from |
79
+ | `checkbox logout` | forgets the stored key |
80
+
81
+ ## `checkbox check` (preflight — "check before you ship")
82
+
83
+ Stateless checks an agent runs while writing checkout code, before anything is deployed. Online they call
84
+ `POST /v1/checks/*`; with `--offline` the same rules engine runs locally and prints the identical JSON (plus
85
+ `"mode": "offline"`). Verdicts always come from the Checkbox rules engine and legal catalog; every result carries
86
+ `rules_version`, `catalog_version` and a `disclaimer` (not legal advice).
87
+
88
+ | Sub-command | API | Offline |
89
+ |---|---|---|
90
+ | `disclosure` | `POST /v1/checks/disclosure` | yes |
91
+ | `stripe-session` | `POST /v1/checks/stripe_checkout_session` | yes |
92
+ | `payment-link` | `POST /v1/checks/stripe_payment_link` | yes |
93
+ | `email` | `POST /v1/checks/email` | yes |
94
+ | `page` | `POST /v1/checks/page` (`--url` needs an activated live account) | `--file` only |
95
+ | `notice-schedule` | `POST /v1/checks/notice_schedule` | no |
96
+
97
+ Run `checkbox check <sub> --help` for flags. Common flags: `--jurisdictions US-CA,US-NY` (default all),
98
+ `--strict` (needs_review exits 2), `--json`, `--offline`, `--body <file.json>` (send a complete request body as-is).
99
+
100
+ ## `checkbox plan` / `fix` / `verify` (the compliance-plan loop)
101
+
102
+ ```
103
+ checkbox plan --json # ordered tasks + next_action (GET /v1/sites/:site/plan)
104
+ checkbox fix task_… [--file src/x.tsx] # the change; for code tasks an exact unified diff of your file (never written)
105
+ checkbox verify task_… --wait # pre-check now, then wait for the confirming scan / email / sync
106
+ checkbox verify --wait # re-check the whole site
107
+ ```
108
+
109
+ The site comes from `--site`, `$CHECKBOX_SITE`, what `checkbox init` saved for this directory, or your only site.
110
+ `fix --out fix.diff` also writes the diff for `git apply`. `verify` accepts `--html-file` (pre-deploy HTML),
111
+ `--stripe-params <json>` and `--email-file <json>`. Exit codes: `plan --exit-code` 1 while not compliant; `verify` 0 passed,
112
+ 1 failed, 2 still pending. Docs: https://checkbox.site/docs/cli
113
+
114
+ Not legal advice: Checkbox is an automated check against its catalog of automatic-renewal laws.