@holmes-lab/holmes-kit 0.30.0 → 0.31.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 +494 -0
- package/README.md +10 -1
- package/bin/holmes-hook-antigravity.js +4 -0
- package/bin/holmes-kit.js +4 -0
- package/bin/holmes-pre-push.js +3 -0
- package/bin/holmes-stop-antigravity.js +4 -0
- package/dist/.build-id +1 -1
- package/dist/holmes/cli/agents.d.ts +41 -0
- package/dist/holmes/cli/agents.js +382 -2
- package/dist/holmes/cli/attest.d.ts +2 -0
- package/dist/holmes/cli/attest.js +66 -15
- package/dist/holmes/cli/ci-gate.js +16 -1
- package/dist/holmes/cli/claude-switches.d.ts +95 -0
- package/dist/holmes/cli/claude-switches.js +967 -0
- package/dist/holmes/cli/codex-hooks.d.ts +77 -0
- package/dist/holmes/cli/codex-hooks.js +802 -0
- package/dist/holmes/cli/codex-oracle.d.ts +194 -0
- package/dist/holmes/cli/codex-oracle.js +1245 -0
- package/dist/holmes/cli/codex-toml.d.ts +35 -0
- package/dist/holmes/cli/codex-toml.js +321 -52
- package/dist/holmes/cli/doctor.d.ts +98 -8
- package/dist/holmes/cli/doctor.js +1328 -94
- package/dist/holmes/cli/index.js +23 -11
- package/dist/holmes/cli/init.d.ts +11 -0
- package/dist/holmes/cli/init.js +736 -44
- package/dist/holmes/cli/mcp-launcher.d.ts +64 -6
- package/dist/holmes/cli/mcp-launcher.js +189 -6
- package/dist/holmes/cli/mcp-version.js +13 -2
- package/dist/holmes/cli/settings-merge.js +8 -2
- package/dist/holmes/cli/upgrade.d.ts +13 -0
- package/dist/holmes/cli/upgrade.js +116 -23
- package/dist/holmes/cli/workspace-scope.d.ts +22 -0
- package/dist/holmes/cli/workspace-scope.js +375 -0
- package/dist/holmes/cpg/cpg-scanner.d.ts +29 -0
- package/dist/holmes/cpg/cpg-scanner.js +403 -3
- package/dist/holmes/cpg/cycle-detect.js +2 -1
- package/dist/holmes/cpg/forbidden-edges.js +9 -2
- package/dist/holmes/cpg/required-calls.js +8 -1
- package/dist/holmes/governance/constitution-debt.js +3 -2
- package/dist/holmes/governance/constitution.js +15 -3
- package/dist/holmes/governance/provenance-chain.js +3 -2
- package/dist/holmes/governance/push-gate-runner.js +4 -3
- package/dist/holmes/guardrail/dependency-delta.js +4 -3
- package/dist/holmes/guardrail/linear-match.d.ts +57 -0
- package/dist/holmes/guardrail/linear-match.js +256 -0
- package/dist/holmes/guardrail/risk-classifier.d.ts +6 -7
- package/dist/holmes/guardrail/risk-classifier.js +931 -44
- package/dist/holmes/guardrail/risk-types.d.ts +6 -0
- package/dist/holmes/guardrail/scope-judgment.d.ts +4 -24
- package/dist/holmes/guardrail/scope-judgment.js +100 -23
- package/dist/holmes/guardrail/shell-words.d.ts +42 -0
- package/dist/holmes/guardrail/shell-words.js +1720 -0
- package/dist/holmes/guardrail/write-target.d.ts +168 -3
- package/dist/holmes/guardrail/write-target.js +2379 -87
- package/dist/holmes/hooks/adapters/antigravity.d.ts +3 -1
- package/dist/holmes/hooks/adapters/antigravity.js +115 -11
- package/dist/holmes/hooks/pre-tool-use.d.ts +32 -6
- package/dist/holmes/hooks/pre-tool-use.js +923 -87
- package/dist/holmes/hooks/rtm-refresh-child.js +3 -1
- package/dist/holmes/hooks/rtm-refresh.js +8 -4
- package/dist/holmes/hooks/session-start.d.ts +10 -0
- package/dist/holmes/hooks/session-start.js +31 -7
- package/dist/holmes/hooks/stop.d.ts +2 -1
- package/dist/holmes/hooks/stop.js +197 -91
- package/dist/holmes/mcp/approval-commit.d.ts +5 -6
- package/dist/holmes/mcp/approval-commit.js +18 -2
- package/dist/holmes/mcp/elicit-approval.js +4 -2
- package/dist/holmes/mcp/handlers/graph-operations.js +3 -2
- package/dist/holmes/mcp/handlers/maintenance-analysis.js +11 -5
- package/dist/holmes/mcp/handlers/maintenance-evidence.js +3 -2
- package/dist/holmes/mcp/handlers/phase-queries.d.ts +22 -7
- package/dist/holmes/mcp/handlers/phase-queries.js +81 -2
- package/dist/holmes/mcp/handlers/requirement-triage.js +5 -3
- package/dist/holmes/mcp/handlers/review-evidence.js +8 -2
- package/dist/holmes/mcp/handlers/slice-orchestration.d.ts +11 -0
- package/dist/holmes/mcp/handlers/slice-orchestration.js +115 -16
- package/dist/holmes/mcp/handlers/spec-approval.d.ts +9 -0
- package/dist/holmes/mcp/handlers/spec-approval.js +110 -17
- package/dist/holmes/mcp/handlers/spec-authoring.js +17 -2
- package/dist/holmes/mcp/handlers/spec-queries.d.ts +39 -3
- package/dist/holmes/mcp/handlers/spec-queries.js +114 -7
- package/dist/holmes/mcp/handlers/test-execution.js +9 -3
- package/dist/holmes/mcp/handlers.d.ts +81 -9
- package/dist/holmes/mcp/handlers.js +70 -23
- package/dist/holmes/mcp/harness-attestation.d.ts +20 -0
- package/dist/holmes/mcp/harness-attestation.js +179 -0
- package/dist/holmes/mcp/requirement-triage-evidence.d.ts +36 -0
- package/dist/holmes/mcp/requirement-triage-evidence.js +160 -4
- package/dist/holmes/mcp/server.js +20 -1
- package/dist/holmes/mcp/tool-schemas.js +26 -9
- package/dist/holmes/mcp/validate-args.js +12 -0
- package/dist/holmes/project/bounded-io.d.ts +102 -0
- package/dist/holmes/project/bounded-io.js +212 -0
- package/dist/holmes/project/change-source.js +3 -1
- package/dist/holmes/project/ci-runs.js +3 -2
- package/dist/holmes/project/ignore.d.ts +31 -2
- package/dist/holmes/project/ignore.js +409 -50
- package/dist/holmes/project/regular-file-guard.d.ts +13 -0
- package/dist/holmes/project/regular-file-guard.js +149 -0
- package/dist/holmes/project/root.js +12 -3
- package/dist/holmes/reverse/anchor.js +4 -3
- package/dist/holmes/reverse/scan.js +6 -2
- package/dist/holmes/review/commit-text.js +3 -2
- package/dist/holmes/review/condition-hunk-replay.js +3 -2
- package/dist/holmes/review/failed-test-names.js +13 -10
- package/dist/holmes/review/findings.js +3 -1
- package/dist/holmes/review/kills-check.js +6 -1
- package/dist/holmes/review/point-in-time-replay.js +5 -4
- package/dist/holmes/review/replay-corpus.js +5 -4
- package/dist/holmes/review/run-replay.js +3 -2
- package/dist/holmes/review/temporal-prior.js +3 -2
- package/dist/holmes/review/test-evidence.js +3 -2
- package/dist/holmes/review/test-outcomes.js +3 -2
- package/dist/holmes/review/test-runner.d.ts +6 -0
- package/dist/holmes/review/test-runner.js +36 -15
- package/dist/holmes/rtm/advisory-outcomes.js +3 -2
- package/dist/holmes/rtm/anchor-ids.js +42 -2
- package/dist/holmes/rtm/file-anchors.js +4 -1
- package/dist/holmes/rtm/ftt-fulfilment.js +8 -3
- package/dist/holmes/rtm/git-changes.js +3 -1
- package/dist/holmes/rtm/graph-store.js +3 -2
- package/dist/holmes/rtm/test-scope.js +9 -4
- package/dist/holmes/spec/compat-impact.d.ts +25 -4
- package/dist/holmes/spec/compat-impact.js +682 -11
- package/dist/holmes/spec/entity-git-snapshot.js +3 -2
- package/dist/holmes/spec/entity-integration.js +3 -2
- package/dist/holmes/spec/entity-renumber-transaction.d.ts +19 -0
- package/dist/holmes/spec/entity-renumber-transaction.js +79 -6
- package/dist/holmes/spec/remote-spec-refs.js +3 -2
- package/dist/holmes/spec/renumber.js +25 -10
- package/dist/holmes/spec/spec-parser.js +9 -3
- package/dist/holmes/spec/yaml-scalar.js +2 -2
- package/dist/holmes/update/refresh.js +3 -1
- package/dist/holmes/update/update-notice.d.ts +6 -0
- package/dist/holmes/update/update-notice.js +18 -1
- package/package.json +11 -4
|
@@ -36,7 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.recordRefreshFailure = recordRefreshFailure;
|
|
37
37
|
exports.runRefreshChild = runRefreshChild;
|
|
38
38
|
exports.defaultRefreshChildDeps = defaultRefreshChildDeps;
|
|
39
|
-
// @implements A-SPEC-719
|
|
39
|
+
// @implements A-SPEC-719, A-SPEC-734
|
|
40
40
|
// @implements A-SPEC-566.4
|
|
41
41
|
/**
|
|
42
42
|
* The detached refresh child — the ONLY place this slice touches the scan/build machinery. Spawned
|
|
@@ -141,6 +141,8 @@ async function warmRequirements(root) {
|
|
|
141
141
|
return graphOps.warmRequirementSemanticCache(root, specs);
|
|
142
142
|
}
|
|
143
143
|
if (require.main === module) {
|
|
144
|
+
// @implements A-SPEC-734 (round 13) — this process never blocks on a file that is not a regular file.
|
|
145
|
+
require('../project/regular-file-guard').installProcessGuards();
|
|
144
146
|
const root = process.argv[2];
|
|
145
147
|
const generation = process.argv[3];
|
|
146
148
|
// fail-soft: a failed refresh leaves the old graph, which the advisory tolerates
|
|
@@ -36,7 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.RTM_REFRESH_MARKER = exports.RTM_REFRESH_TTL_MS = void 0;
|
|
37
37
|
exports.maybeSpawnRtmRefresh = maybeSpawnRtmRefresh;
|
|
38
38
|
exports.requestBackgroundFreshness = requestBackgroundFreshness;
|
|
39
|
-
// @implements A-SPEC-724, A-SPEC-723, A-SPEC-719
|
|
39
|
+
// @implements A-SPEC-724, A-SPEC-723, A-SPEC-719, A-SPEC-734
|
|
40
40
|
/**
|
|
41
41
|
* Graph freshness, kept by the product itself. The impact advisory's quality factor was MEASURED to
|
|
42
42
|
* be staleness (an 8-day-old graph found 7 advisories; a 1-second reindex found 17), so the Stop
|
|
@@ -47,11 +47,15 @@ exports.requestBackgroundFreshness = requestBackgroundFreshness;
|
|
|
47
47
|
const fs = __importStar(require("node:fs"));
|
|
48
48
|
const path = __importStar(require("node:path"));
|
|
49
49
|
const freshness_coordinator_1 = require("../refresh/freshness-coordinator");
|
|
50
|
-
|
|
50
|
+
const bounded_io_1 = require("../project/bounded-io");
|
|
51
|
+
/**
|
|
52
|
+
* Same resolution as the child's `headOf`: full commit id, or null outside a repository.
|
|
53
|
+
* @implements A-SPEC-734 (round 13) — through the per-kind memory: a root whose git already timed out is not asked.
|
|
54
|
+
*/
|
|
51
55
|
function gitHead(root) {
|
|
52
56
|
try {
|
|
53
|
-
const
|
|
54
|
-
return
|
|
57
|
+
const r = (0, bounded_io_1.gitOnce)(root, ['-C', root, 'rev-parse', 'HEAD'], 'repo', { timeout: 2000 });
|
|
58
|
+
return r.status === 0 ? r.stdout.trim() || null : null;
|
|
55
59
|
}
|
|
56
60
|
catch {
|
|
57
61
|
return null;
|
|
@@ -21,3 +21,13 @@ export declare function detectInstallMode(packageRoot: string): InstallMode;
|
|
|
21
21
|
/** Pure: build the banner output and decide whether a refresh should fire. No I/O beyond the
|
|
22
22
|
* injected readFile; the caller performs the detached spawn when shouldRefresh is true. */
|
|
23
23
|
export declare function buildSessionStartOutput(input: SessionStartInput): SessionStartOutput;
|
|
24
|
+
/**
|
|
25
|
+
* @implements A-SPEC-543.3
|
|
26
|
+
* If this workspace's holmes pin is behind the installed package, return a one-line NUDGE to run
|
|
27
|
+
* `holmes-kit upgrade`; otherwise return ''. Detection is zero-config (automatic every session), but
|
|
28
|
+
* the re-pin WRITE is NOT done here: `runInit({force:true})` is gated by a governance-wiring approval,
|
|
29
|
+
* so a silent session-start write would bypass it. The write stays the user's explicit choice via
|
|
30
|
+
* `upgrade`/`init --force`. Forward-drift + opt-out judgment is the pure `repinDecision`; every
|
|
31
|
+
* failure returns '' (fail-open — a banner is never a gate).
|
|
32
|
+
*/
|
|
33
|
+
export declare function driftNudge(cwd: string, installed: string, env: NodeJS.ProcessEnv): string;
|
|
@@ -35,7 +35,8 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
36
|
exports.detectInstallMode = detectInstallMode;
|
|
37
37
|
exports.buildSessionStartOutput = buildSessionStartOutput;
|
|
38
|
-
|
|
38
|
+
exports.driftNudge = driftNudge;
|
|
39
|
+
// @implements A-SPEC-531.2, A-SPEC-734
|
|
39
40
|
// The SessionStart banner hook. It emits the intro (+ optional update notice) as additionalContext,
|
|
40
41
|
// which Claude Code delivers to BOTH the human transcript and the agent context — the "human and
|
|
41
42
|
// agent" delivery REQ-531 asks for. The update refresh is a DETACHED, fire-and-forget child so the
|
|
@@ -97,15 +98,36 @@ function driftNudge(cwd, installed, env) {
|
|
|
97
98
|
const entry = mcp.mcpServers?.['holmes-kit'];
|
|
98
99
|
if (!entry || typeof entry.command !== 'string' || !Array.isArray(entry.args))
|
|
99
100
|
return '';
|
|
100
|
-
|
|
101
|
-
|
|
101
|
+
// @implements A-SPEC-251.2 (confirmation round 24) — only holmes-kit's own package.json answers (an unrelated
|
|
102
|
+
// `tools/package.json` produced a false nudge), and the version reaches the model clipped (a 900 KB version went
|
|
103
|
+
// into every session's context — measured).
|
|
104
|
+
// @implements A-SPEC-251.2 (round 44) — a node launch is walked once and its package.json read only above the walked local path
|
|
105
|
+
// (a `/net/…` argument was read as spelled — measured).
|
|
106
|
+
let args = entry.args;
|
|
107
|
+
const { localRealpath } = require('../cli/codex-oracle');
|
|
108
|
+
if (entry.command === 'node' && typeof args[0] === 'string') {
|
|
109
|
+
const walked = localRealpath(path.resolve(cwd, args[0]));
|
|
110
|
+
if (walked.refused || walked.path === null)
|
|
111
|
+
return '';
|
|
112
|
+
args = [walked.path, ...args.slice(1)];
|
|
102
113
|
}
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
114
|
+
const pinned = mcpLaunchVersion({ command: entry.command, args }, (dir) => {
|
|
115
|
+
// Round 45: each package.json is walked too, and read at its walked path (a committed `bin/package.json` link to `/net`
|
|
116
|
+
// was opened as spelled — measured).
|
|
117
|
+
const walkedPkg = localRealpath(path.join(dir, 'package.json'));
|
|
118
|
+
if (walkedPkg.refused || walkedPkg.path === null)
|
|
119
|
+
return undefined;
|
|
120
|
+
try {
|
|
121
|
+
const pkg = JSON.parse(fs.readFileSync(walkedPkg.path, 'utf8'));
|
|
122
|
+
return pkg?.name === '@holmes-lab/holmes-kit' && typeof pkg.version === 'string' ? pkg.version.slice(0, 40) : undefined;
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
return undefined;
|
|
126
|
+
}
|
|
127
|
+
});
|
|
106
128
|
if (!repinDecision({ pinned, installed, env }).repin)
|
|
107
129
|
return '';
|
|
108
|
-
return `\n[Holmes-Kit] this workspace is pinned to ${pinned}, but ${installed} is installed — run \`${npxBin()} holmes-kit upgrade\` to re-pin.`;
|
|
130
|
+
return `\n[Holmes-Kit] this workspace is pinned to ${String(pinned).slice(0, 40)}, but ${installed} is installed — run \`${npxBin()} holmes-kit upgrade\` to re-pin.`;
|
|
109
131
|
}
|
|
110
132
|
catch {
|
|
111
133
|
return '';
|
|
@@ -114,6 +136,8 @@ function driftNudge(cwd, installed, env) {
|
|
|
114
136
|
// CLI entry: read the hook JSON on stdin (unused beyond triggering), emit the banner, and — when
|
|
115
137
|
// allowed — fire the detached refresh. Wrapped so any failure is an empty output + exit 0.
|
|
116
138
|
if (require.main === module) {
|
|
139
|
+
// @implements A-SPEC-734 (round 13) — this process never blocks on a file that is not a regular file.
|
|
140
|
+
require('../project/regular-file-guard').installProcessGuards();
|
|
117
141
|
// @implements A-SPEC-547.1 — the detached `--refresh` child actually queries the registry and writes
|
|
118
142
|
// the cache. Without this branch the spawn fell through to the banner path and wrote nothing, so the
|
|
119
143
|
// update notice never appeared for any harness. Public dist-tags only, short timeout, fail-open.
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { PendingRequest } from '../governance/approval-queue';
|
|
2
|
+
export declare const STOP_NOTICES: Set<string>;
|
|
2
3
|
import { Spec } from '../spec/spec-parser';
|
|
3
4
|
import type { TestOutcome } from '../review/test-runner';
|
|
4
5
|
import { type KnownDefectJudgement } from '../rtm/known-defects';
|
|
@@ -6,7 +7,7 @@ import { type CiVerdict } from '../project/ci-runs';
|
|
|
6
7
|
import { type DistVerdict } from '../project/dist-freshness';
|
|
7
8
|
import { type AnalysisVerdict } from '../project/analysis-currency';
|
|
8
9
|
import { judgeForbiddenEdges } from '../cpg/forbidden-edges';
|
|
9
|
-
import type
|
|
10
|
+
import { type ScannedFile } from '../cpg/cpg-scanner';
|
|
10
11
|
/** @implements A-SPEC-693 */
|
|
11
12
|
export type ForbiddenEdgeJudgement = ReturnType<typeof judgeForbiddenEdges>;
|
|
12
13
|
export declare function collectKnownDefects(root: string, now: Date): KnownDefectJudgement | undefined;
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.MAX_CONSECUTIVE_BLOCKS = void 0;
|
|
36
|
+
exports.MAX_CONSECUTIVE_BLOCKS = exports.STOP_NOTICES = void 0;
|
|
37
37
|
exports.collectKnownDefects = collectKnownDefects;
|
|
38
38
|
exports.collectSemanticCoverage = collectSemanticCoverage;
|
|
39
39
|
exports.collectAnalysisCurrency = collectAnalysisCurrency;
|
|
@@ -59,6 +59,7 @@ exports.readGuardCount = readGuardCount;
|
|
|
59
59
|
exports.collectForbiddenEdgeJudgement = collectForbiddenEdgeJudgement;
|
|
60
60
|
exports.scanCodeCycles = scanCodeCycles;
|
|
61
61
|
exports.writeGuardCount = writeGuardCount;
|
|
62
|
+
// @implements A-SPEC-734
|
|
62
63
|
const fs = __importStar(require("node:fs"));
|
|
63
64
|
// @implements A-SPEC-549.3 — evaluateStop's messages are English here; the Hangul-absence guard
|
|
64
65
|
// calls into this file.
|
|
@@ -71,6 +72,105 @@ const autonomy_1 = require("../governance/autonomy");
|
|
|
71
72
|
const risk_gate_1 = require("../guardrail/risk-gate");
|
|
72
73
|
const json_state_1 = require("../project/json-state");
|
|
73
74
|
const node_child_process_1 = require("node:child_process");
|
|
75
|
+
/**
|
|
76
|
+
* @implements A-SPEC-734 (round 11) — every git child of the Stop hook runs under a timeout, and a timeout or
|
|
77
|
+
* failure is "no signal": a FIFO `.gitignore` (or a FIFO in place of a tracked file) kept `git status` blocked
|
|
78
|
+
* and the Stop hook never finished (killed at 600 s — measured).
|
|
79
|
+
*/
|
|
80
|
+
/**
|
|
81
|
+
* @implements A-SPEC-734 (round 12) — within one Stop evaluation the status is read once per quoting (four
|
|
82
|
+
* readers took 3.6 s each on a slow status — measured); the hook process turns the session on, a caller that
|
|
83
|
+
* does not (tests, the MCP server) reads fresh. A timed-out root is remembered in the shared memory of
|
|
84
|
+
* `bounded-io`, which the walkers and `maintenance_analyze` consult too, and a status that could not be read
|
|
85
|
+
* is NAMED on stderr — never read as clean (a status over Node's 1 MiB default made ART-1 read "no signal").
|
|
86
|
+
*/
|
|
87
|
+
let STATUS_SESSION = null;
|
|
88
|
+
exports.STOP_NOTICES = new Set();
|
|
89
|
+
/**
|
|
90
|
+
* @implements A-SPEC-734 (round 13) — every git child of the Stop hook: bounded, and through the per-kind memory
|
|
91
|
+
* (`include.path` → FIFO took 27–32 s: five call sites neither consulted nor fed it — measured). Throws on any
|
|
92
|
+
* failure, so each call site keeps its "no signal" branch.
|
|
93
|
+
*/
|
|
94
|
+
function gitText(root, args, kind) {
|
|
95
|
+
const r = (0, bounded_io_1.gitOnce)(root, args, kind, { env: (0, root_1.cleanSubprocessEnv)() });
|
|
96
|
+
if (r.status !== 0)
|
|
97
|
+
throw Object.assign(new Error(`git ${args[0]} failed`), { code: r.error?.code ?? 'EGIT', unanswered: (0, bounded_io_1.gitUnanswered)(r, root) });
|
|
98
|
+
return r.stdout;
|
|
99
|
+
}
|
|
100
|
+
/** The one notice for a status that was not read (a timeout printed two — measured). */
|
|
101
|
+
const STATUS_NOT_READ = 'the working-tree status was not read (git did not answer within 5 s on this project) — the changed-source checks (ART-1, ART-5, ART-8) were not judged this turn';
|
|
102
|
+
/**
|
|
103
|
+
* @implements A-SPEC-734 (round 17) — the changed paths of THIS project, relative to its root, as git names them
|
|
104
|
+
* (`-z`: no quoting, so a name holding `"`, ` -> `, a newline or — with quotepath on — a non-ASCII character is read
|
|
105
|
+
* as itself; each was read as another path and skipped). Limited to the project (`-- .`) and made relative to it:
|
|
106
|
+
* porcelain paths are from the REPOSITORY root, and a monorepo package's ART-1/5/8 returned nothing while a root
|
|
107
|
+
* `src/a.ts` change was read from the package's own file (measured). A rename or copy names its destination.
|
|
108
|
+
*/
|
|
109
|
+
function workTreePaths(root) {
|
|
110
|
+
if (STATUS_SESSION?.has(root))
|
|
111
|
+
return STATUS_SESSION.get(root) ?? null;
|
|
112
|
+
let out = null;
|
|
113
|
+
if ((0, bounded_io_1.gitRootBlocked)(root, 'worktree')) {
|
|
114
|
+
exports.STOP_NOTICES.add(STATUS_NOT_READ);
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
try {
|
|
118
|
+
// A-SPEC-734 (round 16): submodules ignored — a broken submodule gitdir failed the whole status (measured).
|
|
119
|
+
const prefix = gitText(root, ['rev-parse', '--show-prefix'], 'repo').replace(/\r?\n$/, '');
|
|
120
|
+
// A-SPEC-734 (round 20): limited to the project case-insensitively where git can fold it (an ASCII prefix) — the
|
|
121
|
+
// whole-repository status of a 200k-file monorepo cost 20–25× the package's (measured); `underGitPrefix` still folds.
|
|
122
|
+
const limit = prefix !== '' && /^[\x20-\x7e]+$/.test(prefix) ? ['--', `:(top,icase,literal)${prefix}`] : [];
|
|
123
|
+
const raw = (0, node_child_process_1.execFileSync)('git', ['status', '--porcelain', '-z', '-uall', '--ignore-submodules=all', ...limit], { maxBuffer: bounded_io_1.GIT_MAX_BUFFER,
|
|
124
|
+
cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], env: (0, root_1.cleanSubprocessEnv)(), timeout: bounded_io_1.GIT_TIMEOUT_MS, killSignal: 'SIGKILL',
|
|
125
|
+
});
|
|
126
|
+
out = [];
|
|
127
|
+
const entries = raw.split('\0');
|
|
128
|
+
for (let i = 0; i < entries.length; i++) {
|
|
129
|
+
const entry = entries[i];
|
|
130
|
+
if (entry.length < 4)
|
|
131
|
+
continue;
|
|
132
|
+
if (/[RC]/.test(entry.slice(0, 2)))
|
|
133
|
+
i++; // the next entry is the rename's source
|
|
134
|
+
const own = (0, bounded_io_1.underGitPrefix)(entry.slice(3), prefix);
|
|
135
|
+
if (own !== null)
|
|
136
|
+
out.push(own);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
catch (e) {
|
|
140
|
+
(0, bounded_io_1.noteGitFailure)(root, e, 'worktree');
|
|
141
|
+
const code = e.code;
|
|
142
|
+
if (code === 'ETIMEDOUT')
|
|
143
|
+
exports.STOP_NOTICES.add(STATUS_NOT_READ);
|
|
144
|
+
else if (code === 'ENOBUFS' || code === 'ERR_CHILD_PROCESS_STDIO_MAXBUFFER')
|
|
145
|
+
exports.STOP_NOTICES.add('the working-tree status is larger than 256 MiB — the changed-source checks (ART-1, ART-5, ART-8) were not judged this turn');
|
|
146
|
+
// @implements A-SPEC-734 (round 15) — a refusal inside a repository (dubious ownership, a corrupt index) is not
|
|
147
|
+
// "no repository": ART-1 and ART-5 vanished without a notice (measured).
|
|
148
|
+
else if (e.unanswered === true || (0, bounded_io_1.gitAnswerOf)(e, root) === 'unanswered')
|
|
149
|
+
exports.STOP_NOTICES.add(`the working-tree status was refused by git (${String(e.stderr ?? e.message ?? '').trim().split('\n')[0].slice(0, 160)}) — the changed-source checks (ART-1, ART-5, ART-8) were not judged this turn`);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
STATUS_SESSION?.set(root, out);
|
|
153
|
+
return out;
|
|
154
|
+
}
|
|
155
|
+
/** Destination paths of porcelain v1 text (the test seam of `dependencyReappraisals`). */
|
|
156
|
+
function pathsOfPorcelain(text) {
|
|
157
|
+
const out = [];
|
|
158
|
+
for (const line of text.split('\n')) {
|
|
159
|
+
if (line.trim() === '')
|
|
160
|
+
continue;
|
|
161
|
+
let rel = line.slice(3).trim().replace(/^"|"$/g, '');
|
|
162
|
+
if (rel.includes(' -> '))
|
|
163
|
+
rel = rel.split(' -> ')[1];
|
|
164
|
+
out.push(rel);
|
|
165
|
+
}
|
|
166
|
+
return out;
|
|
167
|
+
}
|
|
168
|
+
/** A file git listed, read only when it is a regular file (a FIFO in its place blocked the read forever). */
|
|
169
|
+
function readRegularText(abs) {
|
|
170
|
+
if (!fs.statSync(abs).isFile())
|
|
171
|
+
throw new Error('not a regular file');
|
|
172
|
+
return fs.readFileSync(abs, 'utf8');
|
|
173
|
+
}
|
|
74
174
|
const path = __importStar(require("node:path"));
|
|
75
175
|
const test_scope_1 = require("../rtm/test-scope");
|
|
76
176
|
const constitution_1 = require("../governance/constitution");
|
|
@@ -93,6 +193,8 @@ const analysis_currency_1 = require("../project/analysis-currency");
|
|
|
93
193
|
const forbidden_edges_1 = require("../cpg/forbidden-edges");
|
|
94
194
|
const forbidden_edge_report_1 = require("../cpg/forbidden-edge-report");
|
|
95
195
|
const cycle_report_1 = require("../cpg/cycle-report");
|
|
196
|
+
const cpg_scanner_1 = require("../cpg/cpg-scanner");
|
|
197
|
+
const bounded_io_1 = require("../project/bounded-io");
|
|
96
198
|
// @implements A-SPEC-660 — the I/O half of the known-defect marker: walk the workspace's test files
|
|
97
199
|
// (the same directory rule and test predicate ART-4's anchor scan uses), parse each for markers,
|
|
98
200
|
// judge them against the injected clock. A walk that cannot START is NO SIGNAL (undefined) — never
|
|
@@ -114,13 +216,19 @@ function collectKnownDefects(root, now) {
|
|
|
114
216
|
if (e.name === 'node_modules' || e.name === '.git' || e.name === 'dist' || e.name === '.ax')
|
|
115
217
|
continue;
|
|
116
218
|
const abs = path.join(dir, e.name);
|
|
219
|
+
// @implements A-SPEC-734 (round 10) — a nested tree is another repository (an agent worktree's
|
|
220
|
+
// expired marker blocked this session — measured), and only a regular file is read (a FIFO hung it).
|
|
221
|
+
// @implements A-SPEC-734 (round 16) — a directory whose nesting git could not answer is not evidence either way.
|
|
117
222
|
if (e.isDirectory()) {
|
|
118
|
-
|
|
223
|
+
if (!(0, cpg_scanner_1.isNestedWorkTree)(abs, root) && !(0, cpg_scanner_1.underUnverifiedNesting)(abs))
|
|
224
|
+
walk(abs);
|
|
119
225
|
continue;
|
|
120
226
|
}
|
|
121
227
|
const rel = path.relative(root, abs).split(path.sep).join('/');
|
|
122
228
|
if (!(0, test_files_1.isTestFile)(rel))
|
|
123
229
|
continue;
|
|
230
|
+
if (!(0, cpg_scanner_1.isRegularSource)(e, abs, root))
|
|
231
|
+
continue;
|
|
124
232
|
let text;
|
|
125
233
|
try {
|
|
126
234
|
text = fs.readFileSync(abs, 'utf8');
|
|
@@ -161,8 +269,7 @@ function collectSemanticCoverage(root, tier) {
|
|
|
161
269
|
const { readCoverageState, coverageStopLine } = require('../semantic/vector-coverage');
|
|
162
270
|
let head;
|
|
163
271
|
try {
|
|
164
|
-
|
|
165
|
-
head = execFileSync('git', ['-C', root, 'rev-parse', 'HEAD'], { encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'] }).trim() || undefined;
|
|
272
|
+
head = gitText(root, ['rev-parse', 'HEAD'], 'repo').trim() || undefined;
|
|
166
273
|
}
|
|
167
274
|
catch {
|
|
168
275
|
head = undefined;
|
|
@@ -195,7 +302,7 @@ function collectDistFreshness(root) {
|
|
|
195
302
|
const buildId = (0, dist_freshness_1.distBuildId)(root);
|
|
196
303
|
let head = null;
|
|
197
304
|
try {
|
|
198
|
-
head = (
|
|
305
|
+
head = gitText(root, ['rev-parse', '--short', 'HEAD'], 'repo').trim();
|
|
199
306
|
}
|
|
200
307
|
catch {
|
|
201
308
|
head = null;
|
|
@@ -203,7 +310,7 @@ function collectDistFreshness(root) {
|
|
|
203
310
|
let behind = null;
|
|
204
311
|
if (buildId && head) {
|
|
205
312
|
try {
|
|
206
|
-
const n = Number((
|
|
313
|
+
const n = Number(gitText(root, ['rev-list', '--count', `${buildId}..HEAD`], 'repo').trim());
|
|
207
314
|
behind = Number.isFinite(n) ? n : null;
|
|
208
315
|
}
|
|
209
316
|
catch {
|
|
@@ -230,14 +337,14 @@ function collectCiVerdicts(root, now = new Date()) {
|
|
|
230
337
|
}
|
|
231
338
|
let head;
|
|
232
339
|
try {
|
|
233
|
-
head = (
|
|
340
|
+
head = gitText(root, ['rev-parse', 'HEAD'], 'repo').trim();
|
|
234
341
|
}
|
|
235
342
|
catch {
|
|
236
343
|
head = undefined;
|
|
237
344
|
}
|
|
238
345
|
const behind = (rev) => {
|
|
239
346
|
try {
|
|
240
|
-
return Number((
|
|
347
|
+
return Number(gitText(root, ['rev-list', '--count', `${rev}..HEAD`], 'repo').trim());
|
|
241
348
|
}
|
|
242
349
|
catch {
|
|
243
350
|
return undefined;
|
|
@@ -254,29 +361,17 @@ function collectCiVerdicts(root, now = new Date()) {
|
|
|
254
361
|
function changedAnchoredAspecs(root) {
|
|
255
362
|
const SOURCE = /\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs|py|go|rs|java|kt|cs|rb|php|swift)$/;
|
|
256
363
|
const VENDORED = /^(?:reference|node_modules|dist|build|vendor|third_party)\//;
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
// and its ART-8 evidence silently vanishes (shared defect with the reappraisal detector).
|
|
261
|
-
raw = (0, node_child_process_1.execFileSync)('git', ['-c', 'core.quotepath=false', 'status', '--porcelain', '-uall'], {
|
|
262
|
-
cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], env: (0, root_1.cleanSubprocessEnv)(),
|
|
263
|
-
});
|
|
264
|
-
}
|
|
265
|
-
catch {
|
|
364
|
+
// @implements A-SPEC-560.3 — a non-ASCII-named source must not arrive octal-escaped (round 17: `-z`, never quoted).
|
|
365
|
+
const paths = workTreePaths(root);
|
|
366
|
+
if (paths === null)
|
|
266
367
|
return undefined;
|
|
267
|
-
}
|
|
268
368
|
const ids = new Set();
|
|
269
|
-
for (const
|
|
270
|
-
if (line.trim() === '')
|
|
271
|
-
continue;
|
|
272
|
-
let rel = line.slice(3).trim().replace(/^"|"$/g, '');
|
|
273
|
-
if (rel.includes(' -> '))
|
|
274
|
-
rel = rel.split(' -> ')[1]; // renames name the destination
|
|
369
|
+
for (const rel of paths) {
|
|
275
370
|
if (!SOURCE.test(rel) || VENDORED.test(rel))
|
|
276
371
|
continue;
|
|
277
372
|
let text;
|
|
278
373
|
try {
|
|
279
|
-
text =
|
|
374
|
+
text = readRegularText(path.join(root, rel));
|
|
280
375
|
}
|
|
281
376
|
catch {
|
|
282
377
|
continue;
|
|
@@ -300,30 +395,19 @@ function changedAnchoredAspecs(root) {
|
|
|
300
395
|
function unanchoredChangedSources(root) {
|
|
301
396
|
const SOURCE = /\.(?:ts|tsx|mts|cts|js|jsx|mjs|cjs|py|go|rs|java|kt|cs|rb|php|swift)$/;
|
|
302
397
|
const VENDORED = /^(?:reference|node_modules|dist|build|vendor|third_party)\//;
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
raw = (0, node_child_process_1.execFileSync)('git', ['-c', 'core.quotepath=false', 'status', '--porcelain', '-uall'], {
|
|
309
|
-
cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], env: (0, root_1.cleanSubprocessEnv)(),
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
catch {
|
|
398
|
+
// `-uall`: without it git folds a wholly-untracked directory into one `?? src/` line and the
|
|
399
|
+
// files inside it are never seen — which is precisely where a bypassed write lands.
|
|
400
|
+
// @implements A-SPEC-560.3 — never octal-escaped (round 17: `-z`).
|
|
401
|
+
const paths = workTreePaths(root);
|
|
402
|
+
if (paths === null)
|
|
313
403
|
return undefined;
|
|
314
|
-
}
|
|
315
404
|
const out = [];
|
|
316
|
-
for (const
|
|
317
|
-
if (line.trim() === '')
|
|
318
|
-
continue;
|
|
319
|
-
let rel = line.slice(3).trim().replace(/^"|"$/g, '');
|
|
320
|
-
if (rel.includes(' -> '))
|
|
321
|
-
rel = rel.split(' -> ')[1]; // renames name the destination
|
|
405
|
+
for (const rel of paths) {
|
|
322
406
|
if (!SOURCE.test(rel) || VENDORED.test(rel))
|
|
323
407
|
continue;
|
|
324
408
|
let text;
|
|
325
409
|
try {
|
|
326
|
-
text =
|
|
410
|
+
text = readRegularText(path.join(root, rel));
|
|
327
411
|
}
|
|
328
412
|
catch {
|
|
329
413
|
continue;
|
|
@@ -345,17 +429,12 @@ function dependencyReappraisals(root, isApproved, io = {}) {
|
|
|
345
429
|
// @implements A-SPEC-560.3 — quotepath OFF: with the default core.quotepath, a Korean- (or any
|
|
346
430
|
// non-ASCII/quote-) named file arrives octal-escaped, the read then ENOENTs, and the signal is
|
|
347
431
|
// silently lost. Measured: 2 of 4 drifting files detected before this flag.
|
|
348
|
-
const status = io.status
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
}
|
|
352
|
-
catch {
|
|
353
|
-
return undefined;
|
|
354
|
-
}
|
|
355
|
-
});
|
|
432
|
+
const status = io.status;
|
|
433
|
+
// @implements A-SPEC-734 (round 17) — `HEAD:./<path>` is the project's file; `HEAD:<path>` named the repository
|
|
434
|
+
// root's file of the same name in a monorepo package (measured).
|
|
356
435
|
const show = io.show ?? ((rel) => {
|
|
357
436
|
try {
|
|
358
|
-
return (
|
|
437
|
+
return gitText(root, ['-c', 'core.quotepath=false', 'show', `HEAD:./${rel}`], 'repo');
|
|
359
438
|
}
|
|
360
439
|
catch {
|
|
361
440
|
return undefined;
|
|
@@ -363,28 +442,28 @@ function dependencyReappraisals(root, isApproved, io = {}) {
|
|
|
363
442
|
});
|
|
364
443
|
const read = io.read ?? ((rel) => {
|
|
365
444
|
try {
|
|
366
|
-
return
|
|
445
|
+
return readRegularText(path.join(root, rel));
|
|
367
446
|
}
|
|
368
447
|
catch {
|
|
369
448
|
return undefined;
|
|
370
449
|
}
|
|
371
450
|
});
|
|
372
|
-
let
|
|
451
|
+
let paths;
|
|
373
452
|
try {
|
|
374
|
-
|
|
453
|
+
if (status !== undefined) {
|
|
454
|
+
const raw = status();
|
|
455
|
+
paths = raw === undefined ? null : pathsOfPorcelain(raw);
|
|
456
|
+
}
|
|
457
|
+
else
|
|
458
|
+
paths = workTreePaths(root);
|
|
375
459
|
}
|
|
376
460
|
catch {
|
|
377
|
-
|
|
461
|
+
paths = null;
|
|
378
462
|
}
|
|
379
|
-
if (
|
|
463
|
+
if (paths === null)
|
|
380
464
|
return [];
|
|
381
465
|
const out = [];
|
|
382
|
-
for (const
|
|
383
|
-
if (line.trim() === '')
|
|
384
|
-
continue;
|
|
385
|
-
let rel = line.slice(3).trim().replace(/^"|"$/g, '');
|
|
386
|
-
if (rel.includes(' -> '))
|
|
387
|
-
rel = rel.split(' -> ')[1]; // renames name the destination
|
|
466
|
+
for (const rel of paths) {
|
|
388
467
|
const lang = depLangOf(rel);
|
|
389
468
|
if (lang === undefined || REAPPRAISAL_VENDORED.test(rel))
|
|
390
469
|
continue;
|
|
@@ -475,27 +554,16 @@ function escalateReappraisals(root, reaps, opts) {
|
|
|
475
554
|
* git is a refinement — no repository means `undefined`, which produces no violation.
|
|
476
555
|
*/
|
|
477
556
|
function unrecordedApprovals(root) {
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
raw = (0, node_child_process_1.execFileSync)('git', ['status', '--porcelain', '-uall'], {
|
|
481
|
-
cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], env: (0, root_1.cleanSubprocessEnv)(),
|
|
482
|
-
});
|
|
483
|
-
}
|
|
484
|
-
catch {
|
|
557
|
+
const paths = workTreePaths(root);
|
|
558
|
+
if (paths === null)
|
|
485
559
|
return undefined;
|
|
486
|
-
}
|
|
487
560
|
const approvedIds = [];
|
|
488
|
-
for (const
|
|
489
|
-
if (line.trim() === '')
|
|
490
|
-
continue;
|
|
491
|
-
let rel = line.slice(3).trim().replace(/^"|"$/g, '');
|
|
492
|
-
if (rel.includes(' -> '))
|
|
493
|
-
rel = rel.split(' -> ')[1];
|
|
561
|
+
for (const rel of paths) {
|
|
494
562
|
if (!rel.endsWith('.md') || !rel.replace(/\\/g, '/').includes('/specs/'))
|
|
495
563
|
continue;
|
|
496
564
|
let text;
|
|
497
565
|
try {
|
|
498
|
-
text =
|
|
566
|
+
text = readRegularText(path.join(root, rel));
|
|
499
567
|
}
|
|
500
568
|
catch {
|
|
501
569
|
continue;
|
|
@@ -545,15 +613,16 @@ function unrecordedApprovals(root) {
|
|
|
545
613
|
* against, so this catches rollback of COMMITTED history, not deletion of uncommitted history.
|
|
546
614
|
*/
|
|
547
615
|
function rolledBackLedgers(root) {
|
|
548
|
-
const git = (args) => (
|
|
549
|
-
cwd: root, encoding: 'utf8', stdio: ['ignore', 'pipe', 'ignore'], env: (0, root_1.cleanSubprocessEnv)(),
|
|
550
|
-
});
|
|
616
|
+
const git = (args) => gitText(root, args, 'repo');
|
|
551
617
|
let tracked;
|
|
552
618
|
try {
|
|
553
|
-
tracked = git(['ls-files', '.ax/ledger']).split('\n')
|
|
619
|
+
tracked = git(['-c', 'core.fsmonitor=false', 'ls-files', '.ax/ledger']).split('\n')
|
|
554
620
|
.map((l) => l.trim()).filter((l) => /provenance[\w.-]*\.jsonl$/.test(l));
|
|
555
621
|
}
|
|
556
|
-
catch {
|
|
622
|
+
catch (e) {
|
|
623
|
+
// @implements A-SPEC-734 (round 13) — a git that did not answer is named, not read as "nothing rolled back".
|
|
624
|
+
if (e.unanswered)
|
|
625
|
+
exports.STOP_NOTICES.add('the ledger rollback check (ART-2) was not judged this turn (git did not answer)');
|
|
557
626
|
return undefined;
|
|
558
627
|
}
|
|
559
628
|
const parse = (text) => text.split('\n')
|
|
@@ -569,15 +638,16 @@ function rolledBackLedgers(root) {
|
|
|
569
638
|
const out = [];
|
|
570
639
|
for (const rel of tracked) {
|
|
571
640
|
let committed;
|
|
641
|
+
// Round 17: `HEAD:./` — `ls-files` names paths from the project, `HEAD:` from the repository root (measured).
|
|
572
642
|
try {
|
|
573
|
-
committed = git(['show', `HEAD
|
|
643
|
+
committed = git(['show', `HEAD:./${rel}`]);
|
|
574
644
|
}
|
|
575
645
|
catch {
|
|
576
646
|
continue;
|
|
577
647
|
} // no HEAD, or newly added
|
|
578
648
|
let working;
|
|
579
649
|
try {
|
|
580
|
-
working =
|
|
650
|
+
working = readRegularText(path.join(root, rel));
|
|
581
651
|
}
|
|
582
652
|
catch {
|
|
583
653
|
working = '';
|
|
@@ -952,8 +1022,16 @@ function findProjectRoot(specsDir) {
|
|
|
952
1022
|
let WIRED_SPECS;
|
|
953
1023
|
/** Test seam for the same reason as the two exports below — the CLI sets this on a real run. */
|
|
954
1024
|
function __setWiredSpecsForTest(v) { WIRED_SPECS = v; }
|
|
1025
|
+
/**
|
|
1026
|
+
* @implements A-SPEC-734 (round 17) — resolved once per directory the process runs in: each call ran
|
|
1027
|
+
* `git rev-parse --show-toplevel`, and the ART-4 loop called it per test file (1,000 tests: 16.7 s — measured).
|
|
1028
|
+
*/
|
|
1029
|
+
let STOP_ROOT = null;
|
|
955
1030
|
function stopProjectRoot() {
|
|
956
|
-
|
|
1031
|
+
const cwd = process.cwd();
|
|
1032
|
+
if (STOP_ROOT === null || STOP_ROOT.cwd !== cwd)
|
|
1033
|
+
STOP_ROOT = { cwd, root: findProjectRoot(WIRED_SPECS) ?? cwd };
|
|
1034
|
+
return STOP_ROOT.root;
|
|
957
1035
|
}
|
|
958
1036
|
/** null when no project could be found — nothing is written, nothing is minted. */
|
|
959
1037
|
function guardStatePath() {
|
|
@@ -974,7 +1052,7 @@ const GUARD_SESSIONS_MAX = 32;
|
|
|
974
1052
|
function readGuardState() {
|
|
975
1053
|
let parsed;
|
|
976
1054
|
try {
|
|
977
|
-
parsed = JSON.parse(
|
|
1055
|
+
parsed = JSON.parse((0, bounded_io_1.readRegularTextSync)(GUARD_STATE()));
|
|
978
1056
|
}
|
|
979
1057
|
catch {
|
|
980
1058
|
return {};
|
|
@@ -1180,6 +1258,9 @@ function writeGuardCount(sessionId, n) {
|
|
|
1180
1258
|
}
|
|
1181
1259
|
// CLI entry: Claude Code passes Stop-hook JSON on stdin. Fail-open (never crash a turn).
|
|
1182
1260
|
if (require.main === module) {
|
|
1261
|
+
// @implements A-SPEC-734 (round 13) — this process never blocks on a file that is not a regular file.
|
|
1262
|
+
require('../project/regular-file-guard').installProcessGuards();
|
|
1263
|
+
STATUS_SESSION = new Map();
|
|
1183
1264
|
let buf = '';
|
|
1184
1265
|
process.stdin.on('data', (c) => (buf += c));
|
|
1185
1266
|
process.stdin.on('end', () => {
|
|
@@ -1220,12 +1301,20 @@ if (require.main === module) {
|
|
|
1220
1301
|
let testCasesByAspec;
|
|
1221
1302
|
try {
|
|
1222
1303
|
testCasesByAspec = {};
|
|
1223
|
-
|
|
1304
|
+
const testRoot = stopProjectRoot();
|
|
1305
|
+
for (const [file, ids] of Object.entries((0, test_scope_1.scanTestAnchors)(testRoot))) {
|
|
1306
|
+
// @implements A-SPEC-734 (round 16/17) — a test under a directory whose nesting git could not answer is not
|
|
1307
|
+
// ART-4 evidence (the walk skips it; this holds for a link into one); it is named below.
|
|
1308
|
+
const abs = path.resolve(testRoot, file);
|
|
1309
|
+
if ((0, cpg_scanner_1.underUnverifiedNesting)(abs))
|
|
1310
|
+
continue;
|
|
1224
1311
|
let n = 0;
|
|
1225
1312
|
// Pass the path: the counter picks the test framework from the extension, and without it
|
|
1226
1313
|
// every non-JS suite counts zero and ART-4 reports "no tests" for a project that has them.
|
|
1314
|
+
// Round 17: read from the project root, not the process directory (a Stop run from `src/` raised a false
|
|
1315
|
+
// ART-4 — measured).
|
|
1227
1316
|
try {
|
|
1228
|
-
n = (0, test_scope_1.countTestCases)(fs.readFileSync(
|
|
1317
|
+
n = (0, test_scope_1.countTestCases)(fs.readFileSync(abs, 'utf8'), file);
|
|
1229
1318
|
}
|
|
1230
1319
|
catch { /* unreadable file: skip */ }
|
|
1231
1320
|
for (const id of ids)
|
|
@@ -1239,7 +1328,7 @@ if (require.main === module) {
|
|
|
1239
1328
|
// stale record can never vouch for changed code. Absent/stale -> syntactic fallback.
|
|
1240
1329
|
let executedByAspec;
|
|
1241
1330
|
try {
|
|
1242
|
-
const head = (
|
|
1331
|
+
const head = gitText(stopProjectRoot(), ['rev-parse', 'HEAD'], 'repo').toString().trim();
|
|
1243
1332
|
const ev = (0, test_evidence_1.readTestEvidence)(stopProjectRoot());
|
|
1244
1333
|
if ((0, test_evidence_1.isFresh)(ev, head))
|
|
1245
1334
|
executedByAspec = ev.executedByAspec;
|
|
@@ -1256,7 +1345,7 @@ if (require.main === module) {
|
|
|
1256
1345
|
try {
|
|
1257
1346
|
redFirstMode = (0, config_1.loadConfig)(stopProjectRoot()).guardrail.redFirstEvidence;
|
|
1258
1347
|
if (redFirstMode !== 'off') {
|
|
1259
|
-
const head = (
|
|
1348
|
+
const head = gitText(stopProjectRoot(), ['rev-parse', 'HEAD'], 'repo').toString().trim();
|
|
1260
1349
|
changedAspecs = changedAnchoredAspecs(stopProjectRoot());
|
|
1261
1350
|
// @implements A-SPEC-645 — a renumbered A-SPEC keeps its red-first evidence: records are
|
|
1262
1351
|
// grouped under the display id the entity carries now, per the ledger's rename records.
|
|
@@ -1441,6 +1530,23 @@ if (require.main === module) {
|
|
|
1441
1530
|
// to the observation ledger from the founding commit on (071bbf0c) and never handed over, so
|
|
1442
1531
|
// the ART-2 track branch and the constitution's strict branch were dead code in the product:
|
|
1443
1532
|
// the ratchet had never spoken to anyone. The mode it carries is still the constant `track`.
|
|
1533
|
+
// Round 12: a signal that could not be judged is named, never read as clean.
|
|
1534
|
+
// @implements A-SPEC-734 (round 15) — after every walk (the known-defect walk ran after the print and its
|
|
1535
|
+
// unverified trees went unnamed); directories holding `.git` whose nesting git could not answer are named.
|
|
1536
|
+
try {
|
|
1537
|
+
const { UNVERIFIED_NESTED } = require('../cpg/cpg-scanner');
|
|
1538
|
+
const n = UNVERIFIED_NESTED.size;
|
|
1539
|
+
let realRoot = stopProjectRoot();
|
|
1540
|
+
try {
|
|
1541
|
+
realRoot = fs.realpathSync.native(realRoot);
|
|
1542
|
+
}
|
|
1543
|
+
catch { /* as resolved */ }
|
|
1544
|
+
if (n > 0)
|
|
1545
|
+
exports.STOP_NOTICES.add(`${n} director${n === 1 ? 'y' : 'ies'} holding .git could not be verified with git (${[...UNVERIFIED_NESTED].slice(0, 3).map((d) => path.relative(realRoot, d) || d).join(', ')}${n > 3 ? ', …' : ''}) — ${n === 1 ? 'it was' : 'they were'} not walked: ${n === 1 ? 'its' : 'their'} tests, known-defect markers and code were not judged (ART-4, ART-9)`);
|
|
1546
|
+
}
|
|
1547
|
+
catch { /* the notice is best-effort */ }
|
|
1548
|
+
for (const notice of exports.STOP_NOTICES)
|
|
1549
|
+
process.stderr.write(`[Holmes-Kit] ${notice}\n`);
|
|
1444
1550
|
let out = evaluateStop(specs, { testCasesByAspec, provenance, executedByAspec, findings, findingsUnreadable, unanchoredChangedSources: unanchored, unrecordedApprovals: unrecorded, rolledBackLedgers: rolledBack, redFirstMode, changedAspecs, outcomesByAspec, ...(knownDefects ? { knownDefects } : {}), ...(ci ? { ci } : {}), ...(dist ? { dist } : {}), ...(analysis ? { analysis } : {}), ...(semantic ? { semantic } : {}), ...(forbiddenEdges ? { forbiddenEdges } : {}), ...(cycles ? { cycles } : {}) });
|
|
1445
1551
|
// @implements A-SPEC-534.4 — track mode records ART-8 findings without blocking: surface them so
|
|
1446
1552
|
// the operator observes RED-first gaps before an owner promotes the posture to strict.
|