@sabaiway/agent-workflow-kit 23.3.1 → 23.4.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 (54) hide show
  1. package/CHANGELOG.md +33 -0
  2. package/README.md +1 -1
  3. package/SKILL.md +1 -1
  4. package/bridges/antigravity-cli-bridge/SKILL.md +2 -2
  5. package/bridges/antigravity-cli-bridge/bin/agy-review-harness.test.mjs +7 -1
  6. package/bridges/antigravity-cli-bridge/bin/agy-review-honesty.test.mjs +2 -1
  7. package/bridges/antigravity-cli-bridge/bin/agy-review-model-screen.test.mjs +2 -1
  8. package/bridges/antigravity-cli-bridge/bin/agy-review.sh +18 -10
  9. package/bridges/antigravity-cli-bridge/bin/agy-review.test.mjs +50 -50
  10. package/bridges/antigravity-cli-bridge/bin/agy.sh +6 -2
  11. package/bridges/antigravity-cli-bridge/bin/agy.test.mjs +5 -5
  12. package/bridges/antigravity-cli-bridge/capability.json +2 -2
  13. package/bridges/antigravity-cli-bridge/references/models-and-flags.md +1 -1
  14. package/bridges/antigravity-cli-bridge/setup/README.md +1 -1
  15. package/bridges/codex-cli-bridge/SKILL.md +1 -1
  16. package/bridges/codex-cli-bridge/bin/codex-exec-jev.test.mjs +73 -93
  17. package/bridges/codex-cli-bridge/bin/codex-exec.sh +7 -3
  18. package/bridges/codex-cli-bridge/bin/codex-exec.test.mjs +6 -10
  19. package/bridges/codex-cli-bridge/bin/codex-fixtures-harness.test.mjs +77 -0
  20. package/bridges/codex-cli-bridge/bin/codex-fixtures.test.mjs +215 -0
  21. package/bridges/codex-cli-bridge/bin/codex-model-posture.test.mjs +18 -18
  22. package/bridges/codex-cli-bridge/bin/codex-review-honesty.test.mjs +2 -1
  23. package/bridges/codex-cli-bridge/bin/codex-review-jev.test.mjs +13 -13
  24. package/bridges/codex-cli-bridge/bin/codex-review.sh +17 -10
  25. package/bridges/codex-cli-bridge/bin/codex-review.test.mjs +30 -29
  26. package/bridges/codex-cli-bridge/capability.json +1 -1
  27. package/bridges/typesafe-jev-bridge/SKILL.md +19 -12
  28. package/bridges/typesafe-jev-bridge/bin/jev-ask-harness.test.mjs +109 -0
  29. package/bridges/typesafe-jev-bridge/bin/jev-ask.sh +9 -4
  30. package/bridges/typesafe-jev-bridge/bin/jev-ask.test.mjs +108 -104
  31. package/bridges/typesafe-jev-bridge/bin/jev-client.mjs +27 -13
  32. package/bridges/typesafe-jev-bridge/capability.json +11 -1
  33. package/capability.json +1 -1
  34. package/package.json +2 -1
  35. package/references/modes/bridge-settings.md +6 -5
  36. package/references/modes/coverage-check.md +1 -1
  37. package/tools/apply-danger-check.mjs +2 -2
  38. package/tools/bridge-settings-read.mjs +8 -3
  39. package/tools/bridge-settings.mjs +28 -43
  40. package/tools/coverage-check.mjs +9 -8
  41. package/tools/detect-backends.mjs +1 -1
  42. package/tools/distribution-files/retired.mjs +7 -7
  43. package/tools/distribution-files/scripts.mjs +10 -11
  44. package/tools/ensure-ops.mjs +21 -21
  45. package/tools/ensure-specs.mjs +10 -9
  46. package/tools/family-registry.mjs +4 -4
  47. package/tools/git-hooks.mjs +5 -5
  48. package/tools/manifest/schema.md +4 -1
  49. package/tools/manifest/validate.mjs +10 -0
  50. package/tools/node-evidence.mjs +14 -12
  51. package/tools/recommendations.mjs +2 -2
  52. package/tools/review-state-build.mjs +3 -2
  53. package/tools/review-state.mjs +1 -1
  54. package/tools/write-lanes.mjs +2 -2
@@ -24,16 +24,12 @@
24
24
  import { readFileSync, lstatSync } from 'node:fs';
25
25
  import { join } from 'node:path';
26
26
  import { lstatNoFollow, writeContainedFileAtomic, writeProjectFileCreateOnly } from './atomic-write.mjs';
27
- import { DEPLOYED_SCRIPTS } from './node-evidence.mjs';
27
+ import { readDeployedScripts } from './node-evidence.mjs';
28
28
  import { SCRIPT_PRIORS, classifyDeployedScript } from './script-priors.mjs';
29
29
  import { bundledImportsOf, composeFailure, composeOutcome, dependenciesFirst, nodeEvidenceRefusal, probeSeedTarget, tmpNote } from './ensure-ops.mjs';
30
30
  import { fileLine, hookLine } from './distribution-files/index.mjs';
31
31
 
32
32
  const OP = 'specs';
33
- const READER = DEPLOYED_SCRIPTS.filter((e) => e.module === 'spec-schema');
34
- const CHECKER = DEPLOYED_SCRIPTS.filter((e) => e.module === 'docs-size');
35
- const REPORTER = DEPLOYED_SCRIPTS.filter((e) => e.module === 'test-reporter');
36
- const COMMAND = DEPLOYED_SCRIPTS.find((e) => !e.module);
37
33
  const STORE_ROOT_REL = 'docs/ai/specs/index.md';
38
34
  const STORE_ROOT_TEMPLATE = ['references', 'templates', 'specs', 'index.md'];
39
35
  const DATE_PLACEHOLDER = '{{DATE}}';
@@ -47,8 +43,13 @@ const wrongKind = (rel, kind) => composeFailure(OP, 'wrong-node-kind', `${rel}:
47
43
 
48
44
  // The bundled side: the pairs, the reporter, the command and their whole import closure in write order → { files } | { refusal }.
49
45
  const readBundles = (kitRoot, read) => {
46
+ const deployed = readDeployedScripts();
47
+ const reader = deployed.filter((e) => e.module === 'spec-schema');
48
+ const checker = deployed.filter((e) => e.module === 'docs-size');
49
+ const reporter = deployed.filter((e) => e.module === 'test-reporter');
50
+ const command = deployed.find((e) => !e.module);
50
51
  const byPath = new Map();
51
- const queue = [...READER, ...CHECKER, ...REPORTER, COMMAND];
52
+ const queue = [...reader, ...checker, ...reporter, command];
52
53
  for (const entry of queue) {
53
54
  if (byPath.has(entry.path)) continue;
54
55
  let bundle;
@@ -59,12 +60,12 @@ const readBundles = (kitRoot, read) => {
59
60
  }
60
61
  const imports = bundledImportsOf(entry.path, bundle);
61
62
  byPath.set(entry.path, { path: entry.path, rel: entry.deployed, bundle, imports });
62
- queue.push(...DEPLOYED_SCRIPTS.filter((e) => imports.includes(e.path)));
63
+ queue.push(...deployed.filter((e) => imports.includes(e.path)));
63
64
  }
64
65
  const of = (entries) => (path) => entries.some((e) => e.path === path);
65
66
  const group = (keep) => dependenciesFirst([...byPath.values()].filter((f) => keep(f.path)));
66
- const own = [READER, CHECKER, REPORTER].map(of);
67
- return { files: [...group((p) => !own.some((is) => is(p)) && p !== COMMAND.path), ...own.flatMap(group), ...group((p) => p === COMMAND.path)] };
67
+ const own = [reader, checker, reporter].map(of);
68
+ return { files: [...group((p) => !own.some((is) => is(p)) && p !== command.path), ...own.flatMap(group), ...group((p) => p === command.path)] };
68
69
  };
69
70
 
70
71
  // Each folder on the way to a pair file or a file it imports, lstat-ed without following a link → a refusal or null.
@@ -17,7 +17,7 @@
17
17
  // side effects on import (the isDirectRun idiom) — tests import the helpers with nothing run.
18
18
 
19
19
  import { existsSync, statSync, readFileSync, lstatSync } from 'node:fs';
20
- import { join, resolve, dirname } from 'node:path';
20
+ import { join, resolve, dirname, posix } from 'node:path';
21
21
  import { fileURLToPath } from 'node:url';
22
22
  import os from 'node:os';
23
23
  import { resolveDir, detectBackends, findOnPath } from './detect-backends.mjs';
@@ -85,8 +85,8 @@ import { toViewModel } from './view-model.mjs';
85
85
  import { render } from './renderers.mjs';
86
86
  // The feature-spec adoption state (contract: kit/spec-adoption) — read-only leaves, no cycle.
87
87
  import { ADOPTION, readDeclineAck, surveySpecAdoption } from './spec-adoption.mjs';
88
- // The kit's one door to the script family: where a deployment holds the decisions rotator.
89
- import { DEPLOYED_SCRIPTS } from './node-evidence.mjs';
88
+ import { KIT_COMMANDS } from '../references/scripts/run.mjs';
89
+ import { KIT_SCRIPTS_DIR } from './node-evidence.mjs';
90
90
 
91
91
  // ── manifestState values — re-export the EXACT public subset family-registry exported before B1 ─────
92
92
  // (the 7 state constants + DISPLAY_NAMES) so every existing importer (uninstall.mjs, the test suites)
@@ -357,7 +357,7 @@ export const ADR_LAYOUT_PATHS = Object.freeze({
357
357
  // The DEPLOYED rotator is the discriminator: the new-scheme file names the store path, the
358
358
  // pre-migration one does not. Never "has decisions.md, lacks adr/" — that shape false-positives a
359
359
  // tree whose NEW rotator already reds its own gate, and every No-Node project.
360
- rotator: DEPLOYED_SCRIPTS.find(({ path }) => path === 'archives/archive-decisions.mjs').deployed,
360
+ rotator: posix.join(KIT_SCRIPTS_DIR, KIT_COMMANDS['archive-decisions']),
361
361
  storeMarker: 'docs/ai/adr',
362
362
  });
363
363
  const ENOENT = 'ENOENT';
@@ -11,7 +11,7 @@ import { spawnSync } from 'node:child_process';
11
11
  import { dirname, join, resolve } from 'node:path';
12
12
  import { fileURLToPath } from 'node:url';
13
13
  import { writeProjectFileCreateOnly } from './atomic-write.mjs';
14
- import { DEPLOYED_SCRIPTS, INSTALLER_REL, NODE_EVIDENCE_SCRIPTS, SCRIPTS_DIR } from './node-evidence.mjs';
14
+ import { readDeployedScripts, INSTALLER_REL, readNodeEvidenceScripts, SCRIPTS_DIR } from './node-evidence.mjs';
15
15
  import { shellQuoteArg } from './repo-lex.mjs';
16
16
  import { GIT_MAX_BUFFER } from './git-env.mjs';
17
17
  import { KIT_COMMAND_PATH, KIT_COMMANDS } from '../references/scripts/run.mjs';
@@ -21,7 +21,7 @@ import { readLayoutSetup } from './source-size-core.mjs';
21
21
 
22
22
  const TOOLS = dirname(fileURLToPath(import.meta.url));
23
23
  export const SCRIPTS_REL = SCRIPTS_DIR;
24
- export { DEPLOYED_SCRIPTS, INSTALLER_REL };
24
+ export { readDeployedScripts, INSTALLER_REL };
25
25
 
26
26
  const EXIT_OK = 0;
27
27
  const EXIT_INCOMPLETE = 1;
@@ -172,7 +172,7 @@ export const planGitHooks = ({ root, variant, toolsDir = TOOLS, lstat = lstatSyn
172
172
  nodes.set(rel, node);
173
173
  return node;
174
174
  };
175
- for (const rel of enforcing ? DEPLOYED_SCRIPTS.map(({ deployed }) => deployed) : [INSTALLER_REL]) {
175
+ for (const rel of enforcing ? readDeployedScripts().map(({ deployed }) => deployed) : [INSTALLER_REL]) {
176
176
  for (const folder of foldersOf(rel)) if (!nodes.has(folder)) (folders.push(folder), probe(folder, isPlainDir, 'a plain directory'));
177
177
  probe(rel, isFile, 'a regular file');
178
178
  }
@@ -180,8 +180,8 @@ export const planGitHooks = ({ root, variant, toolsDir = TOOLS, lstat = lstatSyn
180
180
  if (variant === 'hook-checks') return planHookChecks({ root, toolsDir, installer, installerNode: nodes.get(INSTALLER_REL), lstat, readFile, deps });
181
181
  // A flat evidence name is no copy path: another node kind there is not evidence, never a refusal.
182
182
  const evidence = (rel) => (nodes.has(rel) ? isFile(nodes.get(rel)) : nodes.get(SCRIPTS_REL) !== null && isFile(nodeAt(join(root, rel), lstat)));
183
- const deployed = enforcing && NODE_EVIDENCE_SCRIPTS.some((name) => evidence(`${SCRIPTS_REL}/${name}`));
184
- const copies = enforcing && !deployed ? DEPLOYED_SCRIPTS.map(({ deployed: rel, bundled }) =>
183
+ const deployed = enforcing && readNodeEvidenceScripts().some((name) => evidence(`${SCRIPTS_REL}/${name}`));
184
+ const copies = enforcing && !deployed ? readDeployedScripts().map(({ deployed: rel, bundled }) =>
185
185
  ({ rel, path: join(root, rel), action: 'created', bytes: readFile(join(toolsDir, '..', bundled)) })) : [];
186
186
  const placed = copies.find(({ rel }) => rel === INSTALLER_REL);
187
187
  if (!placed && !isFile(nodes.get(INSTALLER_REL))) throw refusal(`${installer} is absent — nothing here places the hook installer`);
@@ -79,9 +79,12 @@ this block). Each entry:
79
79
  - `default` (string|null, **required property** — a missing key fails validation) — `null` = no
80
80
  file default, the wrapper built-ins apply (state them in `effect`); a non-null default must
81
81
  itself pass the kind's validation.
82
+ - `offered` (string[], optional; `posture` only) — when present, a non-empty array of distinct
83
+ strings, each passing the posture value rule, that contains the entry's string `default`.
84
+ On another kind, or in any other shape (`null` included), it makes the manifest invalid.
82
85
  - `appliesTo` (string[], required) — the wrapper `cmd` names (from `roles.*.cmd` of THIS
83
86
  manifest) that APPLY the key. Every wrapper still RECOGNIZES the whole family registry (the
84
- union of both bridges' `settings` keys) and skips other wrappers' keys silently.
87
+ union of every bundled bridge's `settings` keys) and skips other wrappers' keys silently.
85
88
  - `effect` (string, required) — what the knob does, incl. built-in defaults and any spend/risk
86
89
  caveat (the credit-rate caveat rides here for the tier knob).
87
90
  - `retired` (string, optional; **>= 20 chars when present**) — the STATED reason a key is kept only
@@ -610,6 +610,16 @@ export const validateManifest = (skillDir, options = {}) => {
610
610
  if (!cmds.has(c)) errors.push(`${at}.appliesTo names "${c}" which is no roles.*.cmd of this manifest`);
611
611
  }
612
612
  }
613
+ if (Object.hasOwn(entry, 'offered')) {
614
+ const offered = entry.offered;
615
+ const validOffered = entry.kind === 'posture' && Array.isArray(offered) && offered.length > 0
616
+ && offered.every((value) => typeof value === 'string' && settingValueValid(entry, value))
617
+ && new Set(offered).size === offered.length
618
+ && typeof entry.default === 'string' && offered.includes(entry.default);
619
+ if (!validOffered) {
620
+ errors.push(`${at}.offered (${JSON.stringify(entry.key)}) must be a non-empty array of unique posture values containing the string default (posture kind only)`);
621
+ }
622
+ }
613
623
  if (!SETTING_KINDS.has(entry.kind)) {
614
624
  errors.push(`${at}.kind must be one of enum|integer|duration|boolean|posture`);
615
625
  return; // the typed checks below are meaningless without a kind
@@ -1,9 +1,10 @@
1
1
  // node-evidence.mjs — does Node PROVABLY run in this project tree? Contract: docs/ai/specs/kit/node-evidence.md.
2
- // Pure over an injectable lstat; no writes, no side effects on import. Dependency-free, Node >= 22.
2
+ // Pure over an injectable lstat; no writes, no reads on import. Dependency-free, Node >= 22.
3
3
 
4
4
  import { lstatSync } from 'node:fs';
5
5
  import { join, posix } from 'node:path';
6
6
  import { readFamily } from '../references/scripts/family.mjs';
7
+ import { KIT_COMMANDS } from '../references/scripts/run.mjs';
7
8
  import { KIT_FOLDER_ROOT } from './source-size-config.mjs';
8
9
 
9
10
  export const NODE_EVIDENCE = Object.freeze({
@@ -17,12 +18,12 @@ export const PACKAGE_JSON_REL = 'package.json';
17
18
  export const SCRIPTS_DIR = 'scripts';
18
19
  export const KIT_SCRIPTS_DIR = KIT_FOLDER_ROOT;
19
20
 
20
- // The kit's one door to the script family: the mirrored manifest's deployed entries, each with its
21
- // manifest path, module and seed flag, its deployed path in the kit folder and its bundled path in this
22
- // kit. A manifest the reader refuses fails this module's import with the reader's message.
23
- export const DEPLOYED_SCRIPTS = Object.freeze(readFamily().filter(({ role }) => role === 'deployed').map(({ path, module, seed }) =>
21
+ export const INSTALLER_REL = posix.join(KIT_SCRIPTS_DIR, KIT_COMMANDS['install-git-hooks']);
22
+
23
+ // The kit's one door to the script family: read at the first call, never at import; refusals escape.
24
+ const familyCache = {};
25
+ export const readDeployedScripts = () => familyCache.deployed ??= Object.freeze(readFamily().filter(({ role }) => role === 'deployed').map(({ path, module, seed }) =>
24
26
  Object.freeze({ path, module, seed, deployed: `${KIT_SCRIPTS_DIR}/${path}`, bundled: `references/scripts/${path}` })));
25
- export const INSTALLER_REL = DEPLOYED_SCRIPTS.find(({ module }) => module === 'git-hooks').deployed;
26
27
 
27
28
  // The nine flat runnable names probed before the kit folder (frozen, so a flat deployment keeps its
28
29
  // evidence), then the deployed manifest paths, sorted — each relative to scripts/.
@@ -38,18 +39,18 @@ const FLAT_SCRIPTS = [
38
39
  'spec-schema.mjs',
39
40
  ];
40
41
  const KIT_UNDER_SCRIPTS = posix.relative(SCRIPTS_DIR, KIT_SCRIPTS_DIR);
41
- export const NODE_EVIDENCE_SCRIPTS = Object.freeze([
42
+ export const readNodeEvidenceScripts = () => familyCache.scripts ??= Object.freeze([
42
43
  ...FLAT_SCRIPTS,
43
- ...DEPLOYED_SCRIPTS.map(({ path }) => path).sort().map((path) => `${KIT_UNDER_SCRIPTS}/${path}`),
44
+ ...readDeployedScripts().map(({ path }) => path).sort().map((path) => `${KIT_UNDER_SCRIPTS}/${path}`),
44
45
  ]);
45
46
 
46
- export const NODE_EVIDENCE_PROBES = Object.freeze([PACKAGE_JSON_REL, ...NODE_EVIDENCE_SCRIPTS.map((name) => `${SCRIPTS_DIR}/${name}`)]);
47
+ export const readNodeEvidenceProbes = () => familyCache.probes ??= Object.freeze([PACKAGE_JSON_REL, ...readNodeEvidenceScripts().map((name) => `${SCRIPTS_DIR}/${name}`)]);
47
48
 
48
49
  const ENOENT = 'ENOENT';
49
50
  const kindOf = (st) => (st.isSymbolicLink() ? 'a symlink' : st.isDirectory() ? 'a directory' : st.isFile() ? 'a regular file' : 'not a regular file');
50
51
 
51
52
  const answer = (state, evidence, wrongKind, extra = {}) =>
52
- Object.freeze({ state, evidence, probed: NODE_EVIDENCE_PROBES, wrongKind: Object.freeze(wrongKind), ...extra });
53
+ Object.freeze({ state, evidence, probed: readNodeEvidenceProbes(), wrongKind: Object.freeze(wrongKind), ...extra });
53
54
 
54
55
  // probeNodeEvidence(cwd, lstat) -> { state, evidence, probed, wrongKind, error? }: the first regular file
55
56
  // among the probes answers; a probe failing with anything but ENOENT answers unreadable at once; a path of
@@ -57,6 +58,7 @@ const answer = (state, evidence, wrongKind, extra = {}) =>
57
58
  // not follow the LEAF but walks THROUGH a symlinked folder, whose files are not this tree's — so scripts/,
58
59
  // the kit folder and each module folder are proven plain, once each, before any script beneath counts.
59
60
  export const probeNodeEvidence = (cwd, lstat = lstatSync) => {
61
+ const probes = readNodeEvidenceProbes();
60
62
  const wrongKind = [];
61
63
  const folders = new Map();
62
64
  const plainFolder = (rel) => {
@@ -79,7 +81,7 @@ export const probeNodeEvidence = (cwd, lstat = lstatSync) => {
79
81
  try {
80
82
  if (probeKind(PACKAGE_JSON_REL, 'file') === 'file') return answer(NODE_EVIDENCE.PACKAGE_JSON, PACKAGE_JSON_REL, wrongKind);
81
83
  if (plainFolder(SCRIPTS_DIR)) {
82
- for (const rel of NODE_EVIDENCE_PROBES.slice(1)) {
84
+ for (const rel of probes.slice(1)) {
83
85
  if (foldersOf(rel).every(plainFolder) && probeKind(rel, 'file') === 'file') return answer(NODE_EVIDENCE.DEPLOYED_SCRIPTS, rel, wrongKind);
84
86
  }
85
87
  }
@@ -93,7 +95,7 @@ export const hasNodeEvidence = (probe) => probe.state === NODE_EVIDENCE.PACKAGE_
93
95
 
94
96
  // The sentence a skip line carries: every probe checked, and what of the wrong kind sat at any of them.
95
97
  export const describeNodeProbes = (probe = null) => {
96
- const probes = `${PACKAGE_JSON_REL} and the kit-seeded ${SCRIPTS_DIR}/ files (${NODE_EVIDENCE_SCRIPTS.join(', ')})`;
98
+ const probes = `${PACKAGE_JSON_REL} and the kit-seeded ${SCRIPTS_DIR}/ files (${readNodeEvidenceScripts().join(', ')})`;
97
99
  const wrong = probe?.wrongKind?.length ? ` — not evidence: ${probe.wrongKind.join('; ')}` : '';
98
100
  return `${probes}${wrong}`;
99
101
  };
@@ -85,7 +85,7 @@ import { nearestExistingDir, worktreesGrantDir, worktreesGrantHoldsHome } from '
85
85
  import { readBundledAgents, writeCheapAgents, EXECUTOR_VEHICLE } from './cheap-agents.mjs';
86
86
  import { ATTRIBUTION_KEY, LEGACY_ATTRIBUTION_KEY, attributionHidesText, effectiveAttribution, readAttributionChoice, wrongTypedKey } from './attribution.mjs';
87
87
  import { planGlobalRemoval } from './hide-footprint.mjs';
88
- import { DEPLOYED_SCRIPTS, INSTALLER_REL, NODE_EVIDENCE, probeNodeEvidence } from './node-evidence.mjs';
88
+ import { readDeployedScripts, INSTALLER_REL, NODE_EVIDENCE, probeNodeEvidence } from './node-evidence.mjs';
89
89
  // The vehicle READINESS comes from the read-only half — the same survey `recipes` and `status` read.
90
90
  import { surveyExecutorVehicle, readExecutorPosture, agentsAccepted, readStamp, readFsDeps, AGENTS_DIR, WORKFLOW_STAMP, EXPECTED_WORKFLOW_VERSION } from './cheap-agents-read.mjs';
91
91
  // The ack store's path, keys, lane registry, fingerprint and guarded reader live in their own leaf
@@ -1064,7 +1064,7 @@ const enforcementOffer = (root, deps) => {
1064
1064
  if (!listings.has(folder)) listings.set(folder, readDir(folder));
1065
1065
  return listings.get(folder).includes(name);
1066
1066
  });
1067
- if (!DEPLOYED_SCRIPTS.every(({ path }) => inBundle(path))) throw new Error(`${bundleRoot}: a runnable enforcement script is missing`);
1067
+ if (!readDeployedScripts().every(({ path }) => inBundle(path))) throw new Error(`${bundleRoot}: a runnable enforcement script is missing`);
1068
1068
  // Evidence none with nothing of the wrong kind already proves the destination clean: every deployed path is a
1069
1069
  // probe, so each is absent and scripts/, the kit folder and each module folder are absent or plain directories.
1070
1070
  if (readHookState(root, deps).state === 'unmanaged') throw new Error(ENFORCEMENT_UNMANAGED_HOOK);
@@ -6,7 +6,7 @@ import { spawnSync } from 'node:child_process';
6
6
  import { detectBackends } from './detect-backends.mjs';
7
7
  import { resolveActivityRecipe, DISPLAY_ALIASES, requiredBackendsForConfiguredRecipe, composeReadiness } from './recipes.mjs';
8
8
  import { loadConfig } from './orchestration-config.mjs';
9
- import { plansInFlight } from './plan-files.mjs';
9
+ import { plansInFlight, readPlanEntries } from './plan-files.mjs';
10
10
  import { GIT_MAX_BUFFER, resolveGitLocation, stripGitLocationEnv, withGitPath } from './git-env.mjs';
11
11
  import {
12
12
  computeTreeFingerprint,
@@ -86,7 +86,8 @@ export const buildState = ({ cwd, env = process.env, detect = detectBackends, su
86
86
  const resolved = resolveActivityRecipe({ config: config ?? {}, readiness: detection, activity: ACTIVITY, slot: SLOT });
87
87
  const obligations = requiredBackendsForConfiguredRecipe({ config: config ?? {}, readiness: detection, detectionFailed: detectionWarning != null });
88
88
  const requiredBackends = obligations.backends;
89
- const plans = plansInFlight(root);
89
+ const entries = readPlanEntries(root);
90
+ const plans = plansInFlight(root, () => entries);
90
91
  // The injected lstat threads through EVERY stat-dependent computation (fingerprint, clean, the
91
92
  // mask count) — a partial injection would let a test observe an inconsistent state.
92
93
  const fingerprint = location.state === 'work-tree' ? computeTreeFingerprint(cwd, { lstat, env }) : null;
@@ -174,7 +174,7 @@ Sandbox-safe: runs fully inside an OS sandbox (fs + git reads, no network) — t
174
174
  Human residual: git commit --no-verify and receipt-file deletion remain possible — this is a
175
175
  self-discipline mechanism, not a security boundary.
176
176
 
177
- Exit codes: 0 pass (or plain report); 1 check failed or config error (loud); 2 usage.`;
177
+ Exit codes: 0 pass (or plain report); 1 check failed, config error or unreadable docs/plans (loud); 2 usage.`;
178
178
 
179
179
  const KNOWN_ARGS = new Set(['--help', '-h', '--check', '--json']);
180
180
 
@@ -2,7 +2,7 @@ import { join, resolve } from 'node:path';
2
2
  import { dirCovers } from './declared-paths.mjs';
3
3
  import { claudeDirOf, quoteArg, skillTargets } from './jev-facts.mjs';
4
4
  import { targetsFor } from './jev-connect.mjs';
5
- import { DEPLOYED_SCRIPTS, INSTALLER_REL } from './node-evidence.mjs';
5
+ import { readDeployedScripts, INSTALLER_REL } from './node-evidence.mjs';
6
6
  import { dqUnsafePath } from './checker-claim.mjs';
7
7
  import { isLineUnsafe } from './source-size-refusal.mjs';
8
8
  import { SOURCE_SIZE_GATE_ID } from './source-size-gate-cmd.mjs';
@@ -112,7 +112,7 @@ const getStartupPaths = ({ env, home, platform }) => targetsFor({
112
112
  }).filter(({ path }) => path !== null).map(({ path }) => path);
113
113
 
114
114
  const preCommitOf = (facts) => join(facts.hooksDir ?? join(facts.root, '.git', 'hooks'), 'pre-commit');
115
- const getEnforcementPaths = (facts) => [...DEPLOYED_SCRIPTS.map(({ deployed }) => join(facts.root, deployed)), preCommitOf(facts)];
115
+ const getEnforcementPaths = (facts) => [...readDeployedScripts().map(({ deployed }) => join(facts.root, deployed)), preCommitOf(facts)];
116
116
  const getGuardPaths = (facts) => [preCommitOf(facts), join(facts.root, INSTALLER_REL)];
117
117
 
118
118
  const formatCommand = (argv) => argv.map(quoteArg).join(' ');