@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
|
@@ -76,9 +76,11 @@ export declare function pathFlavorFor(root: string, raw: string): path.PlatformP
|
|
|
76
76
|
* testable from either host (A-SPEC-465): production always passes the real `fs`.
|
|
77
77
|
*/
|
|
78
78
|
export interface ResolveFs {
|
|
79
|
-
lstatSync(p: string
|
|
79
|
+
lstatSync(p: string, o?: {
|
|
80
|
+
throwIfNoEntry: false;
|
|
81
|
+
}): {
|
|
80
82
|
isSymbolicLink(): boolean;
|
|
81
|
-
};
|
|
83
|
+
} | undefined;
|
|
82
84
|
readlinkSync(p: string): string;
|
|
83
85
|
realpathSync(p: string): string;
|
|
84
86
|
}
|
|
@@ -131,6 +133,98 @@ export declare function specTargetOf(root: string, specsDir: string, raw: string
|
|
|
131
133
|
* through a dangling link creates exactly the file it names.
|
|
132
134
|
*/
|
|
133
135
|
export declare function protectedFileKindOf(root: string, raw: string): string | null;
|
|
136
|
+
/**
|
|
137
|
+
* @implements A-SPEC-728
|
|
138
|
+
* `~`, `$HOME`/`${HOME}` and `$CODEX_HOME`/`${CODEX_HOME}` in a path argument, replaced by the values
|
|
139
|
+
* this process sees — or `null` when another variable is left, because its value is unknowable here.
|
|
140
|
+
*/
|
|
141
|
+
export declare function expandHomeSpelling(raw: string, env?: NodeJS.ProcessEnv, home?: string): string | null;
|
|
142
|
+
/** The `.ax` children that hold governance state — the same set the text rules name (A-SPEC-196 family). */
|
|
143
|
+
export declare const AX_PROTECTED_CHILDREN: readonly string[];
|
|
144
|
+
/** How a refusal names the `.ax` directory — the spec store and ledger, not session wiring. */
|
|
145
|
+
export declare const GOVERNANCE_STORE_LABEL = ".ax (the spec store and ledger)";
|
|
146
|
+
/** Every directory name that is judged as a whole: the session wiring directories and `.ax`. */
|
|
147
|
+
export declare const WIRING_DIR_NAMES: string[];
|
|
148
|
+
/** Every file name a wiring target can carry — `xargs`/`find` judge by name when paths are unknowable. */
|
|
149
|
+
export declare const WIRING_FILE_NAMES: string[];
|
|
150
|
+
export declare function withIdentCache<T>(fn: () => T): T;
|
|
151
|
+
/**
|
|
152
|
+
* @implements A-SPEC-728
|
|
153
|
+
* The user-level harness config a path lands on — `~/.claude/settings*.json`, or `config.toml` /
|
|
154
|
+
* `hooks.json` directly in a Codex home — or `null`. Judged by identity like the in-project check;
|
|
155
|
+
* `base` resolves a relative spelling.
|
|
156
|
+
*/
|
|
157
|
+
export declare function userHarnessConfigKindOf(raw: string, base: string, env?: NodeJS.ProcessEnv, home?: string): string | null;
|
|
158
|
+
/** A compiled glob. `test` is linear in the tested text (see `globPatternRe`); `source` is the regex it decides. */
|
|
159
|
+
export interface GlobMatcher {
|
|
160
|
+
test(s: string): boolean;
|
|
161
|
+
readonly source: string;
|
|
162
|
+
}
|
|
163
|
+
/**
|
|
164
|
+
* @implements A-SPEC-728 (round 2) — ONE glob translator for every rule: `*`, `?`, `[…]` with `!`/`^`
|
|
165
|
+
* negation and `[[:class:]]`, zsh `(a|b)` groups, and `**` spanning zero or more directories. With
|
|
166
|
+
* `dotfiles: false` (the shell), a leading `*`/`?`/`[` of a component does not match a dotfile; `find
|
|
167
|
+
* -name` passes `true`. Case-insensitive: identity is folded the same way.
|
|
168
|
+
* @implements A-SPEC-728 (rule 37) — matched by simulating the pattern's automaton, never by regex
|
|
169
|
+
* backtracking: 22 `**` + `/` groups in a 77-character deletion glob took the 20 s deadline (measured),
|
|
170
|
+
* and interleaved `*` components grow the same way. The language is the regex this translator wrote
|
|
171
|
+
* (`^…$`, case-insensitive, its top-level `|` included); the regex is still built to decide a spelling it
|
|
172
|
+
* cannot read, which is matched as literal text.
|
|
173
|
+
*/
|
|
174
|
+
export declare function globPatternRe(glob: string, dotfiles?: boolean): GlobMatcher;
|
|
175
|
+
/**
|
|
176
|
+
* @implements A-SPEC-728
|
|
177
|
+
* Which governance wiring target a deletion argument takes away, or `null`. Deleting a wiring file
|
|
178
|
+
* disarms the gate exactly as rewriting it does. A hit is the entry itself (a link is judged as the
|
|
179
|
+
* link — `rm` removes it, not its target), a directory holding one when the deletion is recursive,
|
|
180
|
+
* or a glob that can expand to one. `base` is the segment's working directory; `null` (unknowable)
|
|
181
|
+
* judges only absolute and home-relative arguments.
|
|
182
|
+
*/
|
|
183
|
+
export declare function wiringDeletionKindOf(root: string, base: string | null, arg: string, env?: NodeJS.ProcessEnv, home?: string, recursive?: boolean): string | null;
|
|
184
|
+
/**
|
|
185
|
+
* @implements A-SPEC-728 (round 11/14) — the directories under `<root>/.ax` a null-base segment MAY run in,
|
|
186
|
+
* keyed by the top-level `.ax` child (`.ax`, `.ax/<child>`): at most a dozen whatever the command's length.
|
|
187
|
+
* A candidate is a base the command stood in or a cd target it named; one that resolves inside the
|
|
188
|
+
* project is spelled under the root (real paths fold `/private/var` aliases and `.AX`).
|
|
189
|
+
*/
|
|
190
|
+
export interface AxCandidateKeys {
|
|
191
|
+
/** The `.ax` root (when a candidate stood there) and each protected child at its deepest depth (placeholders below). */
|
|
192
|
+
bases: string[];
|
|
193
|
+
/** Depths at which a candidate stood under an UNPROTECTED child: a segment climbing that many `..` lands at the root. */
|
|
194
|
+
climbDepths: Set<number>;
|
|
195
|
+
}
|
|
196
|
+
/** Where one candidate lies under `<root>/.ax`: the root itself, a protected child at a depth, an unprotected depth, or outside. */
|
|
197
|
+
export type AxPlacement = {
|
|
198
|
+
at: 'root';
|
|
199
|
+
} | {
|
|
200
|
+
at: 'child';
|
|
201
|
+
child: string;
|
|
202
|
+
depth: number;
|
|
203
|
+
} | {
|
|
204
|
+
at: 'climb';
|
|
205
|
+
depth: number;
|
|
206
|
+
} | null;
|
|
207
|
+
/**
|
|
208
|
+
* @implements A-SPEC-728 (rule 44) — `placed` remembers each candidate's placement across calls of one judgement: every stdin
|
|
209
|
+
* program's children carry their own list, and 300 `cd a` lines then 300 `bash -s` heredocs placed all 300 candidates again
|
|
210
|
+
* for each heredoc (2.9 s — measured).
|
|
211
|
+
*/
|
|
212
|
+
export declare function axCandidateKeys(root: string, candidates: Iterable<string>, maxDepth?: number, placed?: Map<string, AxPlacement>): AxCandidateKeys;
|
|
213
|
+
/**
|
|
214
|
+
* @implements A-SPEC-728 (rule 44) — the climb bases one segment is judged at: past 8 the command is refused as too large to
|
|
215
|
+
* judge (60 climbs of distinct depths after cds through a link `axl -> .ax`, at 256 KB, took 5.2 s — measured).
|
|
216
|
+
*/
|
|
217
|
+
export declare const AX_CLIMB_BASES_MAX = 8;
|
|
218
|
+
/** The placeholder bases a segment's own `..` climbs make relevant (one per climb count it uses that a candidate stood at). */
|
|
219
|
+
export declare function axClimbBases(root: string, keys: AxCandidateKeys, text: string): string[];
|
|
220
|
+
/**
|
|
221
|
+
* @implements A-SPEC-728
|
|
222
|
+
* Which governance wiring target a WRITE lands on, or `null`: the wiring file itself (followed
|
|
223
|
+
* through links — a write through a link writes its target), or a wiring directory itself (an
|
|
224
|
+
* archive or copy extracted into `~/.codex` can replace its hooks). The project root and the home
|
|
225
|
+
* directory are not wiring directories.
|
|
226
|
+
*/
|
|
227
|
+
export declare function wiringWriteKindOf(root: string, base: string, arg: string, env?: NodeJS.ProcessEnv, home?: string): string | null;
|
|
134
228
|
export declare function protectedKindOf(root: string, raw: string): string | null;
|
|
135
229
|
/**
|
|
136
230
|
* @implements A-SPEC-447
|
|
@@ -176,6 +270,77 @@ export interface PathImpl {
|
|
|
176
270
|
export interface ShellSegment {
|
|
177
271
|
text: string;
|
|
178
272
|
base: string | null;
|
|
273
|
+
data?: true;
|
|
274
|
+
interp?: true;
|
|
275
|
+
/** @implements A-SPEC-728 (round 11) — when `base` is unknown: every base the command has stood in and
|
|
276
|
+
* every cd target read so far (lexical, resolved at the moment) — the segment MAY run in any of them. */
|
|
277
|
+
maybe?: readonly string[];
|
|
278
|
+
/** @implements A-SPEC-734 (round 23) — the separator that follows this segment in its list (`&&`, `||`, `;`, `|`, …). */
|
|
279
|
+
sep?: string;
|
|
280
|
+
/** @implements A-SPEC-728 (rule 34) — a segment of a program string (`sh -c '…'`), emitted between its parent's pipeline
|
|
281
|
+
* stages: it neither joins nor ends the parent's pipeline. */
|
|
282
|
+
nested?: true;
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* @implements A-SPEC-728 (round 17)
|
|
286
|
+
* One shell word of a `cd`, reduced: adjacent quoted pieces join, a backslash escape drops. `null`
|
|
287
|
+
* when the shell would expand it (an unquoted `*`, `?`, `[`, `(`, `{`) or a quote is unterminated —
|
|
288
|
+
* the target is then unknowable, and a command that mentions `.ax` is judged in `.ax`.
|
|
289
|
+
*/
|
|
290
|
+
export declare function reduceCdWord(word: string): string | null;
|
|
291
|
+
/**
|
|
292
|
+
* @implements A-SPEC-728 (round 17)
|
|
293
|
+
* The directory a shell command is judged FROM: a Codex `workdir` (a relative one anchored at the payload
|
|
294
|
+
* `cwd` — round 18: rule 22's first draft computed that anchor and discarded it, so `cwd: sub` with
|
|
295
|
+
* `workdir: ../.ax/ledger` was judged in `sub` — measured), then the payload `cwd`; the first that is an
|
|
296
|
+
* existing directory inside the project root by identity, spelled under the root; otherwise the root.
|
|
297
|
+
* Measured before round 17: a session opened in `sub/` had `rm ../.mcp.json` judged at the root, where
|
|
298
|
+
* `..` leaves the project.
|
|
299
|
+
*/
|
|
300
|
+
export declare function shellBaseFor(root: string, workdir?: string, cwd?: string): string;
|
|
301
|
+
/**
|
|
302
|
+
* @implements A-SPEC-728 (round 21) — `env -S STRING` split as env splits it (GNU and BSD): single quotes are
|
|
303
|
+
* literal (`\\`, `\'` aside), double quotes and bare text take `\"`, `\\`, `\$`, `\#`, `\n`, `\t`, `\f`, `\v`,
|
|
304
|
+
* `\r`, `\_` (a separator outside quotes, a space inside); a `#` that begins a word is a comment to the end,
|
|
305
|
+
* `\c` stops; any `$` env would expand (`${VAR}`) makes the words unknowable (`dynamic`).
|
|
306
|
+
*/
|
|
307
|
+
export declare function envSplitWords(s: string): {
|
|
308
|
+
words: string[];
|
|
309
|
+
dynamic: boolean;
|
|
310
|
+
};
|
|
311
|
+
/**
|
|
312
|
+
* @implements A-SPEC-728 (round 19/20) — `env -S STRING` is split into words as env does and read IN
|
|
313
|
+
* PLACE (a `-C` inside it was skipped as an option value — measured, the ledger deleted). Round 20: env
|
|
314
|
+
* follows a `-S` inside a `-S` to any depth (measured to depth 5), so the split words go through an
|
|
315
|
+
* iterator STACK, linear in the text — round 19's four-expansion cap answered "no wrapper" on the fifth
|
|
316
|
+
* and failed open. The step limit, if ever reached, fails CLOSED (an ambiguous, unknown base).
|
|
317
|
+
* @implements A-SPEC-728 (round 21) — options are read getopt-style from each wrapper's table (bundled short
|
|
318
|
+
* letters, values glued or in the next word, unique GNU long prefixes, `--`); an option a table does not know,
|
|
319
|
+
* or an option word an expansion shapes, makes the base AMBIGUOUS, never "no wrapper". Split words are
|
|
320
|
+
* literal (a frame flag), so they are re-quoted for the judged text and never re-read as shell syntax.
|
|
321
|
+
*/
|
|
322
|
+
export declare function wrapperChdir(part: string): {
|
|
323
|
+
dirs: string[];
|
|
324
|
+
ambiguous: boolean;
|
|
325
|
+
rest: string;
|
|
326
|
+
} | null;
|
|
327
|
+
export declare function mentionsAxSpelling(command: string): boolean;
|
|
328
|
+
export declare function joinShellText(command: string): string;
|
|
329
|
+
/** The command-wide set of directories a shell command may run any part in, or why it cannot be known. */
|
|
330
|
+
export interface CommandBases {
|
|
331
|
+
bases: string[];
|
|
332
|
+
unknown: string | null;
|
|
333
|
+
/** A-SPEC-728 (round 24): no loop, function, trap, eval, source, shell -c program or expanded command word — text runs
|
|
334
|
+
* where it is written, so a consumer may use each segment's own base. */
|
|
335
|
+
ordered: boolean;
|
|
336
|
+
/** A-SPEC-728 (rule 39): every literal cd argument, read as a plain word (quotes removed, `~` expanded) — for a consumer
|
|
337
|
+
* that must ask, when the bases are unknown, whether one of them lands in the store. */
|
|
338
|
+
literal: string[];
|
|
179
339
|
}
|
|
180
|
-
export declare function
|
|
340
|
+
export declare function commandBases(command: string, start: string, given?: readonly ShellSegment[]): CommandBases;
|
|
341
|
+
export declare function shellSegments(command: string, startBase: string, depth?: number, opts?: {
|
|
342
|
+
programs?: boolean;
|
|
343
|
+
mutated?: boolean;
|
|
344
|
+
ax?: boolean;
|
|
345
|
+
}): ShellSegment[];
|
|
181
346
|
export declare function resolvesInside(raw: string, roots: readonly string[], impl?: PathImpl): boolean;
|