@popovych.co/witness 0.30.0 → 0.31.1

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 (83) hide show
  1. package/README.md +13 -2
  2. package/dist/carry.js +4 -8
  3. package/dist/change-set.d.ts +9 -0
  4. package/dist/change-set.js +135 -0
  5. package/dist/cli.js +2 -2
  6. package/dist/content-sha.js +5 -1
  7. package/dist/criteria.d.ts +9 -0
  8. package/dist/criteria.js +13 -0
  9. package/dist/drafts.js +5 -1
  10. package/dist/drift.js +3 -0
  11. package/dist/drive-report.js +3 -0
  12. package/dist/evidence.d.ts +4 -3
  13. package/dist/evidence.js +132 -306
  14. package/dist/gate.d.ts +2 -0
  15. package/dist/gate.js +8 -0
  16. package/dist/gates/decompose.js +38 -26
  17. package/dist/gates/design.js +10 -6
  18. package/dist/gates/implement.js +44 -33
  19. package/dist/gates/plan.js +20 -16
  20. package/dist/gates/ship.js +77 -36
  21. package/dist/gitio.d.ts +2 -0
  22. package/dist/gitio.js +14 -2
  23. package/dist/harness.d.ts +1 -0
  24. package/dist/harness.js +6 -3
  25. package/dist/held.d.ts +41 -0
  26. package/dist/held.js +411 -0
  27. package/dist/install.d.ts +9 -2
  28. package/dist/install.js +152 -11
  29. package/dist/journal.d.ts +11 -1
  30. package/dist/journal.js +11 -0
  31. package/dist/json-format.d.ts +7 -0
  32. package/dist/json-format.js +49 -0
  33. package/dist/junit.d.ts +10 -0
  34. package/dist/junit.js +16 -0
  35. package/dist/lint-config.d.ts +17 -0
  36. package/dist/lint-config.js +239 -0
  37. package/dist/merge-clock.d.ts +7 -0
  38. package/dist/merge-clock.js +27 -0
  39. package/dist/models.d.ts +1 -0
  40. package/dist/models.js +2 -0
  41. package/dist/progress.js +2 -0
  42. package/dist/record.d.ts +51 -0
  43. package/dist/record.js +176 -0
  44. package/dist/retired-payload.d.ts +1 -0
  45. package/dist/retired-payload.js +98 -0
  46. package/dist/reviewed.js +6 -5
  47. package/dist/rounds.d.ts +4 -0
  48. package/dist/rounds.js +6 -0
  49. package/dist/runner.d.ts +8 -0
  50. package/dist/runner.js +30 -6
  51. package/dist/scratch.d.ts +1 -0
  52. package/dist/scratch.js +16 -0
  53. package/dist/ship.d.ts +5 -0
  54. package/dist/ship.js +26 -4
  55. package/dist/snapshot.js +16 -16
  56. package/dist/stamp.js +5 -2
  57. package/dist/verbs/check.js +32 -1
  58. package/dist/verbs/dashboard.d.ts +1 -1
  59. package/dist/verbs/dashboard.js +11 -1
  60. package/dist/verbs/diff.js +7 -6
  61. package/dist/verbs/draft.js +6 -2
  62. package/dist/verbs/evidence.js +11 -1
  63. package/dist/verbs/init.js +29 -3
  64. package/dist/verbs/log.js +1 -0
  65. package/dist/verbs/migrate.js +4 -8
  66. package/dist/verbs/next.js +18 -2
  67. package/dist/verbs/recap.d.ts +2 -0
  68. package/dist/verbs/recap.js +151 -5
  69. package/dist/verbs/recover.js +68 -3
  70. package/dist/verbs/start.js +11 -0
  71. package/dist/verbs/turn.js +5 -0
  72. package/dist/worktree.d.ts +1 -0
  73. package/dist/worktree.js +54 -16
  74. package/package.json +1 -1
  75. package/plugin/.claude-plugin/plugin.json +1 -1
  76. package/plugin/commands/witness.md +1 -1
  77. package/plugin/hooks/session-dashboard.sh +1 -1
  78. package/plugin/skills/witness-brainstorm/SKILL.md +7 -3
  79. package/plugin/skills/witness-decompose/SKILL.md +1 -1
  80. package/plugin/skills/witness-design/SKILL.md +1 -1
  81. package/plugin/skills/witness-implement/SKILL.md +5 -3
  82. package/plugin/skills/witness-plan/SKILL.md +1 -1
  83. package/plugin/skills/witness-ship/SKILL.md +1 -1
package/README.md CHANGED
@@ -149,6 +149,16 @@ with `cli-behind-state` rather than answering from rules the repository has move
149
149
  release, say — lower it first with `witness floor --set <version> --note <why>`; the
150
150
  decision is journaled, and `floor` is the one verb that still runs under a bound it fails.
151
151
 
152
+ From **0.30.1** witness's Claude Code hooks live in `.witness/hooks/`, which a repo's lint
153
+ usually skips. `init --agent claude-code` moves them from `.claude/hooks/` at the root,
154
+ rewires `.claude/settings.json` and writes it in your formatter's default style; your own
155
+ hooks in `.claude/hooks/` stay where they are. The settings file is rewritten and committed
156
+ once, so commit your own edits to it first. Restart any open Claude Code session in the
157
+ repo (a session keeps the hooks it started with) and push the init commit (new worktrees
158
+ and `witness ship` read the remote). A worktree started earlier keeps its old hooks until
159
+ `witness ship` carries it onto the moved base. `witness check` warns `payload-linted` when
160
+ your Biome config would still check witness's files.
161
+
152
162
  ### Support tiers
153
163
 
154
164
  | Tier | Agents | What they get |
@@ -294,7 +304,8 @@ the wrong file refuses. There are no `WITNESS_*` env vars for configuration.
294
304
  | verb | does |
295
305
  | --- | --- |
296
306
  | `init [--agent claude-code\|pi\|auto]` | scaffold config, principles, journal — one trailer commit; `--agent` also installs that harness's engine, guard and dashboard (idempotent) |
297
- | `recap [--amend] --file <json>` | validate + persist a scope recap — class, goals, non-goals, constraints and numbered decisions; births the effort journal |
307
+ | `recap [--amend] --file <json>` | validate + persist a scope recap — class, goals, non-goals, constraints and numbered decisions; births the effort journal; a fix adds `"cause": "escape"` or `"cause": "decision"` |
308
+ | `recap --effort <slug> --cause escape\|decision` | the human names the cause of a fix that predates causes, in their own chat or terminal (refused in a witness-spawned session); `status` lists those fixes under `cause-owed` |
298
309
  | `draft <key> [--file <json>]` | a grill's or design session's local draft — saved after every settled answer, read back to resume; never committed or journaled |
299
310
  | `write <id> --effort <e> --meta <json> --body <md>` | validated manifest → spec/plan on disk + journal entry; a spec's `covers` and `carries` map it to the recap's goals and decisions |
300
311
  | `diff <spec-id>` | delta since the last realized state (plan pin → empty), and the decisions that moved since that plan |
@@ -324,7 +335,7 @@ the wrong file refuses. There are no `WITNESS_*` env vars for configuration.
324
335
  | `clean` | reap stale worktrees |
325
336
  | `sync` | pull --rebase + push state commits |
326
337
  | `recover [--complete\|--rollback]` | resolve a crashed write transaction |
327
- | `status` | orientation: flows, blocked docs, reconcile rows, pending gates |
338
+ | `status [--record]` | orientation: flows, blocked docs, reconcile rows, pending gates and the track record's line; `--record` prints the track record in full |
328
339
  | *(no verb)* | the same screen as `status` |
329
340
 
330
341
  ## Exit codes
package/dist/carry.js CHANGED
@@ -1,8 +1,8 @@
1
- import { existsSync, mkdtempSync, readFileSync, rmSync } from 'node:fs';
2
- import { tmpdir } from 'node:os';
1
+ import { existsSync, readFileSync } from 'node:fs';
3
2
  import { join, resolve } from 'node:path';
4
3
  import { cliAct } from './act.js';
5
4
  import { ok, refuse, v } from './refusal.js';
5
+ import { withScratch } from './scratch.js';
6
6
  import { spawnSync } from './spawn.js';
7
7
  import { logSafe, shellLine, shellWord, withheldOn } from './toon.js';
8
8
  import { branchName } from './worktree.js';
@@ -355,8 +355,7 @@ export function freshStop(wt) {
355
355
  // the last try wrote and reuses it, never writing an identical one (the final review's M6).
356
356
  export function keepStopped(wt, planId, files) {
357
357
  const pending = (step, out) => refuse([carryPending(planId, `${step} failed, so witness's own stopped rebase was not aborted: ${gitWords(out)}`)]);
358
- const dir = mkdtempSync(join(tmpdir(), 'witness-kept-'));
359
- try {
358
+ return withScratch('witness-kept-', (dir) => {
360
359
  const scratch = { GIT_INDEX_FILE: join(dir, 'index') };
361
360
  const seeded = carryGitWith(wt, scratch, 'read-tree', 'HEAD');
362
361
  if (seeded.code !== 0)
@@ -385,10 +384,7 @@ export function keepStopped(wt, planId, files) {
385
384
  if (created.code !== 0)
386
385
  return pending(`creating ${kept}`, created.stderr);
387
386
  return ok(kept);
388
- }
389
- finally {
390
- rmSync(dir, { recursive: true, force: true });
391
- }
387
+ });
392
388
  }
393
389
  // M6. A kept ref under the plan's prefix that already holds this backup: the same tree, the stop's
394
390
  // HEAD as its one parent, and the same files listed. Anything git cannot answer is no match.
@@ -0,0 +1,9 @@
1
+ import { type Stats } from 'node:fs';
2
+ export declare function witnessPaths(): readonly string[];
3
+ export declare function foreignRetired(root: string, rev: string): string[];
4
+ export declare function witnessExcludes(keep?: readonly string[]): string[];
5
+ export declare function planChangeSet(runRoot: string, base: string): string[];
6
+ export declare function lstatListed(abs: string): Stats | undefined;
7
+ export declare function parentsInTree(root: string, rel: string): boolean;
8
+ export declare function presentInTree(root: string, rel: string): boolean;
9
+ export declare function removeListed(root: string, rel: string): void;
@@ -0,0 +1,135 @@
1
+ import { lstatSync, rmSync } from 'node:fs';
2
+ import { join } from 'node:path';
3
+ import { git } from './gitio.js';
4
+ import { HARNESSES, loadHarness } from './harness.js';
5
+ import { RETIRED_BLOBS } from './retired-payload.js';
6
+ // Row 246 (#93). The plan change set: what a plan changed, which is the diff against its base minus
7
+ // witness's own files. `init --agent` commits each harness's payload into every home, a started
8
+ // plan's worktree included, so a consumer's in-flight plan carried witness's hooks and commands in
9
+ // its diff — reviewers anchored findings and coverage on them, and the reviewed identity moved with
10
+ // every witness upgrade. Every reader of the diff asks here: the reviewed identity, the reviewer
11
+ // prompt's file list and diff, the coverage pool, the snapshot and the delta, evidence's tags and
12
+ // regression specs, verify-red's held set and `next`.
13
+ //
14
+ // Witness-owned is the union of every harness's payload targets, whichever harness is installed: a
15
+ // repo that ran pi's init once still carries pi's files after it moved to claude-code.
16
+ // `.claude/settings.json` is shared with the user's own settings, so it stays a plan change.
17
+ export function witnessPaths() {
18
+ return [...new Set([...payloadPaths('current'), ...payloadPaths('retired')])].sort();
19
+ }
20
+ // Every harness's current payload targets, or its retired ones (row 250, #95).
21
+ function payloadPaths(kind) {
22
+ const paths = new Set();
23
+ for (const name of HARNESSES) {
24
+ const harness = loadHarness(name);
25
+ if (!harness.ok)
26
+ continue;
27
+ if (kind === 'current')
28
+ for (const { to } of harness.value.payload)
29
+ paths.add(to);
30
+ else
31
+ for (const to of harness.value.retired)
32
+ paths.add(to);
33
+ }
34
+ return paths;
35
+ }
36
+ // Row 250 (#95, final review). A retired target stays witness-owned while plan branches still carry
37
+ // it — but only while it holds bytes witness wrote there (RETIRED_BLOBS). Any other bytes at that path
38
+ // are a plan's: an edit the reviewers must see, since nothing else in witness ever looks at a retired
39
+ // file again. A path gone from the tree is witness's either way: its removal is the retirement.
40
+ function retiredIsWitness(rel, blob) {
41
+ return blob === undefined || (RETIRED_BLOBS[rel]?.has(blob) ?? false);
42
+ }
43
+ // The git blob a retired path holds on disk in `runRoot`: undefined when absent, '' when it is not a
44
+ // regular file (a link or a directory there is never witness's).
45
+ function diskBlob(runRoot, rel) {
46
+ if (!parentsInTree(runRoot, rel))
47
+ return '';
48
+ const st = lstatListed(join(runRoot, rel));
49
+ if (st === undefined)
50
+ return undefined;
51
+ return st.isFile() ? git(runRoot, 'hash-object', '--', rel) : '';
52
+ }
53
+ // The retired paths a tree or commit holds with bytes witness never wrote there (row 250, final
54
+ // review): what a delta between two snapshots must still show.
55
+ export function foreignRetired(root, rev) {
56
+ const retired = payloadPaths('retired');
57
+ const found = [];
58
+ if (retired.size === 0)
59
+ return found;
60
+ for (const record of git(root, 'ls-tree', '-r', '-z', '--full-tree', rev, '--', ...retired).split('\0')) {
61
+ const m = /^(\d+) \w+ ([0-9a-f]+)\t([^]*)$/.exec(record);
62
+ if (m === null || !retired.has(m[3]))
63
+ continue;
64
+ const regular = m[1] === '100644' || m[1] === '100755';
65
+ if (!regular || !retiredIsWitness(m[3], m[2]))
66
+ found.push(m[3]);
67
+ }
68
+ return found.sort();
69
+ }
70
+ // One exclude pathspec per witness path, for git commands that take pathspecs. `top` anchors it at
71
+ // the repository root from any cwd, and `literal` keeps a name's `*`, `?` or `[` from matching
72
+ // anything else. A path in `keep` is not excluded: a retired path holding a plan's bytes (row 250).
73
+ export function witnessExcludes(keep = []) {
74
+ const kept = new Set(keep);
75
+ return witnessPaths().filter((p) => !kept.has(p)).map((p) => `:(top,literal,exclude)${p}`);
76
+ }
77
+ // `-z` on both: with core.quotePath on (git's default), a non-ASCII or special path is printed
78
+ // quoted, and a quoted name is no path — the edit was invisible to the reviewed identity, the
79
+ // snapshot and the delta view alike.
80
+ function changedFiles(runRoot, base) {
81
+ // Row 248. git follows `diff.renames` by default, so a moved file listed only its new path: the
82
+ // old one fell out of verify-red's red tree, the snapshot and the reviewed identity.
83
+ const tracked = git(runRoot, 'diff', '--no-renames', '--name-only', '-z', base).split('\0').filter(Boolean);
84
+ const untracked = git(runRoot, 'ls-files', '--others', '--exclude-standard', '-z').split('\0').filter(Boolean);
85
+ return [...new Set([...tracked, ...untracked])].sort();
86
+ }
87
+ export function planChangeSet(runRoot, base) {
88
+ const current = payloadPaths('current');
89
+ const retired = payloadPaths('retired');
90
+ return changedFiles(runRoot, base)
91
+ .filter((rel) => !current.has(rel) && !(retired.has(rel) && retiredIsWitness(rel, diskBlob(runRoot, rel))));
92
+ }
93
+ // Row 248 (slice 1 review). A listed path's entry on disk, or undefined when there is none. With both
94
+ // paths of a rename listed, a rename between a file and a directory of one name lists a path under
95
+ // what is now a file: lstat says ENOTDIR there, which `throwIfNoEntry` does not cover, and the path
96
+ // is just as absent. Every reader that stats a listed path asks here.
97
+ export function lstatListed(abs) {
98
+ try {
99
+ return lstatSync(abs, { throwIfNoEntry: false });
100
+ }
101
+ catch (e) {
102
+ if (e.code === 'ENOTDIR')
103
+ return undefined;
104
+ throw e;
105
+ }
106
+ }
107
+ // Row 250 (security review). Whether every parent of `rel` under `root` is a real directory, or
108
+ // absent: none is a symlink. A branch can commit `.claude/hooks` as a link to anywhere, and a removal
109
+ // through it would delete a file outside the tree.
110
+ export function parentsInTree(root, rel) {
111
+ let at = root;
112
+ for (const part of rel.split('/').slice(0, -1)) {
113
+ at = join(at, part);
114
+ const st = lstatListed(at);
115
+ if (st === undefined || !st.isDirectory())
116
+ return st === undefined || !st.isSymbolicLink();
117
+ }
118
+ return true;
119
+ }
120
+ // Whether `rel` is on disk inside the tree: an entry of its own (a link counts as itself), reached
121
+ // through no linked parent.
122
+ export function presentInTree(root, rel) {
123
+ return parentsInTree(root, rel) && lstatListed(join(root, rel)) !== undefined;
124
+ }
125
+ // A listed path taken off the disk. One under what is now a file is already gone, and one that is
126
+ // now a directory holds the other path of the same rename: neither is a file to remove. One reached
127
+ // through a linked parent is outside the tree, and stays.
128
+ export function removeListed(root, rel) {
129
+ if (!parentsInTree(root, rel))
130
+ return;
131
+ const abs = join(root, rel);
132
+ const st = lstatListed(abs);
133
+ if (st !== undefined && !st.isDirectory())
134
+ rmSync(abs, { force: true });
135
+ }
package/dist/cli.js CHANGED
@@ -87,7 +87,7 @@ const VERB_USAGE = {
87
87
  log: 'witness log <stream> [--all] [--lineage]',
88
88
  next: 'witness next',
89
89
  read: 'witness read <id> [--design] [--outline] [--lines <a>-<b>] [--decisions]',
90
- recap: 'witness recap --file <recap.json> [--ask <id>] [--amend]',
90
+ recap: 'witness recap --file <recap.json> [--ask <id>] [--amend] · witness recap --effort <slug> --cause escape|decision',
91
91
  recover: 'witness recover [--complete | --rollback]',
92
92
  rename: 'witness rename <old-id> <new-id>',
93
93
  retry: 'witness retry <target>',
@@ -96,7 +96,7 @@ const VERB_USAGE = {
96
96
  dismiss: 'witness dismiss <artifact> --deferral <id|index> --cause <superseded|lens-retired|judged-wrong> --note "<why>"',
97
97
  ship: 'witness ship <plan-id> [--manual]',
98
98
  start: 'witness start <plan-id>',
99
- status: 'witness status — flows · blocked docs · reconcile rows · pending gates (bare `witness` is the same screen)',
99
+ status: 'witness status [--record] — flows · blocked docs · reconcile rows · pending gates (bare `witness` is the same screen) · --record: the track record in full',
100
100
  'step-close': 'witness step-close <plan-id> --step <id>',
101
101
  sync: 'witness sync',
102
102
  trust: "witness trust [<artifact-id>] [--cmd '<exact command>']… [--yes]",
@@ -2,6 +2,7 @@ import { existsSync } from 'node:fs';
2
2
  import { planDecisionsTerm } from './basis.js';
3
3
  import { designCurrentSha } from './design.js';
4
4
  import { diffBase } from './evidence.js';
5
+ import { heldIn } from './held.js';
5
6
  import { diffReviewedSha, effortReviewedSha, implementReviewedSha, planPairSha } from './reviewed.js';
6
7
  import { findById } from './scan.js';
7
8
  import { worktreePath } from './worktree.js';
@@ -10,7 +11,8 @@ import { worktreePath } from './worktree.js';
10
11
  // against it. One definition for both readers: the gate registry's `currentSha` (gate.ts) and
11
12
  // `next`'s parked rows (row 244, S2-5), which cannot import the registry, since gate.ts imports
12
13
  // next.ts. `undefined` means the sha CANNOT be computed (no worktree, a missing parent, no config
13
- // for a gate that needs one) and must never read as "moved".
14
+ // for a gate that needs one) and must never read as "moved". Row 247: a plan whose worktree holds a
15
+ // crashed verify-red's set-aside state has no sha — the plan's content is in the held ref, not the tree.
14
16
  export function contentSha(root, canon, cfg, gate, target) {
15
17
  switch (gate) {
16
18
  case 'decompose':
@@ -32,6 +34,8 @@ export function contentSha(root, canon, cfg, gate, target) {
32
34
  const plan = findById(canon, target);
33
35
  if (cfg === undefined || !existsSync(wt) || (gate === 'implement' && !plan))
34
36
  return undefined;
37
+ if (heldIn(root, target, wt))
38
+ return undefined;
35
39
  const baseR = diffBase(wt, cfg);
36
40
  // An unresolvable base must not un-settle a gate or invert a screen's staleness.
37
41
  if (!baseR.ok)
@@ -19,7 +19,16 @@ export interface CriteriaResult {
19
19
  mode: 'filtered' | 'full-suite';
20
20
  tagCount: number;
21
21
  criteria: CriterionOutcome[];
22
+ outcomes?: TestcaseOutcomes;
22
23
  }
24
+ export interface TestcaseOutcomes {
25
+ passed: number;
26
+ skipped: number;
27
+ failed: number;
28
+ failing: string[];
29
+ }
30
+ export declare const FAILING_CAP = 50;
31
+ export declare function outcomesOf(tests: readonly TestOutcome[], specId: string): TestcaseOutcomes;
23
32
  export declare function runCriteria(runRoot: string, ctx: Ctx, doc: CanonDoc, opts?: {
24
33
  trustRoot?: string;
25
34
  suite?: TestOutcome[];
package/dist/criteria.js CHANGED
@@ -10,6 +10,17 @@ export function criterionMark(c) {
10
10
  return `held by ${c.held.join(' · ')}`;
11
11
  return c.ok ? 'ok' : 'fail';
12
12
  }
13
+ export const FAILING_CAP = 50;
14
+ export function outcomesOf(tests, specId) {
15
+ const mine = tests.filter((t) => matchesTag(t.name, specId));
16
+ const failed = mine.filter((t) => t.status === 'failed').map((t) => t.name);
17
+ return {
18
+ passed: mine.filter((t) => t.status === 'passed').length,
19
+ skipped: mine.filter((t) => t.status === 'skipped').length,
20
+ failed: failed.length,
21
+ failing: [...new Set(failed)].sort().slice(0, FAILING_CAP),
22
+ };
23
+ }
13
24
  export async function runCriteria(runRoot, ctx, doc, opts = {}) {
14
25
  const trustRoot = opts.trustRoot ?? runRoot;
15
26
  // D154 root unification. The trust list and the runner config are two halves of one
@@ -115,6 +126,8 @@ export async function runCriteria(runRoot, ctx, doc, opts = {}) {
115
126
  mode: rc.mode,
116
127
  tagCount,
117
128
  criteria,
129
+ // every test criterion matches the spec's own tag, so one fold per spec
130
+ ...(rc.mode === 'full-suite' ? { outcomes: outcomesOf(suite ?? [], id) } : {}),
118
131
  });
119
132
  }
120
133
  // The drift-lane row both code gates journal — one renderer, so implement and ship cannot
package/dist/drafts.js CHANGED
@@ -3,6 +3,7 @@ import { join } from 'node:path';
3
3
  import { cliAct } from './act.js';
4
4
  import { ID_RE } from './dsl.js';
5
5
  import { idTextList } from './idlists.js';
6
+ import { isFixCause } from './journal.js';
6
7
  import { ok, refuse, v } from './refusal.js';
7
8
  import { ensureExcluded } from './worktree.js';
8
9
  // Row 199. A conversation's local draft: the grill's settled answers, or the design session's
@@ -91,7 +92,7 @@ export function draftSessions(root) {
91
92
  }
92
93
  return out;
93
94
  }
94
- const GRILL_FIELDS = ['effort', 'class', 'goals', 'non_goals', 'constraints', 'decisions', 'slices', 'open'];
95
+ const GRILL_FIELDS = ['effort', 'class', 'cause', 'goals', 'non_goals', 'constraints', 'decisions', 'slices', 'open'];
95
96
  const DESIGN_FIELDS = ['direction', 'answers', 'open', 'page'];
96
97
  const ID_LISTS = [['goals', 'g'], ['non_goals', 'n'], ['constraints', 'c'], ['decisions', 'd']];
97
98
  const stringList = (raw, field) => raw === undefined || (Array.isArray(raw) && raw.every((s) => typeof s === 'string' && s.trim() !== ''))
@@ -126,6 +127,9 @@ export function validateDraft(k, raw) {
126
127
  if (raw.class !== undefined && raw.class !== 'feature' && raw.class !== 'fix' && raw.class !== 'chore') {
127
128
  out.push(v('class', 'enum', String(raw.class), 'feature | fix | chore'));
128
129
  }
130
+ // Row 253. A draft may hold a fix's cause before the class settles; only its value is checked here.
131
+ if (raw.cause !== undefined && !isFixCause(raw.cause))
132
+ out.push(v('cause', 'enum', String(raw.cause), 'escape | decision'));
129
133
  for (const [field, prefix] of ID_LISTS)
130
134
  out.push(...idTextList(raw[field], field, prefix, false));
131
135
  out.push(...stringList(raw.slices, 'slices'), ...stringList(raw.open, 'open'));
package/dist/drift.js CHANGED
@@ -26,6 +26,8 @@ export function driftEntry(run, runId) {
26
26
  ok: run.ok,
27
27
  tags: run.tagCount,
28
28
  criteria: run.criteria.map(criterionRecord),
29
+ // Row 251. Full-suite runs only: the spec's testcase outcomes, read by the track record.
30
+ ...(run.outcomes ? { outcomes: run.outcomes } : {}),
29
31
  };
30
32
  }
31
33
  // Row 179: the journaled record of one criterion carries its hold, so a reader of the drift
@@ -164,6 +166,7 @@ export async function deepDrift(root, ctx, canon, specId) {
164
166
  artifact_sha: lane.ok ? lane.value.sha : canonicalSha(doc.meta, doc.body),
165
167
  ok: lane.ok && lane.value.ok, tags: lane.ok ? lane.value.tagCount : 0,
166
168
  criteria: lane.ok ? lane.value.criteria.map(criterionRecord) : [],
169
+ ...(lane.ok && lane.value.outcomes ? { outcomes: lane.value.outcomes } : {}), // row 251
167
170
  deep: true,
168
171
  ...(violations.length === 0 && parsed.ok ? { verdict: parsed.value } : { malformed: violations }),
169
172
  };
@@ -1,7 +1,9 @@
1
1
  import { basename } from 'node:path';
2
2
  import { readStream, streamIds } from './journal.js';
3
3
  import { needsYou, needYouRows, WAIT_KINDS } from './needs-you.js';
4
+ import { record, recordLine } from './record.js';
4
5
  import { loadCanon } from './scan.js';
6
+ import { kv } from './toon.js';
5
7
  export function runStart(root) {
6
8
  return { lines: new Map(streamIds(root).map((s) => [s, readStream(root, s).length])) };
7
9
  }
@@ -45,6 +47,7 @@ export function driveReport(root, ctx, cfg, start, aside, run) {
45
47
  `drive: ${run.stopped !== undefined ? 'stopped' : 'done'} — ${tally}`,
46
48
  ...merged, ...waits, ...parked, ...stuck, ...obligations,
47
49
  `decisions: policy ${counts.policy} · arbiter ${counts.arbiter} · affirmation ${counts.affirmation} · named ${counts.named}`,
50
+ kv('record', recordLine(record(root, canon))), // row 254
48
51
  ...(w > 0 ? ['help: answer the waits above · then /witness or witness drive picks up where this run stopped'] : []),
49
52
  ];
50
53
  return { lines, summary: `witness drive — ${basename(root)} · ${tally}`, merged: m, waiting: w, parked: p, stuck: s };
@@ -8,8 +8,9 @@ export declare function screensDir(runRoot: string, planId: string): string;
8
8
  export interface Capture {
9
9
  name: string;
10
10
  sha: string;
11
+ test?: string;
11
12
  }
12
- export declare function collectCaptures(runRoot: string, planId: string): Capture[];
13
+ export declare function collectCaptures(runRoot: string, planId: string, warn?: (line: string) => void): Capture[];
13
14
  export declare function checkoutRoot(cwd: string): Result<string>;
14
15
  export interface SpecTestRun {
15
16
  runner: 'filtered' | 'full-suite';
@@ -27,15 +28,15 @@ export declare function journalEvidence(stateRoot: string, planId: string, phase
27
28
  vacuous?: boolean;
28
29
  captures?: Capture[];
29
30
  step?: string;
31
+ tree?: string;
30
32
  }): Result<{
31
33
  sha: string;
32
34
  }>;
33
35
  export declare function recordEvidence(runRoot: string, stateRoot: string, ctx: Ctx, planId: string, parentId: string, phase: 'red' | 'green', extra?: {
34
36
  reconstructed?: boolean;
35
37
  step?: string;
36
- }): Promise<Result<SpecTestRun>>;
38
+ }, base?: string): Promise<Result<SpecTestRun>>;
37
39
  export declare function diffBase(runRoot: string, cfg: Config, override?: string): Result<string>;
38
- export declare function changedFiles(runRoot: string, base: string): string[];
39
40
  export declare function verifyRed(runRoot: string, stateRoot: string, ctx: Ctx, planId: string, parentId: string, base: string, step?: string): Promise<Result<{
40
41
  redOk: boolean;
41
42
  greenOk: boolean;