@holmes-lab/holmes-kit 0.29.0 → 0.30.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 (65) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +6 -5
  3. package/dist/.build-id +1 -1
  4. package/dist/holmes/cli/agents-guidance-history.d.ts +1 -1
  5. package/dist/holmes/cli/agents-guidance-history.js +11 -2
  6. package/dist/holmes/cli/agents-guidance.d.ts +1 -0
  7. package/dist/holmes/cli/agents-guidance.js +11 -8
  8. package/dist/holmes/cli/codex-toml.d.ts +23 -1
  9. package/dist/holmes/cli/codex-toml.js +151 -4
  10. package/dist/holmes/cli/doctor.d.ts +11 -1
  11. package/dist/holmes/cli/doctor.js +88 -12
  12. package/dist/holmes/cli/init.d.ts +2 -0
  13. package/dist/holmes/cli/init.js +20 -40
  14. package/dist/holmes/cli/interactive-prompt.js +2 -2
  15. package/dist/holmes/cli/worktree-readiness.d.ts +1 -0
  16. package/dist/holmes/cli/worktree-readiness.js +17 -3
  17. package/dist/holmes/governance/autonomy.d.ts +9 -0
  18. package/dist/holmes/governance/autonomy.js +28 -1
  19. package/dist/holmes/hooks/rtm-refresh-child.d.ts +22 -1
  20. package/dist/holmes/hooks/rtm-refresh-child.js +100 -18
  21. package/dist/holmes/hooks/rtm-refresh.d.ts +20 -1
  22. package/dist/holmes/hooks/rtm-refresh.js +56 -15
  23. package/dist/holmes/mcp/approval-adapters.d.ts +22 -0
  24. package/dist/holmes/mcp/approval-adapters.js +21 -0
  25. package/dist/holmes/mcp/approval-commit.d.ts +21 -0
  26. package/dist/holmes/mcp/approval-commit.js +92 -0
  27. package/dist/holmes/mcp/approval-intent.d.ts +44 -0
  28. package/dist/holmes/mcp/approval-intent.js +67 -0
  29. package/dist/holmes/mcp/approval-policy.d.ts +14 -0
  30. package/dist/holmes/mcp/approval-policy.js +18 -0
  31. package/dist/holmes/mcp/elicit-approval.d.ts +2 -0
  32. package/dist/holmes/mcp/elicit-approval.js +5 -2
  33. package/dist/holmes/mcp/handlers/graph-operations.d.ts +17 -1
  34. package/dist/holmes/mcp/handlers/graph-operations.js +13 -5
  35. package/dist/holmes/mcp/handlers/maintenance-evidence.js +1 -1
  36. package/dist/holmes/mcp/handlers/requirement-triage.d.ts +26 -0
  37. package/dist/holmes/mcp/handlers/requirement-triage.js +45 -10
  38. package/dist/holmes/mcp/handlers/review-evidence.d.ts +2 -1
  39. package/dist/holmes/mcp/handlers/review-evidence.js +9 -5
  40. package/dist/holmes/mcp/handlers/slice-orchestration.d.ts +7 -0
  41. package/dist/holmes/mcp/handlers/slice-orchestration.js +8 -1
  42. package/dist/holmes/mcp/handlers/spec-approval.d.ts +26 -2
  43. package/dist/holmes/mcp/handlers/spec-approval.js +72 -47
  44. package/dist/holmes/mcp/handlers/spec-authoring.js +20 -2
  45. package/dist/holmes/mcp/handlers.d.ts +46 -0
  46. package/dist/holmes/mcp/handlers.js +57 -13
  47. package/dist/holmes/mcp/maintenance-analyze.js +28 -4
  48. package/dist/holmes/mcp/maintenance-evidence.js +1 -1
  49. package/dist/holmes/mcp/requirement-triage-evidence.d.ts +36 -2
  50. package/dist/holmes/mcp/requirement-triage-evidence.js +71 -1
  51. package/dist/holmes/mcp/server.js +5 -3
  52. package/dist/holmes/mcp/supervisor.js +7 -3
  53. package/dist/holmes/mcp/tool-schemas.d.ts +8 -0
  54. package/dist/holmes/mcp/tool-schemas.js +31 -1
  55. package/dist/holmes/refresh/freshness-coordinator.d.ts +67 -0
  56. package/dist/holmes/refresh/freshness-coordinator.js +230 -0
  57. package/dist/holmes/review/condition-hunk-replay.d.ts +12 -0
  58. package/dist/holmes/review/condition-hunk-replay.js +11 -1
  59. package/dist/holmes/review/condition-hunk-resolution.js +59 -8
  60. package/dist/holmes/review/requirement-triage-human-records.d.ts +59 -0
  61. package/dist/holmes/review/requirement-triage-human-records.js +119 -0
  62. package/dist/holmes/review/scope.js +6 -1
  63. package/dist/holmes/review/test-outcomes.d.ts +28 -0
  64. package/dist/holmes/review/test-outcomes.js +90 -1
  65. package/package.json +1 -1
@@ -33,20 +33,109 @@ var __importStar = (this && this.__importStar) || (function () {
33
33
  };
34
34
  })();
35
35
  Object.defineProperty(exports, "__esModule", { value: true });
36
- exports.OUTCOMES_FILE = void 0;
36
+ exports.RELEASE_TEST_LANE_SCHEMA = exports.RELEASE_TEST_LANE_FILE = exports.OUTCOMES_FILE = void 0;
37
+ exports.writeReleaseTestLaneReceipt = writeReleaseTestLaneReceipt;
38
+ exports.validateReleaseTestLaneReceipt = validateReleaseTestLaneReceipt;
37
39
  exports.outcomesFilename = outcomesFilename;
38
40
  exports.isOutcomesFilename = isOutcomesFilename;
39
41
  exports.appendOutcomes = appendOutcomes;
40
42
  exports.readOutcomes = readOutcomes;
41
43
  exports.buildOutcomeRecords = buildOutcomeRecords;
42
44
  exports.groupOutcomesByAspec = groupOutcomesByAspec;
45
+ // @implements A-SPEC-724.1, A-SPEC-714
43
46
  // @implements A-SPEC-534.3, A-SPEC-625
44
47
  // @implements A-SPEC-645
48
+ const node_crypto_1 = require("node:crypto");
45
49
  const execution_context_1 = require("../project/execution-context");
46
50
  const fs = __importStar(require("node:fs"));
47
51
  const path = __importStar(require("node:path"));
48
52
  const replica_id_1 = require("../governance/replica-id");
49
53
  exports.OUTCOMES_FILE = path.join('.ax', 'ledger', 'test-outcomes.jsonl');
54
+ exports.RELEASE_TEST_LANE_FILE = path.join('.ax', 'evidence', 'release-test-lane.json');
55
+ exports.RELEASE_TEST_LANE_SCHEMA = 'release-test-lane/1';
56
+ const RELEASE_TEST_LANE_MAX_AGE_MS = 24 * 60 * 60 * 1000;
57
+ const stableReceipt = (receipt) => JSON.stringify({
58
+ schema: receipt.schema, root: receipt.root, head: receipt.head, completedAt: receipt.completedAt,
59
+ passed: receipt.passed, externalAccess: receipt.externalAccess, command: receipt.command,
60
+ include: receipt.include, exclusions: receipt.exclusions,
61
+ });
62
+ const releaseReceiptDigest = (receipt) => `sha256:${(0, node_crypto_1.createHash)('sha256').update(stableReceipt(receipt)).digest('hex')}`;
63
+ /** Persist only evidence whose scope is explicit and bounded; callers cannot choose its path. */
64
+ function writeReleaseTestLaneReceipt(root, input) {
65
+ // The writer owns the current schema; only persisted input is required to
66
+ // state it explicitly so an older or unknown schema cannot be reinterpreted.
67
+ const receipt = normalizeReleaseTestLaneReceipt(root, { ...input, schema: exports.RELEASE_TEST_LANE_SCHEMA });
68
+ if (receipt === null)
69
+ return null;
70
+ const file = path.join(path.resolve(root), exports.RELEASE_TEST_LANE_FILE);
71
+ const tmp = `${file}.${process.pid}.${Date.now()}.tmp`;
72
+ try {
73
+ fs.mkdirSync(path.dirname(file), { recursive: true });
74
+ fs.writeFileSync(tmp, `${JSON.stringify(receipt)}\n`, { encoding: 'utf8', mode: 0o600 });
75
+ fs.renameSync(tmp, file);
76
+ return receipt;
77
+ }
78
+ catch {
79
+ try {
80
+ fs.unlinkSync(tmp);
81
+ }
82
+ catch { /* no partial receipt is valid */ }
83
+ return null;
84
+ }
85
+ }
86
+ /** Read the sole project-local receipt and fail closed for every missing or unprovable condition. */
87
+ function validateReleaseTestLaneReceipt(root, head, now = Date.now()) {
88
+ const expectedRoot = path.resolve(root);
89
+ if (typeof head !== 'string' || head === '' || head.includes('/') || head.includes('\\'))
90
+ return { valid: false, reason: 'invalid current HEAD' };
91
+ let parsed;
92
+ try {
93
+ parsed = JSON.parse(fs.readFileSync(path.join(expectedRoot, exports.RELEASE_TEST_LANE_FILE), 'utf8'));
94
+ }
95
+ catch {
96
+ return { valid: false, reason: 'release test-lane receipt is absent or malformed' };
97
+ }
98
+ const receipt = normalizeReleaseTestLaneReceipt(expectedRoot, parsed);
99
+ if (receipt === null)
100
+ return { valid: false, reason: 'release test-lane receipt omits required bounded scope or policy' };
101
+ if (receipt.digest !== parsed.digest)
102
+ return { valid: false, reason: 'release test-lane receipt digest is invalid' };
103
+ if (receipt.root !== expectedRoot)
104
+ return { valid: false, reason: 'release test-lane receipt belongs to a different root' };
105
+ if (receipt.head !== head)
106
+ return { valid: false, reason: 'release test-lane receipt HEAD does not match' };
107
+ const completedMs = Date.parse(receipt.completedAt);
108
+ if (!Number.isFinite(completedMs) || completedMs > now || now - completedMs > RELEASE_TEST_LANE_MAX_AGE_MS) {
109
+ return { valid: false, reason: 'release test-lane receipt is stale or has an invalid timestamp' };
110
+ }
111
+ return { valid: true, receipt };
112
+ }
113
+ function normalizeReleaseTestLaneReceipt(root, input) {
114
+ if (!input || typeof input !== 'object')
115
+ return null;
116
+ const value = input;
117
+ const rootPath = path.resolve(root);
118
+ if (value.schema !== exports.RELEASE_TEST_LANE_SCHEMA
119
+ || typeof value.root !== 'string' || path.resolve(value.root) !== rootPath || value.root !== rootPath
120
+ || typeof value.head !== 'string' || value.head === '' || /[\\/]/.test(value.head)
121
+ || typeof value.completedAt !== 'string' || !Number.isFinite(Date.parse(value.completedAt))
122
+ || value.passed !== true || value.externalAccess !== 'forbidden')
123
+ return null;
124
+ if (!Array.isArray(value.command) || value.command.some((part) => typeof part !== 'string' || part === '')
125
+ || value.command.length < 5 || value.command[0] !== 'npm' || value.command[1] !== 'test'
126
+ || value.command[2] !== '--' || !value.command.includes('--runInBand')
127
+ || !value.command.some((part) => part.startsWith('--testPathIgnorePatterns=')))
128
+ return null;
129
+ if (!Array.isArray(value.include) || value.include.length === 0 || value.include.some((part) => typeof part !== 'string' || part.trim() === ''))
130
+ return null;
131
+ if (!Array.isArray(value.exclusions) || value.exclusions.length === 0 || value.exclusions.some((entry) => !entry || typeof entry.pattern !== 'string'
132
+ || entry.pattern.trim() === '' || entry.pattern.includes('..') || typeof entry.reason !== 'string' || entry.reason.trim() === ''))
133
+ return null;
134
+ const unsigned = { schema: exports.RELEASE_TEST_LANE_SCHEMA, root: rootPath, head: value.head, completedAt: value.completedAt,
135
+ passed: true, externalAccess: 'forbidden', command: [...value.command], include: [...value.include],
136
+ exclusions: value.exclusions.map((entry) => ({ pattern: entry.pattern, reason: entry.reason })) };
137
+ return { ...unsigned, digest: releaseReceiptDigest(unsigned) };
138
+ }
50
139
  // @implements A-SPEC-562.1 — outcomes join the ledger's REPLICA convention (A-SPEC-148): one file per
51
140
  // machine, so two machines appending never conflict on merge and a colleague's clone carries both
52
141
  // histories. The shape mirrors `isLedgerFilename` exactly — legacy single file OR a dot-free segment —
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "//": "@implements A-SPEC-209",
3
3
  "name": "@holmes-lab/holmes-kit",
4
- "version": "0.29.0",
4
+ "version": "0.30.0",
5
5
  "description": "Holmes-Kit — deterministic Agentic Software Engineering (ASE) harness with causal traceability (spec chain + D-CPG + RTM + phase guardrail)",
6
6
  "main": "dist/holmes/mcp/server.js",
7
7
  "types": "dist/holmes/mcp/server.d.ts",