@tryvitris/website-harness 1.0.2 → 1.1.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 (59) hide show
  1. package/README.md +76 -74
  2. package/agent/graph.yaml +769 -764
  3. package/agent/refs/admin.md +11 -11
  4. package/agent/refs/browser.md +6 -4
  5. package/agent/refs/business.md +20 -9
  6. package/agent/refs/implement.md +8 -6
  7. package/agent/refs/scheduling.md +13 -0
  8. package/bin/api/agent/evaluate.js +3 -3
  9. package/bin/api/agent/grade.js +3 -3
  10. package/bin/api/cli/api.js +11 -11
  11. package/bin/api/cli.js +13 -13
  12. package/bin/api/engine.js +4 -4
  13. package/bin/api/hosting.js +5 -5
  14. package/bin/api/index.js +1 -1
  15. package/bin/chunks/{chunk-Q6FLOYHS.js → chunk-5KRJQKHB.js} +3 -3
  16. package/bin/chunks/{chunk-YYK6367V.js → chunk-AD7WAHW2.js} +2 -2
  17. package/bin/chunks/{chunk-GO3XEQBA.js → chunk-AS74YXGM.js} +3 -3
  18. package/bin/chunks/{chunk-GM57SNLL.js → chunk-DDJ3QCRR.js} +9 -9
  19. package/bin/chunks/chunk-GPS3SAGQ.js +1020 -0
  20. package/bin/chunks/{chunk-ATPI2YRF.js → chunk-KR5ZUZV2.js} +2 -2
  21. package/bin/chunks/{chunk-YYYPSFFZ.js → chunk-MAPY3YVE.js} +2 -2
  22. package/bin/chunks/{chunk-OQGUEQ6F.js → chunk-MYX4FET4.js} +1 -1
  23. package/bin/chunks/{chunk-XJTAR7KM.js → chunk-OZD7ZWDX.js} +1 -1
  24. package/bin/chunks/{chunk-CPQQQ5YB.js → chunk-SBOUSO3S.js} +3 -3
  25. package/bin/chunks/{chunk-BMD5GVUT.js → chunk-SXPLCCO7.js} +6 -6
  26. package/bin/chunks/{chunk-QRIYA3GJ.js → chunk-WIT6364Y.js} +3 -3
  27. package/bin/chunks/{chunk-JPQCUN2J.js → chunk-WK7HJI5H.js} +1 -1
  28. package/bin/chunks/{design-context-store-BDYBQQCO.js → design-context-store-PGXCHUOF.js} +3 -3
  29. package/bin/chunks/{packets-RXFWDCK2.js → packets-B7MCJ42T.js} +3 -3
  30. package/bin/chunks/{preparation-ETEEMB5H.js → preparation-MVKICQPD.js} +3 -3
  31. package/bin/types/src/build/index.d.ts +2 -0
  32. package/bin/types/src/cli/admin.d.ts +1 -1
  33. package/bin/types/src/scheduling/config.d.ts +11 -0
  34. package/bin/types/src/scheduling/management.d.ts +2 -0
  35. package/bin/types/src/scheduling/styles.d.ts +1 -0
  36. package/bin/types/src/scheduling/widget.d.ts +2 -0
  37. package/bin/vitris-art.js +3 -3
  38. package/bin/vitris-build.js +2 -2
  39. package/bin/vitris-create-site.js +5 -5
  40. package/bin/vitris-cursor-hook.js +3 -3
  41. package/bin/vitris-eval.js +5 -5
  42. package/bin/vitris-go.js +5 -5
  43. package/bin/vitris-harvest.js +4 -4
  44. package/bin/vitris-knowledge.js +4 -4
  45. package/bin/vitris-launch-preflight.js +3 -3
  46. package/bin/vitris-motion-view.js +3 -3
  47. package/bin/vitris-references.js +2 -2
  48. package/bin/vitris-refresh.js +4 -4
  49. package/bin/vitris-stock.js +1 -1
  50. package/bin/vitris-themes.js +3 -3
  51. package/bin/vitris-upgrade.js +4 -4
  52. package/bin/vitris-verify-browser.js +3 -3
  53. package/bin/vitris-verify-performance.js +2 -2
  54. package/bin/vitris.js +13 -13
  55. package/docs/ADMIN.md +85 -85
  56. package/docs/CLI.md +314 -312
  57. package/docs/SCHEDULING.md +67 -0
  58. package/package.json +5 -4
  59. package/bin/chunks/chunk-NMTFSWPK.js +0 -332
package/docs/CLI.md CHANGED
@@ -1,312 +1,314 @@
1
- # Vitris Unified CLI & Automation Contracts
2
-
3
- The `vitris` CLI (`@tryvitris/website-harness`) provides a unified, operator-friendly command line interface and automation harness for creating, running, refining, evaluating, sharing, and deploying static websites.
4
-
5
- ---
6
-
7
- ## 1. Installation & Binary
8
-
9
- Install the stable release as a dependency or run via `npx`. For local tarballs and managed upgrades, see [distribution](DISTRIBUTION.md):
10
-
11
- ```bash
12
- npm install --save-dev --save-exact @tryvitris/website-harness@1.0.0
13
- npx vitris --help
14
- ```
15
-
16
- Within the `@tryvitris/website-harness` repository itself:
17
- ```bash
18
- npm run build:cli
19
- node bin/vitris.js --help
20
- ```
21
-
22
- ---
23
-
24
- ## 2. Command Reference
25
-
26
- ### `vitris admin setup|status|verify|grant`
27
-
28
- Prepare a branded sibling business admin with the pinned published `0.1.0-alpha.1` installer. `vitris admin setup --site SITE --dir SIBLING_ADMIN --domain admin.customer-domain.com --website HTTPS_SITE_ORIGIN --tenant EXISTING_TENANT_ID --backend-origin HTTPS_BACKEND --plan` writes a local plan. Review it, then repeat with `--apply` and dedicated environment `VITRIS_ADMIN_API_TOKEN`. Default grants are read-only; explicit `--lead-write` must be included in both steps to grant status updates. No cloud writes occur. Site creation accepts `--admin` to create instructions only.
29
-
30
- `vitris admin status --site SITE` reports local metadata. `vitris admin verify --site SITE --dir ADMIN` checks the actual backend contract, identities and stored records without exposing PII. `vitris admin grant --dir ADMIN --grants COMPLETE_MAP_FILE --out NEW_IGNORED_FILE` prepares a local hashed grant map while preserving other installations. See [ADMIN.md](ADMIN.md) for preservation rules, API semantics, secret stdin and explicit provisioning/authentication/DNS/deployment steps.
31
-
32
- ### `vitris doctor`
33
- Runs environment and preflight health checks.
34
- ```bash
35
- vitris doctor [--site <dir>] [--provider cloudflare] [--operation pages|deploy] [--json]
36
- ```
37
- Checks:
38
- - Node.js runtime version (`>= 24`)
39
- - Git availability and worktree cleanliness
40
- - Wrangler installation and authentication
41
- - Site configuration (`launch.json`, `package.json`, `agent/graph.yaml`, `agent/STATE.json`)
42
- - Active process lock (`agent/RUN.lock`)
43
- - Pending transaction recovery journals (`.journal.json`)
44
- - Cloudflare dual authentication (`CLOUDFLARE_API_TOKEN` + `CLOUDFLARE_ACCOUNT_ID` or interactive OAuth via `wrangler whoami`)
45
- - Scoped resource validation (Pages vs D1/R2)
46
-
47
- ---
48
-
49
- ### `vitris site create`
50
- Scaffolds a new customer or project site repository with the workflow graph, agent kit, and configuration.
51
- ```bash
52
- vitris site create --dir <target-path> --slug <site-slug> [--name <display-name>] [--from <source-url>] [--owner <email>] [--blank] [--force] [--dry-run]
53
- ```
54
- Options:
55
- - `--dir`: Target directory for the new site.
56
- - `--harness`: Dependency spec (defaults to this package's exact version); before registry publication, use a tarball or explicit `file:` path relative to the new site.
57
- - `--backend-origin`: Optional backend URL, saved as `launch.json.backendOrigin`. Legacy `--kernel` and `--kernel-origin` flags remain accepted.
58
- - `--slug`: Unique identifier for the site (used in Cloudflare Pages project names).
59
- - `--name`: Human-readable site name.
60
- - `--from`: Live website URL to harvest and crawl.
61
- - `--template`: Catalog template ID, display name, or hosted demo/preview URL. Records the supplied choice and continues through local preview without the selection artifact or adaptation/representative-feedback prompts. The choice is bound after harvest and media auditing so branding uses captured evidence. This route delegates section adaptation to the agent and uses existing, harvested, or stock media; AI image generation is disabled. Reference inventory, critic, fidelity, browser, and quality gates still apply. Missing content remains a visible fill-in and blocks launch.
62
- - Template input first reads the hosted gallery catalog and pins the selected entry and its hash in `agent/template-input.json`. If the catalog is unavailable, the command warns and uses the bundled snapshot, which may be stale. A template absent from that snapshot cannot be selected offline.
63
- - `--template-release`: Optional catalog revision for an ID/name; a hosted URL pins its revision automatically.
64
- - `--content` / `--content-file`: Additional business content and instructions, supplied inline or from a UTF-8 file (up to 256 KB; choose one). Wording is preserved in `onboarding/additional-content.md`, survives harvesting, and is included in authoring and review dependencies.
65
- - `--owner`: Site owner contact email.
66
- - `--blank`: Initialize without a live source URL (skips initial crawl).
67
- - `--force`: Overwrite existing files in non-empty directory.
68
- - `--dry-run`: Preview directory scaffolding actions without touching disk.
69
-
70
- Provide the source, template, and extra content together:
71
-
72
- ```bash
73
- vitris site create --dir ../acme --slug acme --from https://old-site.example --template "Still & Field" --content-file ./acme-notes.md --harness file:../vitris-harness
74
- ```
75
-
76
- Open the new site in your coding agent and continue the prepare/work/complete loop with `npm run go` until local preview is ready. The same inputs work with `vitris-create-site` and `npm run create-site -- ...`. When the initial chat already names a template and supplies content, the agent should pass them at setup and continue the workflow without asking the user to select that template again.
77
-
78
- New redesign sites enable `site.json.typography: {"version":1}` and ship concrete shared roles in `theme/defaults.json`. Defaults are 18px body, 16px controls/navigation, 14px supporting text and one responsive 24–32px H3 treatment. The 12px rendered minimum is a harness quality policy. See [the typography guide](../agent/refs/typography.md) for role tokens, named variants, font weights and reviewed adoption on an existing site. Existing sites and preserve-mode captures retain their current rendering; upgrading the harness does not opt them in.
79
-
80
- For enabled sites, `npm run verify:browser -- --site .` records typography evidence in `agent/reviews/browser.json`, checks every authored route even if omitted from the storyboard, and blocks completion on undersized text or inconsistent roles. Checks cover resting text, supported disclosures/tabs and form validation/results. Refinement verification retains this policy and cannot skip browser checks. New template publication validates every original/branded route before changing the catalog. Custom widgets and text embedded in images still need visual review.
81
-
82
- ---
83
-
84
- ### `vitris run`
85
- Executes single-variant or multi-variant site generation workflows.
86
- ```bash
87
- vitris run [--site <dir>] [--variants 1|5] [--theme <theme-name>] [--theme-scope all|one] [--restart-from <node>] [--reason <text>] [--jev-mode off|shadow|assist] [--compact-packets] [--dry-run]
88
- ```
89
- Options:
90
- - `--site`: Path to the site repository (defaults to `.`).
91
- - `--template`, `--template-release`, `--content`, `--content-file`: The same direct inputs as site creation, also accepted by `npm run go -- ...`. Supply them at run start or preparation, after finishing/canceling any active stage. An identical request preserves the selection identity and history; a revised choice uses normal downstream invalidation. Later explicit picker/chat choices take precedence until a new direct request is supplied. Dry runs validate inputs without saving them. Redesign inputs are rejected in preserve mode.
92
- - `--variants`: Number of design directions to generate (`1` or `5`). Default: `1`.
93
- - `--theme`: Explicit design theme or direction.
94
- - `--theme-scope`: In 5-variant runs, apply theme to `all` variants or `one` variant.
95
- - The active host supplies the author/model. Legacy `--adapter` and `--model` options do not provide unattended author execution. Configure an independent representative-quality reviewer explicitly in `agent/adapter.reviewer.json` if needed.
96
- - `--restart-from`: Invalidate and restart from a specific graph node.
97
- - `--reason`: Required rationale when using `--restart-from`.
98
- - `--jev-mode`: Bounded semantic decision mode (`off`, `shadow`, `assist`). Default: `off`.
99
- - `--design-assist`: One preset that sets mode to `assist` and enables `creativeScoring` and `compositionCheck` when those capabilities were not explicitly set. `--jev-mode off` and `--no-jev` win. Explicit `"creativeScoring": "off"` in `agent/jev.json` stays off. This preset does not enable `workOwnership: delegated`.
100
- - `--no-jev`: Force mode `off`.
101
- - `--compact-packets`: Enable bounded context packet slicing and coverage manifests.
102
- - `--dry-run`: Preview workflow execution plan without launching agent loops.
103
-
104
- ---
105
-
106
- ### Jev Decision Service & Evaluation Tooling
107
-
108
- #### Usage Audit:
109
- Audit recorded tokens, cache reads, and provider stream events across site runs:
110
- ```bash
111
- node scripts/audit-workflow-usage.ts --runs <runs-directory> [--out <output-json>]
112
- ```
113
-
114
- #### Evaluation Harness:
115
- Run comparative benchmarking across the 3 treatments (baseline, compact packets, compact + Jev):
116
- ```bash
117
- node scripts/eval-jev.ts [--mock|--live] [--runs <count>] [--out <output-json>]
118
- ```
119
-
120
- #### Packet Expansion:
121
- Expand a partitioned context item on demand during active-agent execution:
122
- ```bash
123
- node scripts/eval-site.ts --site <dir> --expand-packet <expansion-id> --node <node-id>
124
- ```
125
-
126
- ---
127
-
128
- ### `vitris refine`
129
- Performs targeted, post-launch site refinements using intelligent scope routing, layout preservation, and verifiable regression constraints.
130
- ```bash
131
- vitris refine [--site <dir>] --request "<instruction>" [--scope copy|direction|pages|business] [--force] [--dry-run]
132
- ```
133
- Options:
134
- - `--request`: Natural language change request from operator.
135
- - `--scope`: Optional explicit scope override. If omitted, the classifier automatically routes to `copy`, `direction`, `pages`, or `business`.
136
- - `--force`: Bypass non-critical gate warnings.
137
- - `--dry-run`: Preview classified scope, rationale, and proposed change plan.
138
-
139
- Key Invariants:
140
- - Never restarts harvest.
141
- - Unchanged sections and navigation structure are preserved with AST-level integrity.
142
- - Recoverable file replacement with rollback on validation failure.
143
- - Violating navigation links or dropping media triggers fail-closed rejection (exit code 4).
144
-
145
- ---
146
-
147
- ### `vitris status`
148
- Inspects the current state of a site workflow or design run.
149
- ```bash
150
- vitris status [--site <dir>] [--run <run-id>] [--json]
151
- ```
152
- Reports active node, attempt counts, preview status, and lock ownership without altering progress or acquiring locks.
153
-
154
- ---
155
-
156
- ### `vitris resume`
157
- Resumes a paused, interrupted, or checkpointed workflow.
158
- ```bash
159
- vitris resume [--site <dir>] [--run <run-id>] [--dry-run]
160
- ```
161
-
162
- ---
163
-
164
- Production browser verification defaults to a one-hour subprocess timeout. Set `VITRIS_BROWSER_TIMEOUT_MS` to a bounded integer from 1000 to 86400000 milliseconds when the full route and motion suite needs a different limit. The outer production verifier allows an additional minute for preflight to seal its report. This changes only the runtime allowance; every browser, accessibility, motion and performance check still runs.
165
-
166
- ### `vitris cancel`
167
- Safely terminates an active workflow run, releases process locks (`agent/RUN.lock`), and cleans up stale temporary files.
168
- ```bash
169
- vitris cancel [--site <dir>] [--run <run-id>]
170
- ```
171
-
172
- ---
173
-
174
- ### `vitris feedback import`
175
- Imports structured stakeholder feedback for multi-variant design review.
176
- ```bash
177
- vitris feedback import [--site <dir>] [--run <run-id>] --file <feedback.json> [--dry-run]
178
- ```
179
-
180
- ---
181
-
182
- ### `vitris synthesize`
183
- Synthesizes stakeholder feedback across 5 variants into a unified, high-quality final site candidate.
184
- ```bash
185
- vitris synthesize [--site <dir>] [--run <run-id>] [--feedback <feedback.json>] [--dry-run]
186
- ```
187
-
188
- ---
189
-
190
- ### `vitris verify`
191
- Evaluates build verification and all deterministic graph gates.
192
- ```bash
193
- vitris verify [--site <dir>] [--json] [--dry-run]
194
- ```
195
- Returns structured gate summaries and exit code `0` (pass) or `1` (gates failed).
196
-
197
- ---
198
-
199
- ### `vitris preview`
200
- Serves the local static `dist/` bundle with Single-Page Application (SPA) routing, migration redirect emulation, and cookie compliance sandboxing.
201
- ```bash
202
- vitris preview [--site <dir>] [--port <number>] [--dry-run]
203
- ```
204
-
205
- ---
206
-
207
- ### `vitris deploy`
208
- Builds and verifies locally, then directly uploads the exact staged bundle to Cloudflare Pages. This is the default site deployment path; it does not require GitHub Actions or Cloudflare-hosted builds. The CLI defaults to a preview, while new redesign sites' `npm run deploy` explicitly selects production and `npm run deploy:preview` selects a preview.
209
- ```bash
210
- vitris deploy [--site <dir>] [--provider cloudflare] [--environment preview|production] [--branch <branch>] [--quick] [--dry-run]
211
- ```
212
- Workflow:
213
- 1. Scoped preflight check verifying Cloudflare credentials (`CLOUDFLARE_API_TOKEN` + `CLOUDFLARE_ACCOUNT_ID` or `wrangler login`).
214
- 2. Build and verify the static `dist/` bundle locally, then stage its exact bytes (aborts if verification fails or source/output changes).
215
- 3. Upload the staged bundle through Wrangler to the configured Pages project and environment; record the source, artifact and deployment identity.
216
- 4. Executes automated remote smoke check against the deployed `*.pages.dev` URL.
217
-
218
- Quick publish: `vitris deploy --quick --environment production` rebuilds and uploads without graph gates, browser reviews, or launch preflight. New sites also include `npm run deploy:quick`. The CLI still defaults to preview; preservation sites support previews only and quick mode also skips screenshot comparisons. Compilation, Cloudflare credentials, staged-bundle integrity and the remote HTTP smoke check still apply. Receipts use policy `quick-publish-build-only-v1` and results report `verification: "build-only"`. Skipped reviews are never marked passed. Ordinary deployment retains full verification.
219
-
220
- ---
221
-
222
- ### `vitris share`
223
- Launches an authenticated preview or interactive multi-variant comparison review server.
224
- ```bash
225
- vitris share [--site <dir>] [--run <run-id>] [--port <number>] [--dry-run]
226
- ```
227
-
228
- ---
229
-
230
- ## 3. Automation Contracts
231
-
232
- The `vitris` CLI is designed for programmatic execution in CI/CD pipelines, agent harnesses, and orchestration scripts.
233
-
234
- ### Stable Exit Codes
235
-
236
- | Code | Constant | Meaning |
237
- | :---: | :--- | :--- |
238
- | `0` | `SUCCESS` | Command completed successfully. |
239
- | `1` | `GATES_FAILED` | Graph evaluation or quality verification failed. |
240
- | `2` | `CONFIG_OR_CLI_ERROR` | Missing or invalid arguments, configuration, or environment. |
241
- | `3` | `PRECONDITION_FAILED` | Directory already exists, required predecessor not finished. |
242
- | `4` | `REFINEMENT_REJECTED` | Proposed refinement caused a regression (e.g. dropped route or missing asset). |
243
- | `5` | `ABORTED` | Execution canceled via signal (`SIGINT`, `SIGTERM`, `AbortSignal`). |
244
- | `6` | `DEPLOYMENT_FAILED` | Cloudflare Pages deployment or remote smoke check failed. |
245
-
246
- ### Structured Output Modes
247
-
248
- `--json` and `--events` are **strictly mutually exclusive**:
249
- - `--json`: Emits exactly one valid JSON envelope to `stdout` upon completion.
250
- - `--events`: Streams timestamped NDJSON events (`{"type": "...", "timestamp": "...", ...}`) to `stdout`.
251
-
252
- #### Standard JSON Envelope Schema
253
- ```json
254
- {
255
- "ok": true,
256
- "exitCode": 0,
257
- "summary": "Human-readable summary message",
258
- "data": {},
259
- "failures": [],
260
- "error": "Error message if ok is false"
261
- }
262
- ```
263
-
264
- ### Security & Credential Isolation
265
-
266
- - Tokens, passwords, and API secrets are **never** logged to stdout, stderr, or event streams.
267
- - Credentials are **never** written into `launch.json`, prompts, or artifacts.
268
- - Subprocesses receive environment variables directly via secure process inheritance.
269
-
270
- ---
271
-
272
- ## 4. Programmatic TypeScript API
273
-
274
- The CLI features are also exported as an ES Module TypeScript API:
275
-
276
- ```typescript
277
- import {
278
- createSite,
279
- runDoctor,
280
- runSite,
281
- refineSite,
282
- statusSite,
283
- resumeSite,
284
- cancelSite,
285
- importFeedback,
286
- synthesizeSite,
287
- verifySite,
288
- previewSite,
289
- deploySite,
290
- shareSite,
291
- EXIT_CODES,
292
- } from "@tryvitris/website-harness/cli";
293
-
294
- // Example: Run doctor preflight
295
- const doctorResult = await runDoctor({ site: "./my-site", provider: "cloudflare" });
296
- if (!doctorResult.ok) {
297
- console.error("Doctor failed:", doctorResult.summary);
298
- }
299
-
300
- // Example: Refine copy with AbortController
301
- const controller = new AbortController();
302
- const refineResult = await refineSite({
303
- site: "./my-site",
304
- request: "Update homepage headline to emphasize local reliability.",
305
- signal: controller.signal,
306
- });
307
- ```
308
-
309
-
310
- ### Reproducible harness checks and trials
311
-
312
- `npm run test:freeze` runs typecheck, CLI build, the full tests, a packed install/build smoke check, and source archive round-trip verification. It writes a new baseline under `artifacts/official-test/`. See [official test protocol](OFFICIAL-TEST.md) for trial creation, active-agent continuation, spend limitations, and outcome labeling.
1
+ # Vitris Unified CLI & Automation Contracts
2
+
3
+ The `vitris` CLI (`@tryvitris/website-harness`) provides a unified, operator-friendly command line interface and automation harness for creating, running, refining, evaluating, sharing, and deploying static websites.
4
+
5
+ ---
6
+
7
+ ## 1. Installation & Binary
8
+
9
+ Install the stable release as a dependency or run via `npx`. For local tarballs and managed upgrades, see [distribution](DISTRIBUTION.md):
10
+
11
+ ```bash
12
+ npm install --save-dev --save-exact @tryvitris/website-harness@1.0.0
13
+ npx vitris --help
14
+ ```
15
+
16
+ Within the `@tryvitris/website-harness` repository itself:
17
+ ```bash
18
+ npm run build:cli
19
+ node bin/vitris.js --help
20
+ ```
21
+
22
+ ---
23
+
24
+ ## 2. Command Reference
25
+
26
+ ### `vitris admin setup|status|verify|grant`
27
+
28
+ Prepare a branded sibling business admin with the pinned published `0.1.0-alpha.1` installer. `vitris admin setup --site SITE --dir SIBLING_ADMIN --domain admin.customer-domain.com --website HTTPS_SITE_ORIGIN --tenant EXISTING_TENANT_ID --backend-origin HTTPS_BACKEND --plan` writes a local plan. Review it, then repeat with `--apply` and dedicated environment `VITRIS_ADMIN_API_TOKEN`. Default grants are read-only; explicit `--lead-write` must be included in both steps to grant status updates. No cloud writes occur. Site creation accepts `--admin` to create instructions only.
29
+
30
+ `vitris admin status --site SITE` reports local metadata. `vitris admin verify --site SITE --dir ADMIN` checks the actual backend contract, identities and stored records without exposing PII. `vitris admin grant --dir ADMIN --grants COMPLETE_MAP_FILE --out NEW_IGNORED_FILE` prepares a local hashed grant map while preserving other installations. See [ADMIN.md](ADMIN.md) for preservation rules, API semantics, secret stdin and explicit provisioning/authentication/DNS/deployment steps.
31
+
32
+ ### `vitris doctor`
33
+ Runs environment and preflight health checks.
34
+ ```bash
35
+ vitris doctor [--site <dir>] [--provider cloudflare] [--operation pages|deploy] [--json]
36
+ ```
37
+ Checks:
38
+ - Node.js runtime version (`>= 24`)
39
+ - Git availability and worktree cleanliness
40
+ - Wrangler installation and authentication
41
+ - Site configuration (`launch.json`, `package.json`, `agent/graph.yaml`, `agent/STATE.json`)
42
+ - Active process lock (`agent/RUN.lock`)
43
+ - Pending transaction recovery journals (`.journal.json`)
44
+ - Cloudflare dual authentication (`CLOUDFLARE_API_TOKEN` + `CLOUDFLARE_ACCOUNT_ID` or interactive OAuth via `wrangler whoami`)
45
+ - Scoped resource validation (Pages vs D1/R2)
46
+
47
+ ---
48
+
49
+ ### `vitris site create`
50
+ Scaffolds a new customer or project site repository with the workflow graph, agent kit, and configuration.
51
+ ```bash
52
+ vitris site create --dir <target-path> --slug <site-slug> [--name <display-name>] [--from <source-url>] [--owner <email>] [--blank] [--force] [--dry-run]
53
+ ```
54
+ Options:
55
+ - `--dir`: Target directory for the new site.
56
+ - `--harness`: Dependency spec (defaults to this package's exact version); before registry publication, use a tarball or explicit `file:` path relative to the new site.
57
+ - `--backend-origin`: Optional backend URL, saved as `launch.json.backendOrigin`. Legacy `--kernel` and `--kernel-origin` flags remain accepted.
58
+ - `--slug`: Unique identifier for the site (used in Cloudflare Pages project names).
59
+ - `--name`: Human-readable site name.
60
+ - `--from`: Live website URL to harvest and crawl.
61
+ - `--template`: Catalog template ID, display name, or hosted demo/preview URL. Records the supplied choice and continues through local preview without the selection artifact or adaptation/representative-feedback prompts. The choice is bound after harvest and media auditing so branding uses captured evidence. This route delegates section adaptation to the agent and uses existing, harvested, or stock media; AI image generation is disabled. Reference inventory, critic, fidelity, browser, and quality gates still apply. Missing content remains a visible fill-in and blocks launch.
62
+ - Template input first reads the hosted gallery catalog and pins the selected entry and its hash in `agent/template-input.json`. If the catalog is unavailable, the command warns and uses the bundled snapshot, which may be stale. A template absent from that snapshot cannot be selected offline.
63
+ - `--template-release`: Optional catalog revision for an ID/name; a hosted URL pins its revision automatically.
64
+ - `--content` / `--content-file`: Additional business content and instructions, supplied inline or from a UTF-8 file (up to 256 KB; choose one). Wording is preserved in `onboarding/additional-content.md`, survives harvesting, and is included in authoring and review dependencies.
65
+ - `--owner`: Site owner contact email.
66
+ - `--blank`: Initialize without a live source URL (skips initial crawl).
67
+ - `--force`: Overwrite existing files in non-empty directory.
68
+ - `--dry-run`: Preview directory scaffolding actions without touching disk.
69
+
70
+ Provide the source, template, and extra content together:
71
+
72
+ ```bash
73
+ vitris site create --dir ../acme --slug acme --from https://old-site.example --template "Still & Field" --content-file ./acme-notes.md --harness file:../vitris-harness
74
+ ```
75
+
76
+ Open the new site in your coding agent and continue the prepare/work/complete loop with `npm run go` until local preview is ready. The same inputs work with `vitris-create-site` and `npm run create-site -- ...`. When the initial chat already names a template and supplies content, the agent should pass them at setup and continue the workflow without asking the user to select that template again.
77
+
78
+ New redesign sites enable `site.json.typography: {"version":1}` and ship concrete shared roles in `theme/defaults.json`. Defaults are 18px body, 16px controls/navigation, 14px supporting text and one responsive 24–32px H3 treatment. The 12px rendered minimum is a harness quality policy. See [the typography guide](../agent/refs/typography.md) for role tokens, named variants, font weights and reviewed adoption on an existing site. Existing sites and preserve-mode captures retain their current rendering; upgrading the harness does not opt them in.
79
+
80
+ For enabled sites, `npm run verify:browser -- --site .` records typography evidence in `agent/reviews/browser.json`, checks every authored route even if omitted from the storyboard, and blocks completion on undersized text or inconsistent roles. Checks cover resting text, supported disclosures/tabs and form validation/results. Refinement verification retains this policy and cannot skip browser checks. New template publication validates every original/branded route before changing the catalog. Custom widgets and text embedded in images still need visual review.
81
+
82
+ ---
83
+
84
+ ### `vitris run`
85
+ Executes single-variant or multi-variant site generation workflows.
86
+ ```bash
87
+ vitris run [--site <dir>] [--variants 1|5] [--theme <theme-name>] [--theme-scope all|one] [--restart-from <node>] [--reason <text>] [--jev-mode off|shadow|assist] [--compact-packets] [--dry-run]
88
+ ```
89
+ Options:
90
+ - `--site`: Path to the site repository (defaults to `.`).
91
+ - `--template`, `--template-release`, `--content`, `--content-file`: The same direct inputs as site creation, also accepted by `npm run go -- ...`. Supply them at run start or preparation, after finishing/canceling any active stage. An identical request preserves the selection identity and history; a revised choice uses normal downstream invalidation. Later explicit picker/chat choices take precedence until a new direct request is supplied. Dry runs validate inputs without saving them. Redesign inputs are rejected in preserve mode.
92
+ - `--variants`: Number of design directions to generate (`1` or `5`). Default: `1`.
93
+ - `--theme`: Explicit design theme or direction.
94
+ - `--theme-scope`: In 5-variant runs, apply theme to `all` variants or `one` variant.
95
+ - The active host supplies the author/model. Legacy `--adapter` and `--model` options do not provide unattended author execution. Configure an independent representative-quality reviewer explicitly in `agent/adapter.reviewer.json` if needed.
96
+ - `--restart-from`: Invalidate and restart from a specific graph node.
97
+ - `--reason`: Required rationale when using `--restart-from`.
98
+ - `--jev-mode`: Bounded semantic decision mode (`off`, `shadow`, `assist`). Default: `off`.
99
+ - `--design-assist`: One preset that sets mode to `assist` and enables `creativeScoring` and `compositionCheck` when those capabilities were not explicitly set. `--jev-mode off` and `--no-jev` win. Explicit `"creativeScoring": "off"` in `agent/jev.json` stays off. This preset does not enable `workOwnership: delegated`.
100
+ - `--no-jev`: Force mode `off`.
101
+ - `--compact-packets`: Enable bounded context packet slicing and coverage manifests.
102
+ - `--dry-run`: Preview workflow execution plan without launching agent loops.
103
+
104
+ ---
105
+
106
+ ### Jev Decision Service & Evaluation Tooling
107
+
108
+ #### Usage Audit:
109
+ Audit recorded tokens, cache reads, and provider stream events across site runs:
110
+ ```bash
111
+ node scripts/audit-workflow-usage.ts --runs <runs-directory> [--out <output-json>]
112
+ ```
113
+
114
+ #### Evaluation Harness:
115
+ Run comparative benchmarking across the 3 treatments (baseline, compact packets, compact + Jev):
116
+ ```bash
117
+ node scripts/eval-jev.ts [--mock|--live] [--runs <count>] [--out <output-json>]
118
+ ```
119
+
120
+ #### Packet Expansion:
121
+ Expand a partitioned context item on demand during active-agent execution:
122
+ ```bash
123
+ node scripts/eval-site.ts --site <dir> --expand-packet <expansion-id> --node <node-id>
124
+ ```
125
+
126
+ ---
127
+
128
+ ### `vitris refine`
129
+ Performs targeted, post-launch site refinements using intelligent scope routing, layout preservation, and verifiable regression constraints.
130
+ ```bash
131
+ vitris refine [--site <dir>] --request "<instruction>" [--scope copy|direction|pages|business] [--force] [--dry-run]
132
+ ```
133
+ Options:
134
+ - `--request`: Natural language change request from operator.
135
+ - `--scope`: Optional explicit scope override. If omitted, the classifier automatically routes to `copy`, `direction`, `pages`, or `business`.
136
+ - `--force`: Bypass non-critical gate warnings.
137
+ - `--dry-run`: Preview classified scope, rationale, and proposed change plan.
138
+
139
+ Key Invariants:
140
+ - Never restarts harvest.
141
+ - Unchanged sections and navigation structure are preserved with AST-level integrity.
142
+ - Recoverable file replacement with rollback on validation failure.
143
+ - Violating navigation links or dropping media triggers fail-closed rejection (exit code 4).
144
+
145
+ ---
146
+
147
+ ### `vitris status`
148
+ Inspects the current state of a site workflow or design run.
149
+ ```bash
150
+ vitris status [--site <dir>] [--run <run-id>] [--json]
151
+ ```
152
+ Reports active node, attempt counts, preview status, and lock ownership without altering progress or acquiring locks.
153
+
154
+ ---
155
+
156
+ ### `vitris resume`
157
+ Resumes a paused, interrupted, or checkpointed workflow.
158
+ ```bash
159
+ vitris resume [--site <dir>] [--run <run-id>] [--dry-run]
160
+ ```
161
+
162
+ ---
163
+
164
+ Production browser verification defaults to a one-hour subprocess timeout. Set `VITRIS_BROWSER_TIMEOUT_MS` to a bounded integer from 1000 to 86400000 milliseconds when the full route and motion suite needs a different limit. The outer production verifier allows an additional minute for preflight to seal its report. This changes only the runtime allowance; every browser, accessibility, motion and performance check still runs.
165
+
166
+ ### `vitris cancel`
167
+ Safely terminates an active workflow run, releases process locks (`agent/RUN.lock`), and cleans up stale temporary files.
168
+ ```bash
169
+ vitris cancel [--site <dir>] [--run <run-id>]
170
+ ```
171
+
172
+ ---
173
+
174
+ ### `vitris feedback import`
175
+ Imports structured stakeholder feedback for multi-variant design review.
176
+ ```bash
177
+ vitris feedback import [--site <dir>] [--run <run-id>] --file <feedback.json> [--dry-run]
178
+ ```
179
+
180
+ ---
181
+
182
+ ### `vitris synthesize`
183
+ Synthesizes stakeholder feedback across 5 variants into a unified, high-quality final site candidate.
184
+ ```bash
185
+ vitris synthesize [--site <dir>] [--run <run-id>] [--feedback <feedback.json>] [--dry-run]
186
+ ```
187
+
188
+ ---
189
+
190
+ ### `vitris verify`
191
+ Evaluates build verification and all deterministic graph gates.
192
+ ```bash
193
+ vitris verify [--site <dir>] [--json] [--dry-run]
194
+ ```
195
+ Returns structured gate summaries and exit code `0` (pass) or `1` (gates failed).
196
+
197
+ ---
198
+
199
+ ### `vitris preview`
200
+ Serves the local static `dist/` bundle with Single-Page Application (SPA) routing, migration redirect emulation, and cookie compliance sandboxing.
201
+ ```bash
202
+ vitris preview [--site <dir>] [--port <number>] [--dry-run]
203
+ ```
204
+
205
+ ---
206
+
207
+ ### `vitris deploy`
208
+ Builds and verifies locally, then directly uploads the exact staged bundle to Cloudflare Pages. This is the default site deployment path; it does not require GitHub Actions or Cloudflare-hosted builds. The CLI defaults to a preview, while new redesign sites' `npm run deploy` explicitly selects production and `npm run deploy:preview` selects a preview.
209
+ ```bash
210
+ vitris deploy [--site <dir>] [--provider cloudflare] [--environment preview|production] [--branch <branch>] [--quick] [--dry-run]
211
+ ```
212
+ Workflow:
213
+ 1. Scoped preflight check verifying Cloudflare credentials (`CLOUDFLARE_API_TOKEN` + `CLOUDFLARE_ACCOUNT_ID` or `wrangler login`).
214
+ 2. Build and verify the static `dist/` bundle locally, then stage its exact bytes (aborts if verification fails or source/output changes).
215
+ 3. Upload the staged bundle through Wrangler to the configured Pages project and environment; record the source, artifact and deployment identity.
216
+ 4. Executes automated remote smoke check against the deployed `*.pages.dev` URL.
217
+
218
+ Quick publish: `vitris deploy --quick --environment production` rebuilds and uploads without graph gates, browser reviews, or launch preflight. New sites also include `npm run deploy:quick`. The CLI still defaults to preview; preservation sites support previews only and quick mode also skips screenshot comparisons. Compilation, Cloudflare credentials, staged-bundle integrity and the remote HTTP smoke check still apply. Receipts use policy `quick-publish-build-only-v1` and results report `verification: "build-only"`. Skipped reviews are never marked passed. Ordinary deployment retains full verification.
219
+
220
+ ---
221
+
222
+ ### `vitris share`
223
+ Launches an authenticated preview or interactive multi-variant comparison review server.
224
+ ```bash
225
+ vitris share [--site <dir>] [--run <run-id>] [--port <number>] [--dry-run]
226
+ ```
227
+
228
+ ---
229
+
230
+ ## 3. Automation Contracts
231
+
232
+ The `vitris` CLI is designed for programmatic execution in CI/CD pipelines, agent harnesses, and orchestration scripts.
233
+
234
+ ### Stable Exit Codes
235
+
236
+ | Code | Constant | Meaning |
237
+ | :---: | :--- | :--- |
238
+ | `0` | `SUCCESS` | Command completed successfully. |
239
+ | `1` | `GATES_FAILED` | Graph evaluation or quality verification failed. |
240
+ | `2` | `CONFIG_OR_CLI_ERROR` | Missing or invalid arguments, configuration, or environment. |
241
+ | `3` | `PRECONDITION_FAILED` | Directory already exists, required predecessor not finished. |
242
+ | `4` | `REFINEMENT_REJECTED` | Proposed refinement caused a regression (e.g. dropped route or missing asset). |
243
+ | `5` | `ABORTED` | Execution canceled via signal (`SIGINT`, `SIGTERM`, `AbortSignal`). |
244
+ | `6` | `DEPLOYMENT_FAILED` | Cloudflare Pages deployment or remote smoke check failed. |
245
+
246
+ ### Structured Output Modes
247
+
248
+ `--json` and `--events` are **strictly mutually exclusive**:
249
+ - `--json`: Emits exactly one valid JSON envelope to `stdout` upon completion.
250
+ - `--events`: Streams timestamped NDJSON events (`{"type": "...", "timestamp": "...", ...}`) to `stdout`.
251
+
252
+ #### Standard JSON Envelope Schema
253
+ ```json
254
+ {
255
+ "ok": true,
256
+ "exitCode": 0,
257
+ "summary": "Human-readable summary message",
258
+ "data": {},
259
+ "failures": [],
260
+ "error": "Error message if ok is false"
261
+ }
262
+ ```
263
+
264
+ ### Security & Credential Isolation
265
+
266
+ - Tokens, passwords, and API secrets are **never** logged to stdout, stderr, or event streams.
267
+ - Credentials are **never** written into `launch.json`, prompts, or artifacts.
268
+ - Subprocesses receive environment variables directly via secure process inheritance.
269
+
270
+ ---
271
+
272
+ ## 4. Programmatic TypeScript API
273
+
274
+ The CLI features are also exported as an ES Module TypeScript API:
275
+
276
+ ```typescript
277
+ import {
278
+ createSite,
279
+ runDoctor,
280
+ runSite,
281
+ refineSite,
282
+ statusSite,
283
+ resumeSite,
284
+ cancelSite,
285
+ importFeedback,
286
+ synthesizeSite,
287
+ verifySite,
288
+ previewSite,
289
+ deploySite,
290
+ shareSite,
291
+ EXIT_CODES,
292
+ } from "@tryvitris/website-harness/cli";
293
+
294
+ // Example: Run doctor preflight
295
+ const doctorResult = await runDoctor({ site: "./my-site", provider: "cloudflare" });
296
+ if (!doctorResult.ok) {
297
+ console.error("Doctor failed:", doctorResult.summary);
298
+ }
299
+
300
+ // Example: Refine copy with AbortController
301
+ const controller = new AbortController();
302
+ const refineResult = await refineSite({
303
+ site: "./my-site",
304
+ request: "Update homepage headline to emphasize local reliability.",
305
+ signal: controller.signal,
306
+ });
307
+ ```
308
+
309
+
310
+ ### Reproducible harness checks and trials
311
+
312
+ `npm run test:freeze` runs typecheck, CLI build, the full tests, a packed install/build smoke check, and source archive round-trip verification. It writes a new baseline under `artifacts/official-test/`. See [official test protocol](OFFICIAL-TEST.md) for trial creation, active-agent continuation, spend limitations, and outcome labeling.
313
+
314
+ For explicitly requested appointment booking, read [SCHEDULING.md](SCHEDULING.md). Public `launch.json.scheduling` metadata enables the standard route on compatible source/release builds; no scheduling setup CLI, remote migration or production activation is implied.