Skip to main content

vitrify_cli/help/
verbs.rs

1//! Each command's `--help` block, printed after its options: `Reads:`,
2//! `Writes:`, `Prints:`, `Exit status:`, `Config:`, `Examples:` and
3//! `Procedure:`, in that order, the last three where they apply.
4
5pub const LOCATE: &str = "\
6Reads:   SDD discovery (specs/*/sdd.md, specs/*.sdd.md, then the files git would commit);
7         with --units, the SDD's units and their front matter
8Writes:  nothing
9Prints:  one line per SDD: root, shape, slug, version, status, unit count
10         --json: [{root, shape, sdd, title, version, status, scope_roots, units}]
11         --units: one line per unit: status, parallel group, claim_seq, claimable
12         --units --json: {sdd, shape, version, status, units: [{unit, status, parallel_group,
13           depends_on, claimed_by, claim_expires, claim_seq, lease_live, claimable, file}]}
14Exit status: 0 listed · 4 no SDD; with --units, several and no --sdd · 2 usage error
15         An SDD of a schema version this vitrify does not read is still listed.
16Examples:
17  vitrify locate
18  vitrify locate --units --sdd specs/calc
19  vitrify locate --units --json";
20
21pub const READSET: &str = "\
22Reads:   the core file's Ground Rules and Technology Decisions; the unit's entry; each
23         consumed contract, and the body a pinned contract stands for
24Writes:  nothing
25Prints:  one path per line in reading order, `  ::  <region>` for a region of a shared file
26         --json: {unit, sdd, shape, consumes, readings: [{path, region}]}
27Exit status: 0 resolved (and within budget) · 2 over the --budget limit, or a usage error
28         · 4 no SDD, unknown unit, a missing section or contract, a pin that does not
29         resolve or whose hash is not its authority's
30Config:  lint.readset_budget_bytes (VITRIFY_LINT_READSET_BUDGET_BYTES), for a bare --budget
31Examples:
32  vitrify readset --unit U-002 --sdd specs/calc
33  vitrify readset --unit U-002 --json
34  vitrify readset --unit U-002 --budget
35Procedure: vitrify brief build-unit (workers) · vitrify brief authoring (sizing a unit)";
36
37pub const CLAIM: &str = "\
38A protocol verb for workers, the integrator and authored baselines; not run by hand while
39`vitrify run` builds the SDD.
40Reads:   the mainline head (checked out into a throwaway .vitrify/tx-<pid>-<n> worktree);
41         the unit's front matter there
42Writes:  a published mainline commit `sdd: claim <unit> (c<seq>) by <holder>`: status Claimed,
43         claimed_by, claim_expires = now + lease, claim_seq + 1; a claim event; the ledger.
44         The primary checkout is fast-forwarded when it has mainline checked out.
45Prints:  one JSON line: {unit, op, holder, claim_seq, claim_expires, commit, mainline}
46Exit status: 0 published · 1 git failure · 2 usage error · 4 unit missing or not claimable
47         (the reason is named) · 5 lost the publish race after 3 attempts
48Config:  mainline (VITRIFY_MAINLINE), after --mainline; --lease-minutes defaults to 60
49         and does not read run.lease_minutes
50Examples:
51  vitrify claim --unit U-003 --holder w1 --sdd specs/calc
52  vitrify claim --unit U-003 --holder w1 --lease-minutes 90 --mainline main
53Procedure: vitrify brief build-unit · vitrify brief kickoff";
54
55pub const RENEW: &str = "\
56A protocol verb for workers, the integrator and authored baselines; not run by hand while
57`vitrify run` builds the SDD.
58Reads:   the mainline head (throwaway .vitrify/tx-<pid>-<n> worktree); the unit's lease
59Writes:  a published mainline commit: claim_expires = now + lease; a renew event; the ledger
60Prints:  one JSON line: {unit, op, holder, claim_seq, claim_expires, commit, mainline}
61Exit status: 0 published · 1 git failure · 2 usage error · 4 unit missing, or not Claimed
62         by this holder · 5 lost the publish race after 3 attempts · 6 the lease has
63         already expired (renew refused: claim again)
64Config:  mainline (VITRIFY_MAINLINE), after --mainline; --lease-minutes defaults to 60
65Examples:
66  vitrify renew --unit U-003 --holder w1 --sdd specs/calc
67Procedure: vitrify brief build-unit";
68
69pub const RELEASE: &str = "\
70A protocol verb for workers, the integrator and authored baselines; not run by hand while
71`vitrify run` builds the SDD.
72Reads:   the mainline head (throwaway .vitrify/tx-<pid>-<n> worktree); the unit's claim
73Writes:  a published mainline commit: status Ready, holder and expiry cleared, claim_seq kept;
74         a release event; the ledger
75Prints:  one JSON line: {unit, op, holder, claim_seq, claim_expires, commit, mainline}
76Exit status: 0 published · 1 git failure · 2 usage error · 4 unit missing, or not Claimed
77         by this holder · 5 lost the publish race after 3 attempts
78Config:  mainline (VITRIFY_MAINLINE), after --mainline
79Examples:
80  vitrify release --unit U-003 --holder w1 --sdd specs/calc
81Procedure: vitrify brief build-unit · vitrify brief integrate";
82
83pub const TRACE: &str = "\
84Protocol verbs for workers, the integrator and authored baselines; not run by hand while
85`vitrify run` builds the SDD.
86Subcommands: record (write a unit's trace and stamp it Built or Verified) · verify (compare
87         a unit's recorded trace with its current inputs)
88Exit status: 2 without a subcommand; see each subcommand's --help
89Examples:
90  vitrify trace record --unit U-003 --stamp built --sdd specs/calc
91  vitrify trace verify --unit U-003 --json";
92
93pub const TRACE_RECORD: &str = "\
94A protocol verb for workers, the integrator and authored baselines; not run by hand while
95`vitrify run` builds the SDD. A change entry's re-stamps are vitrify change apply's.
96Reads:   the unit's entry, its consumed contracts, Ground Rules and Technology Decisions;
97         git HEAD for the default commit
98Writes:  the working tree: the unit's trace map; built sets status Built and
99         built: <date> @ SDD <version>, commit <sha>; verified sets status Verified and
100         verified:, and clears claimed_by and claim_expires. No journal event, no ledger.
101Prints:  one JSON object: {unit, recorded, stamp, file}
102Exit status: 0 recorded · 2 usage error · 4 no SDD, the unit or a consumed contract missing
103Examples:
104  vitrify trace record --unit U-003 --stamp built --sdd specs/calc
105  vitrify trace record --unit U-003 --stamp verified --commit 3f2a9c1
106Procedure: vitrify brief build-unit · vitrify brief integrate";
107
108pub const TRACE_VERIFY: &str = "\
109Reads:   the unit's recorded trace and its current inputs
110Writes:  nothing
111Prints:  `U-###: trace matches`, or `U-###: STALE — mismatched keys: …`
112         --json: {unit, match, mismatches: [{key, recorded, current}]}
113Exit status: 0 matches · 3 a key differs · 4 no SDD, unknown unit, or no recorded trace
114         · 2 usage error
115Examples:
116  vitrify trace verify --unit U-003 --sdd specs/calc
117  vitrify trace verify --unit U-003 --json
118Procedure: vitrify brief integrate";
119
120pub const LEDGER: &str = "\
121Subcommands: progress (the one-line progress summary) · regen (rewrite or --check the
122         derived ledger; a protocol verb for the integrator and authored baselines, not
123         run by hand while `vitrify run` builds the SDD)
124Exit status: 2 without a subcommand; see each subcommand's --help
125Examples:
126  vitrify ledger progress --all
127  vitrify ledger regen --check --sdd specs/calc";
128
129pub const LEDGER_REGEN: &str = "\
130A protocol verb for the integrator and authored baselines; not run by hand while
131`vitrify run` builds the SDD.
132Reads:   unit front matter; with --check, the ledger on disk
133Writes:  the working tree: ledger.md (bundle) or the ## State Ledger section (single file);
134         nothing with --check
135Prints:  the progress line, and the written path on stderr
136         --check: `ledger current (<path>)`, or the first differing line, derived and found
137Exit status: 0 written, or current · 3 --check found a difference, or no ledger · 4 no SDD,
138         or several and no --sdd · 2 usage error
139Examples:
140  vitrify ledger regen --sdd specs/calc
141  vitrify ledger regen --all --check
142Procedure: vitrify brief integrate";
143
144pub const LEDGER_PROGRESS: &str = "\
145Reads:   unit front matter
146Writes:  nothing
147Prints:  Progress: <V>/<total> Verified · <n> <Status> · … (Retired not in the total);
148         with --all one line per SDD, prefixed with its slug
149Exit status: 0 printed · 4 no SDD, or several and no --sdd · 2 usage error
150Examples:
151  vitrify ledger progress --sdd specs/calc
152  vitrify ledger progress --all";
153
154pub const JOURNAL: &str = "\
155Subcommands: append (add one event; a protocol verb for workers, the integrator and
156         authored baselines, not run by hand while `vitrify run` builds the SDD) · replay
157         (check the journal against front matter)
158Exit status: 2 without a subcommand; see each subcommand's --help
159Examples:
160  vitrify journal replay --all
161  vitrify journal append --event built --unit U-003 --sdd specs/calc";
162
163pub const JOURNAL_APPEND: &str = "\
164A protocol verb for workers, the integrator and authored baselines; not run by hand while
165`vitrify run` builds the SDD. A change entry's events are vitrify change apply's.
166Reads:   the journal's last seq; the SDD's version
167Writes:  the working tree: one line appended to journal.ndjson (bundle) or the ## Journal
168         block (single file), created on first use; seq = last + 1, at = now (UTC)
169Prints:  the appended event line
170Exit status: 0 appended · 2 usage error, or a kind other than change or audit without --unit
171         · 4 no SDD, or several and no --sdd
172Examples:
173  vitrify journal append --event built --unit U-003 --actor w1 --claim-seq 2 --sdd specs/calc
174  vitrify journal append --event audit --findings 0
175Procedure: vitrify brief integrate · vitrify brief kickoff";
176
177pub const JOURNAL_REPLAY: &str = "\
178Reads:   the journal (journal.ndjson, or the ## Journal block) and unit front matter
179Writes:  nothing
180Prints:  `journal consistent (N events)`, or one `order: …` or
181         `mismatch U.field: journal projects …, front matter says …` line per problem;
182         --all prefixes each line with the slug, `calc: no journal yet` where none
183         --json: {events, consistent, order_findings, mismatches, projection};
184         --all: an array of the same, each led by sdd and root
185Exit status: 0 consistent · 3 an order finding or mismatch · 4 no SDD, several and no --sdd,
186         or no journal (an SDD with no journal does not fail --all) · 2 usage error
187Examples:
188  vitrify journal replay --sdd specs/calc
189  vitrify journal replay --all --json
190Procedure: vitrify brief kickoff";
191
192pub const AUDIT: &str = "\
193Reads:   the SDD, its journal, the working tree under scope_roots; check 4 runs Verified
194         units' Verification commands (sh -c from the repository root)
195Writes:  nothing by default. --fix-leases, --apply-stale and --journal edit the working tree:
196         unit front matter, journal events, the ledger
197Prints:  `audit clean (7/7 checks)`, or one `[check N] subject: cause → remediation` line
198         per finding; --all prefixes each line with the slug
199         --json: {clean, findings: [{check, subject, cause, remediation}]};
200         --all: an array of {sdd, root, clean, findings}
201Exit status: 0 clean · 2 a finding (a fixing run still exits 2: re-run to confirm), or a
202         usage error · 4 no SDD, or several and no --sdd
203Config:  run.gate_jobs (VITRIFY_RUN_GATE_JOBS), for check 4
204Examples:
205  vitrify audit --sdd specs/calc
206  vitrify audit --all --skip-rotten --json
207  vitrify audit --apply-stale --journal --sdd specs/calc
208Procedure: vitrify brief kickoff · vitrify brief integrate";
209
210pub const BRIEF: &str = "\
211Reads:   ~/.vitrify/briefs/<task>.md ($VITRIFY_HOME; an override on disk wins); build-unit
212         with --unit --holder also reads the SDD, the unit's reading set and its claim
213Writes:  nothing in the repository; restores or refreshes its copy under ~/.vitrify/
214Prints:  no task: the procedure index (task, what it is for, who follows it)
215         a task: that procedure, filled with this vitrify's version and values
216         build-unit --unit --holder: the whole worker prompt vitrify run hands a worker
217Exit status: 0 printed · 2 --unit and --holder not given together, or not to build-unit,
218         or a usage error · 4 unknown unit, no SDD, or several and no --sdd
219Config:  run.status_check_seconds (VITRIFY_RUN_STATUS_CHECK_SECONDS), in brief run;
220         run.worktree_dir (VITRIFY_RUN_WORKTREE_DIR); run.lease_minutes
221         (VITRIFY_RUN_LEASE_MINUTES), in the worker prompt; VITRIFY_HOME
222Examples:
223  vitrify brief
224  vitrify brief change
225  vitrify brief build-unit --unit U-003 --holder w1 --sdd specs/calc";
226
227pub const INIT: &str = "\
228Sets up this machine, once: no other command creates ~/.vitrify/, and every other command
229refuses until this has run. Not a repository's step: run it in your own terminal.
230Reads:   git and the harness CLIs on PATH (claude, codex, opencode: one real model call
231         each, and one per role that adds flags)
232Writes:  ~/.vitrify/config.toml — every setting at its default, the harness role profiles,
233         and the probe record (the working streaming spellings); materializes the briefs,
234         schemas and templates under ~/.vitrify/
235Prints:  one `status: text` line per check, status ok, FAIL, untested or note, ending
236         `ok: recorded the probe in ~/.vitrify/config.toml`
237         --json: {green, checks: [{status, text}], harnesses: [{name, present, version,
238           headless, failure}]}
239Exit status: 0 set up, nothing failed · 2 a FAIL (git missing, a harness that does not
240         accept its spelling, a role probe that fails), or ~/.vitrify/config.toml exists
241         (vitrify probe updates it)
242Config:  VITRIFY_PROBE_TIMEOUT_SECS (per probe, default 60); VITRIFY_HOME
243Examples:
244  vitrify init
245  vitrify init --json";
246
247pub const PROBE: &str = "\
248Probes the machine again — after installing or upgrading vitrify or a harness CLI, or editing
249a role profile — and brings the probe record in ~/.vitrify/config.toml up to date. Asks
250before it changes the file (-y answers yes); changes nothing else in it.
251Reads:   ~/.vitrify/config.toml (the role profiles and the probe record); git and the harness
252         CLIs on PATH (one real model call each, and one per role that adds flags)
253Writes:  the [probe] tables of ~/.vitrify/config.toml, when there is a change and you agree;
254         restores or refreshes the briefs, schemas and templates under ~/.vitrify/
255Prints:  one `status: text` line per check, status ok, FAIL, untested or note; then one
256         `change: <key>: <recorded> → <found>` line per difference, and either
257         `ok: ~/.vitrify/config.toml: no changes`, `ok: updated ~/.vitrify/config.toml (N
258         changes)`, or `note: ~/.vitrify/config.toml: nothing changed`
259         stderr: the question, `apply N changes to ~/.vitrify/config.toml? [y/N]`
260         --json: {green, checks, harnesses, changes: [{key, from, to}], applied}
261Exit status: 0 the record is up to date, nothing failed · 2 a FAIL, the changes not applied
262         (declined, or no answer on stdin), or ~/.vitrify/config.toml does not parse
263Config:  VITRIFY_PROBE_TIMEOUT_SECS (per probe, default 60); VITRIFY_HOME
264Examples:
265  vitrify probe
266  vitrify probe -y
267  vitrify probe --json --assume-yes";
268
269pub const RUN: &str = "\
270Builds one SDD until it is Complete or Blocked: claims, dispatches workers, integrates,
271publishes. Interrupt it (Ctrl-C, kill -INT <pid>), never its workers; running it again resumes.
272Reads:   the SDD on mainline; ~/.vitrify/config.toml (the recorded harness spelling and
273         the role profiles); the §5 commands it runs
274Writes:  published mainline commits (claims, renewals, releases, each Verified unit);
275         .vitrify/run.json, the latest run's snapshot, its report null until it ends;
276         .vitrify/logs/<job>/: run.json, gate.json, events.jsonl (one line per event),
277           report.txt (the final report), worker-<holder>.out, .err and .prompt.md,
278           escalation-<n>.json;
279         unit worktrees and the integration checkout under run.worktree_dir.
280         --dry-run publishes nothing and moves no file.
281Prints:  stdout: the job header (SDD build job — <sdd> @ <version>  [<job>], Done-condition,
282         Mainline, Plan, Workers, Roles, Worktrees, Parameters), then, before anything is
283         dispatched:
284           Watch: vitrify run status --job <job> [--follow] · once it ends, the same command
285           prints the report · procedure: vitrify brief run
286         then one line per event, then one final report: Complete. or Blocked., the progress
287         line, each blocker, the journal tail (replay: exit 0 (consistent)).
288         --dry-run: the header and any claim it would recover, ending
289           Start: vitrify run <the flags given, without --dry-run>
290         stderr: worker reports, gate failures, notes, warnings, and each
291           preflight failed: <cause> → <fix>
292Exit status: 0 Complete. (--dry-run: preflight passed) · 2 Blocked., a preflight failure,
293         an abort verdict, or a usage error · 1 an error, its message last on stderr.
294         An interrupted run cleans up and ends by the signal it received.
295Config:  mainline (VITRIFY_MAINLINE) · run.worker_cap (VITRIFY_RUN_WORKER_CAP, --cap)
296         · run.lease_minutes · run.renew_fraction · run.abort_failed_waves
297         · run.worker_timeout_minutes · run.gate_jobs (--gate-jobs) · run.poll_seconds
298         · run.worktree_dir · harness.preferred · lint.readset_budget_bytes;
299         each key's variable is VITRIFY_<SECTION>_<KEY> (VITRIFY_RUN_GATE_JOBS, …)
300Examples:
301  vitrify run --dry-run --sdd specs/calc
302  vitrify run --sdd specs/calc
303  vitrify run --cap 2 --gate-jobs 1 --wait
304Procedure: vitrify brief run";
305
306pub const RUN_STATUS: &str = "\
307Read-only: writes no file, takes no lock, runs git only with --no-optional-locks; point it at
308a live run from another terminal.
309Reads:   .vitrify/run.json (the latest job) or the --job's .vitrify/logs/<job>/: run.json,
310         gate.json, events.jsonl, report.txt, the worker logs; process liveness; each
311         worker worktree's git state and front matter
312Writes:  nothing
313Prints:  the run's state (alive, died or ended), the progress line, one line per worker
314         with its stage, the gate's step; once the run has ended, its final report under
315         Report:; warnings as `! <text>` lines.
316         Stages: reading · editing · stamped · exited · ? (unknown) while running;
317           queued · gate · integrating while integrating; else the outcome itself
318         Warnings: an empty log after --quiet-after; no output for --quiet-after; 90% of
319           worker_timeout_minutes used; a run that died, with a kill -9 -- -<pid> line for
320           each worker process group still running
321         --json, in order: job_id, pid, sdd, harness, started_at, at, state, terminated,
322           report, progress, params, workers, gate, warnings, logs
323         --follow: the view once, then one line per change until the run ends;
324           --json one event object per line; --since-start first replays events.jsonl
325Exit status: without --follow: 0 a run is shown, whatever its state · 4 no run recorded, or
326         --job names none · 2 usage error.
327         --follow exits with the followed run: 0 complete · 2 blocked · 1 error, interrupted,
328         or died · 4 no run recorded. A reader that goes away (| head) stops it with 0.
329Examples:
330  vitrify run status
331  vitrify run status --follow --job <job>
332  vitrify run status --json
333Procedure: vitrify brief run";
334
335pub const LINT: &str = "\
336Reads:   the SDD; the other SDDs it pins (L9); its changelog (L10); its TDD (L11)
337Writes:  nothing
338Prints:  `lint clean (L1–L11)`, or one `[L#] subject: cause → remediation` line per finding;
339         --all prefixes each line with the slug
340         --json: {clean, findings: [{check, subject, cause, remediation}]};
341         --all: an array of {sdd, root, clean, findings}
342Exit status: 0 clean · 2 a finding, or a usage error · 4 no SDD, or several and no --sdd
343Config:  lint.readset_budget_bytes (VITRIFY_LINT_READSET_BUDGET_BYTES), for L5
344Examples:
345  vitrify lint --sdd specs/calc
346  vitrify lint --all --built --json
347Procedure: vitrify brief authoring (before Active) · vitrify brief change (after)";
348
349pub const CHECK: &str = "\
350Runs every read-only check over one SDD, or with --all the repository: lint (--built once
351any unit has build state or a journal exists), audit (check 4 unless --skip-rotten), journal
352replay (where a journal exists), ledger regen --check (where a ledger or journal exists) and
353the pin states. Runs no §5 command; vitrify run --dry-run does.
354Reads:   each SDD, its journal and ledger, the SDDs it pins, its changelog and TDD
355Writes:  nothing
356Prints:  one `<slug>: [<source> <check>] subject: cause → remediation` line per finding,
357         then `<slug>: note: Q-### is open (blocks …)` notes, then
358         `check clean: N SDDs`, or `check: N findings in M of K SDDs`
359         --json: {sdd, root, clean, findings: [{source, check, subject, cause, remediation}],
360           notes}; an array with --all. source: lint, audit, journal, ledger or pin;
361           check: \"L4\", \"5\" or null
362Exit status: the worst component (an error, 1, wins; else the highest): 0 clean · 2 a lint,
363         audit or pin finding, or a usage error · 3 a journal or ledger mismatch · 4 no SDD,
364         several and no --sdd, a schema version this vitrify does not read
365Config:  lint.readset_budget_bytes (VITRIFY_LINT_READSET_BUDGET_BYTES) · run.gate_jobs
366         (VITRIFY_RUN_GATE_JOBS), for audit check 4
367Examples:
368  vitrify check --sdd specs/calc
369  vitrify check --all --skip-rotten
370  vitrify check --all --json
371Procedure: vitrify brief change";
372
373pub const CHANGE: &str = "\
374Subcommands: apply (a change entry's bookkeeping in one step: re-stamp or mark Stale, the
375         journal, the ledger)
376Exit status: 2 without a subcommand; see each subcommand's --help
377Examples:
378  vitrify change apply --sdd specs/calc
379  vitrify change apply --all --dry-run";
380
381pub const CHANGE_APPLY: &str = "\
382For each Active SDD whose last change entry has no change event yet: PATCH re-records the
383moved units' traces (status and stamps kept) and appends change --entry CH-###; MINOR or
384MAJOR appends change --entry CH-### --stale <units> and marks each Stale; then the ledger is
385regenerated. Re-running is safe: a recorded entry is skipped.
386Reads:   the changelog's last entry, front matter version and updated, the journal, unit
387         traces (audit check 5), the pin states
388Writes:  the working tree: unit front matter, journal events, the ledger (the commit is
389         yours); nothing with --dry-run
390Prints:  per SDD, label-prefixed: `calc: CH-004 1.2.0 → 1.3.0 (minor): U-002 marked Stale`
391         and `calc: - Staleness applied: U-002 → Stale`, or why nothing applies (already
392         recorded, Draft, no change entry). stderr: `next: copy the Staleness applied line
393         into CH-### (<changelog>), then run vitrify check`; with --dry-run
394         `dry run: nothing written`
395         --json: {sdd, root, entry, from, to, bump, action, restamped, stale,
396           staleness_line, dry_run}; an array with --all. bump: patch, minor, major or
397           null; action: applied, already-recorded, draft or no-entry
398Exit status: 0 applied, or nothing to do · 2 refused (version or updated does not match the
399         entry, a stale pin, a single file's entry outside ## Changelog), or a usage error
400         · 4 no SDD, or several and no --sdd · 1 error
401Examples:
402  vitrify change apply --sdd specs/calc --dry-run
403  vitrify change apply --all
404  vitrify change apply --sdd specs/calc --commit 3f2a9c1 --json
405Procedure: vitrify brief change";
406
407pub const PIN: &str = "\
408Subcommands: list (every external contract, its kind and state) · sync (rewrite stale pins'
409         hashes)
410Exit status: 2 without a subcommand; see each subcommand's --help
411Examples:
412  vitrify pin list --all
413  vitrify pin sync --sdd specs/beta";
414
415pub const PIN_LIST: &str = "\
416Reads:   the SDD's external contracts (Producer: external); for each pin, its authority's
417         body in the SDD that owns it
418Writes:  nothing
419Prints:  one line per contract: `beta C-001  ok  pin of alpha C-001  <file>`, a transcription
420         reading `transcription`, then `N external contracts: 2 ok · 1 stale · …`
421         States: ok · stale · missing-authority · invalid · unchecked (a transcription)
422         --json: {clean, contracts: [{sdd, contract, file, kind, state, authority, bytes,
423           consumers, detail}], counts}. kind: pin or transcription; authority:
424           {sdd, contract, file, bytes}, or null
425Exit status: 0 nothing stale, missing-authority or invalid · 2 one is, or a usage error
426         · 4 no SDD, or several and no --sdd
427Examples:
428  vitrify pin list --sdd specs/beta
429  vitrify pin list --all --json
430Procedure: vitrify brief change";
431
432pub const PIN_SYNC: &str = "\
433Reads:   as pin list; the consumers' unit traces
434Writes:  the working tree: each stale pin's hash, in its contract file. No status, journal
435         event or version: the change entry, vitrify change apply and the commit are yours.
436         Nothing with --dry-run
437Prints:  `synced beta C-002 ← alpha C-002  <file>` per pin; per consumer SDD
438         `beta: - Staleness applied: U-001 → Stale (consume C-002)`; then the count line.
439         stderr: `not synced: …` for what it cannot put right, and per consumer
440         `next: write beta's change entry around its line, then run vitrify change apply
441         --sdd specs/beta`; with --dry-run the same lines, and on stderr
442         `dry run: nothing written` in place of the next: lines
443         --json: {synced, staleness, unresolved, dry_run}
444Exit status: 0 every stale pin synced · 2 something could not be synced (a missing
445         authority, an invalid declaration), or a usage error · 4 no SDD, or several and
446         no --sdd
447Examples:
448  vitrify pin sync --sdd specs/beta
449  vitrify pin sync --all --dry-run
450  vitrify pin sync --all --json
451Procedure: vitrify brief change";
452
453pub const QUESTIONS: &str = "\
454Reads:   the Decision Log (decisions.md, or ## Decisions & Open Questions) and the units'
455         OPEN(Q-###) markers
456Writes:  nothing
457Prints:  one line per question: `Q-001  open  blocks U-003, U-004  <text>`, then
458         `N open, M resolved`; --open lists only the open ones
459         --json: {open, resolved, questions: [{sdd, q, status, blocks, noted, text}]}
460Exit status: 0 listed, whatever is open (lint L8 is the check that fails) · 4 no SDD, or
461         several and no --sdd · 2 usage error
462Examples:
463  vitrify questions --sdd specs/calc --open
464  vitrify questions --all --json
465Procedure: vitrify brief change (answer one) · vitrify brief run (a blocker naming Q-###)";
466
467pub const NEW: &str = "\
468Reads:   ~/.vitrify/templates/ ($VITRIFY_HOME; an override on disk wins)
469Writes:  the working tree, in the current directory: tdd → NAME.md (default tdd.md);
470         sdd → NAME/ bundle with sdd.md, units/, contracts/, changelog.md, decisions.md;
471         sdd --single → NAME.sdd.md (default NAME scope). An SDD declares
472         schema_version: 2.0. Never overwrites.
473Prints:  the created path; stderr: `next: fill <path> per vitrify schema show, then run
474         vitrify lint --sdd <path>` (sdd), `next: fill <path> per vitrify schema show --tdd`
475         (tdd)
476Exit status: 0 created · 2 the target exists, or a usage error
477Config:  VITRIFY_HOME
478Examples:
479  vitrify new tdd calc-tdd
480  vitrify new sdd calc
481  vitrify new sdd --single calc
482Procedure: vitrify brief authoring";
483
484pub const SCHEMA: &str = "\
485Subcommands: show (print the normative SDD schema, or the TDD schema with --tdd)
486Exit status: 2 without a subcommand; see each subcommand's --help
487Examples:
488  vitrify schema show
489  vitrify schema show --tdd";
490
491pub const SCHEMA_SHOW: &str = "\
492Reads:   ~/.vitrify/schemas/ ($VITRIFY_HOME; an override on disk wins)
493Writes:  nothing in the repository; restores or refreshes its copy under ~/.vitrify/
494Prints:  the SDD schema (schema_version 2.0), or with --tdd the TDD schema
495Exit status: 0 printed · 1 the file cannot be read · 2 usage error
496Config:  VITRIFY_HOME
497Examples:
498  vitrify schema show
499  vitrify schema show --tdd
500Procedure: vitrify brief authoring";
501
502#[cfg(test)]
503mod tests {
504    use super::*;
505
506    const ALL: [(&str, &str); 31] = [
507        ("LOCATE", LOCATE),
508        ("READSET", READSET),
509        ("CLAIM", CLAIM),
510        ("RENEW", RENEW),
511        ("RELEASE", RELEASE),
512        ("TRACE", TRACE),
513        ("TRACE_RECORD", TRACE_RECORD),
514        ("TRACE_VERIFY", TRACE_VERIFY),
515        ("LEDGER", LEDGER),
516        ("LEDGER_REGEN", LEDGER_REGEN),
517        ("LEDGER_PROGRESS", LEDGER_PROGRESS),
518        ("JOURNAL", JOURNAL),
519        ("JOURNAL_APPEND", JOURNAL_APPEND),
520        ("JOURNAL_REPLAY", JOURNAL_REPLAY),
521        ("AUDIT", AUDIT),
522        ("BRIEF", BRIEF),
523        ("INIT", INIT),
524        ("PROBE", PROBE),
525        ("RUN", RUN),
526        ("RUN_STATUS", RUN_STATUS),
527        ("LINT", LINT),
528        ("CHECK", CHECK),
529        ("CHANGE", CHANGE),
530        ("CHANGE_APPLY", CHANGE_APPLY),
531        ("PIN", PIN),
532        ("PIN_LIST", PIN_LIST),
533        ("PIN_SYNC", PIN_SYNC),
534        ("QUESTIONS", QUESTIONS),
535        ("NEW", NEW),
536        ("SCHEMA", SCHEMA),
537        ("SCHEMA_SHOW", SCHEMA_SHOW),
538    ];
539
540    #[test]
541    fn every_block_has_exit_status_and_examples() {
542        for (name, text) in ALL {
543            assert!(!text.trim().is_empty(), "{name} is empty");
544            assert!(text.contains("Exit status:"), "{name} lacks Exit status:");
545            assert!(text.contains("Examples:"), "{name} lacks Examples:");
546        }
547    }
548
549    #[test]
550    fn headings_come_in_order() {
551        let order = [
552            "Reads:",
553            "Writes:",
554            "Prints:",
555            "Exit status:",
556            "Config:",
557            "Examples:",
558            "Procedure:",
559        ];
560        for (name, text) in ALL {
561            let mut last = 0;
562            for heading in order {
563                if let Some(at) = text.find(heading) {
564                    assert!(at >= last, "{name}: {heading} out of order");
565                    last = at;
566                }
567            }
568        }
569    }
570
571    #[test]
572    fn every_example_is_a_vitrify_line() {
573        for (name, text) in ALL {
574            let examples = text
575                .split("Examples:\n")
576                .nth(1)
577                .unwrap_or_else(|| panic!("{name}: no Examples: line"));
578            let lines: Vec<&str> = examples
579                .lines()
580                .take_while(|l| l.starts_with("  "))
581                .collect();
582            assert!(!lines.is_empty(), "{name}: no example");
583            for l in lines {
584                assert!(l.starts_with("  vitrify "), "{name}: {l}");
585            }
586        }
587    }
588}