@holmes-lab/holmes-kit 0.39.0 → 0.40.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 +344 -6
- package/README.md +54 -41
- package/dist/.build-id +1 -1
- package/dist/holmes/admission/core/admission-policy.d.ts +37 -0
- package/dist/holmes/admission/core/admission-policy.js +147 -0
- package/dist/holmes/admission/core/bounded-reader.d.ts +56 -0
- package/dist/holmes/admission/core/bounded-reader.js +135 -0
- package/dist/holmes/admission/core/change-classifier.d.ts +34 -0
- package/dist/holmes/admission/core/change-classifier.js +278 -0
- package/dist/holmes/admission/core/config-loader.d.ts +30 -0
- package/dist/holmes/admission/core/config-loader.js +145 -0
- package/dist/holmes/admission/core/event-judgement.d.ts +37 -0
- package/dist/holmes/admission/core/event-judgement.js +251 -0
- package/dist/holmes/admission/core/path-rules.d.ts +35 -0
- package/dist/holmes/admission/core/path-rules.js +88 -0
- package/dist/holmes/admission/core/pin.d.ts +7 -0
- package/dist/holmes/admission/core/pin.js +29 -0
- package/dist/holmes/admission/core/ports.d.ts +48 -0
- package/dist/holmes/admission/core/ports.js +11 -0
- package/dist/holmes/admission/core/range-resolver.d.ts +32 -0
- package/dist/holmes/admission/core/range-resolver.js +51 -0
- package/dist/holmes/admission/core/self-containment.d.ts +1 -0
- package/dist/holmes/admission/core/self-containment.js +125 -0
- package/dist/holmes/admission/core/signature-source.d.ts +9 -0
- package/dist/holmes/admission/core/signature-source.js +4 -0
- package/dist/holmes/admission/core/transition-planner.d.ts +15 -0
- package/dist/holmes/admission/core/transition-planner.js +14 -0
- package/dist/holmes/admission/core/verdict.d.ts +38 -0
- package/dist/holmes/admission/core/verdict.js +17 -0
- package/dist/holmes/admission/core/wiring.d.ts +44 -0
- package/dist/holmes/admission/core/wiring.js +618 -0
- package/dist/holmes/admission/forge/git-object-port.d.ts +4 -0
- package/dist/holmes/admission/forge/git-object-port.js +132 -0
- package/dist/holmes/assoc/assoc-arm.d.ts +1 -1
- package/dist/holmes/assoc/assoc-arm.js +1 -1
- package/dist/holmes/cli/agents.d.ts +8 -0
- package/dist/holmes/cli/agents.js +9 -5
- package/dist/holmes/cli/approve-cli.d.ts +2 -0
- package/dist/holmes/cli/approve-cli.js +392 -0
- package/dist/holmes/cli/approve-ref.d.ts +13 -7
- package/dist/holmes/cli/approve-ref.js +30 -10
- package/dist/holmes/cli/approve-status.d.ts +26 -2
- package/dist/holmes/cli/approve-status.js +98 -18
- package/dist/holmes/cli/approve-watch.d.ts +5 -0
- package/dist/holmes/cli/approve-watch.js +10 -5
- package/dist/holmes/cli/approve.d.ts +49 -13
- package/dist/holmes/cli/approve.js +249 -67
- package/dist/holmes/cli/attest.js +2 -1
- package/dist/holmes/cli/autonomy.d.ts +4 -1
- package/dist/holmes/cli/autonomy.js +17 -10
- package/dist/holmes/cli/codex-oracle.d.ts +11 -0
- package/dist/holmes/cli/codex-oracle.js +5 -1
- package/dist/holmes/cli/codex-toml.d.ts +10 -0
- package/dist/holmes/cli/codex-toml.js +36 -2
- package/dist/holmes/cli/doctor-boundary.d.ts +76 -0
- package/dist/holmes/cli/doctor-boundary.js +308 -0
- package/dist/holmes/cli/doctor-locks.d.ts +15 -0
- package/dist/holmes/cli/doctor-locks.js +119 -0
- package/dist/holmes/cli/doctor.d.ts +2 -0
- package/dist/holmes/cli/doctor.js +34 -5
- package/dist/holmes/cli/flags.d.ts +23 -0
- package/dist/holmes/cli/flags.js +89 -0
- package/dist/holmes/cli/index.d.ts +5 -1
- package/dist/holmes/cli/index.js +202 -424
- package/dist/holmes/cli/init.js +33 -0
- package/dist/holmes/cli/lock-recover.d.ts +5 -0
- package/dist/holmes/cli/lock-recover.js +126 -0
- package/dist/holmes/cli/mcp-processes.js +1 -1
- package/dist/holmes/cli/release-docs.js +1 -1
- package/dist/holmes/cli/run-exec.d.ts +141 -0
- package/dist/holmes/cli/run-exec.js +1435 -0
- package/dist/holmes/cli/run-provision.d.ts +3 -1
- package/dist/holmes/cli/run-provision.js +255 -44
- package/dist/holmes/cli/run-wiring.d.ts +69 -0
- package/dist/holmes/cli/run-wiring.js +270 -0
- package/dist/holmes/cli/run.d.ts +21 -0
- package/dist/holmes/cli/run.js +341 -92
- package/dist/holmes/cli/runtime-binding-approval.js +32 -19
- package/dist/holmes/cli/screen-safe.d.ts +3 -92
- package/dist/holmes/cli/screen-safe.js +18 -756
- package/dist/holmes/config/config.d.ts +2 -0
- package/dist/holmes/config/config.js +5 -2
- package/dist/holmes/cpg/foundation/language-matrix.js +2 -2
- package/dist/holmes/cpg/import-resolver.js +1 -1
- package/dist/holmes/governance/approval-decisions.d.ts +47 -0
- package/dist/holmes/governance/approval-decisions.js +29 -0
- package/dist/holmes/governance/approval-grants.d.ts +220 -1
- package/dist/holmes/governance/approval-grants.js +612 -33
- package/dist/holmes/governance/approval-queue.d.ts +26 -0
- package/dist/holmes/governance/approval-queue.js +109 -11
- package/dist/holmes/governance/approval-spend.d.ts +95 -0
- package/dist/holmes/governance/approval-spend.js +191 -0
- package/dist/holmes/governance/autonomous-shell.d.ts +61 -0
- package/dist/holmes/governance/autonomous-shell.js +332 -0
- package/dist/holmes/governance/autonomy.d.ts +5 -0
- package/dist/holmes/governance/autonomy.js +16 -11
- package/dist/holmes/governance/constitution.d.ts +5 -0
- package/dist/holmes/governance/constitution.js +32 -12
- package/dist/holmes/governance/full-autonomy.d.ts +10 -0
- package/dist/holmes/governance/full-autonomy.js +103 -7
- package/dist/holmes/governance/harness-catalog.d.ts +103 -0
- package/dist/holmes/governance/harness-catalog.js +348 -0
- package/dist/holmes/governance/human-channel.d.ts +38 -0
- package/dist/holmes/governance/human-channel.js +49 -0
- package/dist/holmes/governance/install-manifest.d.ts +22 -0
- package/dist/holmes/governance/install-manifest.js +160 -0
- package/dist/holmes/governance/ledger-rechain.js +2 -0
- package/dist/holmes/governance/ledger-store.conformance.d.ts +7 -1
- package/dist/holmes/governance/ledger-store.conformance.js +66 -0
- package/dist/holmes/governance/ledger-store.d.ts +88 -11
- package/dist/holmes/governance/ledger-store.js +186 -8
- package/dist/holmes/governance/provenance-chain.d.ts +16 -4
- package/dist/holmes/governance/provenance-chain.js +19 -4
- package/dist/holmes/governance/provenance-ledger.d.ts +6 -3
- package/dist/holmes/governance/provenance-ledger.js +53 -18
- package/dist/holmes/governance/push-gate-runner.js +11 -7
- package/dist/holmes/governance/recorded-pairs.d.ts +96 -0
- package/dist/holmes/governance/recorded-pairs.js +522 -0
- package/dist/holmes/governance/replica-id.d.ts +1 -1
- package/dist/holmes/governance/replica-id.js +1 -1
- package/dist/holmes/governance/spec-seam.d.ts +59 -0
- package/dist/holmes/governance/spec-seam.js +587 -0
- package/dist/holmes/governance/spend-kinds.d.ts +16 -0
- package/dist/holmes/governance/spend-kinds.js +18 -0
- package/dist/holmes/guardrail/decision-ledger.d.ts +2 -1
- package/dist/holmes/guardrail/decision-ledger.js +2 -1
- package/dist/holmes/guardrail/impact-gate.d.ts +1 -0
- package/dist/holmes/guardrail/impact-gate.js +1 -1
- package/dist/holmes/guardrail/line-continuation.d.ts +8 -0
- package/dist/holmes/guardrail/line-continuation.js +39 -0
- package/dist/holmes/guardrail/operator-person.d.ts +28 -4
- package/dist/holmes/guardrail/operator-person.js +57 -11
- package/dist/holmes/guardrail/refusal-codes.d.ts +8 -3
- package/dist/holmes/guardrail/refusal-codes.js +64 -10
- package/dist/holmes/guardrail/risk-classifier.d.ts +15 -9
- package/dist/holmes/guardrail/risk-classifier.js +228 -16
- package/dist/holmes/guardrail/risk-gate.d.ts +2 -8
- package/dist/holmes/guardrail/risk-gate.js +7 -34
- package/dist/holmes/guardrail/risk-types.d.ts +10 -0
- package/dist/holmes/guardrail/run-plan-scope.js +3 -1
- package/dist/holmes/guardrail/run-refusals.js +24 -8
- package/dist/holmes/guardrail/run-stages.d.ts +5 -0
- package/dist/holmes/guardrail/run-stages.js +25 -5
- package/dist/holmes/guardrail/scope-judgment.js +1 -1
- package/dist/holmes/guardrail/shell-words.js +24 -3
- package/dist/holmes/guardrail/unresolved-write.d.ts +40 -0
- package/dist/holmes/guardrail/unresolved-write.js +556 -0
- package/dist/holmes/guardrail/write-target.d.ts +3 -0
- package/dist/holmes/guardrail/write-target.js +26 -5
- package/dist/holmes/hooks/pre-tool-use.d.ts +105 -1
- package/dist/holmes/hooks/pre-tool-use.js +1134 -167
- package/dist/holmes/hooks/rtm-refresh-child.d.ts +1 -1
- package/dist/holmes/hooks/rtm-refresh-child.js +1 -1
- package/dist/holmes/hooks/stop.d.ts +23 -0
- package/dist/holmes/hooks/stop.js +86 -33
- package/dist/holmes/mcp/approval-adapters.js +3 -1
- package/dist/holmes/mcp/approval-commit.js +3 -2
- package/dist/holmes/mcp/approval-policy.d.ts +2 -1
- package/dist/holmes/mcp/approval-policy.js +3 -1
- package/dist/holmes/mcp/handlers/adoption.d.ts +1 -1
- package/dist/holmes/mcp/handlers/approval-ask.d.ts +3 -0
- package/dist/holmes/mcp/handlers/approval-ask.js +18 -7
- package/dist/holmes/mcp/handlers/entity-integration.d.ts +3 -3
- package/dist/holmes/mcp/handlers/entity-integration.js +29 -11
- package/dist/holmes/mcp/handlers/entity-renumber.d.ts +4 -4
- package/dist/holmes/mcp/handlers/entity-renumber.js +29 -11
- package/dist/holmes/mcp/handlers/entity-store.d.ts +2 -2
- package/dist/holmes/mcp/handlers/entity-store.js +133 -59
- package/dist/holmes/mcp/handlers/operator-inspection.d.ts +9 -5
- package/dist/holmes/mcp/handlers/operator-inspection.js +79 -16
- package/dist/holmes/mcp/handlers/phase-queries.d.ts +1 -1
- package/dist/holmes/mcp/handlers/requirement-triage.d.ts +4 -4
- package/dist/holmes/mcp/handlers/review-evidence.d.ts +2 -2
- package/dist/holmes/mcp/handlers/review-evidence.js +35 -11
- package/dist/holmes/mcp/handlers/review-queries.d.ts +5 -0
- package/dist/holmes/mcp/handlers/review-queries.js +8 -1
- package/dist/holmes/mcp/handlers/review-verdict.d.ts +3 -0
- package/dist/holmes/mcp/handlers/review-verdict.js +10 -3
- package/dist/holmes/mcp/handlers/risk-assessment.d.ts +7 -2
- package/dist/holmes/mcp/handlers/risk-assessment.js +34 -12
- package/dist/holmes/mcp/handlers/runtime-binding-tool.d.ts +2 -2
- package/dist/holmes/mcp/handlers/slice-orchestration.d.ts +6 -1
- package/dist/holmes/mcp/handlers/slice-orchestration.js +14 -1
- package/dist/holmes/mcp/handlers/spec-approval.d.ts +15 -3
- package/dist/holmes/mcp/handlers/spec-approval.js +32 -5
- package/dist/holmes/mcp/handlers/spec-authoring.d.ts +2 -2
- package/dist/holmes/mcp/handlers/spec-authoring.js +19 -2
- package/dist/holmes/mcp/handlers/spec-lifecycle.d.ts +11 -38
- package/dist/holmes/mcp/handlers/spec-lifecycle.js +441 -94
- package/dist/holmes/mcp/handlers/spec-queries.d.ts +2 -2
- package/dist/holmes/mcp/handlers/taint-screening.d.ts +1 -1
- package/dist/holmes/mcp/handlers/taint-screening.js +2 -2
- package/dist/holmes/mcp/handlers/test-execution.d.ts +1 -1
- package/dist/holmes/mcp/handlers/workspace-queries.d.ts +2 -2
- package/dist/holmes/mcp/handlers.d.ts +89 -79
- package/dist/holmes/mcp/handlers.js +69 -22
- package/dist/holmes/mcp/harness-attestation.d.ts +78 -5
- package/dist/holmes/mcp/harness-attestation.js +325 -53
- package/dist/holmes/mcp/maintenance-analyze.d.ts +1 -1
- package/dist/holmes/mcp/maintenance-analyze.js +9 -9
- package/dist/holmes/mcp/maintenance-evidence.js +31 -2
- package/dist/holmes/mcp/requirement-triage-evidence.js +22 -13
- package/dist/holmes/mcp/server-staleness.js +1 -1
- package/dist/holmes/mcp/server.js +9 -8
- package/dist/holmes/mcp/spec-id-guard.js +1 -1
- package/dist/holmes/mcp/tool-schemas.d.ts +13 -0
- package/dist/holmes/mcp/tool-schemas.js +29 -2
- package/dist/holmes/project/act-root.d.ts +19 -0
- package/dist/holmes/project/act-root.js +100 -0
- package/dist/holmes/project/baseline.js +4 -3
- package/dist/holmes/project/bounded-group.d.ts +47 -0
- package/dist/holmes/project/bounded-group.js +140 -0
- package/dist/holmes/project/bounded-io.d.ts +50 -2
- package/dist/holmes/project/bounded-io.js +138 -6
- package/dist/holmes/project/change-source.js +2 -2
- package/dist/holmes/project/instance-id.d.ts +10 -0
- package/dist/holmes/project/instance-id.js +233 -0
- package/dist/holmes/project/machine-identity.d.ts +25 -0
- package/dist/holmes/project/machine-identity.js +133 -0
- package/dist/holmes/project/owned-lock.d.ts +84 -0
- package/dist/holmes/project/owned-lock.js +263 -0
- package/dist/holmes/project/plain-lock-fs.d.ts +2 -0
- package/dist/holmes/project/plain-lock-fs.js +126 -0
- package/dist/holmes/project/request-lock.d.ts +85 -0
- package/dist/holmes/project/request-lock.js +459 -0
- package/dist/holmes/project/root.d.ts +12 -4
- package/dist/holmes/project/root.js +26 -7
- package/dist/holmes/project/run-records.d.ts +19 -0
- package/dist/holmes/project/run-records.js +94 -12
- package/dist/holmes/project/screen-text.d.ts +94 -0
- package/dist/holmes/project/screen-text.js +763 -0
- package/dist/holmes/project/spend-lock.d.ts +82 -0
- package/dist/holmes/project/spend-lock.js +413 -0
- package/dist/holmes/refresh/freshness-coordinator.d.ts +1 -1
- package/dist/holmes/refresh/freshness-coordinator.js +1 -1
- package/dist/holmes/review/condition-hunk-replay.js +4 -2
- package/dist/holmes/review/confidence-calibration.d.ts +1 -1
- package/dist/holmes/review/confidence-calibration.js +1 -1
- package/dist/holmes/review/content-verify.js +1 -1
- package/dist/holmes/review/hop-ablation.d.ts +4 -4
- package/dist/holmes/review/hop-ablation.js +5 -5
- package/dist/holmes/review/point-in-time-replay.js +12 -3
- package/dist/holmes/review/rank-diagnosis.d.ts +2 -2
- package/dist/holmes/review/rank-diagnosis.js +1 -1
- package/dist/holmes/review/replay-corpus.d.ts +10 -4
- package/dist/holmes/review/replay-corpus.js +25 -9
- package/dist/holmes/review/requirement-triage.js +2 -2
- package/dist/holmes/review/semantic-arm.d.ts +3 -3
- package/dist/holmes/review/semantic-arm.js +3 -3
- package/dist/holmes/review/test-outcomes.js +3 -1
- package/dist/holmes/review/test-runner.d.ts +11 -0
- package/dist/holmes/review/test-runner.js +31 -10
- package/dist/holmes/review/test-selection-breadth.js +2 -2
- package/dist/holmes/review/verdicts.d.ts +105 -8
- package/dist/holmes/review/verdicts.js +640 -36
- package/dist/holmes/rtm/anchor-census.d.ts +9 -0
- package/dist/holmes/rtm/anchor-census.js +151 -0
- package/dist/holmes/rtm/anchor-ids.d.ts +25 -1
- package/dist/holmes/rtm/anchor-ids.js +45 -2
- package/dist/holmes/rtm/comment-ranges.d.ts +2 -0
- package/dist/holmes/rtm/comment-ranges.js +104 -0
- package/dist/holmes/rtm/counted-tests.d.ts +1 -0
- package/dist/holmes/rtm/counted-tests.js +63 -0
- package/dist/holmes/rtm/impact-advisory.d.ts +1 -1
- package/dist/holmes/rtm/known-defects.js +1 -1
- package/dist/holmes/rtm/localize.js +1 -1
- package/dist/holmes/rtm/taint-benchmark.d.ts +1 -1
- package/dist/holmes/rtm/taint-vocabulary.d.ts +1 -1
- package/dist/holmes/rtm/test-scope.d.ts +31 -0
- package/dist/holmes/rtm/test-scope.js +166 -5
- package/dist/holmes/rtm/trace-gaps.js +1 -1
- package/dist/holmes/runtime/dispatch.d.ts +10 -0
- package/dist/holmes/runtime/dispatch.js +12 -1
- package/dist/holmes/semantic/cloud-usage.d.ts +1 -1
- package/dist/holmes/semantic/cloud-usage.js +1 -1
- package/dist/holmes/semantic/unreadable-paths.d.ts +1 -1
- package/dist/holmes/semantic/unreadable-paths.js +1 -1
- package/dist/holmes/spec/approval-blockers.js +1 -1
- package/dist/holmes/spec/entity-store.d.ts +6 -1
- package/dist/holmes/spec/entity-store.js +16 -2
- package/dist/holmes/spec/entity-transaction.d.ts +7 -2
- package/dist/holmes/spec/entity-transaction.js +87 -170
- package/dist/holmes/spec/spec-store.d.ts +12 -6
- package/dist/holmes/spec/spec-store.js +4 -2
- package/dist/holmes/spec/spec-types.js +1 -1
- package/dist/holmes/spec/succession-guard.d.ts +56 -0
- package/dist/holmes/spec/succession-guard.js +187 -0
- package/dist/holmes/spec/succession.d.ts +70 -0
- package/dist/holmes/spec/succession.js +171 -0
- package/dist/holmes/spec/transition-policy.d.ts +2 -2
- package/docs/install-guide.md +9 -3
- package/docs/language-support.md +78 -0
- package/package.json +4 -3
- package/playbooks/author-slice/PLAYBOOK.md +1 -1
- package/playbooks/promote-slice/PLAYBOOK.md +5 -1
- package/playbooks/publish/PLAYBOOK.md +45 -33
- package/dist/holmes/review/manual-baseline.d.ts +0 -209
- package/dist/holmes/review/manual-baseline.js +0 -2847
|
@@ -0,0 +1,119 @@
|
|
|
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.SPEND_LOCK_PATHS = void 0;
|
|
37
|
+
exports.spendLockChecks = spendLockChecks;
|
|
38
|
+
exports.requestLockChecks = requestLockChecks;
|
|
39
|
+
// @implements A-SPEC-245.8, A-SPEC-245.10, A-SPEC-794.6
|
|
40
|
+
/**
|
|
41
|
+
* doctor's spend-lock lines (A-SPEC-245.8 item 9). No line when no lock is held, no leak is recorded and the lock
|
|
42
|
+
* paths are ignored, so a workspace without spends prints what it printed before. Every line is WARN, never FAIL: the
|
|
43
|
+
* doctor exit code does not change. The machine identity is read only when a holder exists.
|
|
44
|
+
*/
|
|
45
|
+
const fs = __importStar(require("node:fs"));
|
|
46
|
+
const path = __importStar(require("node:path"));
|
|
47
|
+
const spend_lock_1 = require("../project/spend-lock");
|
|
48
|
+
/** The paths that must never be synchronised: a lock or claim copied to another clone would hold or recover there. */
|
|
49
|
+
exports.SPEND_LOCK_PATHS = [`${path.posix.dirname(spend_lock_1.SPEND_LOCK_DIR)}/`, `${spend_lock_1.SPEND_CLAIMS_DIR}/`, `${spend_lock_1.SPEND_RETIRED_DIR}/`, spend_lock_1.SPEND_LEAKS_FILE];
|
|
50
|
+
function gitNotIgnored(root, paths) {
|
|
51
|
+
const { gitOnce } = require('../project/bounded-io');
|
|
52
|
+
if (gitOnce(root, ['rev-parse', '--is-inside-work-tree'], 'repo').status !== 0)
|
|
53
|
+
return null;
|
|
54
|
+
const out = [];
|
|
55
|
+
for (const p of paths) {
|
|
56
|
+
const r = gitOnce(root, ['check-ignore', '-q', '--', p], 'repo');
|
|
57
|
+
if (r.status === 1)
|
|
58
|
+
out.push(p);
|
|
59
|
+
else if (r.status !== 0)
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
return out;
|
|
63
|
+
}
|
|
64
|
+
const realDeps = {
|
|
65
|
+
notIgnored: gitNotIgnored,
|
|
66
|
+
hostId: () => require('../project/machine-identity').hostId(),
|
|
67
|
+
now: Date.now,
|
|
68
|
+
};
|
|
69
|
+
function spendLockChecks(root, deps = realDeps) {
|
|
70
|
+
if (!fs.existsSync(path.join(root, '.ax')))
|
|
71
|
+
return [];
|
|
72
|
+
const checks = [];
|
|
73
|
+
const holder = (0, spend_lock_1.spendLockHolder)(root);
|
|
74
|
+
if (holder) {
|
|
75
|
+
const me = deps.hostId();
|
|
76
|
+
const match = holder.host === null || me === null ? 'unknown' : holder.host === me ? 'same' : 'different';
|
|
77
|
+
const ageMs = Math.max(0, deps.now() - Date.parse(holder.acquiredAt));
|
|
78
|
+
const alarm = ageMs > 4 * holder.boundMs;
|
|
79
|
+
checks.push({ name: 'spend lock', level: 'WARN',
|
|
80
|
+
detail: `held by pid ${holder.pid} (host ${match}), age ${(ageMs / 1000).toFixed(1)} s`
|
|
81
|
+
+ (alarm ? `; alarm: held longer than 4x its bound of ${(holder.boundMs / 1000).toFixed(1)} s` : ''),
|
|
82
|
+
fix: alarm ? 'If the holder is dead, the operator runs `holmes-kit lock recover spend` from a terminal.' : undefined });
|
|
83
|
+
}
|
|
84
|
+
else if (fs.existsSync(path.join(root, spend_lock_1.SPEND_LOCK_DIR))) {
|
|
85
|
+
checks.push({ name: 'spend lock', level: 'WARN', detail: 'held, with no readable holder record; it is preserved for inspection',
|
|
86
|
+
fix: 'Inspect .ax/state/spend-lock/held before removing anything.' });
|
|
87
|
+
}
|
|
88
|
+
let leaks = 0;
|
|
89
|
+
try {
|
|
90
|
+
leaks = fs.readFileSync(path.join(root, spend_lock_1.SPEND_LEAKS_FILE), 'utf8').split('\n').filter(Boolean).length;
|
|
91
|
+
}
|
|
92
|
+
catch { /* none */ }
|
|
93
|
+
if (leaks > 0) {
|
|
94
|
+
checks.push({ name: 'spend lock leaks', level: 'WARN', detail: `${leaks} leak(s) recorded in ${spend_lock_1.SPEND_LEAKS_FILE}: a process acquired the spend lock it already held` });
|
|
95
|
+
}
|
|
96
|
+
const notIgnored = deps.notIgnored(root, exports.SPEND_LOCK_PATHS);
|
|
97
|
+
if (notIgnored && notIgnored.length > 0) {
|
|
98
|
+
checks.push({ name: 'spend lock paths', level: 'WARN', detail: `not ignored by git: ${notIgnored.join(', ')}; a synchronised lock would hold or recover in another clone`,
|
|
99
|
+
fix: `Add ${notIgnored.join(' ')} to .gitignore.` });
|
|
100
|
+
}
|
|
101
|
+
return checks;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* A-SPEC-794.6: one WARN per held request lock, with its age, and the operator's route once it is held longer than 4x
|
|
105
|
+
* its bound. Nothing is printed when no request lock is held.
|
|
106
|
+
*/
|
|
107
|
+
function requestLockChecks(root, now = Date.now) {
|
|
108
|
+
if (!fs.existsSync(path.join(root, '.ax')))
|
|
109
|
+
return [];
|
|
110
|
+
const { requestLockHolders, AGE_FACTOR } = require('../project/request-lock');
|
|
111
|
+
return requestLockHolders(root).map((h) => {
|
|
112
|
+
const ageMs = Math.max(0, now() - Date.parse(h.acquiredAt));
|
|
113
|
+
const alarm = ageMs > AGE_FACTOR * h.boundMs;
|
|
114
|
+
return { name: 'request lock', level: 'WARN',
|
|
115
|
+
detail: `${h.id} held by pid ${h.pid}, age ${(ageMs / 1000).toFixed(1)} s`
|
|
116
|
+
+ (alarm ? `; alarm: held longer than ${AGE_FACTOR}x its bound of ${(h.boundMs / 1000).toFixed(1)} s` : ''),
|
|
117
|
+
fix: alarm ? `If the holder is dead, the operator runs \`holmes-kit lock recover request ${h.id} --confirm-holder-dead\` from a terminal.` : undefined };
|
|
118
|
+
});
|
|
119
|
+
}
|
|
@@ -31,6 +31,8 @@ interface RoutedDoctorContext {
|
|
|
31
31
|
script: (harness: RuntimeHarness, entry: RuntimeEntry) => string;
|
|
32
32
|
}
|
|
33
33
|
export interface DoctorOptions {
|
|
34
|
+
/** @implements A-SPEC-792.46, A-SPEC-792.48 — the forge reader for the boundary diagnosis; absent or null skips it. */
|
|
35
|
+
forge?: ((target: string, installedVersion: string) => import('./doctor-boundary').ForgeDeps) | null;
|
|
34
36
|
/** Explicit operator registry for isolated installation diagnostics. */
|
|
35
37
|
runtimeRegistryPath?: string;
|
|
36
38
|
/** Isolated native Claude settings home for integration diagnostics. */
|
|
@@ -75,7 +75,7 @@ exports.wiringHandshakeChecks = wiringHandshakeChecks;
|
|
|
75
75
|
exports.semanticCoverageCheck = semanticCoverageCheck;
|
|
76
76
|
exports.semanticTierVerdict = semanticTierVerdict;
|
|
77
77
|
exports.detectTreeKeyTemporary = detectTreeKeyTemporary;
|
|
78
|
-
// @implements A-SPEC-251.5, 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
|
|
78
|
+
// @implements A-SPEC-794.59, A-SPEC-794.55, A-SPEC-792.46, A-SPEC-792.48, A-SPEC-245.8, A-SPEC-251.5, 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, A-SPEC-102.28, A-SPEC-102.29
|
|
79
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
|
|
80
80
|
const doctor_guidance_1 = require("./doctor-guidance");
|
|
81
81
|
// @implements A-SPEC-264, A-SPEC-423, A-SPEC-549.1, A-SPEC-590
|
|
@@ -249,8 +249,8 @@ function routedCodexDisabled(raw, hooksPath, indices, event = 'pre_tool_use') {
|
|
|
249
249
|
if (!parsed.ok)
|
|
250
250
|
return false;
|
|
251
251
|
const doc = parsed.doc;
|
|
252
|
-
if (
|
|
253
|
-
return true;
|
|
252
|
+
if ((0, codex_toml_1.codexHooksFeatureOff)(doc))
|
|
253
|
+
return true; // @implements A-SPEC-774.46 — `hooks` and its old name `codex_hooks`
|
|
254
254
|
const paths = new Set([hooksPath]);
|
|
255
255
|
try {
|
|
256
256
|
paths.add(fs.realpathSync(hooksPath));
|
|
@@ -1168,7 +1168,7 @@ async function runDoctor(packageRoot, target, opts, extraChecks) {
|
|
|
1168
1168
|
}).split('\n').map((l) => l.trim().split('/').pop()).filter(Boolean));
|
|
1169
1169
|
const untracked = onDisk.filter((f) => !tracked.has(f));
|
|
1170
1170
|
if (untracked.length > 0) {
|
|
1171
|
-
add('ledger tracked', 'WARN', `Untracked ledger(s): ${untracked.join(', ')} — not in git, so the ART-2 truncation backstop (A-SPEC-455) is off for these files. The Stop gate would not catch even a wholesale emptying of the ledger`, '
|
|
1171
|
+
add('ledger tracked', 'WARN', `Untracked ledger(s): ${untracked.join(', ')} — not in git, so the ART-2 truncation backstop (A-SPEC-455) is off for these files. The Stop gate would not catch even a wholesale emptying of the ledger`, 'Stage the ledger file(s) by their paths (`git add -f .ax/ledger/provenance*.jsonl`) and commit; if .gitignore excludes them, add a `!.ax/ledger/provenance*.jsonl` re-include rule as well, so the next file is not left out.');
|
|
1172
1172
|
}
|
|
1173
1173
|
else {
|
|
1174
1174
|
add('ledger tracked', 'PASS', 'The ledger is tracked in git — the ART-2 truncation backstop catches a rollback against the committed history');
|
|
@@ -1534,7 +1534,11 @@ async function runDoctor(packageRoot, target, opts, extraChecks) {
|
|
|
1534
1534
|
// @implements A-SPEC-718.7 — the posture `autonomy status` reports (project default, session grant with its expiry, run
|
|
1535
1535
|
// delegation, or OFF). Reading only the init default, this row said OFF beside a live session grant (2026-10-21).
|
|
1536
1536
|
const { autonomyPostureLine } = require('./autonomy');
|
|
1537
|
-
|
|
1537
|
+
// @implements A-SPEC-794.55 — the full profile has a row of its own instead of a second line inside this one
|
|
1538
|
+
const { fullAutonomyLine } = require('../governance/autonomy');
|
|
1539
|
+
const fullLine = fullAutonomyLine(target);
|
|
1540
|
+
add('full autonomy profile', 'PASS', fullLine === '' ? 'none covers this project' : fullLine.replace(/^full autonomy: /, ''));
|
|
1541
|
+
add('autonomous spec approval', 'PASS', autonomyPostureLine(target, new Date().toISOString(), true).replace(/^autonomous spec approval: /, ''));
|
|
1538
1542
|
// @implements A-SPEC-251.2 — the version this project's MCP server will ACTUALLY launch, vs this
|
|
1539
1543
|
// CLI. The stale-global trap (measured 2026-08-23: .mcp.json pinned a 0.1.9 global while the user
|
|
1540
1544
|
// believed they had upgraded) was invisible because nothing compared them. Offline: the launch
|
|
@@ -2419,6 +2423,31 @@ async function runDoctor(packageRoot, target, opts, extraChecks) {
|
|
|
2419
2423
|
const pg = pushGateCheck(target ?? process.cwd());
|
|
2420
2424
|
if (pg)
|
|
2421
2425
|
checks.push(pg);
|
|
2426
|
+
// @implements A-SPEC-792.46, A-SPEC-792.48 — the server detector's boundary conditions, named honestly; the forge is
|
|
2427
|
+
// read only through an injected reader (the CLI's doctor command injects it), and a failed diagnosis says so
|
|
2428
|
+
if (opts?.forge) {
|
|
2429
|
+
const b = require('./doctor-boundary');
|
|
2430
|
+
try {
|
|
2431
|
+
const t = target ?? process.cwd();
|
|
2432
|
+
const v = (0, mcp_launcher_1.readPackageVersion)(packageRoot) ?? 'unknown';
|
|
2433
|
+
const facts = b.readForgeFacts(t, opts.forge(t, v));
|
|
2434
|
+
if (facts)
|
|
2435
|
+
checks.push(...b.boundaryChecks(facts));
|
|
2436
|
+
}
|
|
2437
|
+
catch {
|
|
2438
|
+
checks.push(b.diagnosisFailedCheck());
|
|
2439
|
+
} // diagnosis must never crash doctor, nor go silent
|
|
2440
|
+
}
|
|
2441
|
+
// @implements A-SPEC-245.2 — a grant claimed by a process that died between claim and settle covers nothing; name it
|
|
2442
|
+
const stale = require('../governance/approval-grants').staleClaims(target ?? process.cwd());
|
|
2443
|
+
if (stale.length > 0)
|
|
2444
|
+
checks.push({ name: 'approval grant claims', level: 'WARN', detail: `${stale.length} approval grant(s) were claimed by a process that ended before settling them; they cover nothing: ${stale.map((s) => `${s.file} (pid ${s.pid}, ${s.at})`).join(', ')}`, fix: 'Ask for the approval again if the act did not happen; then remove the claimed file.' });
|
|
2445
|
+
// @implements A-SPEC-245.8 — the spend lock's holder, leaks and ignore rule; WARN only, so the exit code is unchanged
|
|
2446
|
+
checks.push(...require('./doctor-locks').spendLockChecks(target ?? process.cwd()));
|
|
2447
|
+
checks.push(...require('./doctor-locks').requestLockChecks(target ?? process.cwd())); // @implements A-SPEC-794.6
|
|
2448
|
+
// @implements A-SPEC-102.28 — a refused harness catalog file is shown, so an addition not in force is not silent
|
|
2449
|
+
// @implements A-SPEC-102.29 — the one root decision (catalogWhere) and the whole row inside its try
|
|
2450
|
+
checks.push(require('../governance/harness-catalog').harnessCatalogCheck(target ?? process.cwd()));
|
|
2422
2451
|
const ci = ciMatrixCheck(target ?? process.cwd()); // @implements A-SPEC-664
|
|
2423
2452
|
if (ci)
|
|
2424
2453
|
checks.push(ci);
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The CLI's flag reading, in its own module so the CLI and the gate read a command's flags the same way: the gate's
|
|
3
|
+
* lock-recover judgement (A-SPEC-245.18 item 2) removes the flags the CLI would remove and judges what is left. Moved
|
|
4
|
+
* unchanged from cli/index.ts; the specs each rule was written under are named beside it (A-SPEC-171, 190, 251.1,
|
|
5
|
+
* 770.11, 771.1, 774.17).
|
|
6
|
+
*/
|
|
7
|
+
export declare class UnknownFlagError extends Error {
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Flags that take NO value. Declared, because the old parser stored the NEXT token as any flag's
|
|
11
|
+
* value: `init --dry-run .` swallowed `.` into dry-run, the boolean read false, and the "show me
|
|
12
|
+
* what you'd do" spelling performed a REAL write (round-3 HIGH; same class inverted --remove and
|
|
13
|
+
* --force). A boolean flag must never consume a token.
|
|
14
|
+
*/
|
|
15
|
+
export declare const BOOLEAN_FLAGS: Set<string>;
|
|
16
|
+
/** A-SPEC-770.11 — value flags whose value may be omitted; the handler supplies the default. */
|
|
17
|
+
export declare const OPTIONAL_VALUE_FLAGS: Set<string>;
|
|
18
|
+
/** A-SPEC-771.1 — value flags that may be given more than once. */
|
|
19
|
+
export declare const REPEATABLE_FLAGS: Set<string>;
|
|
20
|
+
export declare function parseFlags(argv: string[], known?: readonly string[]): {
|
|
21
|
+
flags: Record<string, string | boolean>;
|
|
22
|
+
positionals: string[];
|
|
23
|
+
};
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// @implements A-SPEC-245.18, A-SPEC-794.33
|
|
3
|
+
/**
|
|
4
|
+
* The CLI's flag reading, in its own module so the CLI and the gate read a command's flags the same way: the gate's
|
|
5
|
+
* lock-recover judgement (A-SPEC-245.18 item 2) removes the flags the CLI would remove and judges what is left. Moved
|
|
6
|
+
* unchanged from cli/index.ts; the specs each rule was written under are named beside it (A-SPEC-171, 190, 251.1,
|
|
7
|
+
* 770.11, 771.1, 774.17).
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.REPEATABLE_FLAGS = exports.OPTIONAL_VALUE_FLAGS = exports.BOOLEAN_FLAGS = exports.UnknownFlagError = void 0;
|
|
11
|
+
exports.parseFlags = parseFlags;
|
|
12
|
+
class UnknownFlagError extends Error {
|
|
13
|
+
}
|
|
14
|
+
exports.UnknownFlagError = UnknownFlagError;
|
|
15
|
+
/**
|
|
16
|
+
* Flags that take NO value. Declared, because the old parser stored the NEXT token as any flag's
|
|
17
|
+
* value: `init --dry-run .` swallowed `.` into dry-run, the boolean read false, and the "show me
|
|
18
|
+
* what you'd do" spelling performed a REAL write (round-3 HIGH; same class inverted --remove and
|
|
19
|
+
* --force). A boolean flag must never consume a token.
|
|
20
|
+
*/
|
|
21
|
+
// A-SPEC-251.1 (round 26): `yes` — `upgrade --yes` was refused as "--yes requires a value", so the non-interactive
|
|
22
|
+
// upgrade its own guidance names could not run (measured).
|
|
23
|
+
// A-SPEC-774.24: --accept-unknown-versions names its fields, so it is a value flag, not one of these.
|
|
24
|
+
exports.BOOLEAN_FLAGS = new Set(['badge', 'readme', 'help', 'dry-run', 'no-mcp', 'remove', 'force', 'json', 'list', 'status', 'watch', 'autonomy', 'no-autonomy', 'yes', 'allow-push', 'allow-publish', 'no-architecture', 'provision', 'strict-review', 'open-network', 'confirm-holder-dead', 'all']); // `--revoke` stays a value flag: `approve --revoke <id>` // A-SPEC-650: --status // A-SPEC-794.32: `approve --all`
|
|
25
|
+
/** A-SPEC-770.11 — value flags whose value may be omitted; the handler supplies the default. */
|
|
26
|
+
exports.OPTIONAL_VALUE_FLAGS = new Set(['refusals']);
|
|
27
|
+
/** A-SPEC-771.1 — value flags that may be given more than once. */
|
|
28
|
+
exports.REPEATABLE_FLAGS = new Set(['limit', 'engine-arg', 'finding', 'scope']); // A-SPEC-774.17 — one engine argument per flag; A-SPEC-102.2 — one finding id per flag
|
|
29
|
+
function parseFlags(argv, known) {
|
|
30
|
+
const flags = {};
|
|
31
|
+
const positionals = [];
|
|
32
|
+
for (let i = 0; i < argv.length; i++) {
|
|
33
|
+
const a = argv[i];
|
|
34
|
+
if (!a.startsWith('--')) {
|
|
35
|
+
positionals.push(a);
|
|
36
|
+
continue;
|
|
37
|
+
}
|
|
38
|
+
if (a === '--') {
|
|
39
|
+
// The conventional options terminator. Naming it `unknown flag: --` was fail-closed but a
|
|
40
|
+
// misdiagnosis (round-4) — this CLI takes no positionals that would need one.
|
|
41
|
+
throw new UnknownFlagError("the '--' option terminator is not supported — this CLI takes flags only");
|
|
42
|
+
}
|
|
43
|
+
// GNU `--key=value` — refusing it as `unknown flag: --target=/path` was fail-closed but
|
|
44
|
+
// misdiagnosed (round-3).
|
|
45
|
+
let key = a.slice(2);
|
|
46
|
+
let inline;
|
|
47
|
+
const eq = key.indexOf('=');
|
|
48
|
+
if (eq >= 0) {
|
|
49
|
+
inline = key.slice(eq + 1);
|
|
50
|
+
key = key.slice(0, eq);
|
|
51
|
+
}
|
|
52
|
+
if (known && !known.includes(key))
|
|
53
|
+
throw new UnknownFlagError(`unknown flag: --${key}`);
|
|
54
|
+
if (exports.BOOLEAN_FLAGS.has(key)) {
|
|
55
|
+
if (inline !== undefined)
|
|
56
|
+
throw new UnknownFlagError(`--${key} takes no value`);
|
|
57
|
+
flags[key] = true;
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
// A-SPEC-190 (round 7) — a repeated value flag silently took the LAST one:
|
|
61
|
+
// `--target A --target B` acted on B while the operator was looking at A. 'Cannot decide is not
|
|
62
|
+
// permission' applies to the operator's own contradiction too.
|
|
63
|
+
if (Object.prototype.hasOwnProperty.call(flags, key)) {
|
|
64
|
+
// A-SPEC-771.1 — `--limit k=v` is the one flag that repeats by design (one limit per flag); the
|
|
65
|
+
// values are joined with a newline, which no argv value carries, and split again by the autonomy command.
|
|
66
|
+
if (exports.REPEATABLE_FLAGS.has(key) && typeof flags[key] === 'string') {
|
|
67
|
+
const more = inline !== undefined ? inline : (argv[i + 1] && !argv[i + 1].startsWith('--') ? argv[++i] : undefined);
|
|
68
|
+
if (more === undefined)
|
|
69
|
+
throw new UnknownFlagError(`--${key} requires a value`);
|
|
70
|
+
flags[key] = `${flags[key]}\n${more}`;
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
throw new UnknownFlagError(`--${key} was given more than once — say it once, or the run acts on a directory you did not read`);
|
|
74
|
+
}
|
|
75
|
+
if (inline !== undefined) {
|
|
76
|
+
flags[key] = inline;
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const next = argv[i + 1];
|
|
80
|
+
if (next && !next.startsWith('--')) {
|
|
81
|
+
flags[key] = next;
|
|
82
|
+
i++;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
flags[key] = true;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
return { flags, positionals };
|
|
89
|
+
}
|
|
@@ -12,7 +12,11 @@
|
|
|
12
12
|
* command is invoked through the PATH shim.
|
|
13
13
|
*/
|
|
14
14
|
export declare function packageRoot(): string;
|
|
15
|
-
|
|
15
|
+
/** @implements A-SPEC-792.49 — dependencies a caller may inject; absent means the CLI's real ones. */
|
|
16
|
+
export interface MainDeps {
|
|
17
|
+
forge?: ((target: string, installedVersion: string) => import('./doctor-boundary').ForgeDeps) | null;
|
|
18
|
+
}
|
|
19
|
+
export declare function main(argv: string[], deps?: MainDeps): Promise<number>;
|
|
16
20
|
/**
|
|
17
21
|
* @implements A-SPEC-262.1
|
|
18
22
|
* Is this the normal end of a pipeline rather than a fault? Round-10: `approve --list | head` printed
|