@holmes-lab/holmes-kit 0.27.0 → 0.29.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 +64 -0
- package/README.md +21 -17
- package/dist/.build-id +1 -1
- package/dist/holmes/cli/agents-guidance-command.d.ts +9 -0
- package/dist/holmes/cli/agents-guidance-command.js +61 -0
- package/dist/holmes/cli/agents-guidance-file.d.ts +7 -0
- package/dist/holmes/cli/agents-guidance-file.js +86 -0
- package/dist/holmes/cli/agents-guidance-history.d.ts +10 -0
- package/dist/holmes/cli/agents-guidance-history.js +35 -0
- package/dist/holmes/cli/agents-guidance-plan.d.ts +11 -0
- package/dist/holmes/cli/agents-guidance-plan.js +81 -0
- package/dist/holmes/cli/agents-guidance.d.ts +1 -0
- package/dist/holmes/cli/agents-guidance.js +40 -0
- package/dist/holmes/cli/agents.d.ts +3 -19
- package/dist/holmes/cli/agents.js +12 -108
- package/dist/holmes/cli/doctor-guidance.d.ts +2 -0
- package/dist/holmes/cli/doctor-guidance.js +61 -0
- package/dist/holmes/cli/doctor.d.ts +2 -0
- package/dist/holmes/cli/doctor.js +29 -1
- package/dist/holmes/cli/index.js +31 -3
- package/dist/holmes/cli/init.js +32 -5
- package/dist/holmes/cli/upgrade.js +23 -26
- package/dist/holmes/cli/worktree-readiness.d.ts +6 -0
- package/dist/holmes/cli/worktree-readiness.js +81 -0
- package/dist/holmes/cpg/ast-mutation.d.ts +2 -0
- package/dist/holmes/cpg/ast-mutation.js +4 -2
- package/dist/holmes/cpg/foundation/cfg.d.ts +10 -0
- package/dist/holmes/cpg/foundation/cfg.js +27 -1
- package/dist/holmes/mcp/handlers/graph-operations.d.ts +7 -0
- package/dist/holmes/mcp/handlers/graph-operations.js +25 -1
- package/dist/holmes/mcp/handlers/requirement-triage.d.ts +116 -0
- package/dist/holmes/mcp/handlers/requirement-triage.js +185 -0
- package/dist/holmes/mcp/handlers/workspace-preflight.d.ts +9 -0
- package/dist/holmes/mcp/handlers/workspace-preflight.js +13 -0
- package/dist/holmes/mcp/handlers.d.ts +157 -46
- package/dist/holmes/mcp/handlers.js +16 -3
- package/dist/holmes/mcp/requirement-triage-evidence.d.ts +11 -0
- package/dist/holmes/mcp/requirement-triage-evidence.js +79 -0
- package/dist/holmes/mcp/tool-schemas.js +19 -1
- package/dist/holmes/project/workspace-checkout.d.ts +8 -0
- package/dist/holmes/project/workspace-checkout.js +74 -0
- package/dist/holmes/project/workspace-preflight.d.ts +24 -0
- package/dist/holmes/project/workspace-preflight.js +99 -0
- package/dist/holmes/review/condition-hunk-replay.d.ts +33 -0
- package/dist/holmes/review/condition-hunk-replay.js +112 -0
- package/dist/holmes/review/condition-hunk-resolution.d.ts +65 -0
- package/dist/holmes/review/condition-hunk-resolution.js +207 -0
- package/dist/holmes/review/requirement-triage-benchmark.d.ts +45 -0
- package/dist/holmes/review/requirement-triage-benchmark.js +72 -0
- package/dist/holmes/review/requirement-triage.d.ts +61 -0
- package/dist/holmes/review/requirement-triage.js +143 -0
- package/dist/holmes/semantic/local-model.d.ts +3 -3
- package/dist/holmes/semantic/local-model.js +10 -12
- package/dist/holmes/semantic/model-cache.d.ts +15 -6
- package/dist/holmes/semantic/model-cache.js +77 -21
- package/dist/holmes/semantic/tier.d.ts +5 -1
- package/dist/holmes/semantic/tier.js +7 -6
- package/dist/holmes/semantic/vector-coverage.d.ts +17 -0
- package/dist/holmes/semantic/vector-coverage.js +37 -0
- package/docs/install-guide.md +73 -24
- package/package.json +1 -1
- package/playbooks/superpowers-compat/PLAYBOOK.md +46 -0
|
@@ -38,7 +38,7 @@ exports.isHandlerRefusal = isHandlerRefusal;
|
|
|
38
38
|
exports.unreadableAmong = unreadableAmong;
|
|
39
39
|
exports.makeHandlers = makeHandlers;
|
|
40
40
|
exports.collectDecisions = collectDecisions;
|
|
41
|
-
// @implements A-SPEC-629, A-SPEC-628, A-SPEC-599, A-SPEC-603, A-SPEC-604, A-SPEC-605, A-SPEC-606, A-SPEC-607, A-SPEC-608, A-SPEC-609, A-SPEC-610, A-SPEC-611, A-SPEC-612, A-SPEC-613, A-SPEC-614, A-SPEC-615, A-SPEC-616, A-SPEC-617, A-SPEC-618, A-SPEC-621, A-SPEC-622, A-SPEC-624, A-SPEC-625, A-SPEC-627
|
|
41
|
+
// @implements A-SPEC-703, A-SPEC-629, A-SPEC-628, A-SPEC-599, A-SPEC-603, A-SPEC-604, A-SPEC-605, A-SPEC-606, A-SPEC-607, A-SPEC-608, A-SPEC-609, A-SPEC-610, A-SPEC-611, A-SPEC-612, A-SPEC-613, A-SPEC-614, A-SPEC-615, A-SPEC-616, A-SPEC-617, A-SPEC-618, A-SPEC-621, A-SPEC-622, A-SPEC-624, A-SPEC-625, A-SPEC-627, A-SPEC-713
|
|
42
42
|
// @implements A-SPEC-643
|
|
43
43
|
// @implements A-SPEC-642
|
|
44
44
|
// @implements A-SPEC-642
|
|
@@ -68,6 +68,7 @@ const spec_authoring_1 = require("./handlers/spec-authoring");
|
|
|
68
68
|
const spec_lifecycle_1 = require("./handlers/spec-lifecycle");
|
|
69
69
|
const spec_approval_1 = require("./handlers/spec-approval");
|
|
70
70
|
const workspace_identity_2 = require("./handlers/workspace-identity");
|
|
71
|
+
const workspace_preflight_1 = require("./handlers/workspace-preflight");
|
|
71
72
|
const operator_inspection_1 = require("./handlers/operator-inspection");
|
|
72
73
|
const phase_queries_1 = require("./handlers/phase-queries");
|
|
73
74
|
const risk_assessment_1 = require("./handlers/risk-assessment");
|
|
@@ -81,6 +82,7 @@ const graph_operations_1 = require("./handlers/graph-operations");
|
|
|
81
82
|
// @implements A-SPEC-632 — the rebuild paths discharge shares with reindex.
|
|
82
83
|
const graph_operations_2 = require("./handlers/graph-operations");
|
|
83
84
|
const maintenance_analysis_1 = require("./handlers/maintenance-analysis");
|
|
85
|
+
const requirement_triage_1 = require("./handlers/requirement-triage");
|
|
84
86
|
const taint_screening_1 = require("./handlers/taint-screening");
|
|
85
87
|
const cpg_scanner_1 = require("../cpg/cpg-scanner");
|
|
86
88
|
const scan_cache_1 = require("../cpg/scan-cache");
|
|
@@ -533,7 +535,8 @@ function makeHandlers(store, opts) {
|
|
|
533
535
|
const wrapped = {};
|
|
534
536
|
const run = (0, execution_context_1.createExecutionScope)(store instanceof spec_store_1.LocalMarkdownRepository ? store.specsRoot : undefined, opts?.observeInvocation);
|
|
535
537
|
for (const [name, fn] of Object.entries(raw)) {
|
|
536
|
-
const
|
|
538
|
+
const diagnostic = name === 'workspace_preflight';
|
|
539
|
+
const scoped = name === 'workspace_identity' || diagnostic ? fn : async (a) => {
|
|
537
540
|
try {
|
|
538
541
|
return await run(a?.root, () => fn(a));
|
|
539
542
|
}
|
|
@@ -545,7 +548,7 @@ function makeHandlers(store, opts) {
|
|
|
545
548
|
throw e;
|
|
546
549
|
}
|
|
547
550
|
};
|
|
548
|
-
wrapped[name] = (0, basis_1.withBasis)(scoped, (a) => basisFor(a?.root));
|
|
551
|
+
wrapped[name] = (0, basis_1.withBasis)(scoped, (a) => basisFor(diagnostic ? undefined : a?.root));
|
|
549
552
|
}
|
|
550
553
|
wrapped.basis_detail = async (a) => {
|
|
551
554
|
const b = basisFor(a?.root, true);
|
|
@@ -714,6 +717,14 @@ function makeRawHandlers(store, opts) {
|
|
|
714
717
|
specStoreBlindReason: (root, count) => specStoreBlindReason(store, root, count),
|
|
715
718
|
fileDigestOf,
|
|
716
719
|
});
|
|
720
|
+
const requirementTriage = (0, requirement_triage_1.createRequirementTriageHandlers)({
|
|
721
|
+
listSpecs: () => store.list(),
|
|
722
|
+
foreignRootReason: root => foreignRootReason(store, root),
|
|
723
|
+
projectRootOf,
|
|
724
|
+
cachedScan,
|
|
725
|
+
assertStoreReachable: (tool, root) => assertSpecStoreReachable(tool, store, root),
|
|
726
|
+
refusal: reason => new HandlerRefusal(reason),
|
|
727
|
+
});
|
|
717
728
|
const resolver = (specs) => (id) => specs.find((s) => s.id === id) ?? null;
|
|
718
729
|
// @implements A-SPEC-100.2, A-SPEC-128, A-SPEC-138, A-SPEC-140.2, A-SPEC-189, A-SPEC-461, A-SPEC-512.2, A-SPEC-513.1, A-SPEC-524.1
|
|
719
730
|
const taintScreening = (0, taint_screening_1.createTaintScreeningHandlers)({
|
|
@@ -925,11 +936,13 @@ function makeRawHandlers(store, opts) {
|
|
|
925
936
|
listSpecs: () => store.list(),
|
|
926
937
|
cachedScan,
|
|
927
938
|
}),
|
|
939
|
+
requirement_triage: requirementTriage.requirement_triage,
|
|
928
940
|
// @implements A-SPEC-642 — placed in the one slot no public-key-order pin covers (the handler suites pin
|
|
929
941
|
// spec_create..spec_upgrade, spec_retire..spec_unseal, spec_unseal+5, spec_approve+4, spec_next+3,
|
|
930
942
|
// citation_pin+4, phase_check+3, cpg_scan+3, taint_scan..issue_localize, test_run+3, issue_localize+3,
|
|
931
943
|
// rtm_impact+4, rtm_reindex..review_record, review_prepare..risk_check, risk_check±, and the tail).
|
|
932
944
|
ledger_reconcile: operatorInspection.ledger_reconcile,
|
|
945
|
+
...(0, workspace_preflight_1.createWorkspacePreflightHandlers)({ storeRoot: store instanceof spec_store_1.LocalMarkdownRepository ? store.specsRoot : undefined }),
|
|
933
946
|
// @implements A-SPEC-700.2 — same unpinned slot: `spec_retire..spec_unseal` is a pinned run.
|
|
934
947
|
spec_reconcile: specLifecycle.spec_reconcile,
|
|
935
948
|
rtm_impact: graphOperations.rtm_impact,
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export declare const REQUIREMENT_TRIAGE_EVIDENCE_DIR: string;
|
|
2
|
+
export interface RequirementTriageArtifact {
|
|
3
|
+
schema: 'requirement-triage-evidence/1';
|
|
4
|
+
promptDigest: string;
|
|
5
|
+
result: unknown;
|
|
6
|
+
}
|
|
7
|
+
/** Writes an atomically published artifact addressed by its content digest. */
|
|
8
|
+
export declare function writeRequirementTriageEvidence(root: string, artifact: RequirementTriageArtifact): {
|
|
9
|
+
digest: string;
|
|
10
|
+
path: string;
|
|
11
|
+
};
|
|
@@ -0,0 +1,79 @@
|
|
|
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.REQUIREMENT_TRIAGE_EVIDENCE_DIR = void 0;
|
|
37
|
+
exports.writeRequirementTriageEvidence = writeRequirementTriageEvidence;
|
|
38
|
+
// @implements A-SPEC-713
|
|
39
|
+
/** Content-addressed, isolated persistence for advisory requirement triage results. */
|
|
40
|
+
const crypto = __importStar(require("node:crypto"));
|
|
41
|
+
const fs = __importStar(require("node:fs"));
|
|
42
|
+
const path = __importStar(require("node:path"));
|
|
43
|
+
exports.REQUIREMENT_TRIAGE_EVIDENCE_DIR = path.join('.ax', 'evidence', 'requirement-triage');
|
|
44
|
+
const sha256 = (text) => `sha256:${crypto.createHash('sha256').update(text).digest('hex')}`;
|
|
45
|
+
const DIGEST = /^sha256:[a-f0-9]{64}$/;
|
|
46
|
+
/** Canonical JSON keeps equivalent object construction from creating different evidence addresses. */
|
|
47
|
+
function stable(value) {
|
|
48
|
+
if (value === null || typeof value === 'boolean' || typeof value === 'string')
|
|
49
|
+
return JSON.stringify(value);
|
|
50
|
+
if (typeof value === 'number') {
|
|
51
|
+
if (!Number.isFinite(value))
|
|
52
|
+
throw new Error('requirement triage artifact contains a non-finite number');
|
|
53
|
+
return JSON.stringify(value);
|
|
54
|
+
}
|
|
55
|
+
if (Array.isArray(value))
|
|
56
|
+
return `[${value.map(stable).join(',')}]`;
|
|
57
|
+
if (typeof value === 'object') {
|
|
58
|
+
const row = value;
|
|
59
|
+
return `{${Object.keys(row).sort().map((key) => `${JSON.stringify(key)}:${stable(row[key])}`).join(',')}}`;
|
|
60
|
+
}
|
|
61
|
+
throw new Error('requirement triage artifact is not JSON-serializable');
|
|
62
|
+
}
|
|
63
|
+
/** Writes an atomically published artifact addressed by its content digest. */
|
|
64
|
+
function writeRequirementTriageEvidence(root, artifact) {
|
|
65
|
+
if (artifact.schema !== 'requirement-triage-evidence/1' || !DIGEST.test(artifact.promptDigest)) {
|
|
66
|
+
throw new Error('requirement triage artifact requires a sha256 prompt digest');
|
|
67
|
+
}
|
|
68
|
+
const body = `${stable(artifact)}\n`;
|
|
69
|
+
const digest = sha256(body);
|
|
70
|
+
const dir = path.join(root, exports.REQUIREMENT_TRIAGE_EVIDENCE_DIR);
|
|
71
|
+
const target = path.join(dir, `${digest.slice('sha256:'.length)}.json`);
|
|
72
|
+
fs.mkdirSync(dir, { recursive: true });
|
|
73
|
+
if (!fs.existsSync(target)) {
|
|
74
|
+
const temp = `${target}.${process.pid}.tmp`;
|
|
75
|
+
fs.writeFileSync(temp, body, 'utf8');
|
|
76
|
+
fs.renameSync(temp, target);
|
|
77
|
+
}
|
|
78
|
+
return { digest, path: target };
|
|
79
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.TOOL_SCHEMAS = exports.HOOK_ENFORCED_TOOLS = void 0;
|
|
4
|
-
// @implements A-SPEC-629, A-SPEC-628, A-SPEC-623, A-SPEC-277, A-SPEC-624, A-SPEC-627
|
|
4
|
+
// @implements A-SPEC-703, A-SPEC-629, A-SPEC-628, A-SPEC-623, A-SPEC-277, A-SPEC-624, A-SPEC-627, A-SPEC-713
|
|
5
5
|
// @implements A-SPEC-495 — the maintenance_analyze description carries the semantic-evidence
|
|
6
6
|
// consumer contract (sem-verify / semCos / semanticAlternates) beside the anti-prediction warning.
|
|
7
7
|
// @implements A-SPEC-642
|
|
@@ -11,6 +11,7 @@ exports.TOOL_SCHEMAS = exports.HOOK_ENFORCED_TOOLS = void 0;
|
|
|
11
11
|
// @implements A-SPEC-269
|
|
12
12
|
// @implements A-SPEC-267
|
|
13
13
|
const spec_types_1 = require("../spec/spec-types");
|
|
14
|
+
const agents_1 = require("../cli/agents");
|
|
14
15
|
const phase_1 = require("../guardrail/phase");
|
|
15
16
|
const str = (description) => ({ type: 'string', description });
|
|
16
17
|
const num = (description) => ({ type: 'number', description });
|
|
@@ -51,6 +52,10 @@ exports.TOOL_SCHEMAS = {
|
|
|
51
52
|
description: 'Inspect or plan entity adoption without writes by default. Explicit adopt requires config-write approval for the exact returned plan and preserves sealed document bytes. Adopted stores retain entity identity through journaled document creation, edits and classification moves. recovery-plan reports interrupted targets without changing them. recover requires separate exact-plan approval to complete interrupted transactions or release locks for verified completed writes. Sealing, unsealing and retirement additionally require current spec-approve authority for the affected ID and the same transition policy as official spec tools. Live or unknown owners, external changes and noncanonical transitions refuse. Recovery audit completion across crashes remains under development.',
|
|
52
53
|
inputSchema: { type: 'object', properties: { root: ROOT_ANY, operation: { type: 'string', enum: ['status', 'plan-adoption', 'adopt', 'recovery-plan', 'recover'] }, plan: { type: 'object', description: 'The complete unmodified plan returned by plan-adoption or recovery-plan.' } } },
|
|
53
54
|
},
|
|
55
|
+
workspace_preflight: {
|
|
56
|
+
description: 'Read-only diagnosis of this live MCP server workspace binding. Mismatched roots are not scanned. Identity and checkout are inspected only for a matching root. Does not rebind, initialize, register or prove client hook enforcement.',
|
|
57
|
+
inputSchema: { type: 'object', properties: { root: ROOT_ANY, harness: { type: 'string', enum: [...agents_1.AGENTS] } }, required: ['root'] },
|
|
58
|
+
},
|
|
54
59
|
workspace_identity: {
|
|
55
60
|
description: 'Inspect canonical workspace and local replica identity without writes by default. Explicit initialize creates a Git-shareable .ax/workspace.json and registers this checkout; register requires an existing canonical identity. Preserve legacy specs and ledgers; these identifiers grant no approval authority. Share the manifest through Git and keep .ax/state local. Registered MCP writes include holmes-execution/1 provenance and require a reader supporting that schema; matching package versions alone do not establish this capability.',
|
|
56
61
|
inputSchema: {
|
|
@@ -361,6 +366,19 @@ exports.TOOL_SCHEMAS = {
|
|
|
361
366
|
required: ['root', 'request'],
|
|
362
367
|
},
|
|
363
368
|
},
|
|
369
|
+
requirement_triage: {
|
|
370
|
+
description: 'Read-only requirement lifecycle advisory. BM25 always ranks governed REQ/H-SPEC/A-SPEC/T-SPEC lineages; cached local BGE-M3 or explicit Gemini candidates are additive. Content, approval, implementation-anchor, and fresh execution evidence determine fulfilled, existing-change, new, or ambiguous. It never creates, edits, approves, unseals, retires, or opens a source-edit gate.',
|
|
371
|
+
inputSchema: {
|
|
372
|
+
type: 'object',
|
|
373
|
+
properties: {
|
|
374
|
+
root: ROOT_ANY,
|
|
375
|
+
prompt: str('User requirement or requested behavior to compare with governed requirement lineages.'),
|
|
376
|
+
topK: num('Maximum displayed candidate lineages (default 10, clamped to 1..20).'),
|
|
377
|
+
persist: bool('Write only a content-addressed requirement-triage evidence artifact. Default false.'),
|
|
378
|
+
},
|
|
379
|
+
required: ['root', 'prompt'],
|
|
380
|
+
},
|
|
381
|
+
},
|
|
364
382
|
maintenance_outcome: {
|
|
365
383
|
description: 'Record what a change actually touched against a previously persisted maintenance analysis, so the prediction can later be scored. The digest must name an analysis this project already stored.',
|
|
366
384
|
inputSchema: {
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export type CheckoutInfo = {
|
|
2
|
+
kind: 'main' | 'worktree' | 'submodule' | 'non-git' | 'unknown';
|
|
3
|
+
root: string;
|
|
4
|
+
gitTopLevel: string | null;
|
|
5
|
+
branch: string | null;
|
|
6
|
+
detached: boolean | null;
|
|
7
|
+
};
|
|
8
|
+
export declare function inspectWorkspaceCheckout(root: string): CheckoutInfo;
|
|
@@ -0,0 +1,74 @@
|
|
|
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.inspectWorkspaceCheckout = inspectWorkspaceCheckout;
|
|
37
|
+
// @implements A-SPEC-703
|
|
38
|
+
const path = __importStar(require("node:path"));
|
|
39
|
+
const node_child_process_1 = require("node:child_process");
|
|
40
|
+
const root_1 = require("./root");
|
|
41
|
+
function inspectWorkspaceCheckout(root) {
|
|
42
|
+
const result = { kind: 'unknown', root, gitTopLevel: null, branch: null, detached: null };
|
|
43
|
+
const env = (0, root_1.cleanSubprocessEnv)();
|
|
44
|
+
// A caller's Git overrides must not redirect inspection to another checkout.
|
|
45
|
+
for (const key of Object.keys(env))
|
|
46
|
+
if (key.startsWith('GIT_'))
|
|
47
|
+
delete env[key];
|
|
48
|
+
const git = (...args) => (0, node_child_process_1.execFileSync)('git', ['-C', root, ...args], {
|
|
49
|
+
encoding: 'utf8', timeout: 5000, maxBuffer: 1024 * 1024, env,
|
|
50
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
51
|
+
}).trim();
|
|
52
|
+
try {
|
|
53
|
+
result.gitTopLevel = (0, root_1.canonicalPath)(git('rev-parse', '--show-toplevel'));
|
|
54
|
+
const gitDir = (0, root_1.canonicalPath)(git('rev-parse', '--absolute-git-dir'));
|
|
55
|
+
const common = (0, root_1.canonicalPath)(path.resolve(root, git('rev-parse', '--git-common-dir')));
|
|
56
|
+
const superproject = git('rev-parse', '--show-superproject-working-tree');
|
|
57
|
+
result.kind = superproject ? 'submodule' : gitDir !== common ? 'worktree' : 'main';
|
|
58
|
+
try {
|
|
59
|
+
result.branch = git('symbolic-ref', '--quiet', '--short', 'HEAD');
|
|
60
|
+
result.detached = false;
|
|
61
|
+
}
|
|
62
|
+
catch (e) {
|
|
63
|
+
if (e.status === 1)
|
|
64
|
+
result.detached = true;
|
|
65
|
+
else
|
|
66
|
+
throw e;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
const err = e;
|
|
71
|
+
result.kind = err.status === 128 && String(err.stderr).includes('not a git repository') ? 'non-git' : 'unknown';
|
|
72
|
+
}
|
|
73
|
+
return result;
|
|
74
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { WorkspaceIdentityStatus } from './workspace-identity';
|
|
2
|
+
import { CheckoutInfo } from './workspace-checkout';
|
|
3
|
+
export type { CheckoutInfo } from './workspace-checkout';
|
|
4
|
+
export type PreflightCheck = {
|
|
5
|
+
id: string;
|
|
6
|
+
status: 'pass' | 'blocked' | 'unknown';
|
|
7
|
+
detail: string;
|
|
8
|
+
actions: string[];
|
|
9
|
+
};
|
|
10
|
+
export type WorkspacePreflight = {
|
|
11
|
+
schema: 'holmes-workspace-preflight/1';
|
|
12
|
+
requestedRoot: string | null;
|
|
13
|
+
boundRoot: string | null;
|
|
14
|
+
boundSpecsRoot: string | null;
|
|
15
|
+
binding: 'matched' | 'mismatch' | 'unbound' | 'invalid';
|
|
16
|
+
identity: WorkspaceIdentityStatus | null;
|
|
17
|
+
checkout: CheckoutInfo | null;
|
|
18
|
+
checks: PreflightCheck[];
|
|
19
|
+
nextActions: string[];
|
|
20
|
+
};
|
|
21
|
+
export declare function inspectWorkspacePreflight(input: {
|
|
22
|
+
requestedRoot: string;
|
|
23
|
+
storeRoot?: string;
|
|
24
|
+
}): WorkspacePreflight;
|
|
@@ -0,0 +1,99 @@
|
|
|
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.inspectWorkspacePreflight = inspectWorkspacePreflight;
|
|
37
|
+
// @implements A-SPEC-703
|
|
38
|
+
const fs = __importStar(require("node:fs"));
|
|
39
|
+
const path = __importStar(require("node:path"));
|
|
40
|
+
const root_1 = require("./root");
|
|
41
|
+
const workspace_identity_1 = require("./workspace-identity");
|
|
42
|
+
const workspace_checkout_1 = require("./workspace-checkout");
|
|
43
|
+
function inspectWorkspacePreflight(input) {
|
|
44
|
+
const out = { schema: 'holmes-workspace-preflight/1', requestedRoot: null,
|
|
45
|
+
boundRoot: null, boundSpecsRoot: null, binding: 'invalid', identity: null, checkout: null, checks: [], nextActions: [] };
|
|
46
|
+
const check = (id, status, detail, actions = []) => {
|
|
47
|
+
out.checks.push({ id, status, detail, actions });
|
|
48
|
+
out.nextActions.push(...actions);
|
|
49
|
+
};
|
|
50
|
+
try {
|
|
51
|
+
if (typeof input.requestedRoot !== 'string' || !path.isAbsolute(input.requestedRoot)) {
|
|
52
|
+
check('root', 'blocked', 'An absolute existing workspace directory is required.');
|
|
53
|
+
return out;
|
|
54
|
+
}
|
|
55
|
+
out.requestedRoot = (0, root_1.resolveProjectRoot)(input.requestedRoot, { includeGit: false }).root;
|
|
56
|
+
if (!input.storeRoot) {
|
|
57
|
+
out.binding = 'unbound';
|
|
58
|
+
check('binding', 'unknown', 'The server has no file-backed spec store.');
|
|
59
|
+
return out;
|
|
60
|
+
}
|
|
61
|
+
let existing = path.resolve(input.storeRoot);
|
|
62
|
+
while (!fs.existsSync(existing) && path.dirname(existing) !== existing)
|
|
63
|
+
existing = path.dirname(existing);
|
|
64
|
+
out.boundSpecsRoot = path.join((0, root_1.canonicalPath)(existing), path.relative(existing, path.resolve(input.storeRoot)));
|
|
65
|
+
out.boundRoot = (0, root_1.resolveProjectRoot)(existing, { includeGit: false }).root;
|
|
66
|
+
if (out.requestedRoot !== out.boundRoot) {
|
|
67
|
+
out.binding = 'mismatch';
|
|
68
|
+
check('binding', 'blocked', 'Requested workspace differs from the live server store.', ['Restart the MCP server with HOLMES_SPECS pointing to the intended workspace, then rerun workspace_preflight.']);
|
|
69
|
+
return out;
|
|
70
|
+
}
|
|
71
|
+
// Only after binding matches may we inspect checkout metadata or identity.
|
|
72
|
+
const requestedCheckout = (0, workspace_checkout_1.inspectWorkspaceCheckout)((0, root_1.canonicalPath)(input.requestedRoot));
|
|
73
|
+
if (requestedCheckout.gitTopLevel && requestedCheckout.gitTopLevel !== out.boundRoot) {
|
|
74
|
+
check('workspace-marker', 'blocked', 'The requested checkout inherits a different workspace marker.', ['Prepare the intended checkout explicitly; do not copy local replica state.']);
|
|
75
|
+
return out;
|
|
76
|
+
}
|
|
77
|
+
out.identity = (0, workspace_identity_1.workspaceIdentity)(out.boundRoot, 'status');
|
|
78
|
+
out.checkout = (0, workspace_checkout_1.inspectWorkspaceCheckout)(out.boundRoot);
|
|
79
|
+
out.binding = 'matched';
|
|
80
|
+
check('binding', 'pass', 'Requested workspace matches the live server store.');
|
|
81
|
+
if (out.identity.state === 'initialized')
|
|
82
|
+
check('identity', 'blocked', 'Canonical identity exists but this replica is unregistered.', ['Use workspace_identity operation register for this checkout before governed writes.']);
|
|
83
|
+
else
|
|
84
|
+
check('identity', 'pass', `Workspace identity is ${out.identity.state}.`);
|
|
85
|
+
check('checkout', out.checkout.kind === 'unknown' ? 'unknown' : 'pass', `Checkout kind: ${out.checkout.kind}.`);
|
|
86
|
+
check('runtime-enforcement', 'unknown', 'Binding and disk inspection do not prove current client hook enforcement.');
|
|
87
|
+
return out;
|
|
88
|
+
}
|
|
89
|
+
catch (e) {
|
|
90
|
+
const error = e;
|
|
91
|
+
if (!(e instanceof workspace_identity_1.WorkspaceIdentityError) && !error.holmesRefusal && !['ENOENT', 'EACCES', 'EPERM', 'ENOTDIR'].includes(error.code ?? ''))
|
|
92
|
+
throw e;
|
|
93
|
+
out.binding = 'invalid';
|
|
94
|
+
out.identity = null;
|
|
95
|
+
out.checkout = null;
|
|
96
|
+
check('inspection', 'blocked', error.message, ['Preserve existing records and repair the reported path or identity explicitly.']);
|
|
97
|
+
return out;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import type { ReplayCase } from './replay-corpus';
|
|
2
|
+
export interface ConditionHunkReplayReport {
|
|
3
|
+
schema: 'condition-hunk-replay/1';
|
|
4
|
+
commits: string[];
|
|
5
|
+
caseCount: number;
|
|
6
|
+
raw: {
|
|
7
|
+
files: number;
|
|
8
|
+
symbols: number;
|
|
9
|
+
candidateSymbols: number;
|
|
10
|
+
hunks: number;
|
|
11
|
+
resolved: number;
|
|
12
|
+
ambiguous: number;
|
|
13
|
+
unavailable: number;
|
|
14
|
+
relaxed: number;
|
|
15
|
+
narrowed: number;
|
|
16
|
+
unknown: number;
|
|
17
|
+
};
|
|
18
|
+
candidateReduction: {
|
|
19
|
+
hunkToResolved: number | null;
|
|
20
|
+
};
|
|
21
|
+
timingMs: {
|
|
22
|
+
baseline: number;
|
|
23
|
+
conditionResolution: number;
|
|
24
|
+
overheadPct: number | null;
|
|
25
|
+
};
|
|
26
|
+
elapsedMs: number;
|
|
27
|
+
limitations: string[];
|
|
28
|
+
}
|
|
29
|
+
/** Replays caller-selected commits only; it never checks out, writes a cache, or inspects another repository. */
|
|
30
|
+
export declare function replayConditionHunks(input: {
|
|
31
|
+
root: string;
|
|
32
|
+
cases: readonly ReplayCase[];
|
|
33
|
+
}): Promise<ConditionHunkReplayReport>;
|
|
@@ -0,0 +1,112 @@
|
|
|
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.replayConditionHunks = replayConditionHunks;
|
|
37
|
+
// @implements A-SPEC-661
|
|
38
|
+
/** Historical, read-only measurement for the condition-hunk advisory. */
|
|
39
|
+
const node_child_process_1 = require("node:child_process");
|
|
40
|
+
const path = __importStar(require("node:path"));
|
|
41
|
+
const language_parser_1 = require("../cpg/language-parser");
|
|
42
|
+
const condition_hunk_resolution_1 = require("./condition-hunk-resolution");
|
|
43
|
+
const SAFE_COMMIT = /^[0-9a-f]{7,64}$/;
|
|
44
|
+
const sourceLanguage = (file) => {
|
|
45
|
+
if (/\.(ts|mts|cts)$/.test(file))
|
|
46
|
+
return 'typescript';
|
|
47
|
+
if (/\.(tsx|js|jsx|mjs|cjs)$/.test(file))
|
|
48
|
+
return 'tsx';
|
|
49
|
+
return null;
|
|
50
|
+
};
|
|
51
|
+
const safePath = (file) => file !== '' && !path.isAbsolute(file) && !file.split(/[\\/]/).includes('..');
|
|
52
|
+
const git = (root, args) => (0, node_child_process_1.execFileSync)('git', ['-C', root, ...args], {
|
|
53
|
+
encoding: 'utf8', stdio: ['ignore', 'pipe', 'pipe'], maxBuffer: 16 * 1024 * 1024,
|
|
54
|
+
});
|
|
55
|
+
/** Replays caller-selected commits only; it never checks out, writes a cache, or inspects another repository. */
|
|
56
|
+
async function replayConditionHunks(input) {
|
|
57
|
+
const started = Date.now();
|
|
58
|
+
const parser = new language_parser_1.TreeSitterTsParser();
|
|
59
|
+
const resolutions = [];
|
|
60
|
+
let files = 0, symbols = 0, candidateSymbols = 0, baselineMs = 0, conditionResolutionMs = 0;
|
|
61
|
+
const commits = [];
|
|
62
|
+
for (const replayCase of input.cases) {
|
|
63
|
+
if (!SAFE_COMMIT.test(replayCase.commit))
|
|
64
|
+
throw new Error('condition replay requires a hexadecimal commit id');
|
|
65
|
+
commits.push(replayCase.commit);
|
|
66
|
+
for (const file of replayCase.files) {
|
|
67
|
+
const language = sourceLanguage(file);
|
|
68
|
+
if (language === null || !safePath(file))
|
|
69
|
+
continue;
|
|
70
|
+
let source, diff;
|
|
71
|
+
const baselineStart = Date.now();
|
|
72
|
+
try {
|
|
73
|
+
source = git(input.root, ['show', `${replayCase.commit}:${file}`]);
|
|
74
|
+
diff = git(input.root, ['diff', '--unified=0', `${replayCase.commit}^`, replayCase.commit, '--', file]);
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
continue;
|
|
78
|
+
}
|
|
79
|
+
const hunks = (0, condition_hunk_resolution_1.parseUnifiedZeroDiff)(diff);
|
|
80
|
+
if (hunks.length === 0)
|
|
81
|
+
continue;
|
|
82
|
+
const rows = parser.extractSymbols(source, language).map((symbol) => ({ file, name: symbol.qualifiedName, startLine: symbol.startLine, endLine: symbol.endLine }));
|
|
83
|
+
baselineMs += Date.now() - baselineStart;
|
|
84
|
+
files++;
|
|
85
|
+
symbols += rows.length;
|
|
86
|
+
candidateSymbols += hunks.reduce((total, hunk) => total + rows.filter((symbol) => symbol.startLine <= hunk.startLine && symbol.endLine >= hunk.endLine).length, 0);
|
|
87
|
+
const conditionStart = Date.now();
|
|
88
|
+
resolutions.push(...await (0, condition_hunk_resolution_1.resolveConditionHunksFromSources)({ diff, sources: [{ file, source }], symbols: rows }));
|
|
89
|
+
conditionResolutionMs += Date.now() - conditionStart;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const resolved = resolutions.filter((row) => row.state === 'resolved').length;
|
|
93
|
+
const ambiguous = resolutions.filter((row) => row.state === 'ambiguous').length;
|
|
94
|
+
const unavailable = resolutions.filter((row) => row.state === 'unavailable').length;
|
|
95
|
+
const relaxed = resolutions.filter((row) => row.direction === 'relaxed').length;
|
|
96
|
+
const narrowed = resolutions.filter((row) => row.direction === 'narrowed').length;
|
|
97
|
+
const unknown = resolutions.filter((row) => row.direction === 'unknown').length;
|
|
98
|
+
return {
|
|
99
|
+
schema: 'condition-hunk-replay/1', commits, caseCount: input.cases.length,
|
|
100
|
+
raw: { files, symbols, candidateSymbols, hunks: resolutions.length, resolved, ambiguous, unavailable, relaxed, narrowed, unknown },
|
|
101
|
+
candidateReduction: { hunkToResolved: candidateSymbols === 0 ? null : 1 - resolved / candidateSymbols },
|
|
102
|
+
timingMs: { baseline: baselineMs, conditionResolution: conditionResolutionMs,
|
|
103
|
+
overheadPct: baselineMs === 0 ? null : conditionResolutionMs / baselineMs * 100 },
|
|
104
|
+
elapsedMs: Date.now() - started,
|
|
105
|
+
limitations: [
|
|
106
|
+
'This measures only caller-selected TypeScript/JavaScript files with readable commit blobs.',
|
|
107
|
+
'A resolved span is provenance coverage, not a precision or correctness claim.',
|
|
108
|
+
'Direction is reported only for a same-position changed control-flow predicate with a locally monotonic syntax rule; every other hunk remains unknown.',
|
|
109
|
+
'The replay is read-only and does not evaluate a gate, mutate changedFiles, or run tests.',
|
|
110
|
+
],
|
|
111
|
+
};
|
|
112
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
export type ConditionDirection = 'relaxed' | 'narrowed' | 'unknown';
|
|
2
|
+
export type HunkResolutionState = 'resolved' | 'ambiguous' | 'unavailable';
|
|
3
|
+
export interface UnifiedZeroHunk {
|
|
4
|
+
file: string;
|
|
5
|
+
startLine: number;
|
|
6
|
+
endLine: number;
|
|
7
|
+
deletionOnly?: boolean;
|
|
8
|
+
/** Exact changed lines are evidence only; resolution never expands the changed line range. */
|
|
9
|
+
removedLines?: string[];
|
|
10
|
+
addedLines?: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface HunkSymbol {
|
|
13
|
+
file: string;
|
|
14
|
+
name: string;
|
|
15
|
+
startLine: number;
|
|
16
|
+
endLine: number;
|
|
17
|
+
}
|
|
18
|
+
export interface ConditionBranch {
|
|
19
|
+
file: string;
|
|
20
|
+
startLine: number;
|
|
21
|
+
endLine: number;
|
|
22
|
+
conditionText?: string;
|
|
23
|
+
beforeConditionText?: string;
|
|
24
|
+
branchLabel: 'true' | 'false' | 'case' | 'default' | string;
|
|
25
|
+
astKind?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface HunkResolution {
|
|
28
|
+
file: string;
|
|
29
|
+
hunk: UnifiedZeroHunk;
|
|
30
|
+
symbol?: string;
|
|
31
|
+
branch?: ConditionBranch;
|
|
32
|
+
conditionText?: string;
|
|
33
|
+
direction: ConditionDirection;
|
|
34
|
+
state: HunkResolutionState;
|
|
35
|
+
reason?: string;
|
|
36
|
+
candidates?: ConditionBranch[];
|
|
37
|
+
}
|
|
38
|
+
/** Parse file headers, @@ ranges, and exact changed lines; body text never widens the changed region. */
|
|
39
|
+
export declare function parseUnifiedZeroDiff(diff: string): UnifiedZeroHunk[];
|
|
40
|
+
/** Classifies only syntactic changes with a local, monotonic meaning; all other changes are unknown. */
|
|
41
|
+
export declare function classifyConditionDirection(before: string | undefined, after: string | undefined): ConditionDirection;
|
|
42
|
+
export interface ResolveConditionHunksInput {
|
|
43
|
+
hunks: readonly UnifiedZeroHunk[];
|
|
44
|
+
symbols: readonly HunkSymbol[];
|
|
45
|
+
branches: readonly ConditionBranch[];
|
|
46
|
+
/** This first advisory implementation preserves TS/JS branch source spans only. */
|
|
47
|
+
language?: string;
|
|
48
|
+
}
|
|
49
|
+
/** Intersects hunk → narrowest symbol → branch span, retaining ties instead of inventing a winner. */
|
|
50
|
+
export declare function resolveConditionHunks(input: ResolveConditionHunksInput): HunkResolution[];
|
|
51
|
+
export interface ConditionHunkSource {
|
|
52
|
+
file: string;
|
|
53
|
+
source: string;
|
|
54
|
+
}
|
|
55
|
+
export interface ResolveConditionHunksFromSourcesInput {
|
|
56
|
+
diff: string;
|
|
57
|
+
sources: readonly ConditionHunkSource[];
|
|
58
|
+
symbols: readonly HunkSymbol[];
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The explicit heavy advisory path: parse only caller-supplied TS/JS source, derive CFG predicate
|
|
62
|
+
* spans, and feed the same conservative resolver. It is intentionally separate from CpgScanner's
|
|
63
|
+
* synchronous hot path and cannot alter changedFiles, a graph, a gate, or a cache.
|
|
64
|
+
*/
|
|
65
|
+
export declare function resolveConditionHunksFromSources(input: ResolveConditionHunksFromSourcesInput): Promise<HunkResolution[]>;
|