@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,332 @@
|
|
|
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.governanceStagingOnly = governanceStagingOnly;
|
|
37
|
+
exports.stagingGrammar = stagingGrammar;
|
|
38
|
+
exports.autonomousShellVerdict = autonomousShellVerdict;
|
|
39
|
+
exports.realShellDeps = realShellDeps;
|
|
40
|
+
exports.renderAutonomousApprovals = renderAutonomousApprovals;
|
|
41
|
+
const crypto = __importStar(require("node:crypto"));
|
|
42
|
+
const fs = __importStar(require("node:fs"));
|
|
43
|
+
const path = __importStar(require("node:path"));
|
|
44
|
+
const spec_parser_1 = require("../spec/spec-parser");
|
|
45
|
+
const succession_1 = require("../spec/succession");
|
|
46
|
+
const spec_seam_1 = require("./spec-seam");
|
|
47
|
+
/** The classifier's two verdicts on staging the governance store (risk-classifier.ts; full-autonomy.ts reads the same). */
|
|
48
|
+
const STAGING_REASONS = [/^staging command reaches changed files in the protected \.ax spec store/, /^shell command over a protected \.ax governance path is not recognisably read-only/];
|
|
49
|
+
function governanceStagingOnly(reasons) {
|
|
50
|
+
return reasons.length > 0 && reasons.every((r) => STAGING_REASONS.some((re) => re.test(r)));
|
|
51
|
+
}
|
|
52
|
+
const PATH_WORD = /^[A-Za-z0-9_./@+,=-]+$/;
|
|
53
|
+
const STATUS_OPTIONS = new Set(['--porcelain', '--porcelain=v1', '-s', '--short', '--untracked-files=all', '-uall']);
|
|
54
|
+
/**
|
|
55
|
+
* @implements A-SPEC-792.33 — a path word in its one canonical spelling: git normalises `.ax/./x`, `.ax//x`,
|
|
56
|
+
* `.ax/a/../x`, `./x`, an absolute path and (on a case-folding disk) `.AX/x` to the file it stages, while the verdict
|
|
57
|
+
* compares spellings — an alias proved nothing and staged a forged file (measured 2026-10-26, in production).
|
|
58
|
+
*/
|
|
59
|
+
function canonicalPathWord(w) {
|
|
60
|
+
if (w.startsWith('/') || w.startsWith('./'))
|
|
61
|
+
return false;
|
|
62
|
+
const body = w.endsWith('/') ? w.slice(0, -1) : w;
|
|
63
|
+
if (body === '' || body.split('/').some((s) => s === '' || s === '.' || s === '..'))
|
|
64
|
+
return false;
|
|
65
|
+
if (path.posix.normalize(w) !== w)
|
|
66
|
+
return false;
|
|
67
|
+
const first = body.split('/')[0];
|
|
68
|
+
return !(first.toLowerCase() === '.ax' && first !== '.ax');
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Every segment of `rel` that exists under `root` exists in exactly this spelling (a segment that exists in no spelling
|
|
72
|
+
* ends the walk: git then stages nothing new there).
|
|
73
|
+
*/
|
|
74
|
+
function exactCaseOnDisk(root, rel) {
|
|
75
|
+
let dir = root;
|
|
76
|
+
for (const seg of rel.replace(/\/+$/, '').split('/')) {
|
|
77
|
+
let names;
|
|
78
|
+
try {
|
|
79
|
+
names = fs.readdirSync(dir);
|
|
80
|
+
}
|
|
81
|
+
catch {
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
if (names.includes(seg)) {
|
|
85
|
+
dir = path.join(dir, seg);
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
return !names.some((n) => n.toLowerCase() === seg.toLowerCase());
|
|
89
|
+
}
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
/** 1. Grammar: `git add|stage` (-A, --all or literal paths), then `&& git status …` with an optional counted pipe. */
|
|
93
|
+
function stagingGrammar(command) {
|
|
94
|
+
const bad = (detail) => ({ ok: false, detail });
|
|
95
|
+
if (/[;$`<>()\n\r\\]|\|\|/.test(command) || /(?:^|[^&])&(?:[^&]|$)/.test(command))
|
|
96
|
+
return bad('an operator, a redirect or a substitution outside the staging grammar');
|
|
97
|
+
const segs = command.split('&&').map((s) => s.trim());
|
|
98
|
+
let pathspecs = null;
|
|
99
|
+
for (const [i, seg] of segs.entries()) {
|
|
100
|
+
const [head, ...pipes] = seg.split('|').map((p) => p.trim());
|
|
101
|
+
const words = head.split(/\s+/).filter(Boolean);
|
|
102
|
+
if (words.some((w) => /["']/.test(w)))
|
|
103
|
+
return bad(`a quote in ${head}`);
|
|
104
|
+
if (words[0] !== 'git')
|
|
105
|
+
return bad(`${words[0] ?? '(empty)'} is not in the staging grammar`);
|
|
106
|
+
if (i === 0) {
|
|
107
|
+
if ((words[1] !== 'add' && words[1] !== 'stage') || pipes.length > 0)
|
|
108
|
+
return bad('the command must start with git add or git stage');
|
|
109
|
+
const args = words.slice(2).filter((w) => w !== '--');
|
|
110
|
+
if (args.length === 0)
|
|
111
|
+
return bad('git add names nothing');
|
|
112
|
+
const all = args.every((a) => a === '-A' || a === '--all');
|
|
113
|
+
if (all) {
|
|
114
|
+
pathspecs = null;
|
|
115
|
+
continue;
|
|
116
|
+
}
|
|
117
|
+
if (!args.every((a) => PATH_WORD.test(a) && !a.startsWith('-') && !a.startsWith(':')))
|
|
118
|
+
return bad('git add takes -A, --all or literal paths only');
|
|
119
|
+
const alias = args.find((a) => !canonicalPathWord(a));
|
|
120
|
+
if (alias !== undefined)
|
|
121
|
+
return bad(`${alias} is not a canonical path (no ./, /./, //, .., leading / or case variant of .ax)`);
|
|
122
|
+
pathspecs = args;
|
|
123
|
+
continue;
|
|
124
|
+
}
|
|
125
|
+
if (words[1] !== 'status' || !words.slice(2).every((w) => STATUS_OPTIONS.has(w) || (PATH_WORD.test(w) && !w.startsWith('-'))))
|
|
126
|
+
return bad(`${head} is not a plain git status`);
|
|
127
|
+
const statusAlias = words.slice(2).find((w) => !STATUS_OPTIONS.has(w) && !canonicalPathWord(w));
|
|
128
|
+
if (statusAlias !== undefined)
|
|
129
|
+
return bad(`${statusAlias} is not a canonical path (no ./, /./, //, .., leading / or case variant of .ax)`);
|
|
130
|
+
for (const p of pipes) {
|
|
131
|
+
if (!/^grep\s+-c\s+(['"])[^'"$`\\]*\1$/.test(p) && !/^wc\s+-l$/.test(p))
|
|
132
|
+
return bad(`${p} is not a counted pipe`);
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return { ok: true, pathspecs };
|
|
136
|
+
}
|
|
137
|
+
const sha256 = (text) => crypto.createHash('sha256').update(text).digest('hex');
|
|
138
|
+
const inputsOf = (e) => (Array.isArray(e.inputs) ? e.inputs.map(String) : []);
|
|
139
|
+
const jsonLines = (text) => text.split('\n').filter((l) => l.trim() !== '').every((l) => {
|
|
140
|
+
try {
|
|
141
|
+
const v = JSON.parse(l);
|
|
142
|
+
return v !== null && typeof v === 'object' && !Array.isArray(v);
|
|
143
|
+
}
|
|
144
|
+
catch {
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
});
|
|
148
|
+
const PROVERS = [
|
|
149
|
+
{ matches: (r) => /^\.ax\/specs\/.+\.md$/.test(r), prove: (r, text, events) => {
|
|
150
|
+
let s;
|
|
151
|
+
try {
|
|
152
|
+
s = (0, spec_parser_1.parseSpec)(text);
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
return `${r} is not a readable spec`;
|
|
156
|
+
}
|
|
157
|
+
const has = (kind, pred) => events.some((e) => e.kind === kind && pred(inputsOf(e)));
|
|
158
|
+
if (s.status === 'approved') {
|
|
159
|
+
const d = String(s.frontmatter.approved_digest ?? '');
|
|
160
|
+
return (0, succession_1.sealHolds)(s) && has('spec-approved', (i) => i[0] === s.id && i[1] === d) ? null : `${r}: its seal does not hold or no spec-approved event names it`;
|
|
161
|
+
}
|
|
162
|
+
if (s.status === 'outdated')
|
|
163
|
+
return has('spec-retired', (i) => i[0] === s.id) ? null : `${r}: no spec-retired event names ${s.id}`;
|
|
164
|
+
return has('spec-created', (i) => i[0] === s.id) ? null : `${r}: no spec-created event names ${s.id} (written by hand)`;
|
|
165
|
+
} },
|
|
166
|
+
{ matches: (r) => /^\.ax\/evidence\/maintenance\/[0-9a-f]{64}\.json$/.test(r), prove: (r, text, events) => {
|
|
167
|
+
const d = `sha256:${path.basename(r, '.json')}`;
|
|
168
|
+
return events.some((e) => e.kind === 'analysis-persisted' && inputsOf(e)[0] === d && inputsOf(e)[1] === `content:${sha256(text)}`) ? null : `${r}: no analysis-persisted event names its content`;
|
|
169
|
+
} },
|
|
170
|
+
{ matches: (r) => /^\.ax\/evidence\/requirement-triage\/[0-9a-f]{64}\.json$/.test(r), prove: (r, text, events) => {
|
|
171
|
+
const hex = path.basename(r, '.json');
|
|
172
|
+
return sha256(text) === hex && events.some((e) => e.kind === 'triage-issued' && inputsOf(e)[0] === `sha256:${hex}`) ? null : `${r}: not issued triage evidence`;
|
|
173
|
+
} },
|
|
174
|
+
{ matches: (r) => /^\.ax\/state\/baselines\/[^/]+\.json$/.test(r), prove: (r, text, events) => {
|
|
175
|
+
const { baselineDigest } = require('../project/baseline');
|
|
176
|
+
let files;
|
|
177
|
+
try {
|
|
178
|
+
files = JSON.parse(text).files ?? {};
|
|
179
|
+
}
|
|
180
|
+
catch {
|
|
181
|
+
return `${r} is not a readable baseline`;
|
|
182
|
+
}
|
|
183
|
+
const d = baselineDigest(files);
|
|
184
|
+
return events.some((e) => e.kind === 'baseline-recorded' && inputsOf(e)[0] === path.basename(r, '.json') && inputsOf(e)[1] === d) ? null : `${r}: no baseline-recorded event names it`;
|
|
185
|
+
} },
|
|
186
|
+
{ matches: (r) => r === '.ax/state/install-manifest.json', prove: (r, _t, _e, deps) => (deps.productProblems([]) === null ? null : `${r}: the manifest is not the one init recorded`) },
|
|
187
|
+
// @implements A-SPEC-222.10 — H-A (b): only this writer's own ledger file; staging another replica's file would put it
|
|
188
|
+
// into HEAD, where the trusted-events port counts it, so a person stages that
|
|
189
|
+
{ matches: (r) => /^\.ax\/ledger\/provenance[^/]*\.jsonl$/.test(r), prove: (r, _t, _e, deps) => (r !== deps.ownLedgerFile?.()
|
|
190
|
+
? `${r} is not this writer's ledger file — staging another replica's ledger goes to a person`
|
|
191
|
+
: deps.chainsVerify() ? null : `${r}: the chain does not verify`) },
|
|
192
|
+
// the weakest proof: an append-only JSON-lines record no agent tool can write (the gate refuses writes under .ax)
|
|
193
|
+
{ matches: (r) => /^\.ax\/(?:ledger|approvals|reviews)\/[^/]+\.jsonl$/.test(r), prove: (r, text) => (jsonLines(text) ? null : `${r}: a line is not a JSON object`) },
|
|
194
|
+
];
|
|
195
|
+
function autonomousShellVerdict(input, deps) {
|
|
196
|
+
const fail = (failed, detail) => ({ ok: false, failed, detail });
|
|
197
|
+
if (input.shellStaging !== 'on')
|
|
198
|
+
return fail('switch', 'autonomy.shellStaging is off');
|
|
199
|
+
// @implements A-SPEC-792.32 — one path base: the verdict resolves pathspecs from the root, so the act must run there (N2)
|
|
200
|
+
if (input.base !== undefined && path.resolve(input.base) !== path.resolve(input.root))
|
|
201
|
+
return fail('base', `the command runs from ${input.base}, not the workspace root; its paths are judged only from the root`);
|
|
202
|
+
const g = stagingGrammar(input.command);
|
|
203
|
+
if (!g.ok)
|
|
204
|
+
return fail('grammar', g.detail);
|
|
205
|
+
// @implements A-SPEC-792.33 — a word spelled otherwise than on disk (a case variant on a case-folding volume) names
|
|
206
|
+
// the file git stages, not the spelling the verdict compares
|
|
207
|
+
const miscased = (g.pathspecs ?? []).find((p) => !exactCaseOnDisk(input.root, p));
|
|
208
|
+
if (miscased !== undefined)
|
|
209
|
+
return fail('grammar', `${miscased} is not spelled as it is on disk`);
|
|
210
|
+
const staged = deps.statusPaths(g.pathspecs);
|
|
211
|
+
if (staged === null)
|
|
212
|
+
return fail('provenance', 'git could not say what the command stages');
|
|
213
|
+
const governance = staged.filter((s) => s.path === '.ax' || s.path.startsWith('.ax/'));
|
|
214
|
+
// @implements A-SPEC-792.31 — safety stop: the spec store goes to a person until its grant has one source of truth,
|
|
215
|
+
// and a staging the gate classed as governance with nothing here to prove is the verdict and the act disagreeing
|
|
216
|
+
if (governance.length === 0)
|
|
217
|
+
return fail('provenance', 'the command stages no governance path this verdict can prove (its paths resolve elsewhere than the root)');
|
|
218
|
+
// 4. reversible: the grammar admits no remote write and no rm; a staged deletion of a governance path is a deletion
|
|
219
|
+
const deleted = governance.filter((s) => s.deleted);
|
|
220
|
+
if (deleted.length > 0)
|
|
221
|
+
return fail('reversible', `the command stages the deletion of ${deleted.slice(0, 3).map((s) => s.path).join(', ')}`);
|
|
222
|
+
// 3. integrity before provenance: a broken record proves nothing
|
|
223
|
+
// @implements A-SPEC-222.10 — and before the product check, which reads the manifest record through the trusted port
|
|
224
|
+
if (!deps.chainsVerify())
|
|
225
|
+
return fail('integrity', 'a provenance chain does not verify');
|
|
226
|
+
const malformed = deps.queueMalformed();
|
|
227
|
+
if (malformed > 0)
|
|
228
|
+
return fail('integrity', `the approval queue has ${malformed} malformed line(s)`);
|
|
229
|
+
const product = deps.productProblems(staged.map((s) => s.path));
|
|
230
|
+
if (product !== null)
|
|
231
|
+
return fail('product-installed', product);
|
|
232
|
+
const events = deps.ledgerEvents();
|
|
233
|
+
// @implements A-SPEC-792.32 — what was proven is named by the bytes that proved it: the recorder writes only this
|
|
234
|
+
const proven = [];
|
|
235
|
+
for (const s of governance) {
|
|
236
|
+
const prover = PROVERS.find((p) => p.matches(s.path));
|
|
237
|
+
if (!prover)
|
|
238
|
+
return fail('provenance', `${s.path} is not an artifact holmes writes`);
|
|
239
|
+
const bytes = deps.readBytes(s.path);
|
|
240
|
+
if (bytes === null)
|
|
241
|
+
return fail('provenance', `${s.path} cannot be read as a regular, non-executable file`);
|
|
242
|
+
const why = prover.prove(s.path, bytes.toString('utf8'), events, deps);
|
|
243
|
+
// @implements A-SPEC-222.9 — an unproven path names the ledger entries that were not trusted
|
|
244
|
+
if (why !== null) {
|
|
245
|
+
const ignored = deps.ignoredEvents?.() ?? '';
|
|
246
|
+
return fail('provenance', ignored ? `${why} (${ignored})` : why);
|
|
247
|
+
}
|
|
248
|
+
proven.push({ path: s.path, blob: (0, spec_seam_1.blobOf)(bytes, deps.objectFormat?.() ?? 'sha1') });
|
|
249
|
+
}
|
|
250
|
+
// @implements A-SPEC-792.31 — last, so every other condition is still named as before: a spec path is out of scope
|
|
251
|
+
// (A-SPEC-792.32: `specStaging` lifts the stop for the tests only; the gate sets it from no environment or config)
|
|
252
|
+
const specsRel = (input.specsRel ?? '.ax/specs').replace(/\/+$/, '');
|
|
253
|
+
const spec = governance.find((s) => s.path === specsRel || s.path.startsWith(`${specsRel}/`));
|
|
254
|
+
if (spec && input.specStaging !== true)
|
|
255
|
+
return fail('scope', `${spec.path} is in the spec store, which autonomous approval does not cover; a person approves spec staging`);
|
|
256
|
+
return { ok: true, paths: governance.map((s) => s.path).sort(), proven, conditions: { grammar: 'pass', reversible: 'pass', 'product-installed': 'pass', integrity: 'pass', provenance: 'pass' } };
|
|
257
|
+
}
|
|
258
|
+
/** The real readers: git in the workspace, its provenance ledger, its queue and its install manifest. */
|
|
259
|
+
function realShellDeps(root) {
|
|
260
|
+
const { FileLedgerStore } = require('./ledger-store');
|
|
261
|
+
const store = new FileLedgerStore(path.join(root, '.ax', 'ledger'));
|
|
262
|
+
// @implements A-SPEC-222.9 — H1: a proof is taken only from trusted events (one port with the gate and spec_retire);
|
|
263
|
+
// read once per verdict
|
|
264
|
+
const { trustedLedgerEvents, describeIgnored } = require('./recorded-pairs');
|
|
265
|
+
let trusted;
|
|
266
|
+
const read = () => {
|
|
267
|
+
if (trusted === undefined) {
|
|
268
|
+
try {
|
|
269
|
+
trusted = trustedLedgerEvents(root);
|
|
270
|
+
}
|
|
271
|
+
catch {
|
|
272
|
+
trusted = { events: [], ignored: [{ file: '.ax/ledger', why: 'the ledger could not be read' }] };
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
return trusted;
|
|
276
|
+
};
|
|
277
|
+
return {
|
|
278
|
+
// @implements A-SPEC-792.32 — no `git status` (a racily clean file is re-hashed through the agent's clean filter)
|
|
279
|
+
statusPaths(pathspecs) {
|
|
280
|
+
try {
|
|
281
|
+
return (0, spec_seam_1.worktreeChanges)(root, pathspecs).map((c) => ({ path: c.path, deleted: c.deleted }));
|
|
282
|
+
}
|
|
283
|
+
catch {
|
|
284
|
+
return null;
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
ledgerEvents: () => read().events,
|
|
288
|
+
ignoredEvents: () => describeIgnored(read().ignored),
|
|
289
|
+
ownLedgerFile: () => { try {
|
|
290
|
+
return `.ax/ledger/provenance.${store.replicaId()}.jsonl`;
|
|
291
|
+
}
|
|
292
|
+
catch {
|
|
293
|
+
return null;
|
|
294
|
+
} },
|
|
295
|
+
chainsVerify: () => { try {
|
|
296
|
+
return store.verifyAll().ok;
|
|
297
|
+
}
|
|
298
|
+
catch {
|
|
299
|
+
return false;
|
|
300
|
+
} },
|
|
301
|
+
queueMalformed: () => {
|
|
302
|
+
const { readQueue } = require('./approval-queue');
|
|
303
|
+
try {
|
|
304
|
+
return readQueue(root).malformedLines;
|
|
305
|
+
}
|
|
306
|
+
catch {
|
|
307
|
+
return 1;
|
|
308
|
+
}
|
|
309
|
+
},
|
|
310
|
+
productProblems: (staged) => {
|
|
311
|
+
const { productInstalledProblems, describeProductInstalled } = require('./install-manifest');
|
|
312
|
+
const problems = productInstalledProblems(root, staged);
|
|
313
|
+
return problems.length === 0 ? null : describeProductInstalled(problems);
|
|
314
|
+
},
|
|
315
|
+
// @implements A-SPEC-792.30, A-SPEC-792.32 — only a regular, non-executable file proves: a link would prove its
|
|
316
|
+
// target, an executable is not the 100644 entry the seam grants
|
|
317
|
+
readBytes: (rel) => (0, spec_seam_1.grantableBytes)(path.join(root, rel)),
|
|
318
|
+
objectFormat: () => (0, spec_seam_1.objectFormatOf)(root),
|
|
319
|
+
};
|
|
320
|
+
}
|
|
321
|
+
/** For approve --list: the last autonomous shell approvals (time, command digest, path count). */
|
|
322
|
+
function renderAutonomousApprovals(events, limit = 20) {
|
|
323
|
+
const rows = events.filter((e) => e.kind === 'autonomous-shell-approved').slice(-limit);
|
|
324
|
+
if (rows.length === 0)
|
|
325
|
+
return '';
|
|
326
|
+
return ['autonomous shell approvals (A-SPEC-792.28):', ...rows.map((e) => {
|
|
327
|
+
const i = inputsOf(e);
|
|
328
|
+
const cmd = (i.find((x) => x.startsWith('command:')) ?? 'command:?').slice('command:'.length, 'command:'.length + 12);
|
|
329
|
+
const n = (i.find((x) => x.startsWith('count:')) ?? 'count:?').slice('count:'.length);
|
|
330
|
+
return ` auto-approved ${e.ts ?? '?'} command ${cmd} · ${n} governance path(s)`;
|
|
331
|
+
})].join('\n');
|
|
332
|
+
}
|
|
@@ -63,6 +63,11 @@ export declare function projectDefaultAutonomy(root: string): boolean;
|
|
|
63
63
|
export declare function autonomousApprovalEnabled(env: NodeJS.ProcessEnv, root?: string, now?: string): boolean;
|
|
64
64
|
/** @implements A-SPEC-792.7 — the full profile covering `root`, as one line (without the banner prefix), or ''. */
|
|
65
65
|
export declare function fullAutonomyLine(root: string, home?: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* @implements A-SPEC-794.55 — what a full profile does, in one sentence every surface prints: spec staging still goes to a
|
|
68
|
+
* person's form, and push and publish without their flag to the owner.
|
|
69
|
+
*/
|
|
70
|
+
export declare const FULL_PROFILE_MEANING = "judgments it covers do not wait for a person; spec staging still goes to a person's form, and push and publish without their flag to the owner";
|
|
66
71
|
export declare function autonomyBanner(env: NodeJS.ProcessEnv, root: string, now: string, home?: string): string;
|
|
67
72
|
export declare function autonomyMarkerShouldPrune(root: string, now: string): boolean;
|
|
68
73
|
export declare function versionBumpKind(from: string, to: string): 'major' | 'minor' | 'patch' | 'none';
|
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.SESSION_AUTONOMY_MARKER = exports.AUTONOMY_ENV = void 0;
|
|
36
|
+
exports.FULL_PROFILE_MEANING = exports.SESSION_AUTONOMY_MARKER = exports.AUTONOMY_ENV = void 0;
|
|
37
37
|
exports.isHighRiskPath = isHighRiskPath;
|
|
38
38
|
exports.descendantAspecs = descendantAspecs;
|
|
39
39
|
exports.specApprovalAutonomy = specApprovalAutonomy;
|
|
@@ -51,7 +51,7 @@ exports.autonomyBanner = autonomyBanner;
|
|
|
51
51
|
exports.autonomyMarkerShouldPrune = autonomyMarkerShouldPrune;
|
|
52
52
|
exports.versionBumpKind = versionBumpKind;
|
|
53
53
|
exports.releaseAutonomy = releaseAutonomy;
|
|
54
|
-
// @implements A-SPEC-532.1, A-SPEC-718, A-SPEC-532.3, A-SPEC-532.4, A-SPEC-532.7, A-SPEC-792.7
|
|
54
|
+
// @implements A-SPEC-794.55, A-SPEC-532.1, A-SPEC-718, A-SPEC-532.3, A-SPEC-532.4, A-SPEC-532.7, A-SPEC-792.7, A-SPEC-794.47, A-SPEC-794.49
|
|
55
55
|
// Whether a spec approval may be sealed AUTONOMOUSLY by the agent, or must still ask a human through
|
|
56
56
|
// the MCP elicitation TUI. The governance chain (REQ→H→A→T→CPG + RTM + taint + phase gate) already
|
|
57
57
|
// forces quality structurally, so a low/mid-risk spec self-approving under an explicitly-enabled
|
|
@@ -393,8 +393,13 @@ function fullAutonomyLine(root, home = os.homedir()) {
|
|
|
393
393
|
return '';
|
|
394
394
|
const f = s.entry.flags;
|
|
395
395
|
const onOff = (b) => (b ? 'on' : 'off');
|
|
396
|
-
return `full autonomy: ON (scope ${s.entry.scope}; push ${onOff(f.push)}, publish ${onOff(f.publish)}, architecture ${onOff(f.architecture)}) —
|
|
396
|
+
return `full autonomy: ON (scope ${s.entry.scope}; push ${onOff(f.push)}, publish ${onOff(f.publish)}, architecture ${onOff(f.architecture)}) — ${exports.FULL_PROFILE_MEANING}`;
|
|
397
397
|
}
|
|
398
|
+
/**
|
|
399
|
+
* @implements A-SPEC-794.55 — what a full profile does, in one sentence every surface prints: spec staging still goes to a
|
|
400
|
+
* person's form, and push and publish without their flag to the owner.
|
|
401
|
+
*/
|
|
402
|
+
exports.FULL_PROFILE_MEANING = 'judgments it covers do not wait for a person; spec staging still goes to a person\'s form, and push and publish without their flag to the owner';
|
|
398
403
|
function autonomyBanner(env, root, now, home) {
|
|
399
404
|
// @implements A-SPEC-792.7 — an active full profile is named first; without one the banner is what it was.
|
|
400
405
|
const full = fullAutonomyLine(root, home);
|
|
@@ -441,8 +446,8 @@ function autonomyMarkerShouldPrune(root, now) {
|
|
|
441
446
|
// @implements A-SPEC-555.1 — the semver bump between two `major.minor.patch` strings (non-numeric
|
|
442
447
|
// fields read as 0; never throws).
|
|
443
448
|
// @implements A-SPEC-558.1 — a DOWNGRADE (to < from) is not a normal forward bump; it is treated as
|
|
444
|
-
// 'major' so a mis-set lower version
|
|
445
|
-
//
|
|
449
|
+
// 'major' so a mis-set lower version never classifies as low-risk (releaseAutonomy answers 'hitl' for
|
|
450
|
+
// non-patch/minor).
|
|
446
451
|
function versionBumpKind(from, to) {
|
|
447
452
|
const tri = (v) => {
|
|
448
453
|
const [a, b, c] = v.split('.').map((n) => { const x = parseInt(n, 10); return Number.isFinite(x) ? x : 0; });
|
|
@@ -462,15 +467,15 @@ function versionBumpKind(from, to) {
|
|
|
462
467
|
}
|
|
463
468
|
// @implements A-SPEC-555.1 — the RELEASE risk verdict, decided by what the release CONTAINS (reusing
|
|
464
469
|
// the per-spec grade), never by the publish act. npm publish is irreversible + outward, so the
|
|
465
|
-
// conservative default is 'hitl':
|
|
466
|
-
// major, and every spec is auto-grade
|
|
467
|
-
//
|
|
470
|
+
// conservative default is 'hitl': the answer is 'auto' ONLY when autonomy is on, the bump is not
|
|
471
|
+
// major, and every spec is auto-grade. No product code calls this (A-SPEC-794.47, measured): nothing
|
|
472
|
+
// self-publishes, and the publish playbook uses these rules to classify the report to the owner.
|
|
468
473
|
function releaseAutonomy(specs, versionBump, env, root, now) {
|
|
469
474
|
if (!autonomousApprovalEnabled(env, root, now))
|
|
470
|
-
return 'hitl';
|
|
475
|
+
return 'hitl';
|
|
471
476
|
// @implements A-SPEC-558.1 — fail-closed on the edges: an empty/unknown spec set is not positive
|
|
472
|
-
// evidence of a low-risk release, and only a positive patch/minor bump
|
|
473
|
-
// a downgrade-graded-major, or a no-op 'none' all
|
|
477
|
+
// evidence of a low-risk release, and only a positive patch/minor bump answers 'auto' (a 'major',
|
|
478
|
+
// a downgrade-graded-major, or a no-op 'none' all answer 'hitl').
|
|
474
479
|
if (specs.length === 0)
|
|
475
480
|
return 'hitl';
|
|
476
481
|
if (versionBump !== 'patch' && versionBump !== 'minor')
|
|
@@ -82,6 +82,11 @@ export interface ConstitutionContext {
|
|
|
82
82
|
};
|
|
83
83
|
/** A-SPEC id -> count of real test cases in anchored test files (H1 syntactic lower bound). */
|
|
84
84
|
testCasesByAspec?: Record<string, number>;
|
|
85
|
+
/** @implements A-SPEC-750.2 — A-SPEC id -> the anchored files that counted zero, and why. */
|
|
86
|
+
zeroCountCauses?: Record<string, Array<{
|
|
87
|
+
file: string;
|
|
88
|
+
reason: string;
|
|
89
|
+
}>>;
|
|
85
90
|
/**
|
|
86
91
|
* A-SPEC id -> cases that ACTUALLY EXECUTED in a recorded PASSING test run.
|
|
87
92
|
*
|
|
@@ -9,6 +9,7 @@ const rtm_check_1 = require("../rtm/rtm-check");
|
|
|
9
9
|
// @implements A-SPEC-574.4 — the same detector the design-time advisory calls.
|
|
10
10
|
const cycle_detect_1 = require("../cpg/cycle-detect");
|
|
11
11
|
const validator_1 = require("../spec/validator");
|
|
12
|
+
const succession_1 = require("../spec/succession"); // @implements A-SPEC-222.7
|
|
12
13
|
/**
|
|
13
14
|
* @implements A-SPEC-534.2
|
|
14
15
|
* ART-8 RED-first check (pure). For each changed A-SPEC that HAS recorded outcomes, require a
|
|
@@ -100,18 +101,37 @@ function verifyConstitution(ctx) {
|
|
|
100
101
|
for (const t of governed) {
|
|
101
102
|
if (t.type !== 'T-SPEC' || t.status !== 'approved')
|
|
102
103
|
continue;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
104
|
+
// @implements A-SPEC-222.7 — H1: every A-SPEC the T-SPEC depends on, as the T-SPEC gate reads them (it reads the
|
|
105
|
+
// whole depends_on); a T-SPEC with no A-SPEC edge keeps the first one, as before
|
|
106
|
+
const aspecIds = t.dependsOn.filter((id) => id.startsWith('A-SPEC-'));
|
|
107
|
+
for (const aspec of aspecIds.length > 0 ? aspecIds : t.dependsOn.slice(0, 1)) {
|
|
108
|
+
// BASELINE (always enforced): the syntactic lower bound. Evidence can never waive it.
|
|
109
|
+
if (ctx.testCasesByAspec && (familySum(ctx.testCasesByAspec, aspec) ?? 0) === 0) {
|
|
110
|
+
// @implements A-SPEC-750.2 — a zero is never silent about its cause, and a zero against executed runs is called a
|
|
111
|
+
// suspected counter defect (the floor still holds: it stays a violation)
|
|
112
|
+
const causes = Object.entries(ctx.zeroCountCauses ?? {}).filter(([id]) => id === aspec || id.startsWith(`${aspec}.`)).flatMap(([, c]) => c);
|
|
113
|
+
const why = causes.length > 0 ? ` — anchored file(s) counted zero: ${causes.slice(0, 5).map((c) => `${c.file} (${c.reason})`).join('; ')}` : '';
|
|
114
|
+
const ran = familySum(ctx.executedByAspec, aspec) ?? 0;
|
|
115
|
+
// @implements A-SPEC-222.5 — AU1-d: a T-SPEC whose A-SPEC was superseded, with an approved T-SPEC over the
|
|
116
|
+
// successor, names the autonomous exit (the debt still blocks code writes; only the exit is shown)
|
|
117
|
+
const via = String(resolve(aspec)?.frontmatter?.superseded_by ?? '').trim();
|
|
118
|
+
const succ = resolve(aspec)?.status === 'outdated' && via !== ''
|
|
119
|
+
? ctx.specs.find((s) => s.type === 'T-SPEC' && s.status === 'approved' && s.id !== t.id && s.dependsOn.includes(via)) : undefined;
|
|
120
|
+
// @implements A-SPEC-222.7 — L4: the exit is the judgment's own answer (the same function spec_retire uses)
|
|
121
|
+
const blocked = succ ? (0, succession_1.tspecSuccessionRefusal)(t, succ, succ.id, ctx.specs, (a) => familySum(ctx.testCasesByAspec, a) ?? 0) : null;
|
|
122
|
+
const exit = !succ ? '' : blocked === null
|
|
123
|
+
? `; ${aspec} is superseded by ${via} — spec_retire({ id: "${t.id}", supersededBy: "${succ.id}", directive: "<the directive>" }) retires ${t.id} without a person under full autonomy`
|
|
124
|
+
: `; ${aspec} is superseded by ${via}, but there is no autonomous exit to ${succ.id}: ${blocked}`;
|
|
125
|
+
v.push({ article: 'ART-4', detail: (ran > 0
|
|
126
|
+
? `${t.id}: the syntactic count and the recorded runs disagree for ${aspec} (0 counted, ${ran} executed) — a counter defect is suspected${why}; the floor still holds: make a case head countable or report the defect`
|
|
127
|
+
: `${t.id}: declared coverage but NO anchored test file with real cases for ${aspec}${why} (anchor the covering tests with the @implements marker for ${aspec})`) + exit });
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
// ADDITIVE: a recorded run that covered this A-SPEC and executed nothing is an extra violation.
|
|
131
|
+
const executed = familySum(ctx.executedByAspec, aspec);
|
|
132
|
+
if (executed === 0) {
|
|
133
|
+
v.push({ article: 'ART-4', detail: `${t.id}: a recorded test run covered ${aspec} but EXECUTED no cases` });
|
|
134
|
+
}
|
|
115
135
|
}
|
|
116
136
|
}
|
|
117
137
|
}
|
|
@@ -39,7 +39,15 @@ export type FullShellVerdict = {
|
|
|
39
39
|
} | {
|
|
40
40
|
outcome: 'refuse';
|
|
41
41
|
route: string;
|
|
42
|
+
} | {
|
|
43
|
+
outcome: 'ask';
|
|
42
44
|
};
|
|
45
|
+
/**
|
|
46
|
+
* @implements A-SPEC-792.10, A-SPEC-792.11 — whether every clause of `command` is `git add` or `git stage` whose
|
|
47
|
+
* pathspecs are each a literal path inside the spec store. A pipe, a glob, a quote, an option, pathspec magic (a word
|
|
48
|
+
* starting with `:`), a directory above the store, `git commit` or any other clause makes it not spec staging.
|
|
49
|
+
*/
|
|
50
|
+
export declare function onlyStagesSpecs(command: string, cwd: string, workspace: string): boolean;
|
|
43
51
|
/**
|
|
44
52
|
* @implements A-SPEC-792.5 — what a full scope does with a hard-HITL shell verdict. Every reason must be approvable:
|
|
45
53
|
* a workspace-local destructive git act, an rm whose every target sits strictly inside the scope or the scratch root,
|
|
@@ -54,6 +62,8 @@ export declare function fullModeShellVerdict(input: {
|
|
|
54
62
|
scratchRoot: string | null;
|
|
55
63
|
entry: FullProfileEntry;
|
|
56
64
|
}): FullShellVerdict;
|
|
65
|
+
/** @implements A-SPEC-794.49, A-SPEC-794.50 — REQ-792's flags: what to do about the first outward act this profile leaves to the owner, or null. */
|
|
66
|
+
export declare function fullModeOutwardRefusal(acts: ReadonlyArray<'push' | 'publish'>, entry: FullProfileEntry): string | null;
|
|
57
67
|
/** The tail a full-scope refusal carries instead of a queued request (config, secrets, approvals, code under debt). */
|
|
58
68
|
export declare function fullModeRefusalTail(kind: 'shell' | 'config-write' | 'code-write', route?: string): string;
|
|
59
69
|
/**
|