@holmes-lab/holmes-kit 0.35.25 → 0.36.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 +298 -0
- package/README.md +3 -2
- package/dist/.build-id +1 -1
- package/dist/holmes/cli/approve-status.js +4 -1
- package/dist/holmes/cli/approve-watch.js +3 -1
- package/dist/holmes/cli/approve.d.ts +10 -0
- package/dist/holmes/cli/approve.js +31 -1
- package/dist/holmes/cli/claude-switches.d.ts +7 -1
- package/dist/holmes/cli/claude-switches.js +11 -7
- package/dist/holmes/cli/codex-toml.d.ts +3 -0
- package/dist/holmes/cli/codex-toml.js +2 -1
- package/dist/holmes/cli/doctor.d.ts +25 -1
- package/dist/holmes/cli/doctor.js +153 -7
- package/dist/holmes/cli/index.js +99 -4
- package/dist/holmes/cli/init.js +4 -3
- package/dist/holmes/cli/os-notify.d.ts +3 -1
- package/dist/holmes/cli/os-notify.js +10 -4
- package/dist/holmes/cli/review.d.ts +25 -0
- package/dist/holmes/cli/review.js +111 -0
- package/dist/holmes/cli/roles-readme.d.ts +11 -0
- package/dist/holmes/cli/roles-readme.js +38 -16
- package/dist/holmes/cli/roles.d.ts +12 -0
- package/dist/holmes/cli/roles.js +86 -0
- package/dist/holmes/cli/run.d.ts +65 -0
- package/dist/holmes/cli/run.js +308 -0
- package/dist/holmes/cli/runtime-binding.d.ts +30 -0
- package/dist/holmes/cli/runtime-binding.js +96 -7
- package/dist/holmes/cli/test-platform.d.ts +16 -0
- package/dist/holmes/cli/test-platform.js +31 -1
- package/dist/holmes/config/config.d.ts +49 -0
- package/dist/holmes/config/config.js +146 -3
- package/dist/holmes/config/project-caps.d.ts +21 -0
- package/dist/holmes/config/project-caps.js +114 -0
- package/dist/holmes/governance/approval-queue.d.ts +17 -3
- package/dist/holmes/governance/approval-queue.js +48 -6
- package/dist/holmes/governance/autonomy.d.ts +6 -0
- package/dist/holmes/governance/autonomy.js +21 -0
- package/dist/holmes/governance/push-gate-runner.d.ts +8 -0
- package/dist/holmes/governance/push-gate-runner.js +49 -1
- package/dist/holmes/governance/replica-id.d.ts +9 -0
- package/dist/holmes/governance/replica-id.js +44 -7
- package/dist/holmes/governance/role-policy.d.ts +41 -1
- package/dist/holmes/governance/role-policy.js +137 -20
- package/dist/holmes/governance/run-mode.d.ts +14 -0
- package/dist/holmes/governance/run-mode.js +120 -0
- package/dist/holmes/governance/tool-actions.d.ts +30 -0
- package/dist/holmes/governance/tool-actions.js +121 -0
- package/dist/holmes/guardrail/agent-launch-policy.d.ts +15 -0
- package/dist/holmes/guardrail/agent-launch-policy.js +177 -0
- package/dist/holmes/guardrail/classification-mode.d.ts +17 -0
- package/dist/holmes/guardrail/classification-mode.js +135 -0
- package/dist/holmes/guardrail/dynamic-write.d.ts +43 -0
- package/dist/holmes/guardrail/dynamic-write.js +304 -0
- package/dist/holmes/guardrail/phase.d.ts +2 -1
- package/dist/holmes/guardrail/phase.js +22 -8
- package/dist/holmes/guardrail/powershell-shell.d.ts +21 -0
- package/dist/holmes/guardrail/powershell-shell.js +801 -0
- package/dist/holmes/guardrail/refusal-codes.d.ts +24 -0
- package/dist/holmes/guardrail/refusal-codes.js +140 -0
- package/dist/holmes/guardrail/risk-classifier.d.ts +17 -0
- package/dist/holmes/guardrail/risk-classifier.js +242 -26
- package/dist/holmes/guardrail/risk-types.d.ts +15 -0
- package/dist/holmes/guardrail/run-plan-scope.d.ts +23 -0
- package/dist/holmes/guardrail/run-plan-scope.js +155 -0
- package/dist/holmes/guardrail/run-refusals.d.ts +116 -0
- package/dist/holmes/guardrail/run-refusals.js +348 -0
- package/dist/holmes/guardrail/run-stages.d.ts +67 -0
- package/dist/holmes/guardrail/run-stages.js +188 -0
- package/dist/holmes/guardrail/scope-judgment.d.ts +5 -1
- package/dist/holmes/guardrail/scope-judgment.js +8 -10
- package/dist/holmes/guardrail/scope-refusal-memory.d.ts +3 -0
- package/dist/holmes/guardrail/scope-refusal-memory.js +85 -0
- package/dist/holmes/guardrail/shell-words.js +7 -7
- package/dist/holmes/guardrail/write-target.d.ts +31 -2
- package/dist/holmes/guardrail/write-target.js +118 -16
- package/dist/holmes/hooks/pre-tool-use.d.ts +35 -1
- package/dist/holmes/hooks/pre-tool-use.js +702 -81
- package/dist/holmes/hooks/session-start.js +5 -3
- package/dist/holmes/hooks/stop.d.ts +32 -0
- package/dist/holmes/hooks/stop.js +129 -4
- package/dist/holmes/mcp/handlers/graph-operations.js +5 -5
- package/dist/holmes/mcp/handlers/maintenance-analysis.js +2 -2
- package/dist/holmes/mcp/handlers/operator-inspection.d.ts +2 -1
- package/dist/holmes/mcp/handlers/operator-inspection.js +3 -1
- package/dist/holmes/mcp/handlers/phase-queries.js +16 -1
- package/dist/holmes/mcp/handlers/requirement-triage.js +2 -2
- package/dist/holmes/mcp/handlers/spec-approval.d.ts +3 -3
- package/dist/holmes/mcp/handlers/spec-approval.js +54 -8
- package/dist/holmes/mcp/handlers/spec-lifecycle.d.ts +1 -0
- package/dist/holmes/mcp/handlers/spec-lifecycle.js +3 -3
- package/dist/holmes/mcp/handlers/spec-queries.d.ts +7 -0
- package/dist/holmes/mcp/handlers/spec-queries.js +5 -0
- package/dist/holmes/mcp/handlers/workspace-queries.js +2 -2
- package/dist/holmes/mcp/handlers.d.ts +2 -3
- package/dist/holmes/mcp/handlers.js +22 -2
- package/dist/holmes/mcp/harness-attestation.d.ts +2 -0
- package/dist/holmes/mcp/harness-attestation.js +3 -1
- package/dist/holmes/mcp/operator-recovery.d.ts +2 -0
- package/dist/holmes/mcp/operator-recovery.js +4 -3
- package/dist/holmes/mcp/server.js +9 -0
- package/dist/holmes/mcp/tool-schemas.js +6 -3
- package/dist/holmes/project/root.js +6 -1
- package/dist/holmes/project/run-records.d.ts +17 -0
- package/dist/holmes/project/run-records.js +126 -0
- package/dist/holmes/review/mrp.d.ts +35 -0
- package/dist/holmes/review/mrp.js +119 -0
- package/dist/holmes/review/verdicts.d.ts +117 -0
- package/dist/holmes/review/verdicts.js +345 -0
- package/dist/holmes/semantic/cloud-usage.d.ts +20 -0
- package/dist/holmes/semantic/cloud-usage.js +106 -0
- package/dist/holmes/semantic/embedder.d.ts +15 -6
- package/dist/holmes/semantic/embedder.js +84 -3
- package/dist/holmes/semantic/local-model.d.ts +21 -2
- package/dist/holmes/semantic/local-model.js +14 -3
- package/dist/holmes/semantic/tier.d.ts +25 -0
- package/dist/holmes/semantic/tier.js +86 -1
- package/dist/holmes/semantic/vector-cache.d.ts +1 -0
- package/dist/holmes/semantic/vector-cache.js +4 -1
- package/dist/holmes/spec/approval-blockers.d.ts +11 -1
- package/dist/holmes/spec/approval-blockers.js +70 -2
- package/dist/holmes/spec/renumber.d.ts +1 -1
- package/dist/holmes/spec/renumber.js +5 -2
- package/dist/holmes/spec/transition-policy.d.ts +5 -7
- package/dist/holmes/spec/transition-policy.js +17 -2
- package/package.json +1 -1
|
@@ -51,6 +51,8 @@ exports.resetWiringSpawns = resetWiringSpawns;
|
|
|
51
51
|
exports.wiringSpawnShared = wiringSpawnShared;
|
|
52
52
|
exports.wiringSpawnCheck = wiringSpawnCheck;
|
|
53
53
|
exports.mcpProbeEnv = mcpProbeEnv;
|
|
54
|
+
exports.sealedUnderUnsealedAncestorCheck = sealedUnderUnsealedAncestorCheck;
|
|
55
|
+
exports.stageMachineCheck = stageMachineCheck;
|
|
54
56
|
exports.pushGateCheck = pushGateCheck;
|
|
55
57
|
exports.stopHookTimeoutCheck = stopHookTimeoutCheck;
|
|
56
58
|
exports.activationText = activationText;
|
|
@@ -61,6 +63,7 @@ exports.ciMatrixCheck = ciMatrixCheck;
|
|
|
61
63
|
exports.checksJson = checksJson;
|
|
62
64
|
exports.formatChecks = formatChecks;
|
|
63
65
|
exports.codexWiredTarget = codexWiredTarget;
|
|
66
|
+
exports.holmesWirings = holmesWirings;
|
|
64
67
|
exports.wiringLauncherChecks = wiringLauncherChecks;
|
|
65
68
|
exports.wiringVersionChecks = wiringVersionChecks;
|
|
66
69
|
exports.harnessClause = harnessClause;
|
|
@@ -72,7 +75,7 @@ exports.wiringHandshakeChecks = wiringHandshakeChecks;
|
|
|
72
75
|
exports.semanticCoverageCheck = semanticCoverageCheck;
|
|
73
76
|
exports.semanticTierVerdict = semanticTierVerdict;
|
|
74
77
|
exports.detectTreeKeyTemporary = detectTreeKeyTemporary;
|
|
75
|
-
// @implements A-SPEC-751.4, A-SPEC-770.3, A-SPEC-770.6, A-SPEC-770.7, A-SPEC-770.9, A-SPEC-770.10,A-SPEC-733,A-SPEC-727, A-SPEC-721, A-SPEC-738, A-SPEC-734, A-SPEC-751, A-SPEC-751.2, A-SPEC-772.1, A-SPEC-772.5, A-SPEC-772.6, A-SPEC-772.7, A-SPEC-772.8, A-SPEC-772.9, A-SPEC-772.10, A-SPEC-772.11
|
|
78
|
+
// @implements A-SPEC-476.1, A-SPEC-476.5, A-SPEC-751.4, A-SPEC-751.9, A-SPEC-770.3, A-SPEC-770.6, A-SPEC-770.7, A-SPEC-770.9, A-SPEC-770.10,A-SPEC-733,A-SPEC-727, A-SPEC-774.22, A-SPEC-781.2, A-SPEC-182.3, A-SPEC-182.4,A-SPEC-721, A-SPEC-738, A-SPEC-734, A-SPEC-751, A-SPEC-751.2, A-SPEC-772.1, A-SPEC-772.5, A-SPEC-772.6, A-SPEC-772.7, A-SPEC-772.8, A-SPEC-772.9, A-SPEC-772.10, A-SPEC-772.11
|
|
76
79
|
// @implements A-SPEC-704, A-SPEC-710, A-SPEC-712, A-SPEC-769.14, A-SPEC-769.16, A-SPEC-769.17, A-SPEC-769.18, A-SPEC-769.19, A-SPEC-769.20, A-SPEC-769.21
|
|
77
80
|
const doctor_guidance_1 = require("./doctor-guidance");
|
|
78
81
|
// @implements A-SPEC-264, A-SPEC-423, A-SPEC-549.1, A-SPEC-590
|
|
@@ -88,11 +91,13 @@ const npx_bin_1 = require("../project/npx-bin");
|
|
|
88
91
|
const install_scripts_policy_1 = require("../project/install-scripts-policy");
|
|
89
92
|
const native_deps_1 = require("./native-deps");
|
|
90
93
|
const tier_1 = require("../semantic/tier");
|
|
94
|
+
const cloud_usage_1 = require("../semantic/cloud-usage");
|
|
91
95
|
const probe_process_1 = require("./probe-process");
|
|
92
96
|
const npx_cache_check_1 = require("./npx-cache-check");
|
|
93
97
|
const ci_runs_1 = require("../project/ci-runs");
|
|
94
98
|
const vector_coverage_1 = require("../semantic/vector-coverage");
|
|
95
99
|
const path = __importStar(require("node:path"));
|
|
100
|
+
const config_1 = require("../config/config");
|
|
96
101
|
const role_policy_1 = require("../governance/role-policy");
|
|
97
102
|
const blind_spots_1 = require("../guardrail/blind-spots");
|
|
98
103
|
const node_child_process_1 = require("node:child_process");
|
|
@@ -1177,9 +1182,40 @@ async function runDoctor(packageRoot, target, opts, extraChecks) {
|
|
|
1177
1182
|
// operators that doctor's failures are noise, which costs more than this check is worth.
|
|
1178
1183
|
if (target) {
|
|
1179
1184
|
const rs = (0, role_policy_1.rolePolicyStatus)(target);
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1185
|
+
// @implements A-SPEC-774.8 — a broad default is refused in a run; interactively it is a warning with the migration.
|
|
1186
|
+
// @implements A-SPEC-774.15 — an unreadable policy refuses every action; a role defined twice is refused in a run.
|
|
1187
|
+
if (rs.loadIssue)
|
|
1188
|
+
add('role policy', 'WARN', `${rs.loadIssue}. Every role-checked action is refused until it can be read.`);
|
|
1189
|
+
else if (rs.duplicates?.length)
|
|
1190
|
+
add('role policy', 'WARN', `role(s) defined in more than one file under .ax/roles: ${rs.duplicates.join(', ')}. The later definition holds interactively; an orchestrated run refuses them. Define each role once.`);
|
|
1191
|
+
else if (rs.defaultIssue)
|
|
1192
|
+
add('role policy', 'WARN', `${rs.defaultIssue}. In an orchestrated run this policy is refused; interactive sessions are unaffected.`);
|
|
1193
|
+
// @implements A-SPEC-774.22 — a stages declaration that cannot be read: ignored interactively, refused in a run.
|
|
1194
|
+
else if (rs.malformedStages?.length)
|
|
1195
|
+
add('role policy', 'WARN', `role(s) whose stages cannot be read: ${rs.malformedStages.join(', ')} — interactive sessions ignore them; an orchestrated run refuses them in every stage. Write stages as a list of stage names.`);
|
|
1196
|
+
else
|
|
1197
|
+
add('role policy', 'PASS', rs.state === 'absent' ? 'not configured (optional)'
|
|
1198
|
+
: rs.state === 'inactive' ? 'guidance present, no policy — roles are off (see .ax/roles/README.md)'
|
|
1199
|
+
: `active — ${rs.roles.length} role(s): ${rs.roles.join(', ')}; default=${rs.default ?? '(none — unspecified is refused)'}`);
|
|
1200
|
+
// @implements A-SPEC-781.2 — a stage machine not read as written is named, never replaced silently.
|
|
1201
|
+
const sm = stageMachineCheck(target);
|
|
1202
|
+
if (sm)
|
|
1203
|
+
checks.push(sm);
|
|
1204
|
+
}
|
|
1205
|
+
// @implements A-SPEC-532.6 — the owner's ceiling on automatic approval; a value the loader could not read is `off`.
|
|
1206
|
+
if (target) {
|
|
1207
|
+
let raw;
|
|
1208
|
+
try {
|
|
1209
|
+
raw = JSON.parse(fs.readFileSync(path.join(target, 'ax.config.json'), 'utf8')).autonomy?.ceiling;
|
|
1210
|
+
}
|
|
1211
|
+
catch {
|
|
1212
|
+
raw = undefined;
|
|
1213
|
+
}
|
|
1214
|
+
const ceiling = (0, config_1.loadConfig)(target).autonomy.ceiling;
|
|
1215
|
+
if (raw !== undefined && raw !== ceiling)
|
|
1216
|
+
add('autonomy ceiling', 'WARN', `ax.config.json autonomy.ceiling ${JSON.stringify(raw)} is not one of off, tests, no-gate, default — read as "off": no seal is automatic until it is corrected`);
|
|
1217
|
+
else
|
|
1218
|
+
add('autonomy ceiling', 'PASS', ceiling === 'default' ? 'default — the grader decides which seals are automatic' : `"${ceiling}" — automatic seals above it are the operator's`);
|
|
1183
1219
|
}
|
|
1184
1220
|
// @implements A-SPEC-165
|
|
1185
1221
|
// The boundary, told to the user rather than left in a document nobody opens. PASS, not FAIL: a
|
|
@@ -1214,6 +1250,13 @@ async function runDoctor(packageRoot, target, opts, extraChecks) {
|
|
|
1214
1250
|
: `${orphaned.length} approved spec(s) with a non-approved parent: ${orphaned.map((s) => s.id).slice(0, 5).join(', ')}`);
|
|
1215
1251
|
}
|
|
1216
1252
|
catch { /* an unreadable corpus is doctor's other checks' business, not this one's */ }
|
|
1253
|
+
// @implements A-SPEC-182.3 — the whole chain, not only the direct parents: named, never silent.
|
|
1254
|
+
try {
|
|
1255
|
+
const anc = sealedUnderUnsealedAncestorCheck(target);
|
|
1256
|
+
if (anc)
|
|
1257
|
+
checks.push(anc);
|
|
1258
|
+
}
|
|
1259
|
+
catch { /* as above */ }
|
|
1217
1260
|
// @implements A-SPEC-254.1
|
|
1218
1261
|
// Distributed id preemption (the 2026-08-23 REQ-220 incident): two offline workspaces issue the
|
|
1219
1262
|
// same number, silent at create and at push. Judgment lives in the ONE pure detector; identity is
|
|
@@ -1709,13 +1752,13 @@ async function runDoctor(packageRoot, target, opts, extraChecks) {
|
|
|
1709
1752
|
issues.push(`${file}: hooks are disabled`);
|
|
1710
1753
|
for (const g of ours.PreToolUse ?? [])
|
|
1711
1754
|
for (const hook of g.hooks ?? []) {
|
|
1712
|
-
if (hook.command
|
|
1755
|
+
if ((0, runtime_binding_1.sameAgyCommand)(hook.command, routed.command('antigravity', 'pre-tool-use'))) { // A-SPEC-751.9
|
|
1713
1756
|
pres++;
|
|
1714
1757
|
if (g.matcher !== '*')
|
|
1715
1758
|
issues.push(`${file}: PreToolUse matcher must be *`);
|
|
1716
1759
|
}
|
|
1717
1760
|
}
|
|
1718
|
-
stops += (ours.Stop ?? []).filter((h2) => h2.command
|
|
1761
|
+
stops += (ours.Stop ?? []).filter((h2) => (0, runtime_binding_1.sameAgyCommand)(h2.command, routed.command('antigravity', 'stop'))).length; // A-SPEC-751.9
|
|
1719
1762
|
}
|
|
1720
1763
|
if (pres !== 1 || (stops !== 1 && !(emptyStop && stops === 0)))
|
|
1721
1764
|
issues.push('expected exactly one registered PreToolUse and Stop across Antigravity sources');
|
|
@@ -2343,9 +2386,11 @@ async function runDoctor(packageRoot, target, opts, extraChecks) {
|
|
|
2343
2386
|
add('global prefix', verdict.level, verdict.detail, verdict.fix);
|
|
2344
2387
|
}
|
|
2345
2388
|
{
|
|
2346
|
-
const t = (0, tier_1.
|
|
2389
|
+
const t = (0, tier_1.resolveProjectSemanticTier)(target ?? process.cwd()); // @implements A-SPEC-476.1
|
|
2347
2390
|
const v = semanticTierVerdict(t);
|
|
2348
2391
|
add('semantic tier', v.level, v.detail, v.fix);
|
|
2392
|
+
// @implements A-SPEC-476.5 — what this project actually sent to the cloud embedder, by day (every tier, so a cap shows 0).
|
|
2393
|
+
add('cloud embedding usage', 'PASS', (0, cloud_usage_1.cloudUsageLine)((0, cloud_usage_1.cloudUsageSummary)(target ?? process.cwd())));
|
|
2349
2394
|
// @implements A-SPEC-682 — the tier line says what is CONFIGURED. Measured 2026-09-19 on this
|
|
2350
2395
|
// repository, the configured tier was cloud while 0 of 602 scanned files had a cached document
|
|
2351
2396
|
// vector under it, so every lookup returned nothing and both semantic surfaces were inert —
|
|
@@ -2691,6 +2736,85 @@ function mcpHandshakeCheck(packageRoot, target, timeoutMs = 15000) {
|
|
|
2691
2736
|
send({ jsonrpc: '2.0', id: 1, method: 'initialize', params: { protocolVersion: '2024-11-05', capabilities: {}, clientInfo: { name: 'holmes-doctor', version: '1' } } });
|
|
2692
2737
|
});
|
|
2693
2738
|
}
|
|
2739
|
+
/**
|
|
2740
|
+
* @implements A-SPEC-182.3 — approved specs whose ancestor chain (direct parents included) holds a spec that is not
|
|
2741
|
+
* approved: a WARN with the count and the ancestors that hold most of them, or null on a clean store. Measured here on
|
|
2742
|
+
* 2026-10-18: 28 (REQ-102 13, REQ-125 11, H-SPEC-100 4).
|
|
2743
|
+
*/
|
|
2744
|
+
function sealedUnderUnsealedAncestorCheck(target) {
|
|
2745
|
+
const { parseSpec } = require('../spec/spec-parser');
|
|
2746
|
+
const byId = new Map();
|
|
2747
|
+
const walk = (dir, depth) => {
|
|
2748
|
+
if (depth > 6)
|
|
2749
|
+
return;
|
|
2750
|
+
let entries;
|
|
2751
|
+
try {
|
|
2752
|
+
entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
2753
|
+
}
|
|
2754
|
+
catch {
|
|
2755
|
+
return;
|
|
2756
|
+
}
|
|
2757
|
+
for (const e of entries) {
|
|
2758
|
+
const p = path.join(dir, e.name);
|
|
2759
|
+
if (e.isDirectory())
|
|
2760
|
+
walk(p, depth + 1);
|
|
2761
|
+
else if (e.isFile() && e.name.endsWith('.md')) {
|
|
2762
|
+
try {
|
|
2763
|
+
const s = parseSpec(fs.readFileSync(p, 'utf8'));
|
|
2764
|
+
if (s.id)
|
|
2765
|
+
byId.set(s.id, s);
|
|
2766
|
+
}
|
|
2767
|
+
catch { /* unreadable: other checks */ }
|
|
2768
|
+
}
|
|
2769
|
+
}
|
|
2770
|
+
};
|
|
2771
|
+
walk(path.join(target, '.ax', 'specs'), 0);
|
|
2772
|
+
const holders = new Map();
|
|
2773
|
+
let count = 0;
|
|
2774
|
+
for (const s of byId.values()) {
|
|
2775
|
+
if (s.status !== 'approved')
|
|
2776
|
+
continue;
|
|
2777
|
+
const bad = new Set();
|
|
2778
|
+
const seen = new Set([s.id]);
|
|
2779
|
+
const up = (id, depth) => {
|
|
2780
|
+
if (depth > 16 || seen.has(id))
|
|
2781
|
+
return;
|
|
2782
|
+
seen.add(id);
|
|
2783
|
+
const a = byId.get(id);
|
|
2784
|
+
// @implements A-SPEC-182.4 — an ancestor no spec carries holds the chain up as an unapproved one does.
|
|
2785
|
+
if (!a) {
|
|
2786
|
+
bad.add(`${id} (missing)`);
|
|
2787
|
+
return;
|
|
2788
|
+
}
|
|
2789
|
+
if (a.status !== 'approved')
|
|
2790
|
+
bad.add(`${a.id} (${a.status})`);
|
|
2791
|
+
for (const d of a.dependsOn ?? [])
|
|
2792
|
+
up(d, depth + 1);
|
|
2793
|
+
};
|
|
2794
|
+
for (const d of s.dependsOn ?? [])
|
|
2795
|
+
up(d, 1);
|
|
2796
|
+
if (bad.size > 0) {
|
|
2797
|
+
count++;
|
|
2798
|
+
for (const b of bad)
|
|
2799
|
+
holders.set(b, (holders.get(b) ?? 0) + 1);
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
if (count === 0)
|
|
2803
|
+
return null;
|
|
2804
|
+
const top = [...holders.entries()].sort((a, b) => b[1] - a[1]).slice(0, 5).map(([k, v]) => `${k}: ${v}`).join(', ');
|
|
2805
|
+
return { name: 'sealed under unsealed ancestor', level: 'WARN',
|
|
2806
|
+
detail: `${count} approved spec(s) sit under an ancestor that is not approved — ${top}. A run or classification.strict refuses such a seal; seal the ancestor to restore the chain.` };
|
|
2807
|
+
}
|
|
2808
|
+
/**
|
|
2809
|
+
* @implements A-SPEC-781.2 — how the run stage machine in `ax.config.json` was read: a WARN naming the fallback or the
|
|
2810
|
+
* deny entries filled in, or null when it was read as written (no line, so a clean project's doctor is unchanged).
|
|
2811
|
+
*/
|
|
2812
|
+
function stageMachineCheck(target) {
|
|
2813
|
+
const notes = (0, config_1.loadConfig)(target).stages.notes;
|
|
2814
|
+
if (notes.length === 0)
|
|
2815
|
+
return null;
|
|
2816
|
+
return { name: 'stage machine', level: 'WARN', detail: `${notes.join('; ')}. Orchestrated runs use the machine as read; interactive sessions are unaffected.` };
|
|
2817
|
+
}
|
|
2694
2818
|
// @implements A-SPEC-509.1
|
|
2695
2819
|
/**
|
|
2696
2820
|
* Push-gate presence, diagnosed only where it applies: a repo that opted into governance (.ax)
|
|
@@ -3196,6 +3320,7 @@ function codexWiredTarget(target) {
|
|
|
3196
3320
|
|| fs.existsSync(path.join(target, '.codex', 'mcp_config.json'));
|
|
3197
3321
|
}
|
|
3198
3322
|
/** The Holmes wirings of the three harnesses, read the way the handshake reads them (nothing is started). */
|
|
3323
|
+
// @implements A-SPEC-774.18 — exported: run start reads the same wirings to pin the MCP version of a run.
|
|
3199
3324
|
function holmesWirings(target, codexConfigPath) {
|
|
3200
3325
|
const wirings = [
|
|
3201
3326
|
{
|
|
@@ -3833,7 +3958,28 @@ function semanticCoverageCheck(root, tier) {
|
|
|
3833
3958
|
return unjudgeable();
|
|
3834
3959
|
}
|
|
3835
3960
|
}
|
|
3961
|
+
/**
|
|
3962
|
+
* @implements A-SPEC-476.1 — the tier row names the project's cap: a key it withheld (by source, never the value) and the
|
|
3963
|
+
* cap that applied; a cap that could not be read is FAIL, because the tier is none until it is fixed.
|
|
3964
|
+
*/
|
|
3836
3965
|
function semanticTierVerdict(t) {
|
|
3966
|
+
if (t.cap?.problem) {
|
|
3967
|
+
return {
|
|
3968
|
+
level: 'FAIL',
|
|
3969
|
+
detail: `semantic.maxTier in ax.config.json could not be read (${t.cap.problem}) — the semantic tier is none until it is fixed.`,
|
|
3970
|
+
fix: 'Set semantic.maxTier to "cloud", "local" or "none" in ax.config.json, or remove the key for no cap.',
|
|
3971
|
+
};
|
|
3972
|
+
}
|
|
3973
|
+
const v = uncappedTierVerdict(t);
|
|
3974
|
+
if (!t.cap)
|
|
3975
|
+
return v;
|
|
3976
|
+
const key = t.cap.keyWithheld === undefined ? 'no key' : `key present (${KEY_SOURCE_LABEL[t.cap.keyWithheld]})`;
|
|
3977
|
+
return { ...v, detail: `${v.detail} [${key}, project cap ${t.cap.maxTier} (ax.config.json semantic.maxTier)]` };
|
|
3978
|
+
}
|
|
3979
|
+
const KEY_SOURCE_LABEL = {
|
|
3980
|
+
'env': 'HOLMES_SEMANTIC_API_KEY', 'env-compat': 'GEMINI_API_KEY', 'keychain': 'macOS keychain', 'file': '~/.holmes/credentials.json',
|
|
3981
|
+
};
|
|
3982
|
+
function uncappedTierVerdict(t) {
|
|
3837
3983
|
if (t.tier === 'cloud') {
|
|
3838
3984
|
// @implements A-SPEC-477 — the SOURCE of the consent is shown (env/keychain/file); the value
|
|
3839
3985
|
// never is. Consent must be able to see what it consented to, and where it lives.
|
package/dist/holmes/cli/index.js
CHANGED
|
@@ -37,7 +37,7 @@ exports.isBrokenPipe = void 0;
|
|
|
37
37
|
exports.packageRoot = packageRoot;
|
|
38
38
|
exports.main = main;
|
|
39
39
|
exports.installPipeGuard = installPipeGuard;
|
|
40
|
-
// @implements A-SPEC-704, A-SPEC-773, A-SPEC-770.11,A-SPEC-709, A-SPEC-734,A-SPEC-751, A-SPEC-752, A-SPEC-772.4
|
|
40
|
+
// @implements A-SPEC-704, A-SPEC-773, A-SPEC-770.11,A-SPEC-709, A-SPEC-734,A-SPEC-751, A-SPEC-752, A-SPEC-772.4, A-SPEC-779, A-SPEC-102.2, A-SPEC-774.20, A-SPEC-102.7, A-SPEC-779.2
|
|
41
41
|
// @implements A-SPEC-549.2
|
|
42
42
|
// @implements A-SPEC-591, A-SPEC-626
|
|
43
43
|
const cli_execution_1 = require("./cli-execution");
|
|
@@ -87,10 +87,14 @@ const KNOWN_FLAGS = {
|
|
|
87
87
|
attest: ['help', 'target', 'exclude', 'json', 'badge', 'readme'],
|
|
88
88
|
// @implements A-SPEC-773 — the Holmes scratch root an agent may clean up on its own.
|
|
89
89
|
scratch: ['help', 'new'],
|
|
90
|
+
// @implements A-SPEC-774.10 — the role policy rewritten into the new vocabulary with equal verdicts.
|
|
91
|
+
roles: ['help', 'target', 'dry-run'],
|
|
92
|
+
run: ['help', 'target', 'worktree', 'engine', 'engine-arg', 'id', 'key', 'scope', 'to', 'why', 'accept-unknown-versions'], // @implements A-SPEC-774.17, A-SPEC-102.5, A-SPEC-781, A-SPEC-774.20
|
|
93
|
+
review: ['help', 'target', 'base', 'head', 'verdict', 'finding', 'engine', 'model', 'session', 'strict', 'solid'], // @implements A-SPEC-102.2, A-SPEC-102.7
|
|
90
94
|
skills: ['help', 'target'],
|
|
91
95
|
ci: ['help', 'target', 'specs-dir', 'json'],
|
|
92
96
|
serve: ['help', 'target', 'port'],
|
|
93
|
-
approve: ['help', 'target', 'list', 'status', 'refusals', 'grant', 'deny', 'ask', 'revoke', 'reason', 'question', 'ttl', 'rationale', 'watch', 'poll-ms'], // A-SPEC-649: --revoke · A-SPEC-650: --status
|
|
97
|
+
approve: ['help', 'target', 'list', 'status', 'refusals', 'grant', 'deny', 'ask', 'revoke', 'withdraw', 'reason', 'question', 'ttl', 'rationale', 'watch', 'poll-ms'], // A-SPEC-649: --revoke · A-SPEC-650: --status · A-SPEC-779.2: --withdraw
|
|
94
98
|
ledger: ['help', 'target', 'ref', 'dry-run'],
|
|
95
99
|
// @implements A-SPEC-477 — the human's opt-in act for the cloud semantic tier.
|
|
96
100
|
'semantic-key': ['help'],
|
|
@@ -118,6 +122,7 @@ const APPROVE_USAGE = `holmes-kit approve — decide pending approval requests (
|
|
|
118
122
|
--deny <id> --reason <text> deny — the reason rides the agent's next refusal
|
|
119
123
|
--ask <id> --question <text> leave a question and hold — the agent relays it to the user
|
|
120
124
|
--revoke <id> --reason <text> withdraw a live grant — the request must be decided again
|
|
125
|
+
--withdraw <ref> --reason <text> the run that filed a request closes it (recorded as withdrawn, not denied)
|
|
121
126
|
--target <dir> project root (default: current directory)
|
|
122
127
|
`;
|
|
123
128
|
class UnknownFlagError extends Error {
|
|
@@ -130,11 +135,12 @@ class UnknownFlagError extends Error {
|
|
|
130
135
|
*/
|
|
131
136
|
// A-SPEC-251.1 (round 26): `yes` — `upgrade --yes` was refused as "--yes requires a value", so the non-interactive
|
|
132
137
|
// upgrade its own guidance names could not run (measured).
|
|
138
|
+
// A-SPEC-774.24: --accept-unknown-versions names its fields, so it is a value flag, not one of these.
|
|
133
139
|
const BOOLEAN_FLAGS = new Set(['badge', 'readme', 'help', 'dry-run', 'no-mcp', 'remove', 'force', 'json', 'list', 'status', 'watch', 'autonomy', 'no-autonomy', 'yes']); // A-SPEC-650: --status
|
|
134
140
|
/** @implements A-SPEC-770.11 — value flags whose value may be omitted; the handler supplies the default. */
|
|
135
141
|
const OPTIONAL_VALUE_FLAGS = new Set(['refusals']);
|
|
136
142
|
/** @implements A-SPEC-771.1 — value flags that may be given more than once. */
|
|
137
|
-
const REPEATABLE_FLAGS = new Set(['limit']);
|
|
143
|
+
const REPEATABLE_FLAGS = new Set(['limit', 'engine-arg', 'finding', 'scope']); // @implements A-SPEC-774.17 — one engine argument per flag; A-SPEC-102.2 — one finding id per flag
|
|
138
144
|
function parseFlags(argv, known) {
|
|
139
145
|
const flags = {};
|
|
140
146
|
const positionals = [];
|
|
@@ -251,9 +257,32 @@ const USAGE = `holmes-kit — deterministic ASE governance for a project
|
|
|
251
257
|
--deny <ref> --reason <text> record a denial the agent will see
|
|
252
258
|
--ask <ref> --question <text> hold with a question the agent relays
|
|
253
259
|
--revoke <id> --reason <text> withdraw a live grant (full id or unique prefix)
|
|
260
|
+
--withdraw <ref> --reason <text> the filing run closes its own request (recorded withdrawn)
|
|
254
261
|
<ref> list index (1,2,…), full id, or a unique id prefix
|
|
255
262
|
--target <dir> project root (default: cwd)
|
|
256
263
|
|
|
264
|
+
holmes-kit run start|status|stop open, list and end an orchestrated run (JSON on stdout)
|
|
265
|
+
start --worktree <dir> --engine claude|codex|agy [--engine-arg <a>]… [--scope <A-SPEC-id>]…
|
|
266
|
+
[--accept-unknown-versions <field,...>]
|
|
267
|
+
checks the worktree would be governed (specs, MCP, gate hook, no
|
|
268
|
+
gate-off argument, every version and build readable), writes the run
|
|
269
|
+
record, prints the headless command, HOLMES_RUN_ID and a one-time stop
|
|
270
|
+
key; exit 3 if refused. --accept-unknown-versions hook,mcp starts
|
|
271
|
+
despite those unreadable fields only, and records them; fields a
|
|
272
|
+
harness cannot read by design (agy: hook, hook_build) are exempt
|
|
273
|
+
stop --id <run_id> --key <stop_key> end the run (only the holder of the key can)
|
|
274
|
+
transition --id <run_id> --to <stage> --key <stop_key> [--why <text>]
|
|
275
|
+
move the run along its stage machine (ax.config.json stages);
|
|
276
|
+
test and done need an independent passing review; exit 3 if refused
|
|
277
|
+
|
|
278
|
+
holmes-kit review record|status|gate review verdicts bound to a base and head (JSON on stdout)
|
|
279
|
+
record --base <rev> --head <rev> --verdict pass|fail [--finding <id>]… [--engine e] [--model m]
|
|
280
|
+
refuses a self-review (the run that wrote the head) and a role
|
|
281
|
+
without RECORD_REVIEW; the ledger lives in the main checkout
|
|
282
|
+
gate --base <rev> --head <rev> [--strict] exit 1 unless an independent pass covers the range
|
|
283
|
+
and no open critical (with --strict, important) finding remains
|
|
284
|
+
mrp --base <rev> --head <rev> the merge-ready package: spec chain, test evidence, verdict, missing
|
|
285
|
+
|
|
257
286
|
holmes-kit autonomy status|on|off|delegate|revoke-delegation grant/end autonomous spec approval
|
|
258
287
|
delegate --run <id> --allow <rule[,rule]> [--for 2h] [--limit k=v]… [--rationale <text>]
|
|
259
288
|
run delegation for THIS workspace: hitl specs whose only reason is a
|
|
@@ -342,7 +371,10 @@ async function main(argv) {
|
|
|
342
371
|
// silently wrote into CWD while the named target stayed stale (round-3 HIGH).
|
|
343
372
|
const expected = cmd === 'runtime-binding' ? ['setup', 'status', 'remove'] : cmd === 'guidance' ? ['check', 'refresh'] : cmd === 'skills' ? ['refresh'] : cmd === 'ledger' ? ['rechain']
|
|
344
373
|
: cmd === 'semantic-key' ? ['set', 'unset', 'status']
|
|
345
|
-
: cmd === 'autonomy' ? ['status', 'on', 'off', 'delegate', 'revoke-delegation']
|
|
374
|
+
: cmd === 'autonomy' ? ['status', 'on', 'off', 'delegate', 'revoke-delegation'] // @implements A-SPEC-771.1
|
|
375
|
+
: cmd === 'roles' ? ['migrate'] // @implements A-SPEC-774.10
|
|
376
|
+
: cmd === 'run' ? ['start', 'status', 'stop', 'transition'] // @implements A-SPEC-774.17, A-SPEC-781
|
|
377
|
+
: cmd === 'review' ? ['record', 'status', 'gate', 'mrp'] : []; // @implements A-SPEC-102.2, A-SPEC-102.6
|
|
346
378
|
const unexpected = positionals.filter((p) => !expected.includes(p));
|
|
347
379
|
if (unexpected.length > 0) {
|
|
348
380
|
const hint = fs.existsSync(unexpected[0]) ? ` — did you mean --target ${unexpected[0]}?` : '';
|
|
@@ -478,6 +510,43 @@ async function main(argv) {
|
|
|
478
510
|
// @implements A-SPEC-702 — reads one scan and the spec store; writes only the badge and the README's
|
|
479
511
|
// marker region, and only when asked. The numbers never change the exit code.
|
|
480
512
|
// @implements A-SPEC-773
|
|
513
|
+
// @implements A-SPEC-774.10
|
|
514
|
+
// @implements A-SPEC-774.17 — open, list and end an orchestrated run (the record A-SPEC-774.9's run mode reads).
|
|
515
|
+
if (cmd === 'run') {
|
|
516
|
+
const { runRun, parseAcceptedVersions } = require('./run');
|
|
517
|
+
const str = (k) => (typeof flags[k] === 'string' ? flags[k] : undefined);
|
|
518
|
+
// @implements A-SPEC-774.24 — the accepted unreadable fields, by name; an empty or unknown name is refused.
|
|
519
|
+
const acceptText = str('accept-unknown-versions');
|
|
520
|
+
const acceptParsed = acceptText === undefined ? null : parseAcceptedVersions(acceptText);
|
|
521
|
+
if (acceptParsed !== null && 'refusal' in acceptParsed) {
|
|
522
|
+
process.stderr.write(`✗ ${acceptParsed.refusal}\n`);
|
|
523
|
+
return 2;
|
|
524
|
+
}
|
|
525
|
+
return runRun(positionals[0], {
|
|
526
|
+
target: str('target') ? path.resolve(str('target')) : undefined, worktree: str('worktree'), engine: str('engine'),
|
|
527
|
+
engineArgs: str('engine-arg')?.split('\n'), id: str('id'), key: str('key'), scope: str('scope')?.split('\n'), to: str('to'), why: str('why'),
|
|
528
|
+
// @implements A-SPEC-774.20 — start despite unreadable versions; run start records which.
|
|
529
|
+
...(acceptParsed !== null ? { acceptUnknownVersions: acceptParsed.fields } : {}),
|
|
530
|
+
}, { stdout: (t) => process.stdout.write(t), stderr: (t) => process.stderr.write(t) });
|
|
531
|
+
}
|
|
532
|
+
// @implements A-SPEC-102.2 — review verdicts for callers that are not MCP clients.
|
|
533
|
+
if (cmd === 'review') {
|
|
534
|
+
const { runReview, REVIEW_USAGE } = require('./review');
|
|
535
|
+
if (flags.help) {
|
|
536
|
+
process.stdout.write(REVIEW_USAGE);
|
|
537
|
+
return 0;
|
|
538
|
+
}
|
|
539
|
+
const str = (k) => (typeof flags[k] === 'string' ? flags[k] : undefined);
|
|
540
|
+
return runReview(positionals[0], {
|
|
541
|
+
target: str('target'), base: str('base'), head: str('head'), verdict: str('verdict'), findings: str('finding')?.split('\n'),
|
|
542
|
+
solid: str('solid')?.split('\n'), // @implements A-SPEC-102.7
|
|
543
|
+
engine: str('engine'), model: str('model'), session: str('session'), strict: flags.strict === true,
|
|
544
|
+
}, { stdout: (t) => process.stdout.write(t), stderr: (t) => process.stderr.write(t) });
|
|
545
|
+
}
|
|
546
|
+
if (cmd === 'roles') {
|
|
547
|
+
const { runRoles } = require('./roles');
|
|
548
|
+
return runRoles(positionals[0], { target: typeof flags.target === 'string' ? path.resolve(flags.target) : process.cwd(), dryRun: flags['dry-run'] === true }, { stdout: (t) => process.stdout.write(t), stderr: (t) => process.stderr.write(t) });
|
|
549
|
+
}
|
|
481
550
|
if (cmd === 'scratch') {
|
|
482
551
|
const { runScratch } = require('./scratch');
|
|
483
552
|
return runScratch({ label: typeof flags.new === 'string' ? flags.new : undefined }, { stdout: (t) => process.stdout.write(t), stderr: (t) => process.stderr.write(t) });
|
|
@@ -977,6 +1046,15 @@ async function main(argv) {
|
|
|
977
1046
|
process.stdout.write(`\u2717 ${ref.refusal}\n`);
|
|
978
1047
|
return 1;
|
|
979
1048
|
}
|
|
1049
|
+
// @implements A-SPEC-779 \u2014 never from inside a run; a run's awaited request only from a terminal.
|
|
1050
|
+
const { grantGuard } = require('../guardrail/run-refusals');
|
|
1051
|
+
const guarded = grantGuard(root, ref.id, { env: process.env, interactive: process.stdin.isTTY === true && process.stdout.isTTY === true });
|
|
1052
|
+
if (guarded !== null) {
|
|
1053
|
+
// @implements A-SPEC-779.1 \u2014 the refusal carries its envelope, so an orchestrator reads its class.
|
|
1054
|
+
const { withRefusalLine } = require('../guardrail/refusal-codes');
|
|
1055
|
+
process.stdout.write(`${withRefusalLine(`\u2717 ${guarded}`)}\n`);
|
|
1056
|
+
return 1;
|
|
1057
|
+
}
|
|
980
1058
|
const r = grantRequest(root, ref.id, opts);
|
|
981
1059
|
process.stdout.write(r.ok ? `✓ approved — ${ref.subject('✓ approved — ')}\n${ref.detail(`valid until ${r.expires}`)}\n` : `✗ ${r.reason}\n`);
|
|
982
1060
|
return r.ok ? 0 : 1;
|
|
@@ -996,6 +1074,23 @@ async function main(argv) {
|
|
|
996
1074
|
process.stdout.write(r.ok ? `✓ denied — ${ref.subject('✓ denied — ')}\n${ref.detail('the denial was recorded')}\n` : `✗ ${r.reason}\n`);
|
|
997
1075
|
return r.ok ? 0 : 1;
|
|
998
1076
|
}
|
|
1077
|
+
// @implements A-SPEC-779.2 — the requester's own close: only the run that filed it, recorded as `withdrawn`.
|
|
1078
|
+
if (typeof flags.withdraw === 'string') {
|
|
1079
|
+
const reason = typeof flags.reason === 'string' ? flags.reason.trim() : '';
|
|
1080
|
+
if (reason === '') {
|
|
1081
|
+
process.stderr.write('✗ --withdraw requires --reason — it is what the operator reads in place of a decision\n');
|
|
1082
|
+
return 1;
|
|
1083
|
+
}
|
|
1084
|
+
const { withdrawRequest } = require('./approve');
|
|
1085
|
+
const ref = resolveRef(flags.withdraw);
|
|
1086
|
+
if ('refusal' in ref) {
|
|
1087
|
+
process.stdout.write(`✗ ${ref.refusal}\n`);
|
|
1088
|
+
return 1;
|
|
1089
|
+
}
|
|
1090
|
+
const r = withdrawRequest(root, ref.id, reason, { env: process.env, cwd: process.cwd() });
|
|
1091
|
+
process.stdout.write(r.ok ? `↩ withdrawn — ${ref.subject('↩ withdrawn — ')}\n${ref.detail('withdrawn by its run')}\n` : `✗ ${r.reason}\n`);
|
|
1092
|
+
return r.ok ? 0 : 1;
|
|
1093
|
+
}
|
|
999
1094
|
// @implements A-SPEC-649 — the operator withdraws a live grant. A granted id is no longer
|
|
1000
1095
|
// pending, so it resolves against the DECIDED ids (full id or a unique prefix), never a list index.
|
|
1001
1096
|
if (typeof flags.revoke === 'string') {
|
package/dist/holmes/cli/init.js
CHANGED
|
@@ -36,7 +36,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
36
36
|
exports.settingsPathOf = exports.MATCHERS = exports.SERVER_NAME = void 0;
|
|
37
37
|
exports.buildHookPlan = buildHookPlan;
|
|
38
38
|
exports.runInit = runInit;
|
|
39
|
-
// @implements A-SPEC-727, A-SPEC-724, A-SPEC-721, A-SPEC-738, A-SPEC-752.8, A-SPEC-772.2, A-SPEC-772.4, A-SPEC-772.5, A-SPEC-772.6
|
|
39
|
+
// @implements A-SPEC-727, A-SPEC-724, A-SPEC-721, A-SPEC-738, A-SPEC-752.8, A-SPEC-772.2, A-SPEC-772.4, A-SPEC-772.5, A-SPEC-772.6, A-SPEC-476.1
|
|
40
40
|
// @implements A-SPEC-709
|
|
41
41
|
// @implements A-SPEC-769.11
|
|
42
42
|
// @implements A-SPEC-340
|
|
@@ -1356,9 +1356,10 @@ function runInitUnguarded(opts) {
|
|
|
1356
1356
|
// runs doctor never met it. One-time by the nature of the act, so no marker is needed here.
|
|
1357
1357
|
// Fail-open: an invitation is not worth failing a wiring over.
|
|
1358
1358
|
try {
|
|
1359
|
-
const {
|
|
1359
|
+
const { resolveProjectSemanticTier } = require('../semantic/tier');
|
|
1360
1360
|
const { tierAdviceLines } = require('../semantic/tier-advice');
|
|
1361
|
-
|
|
1361
|
+
// @implements A-SPEC-476.1 — the target project's capped tier.
|
|
1362
|
+
for (const line of tierAdviceLines(resolveProjectSemanticTier(opts.target)))
|
|
1362
1363
|
messages.push(line);
|
|
1363
1364
|
}
|
|
1364
1365
|
catch { /* the wiring is the point; the invitation is not */
|
|
@@ -16,4 +16,6 @@ export interface NotifyDeps {
|
|
|
16
16
|
detached?: boolean;
|
|
17
17
|
}) => Pick<ChildProcess, 'unref' | 'on'>;
|
|
18
18
|
}
|
|
19
|
-
|
|
19
|
+
/** @implements A-SPEC-770.12 — the notification text: kind, target and, when the request carries one, its title. */
|
|
20
|
+
export declare function notificationBody(item: Pick<PendingRequest, 'kind' | 'target' | 'title'>): string;
|
|
21
|
+
export declare function notifyQueueArrival(item: Pick<PendingRequest, 'kind' | 'target' | 'title'>, deps?: NotifyDeps): void;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.notificationBody = notificationBody;
|
|
3
4
|
exports.notifyQueueArrival = notifyQueueArrival;
|
|
4
|
-
// @implements A-SPEC-497.2
|
|
5
|
+
// @implements A-SPEC-497.2, A-SPEC-770.12
|
|
5
6
|
/**
|
|
6
7
|
* OS-native arrival notification for the approval queue — the MAIN LANE's "you are needed" ping.
|
|
7
8
|
* Fire-and-forget by doctrine: a notification failure must change NOTHING about the watch loop,
|
|
@@ -13,11 +14,16 @@ exports.notifyQueueArrival = notifyQueueArrival;
|
|
|
13
14
|
*/
|
|
14
15
|
const node_child_process_1 = require("node:child_process");
|
|
15
16
|
const screen_safe_1 = require("./screen-safe");
|
|
17
|
+
/** @implements A-SPEC-770.12 — the notification text: kind, target and, when the request carries one, its title. */
|
|
18
|
+
function notificationBody(item) {
|
|
19
|
+
const kind = (0, screen_safe_1.flattenField)(item.kind, 40);
|
|
20
|
+
const target = (0, screen_safe_1.flattenField)(item.target, 80);
|
|
21
|
+
const title = typeof item.title === 'string' && item.title.trim() !== '' ? ` 「${(0, screen_safe_1.flattenField)(item.title, 80)}」` : '';
|
|
22
|
+
return `${kind} — ${target}${title} · 결정: holmes approve`;
|
|
23
|
+
}
|
|
16
24
|
function notifyQueueArrival(item, deps = { platform: process.platform, spawn: (cmd, args) => (0, node_child_process_1.spawn)(cmd, args, { stdio: 'ignore', detached: false }) }) {
|
|
17
25
|
try {
|
|
18
|
-
const
|
|
19
|
-
const target = (0, screen_safe_1.flattenField)(item.target, 80);
|
|
20
|
-
const body = `${kind} — ${target} · 결정: holmes approve`;
|
|
26
|
+
const body = notificationBody(item);
|
|
21
27
|
let cmd;
|
|
22
28
|
let args;
|
|
23
29
|
if (deps.platform === 'darwin') {
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export interface ReviewOptions {
|
|
2
|
+
target?: string;
|
|
3
|
+
base?: string;
|
|
4
|
+
head?: string;
|
|
5
|
+
verdict?: string;
|
|
6
|
+
findings?: string[];
|
|
7
|
+
engine?: string;
|
|
8
|
+
model?: string;
|
|
9
|
+
session?: string;
|
|
10
|
+
strict?: boolean;
|
|
11
|
+
/** @implements A-SPEC-102.7 — `--solid <S|O|L|I|D>=<compliant|violation|n-a>:<evidence>`, repeatable. */
|
|
12
|
+
solid?: string[];
|
|
13
|
+
}
|
|
14
|
+
export interface ReviewDeps {
|
|
15
|
+
env?: NodeJS.ProcessEnv;
|
|
16
|
+
cwd?: string;
|
|
17
|
+
interactive?: boolean;
|
|
18
|
+
}
|
|
19
|
+
type Io = {
|
|
20
|
+
stdout: (t: string) => void;
|
|
21
|
+
stderr: (t: string) => void;
|
|
22
|
+
};
|
|
23
|
+
export declare const REVIEW_USAGE: string;
|
|
24
|
+
export declare function runReview(sub: string | undefined, opts: ReviewOptions, io: Io, deps?: ReviewDeps): number;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,111 @@
|
|
|
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.REVIEW_USAGE = void 0;
|
|
37
|
+
exports.runReview = runReview;
|
|
38
|
+
// @implements A-SPEC-102.2, A-SPEC-102.6, A-SPEC-102.7
|
|
39
|
+
// `holmes-kit review record|status|gate|mrp` — the review verdict surface for callers that are not MCP clients.
|
|
40
|
+
const path = __importStar(require("node:path"));
|
|
41
|
+
const verdicts_1 = require("../review/verdicts");
|
|
42
|
+
/** The checklist from `--solid` values; an unreadable value is named. */
|
|
43
|
+
function parseSolid(values) {
|
|
44
|
+
const out = {};
|
|
45
|
+
for (const v of values) {
|
|
46
|
+
const m = /^([SOLID])=(compliant|violation|n-a):(.*)$/s.exec(v);
|
|
47
|
+
if (!m)
|
|
48
|
+
return { error: `--solid ${v} is not <S|O|L|I|D>=<compliant|violation|n-a>:<evidence>` };
|
|
49
|
+
out[m[1]] = { status: m[2], evidence: m[3].trim() };
|
|
50
|
+
}
|
|
51
|
+
return { solid: out };
|
|
52
|
+
}
|
|
53
|
+
exports.REVIEW_USAGE = 'usage: holmes-kit review record --base <rev> --head <rev> --verdict pass|fail [--finding <id>]… [--solid <S|O|L|I|D>=<compliant|violation|n-a>:<evidence>]… [--engine e] [--model m] [--session s] [--target <dir>]\n'
|
|
54
|
+
+ ' holmes-kit review status --base <rev> --head <rev> [--target <dir>]\n'
|
|
55
|
+
+ ' holmes-kit review gate --base <rev> --head <rev> [--strict] [--target <dir>]\n'
|
|
56
|
+
+ ' holmes-kit review mrp --base <rev> --head <rev> [--target <dir>]\n';
|
|
57
|
+
function runReview(sub, opts, io, deps = {}) {
|
|
58
|
+
const root = path.resolve(opts.target ?? deps.cwd ?? process.cwd());
|
|
59
|
+
if (!opts.base || !opts.head || !['record', 'status', 'gate', 'mrp'].includes(sub ?? '')) {
|
|
60
|
+
io.stderr(exports.REVIEW_USAGE);
|
|
61
|
+
return 2;
|
|
62
|
+
}
|
|
63
|
+
// @implements A-SPEC-102.6 — the merge-ready package; exit 0 only when it is ready.
|
|
64
|
+
if (sub === 'mrp') {
|
|
65
|
+
const { buildMrp } = require('../review/mrp');
|
|
66
|
+
const m = buildMrp(root, opts.base, opts.head);
|
|
67
|
+
if ('error' in m) {
|
|
68
|
+
io.stderr(`✗ ${m.error}\n`);
|
|
69
|
+
return 1;
|
|
70
|
+
}
|
|
71
|
+
io.stdout(`${JSON.stringify(m, null, 2)}\n`);
|
|
72
|
+
return m.ready ? 0 : 1;
|
|
73
|
+
}
|
|
74
|
+
if (sub === 'record') {
|
|
75
|
+
if (opts.verdict !== 'pass' && opts.verdict !== 'fail') {
|
|
76
|
+
io.stderr(exports.REVIEW_USAGE);
|
|
77
|
+
return 2;
|
|
78
|
+
}
|
|
79
|
+
const solid = opts.solid && opts.solid.length > 0 ? parseSolid(opts.solid) : undefined;
|
|
80
|
+
if (solid && 'error' in solid) {
|
|
81
|
+
io.stderr(`✗ ${solid.error}\n`);
|
|
82
|
+
return 2;
|
|
83
|
+
}
|
|
84
|
+
const r = (0, verdicts_1.recordVerdict)(root, {
|
|
85
|
+
base: opts.base, head: opts.head, verdict: opts.verdict, findings: opts.findings ?? [],
|
|
86
|
+
...(solid ? { solid: solid.solid } : {}),
|
|
87
|
+
...(opts.engine ? { engine: opts.engine } : {}), ...(opts.model ? { model: opts.model } : {}), ...(opts.session ? { session: opts.session } : {}),
|
|
88
|
+
}, {
|
|
89
|
+
env: deps.env ?? process.env, cwd: deps.cwd ?? process.cwd(),
|
|
90
|
+
interactive: deps.interactive ?? (process.stdin.isTTY === true && process.stdout.isTTY === true),
|
|
91
|
+
});
|
|
92
|
+
if (!r.ok) {
|
|
93
|
+
io.stderr(`✗ ${r.reason}\n`);
|
|
94
|
+
return 1;
|
|
95
|
+
}
|
|
96
|
+
io.stdout(`${JSON.stringify(r.record)}\n`);
|
|
97
|
+
return 0;
|
|
98
|
+
}
|
|
99
|
+
if (sub === 'status') {
|
|
100
|
+
const s = (0, verdicts_1.rangeStatus)(root, opts.base, opts.head);
|
|
101
|
+
if ('error' in s) {
|
|
102
|
+
io.stderr(`✗ ${s.error}\n`);
|
|
103
|
+
return 1;
|
|
104
|
+
}
|
|
105
|
+
io.stdout(`${JSON.stringify(s, null, 2)}\n`);
|
|
106
|
+
return 0;
|
|
107
|
+
}
|
|
108
|
+
const g = (0, verdicts_1.gateRange)(root, opts.base, opts.head, { strict: opts.strict === true });
|
|
109
|
+
io.stdout(`${JSON.stringify(g)}\n`);
|
|
110
|
+
return g.ok ? 0 : 1;
|
|
111
|
+
}
|