@holmes-lab/holmes-kit 0.30.0 → 0.31.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +505 -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 +26 -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 +18 -0
- package/dist/holmes/cli/upgrade.js +129 -24
- 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.d.ts +5 -0
- package/dist/holmes/update/refresh.js +26 -1
- package/dist/holmes/update/update-notice.d.ts +6 -0
- package/dist/holmes/update/update-notice.js +18 -1
- package/dist/holmes/update/upgrade-plan.d.ts +28 -0
- package/dist/holmes/update/upgrade-plan.js +31 -2
- package/package.json +11 -4
|
@@ -0,0 +1,212 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.REPO_LOCATING_GIT_VARS = exports.GIT_MAX_BUFFER = exports.GIT_LONG_TIMEOUT_MS = exports.GIT_TIMEOUT_MS = void 0;
|
|
37
|
+
exports.gitRootBlocked = gitRootBlocked;
|
|
38
|
+
exports.noteGitFailure = noteGitFailure;
|
|
39
|
+
exports.gitOnce = gitOnce;
|
|
40
|
+
exports.resetGitBlocked = resetGitBlocked;
|
|
41
|
+
exports.readRegularFileSync = readRegularFileSync;
|
|
42
|
+
exports.readRegularTextSync = readRegularTextSync;
|
|
43
|
+
exports.gitAnswerOf = gitAnswerOf;
|
|
44
|
+
exports.gitEntryAbove = gitEntryAbove;
|
|
45
|
+
exports.underGitPrefix = underGitPrefix;
|
|
46
|
+
exports.gitEnv = gitEnv;
|
|
47
|
+
exports.gitUnanswered = gitUnanswered;
|
|
48
|
+
// @implements A-SPEC-734
|
|
49
|
+
/**
|
|
50
|
+
* Bounded I/O shared by every caller on a hook, MCP or scan path (A-SPEC-734 round 12).
|
|
51
|
+
*
|
|
52
|
+
* A git child without a timeout, a git child with Node's 1 MiB default output buffer, or a plain
|
|
53
|
+
* `readFileSync` of a path that could be a FIFO each turned into a hang or a silently skipped check
|
|
54
|
+
* somewhere in the tree (measured: a FIFO `.gitattributes` blocked `git log --name-only` inside
|
|
55
|
+
* `maintenance_analyze`; `include.path` pointing at a FIFO blocked `git rev-parse` in every hook; a
|
|
56
|
+
* status larger than 1 MiB made the Stop hook's ART-1 check read "no signal"). The bounds live here
|
|
57
|
+
* so they are one decision, and a census test reads the tree for every git child.
|
|
58
|
+
*/
|
|
59
|
+
const node_child_process_1 = require("node:child_process");
|
|
60
|
+
const fs = __importStar(require("node:fs"));
|
|
61
|
+
const path = __importStar(require("node:path"));
|
|
62
|
+
/** A git child on a hook, MCP or scan path. */
|
|
63
|
+
exports.GIT_TIMEOUT_MS = 5000;
|
|
64
|
+
/** Replay and integration tooling that walks whole histories or object stores. */
|
|
65
|
+
exports.GIT_LONG_TIMEOUT_MS = 120_000;
|
|
66
|
+
/** Output a git child may produce before it counts as a failure (Node's default is 1 MiB). */
|
|
67
|
+
exports.GIT_MAX_BUFFER = 256 * 1024 * 1024;
|
|
68
|
+
/** How long a root whose git timed out is remembered as blocked. */
|
|
69
|
+
const BLOCKED_TTL_MS = 60_000;
|
|
70
|
+
const BLOCKED = new Map();
|
|
71
|
+
const keyOf = (root) => {
|
|
72
|
+
try {
|
|
73
|
+
return fs.realpathSync.native(root);
|
|
74
|
+
}
|
|
75
|
+
catch {
|
|
76
|
+
return path.resolve(root);
|
|
77
|
+
}
|
|
78
|
+
};
|
|
79
|
+
/**
|
|
80
|
+
* Whether a git child of this kind for `root` timed out within the last minute (every caller then answers
|
|
81
|
+
* "no signal" at once). The default kind is `worktree`, the one every timeout blocks.
|
|
82
|
+
*/
|
|
83
|
+
function gitRootBlocked(root, kind = 'worktree') {
|
|
84
|
+
const at = BLOCKED.get(keyOf(root))?.[kind];
|
|
85
|
+
return at !== undefined && Date.now() - at < BLOCKED_TTL_MS;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Records a git failure for `root` when it was a timeout (other failures are ordinary answers). The default
|
|
89
|
+
* kind is `worktree`: a caller that does not say is never allowed to silence the `repo` queries.
|
|
90
|
+
*/
|
|
91
|
+
function noteGitFailure(root, err, kind = 'worktree') {
|
|
92
|
+
const e = err;
|
|
93
|
+
if (e?.code !== 'ETIMEDOUT' && e?.error?.code !== 'ETIMEDOUT')
|
|
94
|
+
return;
|
|
95
|
+
const key = keyOf(root);
|
|
96
|
+
const now = Date.now();
|
|
97
|
+
const cur = BLOCKED.get(key) ?? {};
|
|
98
|
+
BLOCKED.set(key, kind === 'repo' ? { repo: now, worktree: now } : { ...cur, worktree: now });
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* @implements A-SPEC-734 (round 13) — one bounded git child that consults and feeds the memory: a blocked
|
|
102
|
+
* root answers at once with `status: null` and `error.code: 'EBLOCKED'`. The Stop hook's git children go
|
|
103
|
+
* through it (five of its call sites neither consulted nor fed the memory: `include.path` → FIFO took
|
|
104
|
+
* 27–32 s — measured).
|
|
105
|
+
*/
|
|
106
|
+
function gitOnce(root, args, kind, opts = {}) {
|
|
107
|
+
if (gitRootBlocked(root, kind)) {
|
|
108
|
+
const error = Object.assign(new Error(`git ${args[0] ?? ''}: not asked — a git child for this root timed out within the last minute`), { code: 'EBLOCKED' });
|
|
109
|
+
return { pid: 0, output: [null, '', ''], stdout: '', stderr: '', status: null, signal: null, error };
|
|
110
|
+
}
|
|
111
|
+
const env = gitEnv(opts.env ?? process.env);
|
|
112
|
+
const r = (0, node_child_process_1.spawnSync)('git', args, { cwd: opts.cwd ?? root, input: opts.input, encoding: 'utf8', timeout: opts.timeout ?? exports.GIT_TIMEOUT_MS, killSignal: 'SIGKILL',
|
|
113
|
+
maxBuffer: exports.GIT_MAX_BUFFER, windowsHide: true, env, stdio: [opts.input === undefined ? 'ignore' : 'pipe', 'pipe', 'pipe'] });
|
|
114
|
+
noteGitFailure(root, r, kind);
|
|
115
|
+
return r;
|
|
116
|
+
}
|
|
117
|
+
/** Test seam: forget every blocked root. */
|
|
118
|
+
function resetGitBlocked() { BLOCKED.clear(); }
|
|
119
|
+
/**
|
|
120
|
+
* A file read only when it is a REGULAR file: opened non-blocking, so a FIFO in its place returns at once
|
|
121
|
+
* instead of waiting for a writer, then refused with everything else that is not a regular file (a device
|
|
122
|
+
* such as `/dev/zero` included). Throws like `readFileSync` does, so callers keep their error handling.
|
|
123
|
+
*/
|
|
124
|
+
function readRegularFileSync(p) {
|
|
125
|
+
const flags = fs.constants.O_RDONLY | (typeof fs.constants.O_NONBLOCK === 'number' ? fs.constants.O_NONBLOCK : 0);
|
|
126
|
+
const fd = fs.openSync(p, flags);
|
|
127
|
+
try {
|
|
128
|
+
if (!fs.fstatSync(fd).isFile()) {
|
|
129
|
+
const err = new Error(`not a regular file: ${p}`);
|
|
130
|
+
err.code = 'EINVAL';
|
|
131
|
+
throw err;
|
|
132
|
+
}
|
|
133
|
+
return fs.readFileSync(fd);
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
fs.closeSync(fd);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
/** `readRegularFileSync` as UTF-8 text. */
|
|
140
|
+
function readRegularTextSync(p) {
|
|
141
|
+
return readRegularFileSync(p).toString('utf8');
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* @implements A-SPEC-734 (round 16) — with `dir`, "no repository" is decided by the TREE: no `.git` entry in `dir` or
|
|
145
|
+
* any ancestor. Round 15 read git's English message — a translated git (Linux/Homebrew git under `LANG=ko_KR`) turned
|
|
146
|
+
* every non-git project into "did not answer", and `not a git repository: <gitdir>` (a submodule without its modules
|
|
147
|
+
* directory, a linked worktree whose main repository moved) read as "no repository" (measured).
|
|
148
|
+
*/
|
|
149
|
+
function gitAnswerOf(r, dir) {
|
|
150
|
+
const code = r.error?.code ?? (typeof r.code === 'string' ? r.code : undefined);
|
|
151
|
+
if (code === 'ENOENT')
|
|
152
|
+
return 'no-repository'; // no git
|
|
153
|
+
if (r.status === 0 && code === undefined)
|
|
154
|
+
return 'answered';
|
|
155
|
+
if (dir !== undefined)
|
|
156
|
+
return gitEntryAbove(dir) ? 'unanswered' : 'no-repository';
|
|
157
|
+
const stderr = typeof r.stderr === 'string' ? r.stderr : Buffer.isBuffer(r.stderr) ? r.stderr.toString('utf8') : '';
|
|
158
|
+
if (/not a git repository/i.test(stderr))
|
|
159
|
+
return 'no-repository';
|
|
160
|
+
return 'unanswered';
|
|
161
|
+
}
|
|
162
|
+
/** Whether `dir` or an ancestor holds a `.git` entry (file, directory or link) — the tree's own answer to "is this a repository". */
|
|
163
|
+
function gitEntryAbove(dir) {
|
|
164
|
+
let d = path.resolve(dir);
|
|
165
|
+
for (;;) {
|
|
166
|
+
try {
|
|
167
|
+
fs.lstatSync(path.join(d, '.git'));
|
|
168
|
+
return true;
|
|
169
|
+
}
|
|
170
|
+
catch { /* none here */ }
|
|
171
|
+
const parent = path.dirname(d);
|
|
172
|
+
if (parent === d)
|
|
173
|
+
return false;
|
|
174
|
+
d = parent;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* @implements A-SPEC-734 (round 16) — the variables that relocate the repository a git child reads. An exported
|
|
179
|
+
* dotfiles `GIT_DIR` made the rm gate judge the project by that repository (measured).
|
|
180
|
+
*/
|
|
181
|
+
exports.REPO_LOCATING_GIT_VARS = ['GIT_DIR', 'GIT_WORK_TREE', 'GIT_INDEX_FILE', 'GIT_COMMON_DIR', 'GIT_OBJECT_DIRECTORY',
|
|
182
|
+
'GIT_ALTERNATE_OBJECT_DIRECTORIES', 'GIT_NAMESPACE', 'GIT_CEILING_DIRECTORIES', 'GIT_DISCOVERY_ACROSS_FILESYSTEM'];
|
|
183
|
+
/**
|
|
184
|
+
* @implements A-SPEC-734 (round 17) — `full` (a porcelain path from the repository root) relative to the project whose
|
|
185
|
+
* `rev-parse --show-prefix` is `prefix`, compared segment by segment NFC and case-folded; null when it lies elsewhere.
|
|
186
|
+
* A `-- .` pathspec is matched case-sensitively by git, so a package whose directory case differs between the index and
|
|
187
|
+
* a case-folding disk read clean (measured).
|
|
188
|
+
*/
|
|
189
|
+
function underGitPrefix(full, prefix) {
|
|
190
|
+
const want = prefix.split('/').filter((p) => p !== '');
|
|
191
|
+
if (want.length === 0)
|
|
192
|
+
return full;
|
|
193
|
+
const have = full.split('/');
|
|
194
|
+
if (have.length <= want.length)
|
|
195
|
+
return null;
|
|
196
|
+
const fold = (p) => p.normalize('NFC').toUpperCase();
|
|
197
|
+
for (let i = 0; i < want.length; i++)
|
|
198
|
+
if (fold(have[i]) !== fold(want[i]))
|
|
199
|
+
return null;
|
|
200
|
+
return have.slice(want.length).join('/');
|
|
201
|
+
}
|
|
202
|
+
/** A git child's environment: the caller's, without the variables that relocate the repository (round 17). */
|
|
203
|
+
function gitEnv(env = process.env) {
|
|
204
|
+
const out = { ...env };
|
|
205
|
+
for (const k of exports.REPO_LOCATING_GIT_VARS)
|
|
206
|
+
delete out[k];
|
|
207
|
+
return out;
|
|
208
|
+
}
|
|
209
|
+
/** Whether a failed git answer means "not judged" rather than "no repository" (round 15: a refusal is not judged too). */
|
|
210
|
+
function gitUnanswered(r, dir) {
|
|
211
|
+
return gitAnswerOf(r, dir) === 'unanswered';
|
|
212
|
+
}
|
|
@@ -36,7 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.EMPTY_CHANGE_SET = exports.GitChangeSource = exports.SnapshotChangeSource = exports.hashOf = exports.isDerivedState = void 0;
|
|
37
37
|
exports.hashTree = hashTree;
|
|
38
38
|
exports.diffHashes = diffHashes;
|
|
39
|
-
// @implements A-SPEC-128
|
|
39
|
+
// @implements A-SPEC-128, A-SPEC-734
|
|
40
40
|
const fs = __importStar(require("node:fs"));
|
|
41
41
|
const path = __importStar(require("node:path"));
|
|
42
42
|
const node_crypto_1 = require("node:crypto");
|
|
@@ -89,6 +89,8 @@ function hashTree(root, opts = {}) {
|
|
|
89
89
|
if (cpg_scanner_1.SKIP.has(e.name))
|
|
90
90
|
continue;
|
|
91
91
|
const abs = path.join(dir, e.name);
|
|
92
|
+
if (e.isDirectory() && (0, cpg_scanner_1.isNestedWorkTree)(abs, root))
|
|
93
|
+
continue; // A-SPEC-734: another repository
|
|
92
94
|
const rel = path.relative(root, abs).split(path.sep).join('/');
|
|
93
95
|
if ((0, exports.isDerivedState)(`${rel}${e.isDirectory() ? '/' : ''}`) || opts.isIgnored?.(rel))
|
|
94
96
|
continue;
|
|
@@ -38,7 +38,7 @@ exports.readCiRuns = readCiRuns;
|
|
|
38
38
|
exports.latestCiRun = latestCiRun;
|
|
39
39
|
exports.ciVerdict = ciVerdict;
|
|
40
40
|
exports.ciStatusLine = ciStatusLine;
|
|
41
|
-
// @implements A-SPEC-664
|
|
41
|
+
// @implements A-SPEC-664, A-SPEC-734
|
|
42
42
|
/**
|
|
43
43
|
* The CI-runs ledger reader — the product side of the minimal Linux matrix.
|
|
44
44
|
*
|
|
@@ -50,6 +50,7 @@ exports.ciStatusLine = ciStatusLine;
|
|
|
50
50
|
*/
|
|
51
51
|
const fs = __importStar(require("node:fs"));
|
|
52
52
|
const path = __importStar(require("node:path"));
|
|
53
|
+
const bounded_io_1 = require("./bounded-io");
|
|
53
54
|
const FILE_RE = /^ci-runs\.([^.]+)\.jsonl$/;
|
|
54
55
|
/**
|
|
55
56
|
* @implements A-SPEC-664 — the ADOPTION predicate: does this workspace use the CI matrix at all?
|
|
@@ -82,7 +83,7 @@ function readCiRuns(root) {
|
|
|
82
83
|
for (const n of names) {
|
|
83
84
|
let text;
|
|
84
85
|
try {
|
|
85
|
-
text =
|
|
86
|
+
text = (0, bounded_io_1.readRegularTextSync)(path.join(dir, n));
|
|
86
87
|
}
|
|
87
88
|
catch {
|
|
88
89
|
continue;
|
|
@@ -28,6 +28,35 @@ export interface IgnoreMatcher {
|
|
|
28
28
|
/** Format-level limits of this implementation, stated so a caller never has to infer them. */
|
|
29
29
|
limitations(): string[];
|
|
30
30
|
}
|
|
31
|
-
|
|
32
|
-
|
|
31
|
+
/** The cap on a `.gitignore` the matcher reads (round 12: a planted 2 MB file cost 1.6 s per path). */
|
|
32
|
+
export declare const IGNORE_FILE_CAP: number;
|
|
33
|
+
/** The most distinct rules a `.gitignore` may carry before none apply (round 13: bounded work per path). */
|
|
34
|
+
export declare const IGNORE_RULES_CAP = 10000;
|
|
35
|
+
/**
|
|
36
|
+
* The most pattern tokens one path's candidate rules may carry (round 13). The walk is O(tokens × path
|
|
37
|
+
* length) per candidate; a planted file of 10,000 rules sharing one literal cost 25 s over 600 paths
|
|
38
|
+
* (measured). Over the budget the path is treated as NOT ignored — every consumer skips ignored files,
|
|
39
|
+
* so the answer errs toward scanning more, never toward hiding — and the matcher reports it.
|
|
40
|
+
*/
|
|
41
|
+
export declare const IGNORE_PATH_TOKENS_BUDGET = 4000;
|
|
42
|
+
export declare function parseIgnore(content: string, extraUnsupported?: string[]): IgnoreMatcher;
|
|
43
|
+
/**
|
|
44
|
+
* Load the project-root `.gitignore`. A missing file ignores nothing.
|
|
45
|
+
* @implements A-SPEC-733 (round 12) — a non-blocking read of a REGULAR file at most 2 MB: a FIFO named
|
|
46
|
+
* `.gitignore` blocked every act that loads the file forever (measured); over the cap the file yields no
|
|
47
|
+
* rules and `unsupportedPatterns` names the size — toward scanning more, never less.
|
|
48
|
+
*/
|
|
33
49
|
export declare function loadIgnore(root: string): IgnoreMatcher;
|
|
50
|
+
/**
|
|
51
|
+
* @implements A-SPEC-733 (round 12) / A-SPEC-734 (round 10) — the project-root `.gitignore` read
|
|
52
|
+
* non-blocking, as a REGULAR file, at most 2 MiB: a FIFO there blocked every reader forever (measured,
|
|
53
|
+
* `loadIgnore` and `planSourceRenumber`). `bytes` is null with a reason: `missing`, `not a regular
|
|
54
|
+
* file`, `unreadable`, or the size refusal.
|
|
55
|
+
*/
|
|
56
|
+
export declare function readIgnoreFileSafely(root: string): {
|
|
57
|
+
bytes: Buffer;
|
|
58
|
+
reason: '';
|
|
59
|
+
} | {
|
|
60
|
+
bytes: null;
|
|
61
|
+
reason: string;
|
|
62
|
+
};
|