@sabaiway/agent-workflow-kit 23.4.0 → 23.5.0
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.
- package/CHANGELOG.md +38 -0
- package/SKILL.md +1 -1
- package/capability.json +1 -1
- package/package.json +2 -1
- package/references/modes/coverage-check.md +1 -1
- package/references/scripts/archives/archive-changelog.mjs +110 -113
- package/references/scripts/archives/archive-decisions.mjs +3 -62
- package/references/scripts/archives/archive-issues.mjs +87 -114
- package/references/scripts/archives/rotation-conservation.mjs +45 -0
- package/references/scripts/archives/whole-write.mjs +63 -0
- package/references/scripts/family.json +5 -0
- package/references/scripts/shared/index.mjs +2 -1
- package/references/scripts/shared/markdown-blocks.mjs +4 -1
- package/references/scripts/shared/verdict-block.mjs +123 -0
- package/tools/apply-danger-check.mjs +2 -2
- package/tools/coverage-check.mjs +9 -8
- package/tools/distribution-files/retired.mjs +7 -7
- package/tools/distribution-files/scripts.mjs +10 -11
- package/tools/ensure-ops.mjs +21 -21
- package/tools/ensure-specs.mjs +10 -9
- package/tools/family-registry.mjs +4 -4
- package/tools/git-hooks.mjs +5 -5
- package/tools/node-evidence.mjs +14 -12
- package/tools/recommendations.mjs +2 -2
- package/tools/review-state-build.mjs +3 -2
- package/tools/review-state.mjs +1 -1
- package/tools/script-priors.mjs +1 -0
- package/tools/write-lanes.mjs +2 -2
package/tools/coverage-check.mjs
CHANGED
|
@@ -73,11 +73,12 @@ const checkCoverage = ({ rootTop, lcovPath }) => {
|
|
|
73
73
|
let st = null;
|
|
74
74
|
try {
|
|
75
75
|
st = lstatSync(lcovPath);
|
|
76
|
-
} catch {
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
} catch (error) {
|
|
77
|
+
if (error?.code === 'ENOENT') {
|
|
78
|
+
return { failures, notes: [`skipped-no-lcov: no lcov file at ${lcovPath} — NO coverage check ran (produce it via the declared unit-tests gate cmd's lcov reporters)`], skipped: true, lcovSha256: null };
|
|
79
|
+
}
|
|
80
|
+
failures.push(`${lcovPath}: status could not be read (${error?.code ?? 'fs error'})`);
|
|
81
|
+
return { failures, notes, skipped: false, lcovSha256: null };
|
|
81
82
|
}
|
|
82
83
|
if (!st.isFile()) {
|
|
83
84
|
failures.push(`${lcovPath}: not a regular file (a symlink/device is never read — fail closed)`);
|
|
@@ -318,9 +319,9 @@ deleted fresh by run-gates --final), lists uncovered CHANGED executable Node lin
|
|
|
318
319
|
lists changed out-of-domain files (the coverage claim is narrowed to Node lines), and VERIFIES
|
|
319
320
|
every current-base red-proof record: bound test present, content hash unchanged, green N/N
|
|
320
321
|
(AW_CORE_EVIDENCE_RERUNS, default 3), pre-fix fingerprint differing from the current tree.
|
|
321
|
-
An absent lcov file is a LOUD skipped-no-lcov (exit 0 — NO coverage check ran, stated)
|
|
322
|
-
symlinked lcov path, an uncovered line, a broken red-proof
|
|
323
|
-
store fails (exit 1).
|
|
322
|
+
An absent lcov file (ENOENT) is a LOUD skipped-no-lcov (exit 0 — NO coverage check ran, stated).
|
|
323
|
+
Any other lcov status failure, a symlinked lcov path, an uncovered line, a broken red-proof
|
|
324
|
+
obligation, or a malformed evidence store fails (exit 1).
|
|
324
325
|
|
|
325
326
|
A coverage VERDICT is issued ONLY inside the run that owns the artifact's lifetime: run-gates
|
|
326
327
|
--final deletes the lcov before any gate spawns and hands this checker an attestation context
|
|
@@ -3,11 +3,11 @@ import { lstatSync, readFileSync, readdirSync, unlinkSync } from 'node:fs';
|
|
|
3
3
|
import { join, posix } from 'node:path';
|
|
4
4
|
import { lstatNoFollow } from '../atomic-write.mjs';
|
|
5
5
|
import { stripGitLocationEnv } from '../git-env.mjs';
|
|
6
|
-
import {
|
|
6
|
+
import { readDeployedScripts, KIT_SCRIPTS_DIR, SCRIPTS_DIR } from '../node-evidence.mjs';
|
|
7
7
|
import { PRIOR_FILES, SCRIPT_PRIORS, digestOf } from '../script-priors.mjs';
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
const
|
|
9
|
+
const readDeployedByName = () => new Map(readDeployedScripts().map((entry) => [posix.basename(entry.path), entry]));
|
|
10
|
+
const readCommand = () => readDeployedScripts().find((entry) => !entry.module);
|
|
11
11
|
const normalizeBody = (bytes) => String(bytes).replaceAll('\r\n', '\n');
|
|
12
12
|
const flatPath = (name) => `${SCRIPTS_DIR}/${name}`;
|
|
13
13
|
const isRegular = (cwd, rel, lstat) => lstatNoFollow(join(cwd, rel), lstat)?.isFile() === true;
|
|
@@ -16,7 +16,7 @@ const errorCode = (error) => error.code ?? error.message;
|
|
|
16
16
|
export const isRetiredKitScript = (name, bytes, kitRoot, read = readFileSync) => {
|
|
17
17
|
const digest = digestOf(normalizeBody(bytes));
|
|
18
18
|
if (SCRIPT_PRIORS.some((row) => row.file === name && row.digest === digest)) return true;
|
|
19
|
-
const entry =
|
|
19
|
+
const entry = readDeployedByName().get(name);
|
|
20
20
|
return Boolean(entry && digest === digestOf(normalizeBody(read(join(kitRoot, entry.bundled)))));
|
|
21
21
|
};
|
|
22
22
|
|
|
@@ -56,7 +56,7 @@ export const retireScripts = ({ cwd, kitRoot, dryRun = false, deps = {}, placedS
|
|
|
56
56
|
const lstat = deps.lstat ?? lstatSync;
|
|
57
57
|
const read = deps.readFile ?? readFileSync;
|
|
58
58
|
const standing = (rel) => (dryRun && placedScripts.includes(rel)) || isRegular(cwd, rel, lstat);
|
|
59
|
-
const commandStands = standing(
|
|
59
|
+
const commandStands = standing(readCommand().deployed);
|
|
60
60
|
const classified = new Map();
|
|
61
61
|
const removed = [];
|
|
62
62
|
const lines = [];
|
|
@@ -79,8 +79,8 @@ export const retireScripts = ({ cwd, kitRoot, dryRun = false, deps = {}, placedS
|
|
|
79
79
|
if (owned === null) continue;
|
|
80
80
|
classified.set(name, owned ? 'kit' : 'foreign');
|
|
81
81
|
if (!owned) { lines.push(foreignLine(name)); continue; }
|
|
82
|
-
const replacement =
|
|
83
|
-
const missing = !commandStands ?
|
|
82
|
+
const replacement = readDeployedByName().get(name);
|
|
83
|
+
const missing = !commandStands ? readCommand().deployed : replacement && !standing(replacement.deployed) ? replacement.deployed : null;
|
|
84
84
|
if (missing) { lines.push(keptLine(name, missing, dryRun)); continue; }
|
|
85
85
|
if (!dryRun) {
|
|
86
86
|
try {
|
|
@@ -19,7 +19,7 @@ import { lstatSync, readFileSync } from 'node:fs';
|
|
|
19
19
|
import { join, posix } from 'node:path';
|
|
20
20
|
import { lstatNoFollow, writeContainedFileAtomic, writeProjectFileCreateOnly } from '../atomic-write.mjs';
|
|
21
21
|
import { bundledImportsOf, composeFailure, composeOutcome, dependenciesFirst, nodeEvidenceRefusal, probeSeedTarget, tmpNote } from '../ensure-ops.mjs';
|
|
22
|
-
import {
|
|
22
|
+
import { readDeployedScripts, INSTALLER_REL, KIT_SCRIPTS_DIR, SCRIPTS_DIR } from '../node-evidence.mjs';
|
|
23
23
|
import { SCRIPT_PRIORS, classifyDeployedScript } from '../script-priors.mjs';
|
|
24
24
|
import { VEHICLES_REL } from '../vehicle-settings.mjs';
|
|
25
25
|
import { retireScripts } from './retired.mjs';
|
|
@@ -34,10 +34,6 @@ export const HOOK_CHANNEL = '.claude/hooks/<name>.local.mjs';
|
|
|
34
34
|
const ROTATOR = 'archives/archive-decisions.mjs';
|
|
35
35
|
// The family: every deployed entry outside the specs op's files (its three modules and the command), in manifest order.
|
|
36
36
|
const SPECS_MODULES = ['spec-schema', 'docs-size', 'test-reporter'];
|
|
37
|
-
const FAMILY = DEPLOYED_SCRIPTS.filter((e) => e.module && !SPECS_MODULES.includes(e.module));
|
|
38
|
-
// The manifest paths a run of a component that is not accepted judges: the rotator and what it loads.
|
|
39
|
-
export const SEED_NAMES = Object.freeze(FAMILY.filter((e) => e.seed).map((e) => e.path));
|
|
40
|
-
const FOLDERS = [...new Set([SCRIPTS_DIR, KIT_SCRIPTS_DIR, ...FAMILY.map((e) => posix.dirname(e.deployed))])];
|
|
41
37
|
|
|
42
38
|
const causeOf = (err) => String((err && err.message) || err);
|
|
43
39
|
const kindOfDir = (st) => (st.isSymbolicLink() ? 'a symlink' : st.isFile() ? 'a regular file' : 'not a directory');
|
|
@@ -49,8 +45,9 @@ const wrongKind = (rel, kind) => composeFailure(OP, 'wrong-node-kind', `${rel}:
|
|
|
49
45
|
const inWriteOrder = (files) => [...files.filter((f) => f.rel === INSTALLER_REL), ...dependenciesFirst(files.filter((f) => f.rel !== INSTALLER_REL))];
|
|
50
46
|
|
|
51
47
|
// Each folder on the way, lstat-ed without following a link: → { refusal } | {}.
|
|
52
|
-
const surveyFolders = (cwd, lstat) => {
|
|
53
|
-
|
|
48
|
+
const surveyFolders = (cwd, family, lstat) => {
|
|
49
|
+
const folders = [...new Set([SCRIPTS_DIR, KIT_SCRIPTS_DIR, ...family.map((e) => posix.dirname(e.deployed))])];
|
|
50
|
+
for (const rel of folders) {
|
|
54
51
|
const st = lstatNoFollow(join(cwd, rel), lstat);
|
|
55
52
|
if (st !== null && (!st.isDirectory() || st.isSymbolicLink())) return { refusal: wrongKind(`${rel}/`, kindOfDir(st)) };
|
|
56
53
|
}
|
|
@@ -60,13 +57,15 @@ const surveyFolders = (cwd, lstat) => {
|
|
|
60
57
|
// → { refusal } | { files, accepted }. A family path of another node kind is judged before the
|
|
61
58
|
// component, so a linked family file is never placed over.
|
|
62
59
|
const survey = ({ cwd, kitRoot, deps, read, lstat }) => {
|
|
63
|
-
const
|
|
60
|
+
const family = readDeployedScripts().filter((e) => e.module && !SPECS_MODULES.includes(e.module));
|
|
61
|
+
const seedNames = family.filter((e) => e.seed).map((e) => e.path);
|
|
62
|
+
const folders = surveyFolders(cwd, family, lstat);
|
|
64
63
|
if (folders.refusal) return folders;
|
|
65
|
-
const probes =
|
|
64
|
+
const probes = family.map((e) => ({ path: e.path, rel: e.deployed, bundled: e.bundled, probe: probeSeedTarget(join(cwd, e.deployed), lstat) }));
|
|
66
65
|
const wrong = probes.find((f) => f.probe.wrongKind);
|
|
67
66
|
if (wrong) return { refusal: wrongKind(wrong.rel, wrong.probe.wrongKind) };
|
|
68
67
|
const flatInstaller = probeSeedTarget(join(cwd, SCRIPTS_DIR, posix.basename(INSTALLER_REL)), lstat);
|
|
69
|
-
const accepted = probes.some((f) => f.probe.present && !
|
|
68
|
+
const accepted = probes.some((f) => f.probe.present && !seedNames.includes(f.path)) || (flatInstaller.present && !flatInstaller.wrongKind);
|
|
70
69
|
const byPath = new Map();
|
|
71
70
|
for (const f of probes) {
|
|
72
71
|
try {
|
|
@@ -76,7 +75,7 @@ const survey = ({ cwd, kitRoot, deps, read, lstat }) => {
|
|
|
76
75
|
return { refusal: composeFailure(OP, 'bundle-unreadable', `${f.rel}: the bundled script could not be read, so nothing was written — reinstall the kit. ${causeOf(err)}`) };
|
|
77
76
|
}
|
|
78
77
|
}
|
|
79
|
-
const files = inWriteOrder([...byPath.values()]).filter((f) => accepted ||
|
|
78
|
+
const files = inWriteOrder([...byPath.values()]).filter((f) => accepted || seedNames.includes(f.path)).map(({ path, rel, bundle, probe }) => {
|
|
80
79
|
const bytes = probe.present ? read(join(cwd, rel)) : undefined;
|
|
81
80
|
return { path, rel, bundle, state: probe.present ? classifyDeployedScript(bytes, path, bundle, deps.priors ?? SCRIPT_PRIORS) : 'absent' };
|
|
82
81
|
});
|
package/tools/ensure-ops.mjs
CHANGED
|
@@ -36,7 +36,7 @@ import { GATES_REL } from './gates-declaration.mjs';
|
|
|
36
36
|
import { AUTONOMY_REL } from './autonomy-config.mjs';
|
|
37
37
|
import { VEHICLES_REL } from './vehicle-settings.mjs';
|
|
38
38
|
import { ENSURE_TOKENS, FAILURE_CAUSES } from './ensure-vocabulary.mjs';
|
|
39
|
-
import {
|
|
39
|
+
import { readDeployedScripts, NODE_EVIDENCE, describeNodeProbes, probeNodeEvidence } from './node-evidence.mjs';
|
|
40
40
|
import { classifyDeployedScript } from './script-priors.mjs';
|
|
41
41
|
import { parseFrontmatter } from '../references/scripts/docs-size/index.mjs';
|
|
42
42
|
|
|
@@ -233,7 +233,7 @@ export const nodeEvidenceRefusal = (op, cwd, lstat) => {
|
|
|
233
233
|
const INDEX_REL = 'docs/ai/index.md';
|
|
234
234
|
// The docs checker is the docs-size module's one deployed entry: bundled, it is the generator; deployed,
|
|
235
235
|
// the kept probe. A flat scripts/check-docs-size.mjs is no deployed checker (story S4 reads it).
|
|
236
|
-
const
|
|
236
|
+
const readChecker = () => readDeployedScripts().find(({ module }) => module === 'docs-size');
|
|
237
237
|
const ENSURE_INDEX_OUTCOME = /^ensure-index: (regenerated|already-current)\b/m;
|
|
238
238
|
const ENSURE_INDEX_REFUSAL = /^ensure-index: (write-refused|probe-failed)\b/m;
|
|
239
239
|
// The probe has no machine line, so its two ANSWERS are matched against the canonical sentences it
|
|
@@ -249,21 +249,21 @@ const describeExit = (result) => (result.signal ? `on signal ${result.signal}` :
|
|
|
249
249
|
const bothStreams = (result) => `${String(result.stdout ?? '')}${String(result.stderr ?? '')}`.trim();
|
|
250
250
|
const describeExitWithOutput = (result, subject = 'it') => `${subject} exited ${describeExit(result)}${bothStreams(result) ? `: ${bothStreams(result)}` : ''}`;
|
|
251
251
|
|
|
252
|
-
const
|
|
253
|
-
const
|
|
252
|
+
const describeKeptJudge = () => `the project's own checker (${readChecker().deployed} --check-index)`;
|
|
253
|
+
const describeKeptFits = () => `in sync under ${describeKeptJudge()} and within the maxLines it stamps`;
|
|
254
254
|
const KEPT_ROUTE = "the spec layer's write of the bundled modules the project's hook loads, then this step again";
|
|
255
255
|
const KEPT_PROBE_TIMEOUT_MS = 30_000;
|
|
256
256
|
const countLines = (text) => text.split('\n').length - (text.endsWith('\n') ? 1 : 0);
|
|
257
257
|
const readStampedCap = (text) => { const value = parseFrontmatter(text)?.maxLines; const cap = value ? Number(value) : NaN; return Number.isNaN(cap) ? undefined : cap; };
|
|
258
258
|
|
|
259
|
-
const
|
|
259
|
+
const readDeployedByPath = () => new Map(readDeployedScripts().map((entry) => [entry.path, entry]));
|
|
260
260
|
const RELATIVE_IMPORT = /(?:\bfrom\s*|\bimport\s*\(?\s*)['"](\.{1,2}\/[^'"]+)['"]/g;
|
|
261
261
|
const pathIn = (root, rel) => join(root, ...rel.split('/'));
|
|
262
262
|
|
|
263
263
|
// The one reading of the family's bundled imports, shared by the index, scripts and specs ops: the deployed
|
|
264
264
|
// manifest paths `bundle` (the bytes at manifest path `path`) imports by a relative specifier.
|
|
265
265
|
export const bundledImportsOf = (path, bundle) => [...String(bundle).matchAll(RELATIVE_IMPORT)]
|
|
266
|
-
.map(([, spec]) => posix.join(posix.dirname(path), spec)).filter((dep) =>
|
|
266
|
+
.map(([, spec]) => posix.join(posix.dirname(path), spec)).filter((dep) => readDeployedByPath().has(dep));
|
|
267
267
|
// Each of `files` ({ path, imports }) after every one of them it imports, by manifest path in code-unit order
|
|
268
268
|
// otherwise, so each file a run leaves loads. A cycle is a broken bundle, never a silent order.
|
|
269
269
|
export const dependenciesFirst = (files) => {
|
|
@@ -281,10 +281,10 @@ export const dependenciesFirst = (files) => {
|
|
|
281
281
|
// The modules the project's hook loads, the checker first: the deployed files of the docs-size and
|
|
282
282
|
// spec-schema modules, and the shared files the checker reaches through its bundled relative imports.
|
|
283
283
|
const hookModulesOf = (bundleOf) => {
|
|
284
|
-
const reached = new Set([
|
|
285
|
-
for (const path of reached) for (const dep of bundledImportsOf(path, bundleOf(
|
|
284
|
+
const reached = new Set([readChecker().path]);
|
|
285
|
+
for (const path of reached) for (const dep of bundledImportsOf(path, bundleOf(readDeployedByPath().get(path)).bytes ?? '')) reached.add(dep);
|
|
286
286
|
const loaded = ({ module, path }) => module === 'docs-size' || module === 'spec-schema' || (module === 'shared' && reached.has(path));
|
|
287
|
-
return [
|
|
287
|
+
return [readChecker(), ...readDeployedScripts().filter((entry) => entry !== readChecker() && loaded(entry))];
|
|
288
288
|
};
|
|
289
289
|
|
|
290
290
|
// A regular file where a folder on the way belongs (ENOTDIR) holds no module.
|
|
@@ -293,12 +293,12 @@ const probeHookModule = (cwd, entry, lstat) => { try { return probeSeedTarget(pa
|
|
|
293
293
|
// → one { rel, state } per hook module: absent, wrong-kind, bundle-unreadable or the classifier's word.
|
|
294
294
|
// No deployed checker → that one entry, absent; every kind is probed before any project file is read.
|
|
295
295
|
const surveyHook = (cwd, kitRoot, read, lstat) => {
|
|
296
|
-
const checker = probeHookModule(cwd,
|
|
297
|
-
if (checker.wrongKind || !checker.present) return [{ rel:
|
|
296
|
+
const checker = probeHookModule(cwd, readChecker(), lstat);
|
|
297
|
+
if (checker.wrongKind || !checker.present) return [{ rel: readChecker().deployed, state: checker.wrongKind ? 'wrong-kind' : 'absent', wrongKind: checker.wrongKind }];
|
|
298
298
|
const bundles = new Map();
|
|
299
299
|
const readBundle = (entry) => { try { return { bytes: read(pathIn(kitRoot, entry.bundled)) }; } catch (err) { return { error: causeOf(err) }; } };
|
|
300
300
|
const bundleOf = (entry) => (bundles.has(entry.path) ? bundles : bundles.set(entry.path, readBundle(entry))).get(entry.path);
|
|
301
|
-
const probes = hookModulesOf(bundleOf).map((entry) => ({ entry, rel: entry.deployed, probe: entry ===
|
|
301
|
+
const probes = hookModulesOf(bundleOf).map((entry) => ({ entry, rel: entry.deployed, probe: entry === readChecker() ? checker : probeHookModule(cwd, entry, lstat) }));
|
|
302
302
|
const wrong = probes.find(({ probe }) => probe.wrongKind);
|
|
303
303
|
if (wrong) return [{ rel: wrong.rel, state: 'wrong-kind', wrongKind: wrong.probe.wrongKind }];
|
|
304
304
|
return probes.map(({ entry, rel, probe }) => {
|
|
@@ -310,7 +310,7 @@ const surveyHook = (cwd, kitRoot, read, lstat) => {
|
|
|
310
310
|
};
|
|
311
311
|
|
|
312
312
|
const judgeKept = ({ cwd, spawn, read, lstat, deps }) => {
|
|
313
|
-
const result = spawn(process.execPath, [pathIn(cwd,
|
|
313
|
+
const result = spawn(process.execPath, [pathIn(cwd, readChecker().deployed), '--check-index'], { cwd, encoding: 'utf8', timeout: deps.keptProbeTimeoutMs ?? KEPT_PROBE_TIMEOUT_MS, killSignal: 'SIGKILL' });
|
|
314
314
|
if (result.error) return { error: `${causeOf(result.error)}${result.signal ? `, killed on signal ${result.signal}` : ''}` };
|
|
315
315
|
if (result.status !== 0) return { accepted: false, said: describeExitWithOutput(result), half: 'its index check' };
|
|
316
316
|
const text = lstatNoFollow(join(cwd, INDEX_REL), lstat)?.isFile() ? String(read(join(cwd, INDEX_REL), 'utf8')) : null;
|
|
@@ -340,15 +340,15 @@ const putBackIndex = (cwd, found, deps) => {
|
|
|
340
340
|
|
|
341
341
|
const ensureKeptIndex = ({ cwd, drive, spawn, read, lstat, deps }) => {
|
|
342
342
|
const judge = () => judgeKept({ cwd, spawn, read, lstat, deps });
|
|
343
|
-
const reportUnanswered = (verdict, after) => loud('index', 'index-probe-failed', `${INDEX_REL}: ${
|
|
343
|
+
const reportUnanswered = (verdict, after) => loud('index', 'index-probe-failed', `${INDEX_REL}: ${describeKeptJudge()} could not be launched or did not answer in time (${verdict.error}) — ${after}`);
|
|
344
344
|
const first = judge();
|
|
345
345
|
if (first.error) return reportUnanswered(first, 'nothing was written');
|
|
346
|
-
if (first.accepted) return ok('index', 'already-current', `${INDEX_REL}: ${
|
|
346
|
+
if (first.accepted) return ok('index', 'already-current', `${INDEX_REL}: ${describeKeptFits()} — nothing written`);
|
|
347
347
|
const found = lstatNoFollow(join(cwd, INDEX_REL), lstat) === null ? null : read(join(cwd, INDEX_REL));
|
|
348
348
|
const restored = found === null ? 'the navigator was put back: found absent, it was removed again' : 'the navigator was put back byte for byte';
|
|
349
349
|
const restoreThen = (failure, compose) => {
|
|
350
350
|
const refused = putBackIndex(cwd, found, deps);
|
|
351
|
-
return refused === null ? compose() : loud('index', 'write-refused', `${INDEX_REL}: putting the navigator back failed (${refused})${failure ? ` after ${failure}` : ''} — a navigator ${
|
|
351
|
+
return refused === null ? compose() : loud('index', 'write-refused', `${INDEX_REL}: putting the navigator back failed (${refused})${failure ? ` after ${failure}` : ''} — a navigator ${describeKeptJudge()} rejects may stand; re-read it before re-running`);
|
|
352
352
|
};
|
|
353
353
|
const run = drive('--ensure-index');
|
|
354
354
|
const refusal = String(run.stderr ?? '').match(ENSURE_INDEX_REFUSAL);
|
|
@@ -359,19 +359,19 @@ const ensureKeptIndex = ({ cwd, drive, spawn, read, lstat, deps }) => {
|
|
|
359
359
|
}
|
|
360
360
|
let second;
|
|
361
361
|
try { second = judge(); } catch (err) { return restoreThen(`the navigator could not be read back (${causeOf(err)})`, () => loud('index', 'unexpected-error', `${INDEX_REL}: the navigator could not be read back after the bundled write (${causeOf(err)}) — ${restored}`)); }
|
|
362
|
-
if (second.error) return restoreThen(`${
|
|
363
|
-
if (second.accepted) return ok('index', 'regenerated', `${INDEX_REL}: written by the bundled generator — ${
|
|
364
|
-
return restoreThen(null, () => ok('index', 'customized-preserved', `${INDEX_REL}: ${
|
|
362
|
+
if (second.error) return restoreThen(`${describeKeptJudge()} could not answer (${second.error})`, () => reportUnanswered(second, restored));
|
|
363
|
+
if (second.accepted) return ok('index', 'regenerated', `${INDEX_REL}: written by the bundled generator — ${describeKeptFits()}`);
|
|
364
|
+
return restoreThen(null, () => ok('index', 'customized-preserved', `${INDEX_REL}: ${describeKeptJudge()} rejected the bundled render on ${second.half} (${second.said}), and the navigator as found did not pass it either (${first.half}) — ${restored}. The route: ${KEPT_ROUTE}`));
|
|
365
365
|
};
|
|
366
366
|
|
|
367
367
|
const buildKeptDryRunNote = (hook) =>
|
|
368
|
-
`a module the project's hook loads (${hook.filter((entry) => entry.state !== 'current').map((entry) => entry.rel).join(', ')}) is not the bundled one: unless the spec-layer step of this run first refreshes every such module, the real run judges the navigator by ${
|
|
368
|
+
`a module the project's hook loads (${hook.filter((entry) => entry.state !== 'current').map((entry) => entry.rel).join(', ')}) is not the bundled one: unless the spec-layer step of this run first refreshes every such module, the real run judges the navigator by ${describeKeptJudge()} and puts back a write it rejects`;
|
|
369
369
|
|
|
370
370
|
export const ensureIndex = ({ cwd, kitRoot, dryRun = false, deps = {} }) => {
|
|
371
371
|
const lstat = deps.lstat ?? lstatSync;
|
|
372
372
|
const read = deps.readFile ?? readFileSync;
|
|
373
373
|
const spawn = deps.spawnSync ?? spawnSync;
|
|
374
|
-
const generator = pathIn(kitRoot,
|
|
374
|
+
const generator = pathIn(kitRoot, readChecker().bundled);
|
|
375
375
|
const drive = (mode) => spawn(process.execPath, [generator, mode, `--root=${cwd}`], { encoding: 'utf8' });
|
|
376
376
|
const unlaunchable = (result) =>
|
|
377
377
|
loud('index', 'generator-unlaunchable', `${INDEX_REL}: the bundled generator could not be started, so nothing was probed or written — reinstall the kit. ${causeOf(result.error)}`);
|
package/tools/ensure-specs.mjs
CHANGED
|
@@ -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 {
|
|
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 = [...
|
|
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(...
|
|
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 = [
|
|
67
|
-
return { files: [...group((p) => !own.some((is) => is(p)) && p !==
|
|
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
|
-
|
|
89
|
-
import {
|
|
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:
|
|
360
|
+
rotator: posix.join(KIT_SCRIPTS_DIR, KIT_COMMANDS['archive-decisions']),
|
|
361
361
|
storeMarker: 'docs/ai/adr',
|
|
362
362
|
});
|
|
363
363
|
const ENOENT = 'ENOENT';
|
package/tools/git-hooks.mjs
CHANGED
|
@@ -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 {
|
|
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 {
|
|
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 ?
|
|
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 &&
|
|
184
|
-
const copies = enforcing && !deployed ?
|
|
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`);
|
package/tools/node-evidence.mjs
CHANGED
|
@@ -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
|
|
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
|
-
|
|
21
|
-
|
|
22
|
-
// kit
|
|
23
|
-
|
|
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
|
|
42
|
+
export const readNodeEvidenceScripts = () => familyCache.scripts ??= Object.freeze([
|
|
42
43
|
...FLAT_SCRIPTS,
|
|
43
|
-
...
|
|
44
|
+
...readDeployedScripts().map(({ path }) => path).sort().map((path) => `${KIT_UNDER_SCRIPTS}/${path}`),
|
|
44
45
|
]);
|
|
45
46
|
|
|
46
|
-
export const
|
|
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:
|
|
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
|
|
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 (${
|
|
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 {
|
|
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 (!
|
|
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
|
|
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;
|
package/tools/review-state.mjs
CHANGED
|
@@ -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
|
|
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
|
|
package/tools/script-priors.mjs
CHANGED
|
@@ -88,6 +88,7 @@ export const SCRIPT_PRIORS = Object.freeze([
|
|
|
88
88
|
prior('migrate-gates.mjs', '8.1.5', '9.0.0', 'd9c3f9da27397dd94ad866c3cbac72e529ad2e6311ffa15de7478a960800cdfa'),
|
|
89
89
|
prior('migrate-gates.test.mjs', '8.1.5', '9.0.0', '8f99a2f65f1f3db0eb3464a0382c208ca5076388b6df0596cf099d53ab2a1f86'),
|
|
90
90
|
prior('spec-schema.test.mjs', '8.7.0', '9.0.0', '6a602a93e9f9f21f0bc10c50e356de693936d3e204987efbab1a1d7674030498'),
|
|
91
|
+
prior('markdown-blocks.mjs', '4.0.0', '9.0.0', '5a9fb45d4248c53dee9694b2d95c1cf98fe08a55c41429cf72826aa218f0ad2d'),
|
|
91
92
|
]);
|
|
92
93
|
|
|
93
94
|
export const digestOf = (bytes) => createHash('sha256').update(bytes).digest('hex');
|
package/tools/write-lanes.mjs
CHANGED
|
@@ -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 {
|
|
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) => [...
|
|
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(' ');
|