@popovych.co/witness 0.28.2 → 0.28.3

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 (197) hide show
  1. package/README.md +1 -1
  2. package/dist/abandon.d.ts +67 -0
  3. package/dist/act.d.ts +16 -0
  4. package/dist/act.js +61 -0
  5. package/dist/adopt.d.ts +21 -0
  6. package/dist/allowlist.d.ts +48 -0
  7. package/dist/allowlist.js +79 -5
  8. package/dist/arbiter.d.ts +37 -0
  9. package/dist/arbiter.js +7 -5
  10. package/dist/ask.d.ts +29 -0
  11. package/dist/ask.js +11 -5
  12. package/dist/autonomy.d.ts +46 -0
  13. package/dist/autonomy.js +24 -12
  14. package/dist/awake.d.ts +15 -0
  15. package/dist/basis.d.ts +9 -0
  16. package/dist/battery.d.ts +23 -0
  17. package/dist/bin.d.ts +2 -0
  18. package/dist/caps.d.ts +20 -0
  19. package/dist/cli.d.ts +18 -0
  20. package/dist/config-file.d.ts +12 -0
  21. package/dist/config.d.ts +96 -0
  22. package/dist/config.js +2 -1
  23. package/dist/contain.d.ts +16 -0
  24. package/dist/context.d.ts +25 -0
  25. package/dist/criteria.d.ts +27 -0
  26. package/dist/criteria.js +2 -1
  27. package/dist/decide-view.d.ts +46 -0
  28. package/dist/decide-view.js +137 -0
  29. package/dist/decisions.d.ts +23 -0
  30. package/dist/deferral.d.ts +26 -0
  31. package/dist/delta.d.ts +58 -0
  32. package/dist/departure.d.ts +66 -0
  33. package/dist/design.d.ts +34 -0
  34. package/dist/drafts.d.ts +31 -0
  35. package/dist/drafts.js +5 -3
  36. package/dist/drift.d.ts +23 -0
  37. package/dist/drive-presence.d.ts +27 -0
  38. package/dist/drive-presence.js +15 -4
  39. package/dist/drive-report.d.ts +24 -0
  40. package/dist/drive-report.js +4 -4
  41. package/dist/drive.d.ts +97 -0
  42. package/dist/drive.js +68 -71
  43. package/dist/dsl.d.ts +23 -0
  44. package/dist/dsl.js +8 -3
  45. package/dist/evidence.d.ts +65 -0
  46. package/dist/floor.d.ts +6 -0
  47. package/dist/fm.d.ts +9 -0
  48. package/dist/gate-run-view.d.ts +57 -0
  49. package/dist/gate-run-view.js +100 -0
  50. package/dist/gate.d.ts +91 -0
  51. package/dist/gate.js +14 -67
  52. package/dist/gates/decompose.d.ts +1 -0
  53. package/dist/gates/decompose.js +3 -1
  54. package/dist/gates/design.d.ts +1 -0
  55. package/dist/gates/design.js +6 -2
  56. package/dist/gates/implement.d.ts +1 -0
  57. package/dist/gates/implement.js +9 -2
  58. package/dist/gates/index.d.ts +5 -0
  59. package/dist/gates/plan.d.ts +1 -0
  60. package/dist/gates/plan.js +10 -4
  61. package/dist/gates/ship.d.ts +1 -0
  62. package/dist/gates/ship.js +4 -2
  63. package/dist/gitio.d.ts +30 -0
  64. package/dist/gitio.js +4 -1
  65. package/dist/glob.d.ts +2 -0
  66. package/dist/harness.d.ts +73 -0
  67. package/dist/harness.js +36 -15
  68. package/dist/history.d.ts +10 -0
  69. package/dist/idlists.d.ts +2 -0
  70. package/dist/install.d.ts +29 -0
  71. package/dist/journal.d.ts +74 -0
  72. package/dist/journal.js +5 -1
  73. package/dist/junit.d.ts +9 -0
  74. package/dist/live.d.ts +24 -0
  75. package/dist/lock.d.ts +9 -0
  76. package/dist/matcher.d.ts +8 -0
  77. package/dist/migration.d.ts +25 -0
  78. package/dist/model.d.ts +8 -0
  79. package/dist/models.d.ts +9 -0
  80. package/dist/models.js +10 -0
  81. package/dist/needs-you.d.ts +75 -0
  82. package/dist/needs-you.js +104 -40
  83. package/dist/needs.d.ts +44 -0
  84. package/dist/needs.js +37 -7
  85. package/dist/notify.d.ts +12 -0
  86. package/dist/opener.d.ts +15 -0
  87. package/dist/pin.d.ts +12 -0
  88. package/dist/pin.js +9 -2
  89. package/dist/principles.d.ts +3 -0
  90. package/dist/probe.d.ts +1 -0
  91. package/dist/progress.d.ts +3 -0
  92. package/dist/recommend.d.ts +31 -0
  93. package/dist/recommend.js +51 -42
  94. package/dist/refusal.d.ts +20 -0
  95. package/dist/refusal.js +12 -4
  96. package/dist/registry.d.ts +1 -0
  97. package/dist/released-comments.d.ts +1 -0
  98. package/dist/review.d.ts +27 -0
  99. package/dist/reviewed.d.ts +23 -0
  100. package/dist/reviewer.d.ts +47 -0
  101. package/dist/rounds.d.ts +135 -0
  102. package/dist/rounds.js +38 -21
  103. package/dist/runner-lock.d.ts +5 -0
  104. package/dist/runner.d.ts +30 -0
  105. package/dist/scan.d.ts +27 -0
  106. package/dist/schemas.d.ts +11 -0
  107. package/dist/schemas.js +7 -3
  108. package/dist/session-clock.d.ts +16 -0
  109. package/dist/settings.d.ts +73 -0
  110. package/dist/settings.js +12 -2
  111. package/dist/settle.d.ts +39 -0
  112. package/dist/settle.js +59 -30
  113. package/dist/sha.d.ts +5 -0
  114. package/dist/ship.d.ts +20 -0
  115. package/dist/ship.js +21 -12
  116. package/dist/slice.d.ts +45 -0
  117. package/dist/slice.js +2 -2
  118. package/dist/snapshot.d.ts +10 -0
  119. package/dist/spawn.d.ts +22 -0
  120. package/dist/stamp.d.ts +27 -0
  121. package/dist/stamp.js +3 -1
  122. package/dist/steps.d.ts +30 -0
  123. package/dist/steps.js +8 -3
  124. package/dist/toon.d.ts +17 -0
  125. package/dist/toon.js +150 -14
  126. package/dist/txn.d.ts +28 -0
  127. package/dist/usage.d.ts +25 -0
  128. package/dist/verbs/abandon.d.ts +2 -0
  129. package/dist/verbs/adopt.d.ts +2 -0
  130. package/dist/verbs/adopt.js +9 -4
  131. package/dist/verbs/ask.d.ts +2 -0
  132. package/dist/verbs/check.d.ts +2 -0
  133. package/dist/verbs/check.js +29 -10
  134. package/dist/verbs/clean.d.ts +2 -0
  135. package/dist/verbs/dashboard.d.ts +59 -0
  136. package/dist/verbs/dashboard.js +4 -2
  137. package/dist/verbs/decide.d.ts +34 -0
  138. package/dist/verbs/decide.js +95 -130
  139. package/dist/verbs/design.d.ts +2 -0
  140. package/dist/verbs/design.js +8 -5
  141. package/dist/verbs/diff.d.ts +2 -0
  142. package/dist/verbs/diff.js +4 -2
  143. package/dist/verbs/dismiss.d.ts +2 -0
  144. package/dist/verbs/dispatch.d.ts +2 -0
  145. package/dist/verbs/dispatch.js +2 -2
  146. package/dist/verbs/draft.d.ts +2 -0
  147. package/dist/verbs/draft.js +6 -3
  148. package/dist/verbs/drive.d.ts +2 -0
  149. package/dist/verbs/evidence.d.ts +5 -0
  150. package/dist/verbs/floor.d.ts +2 -0
  151. package/dist/verbs/gate.d.ts +3 -0
  152. package/dist/verbs/index-verb.d.ts +2 -0
  153. package/dist/verbs/init.d.ts +2 -0
  154. package/dist/verbs/log.d.ts +9 -0
  155. package/dist/verbs/migrate.d.ts +13 -0
  156. package/dist/verbs/next.d.ts +61 -0
  157. package/dist/verbs/next.js +112 -84
  158. package/dist/verbs/read.d.ts +2 -0
  159. package/dist/verbs/read.js +3 -1
  160. package/dist/verbs/recap.d.ts +28 -0
  161. package/dist/verbs/recap.js +3 -3
  162. package/dist/verbs/recover.d.ts +5 -0
  163. package/dist/verbs/recover.js +14 -9
  164. package/dist/verbs/rename.d.ts +2 -0
  165. package/dist/verbs/rename.js +1 -1
  166. package/dist/verbs/retry.d.ts +2 -0
  167. package/dist/verbs/review.d.ts +2 -0
  168. package/dist/verbs/review.js +1 -1
  169. package/dist/verbs/satisfy.d.ts +2 -0
  170. package/dist/verbs/ship.d.ts +3 -0
  171. package/dist/verbs/start.d.ts +2 -0
  172. package/dist/verbs/start.js +12 -7
  173. package/dist/verbs/step-close.d.ts +2 -0
  174. package/dist/verbs/sync.d.ts +15 -0
  175. package/dist/verbs/trust.d.ts +4 -0
  176. package/dist/verbs/trust.js +34 -32
  177. package/dist/verbs/turn.d.ts +2 -0
  178. package/dist/verbs/wait.d.ts +9 -0
  179. package/dist/verbs/wait.js +3 -3
  180. package/dist/verbs/write.d.ts +18 -0
  181. package/dist/verbs/write.js +11 -5
  182. package/dist/verdict.d.ts +60 -0
  183. package/dist/version.d.ts +4 -0
  184. package/dist/worker-stream.d.ts +22 -0
  185. package/dist/worktree.d.ts +22 -0
  186. package/dist/worktree.js +1 -1
  187. package/package.json +7 -1
  188. package/plugin/.claude-plugin/plugin.json +1 -1
  189. package/plugin/commands/witness.md +10 -10
  190. package/plugin/hooks/canon-guard.mjs +71 -10
  191. package/plugin/hooks/session-dashboard.sh +1 -1
  192. package/plugin/skills/witness-brainstorm/SKILL.md +3 -3
  193. package/plugin/skills/witness-decompose/SKILL.md +3 -3
  194. package/plugin/skills/witness-design/SKILL.md +2 -2
  195. package/plugin/skills/witness-implement/SKILL.md +2 -2
  196. package/plugin/skills/witness-plan/SKILL.md +2 -2
  197. package/plugin/skills/witness-ship/SKILL.md +2 -2
@@ -0,0 +1,65 @@
1
+ import type { Ctx } from './cli.js';
2
+ import type { Config } from './config.js';
3
+ import { type TestOutcome } from './junit.js';
4
+ import { type Result } from './refusal.js';
5
+ import type { CanonDoc } from './scan.js';
6
+ export declare function isTestPath(rel: string): boolean;
7
+ export declare function screensDir(runRoot: string, planId: string): string;
8
+ export interface Capture {
9
+ name: string;
10
+ sha: string;
11
+ }
12
+ export declare function collectCaptures(runRoot: string, planId: string): Capture[];
13
+ export declare function checkoutRoot(cwd: string): Result<string>;
14
+ export interface SpecTestRun {
15
+ runner: 'filtered' | 'full-suite';
16
+ tests: Array<{
17
+ name: string;
18
+ ok: boolean;
19
+ }>;
20
+ allOk: boolean;
21
+ }
22
+ export declare function runSpecTests(runRoot: string, ctx: Ctx, parentId: string, trustRoot: string, opts?: {
23
+ suite?: TestOutcome[];
24
+ }): Promise<Result<SpecTestRun>>;
25
+ export declare function journalEvidence(stateRoot: string, planId: string, phase: 'red' | 'green', run: SpecTestRun, extra?: {
26
+ reconstructed?: boolean;
27
+ vacuous?: boolean;
28
+ captures?: Capture[];
29
+ step?: string;
30
+ }): Result<{
31
+ sha: string;
32
+ }>;
33
+ export declare function recordEvidence(runRoot: string, stateRoot: string, ctx: Ctx, planId: string, parentId: string, phase: 'red' | 'green', extra?: {
34
+ reconstructed?: boolean;
35
+ step?: string;
36
+ }): Promise<Result<SpecTestRun>>;
37
+ export declare function diffBase(runRoot: string, cfg: Config, override?: string): Result<string>;
38
+ export declare function changedFiles(runRoot: string, base: string): string[];
39
+ export declare function verifyRed(runRoot: string, stateRoot: string, ctx: Ctx, planId: string, parentId: string, base: string, step?: string): Promise<Result<{
40
+ redOk: boolean;
41
+ greenOk: boolean;
42
+ vacuous: boolean;
43
+ }>>;
44
+ export declare function diffTags(runRoot: string, base: string): string[];
45
+ export declare function changedTestSpecs(runRoot: string, base: string, parentId: string): string[];
46
+ export interface RegressionOutcome {
47
+ spec: string;
48
+ state: 'green' | 'red' | 'unknown' | 'unrunnable';
49
+ detail: string;
50
+ untrusted?: string;
51
+ }
52
+ export declare function runRegression(runRoot: string, ctx: Ctx, trustRoot: string, specIds: string[], known: (id: string) => boolean): Promise<RegressionOutcome[]>;
53
+ export interface EvidenceRequirement {
54
+ tag: string;
55
+ red: boolean;
56
+ green: boolean;
57
+ vacuous: boolean;
58
+ }
59
+ export interface EvidenceReport {
60
+ plan: string;
61
+ base: string;
62
+ required: EvidenceRequirement[];
63
+ satisfied: boolean;
64
+ }
65
+ export declare function evidenceForDiff(runRoot: string, stateRoot: string, plan: CanonDoc, base: string): EvidenceReport;
@@ -0,0 +1,6 @@
1
+ export declare function stateFloor(root: string): {
2
+ pin: string;
3
+ stream: string;
4
+ } | undefined;
5
+ export declare const FLOOR_STREAM = "floor";
6
+ export declare const FLOOR_KEY = "floor";
package/dist/fm.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import { type Result } from './refusal.js';
2
+ export interface RawDoc {
3
+ meta: Record<string, unknown>;
4
+ body: string;
5
+ }
6
+ export declare function splitDoc(raw: string): Result<RawDoc>;
7
+ export declare function serializeDoc(doc: RawDoc): string;
8
+ export declare function readDoc(path: string): Result<RawDoc>;
9
+ export declare function writeDoc(path: string, doc: RawDoc): void;
@@ -0,0 +1,57 @@
1
+ import type { Entry } from './journal.js';
2
+ import { type GateRunEntry, type ReviewerVerdict } from './rounds.js';
3
+ export interface FindingView {
4
+ reviewer: string;
5
+ blocking: boolean;
6
+ pin?: number;
7
+ anchor: string;
8
+ claim: string;
9
+ }
10
+ export declare function findingViews(verdicts: ReviewerVerdict[]): FindingView[];
11
+ export declare function findingRows(verdicts: ReviewerVerdict[]): Array<Record<string, string>>;
12
+ export declare function malformedRows(malformed: GateRunView['malformed']): Array<Record<string, string>>;
13
+ export interface GateRunView {
14
+ gate: string;
15
+ target: string;
16
+ round: number;
17
+ budget: number;
18
+ resume: boolean;
19
+ reviewed: string;
20
+ model: string;
21
+ cached: boolean;
22
+ delta?: number;
23
+ skipped: string[];
24
+ fallback: string[];
25
+ rerolled: string[];
26
+ carried?: {
27
+ lenses: string[];
28
+ run: string;
29
+ };
30
+ checks: Array<{
31
+ name: string;
32
+ ok: boolean;
33
+ detail?: string;
34
+ }>;
35
+ held: Array<{
36
+ criterion: string;
37
+ need: string;
38
+ satisfy?: string;
39
+ }>;
40
+ findings: FindingView[];
41
+ demoted: Array<{
42
+ anchor: string;
43
+ round: number;
44
+ }>;
45
+ malformed: Array<{
46
+ reviewer: string;
47
+ violations: Array<{
48
+ field: string;
49
+ rule: string;
50
+ }>;
51
+ }>;
52
+ standing?: string;
53
+ outcome: GateRunEntry['outcome'];
54
+ lastRound: boolean;
55
+ }
56
+ export declare function gateRunView(entry: GateRunEntry, mode: 'ran' | 'resume', entries?: Entry[]): GateRunView;
57
+ export declare function gateRunLines(view: GateRunView): string[];
@@ -0,0 +1,100 @@
1
+ import { heldSatisfy } from './needs.js';
2
+ import { ROUND_BOUND, boundReached, roundBudget } from './rounds.js';
3
+ import { kv, logSafe, rows } from './toon.js';
4
+ import { anchorKey } from './verdict.js';
5
+ // A finding's anchor and claim are a reviewer's free text, printed on a human's terminal: spelled
6
+ // out (`logSafe`) so an escape sequence or bidi override cannot paint over the row (row 215).
7
+ export function findingViews(verdicts) {
8
+ return verdicts.flatMap((rv) => rv.findings.map((f) => ({
9
+ reviewer: rv.reviewer, blocking: f.blocking,
10
+ ...(f.contradicts_pin !== undefined ? { pin: f.contradicts_pin } : {}),
11
+ anchor: logSafe(typeof f.anchor === 'string' ? f.anchor : `omission:${f.anchor.scope}`), claim: logSafe(f.claim),
12
+ })));
13
+ }
14
+ const findingRow = (f) => ({
15
+ reviewer: f.reviewer, blocking: String(f.blocking), pin: f.pin !== undefined ? `#${f.pin}` : '',
16
+ anchor: f.anchor, claim: f.claim,
17
+ });
18
+ export function findingRows(verdicts) {
19
+ return findingViews(verdicts).map(findingRow);
20
+ }
21
+ // One row per violation, from a journaled round's malformed lenses or a view's.
22
+ export function malformedRows(malformed) {
23
+ return malformed.flatMap((m) => m.violations.map((x) => ({ reviewer: m.reviewer, field: x.field, rule: x.rule })));
24
+ }
25
+ // `entries` is the stream AS OF AFTER this entry: without it the view cannot tell the round that
26
+ // spends the budget from any other, and rows 109/110 are both about that round. Without it this
27
+ // stays a pure read of the entry it was handed: the base budget, and never the last round.
28
+ export function gateRunView(entry, mode, entries) {
29
+ return {
30
+ gate: entry.gate, target: entry.artifact, round: entry.round,
31
+ budget: entries ? roundBudget(entries, entry.gate) : ROUND_BOUND,
32
+ resume: mode === 'resume',
33
+ reviewed: entry.reviewed_sha.slice(0, 7), model: entry.model, cached: Boolean(entry.cached),
34
+ ...(entry.delta ? { delta: entry.delta.round } : {}),
35
+ skipped: [...(entry.skipped ?? [])], fallback: [...(entry.fallback ?? [])], rerolled: [...(entry.rerolled ?? [])],
36
+ ...(entry.carried ? { carried: { lenses: [...entry.carried.lenses], run: entry.carried.run } } : {}),
37
+ checks: entry.checks.map((c) => ({ name: c.name, ok: c.ok, ...(c.detail !== undefined ? { detail: c.detail } : {}) })),
38
+ // A journaled row is parsed JSON: each field is shown as the string it prints as.
39
+ held: entry.checks.flatMap((c) => c.held ?? []).map((h) => {
40
+ const satisfy = heldSatisfy(h);
41
+ return { criterion: logSafe(String(h.criterion)), need: logSafe(String(h.need)), ...(satisfy !== undefined ? { satisfy } : {}) };
42
+ }),
43
+ findings: findingViews(entry.verdicts ?? []),
44
+ demoted: (entry.verdicts ?? []).flatMap((rv) => rv.findings)
45
+ .flatMap((f) => (f.demoted !== undefined ? [{ anchor: anchorKey(f.anchor), round: f.demoted }] : [])),
46
+ malformed: (entry.malformed ?? [])
47
+ .map((m) => ({ reviewer: m.reviewer, violations: m.violations.map((x) => ({ field: x.field, rule: x.rule })) })),
48
+ ...(entry.standing ? { standing: entry.standing } : {}),
49
+ outcome: entry.outcome,
50
+ lastRound: entry.outcome !== 'passed' && entries !== undefined && boundReached(entries, entry.gate),
51
+ };
52
+ }
53
+ // Rows 139/203. `renderGateRun`'s lines up to its help tail, read from the view. Each element is
54
+ // one line as the screen has always printed it, and a table one element, its rows joined: a
55
+ // caller printing these one `ctx.out` each is handed exactly what it was handed before the view.
56
+ export function gateRunLines(view) {
57
+ const out = [
58
+ kv('gate', view.gate),
59
+ kv('target', view.target),
60
+ kv('round', `${view.round} of ${view.budget}${view.resume ? ' (resume — content unchanged)' : ''}`),
61
+ kv('reviewed', view.reviewed),
62
+ kv('model', `${view.model}${view.cached ? ' · cached' : ''}`),
63
+ ];
64
+ if (view.delta !== undefined)
65
+ out.push(kv('review', `delta since round ${view.delta}`));
66
+ if (view.skipped.length > 0)
67
+ out.push(kv('skipped', view.skipped.join(' · ')));
68
+ if (view.fallback.length > 0)
69
+ out.push(kv('fallback', view.fallback.join(' → ')));
70
+ if (view.rerolled.length > 0)
71
+ out.push(kv('rerolled', view.rerolled.join(' · ')));
72
+ if (view.carried) {
73
+ out.push(kv('carried', `${view.carried.lenses.join(' · ')} — answered in run ${view.carried.run} on this content and prompts`));
74
+ }
75
+ out.push(rows('checks', ['name', 'ok', 'detail'], view.checks.map((c) => ({ name: c.name, ok: String(c.ok), detail: c.detail ?? '' }))).join('\n'));
76
+ // Row 179: what the lane did not run, beside the row that passed without it.
77
+ for (const h of view.held)
78
+ out.push(`held: ${h.criterion} — ${h.need} unmet${h.satisfy ? ` · ${h.satisfy}` : ''}`);
79
+ if (view.findings.length > 0) {
80
+ out.push(rows('findings', ['reviewer', 'blocking', 'pin', 'anchor', 'claim'], view.findings.map(findingRow)).join('\n'));
81
+ }
82
+ for (const d of view.demoted)
83
+ out.push(kv('demoted', `${d.anchor} — unchanged since round ${d.round}`));
84
+ if (view.malformed.length > 0)
85
+ out.push(rows('malformed', ['reviewer', 'field', 'rule'], malformedRows(view.malformed)).join('\n'));
86
+ if (view.standing)
87
+ out.push(kv('standing-stop', view.standing));
88
+ out.push(kv('outcome', view.outcome));
89
+ // Row 110. The round that SPENDS the budget is the one that has to say so. It rendered
90
+ // like any other, so the natural next act — fix the finding, re-gate — was advertised
91
+ // by the help line below and then refused twice: the gate short-circuits, and the edit
92
+ // that answered the finding forfeits `--approve` under D75. Nothing warned, and the
93
+ // finding is itself an instruction to edit. Printed above the `help:` suppression, not
94
+ // inside it: `decide --show` renders its own exits and is the surface a human reads
95
+ // while deciding — the one place this warning is most owed.
96
+ if (view.lastRound) {
97
+ out.push(kv('last-round', 'the round budget is spent — the gate will not run again, and an edit from here forfeits --approve (the verdict would describe an older tree)'));
98
+ }
99
+ return out;
100
+ }
package/dist/gate.d.ts ADDED
@@ -0,0 +1,91 @@
1
+ import { type Ctx } from './cli.js';
2
+ import { type Config } from './config.js';
3
+ import { type Entry } from './journal.js';
4
+ import { type Canon } from './scan.js';
5
+ import { type DeferralEntry } from './deferral.js';
6
+ import { type Result } from './refusal.js';
7
+ import { type ContentKind, type Lens, type LensDoc } from './reviewer.js';
8
+ import { type Reviewed } from './verdict.js';
9
+ import { type OutstandingDemotion } from './delta.js';
10
+ import { type GateCheck, type GateRunEntry } from './rounds.js';
11
+ export { liveExits } from './rounds.js';
12
+ import type { ChangeClass, GateName } from './settings.js';
13
+ export type { ChangeClass, GateName } from './settings.js';
14
+ export interface Stamp {
15
+ artifact: string;
16
+ to: string;
17
+ }
18
+ export interface MetaStamp {
19
+ artifact: string;
20
+ patch: Record<string, unknown>;
21
+ entryType: string;
22
+ }
23
+ export interface LensOverride {
24
+ reviewed?: Reviewed;
25
+ promptBody?: string;
26
+ docs?: LensDoc[];
27
+ }
28
+ export interface GateInput {
29
+ class: ChangeClass;
30
+ reviewedSha: string;
31
+ artifactSha?: string;
32
+ diffSha?: string;
33
+ reviewed: Reviewed;
34
+ promptBody: string;
35
+ checks: GateCheck[];
36
+ standingStop?: string;
37
+ stamps: Stamp[];
38
+ repin?: {
39
+ rel: string;
40
+ meta: Record<string, unknown>;
41
+ body: string;
42
+ sha: string;
43
+ };
44
+ lensOverrides?: Record<string, LensOverride>;
45
+ skipLenses?: Array<{
46
+ lens: string;
47
+ why: string;
48
+ }>;
49
+ snapshot?: {
50
+ tree: string;
51
+ context: string;
52
+ };
53
+ }
54
+ export interface GateSpec {
55
+ gate: GateName;
56
+ targetKind: 'effort' | 'plan' | 'spec';
57
+ resolve(root: string, ctx: Ctx, canon: Canon, cfg: Config, target: string): Promise<Result<GateInput>>;
58
+ currentSha?(root: string, canon: Canon, cfg: Config, target: string): string | undefined;
59
+ upstreamOf?(root: string, canon: Canon, target: string): string | undefined;
60
+ approveStamps?(root: string, canon: Canon, target: string): Stamp[];
61
+ approveMeta?(root: string, canon: Canon, cfg: Config, target: string): MetaStamp[];
62
+ demotes?: boolean;
63
+ backstops?: GateName;
64
+ reads: ContentKind;
65
+ lensReads?: Record<string, ContentKind>;
66
+ }
67
+ export declare function registerGate(spec: GateSpec): void;
68
+ export declare function gateSpec(name: string): GateSpec | undefined;
69
+ export declare function readsOf(gate: string, lens?: string): ContentKind | undefined;
70
+ export declare function assertReads(spec: GateSpec, reviewed: Reviewed, overrides?: Record<string, LensOverride>): void;
71
+ export declare function debtKinds(root: string, d: DeferralEntry, home: Entry[]): ContentKind[];
72
+ export declare function judgeable(root: string, d: DeferralEntry, home: Entry[], gate: GateName, lenses: readonly string[]): boolean;
73
+ export declare function gateLenses(root: string, cfg: Config, gate: GateName, names: string[], overrides?: Record<string, LensOverride>): Result<Lens[]>;
74
+ export declare function gateSetup(root: string, spec: GateSpec, entries: Entry[], lenses: readonly string[]): {
75
+ forLens(name: string): string;
76
+ text: string;
77
+ backstopped: OutstandingDemotion[];
78
+ };
79
+ export declare function lensPrompt(lens: Lens, setup: string, menu: string, body: string): string;
80
+ export declare function batteryFor(cfg: Config, gate: GateName, cls: ChangeClass): Result<string[]>;
81
+ export declare function renderGateRun(ctx: Ctx, entry: GateRunEntry, mode: 'ran' | 'resume', opts?: {
82
+ entries?: Entry[];
83
+ help?: boolean;
84
+ upstream?: string;
85
+ }): void;
86
+ export declare function printSliceShape(ctx: Ctx, root: string, gateName: string, target: string): void;
87
+ export declare function runGate(ctx: Ctx, gateName: string, target: string, flags: {
88
+ fresh: boolean;
89
+ manual: boolean;
90
+ handover?: boolean;
91
+ }): Promise<number>;
package/dist/gate.js CHANGED
@@ -12,13 +12,14 @@ import { deferralsBlock, openDeferrals } from './deferral.js';
12
12
  import { newRunId } from './drift.js';
13
13
  import { resolveJudge } from './harness.js';
14
14
  import { ok, refuse, renderRefusal, v } from './refusal.js';
15
- import { cmd, kv, logSafe, rows } from './toon.js';
15
+ import { cmd, kv, shellWord } from './toon.js';
16
16
  import { stageModel, unansweredPin } from './model.js';
17
17
  import { docKeysFor, docsBlock, loadLensDocs, pinsBlock, promptsSha, resolvePrompt, } from './reviewer.js';
18
18
  import { runBattery } from './battery.js';
19
+ import { gateRunLines, gateRunView } from './gate-run-view.js';
19
20
  import { anchorFromKey, anchorKey, anchorMenu } from './verdict.js';
20
21
  import { basisSha, deltaBlock, demote, demotionsBlock, outstandingDemotions, planDelta, reportedBy, } from './delta.js';
21
- import { ROUND_BOUND, appendKind, boundReached, lastGateRun, liveExits, roundBudget, roundsSinceApprove, runsSinceReset, } from './rounds.js';
22
+ import { appendKind, boundReached, lastGateRun, liveExits, roundsSinceApprove, runsSinceReset, } from './rounds.js';
22
23
  export { liveExits } from './rounds.js';
23
24
  import { gateSettled, owedRun } from './verbs/next.js';
24
25
  import { prepareStamp, writeStamp } from './stamp.js';
@@ -148,18 +149,6 @@ export function gateSetup(root, spec, entries, lenses) {
148
149
  export function lensPrompt(lens, setup, menu, body) {
149
150
  return `${lens.contents}\n\n${docsBlock(lens.docs ?? [])}${setup}${menu ? `${menu}\n\n` : ''}## Reviewed content\n\n${body}\n`;
150
151
  }
151
- // A finding's anchor and claim are a reviewer's free text, printed on a human's terminal: spelled
152
- // out (`logSafe`) so an escape sequence or bidi override cannot paint over the row (row 215).
153
- export function findingRows(verdicts) {
154
- return verdicts.flatMap((rv) => rv.findings.map((f) => ({
155
- reviewer: rv.reviewer, blocking: String(f.blocking),
156
- pin: f.contradicts_pin !== undefined ? `#${f.contradicts_pin}` : '',
157
- anchor: logSafe(typeof f.anchor === 'string' ? f.anchor : `omission:${f.anchor.scope}`), claim: logSafe(f.claim),
158
- })));
159
- }
160
- export function malformedRows(malformed) {
161
- return malformed.flatMap((m) => m.violations.map((x) => ({ reviewer: m.reviewer, field: x.field, rule: x.rule })));
162
- }
163
152
  // The gate's own reviewers for this class. Their shape — a non-empty list, or a map naming
164
153
  // every class — is refused when the file loads (row 13, amended by 193), so nothing is left
165
154
  // to refuse here.
@@ -169,59 +158,16 @@ export function batteryFor(cfg, gate, cls) {
169
158
  }
170
159
  // `entries` is the stream AS OF AFTER this entry: without it the renderer cannot tell the
171
160
  // round that spends the budget from any other, and rows 109/110 are both about that round.
172
- // `help: false` is for callers that render their own `exits:` line (`decide --show`).
161
+ // `help: false` is for callers that render their own `exits:` line (`decide --show`, which
162
+ // prints the run's view itself — `gateRunLines` — and never reaches this tail).
163
+ // Rows 139/203. The run's lines come from its view (src/gate-run-view.ts); only the help tail,
164
+ // which loads canon and the trust list, stays here.
173
165
  export function renderGateRun(ctx, entry, mode, opts = {}) {
174
- const entries = opts.entries ?? [];
175
- const budget = opts.entries ? roundBudget(entries, entry.gate) : ROUND_BOUND;
176
- const atBound = opts.entries !== undefined && boundReached(entries, entry.gate);
177
- ctx.out(kv('gate', entry.gate));
178
- ctx.out(kv('target', entry.artifact));
179
- ctx.out(kv('round', `${entry.round} of ${budget}${mode === 'resume' ? ' (resume — content unchanged)' : ''}`));
180
- ctx.out(kv('reviewed', entry.reviewed_sha.slice(0, 7)));
181
- ctx.out(kv('model', `${entry.model}${entry.cached ? ' · cached' : ''}`));
182
- if (entry.delta)
183
- ctx.out(kv('review', `delta since round ${entry.delta.round}`));
184
- if (entry.skipped?.length)
185
- ctx.out(kv('skipped', entry.skipped.join(' · ')));
186
- if (entry.fallback?.length)
187
- ctx.out(kv('fallback', entry.fallback.join(' → ')));
188
- if (entry.rerolled?.length)
189
- ctx.out(kv('rerolled', entry.rerolled.join(' · ')));
190
- if (entry.carried) {
191
- ctx.out(kv('carried', `${entry.carried.lenses.join(' · ')} — answered in run ${entry.carried.run} on this content and prompts`));
192
- }
193
- ctx.out(rows('checks', ['name', 'ok', 'detail'], entry.checks.map((c) => ({ name: c.name, ok: String(c.ok), detail: c.detail ?? '' }))).join('\n'));
194
- // Row 179: what the lane did not run, beside the row that passed without it.
195
- for (const h of entry.checks.flatMap((c) => c.held ?? []))
196
- ctx.out(`held: ${h.criterion} — ${h.need} unmet · ${h.satisfy}`);
197
- const findings = findingRows(entry.verdicts ?? []);
198
- if (findings.length)
199
- ctx.out(rows('findings', ['reviewer', 'blocking', 'pin', 'anchor', 'claim'], findings).join('\n'));
200
- for (const f of (entry.verdicts ?? []).flatMap((rv) => rv.findings)) {
201
- if (f.demoted !== undefined)
202
- ctx.out(kv('demoted', `${anchorKey(f.anchor)} — unchanged since round ${f.demoted}`));
203
- }
204
- if (entry.malformed?.length) {
205
- ctx.out(rows('malformed', ['reviewer', 'field', 'rule'], malformedRows(entry.malformed)).join('\n'));
206
- }
207
- if (entry.standing)
208
- ctx.out(kv('standing-stop', entry.standing));
209
- ctx.out(kv('outcome', entry.outcome));
210
- if (entry.outcome !== 'passed') {
211
- // Row 110. The round that SPENDS the budget is the one that has to say so. It rendered
212
- // like any other, so the natural next act — fix the finding, re-gate — was advertised
213
- // by the help line below and then refused twice: the gate short-circuits, and the edit
214
- // that answered the finding forfeits `--approve` under D75. Nothing warned, and the
215
- // finding is itself an instruction to edit. Printed above the `help:` suppression, not
216
- // inside it: `decide --show` renders its own exits and is the surface a human reads
217
- // while deciding — the one place this warning is most owed.
218
- if (atBound) {
219
- ctx.out(kv('last-round', 'the round budget is spent — the gate will not run again, and an edit from here forfeits --approve (the verdict would describe an older tree)'));
220
- }
221
- // Without `entries` this stays a pure formatter over the entry it was handed, and the
222
- // off-bound triple is the right answer; with them it tells the truth at the bound too.
223
- if (opts.help !== false)
224
- renderChoices(ctx, entry.gate, entry.artifact, entries, opts.upstream);
166
+ gateRunLines(gateRunView(entry, mode, opts.entries)).forEach((l) => ctx.out(l));
167
+ // Without `entries` this stays a pure formatter over the entry it was handed, and the
168
+ // off-bound triple is the right answer; with them it tells the truth at the bound too.
169
+ if (entry.outcome !== 'passed' && opts.help !== false) {
170
+ renderChoices(ctx, entry.gate, entry.artifact, opts.entries ?? [], opts.upstream);
225
171
  }
226
172
  }
227
173
  // D121: the exits line stated which commands would not refuse and never which to take, so
@@ -399,7 +345,8 @@ async function judge(ctx, gateName, target, flags) {
399
345
  // refuse and send the human through the verb that states a retraction and its reason.
400
346
  const settledBefore = gateSettled(entries, spec.gate);
401
347
  if (flags.fresh && settledBefore) {
402
- renderRefusal([v('gate', 'settled-approve', `${spec.gate} ${target} is settled`, `witness decide ${spec.gate} ${target} --revise --note "<why>" — retract the approval, then re-gate`)])
348
+ // Row 239. A shape: the target is quoted, and the slot is the human's to fill.
349
+ renderRefusal([v('gate', 'settled-approve', `${spec.gate} ${target} is settled`, `witness decide ${shellWord(spec.gate)} ${shellWord(target)} --revise --note "<why>" — retract the approval, then re-gate`)])
403
350
  .forEach((l) => ctx.err(l));
404
351
  return EXIT.REFUSED;
405
352
  }
@@ -0,0 +1 @@
1
+ export {};
@@ -9,6 +9,7 @@ import { effortCanon, effortReviewedSha, effortWrites } from '../reviewed.js';
9
9
  import { validateDoc } from '../schemas.js';
10
10
  import { registerGate } from '../gate.js';
11
11
  import { basisMoved, planBasis, specBasis } from '../basis.js';
12
+ import { shellWord } from '../toon.js';
12
13
  // Row 221 (final review). The critic's lenses are written for slices; principles are not one.
13
14
  const PRINCIPLES_LENSES = [
14
15
  'This effort also amends the repo\'s principles. Principles are standing rules, not a slice:',
@@ -43,7 +44,8 @@ registerGate({
43
44
  // here, and an approve stamps them with its specs.
44
45
  const docs = effortCanon(root, canon, effort);
45
46
  if (docs.length === 0) {
46
- return refuse([v('effort', 'nothing-to-gate', effort, `written specs or principles — run: witness write <id> --effort ${effort} --meta m.json --body b.md`)]);
47
+ // Row 239. A shape: the effort is quoted, and the id and the files are the session's.
48
+ return refuse([v('effort', 'nothing-to-gate', effort, `written specs or principles — run: witness write <id> --effort ${shellWord(effort)} --meta m.json --body b.md`)]);
47
49
  }
48
50
  const checks = [];
49
51
  const schemaProblems = docs.flatMap((d) => validateDoc(d.meta, d.body).map((x) => `${String(d.meta.id)} ${x.field}:${x.rule}`));
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,6 @@
1
1
  import { existsSync, readFileSync } from 'node:fs';
2
2
  import { join } from 'node:path';
3
+ import { cliAct } from '../act.js';
3
4
  import { designCurrentSha, designGateSha, designRel, designReviewed, designUnseen, htmlSha, validateDesignArtifact } from '../design.js';
4
5
  import { registerGate } from '../gate.js';
5
6
  import { latestRecap } from '../journal.js';
@@ -9,6 +10,7 @@ import { findById } from '../scan.js';
9
10
  import { canonicalSha, short } from '../sha.js';
10
11
  import { contextDigest } from '../delta.js';
11
12
  import { snapshotFiles } from '../snapshot.js';
13
+ import { shellWord } from '../toon.js';
12
14
  registerGate({
13
15
  gate: 'design',
14
16
  targetKind: 'spec',
@@ -32,14 +34,16 @@ registerGate({
32
34
  //
33
35
  // Row 194: in every mode. A look comes out of a conversation with a human, so the human
34
36
  // has seen it before any critic judges it (row 178's unseen gate is gone).
37
+ // Row 239. A command a want or a check detail names is an act's line, and a shape (a file to
38
+ // author) quotes its foreign word.
35
39
  const unseen = designUnseen(root, cfg.paths, specId);
36
40
  if (unseen !== undefined) {
37
- return refuse([v('design', 'design-unseen', `no sight witnessed for ${short(unseen)}`, `a human shown this artifact — run: witness design ${specId} --open`)]);
41
+ return refuse([v('design', 'design-unseen', `no sight witnessed for ${short(unseen)}`, `a human shown this artifact — run: ${cliAct('design', specId, '--open').line}`)]);
38
42
  }
39
43
  const checks = [];
40
44
  checks.push({ name: 'ui-flag', ok: spec.meta.ui === true, detail: spec.meta.ui === true ? 'ui: true' : 'spec is not ui-flagged' });
41
45
  checks.push({ name: 'feature-class', ok: recap?.class === 'feature', detail: `effort class: ${recap?.class ?? 'none'}` });
42
- checks.push({ name: 'artifact', ok: html !== undefined, detail: html !== undefined ? rel : `${rel} missing — run: witness design ${specId} --file <html>` });
46
+ checks.push({ name: 'artifact', ok: html !== undefined, detail: html !== undefined ? rel : `${rel} missing — run: witness design ${shellWord(specId)} --file <html>` });
43
47
  const template = html !== undefined ? validateDesignArtifact(html) : [];
44
48
  checks.push({ name: 'template', ok: html !== undefined && template.length === 0,
45
49
  detail: template.length ? template.map((x) => x.rule).join(' · ') : 'self-contained, id-attributed' });
@@ -0,0 +1 @@
1
+ export declare function codePromptBody(wt: string, base: string, files: string[], header: string): string;
@@ -15,6 +15,8 @@ import { laneCheck, runCriteria } from '../criteria.js';
15
15
  import { diffReviewedSha, effortOf, implementReviewedSha } from '../reviewed.js';
16
16
  import { worktreePath } from '../worktree.js';
17
17
  import { registerGate } from '../gate.js';
18
+ import { logSafe, offeredLine } from '../toon.js';
19
+ import { cliAct } from '../act.js';
18
20
  export function codePromptBody(wt, base, files, header) {
19
21
  const diff = git(wt, 'diff', base);
20
22
  const untracked = files.filter((f) => {
@@ -80,7 +82,8 @@ registerGate({
80
82
  }
81
83
  const wt = worktreePath(root, planId);
82
84
  if (String(plan.meta.status) !== 'in-progress' || !existsSync(wt)) {
83
- return refuse([v('plan', 'not-started', String(plan.meta.status), `an in-progress plan with a worktree — run: witness start ${planId}`)]);
85
+ // Row 239. The command a want names is an act's line.
86
+ return refuse([v('plan', 'not-started', String(plan.meta.status), `an in-progress plan with a worktree — run: ${cliAct('start', planId).line}`)]);
84
87
  }
85
88
  const parent = findById(canon, String(plan.meta.parent));
86
89
  if (!parent) {
@@ -101,7 +104,11 @@ registerGate({
101
104
  const artRel = designRel(cfg.paths, String(plan.meta.parent));
102
105
  const artAbs = join(root, artRel);
103
106
  if (!existsSync(artAbs) || !statSync(artAbs).isFile()) {
104
- return refuse([v('design', 'design-artifact-missing', artRel, 'the approved living design the plan pins — restore it or re-run the design stage', `git checkout -- ${artRel}`)]);
107
+ // Row 239: the restore is another tool's command, through the one renderer. Where it is
108
+ // withheld there is no `run:`, and the want still names both ways back. Ruling R24: the path
109
+ // is the config's, and the refusal's row above the remedy names it spelled out, so a line break
110
+ // in it cannot start a line of its own, which could read `run:`.
111
+ return refuse([v('design', 'design-artifact-missing', logSafe(artRel), 'the approved living design the plan pins — restore it or re-run the design stage', offeredLine(['git', 'checkout', '--', artRel]))]);
105
112
  }
106
113
  const living = { path: artRel, contents: readFileSync(artAbs, 'utf8') };
107
114
  lensOverrides['design-reviewer'] = {
@@ -0,0 +1,5 @@
1
+ import './decompose.js';
2
+ import './plan.js';
3
+ import './implement.js';
4
+ import './ship.js';
5
+ import './design.js';
@@ -0,0 +1 @@
1
+ export {};
@@ -12,7 +12,9 @@ import { registerGate } from '../gate.js';
12
12
  import { designPending, designStamp } from '../design.js';
13
13
  import { basisMoved, planBasis, planDecisionsTerm, specBasis } from '../basis.js';
14
14
  import { decisionDelta, decisionLines, recapLines } from '../decisions.js';
15
+ import { isId } from '../dsl.js';
15
16
  import { rows } from '../toon.js';
17
+ import { cliAct } from '../act.js';
16
18
  // D167. One derivation for the gate's stamp and `decide`'s: a pass approves a draft and nothing
17
19
  // else. Row 95 keeps an in-flight status through a re-author, and a passing re-gate must not
18
20
  // take it back — nor stamp a finished plan approved again.
@@ -73,12 +75,13 @@ registerGate({
73
75
  const baseMoved = base.kind === 'empty' ? []
74
76
  : basisMoved({ spec: base.sha, ...(base.decisions ? { decisions: base.decisions } : {}) }, current);
75
77
  const delta = baseMoved.includes('decisions') ? decisionDelta(root, base, parent) : undefined;
78
+ // Row 239. Each read the prompt names is an act's line, here and in its sections below.
76
79
  const deltaBase = base.kind === 'empty'
77
80
  ? 'new spec — the delta is the whole spec'
78
81
  : [
79
82
  `previous plan ${base.planId} pinned ${short(base.sha ?? '')} — the plan must realize what changed since`,
80
83
  ...(!baseMoved.includes('decisions') ? []
81
- : delta === undefined ? [`decisions moved since ${base.planId} — witness read ${parentId} --decisions`]
84
+ : delta === undefined ? [`decisions moved since ${base.planId} — ${cliAct('read', parentId, '--decisions').line}`]
82
85
  : [`decisions moved since ${base.planId}:`, ...rows('decisions-delta', ['id', 'change', 'text'], delta)]),
83
86
  ].join('\n');
84
87
  // What the parent's slicing settled and its effort's standing limits — shown only when it
@@ -86,8 +89,8 @@ registerGate({
86
89
  // chore plan also reads its chore's whole recap: a chore writes no spec to carry it.
87
90
  const carried = decisionLines(root, parent);
88
91
  const sections = [
89
- ...(carried.some((l) => l.startsWith(' ')) ? [`### Decisions ${parentId} carries — witness read ${parentId} --decisions`, carried.join('\n')] : []),
90
- ...(recap?.class === 'chore' ? [`### The chore's recap — witness read ${effort} --decisions`, recapLines(recap).join('\n')] : []),
92
+ ...(carried.some((l) => l.startsWith(' ')) ? [`### Decisions ${parentId} carries — ${cliAct('read', parentId, '--decisions').line}`, carried.join('\n')] : []),
93
+ ...(recap?.class === 'chore' ? [`### The chore's recap — ${cliAct('read', effort, '--decisions').line}`, recapLines(recap).join('\n')] : []),
91
94
  ];
92
95
  const promptBody = [
93
96
  `### Parent spec: ${parentId}`, serializeDoc({ meta: parent.meta, body: parent.body }),
@@ -118,9 +121,12 @@ registerGate({
118
121
  const parent = plan ? findById(canon, String(plan.meta.parent)) : undefined;
119
122
  return plan && parent ? planPairSha(plan, parent, planDecisionsTerm(root, plan, parent)) : undefined;
120
123
  },
124
+ // Row 239 (the plan's B15). The upstream is printed into `--revise --upstream <id>`: a parent
125
+ // outside the id set gives none, as `next`'s `upstreamFor` gives none.
121
126
  upstreamOf(_root, canon, planId) {
122
127
  const plan = findById(canon, planId);
123
- return plan && plan.meta.type === 'plan' ? String(plan.meta.parent) : undefined;
128
+ const parent = plan && plan.meta.type === 'plan' ? String(plan.meta.parent) : undefined;
129
+ return isId(parent) ? parent : undefined;
124
130
  },
125
131
  approveStamps(_root, canon, planId) {
126
132
  const doc = findById(canon, planId);
@@ -0,0 +1 @@
1
+ export {};
@@ -1,4 +1,5 @@
1
1
  import { existsSync } from 'node:fs';
2
+ import { cliAct } from '../act.js';
2
3
  import { stateDirs } from '../gitio.js';
3
4
  import { ok, refuse, v } from '../refusal.js';
4
5
  import { canonicalSha, planContentSha } from '../sha.js';
@@ -39,7 +40,8 @@ registerGate({
39
40
  }
40
41
  const wt = worktreePath(root, planId);
41
42
  if (String(plan.meta.status) !== 'in-progress' || !existsSync(wt)) {
42
- return refuse([v('plan', 'not-started', String(plan.meta.status), `an in-progress plan with a worktree — run: witness start ${planId}`)]);
43
+ // Row 239. A command a want or a check detail names is an act's line, here and below.
44
+ return refuse([v('plan', 'not-started', String(plan.meta.status), `an in-progress plan with a worktree — run: ${cliAct('start', planId).line}`)]);
43
45
  }
44
46
  const parent = findById(canon, String(plan.meta.parent));
45
47
  if (!parent) {
@@ -71,7 +73,7 @@ registerGate({
71
73
  checks.push({ name: 'implement-gate', ok: implementSettled,
72
74
  detail: lastImplement
73
75
  ? `last implement round ${lastImplement.round}: ${lastImplement.outcome}`
74
- : 'implement gate never ran — witness gate implement ' + planId });
76
+ : `implement gate never ran — ${cliAct('gate', 'implement', planId).line}` });
75
77
  checks.push(await commandLane(wt, root, ctx, 'tests', cfg.ship.test));
76
78
  checks.push(await commandLane(wt, root, ctx, 'lint', cfg.ship.lint));
77
79
  // deterministic drift lane: spec content from MAIN, execution in the worktree