@holmes-lab/holmes-kit 0.29.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.
Files changed (169) hide show
  1. package/CHANGELOG.md +556 -0
  2. package/README.md +15 -5
  3. package/bin/holmes-hook-antigravity.js +4 -0
  4. package/bin/holmes-kit.js +4 -0
  5. package/bin/holmes-pre-push.js +3 -0
  6. package/bin/holmes-stop-antigravity.js +4 -0
  7. package/dist/.build-id +1 -1
  8. package/dist/holmes/cli/agents-guidance-history.d.ts +1 -1
  9. package/dist/holmes/cli/agents-guidance-history.js +11 -2
  10. package/dist/holmes/cli/agents-guidance.d.ts +1 -0
  11. package/dist/holmes/cli/agents-guidance.js +11 -8
  12. package/dist/holmes/cli/agents.d.ts +41 -0
  13. package/dist/holmes/cli/agents.js +382 -2
  14. package/dist/holmes/cli/attest.d.ts +2 -0
  15. package/dist/holmes/cli/attest.js +66 -15
  16. package/dist/holmes/cli/ci-gate.js +16 -1
  17. package/dist/holmes/cli/claude-switches.d.ts +95 -0
  18. package/dist/holmes/cli/claude-switches.js +967 -0
  19. package/dist/holmes/cli/codex-hooks.d.ts +77 -0
  20. package/dist/holmes/cli/codex-hooks.js +802 -0
  21. package/dist/holmes/cli/codex-oracle.d.ts +194 -0
  22. package/dist/holmes/cli/codex-oracle.js +1245 -0
  23. package/dist/holmes/cli/codex-toml.d.ts +58 -1
  24. package/dist/holmes/cli/codex-toml.js +456 -40
  25. package/dist/holmes/cli/doctor.d.ts +108 -8
  26. package/dist/holmes/cli/doctor.js +1408 -98
  27. package/dist/holmes/cli/index.js +23 -11
  28. package/dist/holmes/cli/init.d.ts +13 -0
  29. package/dist/holmes/cli/init.js +749 -77
  30. package/dist/holmes/cli/interactive-prompt.js +2 -2
  31. package/dist/holmes/cli/mcp-launcher.d.ts +64 -6
  32. package/dist/holmes/cli/mcp-launcher.js +189 -6
  33. package/dist/holmes/cli/mcp-version.js +13 -2
  34. package/dist/holmes/cli/settings-merge.js +8 -2
  35. package/dist/holmes/cli/upgrade.d.ts +13 -0
  36. package/dist/holmes/cli/upgrade.js +116 -23
  37. package/dist/holmes/cli/workspace-scope.d.ts +22 -0
  38. package/dist/holmes/cli/workspace-scope.js +375 -0
  39. package/dist/holmes/cli/worktree-readiness.d.ts +1 -0
  40. package/dist/holmes/cli/worktree-readiness.js +17 -3
  41. package/dist/holmes/cpg/cpg-scanner.d.ts +29 -0
  42. package/dist/holmes/cpg/cpg-scanner.js +403 -3
  43. package/dist/holmes/cpg/cycle-detect.js +2 -1
  44. package/dist/holmes/cpg/forbidden-edges.js +9 -2
  45. package/dist/holmes/cpg/required-calls.js +8 -1
  46. package/dist/holmes/governance/autonomy.d.ts +9 -0
  47. package/dist/holmes/governance/autonomy.js +28 -1
  48. package/dist/holmes/governance/constitution-debt.js +3 -2
  49. package/dist/holmes/governance/constitution.js +15 -3
  50. package/dist/holmes/governance/provenance-chain.js +3 -2
  51. package/dist/holmes/governance/push-gate-runner.js +4 -3
  52. package/dist/holmes/guardrail/dependency-delta.js +4 -3
  53. package/dist/holmes/guardrail/linear-match.d.ts +57 -0
  54. package/dist/holmes/guardrail/linear-match.js +256 -0
  55. package/dist/holmes/guardrail/risk-classifier.d.ts +6 -7
  56. package/dist/holmes/guardrail/risk-classifier.js +931 -44
  57. package/dist/holmes/guardrail/risk-types.d.ts +6 -0
  58. package/dist/holmes/guardrail/scope-judgment.d.ts +4 -24
  59. package/dist/holmes/guardrail/scope-judgment.js +100 -23
  60. package/dist/holmes/guardrail/shell-words.d.ts +42 -0
  61. package/dist/holmes/guardrail/shell-words.js +1720 -0
  62. package/dist/holmes/guardrail/write-target.d.ts +168 -3
  63. package/dist/holmes/guardrail/write-target.js +2379 -87
  64. package/dist/holmes/hooks/adapters/antigravity.d.ts +3 -1
  65. package/dist/holmes/hooks/adapters/antigravity.js +115 -11
  66. package/dist/holmes/hooks/pre-tool-use.d.ts +32 -6
  67. package/dist/holmes/hooks/pre-tool-use.js +923 -87
  68. package/dist/holmes/hooks/rtm-refresh-child.d.ts +22 -1
  69. package/dist/holmes/hooks/rtm-refresh-child.js +102 -18
  70. package/dist/holmes/hooks/rtm-refresh.d.ts +20 -1
  71. package/dist/holmes/hooks/rtm-refresh.js +60 -15
  72. package/dist/holmes/hooks/session-start.d.ts +10 -0
  73. package/dist/holmes/hooks/session-start.js +31 -7
  74. package/dist/holmes/hooks/stop.d.ts +2 -1
  75. package/dist/holmes/hooks/stop.js +197 -91
  76. package/dist/holmes/mcp/approval-adapters.d.ts +22 -0
  77. package/dist/holmes/mcp/approval-adapters.js +21 -0
  78. package/dist/holmes/mcp/approval-commit.d.ts +20 -0
  79. package/dist/holmes/mcp/approval-commit.js +108 -0
  80. package/dist/holmes/mcp/approval-intent.d.ts +44 -0
  81. package/dist/holmes/mcp/approval-intent.js +67 -0
  82. package/dist/holmes/mcp/approval-policy.d.ts +14 -0
  83. package/dist/holmes/mcp/approval-policy.js +18 -0
  84. package/dist/holmes/mcp/elicit-approval.d.ts +2 -0
  85. package/dist/holmes/mcp/elicit-approval.js +8 -3
  86. package/dist/holmes/mcp/handlers/graph-operations.d.ts +17 -1
  87. package/dist/holmes/mcp/handlers/graph-operations.js +15 -6
  88. package/dist/holmes/mcp/handlers/maintenance-analysis.js +11 -5
  89. package/dist/holmes/mcp/handlers/maintenance-evidence.js +3 -2
  90. package/dist/holmes/mcp/handlers/phase-queries.d.ts +22 -7
  91. package/dist/holmes/mcp/handlers/phase-queries.js +81 -2
  92. package/dist/holmes/mcp/handlers/requirement-triage.d.ts +26 -0
  93. package/dist/holmes/mcp/handlers/requirement-triage.js +48 -11
  94. package/dist/holmes/mcp/handlers/review-evidence.d.ts +2 -1
  95. package/dist/holmes/mcp/handlers/review-evidence.js +15 -5
  96. package/dist/holmes/mcp/handlers/slice-orchestration.d.ts +18 -0
  97. package/dist/holmes/mcp/handlers/slice-orchestration.js +122 -16
  98. package/dist/holmes/mcp/handlers/spec-approval.d.ts +35 -2
  99. package/dist/holmes/mcp/handlers/spec-approval.js +175 -57
  100. package/dist/holmes/mcp/handlers/spec-authoring.js +36 -3
  101. package/dist/holmes/mcp/handlers/spec-queries.d.ts +39 -3
  102. package/dist/holmes/mcp/handlers/spec-queries.js +114 -7
  103. package/dist/holmes/mcp/handlers/test-execution.js +9 -3
  104. package/dist/holmes/mcp/handlers.d.ts +126 -8
  105. package/dist/holmes/mcp/handlers.js +109 -18
  106. package/dist/holmes/mcp/harness-attestation.d.ts +20 -0
  107. package/dist/holmes/mcp/harness-attestation.js +179 -0
  108. package/dist/holmes/mcp/maintenance-analyze.js +28 -4
  109. package/dist/holmes/mcp/maintenance-evidence.js +1 -1
  110. package/dist/holmes/mcp/requirement-triage-evidence.d.ts +72 -2
  111. package/dist/holmes/mcp/requirement-triage-evidence.js +227 -1
  112. package/dist/holmes/mcp/server.js +24 -3
  113. package/dist/holmes/mcp/supervisor.js +7 -3
  114. package/dist/holmes/mcp/tool-schemas.d.ts +8 -0
  115. package/dist/holmes/mcp/tool-schemas.js +54 -7
  116. package/dist/holmes/mcp/validate-args.js +12 -0
  117. package/dist/holmes/project/bounded-io.d.ts +102 -0
  118. package/dist/holmes/project/bounded-io.js +212 -0
  119. package/dist/holmes/project/change-source.js +3 -1
  120. package/dist/holmes/project/ci-runs.js +3 -2
  121. package/dist/holmes/project/ignore.d.ts +31 -2
  122. package/dist/holmes/project/ignore.js +409 -50
  123. package/dist/holmes/project/regular-file-guard.d.ts +13 -0
  124. package/dist/holmes/project/regular-file-guard.js +149 -0
  125. package/dist/holmes/project/root.js +12 -3
  126. package/dist/holmes/refresh/freshness-coordinator.d.ts +67 -0
  127. package/dist/holmes/refresh/freshness-coordinator.js +230 -0
  128. package/dist/holmes/reverse/anchor.js +4 -3
  129. package/dist/holmes/reverse/scan.js +6 -2
  130. package/dist/holmes/review/commit-text.js +3 -2
  131. package/dist/holmes/review/condition-hunk-replay.d.ts +12 -0
  132. package/dist/holmes/review/condition-hunk-replay.js +13 -2
  133. package/dist/holmes/review/condition-hunk-resolution.js +59 -8
  134. package/dist/holmes/review/failed-test-names.js +13 -10
  135. package/dist/holmes/review/findings.js +3 -1
  136. package/dist/holmes/review/kills-check.js +6 -1
  137. package/dist/holmes/review/point-in-time-replay.js +5 -4
  138. package/dist/holmes/review/replay-corpus.js +5 -4
  139. package/dist/holmes/review/requirement-triage-human-records.d.ts +59 -0
  140. package/dist/holmes/review/requirement-triage-human-records.js +119 -0
  141. package/dist/holmes/review/run-replay.js +3 -2
  142. package/dist/holmes/review/scope.js +6 -1
  143. package/dist/holmes/review/temporal-prior.js +3 -2
  144. package/dist/holmes/review/test-evidence.js +3 -2
  145. package/dist/holmes/review/test-outcomes.d.ts +28 -0
  146. package/dist/holmes/review/test-outcomes.js +92 -2
  147. package/dist/holmes/review/test-runner.d.ts +6 -0
  148. package/dist/holmes/review/test-runner.js +36 -15
  149. package/dist/holmes/rtm/advisory-outcomes.js +3 -2
  150. package/dist/holmes/rtm/anchor-ids.js +42 -2
  151. package/dist/holmes/rtm/file-anchors.js +4 -1
  152. package/dist/holmes/rtm/ftt-fulfilment.js +8 -3
  153. package/dist/holmes/rtm/git-changes.js +3 -1
  154. package/dist/holmes/rtm/graph-store.js +3 -2
  155. package/dist/holmes/rtm/test-scope.js +9 -4
  156. package/dist/holmes/spec/compat-impact.d.ts +25 -4
  157. package/dist/holmes/spec/compat-impact.js +682 -11
  158. package/dist/holmes/spec/entity-git-snapshot.js +3 -2
  159. package/dist/holmes/spec/entity-integration.js +3 -2
  160. package/dist/holmes/spec/entity-renumber-transaction.d.ts +19 -0
  161. package/dist/holmes/spec/entity-renumber-transaction.js +79 -6
  162. package/dist/holmes/spec/remote-spec-refs.js +3 -2
  163. package/dist/holmes/spec/renumber.js +25 -10
  164. package/dist/holmes/spec/spec-parser.js +9 -3
  165. package/dist/holmes/spec/yaml-scalar.js +2 -2
  166. package/dist/holmes/update/refresh.js +3 -1
  167. package/dist/holmes/update/update-notice.d.ts +6 -0
  168. package/dist/holmes/update/update-notice.js +18 -1
  169. package/package.json +11 -4
@@ -0,0 +1,95 @@
1
+ import type { Check } from './doctor-check';
2
+ export interface ClaudeSwitchEnv {
3
+ home: string;
4
+ /** `$CLAUDE_CONFIG_DIR`: where Claude reads the user's settings instead of `~/.claude`. */
5
+ claudeConfigDir?: string;
6
+ /** Directories holding `managed-settings.json` and `managed-settings.d/*.json`. */
7
+ managedDirs: string[];
8
+ /** Round 42: `$CLAUDE_CODE_CUSTOM_OAUTH_URL` is set — Claude's global config is then `.claude-custom-oauth.json`. */
9
+ customOauth?: boolean;
10
+ /** Round 43: `$CLAUDE_CONFIG_DIR` exactly as set (empty and whitespace included) — Claude computes the global config from it. */
11
+ rawConfigDir?: string;
12
+ }
13
+ /** The managed-settings folders Claude Code reads on each platform. */
14
+ export declare function managedSettingsDirs(platform?: NodeJS.Platform): string[];
15
+ export declare function claudeSwitchEnv(): ClaudeSwitchEnv;
16
+ /** Claude's user settings file: `$CLAUDE_CONFIG_DIR/settings.json`, else `~/.claude/settings.json`. */
17
+ export declare function claudeUserSettingsPath(env: ClaudeSwitchEnv): string | null;
18
+ /**
19
+ * @implements A-SPEC-251.2 (round 35) — the largest settings file Claude Code 2.1.281 reads (`size > maxBytes` is
20
+ * ERR_FILE_TOO_LARGE, and the file applies nothing): a 3 MiB file holding Holmes's hooks read PASS and "enforced" (measured).
21
+ */
22
+ export declare const CLAUDE_SETTINGS_MAX_BYTES: number;
23
+ /** The first `max` bytes of a regular file as text (a `.git` file, `commondir`, `gitdir`), or null. Never blocks on a FIFO. */
24
+ export declare function readFileHead(file: string, max?: number): string | null;
25
+ /**
26
+ * @implements A-SPEC-251.2 (round 35) — a path resolved one component at a time as the kernel resolves a command (`..` from
27
+ * the real path so far), never looking up a network or device path (`/net/<host>`, `//host`, `\\host`): Claude's and
28
+ * Antigravity's wirings reached `realpath` on an automounter path (code reading, lookups intercepted — measured).
29
+ */
30
+ export declare function localPhysicalRealpath(p: string, budget?: {
31
+ left: number;
32
+ }): {
33
+ path: string | null;
34
+ refused: boolean;
35
+ exhausted?: true;
36
+ };
37
+ export declare function isClaudeEvent(name: string): boolean;
38
+ /**
39
+ * @implements A-SPEC-251.2 (round 35) — where Claude 2.1.281 also reads local settings (`lU`, `pOo`, `Bme`): the canonical git
40
+ * root — the nearest `.git` directory's checkout, or a `.git` file's main checkout (its `commondir` named `.git`) — when it is
41
+ * neither the target nor the home directory and, on POSIX, it, its `.git` and its `.claude` (if any) belong to this user. A
42
+ * root's `disableAllHooks` read PASS from a monorepo package and a linked worktree (measured). Network paths are not followed.
43
+ */
44
+ export declare function canonicalLocalSettingsPath(target: string, home: string): string | null;
45
+ /**
46
+ * Why Claude Code applies NOTHING from this settings file, or null.
47
+ *
48
+ * @implements A-SPEC-251.2 (round 34) — Claude 2.1.281's loader (`Pf`, `Tf`, `zt`, `gc`) transcribed: a PreToolUse/
49
+ * PermissionRequest hook it cannot load, or one declared outside `hooks`, makes it apply nothing in the file ("nothing it
50
+ * sits in is applied"). Round 33 read a few shapes and PASSed 24 others (`timeout: 0`, `matcher: null`, a top-level
51
+ * `"PreToolUse"` — measured); it also refused files Claude loads (a `"matcher"` key beside the events). What Claude only warns
52
+ * about and drops (an unknown event, another event's bad group) does not drop the file. The rest of Claude's settings schema
53
+ * (which can also drop a file) is not read.
54
+ */
55
+ export declare function claudeDropsFile(raw: unknown): string | null;
56
+ /**
57
+ * @implements A-SPEC-251.2 (round 42) — a script path that does not depend on the directory the harness runs its hook in:
58
+ * POSIX `/…`, Windows `X:\…` or UNC. Claude runs a command hook in the session's current directory, so a relative gate script
59
+ * failed with "Cannot find module" (exit 1, non-blocking) after one `cd src` while doctor read PASS (measured).
60
+ */
61
+ export declare function isAbsoluteScript(p: string): boolean;
62
+ /**
63
+ * @implements A-SPEC-251.2 (round 43) — a string from a file, safe to print: control characters are escaped (an `env` key holding
64
+ * ESC and BEL retitled the terminal and cleared the screen through doctor and init — measured).
65
+ */
66
+ export declare function printable(s: string): string;
67
+ export interface ClaudeSwitches {
68
+ /** Files (with the setting) that switch every hook off here — the Holmes gate included. */
69
+ hooksOff: string[];
70
+ /** Files (with the setting) that reject or deny Holmes's MCP tools. */
71
+ toolsOff: string[];
72
+ /** Files that exist but could not be read as settings. */
73
+ unreadable: string[];
74
+ /** Files Claude applies nothing from (an unloadable guard entry) that do not hold Holmes's hooks. */
75
+ notApplied: string[];
76
+ /** Why the gate is not confirmed to block (round 39: a gate entry of another shape than init's, or a shell prefix). */
77
+ unconfirmed: string[];
78
+ /** Round 40: switches that turn off every non-managed hook while a managed gate still runs (WARN, not FAIL). */
79
+ spared: string[];
80
+ /** Round 40: the scripts the canonical gate entries run (for a caller that knows which install is this one). */
81
+ gateScripts: string[];
82
+ /** Round 40: files wiring Holmes's other hooks with no Holmes PreToolUse gate anywhere Claude applies. */
83
+ noGate: string[];
84
+ }
85
+ /**
86
+ * @implements A-SPEC-251.2 (round 50) — `planned`: settings files by path with the content init is about to write, judged in
87
+ * place of what is on disk (a first init said "enforced" over an entry doctor and the next init called not confirmed).
88
+ */
89
+ export declare function claudeSwitches(target: string, env?: ClaudeSwitchEnv, planned?: ReadonlyMap<string, string>): ClaudeSwitches;
90
+ /**
91
+ * `script` is which install a canonical gate entry's script belongs to: this one, another existing one, or none (a missing
92
+ * file). Given by doctor, which knows this install; absent, the scripts are not judged.
93
+ */
94
+ export type GateScriptOwner = (script: string) => 'this' | 'other' | 'missing' | 'unknown';
95
+ export declare function claudeHookSwitchesCheck(target: string, env?: ClaudeSwitchEnv, owner?: GateScriptOwner): Check;