@orkestrel/scaffold 0.0.113 → 0.0.115

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 (94) hide show
  1. package/dist/agents/skills/orkestrel-publish/scripts/wave.js +83 -16
  2. package/dist/bin/main.js +71 -23
  3. package/dist/bin/main.js.map +1 -1
  4. package/dist/host/agents/orchestration.md +5 -3
  5. package/dist/host/agents/platforms/windows.md +1 -0
  6. package/dist/host/agents/skills/orkestrel-align/references/integration.md +1 -1
  7. package/dist/host/agents/skills/orkestrel-debrief/SKILL.md +4 -4
  8. package/dist/host/agents/skills/orkestrel-dispatch/SKILL.md +4 -1
  9. package/dist/host/agents/skills/orkestrel-falsify/SKILL.md +8 -2
  10. package/dist/host/agents/skills/orkestrel-harden/references/equivalence.md +1 -0
  11. package/dist/host/agents/skills/orkestrel-harden/references/hardening.md +1 -1
  12. package/dist/host/agents/skills/orkestrel-parallel/SKILL.md +1 -1
  13. package/dist/host/agents/skills/orkestrel-parallel/references/codex.md +1 -0
  14. package/dist/host/agents/skills/orkestrel-publish/SKILL.md +7 -7
  15. package/dist/host/agents/skills/orkestrel-publish/references/wave.md +31 -11
  16. package/dist/host/agents/skills/orkestrel-publish/scripts/wave.ts +150 -49
  17. package/dist/host/claude/agents/analyst.md +1 -1
  18. package/dist/host/claude/agents/astra.md +2 -2
  19. package/dist/host/claude/agents/builder.md +4 -4
  20. package/dist/host/claude/agents/opus.md +3 -3
  21. package/dist/host/claude/agents/orkestrel.md +57 -59
  22. package/dist/host/claude/agents/planner.md +8 -2
  23. package/dist/host/claude/rules/campaign.md +2 -1
  24. package/dist/host/claude/rules/documentation.md +1 -0
  25. package/dist/host/claude/rules/tests.md +13 -8
  26. package/dist/host/claude/rules/workspace.md +28 -28
  27. package/dist/host/claude/rules/writing.md +1 -0
  28. package/dist/host/claude/skills/enterprise-bootstrap/SKILL.md +1 -2
  29. package/dist/host/claude/skills/orkestrel-align/SKILL.md +1 -1
  30. package/dist/host/claude/skills/orkestrel-build/SKILL.md +1 -2
  31. package/dist/host/claude/skills/orkestrel-debrief/SKILL.md +1 -2
  32. package/dist/host/claude/skills/orkestrel-dispatch/SKILL.md +1 -1
  33. package/dist/host/claude/skills/orkestrel-falsify/SKILL.md +1 -1
  34. package/dist/host/claude/skills/orkestrel-harden/SKILL.md +1 -1
  35. package/dist/host/claude/skills/orkestrel-journey/SKILL.md +1 -1
  36. package/dist/host/claude/skills/orkestrel-parallel/SKILL.md +1 -1
  37. package/dist/host/claude/skills/orkestrel-polish/SKILL.md +1 -2
  38. package/dist/host/claude/skills/orkestrel-publish/SKILL.md +1 -2
  39. package/dist/host/claude/skills/orkestrel-scout/SKILL.md +1 -1
  40. package/dist/host/codex/agents/analyst.toml +8 -5
  41. package/dist/host/codex/agents/astra.toml +4 -5
  42. package/dist/host/codex/agents/builder.toml +5 -5
  43. package/dist/host/codex/agents/opus.toml +3 -4
  44. package/dist/host/codex/agents/orkestrel.toml +2 -1
  45. package/dist/host/codex/agents/planner.toml +8 -5
  46. package/dist/host/codex/agents/reviewer.toml +5 -4
  47. package/dist/host/guides/agent.md +13 -13
  48. package/dist/host/guides/brief.md +4 -0
  49. package/dist/host/guides/browser.md +162 -44
  50. package/dist/host/guides/budget.md +1 -1
  51. package/dist/host/guides/capture.md +4 -0
  52. package/dist/host/guides/console.md +13 -0
  53. package/dist/host/guides/contract.md +38 -3
  54. package/dist/host/guides/csv.md +5 -0
  55. package/dist/host/guides/database.md +58 -8
  56. package/dist/host/guides/form.md +17 -0
  57. package/dist/host/guides/guide.md +36 -33
  58. package/dist/host/guides/html.md +72 -44
  59. package/dist/host/guides/indexeddb.md +4 -0
  60. package/dist/host/guides/lsp.md +49 -8
  61. package/dist/host/guides/markdown.md +146 -1
  62. package/dist/host/guides/mcp.md +117 -22
  63. package/dist/host/guides/middleware.md +194 -26
  64. package/dist/host/guides/msg.md +9 -5
  65. package/dist/host/guides/pool.md +8 -1
  66. package/dist/host/guides/probe.md +13 -1
  67. package/dist/host/guides/process.md +102 -90
  68. package/dist/host/guides/program.md +4 -0
  69. package/dist/host/guides/qualifier.md +4 -0
  70. package/dist/host/guides/rater.md +4 -0
  71. package/dist/host/guides/reason.md +6 -4
  72. package/dist/host/guides/relation.md +4 -0
  73. package/dist/host/guides/scaffold.md +32 -14
  74. package/dist/host/guides/server.md +29 -13
  75. package/dist/host/guides/sqlite.md +6 -0
  76. package/dist/host/guides/sse.md +6 -0
  77. package/dist/host/guides/study.md +473 -473
  78. package/dist/host/guides/table.md +3 -0
  79. package/dist/host/guides/template.md +3 -0
  80. package/dist/host/guides/test.md +38 -20
  81. package/dist/host/guides/tool.md +3 -0
  82. package/dist/host/guides/toolbox.md +21 -0
  83. package/dist/host/guides/websocket.md +3 -1
  84. package/dist/host/guides/workflow.md +103 -11
  85. package/dist/host/guides/workspace.md +4 -0
  86. package/dist/host/manifest.json +84 -84
  87. package/dist/host/tests/config.test.ts +7 -13
  88. package/dist/src/core/index.cjs +20 -28
  89. package/dist/src/core/index.cjs.map +1 -1
  90. package/dist/src/core/index.d.cts +7 -7
  91. package/dist/src/core/index.d.ts +7 -7
  92. package/dist/src/core/index.js +20 -28
  93. package/dist/src/core/index.js.map +1 -1
  94. package/package.json +12 -12
@@ -56,6 +56,7 @@ The harness's own engine orchestrates: Claude Fable 5.1 or Claude Opus 5.5 in Cl
56
56
  - Keep small tedious precise tasks native: Claude Haiku in Claude, Codex Luna in Codex. Use `scout` for an exact bounded lookup; keep bench drivers, `checker`, and `verifier` on their mapped native engines. A bounded file scope does not turn context absorption or exploratory reading into a native lookup.
57
57
  - Route a unit that authors path-containment, import-resolution-boundary, unescaped-input, or credential-exposure proofs to `opus` from the start where `opus` runs on Claude, and record the Codex bench dark for that unit only. Under native Codex roles, report a harness refusal through § Deviation protocol.
58
58
  - Route gates to `verifier`. A writer's self-reported gate is not evidence. A writer never holds the runner lane for its own acceptance; a gate a writer runs is an observation, never acceptance.
59
+ - Record mechanical source adoption as Orchestrator integration or a writer unit. Reserve the runner name for a verifier that made no source repair.
59
60
  - Under the Codex mapping, put falsify lanes on Astra or Sol at high effort; keep Luna for gates and verifier runs, never for a lane that must resolve runtime claims.
60
61
  - Work directly on a one-file change or a one-line fix, subject to the preceding routing rules. Route standalone lookups through `scout`. Dispatch when isolation, parallelism, a second engine, or a large read pays for the brief.
61
62
 
@@ -159,8 +160,8 @@ A large change opens with a concise goal and its exit criterion, short enough to
159
160
  - Permit a verifier to write its assigned evidence artifacts and the generated outputs its dispatch declares; never permit source repairs. A declaration names the command and each path the command writes or replaces. Declare a path only when the command regenerates it and no lane authors it, such as a build directory or a generated inventory file; an authored path is source, whichever command rewrites it. Declare no path for a command that only deletes. Keep each declared output outside every other lane's owned files and recorded fixtures, and hold it with the command's inputs for the run. Under this floor, the declared command can remove and rewrite its declared outputs, and that replacement is neither a destructive command nor a deletion.
160
161
  - Record `git status --porcelain` before and after a declared command. Report each declared output that git tracks and the run changed; never revert it. When the run changed a path outside its declarations, stop and report the path.
161
162
  - No role commits, pushes, tags, publishes, installs, or runs a destructive command.
162
- - No role runs `git checkout`, `git restore`, `git stash`, `git reset`, or `git clean`. Undo an edit by rewriting the text.
163
- - No role reads, prints, copies, uploads, or packages a secret: `.env*`, `.npmrc`, `auth.json`, keys, tokens, `CURSOR_API_KEY`.
163
+ - No role, the Orchestrator included, runs `git checkout`, `git restore`, `git stash`, `git reset`, or `git clean`. Undo an edit by rewriting the text. Supply an untracked review input by its path; never stage it for review.
164
+ - No role, the Orchestrator included, reads, prints, copies, uploads, or packages a secret: `.env*`, `.npmrc`, `auth.json`, keys, tokens, `CURSOR_API_KEY`.
164
165
  - A unit writes only under its owned files, its checkout's `tmp/`, and the declared outputs the preceding bullets permit. The Orchestrator's own briefs, probes, drafts, and records live in the checkout's `tmp/` too, never in a directory outside the repository; the user follows the work through the tree.
165
166
  - When a sandbox rejects a write, the unit stops and reports the rejection. It never tries another write mechanism.
166
167
  - Apart from a declared command replacing its declared outputs, a unit deletes only the fixture directory it created, by its recorded path. It never removes a `tmp/<lane>` directory, another unit's files, or anything through `sweep.ts --tmp` or `--unit … --delete`; those are the Orchestrator's, after the last live unit exits.
@@ -211,7 +212,7 @@ The Orchestrator triages: obvious correction → tighten and re-dispatch; missin
211
212
 
212
213
  ## Cleanup
213
214
 
214
- - When a unit is accepted, carry its measurements, unresolved findings, and any instrument worth keeping into the commit message, a tracked design, or a test, then delete its `tmp/units/<unit>-*` files and its bench journals. Before a unit's files go, carry its effective brief (objective, corrections, source identity, rulings) into the tracked plan or the acceptance commit. Delete or move no path a live lane's brief names.
215
+ - When a unit is accepted, carry its measurements, unresolved findings, and any instrument worth keeping into the commit message, a tracked design, or a test, then delete its `tmp/units/<unit>-*` files and its bench journals. Before a unit's files go, carry its effective brief (objective, corrections, source identity, rulings), each reported deviation, and the recovery that closed it into the tracked plan or the acceptance commit. Quote each deviation and its closing recovery verbatim. Delete or move no path a live lane's brief names.
215
216
  - `.claude/rules/campaign.md` owns what `.orkestrel/` holds and when each file goes; git history is the archive.
216
217
  - Delete a probe from the source tree before the unit returns; promote a probe that settled a claim into a test.
217
218
  - Run `node .agents/skills/orkestrel-dispatch/scripts/sweep.ts --report` at acceptance; it lists leftovers under `tmp/` and `.orkestrel/` by age and deletes nothing. Run the same script with `--tmp` after the last live unit exits; it deletes files older than its threshold and refuses while a journal is changing.
@@ -227,6 +228,7 @@ The Orchestrator triages: obvious correction → tighten and re-dispatch; missin
227
228
  ## Acceptance
228
229
 
229
230
  - No writer's and no bench's self-assessment is authoritative. The Orchestrator accepts after the review and the gates the size gate names.
231
+ - Close each review the size gate requires before acceptance; never put that review in a deferral list.
230
232
  - An accepted claim or gate row names the independent receipt (command, input identity, exit) that closed it; a writer's report states implementation status and never closure.
231
233
  - Accept when the exit criterion is met and the gates are green. Reopening an accepted criterion is the user's instruction, not a reviewer's finding.
232
234
  - Before calling work ready, try the shipped result as the user will, on the build they run, and report what did not run.
@@ -4,6 +4,7 @@ The commands an agent runs on a Windows host, and their quirks. `.claude/rules/p
4
4
 
5
5
  ## Processes
6
6
 
7
+ - When a held native module interrupts an install, identify its holders with `tasklist /M`, terminate no process the session did not launch, and record the partial installation state. Rebuild from the unchanged lockfile, verify the manifest and lockfile identities, and report the clean-install criterion the recovery did not prove.
7
8
  - Read liveness with `Get-Process -Id <pid>` in PowerShell, or under Git Bash from the output of `tasklist //FI "PID eq <pid>" //NH`: a row naming the pid means alive, and the `INFO:` line means gone. Never read liveness from `tasklist`'s exit code, `kill -0`, or `ps -eo`.
8
9
  - List descendants with `Get-CimInstance Win32_Process -Filter "ParentProcessId=<pid>"`, applied to each listed id in turn. Under Git Bash, run it through `powershell -NoProfile -Command`, and write every Windows slash option as `//`.
9
10
  - Kill a recorded tree with `taskkill /pid <pid> /T /F`. `launch.ts` kills the tree at its cap on this host.
@@ -24,7 +24,7 @@ Read the concrete consumer flow first-hand:
24
24
 
25
25
  When moving behavior:
26
26
 
27
- - define the destination contract and guide first;
27
+ - define the destination type contract before implementation, and document it in the final prose pass under `AGENTS.md` § Work loop;
28
28
  - keep storage/transport integrations pluggable where consumers choose them;
29
29
  - move the real implementation, tests, and guide together;
30
30
  - delete the source duplicate and update every consumer;
@@ -25,10 +25,10 @@ as a refinement.
25
25
  package, an app, an agent-facing surface — drive it with representative real consumers
26
26
  before writing findings about it. For agent-facing surfaces, follow
27
27
  [field-testing.md](references/field-testing.md).
28
- - **Every finding ends in exactly one bucket**: fix now; agent refinement; rule
29
- refinement; skill refinement or creation; process refinement (orchestration contract);
30
- package promotion; guide truth; roadmap; stays as-is with the reason; or dropped on the
31
- record with the refuting evidence. A finding with no bucket is an unfinished debrief.
28
+ - Assign every finding a bucket: fix now; a refinement class named in
29
+ [instruction-audit.md](references/instruction-audit.md) § Refinement classes; package promotion;
30
+ guide truth; roadmap; stays as-is with the reason; or dropped on the record with the refuting
31
+ evidence. For a refinement, use the class name verbatim.
32
32
  - **Fixes are re-proven by the evidence class that found them.** A defect found in live
33
33
  use closes with live use; a process failure closes when the next campaign round runs
34
34
  the corrected process.
@@ -24,7 +24,7 @@ description: >-
24
24
 
25
25
  ## Write the brief
26
26
 
27
- 1. A small native unit's brief is the dispatch message: scope, law references, expected result. Otherwise run `node .agents/skills/orkestrel-dispatch/scripts/brief.ts --unit <unit> --lane <lane>` and fill every section; write `none` in an empty one. A re-run takes the `-<n>` file the script writes; never edit a launched brief.
27
+ 1. A small native unit's brief is the dispatch message: scope, law references, expected result. Otherwise run `node .agents/skills/orkestrel-dispatch/scripts/brief.ts --unit <unit> --lane <lane>` and fill every section; write `none` in an empty one. Cite each law by file and section; quote a law the brief carries, never paraphrase it. A re-run takes the `-<n>` file the script writes; never edit a launched brief.
28
28
  2. Back every fact the unit will act on with the command and output that established it. Check a fact against the tree, not against another artifact. A cross-process or filesystem brief carries a platform-facts table (operation, host, measured code, and the probe that measured it) and marks each unmeasured assumption. An investigation brief names the failing command and state, the candidate layers, the readings that distinguish them, the test that pins the existing behavior, the fix pre-approved for each confirmed reading, and the stop for every other outcome. A failure that passes alone but repeats in the sequence that produced it is an order-dependent defect to diagnose, never a timing miss to record, and an unchanged rerun of that sequence adds no evidence. A brief built on an earlier lane's evidence names what that evidence left unproven and schedules the cheapest run that covers the remainder before any long run. A brief carries the failure output it asks the unit to repair inline or under the unit's own checkout, never only as a path the unit may not reach.
29
29
  3. Scope by what the change makes false: run the `orkestrel-scout` skill's `map.ts --refs` and `--census` for an existing member of any enumerated population the unit extends, and own every file that comes back, with the tests that pin the behavior, the fixtures derived from a constant, and the materialized copy of a template. A brief that prescribes a mechanism step by step lists the inherited operations that keep their behavior, so its stop line guards only what the prescription changes.
30
30
  4. Order acceptance criteria cheap-first, per `AGENTS.md` § Work loop: regenerate, then the format check, lint, and type check, then scoped tests. Name a timing-sensitive or tree-wide gate as an observation, not a criterion. Place a run whose cost outweighs the discrimination it adds after the cheap checks and after the inputs stabilize. Before a brief ships, run every acceptance check it states as a command's expected output against the destination tree and word the row from that reading.
@@ -33,6 +33,9 @@ description: >-
33
33
  7. Fill each placeholder at its value sites only; a global replace also rewrites a stop clause that names the placeholder.
34
34
  8. Run `brief.ts --check <brief>` and fix every missing path before the launch.
35
35
 
36
+ When a unit may attribute a failed command to its baseline, require its pre-edit output, exit code,
37
+ and input identity before writing; otherwise report the attribution as unverified.
38
+
36
39
  ## Launch
37
40
 
38
41
  - Select continuation or a fresh session per `.agents/orchestration.md` § Sessions and consultation. Use the message or resume mechanism the harness's live tool descriptions name, and record the session and task identities it returns.
@@ -21,7 +21,9 @@ Run from the checkout root. The script's opening comment owns its behavior.
21
21
 
22
22
  ## Write the claims
23
23
 
24
- Write `tmp/units/<unit>-claims.md` and point every lane at it. Read `references/brief.md` for the claim form.
24
+ For a one-lane review, carry the claims inline in its brief or write `tmp/units/<unit>-claims.md`.
25
+ For a review with separate lanes, write that claims file and point every lane at it.
26
+ Read `references/brief.md` for the claim form.
25
27
 
26
28
  - State the subject as numbered falsifiable claims: properties a concrete input, state, or interleaving could show false. Never "review this diff".
27
29
  - Derive claims from adverse conditions: cancellation, restart, concurrency, partial failure, malformed or unexpected input, resource exhaustion, orderings the happy path never reaches.
@@ -62,7 +64,11 @@ Read `references/reconcile.md`.
62
64
 
63
65
  ## Write the verdict
64
66
 
65
- Write `.orkestrel/<package>/<unit>-audit-verdict.md` with the lanes that ran, their engines, the per-claim rulings, the findings carried into fix units, and any lane the round did not run with the reason. Delete the claims file and the verdict when the seam closes.
67
+ For a one-lane review, record its per-claim rulings and findings in the ledger row or write
68
+ `.orkestrel/<package>/<unit>-audit-verdict.md`. For a review with separate lanes, write that verdict
69
+ file with the lanes that ran, their engines, the per-claim rulings, the findings carried into fix
70
+ units, and any lane the round did not run with the reason. Delete any separate claims file and
71
+ verdict when the seam closes.
66
72
 
67
73
  ## End the depth search
68
74
 
@@ -8,6 +8,7 @@ with a row for each class this contract names that the changed code admits.
8
8
 
9
9
  ## Hold the contract
10
10
 
11
+ - When a rewrite changes traversal, membership, allocation, or materialization, compare its cost growth with the baseline on the package's realistic load and rule the measured effect under `.claude/rules/quality.md` § Performance.
11
12
  - Treat every value the declared parameter types admit as inside the contract: holes, entries read
12
13
  through getters (their count and order), entries that throw, an array whose `Symbol.iterator` is
13
14
  missing or replaced, and an iterator's `return()`.
@@ -99,7 +99,7 @@ For every fetch, write, delete, extraction, path, protocol, or authentication bo
99
99
  Run the discovery census, `scripts/discovery.ts` as `SKILL.md` § Scripts states (step 11 of the hardening lane): which project collects each file, which gate reaches each project, and where a file carries `.todo`, a conditional skip (`.skipIf`, `.runIf`), `.fails`, a retry, or a timeout. `vitest/no-focused-tests` and `vitest/no-disabled-tests` refuse `.only` and `.skip`. Then verify:
100
100
 
101
101
  - every intended test file is collected by the correct project, and the test counts and environments match the intent;
102
- - every project that collects tests has a gate: the census flags one no chain reaches as ungated, and a chained project that collects nothing as empty. A declared project that collects nothing and that no chain names is a workbench, reported without a flag; read the chain behind every workbench and rule it by its purpose, not by the exit code;
102
+ - judge each discovered project's invocation and gate membership by `.claude/rules/workspace.md` § Test project matrix; read each reported chain and rule each workbench by its purpose;
103
103
  - every flag the census reports is closed or ruled with a reason;
104
104
  - every marker it reports is justified;
105
105
  - no current-scope requirement is represented only by a todo or a placeholder;
@@ -99,7 +99,7 @@ expect: <red or green, named cases, required artifact>
99
99
  - State in each long command's request which line is its terminal record; that line ends the wait.
100
100
  - When the shell yields before the command exits, keep its output in the assigned file and resume its tracked session per the harness page until the terminal record arrives. Start nothing else meanwhile, and never replace the command with a second launch. Confirm owned descendants have exited before publishing completion. Escalate incomplete cleanup before releasing files or starting another command.
101
101
  - Run the commands the accepted unit and the size gate require, narrowest first, and add no standing root, guide, or entry check beyond the request. Preserve receipts and rerun checks per `.agents/orchestration.md` § Pace.
102
- - Stop on the first unexpected failure. Return the complete diagnostic and the owning file, and classify the failure as an assertion failure, an invocation error, a reporting failure, a cap, or an interruption. Preserve every receipt obtained before the stop. Check an `expect:` that names cases against the command's `--reporter=json` report with `scripts/cases.ts`.
102
+ - For a release run, follow the `orkestrel-publish` skill's reference The release wave § Prepare a layer. For other runs, stop on the first unexpected failure. Return the complete diagnostic and the owning file, and classify the failure as an assertion failure, an invocation error, a reporting failure, a cap, or an interruption. Preserve every receipt obtained before the stop. Check an `expect:` that names cases against the command's `--reporter=json` report with `scripts/cases.ts`.
103
103
  - Record the command's input identity and expected outputs before launch. When an input changes during the run, report that result as invalid and retain each result whose input set stayed stable.
104
104
  - After every writer's current `FINAL` and the integrated review, run the Orchestrator's closing acceptance request under a unique gate number. Write `coord/runs/closing-<gate>.md`, reply with that identity, and end the turn.
105
105
 
@@ -20,6 +20,7 @@ Native Codex agents, and Codex lanes another harness hosts. `.codex/config.toml`
20
20
 
21
21
  ## Quirks
22
22
 
23
+ - Before a Codex lane that requires a tool server, verify the entry's resolution and handshake from that lane's checkout under the effective configuration. On "required MCP servers failed to initialize", read the user-level configuration for a same-named entry.
23
24
  - When a Codex lane runs a long command, brief the yield fallback before launch: the longest yield interval, output to a file, process-list reads until the tracked command exits, and no kill. The lane cannot set a timeout; brief it to proceed without asking for one.
24
25
  - When the shell yields before the command exits, start nothing else, and confirm no owned leftover remains before the next lane; a lane that started the next test file broke the one-runner bound (2026-10-22).
25
26
  - When a brief launches a long command, name its terminal record, such as the launcher's `exit=` line; a lane read a finished step as running and polled it for six minutes (2026-10-22).
@@ -21,13 +21,13 @@ description: Run an Orkestrel release from layer order to registry confirmation,
21
21
 
22
22
  ## Scripts
23
23
 
24
- | Script | Does |
25
- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
26
- | `scripts/compare.ts` | `[--package NAME] [--version V] [--tarball PATH] [--dist dist] [--json]`, run from the package root after its build: fetches the published tarball and lists the material differences from the rebuilt `dist/` (sourcemaps excluded, whitespace-only differences ignored). Exit 0 when nothing differs, 3 when something does, 2 when the tarball cannot be read, 64 on usage (no package name, no `dist/`, or `--tarball` with no path). |
27
- | `scripts/pins.ts` | `--version PRIOR [--range PRIOR_RANGE ...] [--paths src,tests] [--json]`, run from the package root: lists every line under the paths carrying the prior version literal or a prior range literal, once per line, sweeping a one-comparator range such as `^8.3.0` for its bare version in any form. Exit 0 with no hits, 3 with hits, 64 on usage (no literal, or a flag with no value). |
28
- | `scripts/swap.ts` | One mode per run, from any directory: `--pin --consumer DIR --source DIR [--source DIR ...] [--override NAME ...] [--no-build] [--dry-run] [--json]` refuses a source whose packed manifest names a local dependency spec in any dependency field (a `file:` or `link:` prefix, a path start of `.`, `~/`, `/`, `\`, or a drive letter, or a protocol-free archive name ending in `.tgz`, `.tar.gz`, or `.tar` that is not a `user/repo` shorthand), builds and packs each source into `<consumer>/tmp/tarballs/` under a name carrying its SHA-256, records each replaced range in the ledger `pins.json` there, the record of which build the consumer runs, writes each tarball's absolute `file:` spec and each `--override` (repeatable, like `--source`) where oxfmt sorts it, installs, and proves that every pinned source, an override-only one included, is installed with the source's bytes; `--restore --consumer DIR [--package NAME ...] [--json]` puts back each recorded range and override, keeps an `overrides` block that existed before the pin, installs, proves the restored copy, and lists the re-pin arguments, and refuses with 64, before it writes anything, a ledger whose package or override keys are not package names or whose removal would leave `node_modules`; `--status --consumer DIR [--json]` writes nothing and reports drift between the ledger, the manifest, the tarballs, the installed bytes, and the source commits, a manifest spec holding its tarball only when it names the ledger archive's location. `--pin` and `--restore` write a receipt under `tmp/units/`. Exit 0 on success, 1 when a command or a proof failed, 3 when `--status` reports drift, 64 on usage. |
29
- | `scripts/wave.ts` | `--visit [--target DIR] [--offline] [--regenerate] [--from STEP] [--to STEP] [--prior VERSION] [--dry-run] [--json] [--out FILE]` runs one repository's visit in the order [wave.md](references/wave.md) § Visit a repository fixes (pin, commit, overwrite, verify, install, pins, format, record, gates, compare), stops at the first failing step, journals each executed step's full output under the target's `tmp/units/wave/` when the work tree ignores `tmp/` and names the journal in its row, and prints each step's exit (a failed step names the `code: message` refusal or the `note` a JSON verb writes on stdout, else the last stderr lines), the bump ruling (the rebuilt dist against the published tarball, and the final runtime dependency set against the published manifest), and a row for `.orkestrel/release.md`; `--prior` names the version a pre-ruled bump replaced so the self-pin sweep finds it; `--plan` prints the packages by layer from the catalog table. An install that fails `ERESOLVE` names the rerun command, and `--regenerate` replaces the lockfile and `node_modules` from the manifest under the refusals and proof [wave.md](references/wave.md) § Regenerate a lock the install cannot move states; `record` commits the overwrite's writes as `Overwrite with scaffold VERSION`. Exit 0 when every step passed, 1 when one failed, 2 when a reading failed, 64 on usage, including `--regenerate` with `--plan`. |
30
- | `scripts/window.ts` | `--whoami [--wait SECONDS]` reads or polls `npm whoami`; `--login` prints the operator's login command and polls `whoami` until it answers; `--publish DIR... --otp CODE` refuses a batch whose nearest `.git` entry is a file, including ancestor entries, with exit 3 before contacting npm; it names a linked worktree's primary clone or identifies a submodule, then uploads back to back with `npm publish --ignore-scripts --otp`, journals each upload under `tmp/units/`, stops at the first refusal naming where to resume, and confirms each accepted version against the registry; `--confirm NAME@VERSION...` re-reads the registry until it serves the version. Exit 0 on success, 3 when not, 64 on usage. |
24
+ | Script | Does |
25
+ | -------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
26
+ | `scripts/compare.ts` | `[--package NAME] [--version V] [--tarball PATH] [--dist dist] [--json]`, run from the package root after its build: fetches the published tarball and lists the material differences from the rebuilt `dist/` (sourcemaps excluded, whitespace-only differences ignored). Exit 0 when nothing differs, 3 when something does, 2 when the tarball cannot be read, 64 on usage (no package name, no `dist/`, or `--tarball` with no path). |
27
+ | `scripts/pins.ts` | `--version PRIOR [--range PRIOR_RANGE ...] [--paths src,tests] [--json]`, run from the package root: lists every line under the paths carrying the prior version literal or a prior range literal, once per line, sweeping a one-comparator range such as `^8.3.0` for its bare version in any form. Exit 0 with no hits, 3 with hits, 64 on usage (no literal, or a flag with no value). |
28
+ | `scripts/swap.ts` | One mode per run, from any directory: `--pin --consumer DIR --source DIR [--source DIR ...] [--override NAME ...] [--no-build] [--dry-run] [--json]` refuses a source whose packed manifest names a local dependency spec in any dependency field (a `file:` or `link:` prefix, a path start of `.`, `~/`, `/`, `\`, or a drive letter, or a protocol-free archive name ending in `.tgz`, `.tar.gz`, or `.tar` that is not a `user/repo` shorthand), builds and packs each source into `<consumer>/tmp/tarballs/` under a name carrying its SHA-256, records each replaced range in the ledger `pins.json` there, the record of which build the consumer runs, writes each tarball's absolute `file:` spec and each `--override` (repeatable, like `--source`) where oxfmt sorts it, installs, and proves that every pinned source, an override-only one included, is installed with the source's bytes; `--restore --consumer DIR [--package NAME ...] [--json]` puts back each recorded range and override, keeps an `overrides` block that existed before the pin, installs, proves the restored copy, and lists the re-pin arguments, and refuses with 64, before it writes anything, a ledger whose package or override keys are not package names or whose removal would leave `node_modules`; `--status --consumer DIR [--json]` writes nothing and reports drift between the ledger, the manifest, the tarballs, the installed bytes, and the source commits, a manifest spec holding its tarball only when it names the ledger archive's location. `--pin` and `--restore` write a receipt under `tmp/units/`. Exit 0 on success, 1 when a command or a proof failed, 3 when `--status` reports drift, 64 on usage. |
29
+ | `scripts/wave.ts` | `--visit [--target DIR] [--offline] [--regenerate] [--from STEP] [--to STEP] [--prior VERSION] [--dry-run] [--json] [--out FILE]` runs one repository's visit in the order [wave.md](references/wave.md) § Visit a repository fixes (pin, commit, overwrite, verify, install, pins, format, record, gates, compare), stops at the first failing step, journals each executed step's full output under the target's `tmp/units/wave/` when the work tree ignores `tmp/` and names the journal in its row, and prints each step's exit (a failed step names the `code: message` refusal or the `note` a JSON verb writes on stdout, else the last stderr lines), the bump ruling (the rebuilt dist against the published tarball, and the final runtime dependency set against the published manifest), and a row for `.orkestrel/release.md`; `--prior` names the version a pre-ruled bump replaced so the self-pin sweep finds it; `--plan` prints the packages by layer from the catalog table. An install that fails `ERESOLVE` names the rerun command, and `--regenerate` replaces the lockfile and `node_modules` from the manifest under the refusals and proof [wave.md](references/wave.md) § Regenerate a lock the install cannot move states; `record` commits the overwrite's writes as `Overwrite with scaffold VERSION`, then paths dirtied only by that invocation's successful `format` step as `Format with oxfmt VERSION`, reading the formatter version from the target's installed manifest and attributing paths from dirty sets collected immediately before and after formatting; it refuses every other dirty path by name before committing. On `--from record`, it reports the absent format evidence and commits only the overwrite receipt's paths and the manifest pair. The visit runs the target's own executable as scaffold only when the target's manifest names `@orkestrel/scaffold`, and otherwise refuses, naming the install the target needs. Exit 0 when every step passed, 1 when one failed, 2 when a reading failed, 64 on usage, including `--regenerate` with `--plan`. |
30
+ | `scripts/window.ts` | `--whoami [--wait SECONDS]` reads or polls `npm whoami`; `--login` prints the operator's login command and polls `whoami` until it answers; `--publish DIR... --otp CODE` refuses a batch whose nearest `.git` entry is a file, including ancestor entries, with exit 3 before contacting npm; it names a linked worktree's primary clone or identifies a submodule, then uploads back to back with `npm publish --ignore-scripts --otp`, journals each upload under `tmp/units/`, stops at the first refusal naming where to resume, and confirms each accepted version against the registry; `--confirm NAME@VERSION...` re-reads the registry until it serves the version. Exit 0 on success, 3 when not, 64 on usage. |
31
31
 
32
32
  The user's current instruction wins. `references/release.md` binds every release: the credential and authorization law, the upload serialization, the tarball swap, what a bump obliges downstream, and the layer order. Nothing here weakens it. Where this skill disagrees with it, report the drift instead of following the skill.
33
33
 
@@ -23,7 +23,8 @@ overwrite receipts are written only where the work tree ignores `tmp/`.
23
23
  rewrite a peer range only when its name shares an audited release reading. For example, with
24
24
  peer-only `@orkestrel/peer-only: ^0.0.1`, leave that peer unchanged; with a planned tool whose
25
25
  registry serves `8.3.4`, apply `vite: ~8.2.0 -> ^8.3.4` even though the tilde excludes `8.3.4`.
26
- Keep a wave within each declared major. A range joined by `||` names one supported major per
26
+ Keep this pin step within each declared major; step 5 states the overwrite's lift.
27
+ A range joined by `||` names one supported major per
27
28
  arm, so move only the arm in the release's major and keep every other arm: with
28
29
  `vitest: ^4.1.11 || ^5.0.5` and a registry serving `4.1.12`, apply `^4.1.12 || ^5.0.5`.
29
30
  For a workspace whose selected framework activates a
@@ -52,16 +53,29 @@ overwrite receipts are written only where the work tree ignores `tmp/`.
52
53
  again. Keep a local MCP server registration outside the repository rather than at `.mcp.json`.
53
54
  4. Force-verify the same audit population and lookup bounds against a registry sweep taken after
54
55
  the previous layer published. Do not infer verification of peer-only declarations from that audit.
55
- 5. Run the full install. The overwrite re-declares the toolchain ranges and declares each planned
56
- dependency the manifest lacks, so the lockfile the first install regenerated no longer matches the
57
- manifest.
56
+ 5. Run the full install after the overwrite lifts each planned foreign tool's `devDependencies`
57
+ declaration whose major trails the canon's to the canon's planned range, its selected framework
58
+ holds included, and declares each planned dependency the manifest lacks. The lift reads a major
59
+ only from `^MAJOR` or a full version, optionally under `^` or `~`, and lifts a `||` range only
60
+ when every arm trails; it keeps an equal or later major, every other range form, and every
61
+ `dependencies` declaration. Read each lift's `from` and `to` ranges from the overwrite result's
62
+ `lifts`, and regenerate the lockfile against the resulting manifest.
58
63
  6. Sweep the self-pins, per § Sweep the self-pins: the re-pin moves the snapshot class.
59
64
  7. Run the mutating `format` script to converge generated writes.
60
65
  8. Commit the overwrite's writes as `Overwrite with scaffold <version>`: every path the overwrite
61
- wrote or removed, and the manifest and lockfile the install converged. The step refuses a dirty
62
- path the overwrite did not write and names it. After committing an unrelated path, complete the intended overwrite commit by hand:
63
- inspect the receipt's written and removed paths, stage those paths and the converged manifest
64
- and lockfile, and commit them as `Overwrite with scaffold <version>`. Then resume with `--from gates`.
66
+ wrote or removed, and the manifest and lockfile the install converged. Then commit the remaining
67
+ paths this run's `format` step dirtied as `Format with oxfmt <version>`, using the version read
68
+ from the target's installed `node_modules/oxfmt/package.json`. Attribute those paths only from
69
+ the dirty sets read immediately before and after that successful format step. Refuse every
70
+ dirty path neither group accounts for, naming each path, before either commit. Keep a path that
71
+ was already dirty outside the overwrite group refused even when the formatter rewrites it.
72
+ When resuming with `--from record`, report the absent format evidence and commit only paths the
73
+ valid overwrite receipt and manifest pair account for; never recover attribution from file
74
+ content or a previous run's journals. After an unrelated commit, or a refusal of the formatter's
75
+ rewrites on a resumed run, complete the intended overwrite commit by hand: inspect the receipt's
76
+ written and removed paths, stage those paths and the converged manifest and lockfile, and commit
77
+ them as `Overwrite with scaffold <version>`; then commit the formatter's remaining rewrites as
78
+ `Format with oxfmt <version>`. Then resume with `--from gates`.
65
79
  Treat the receipt as stale after any intervening commit; never use that receipt to authorize
66
80
  another `record` commit. Skip this step for an offline overwrite and the `@orkestrel/scaffold` package.
67
81
  9. Run the quality gates.
@@ -95,6 +109,9 @@ When the target is the `@orkestrel/scaffold` package, expect the runner to recor
95
109
  as skipped and to read the verify audit's foreign-path findings as expected; never run the `scaffold repair` or `scaffold overwrite` command
96
110
  against that checkout.
97
111
 
112
+ When a refused build leaves no `dist/host` for `scaffold catalog`, run a verified published scaffold
113
+ executable from owned scratch to refresh the catalog, then rerun the build.
114
+
98
115
  Run visits in parallel slices of disjoint repositories, each slice strictly serial inside itself,
99
116
  reporting per target. Refuse a failed target, name it, repair it, and re-run it alone.
100
117
 
@@ -150,6 +167,10 @@ registry copy over any staged tip, so every consumer stays red until that tip is
150
167
 
151
168
  ## Prepare a layer
152
169
 
170
+ - Before upload, compare the wave's candidate exported names with each other and the served fleet under `.claude/rules/names.md` § Fleet name ownership, and resolve every collision.
171
+ - Begin each release chain plan with the clean reinstall and the clean, whether it runs in a clone or the checkout.
172
+ - When a writer owns a script the preparation needs, run its installed built twin and record the executable's identity.
173
+ - Derive each release row's ruling from the measured distribution comparison and final runtime-range result under § Rule on the bump.
153
174
  - When the manifest's `engines.node` names a floor below the `DEFAULT_ENGINES` a generated workspace declares, raise it to that floor.
154
175
  - When a package still carries `.github/workflows/ci.yml`, delete it in that visit; the ecosystem runs no hosted CI.
155
176
  - Before the release, rule the package's guide and source comments against `.claude/rules/writing.md` § Substitutions and reword each hit its rows name; identifiers stay.
@@ -167,12 +188,11 @@ Prepare a published package's layer in this order, after the visit has ruled the
167
188
  preparation commit already precedes the overwrite; this install regenerates the lockfile for the
168
189
  bumped manifest.
169
190
  3. **Sweep the self-pins**, per the following section: the bump moves the version class.
170
- 4. **Run `prepublishOnly` to green in a fresh clone of the candidate commit, in the order the package's own chain fixes.** A release run executes every step whose inputs a failed step leaves valid and reports each result, so one clean-host run surfaces every independent fault.
191
+ 4. **Run `prepublishOnly` to green on the candidate commit, in a fresh clone or, where the user rules clones out, in the checkout, in the order the package's own chain fixes.** Run every release step whose inputs remain valid after a failure and report each result. Before using a serial chain that stops on failure, split aggregate commands into their component steps and record each step's prerequisites. After a failure, run the independent steps in separate chains, mark dependent steps blocked, and keep the release result failed while a required step fails or remains blocked.
171
192
  Run the visit and this script on a Node whose bundled npm meets the `MINIMUM_NPM_VERSION` floor a
172
193
  generated workspace declares in `devEngines`: the scripts spawn the npm CLI beside the running
173
194
  Node binary when one is there, so a `PATH` change reaches them only where none is.
174
- 5. **Write the release commit and push before the window opens.** The preparation commit inside
175
- the visit is a different commit at a different moment.
195
+ 5. **Write the release commit before the window opens. Push it only after the registry serves its version.**
176
196
 
177
197
  Where an inventory taken before the round already ruled every dist moved, apply the bump before
178
198
  the visit, pass the replaced version through `--prior` so the self-pin sweep finds it, and complete
@@ -11,7 +11,8 @@
11
11
  // the audit's writable dependency population matches its lookup bounds; on @orkestrel/scaffold itself an audit exit of 1 is
12
12
  // read as the expected foreign-path findings of its own canonical sources), install,
13
13
  // pins (the self-pin sweep with --prior or the manifest version and every range the visit moved; hits are reported, not
14
- // fatal), format, record (commit the overwrite paths), gates (format:check, lint:check, check, build, test), and compare (the rebuilt
14
+ // fatal), format, record (commit the overwrite paths, then this run's formatter rewrites), gates
15
+ // (format:check, lint:check, check, build, test), and compare (the rebuilt
15
16
  // dist against the published tarball, and the final runtime dependency set against the published
16
17
  // manifest `npm view NAME --json` serves; both readings are reported, not fatal). The summary
17
18
  // carries each step's exit and duration, a failed step's refusal (the `code: message` envelope or
@@ -211,6 +212,12 @@ export interface OverwriteReceipt {
211
212
  readonly removed: readonly string[]
212
213
  }
213
214
 
215
+ /** Describes the paths dirtied by this visit's format step and its installed formatter version. */
216
+ export interface FormatReceipt {
217
+ readonly paths: readonly string[]
218
+ readonly version: string | undefined
219
+ }
220
+
214
221
  /** Describes the outcome of writing a journal file. */
215
222
  export interface Journal {
216
223
  readonly path?: string
@@ -508,14 +515,15 @@ export function compareRanges(
508
515
  * Resolves the scaffold executable a target runs.
509
516
  *
510
517
  * @param target - The target directory.
511
- * @returns Node and the installed scaffold entry, else Node and the target's own built entry, else
512
- * none.
518
+ * @returns Node and the installed scaffold entry, else Node and the target's own built entry when
519
+ * its manifest names @orkestrel/scaffold, else none.
513
520
  */
514
521
  export function resolveScaffold(target: string): readonly string[] {
515
522
  const installed = join(target, 'node_modules', '@orkestrel', 'scaffold', 'dist', 'bin', 'main.js')
516
523
  if (existsSync(installed)) return [process.execPath, installed]
517
524
  const own = join(target, 'dist', 'bin', 'main.js')
518
- if (existsSync(own)) return [process.execPath, own]
525
+ if (readString(readManifest(target), 'name') === SCAFFOLD && existsSync(own))
526
+ return [process.execPath, own]
519
527
  return []
520
528
  }
521
529
 
@@ -1274,32 +1282,51 @@ export function readReceipt(target: string): OverwriteReceipt | undefined {
1274
1282
  *
1275
1283
  * @param runner - The visit's state.
1276
1284
  * @param name - The package name the manifest declares.
1277
- * @returns Nothing after the rows are appended; the overwrite's paths are committed when the receipt
1278
- * attributes every dirty path to them.
1285
+ * @param format - The evidence collected by this invocation's format step. Without it, paths outside
1286
+ * the overwrite receipt and manifest pair are refused.
1287
+ * @returns Nothing after the rows are appended; each attributed group is committed separately when
1288
+ * every dirty path belongs to the overwrite or this invocation's formatter rewrites.
1279
1289
  */
1280
- export function runRecord(runner: Runner, name: string | undefined): void {
1290
+ export function runRecord(runner: Runner, name: string | undefined, format?: FormatReceipt): void {
1281
1291
  if (name === SCAFFOLD) {
1282
1292
  appendStep(runner, 'record', 'git commit', `skipped: ${SCAFFOLD}`)
1283
1293
  return
1284
1294
  }
1285
1295
  if (refuseLocalSpecs(runner, 'record')) return
1286
1296
  if (runner.dry) {
1287
- runStep(
1288
- runner,
1289
- 'record',
1290
- 'git',
1291
- ['add', '-A', '--pathspec-from-file=-', '--pathspec-file-nul'],
1292
- runner.target,
1293
- )
1294
- runStep(
1297
+ for (const message of ['Overwrite with scaffold <version>', 'Format with oxfmt <version>']) {
1298
+ runStep(
1299
+ runner,
1300
+ 'record',
1301
+ 'git',
1302
+ ['--literal-pathspecs', 'add', '-A', '--pathspec-from-file=-', '--pathspec-file-nul'],
1303
+ runner.target,
1304
+ )
1305
+ runStep(
1306
+ runner,
1307
+ 'record',
1308
+ 'git',
1309
+ [
1310
+ '--literal-pathspecs',
1311
+ 'commit',
1312
+ '--only',
1313
+ '-m',
1314
+ message,
1315
+ '--pathspec-from-file=-',
1316
+ '--pathspec-file-nul',
1317
+ ],
1318
+ runner.target,
1319
+ )
1320
+ }
1321
+ return
1322
+ }
1323
+ if (format === undefined)
1324
+ appendStep(
1295
1325
  runner,
1296
1326
  'record',
1297
- 'git',
1298
- ['commit', '-m', 'Overwrite with scaffold <version>'],
1299
- runner.target,
1327
+ 'attribute format paths',
1328
+ 'format evidence is absent in this run; only overwrite receipt paths and the manifest pair can be committed',
1300
1329
  )
1301
- return
1302
- }
1303
1330
  const status = runStep(
1304
1331
  runner,
1305
1332
  'record',
@@ -1337,17 +1364,20 @@ export function runRecord(runner: Runner, name: string | undefined): void {
1337
1364
  const allowed = [...receipt.written, ...receipt.removed, 'package.json', 'package-lock.json'].map(
1338
1365
  (path) => normalizeSlashes(relative(runner.target, resolve(runner.target, path))),
1339
1366
  )
1340
- const outside = dirty.filter(
1341
- (path) =>
1342
- !allowed.some(
1343
- (entry) =>
1344
- entry !== '' &&
1345
- entry !== '..' &&
1346
- !entry.startsWith('../') &&
1347
- !isAbsolute(entry) &&
1348
- path === entry,
1349
- ),
1367
+ const overwritten = dirty.filter((path) =>
1368
+ allowed.some(
1369
+ (entry) =>
1370
+ entry !== '' &&
1371
+ entry !== '..' &&
1372
+ !entry.startsWith('../') &&
1373
+ !isAbsolute(entry) &&
1374
+ path === entry,
1375
+ ),
1376
+ )
1377
+ const formatted = dirty.filter(
1378
+ (path) => !overwritten.includes(path) && format?.paths.includes(path),
1350
1379
  )
1380
+ const outside = dirty.filter((path) => !overwritten.includes(path) && !formatted.includes(path))
1351
1381
  if (outside.length > 0) {
1352
1382
  appendStep(
1353
1383
  runner,
@@ -1358,29 +1388,94 @@ export function runRecord(runner: Runner, name: string | undefined): void {
1358
1388
  )
1359
1389
  return
1360
1390
  }
1361
- runStep(
1391
+ if (formatted.length > 0 && (format?.version === undefined || !VERSION.test(format.version))) {
1392
+ appendStep(
1393
+ runner,
1394
+ 'record',
1395
+ 'read formatter version',
1396
+ 'cannot read the installed formatter version from node_modules/oxfmt/package.json; restore the oxfmt install before recording',
1397
+ 1,
1398
+ )
1399
+ return
1400
+ }
1401
+ for (const group of [
1402
+ { paths: overwritten, message: `Overwrite with scaffold ${receipt.version}` },
1403
+ { paths: formatted, message: `Format with oxfmt ${format?.version}` },
1404
+ ]) {
1405
+ if (group.paths.length === 0) continue
1406
+ const input = `${group.paths.join('\0')}\0`
1407
+ runStep(
1408
+ runner,
1409
+ 'record',
1410
+ 'git',
1411
+ ['--literal-pathspecs', 'add', '-A', '--pathspec-from-file=-', '--pathspec-file-nul'],
1412
+ runner.target,
1413
+ readVerdict,
1414
+ input,
1415
+ )
1416
+ if (failed(runner.steps)) return
1417
+ runStep(
1418
+ runner,
1419
+ 'record',
1420
+ 'git',
1421
+ [
1422
+ '--literal-pathspecs',
1423
+ 'commit',
1424
+ '--only',
1425
+ '-m',
1426
+ group.message,
1427
+ '--pathspec-from-file=-',
1428
+ '--pathspec-file-nul',
1429
+ ],
1430
+ runner.target,
1431
+ readVerdict,
1432
+ input,
1433
+ )
1434
+ if (failed(runner.steps)) return
1435
+ }
1436
+ if (failed(runner.steps)) return
1437
+ runStep(runner, 'record', 'git', ['status', '--porcelain'], runner.target, (result) =>
1438
+ result.status === 0 && result.stdout.trim() !== ''
1439
+ ? { exit: 1, note: `tree remains dirty: ${result.stdout}` }
1440
+ : readVerdict(result),
1441
+ )
1442
+ }
1443
+
1444
+ /**
1445
+ * Runs the formatter and attributes paths from the dirty sets read immediately before and after it.
1446
+ *
1447
+ * @param runner - The visit's state.
1448
+ * @returns This invocation's evidence, or undefined for a dry run or a failed step.
1449
+ */
1450
+ export function runFormat(runner: Runner): FormatReceipt | undefined {
1451
+ if (runner.dry) {
1452
+ runNpmStep(runner, 'format', ['run', 'format'])
1453
+ return undefined
1454
+ }
1455
+ const version = readString(readManifest(join(runner.target, 'node_modules', 'oxfmt')), 'version')
1456
+ const before = runStep(
1362
1457
  runner,
1363
- 'record',
1458
+ 'format',
1364
1459
  'git',
1365
- ['--literal-pathspecs', 'add', '-A', '--pathspec-from-file=-', '--pathspec-file-nul'],
1460
+ ['status', '--porcelain=v1', '-z', '--untracked-files=all'],
1366
1461
  runner.target,
1367
- readVerdict,
1368
- `${dirty.join('\0')}\0`,
1369
1462
  )
1370
- if (failed(runner.steps)) return
1371
- runStep(
1463
+ if (before?.status !== 0 || failed(runner.steps)) return undefined
1464
+ runNpmStep(runner, 'format', ['run', 'format'])
1465
+ if (failed(runner.steps)) return undefined
1466
+ const after = runStep(
1372
1467
  runner,
1373
- 'record',
1468
+ 'format',
1374
1469
  'git',
1375
- ['commit', '-m', `Overwrite with scaffold ${receipt.version}`],
1470
+ ['status', '--porcelain=v1', '-z', '--untracked-files=all'],
1376
1471
  runner.target,
1377
1472
  )
1378
- if (failed(runner.steps)) return
1379
- runStep(runner, 'record', 'git', ['status', '--porcelain'], runner.target, (result) =>
1380
- result.status === 0 && result.stdout.trim() !== ''
1381
- ? { exit: 1, note: `tree remains dirty: ${result.stdout}` }
1382
- : readVerdict(result),
1383
- )
1473
+ if (after?.status !== 0 || failed(runner.steps)) return undefined
1474
+ const prior = new Set(readDirtyPaths(before.stdout))
1475
+ return {
1476
+ paths: [...new Set(readDirtyPaths(after.stdout))].filter((path) => !prior.has(path)),
1477
+ version,
1478
+ }
1384
1479
  }
1385
1480
 
1386
1481
  /**
@@ -1748,7 +1843,14 @@ export function runVisit(argv: readonly string[]): Visit | undefined {
1748
1843
  }
1749
1844
  const scaffold = resolveScaffold(target)
1750
1845
  if (scaffold.length === 0) {
1751
- console.error(`wave: no scaffold executable under ${target}; run npm install first`)
1846
+ const declared = [...readRanges(readManifest(target) ?? {}, RANGE_FIELDS).keys()].some((key) =>
1847
+ key.endsWith(` ${SCAFFOLD}`),
1848
+ )
1849
+ console.error(
1850
+ declared
1851
+ ? `wave: no @orkestrel/scaffold executable under ${target}; run npm install to install its declared @orkestrel/scaffold dependency first`
1852
+ : `wave: no @orkestrel/scaffold executable under ${target}, and its manifest declares none; run npm install --save-dev @orkestrel/scaffold first`,
1853
+ )
1752
1854
  return undefined
1753
1855
  }
1754
1856
  const [scaffoldFile, ...scaffoldPrefix] = scaffold
@@ -1805,9 +1907,8 @@ export function runVisit(argv: readonly string[]): Visit | undefined {
1805
1907
  selected.has('pins') && !failed(runner.steps)
1806
1908
  ? runPins(runner, before, readOption(argv, '--prior') ?? version)
1807
1909
  : undefined
1808
- if (selected.has('format') && !failed(runner.steps))
1809
- runNpmStep(runner, 'format', ['run', 'format'])
1810
- if (selected.has('record') && !failed(runner.steps)) runRecord(runner, name)
1910
+ const format = selected.has('format') && !failed(runner.steps) ? runFormat(runner) : undefined
1911
+ if (selected.has('record') && !failed(runner.steps)) runRecord(runner, name, format)
1811
1912
  if (selected.has('gates') && !failed(runner.steps)) {
1812
1913
  for (const gate of GATES) {
1813
1914
  if (failed(runner.steps)) break