@mrclrchtr/supi-code-intelligence 10.0.0 → 11.0.1
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/README.md +77 -21
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/LICENSE +21 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/README.md +743 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/index.js +17 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/constants.js +184 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/parse.js +1425 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/picomatch.js +361 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/scan.js +403 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/utils.js +72 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/package.json +83 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/posix.js +3 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +4 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +11 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/file-associations.ts +190 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +22 -0
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/README.md +88 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/LICENSE +21 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/README.md +743 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/index.js +17 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/constants.js +184 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/parse.js +1425 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/picomatch.js +361 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/scan.js +403 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/utils.js +72 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/package.json +83 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/posix.js +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +4 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/file-associations.ts +190 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +22 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostic-host.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-diagnostics.ts +6 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-request-enrollment.ts +66 -22
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-semantic-input-barrier.ts +37 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +136 -43
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +261 -22
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +13 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-edit-discovery.ts +151 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-edit-normalizer.ts +97 -129
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/semantic-edit-protocol.ts +132 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +8 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registry.ts +7 -20
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-rename.ts +172 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/workspace-lsp-runtime.ts +14 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/utils.ts +12 -11
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +63 -17
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/LICENSE +21 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/README.md +743 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/index.js +17 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/constants.js +184 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/parse.js +1425 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/picomatch.js +361 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/scan.js +403 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/lib/utils.js +72 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/package.json +83 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/picomatch/posix.js +3 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +4 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +11 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/file-associations.ts +190 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +22 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/language.ts +16 -10
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/operation-support.ts +13 -6
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/provider/tree-sitter-provider.ts +19 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-controller.ts +18 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/session.ts +10 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-client.ts +17 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-process.ts +22 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/structural-worker-protocol.ts +36 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/syntax-errors.ts +73 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/syntax-node.ts +4 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +15 -9
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +24 -15
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/exports.ts +8 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/imports.ts +233 -7
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/node-at.ts +7 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/outline-expansion.ts +78 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/outline-jvm.ts +25 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/outline-nested.ts +390 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/outline.ts +49 -28
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/types.ts +16 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/process-host.mjs +61 -24
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/runtime.ts +44 -10
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/service.ts +13 -9
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/worker/worker-main.ts +15 -2
- package/node_modules/ignore/README.md +61 -6
- package/node_modules/ignore/index.d.ts +55 -20
- package/node_modules/ignore/index.js +93 -67
- package/node_modules/ignore/legacy.js +109 -85
- package/node_modules/ignore/package.json +1 -1
- package/package.json +5 -5
- package/src/analysis/refactor/apply.ts +35 -14
- package/src/analysis/relations/callees.ts +9 -2
- package/src/analysis/relations/implementations.ts +7 -2
- package/src/analysis/search/pattern-analysis.ts +90 -12
- package/src/analysis/search/pattern.ts +1 -0
- package/src/analysis/target/anchored-structural.ts +1 -0
- package/src/analysis/target/discovery.ts +29 -0
- package/src/analysis/target/file.ts +19 -9
- package/src/analysis/target/types.ts +5 -0
- package/src/config.ts +46 -7
- package/src/session/graph/collect.ts +2 -2
- package/src/session/graph-types.ts +6 -0
- package/src/session/inspect/collect.ts +35 -20
- package/src/session/inspect-types.ts +9 -2
- package/src/session/orientation/collect.ts +90 -18
- package/src/session/orientation/context-sections.ts +22 -1
- package/src/session/orientation/gather.ts +46 -6
- package/src/session/orientation-types.ts +7 -1
- package/src/session/refactor-plans.ts +17 -0
- package/src/session/refactor-workflow.ts +13 -6
- package/src/session/target-store.ts +5 -0
- package/src/session/target-workflow.ts +3 -0
- package/src/substrate/workspace-provider-host.ts +22 -2
- package/src/tool/code_find/markdown.ts +17 -4
- package/src/tool/code_find/result.ts +17 -3
- package/src/tool/code_graph/details.ts +2 -0
- package/src/tool/code_graph/display.ts +1 -0
- package/src/tool/code_graph/format.ts +1 -0
- package/src/tool/code_graph/result.ts +32 -6
- package/src/tool/code_inspect/markdown.ts +15 -1
- package/src/tool/code_inspect/result.ts +11 -0
- package/src/tool/code_orientation/result.ts +4 -2
- package/src/tool/code_resolve/markdown.ts +34 -14
- package/src/tool/code_resolve/result.ts +7 -3
- package/src/tool/result/types.ts +20 -2
- package/src/ui/tui/display.ts +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/LICENSE-MIT +0 -21
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/README.md +0 -501
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/index.d.ts +0 -81
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/index.js +0 -1566
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/legacy.js +0 -1346
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/ignore/package.json +0 -93
|
@@ -69,7 +69,11 @@ export async function applyWorkspaceEdit(
|
|
|
69
69
|
if (!freshness.ok) return { kind: "error", reason: freshness.reason };
|
|
70
70
|
}
|
|
71
71
|
|
|
72
|
-
const documentState = validateDocumentPreconditions(
|
|
72
|
+
const documentState = validateDocumentPreconditions(
|
|
73
|
+
edit,
|
|
74
|
+
options.getOpenDocumentVersion,
|
|
75
|
+
options.expectedFingerprints,
|
|
76
|
+
);
|
|
73
77
|
if (!documentState.ok) return { kind: "error", reason: documentState.reason };
|
|
74
78
|
|
|
75
79
|
const validation = validateEditAgainstFiles(edit);
|
|
@@ -92,6 +96,7 @@ export async function applyWorkspaceEdit(
|
|
|
92
96
|
function validateDocumentPreconditions(
|
|
93
97
|
edit: WorkspaceEdit,
|
|
94
98
|
getOpenDocumentVersion: ApplyOptions["getOpenDocumentVersion"],
|
|
99
|
+
expectedFingerprints: ApplyOptions["expectedFingerprints"],
|
|
95
100
|
): { ok: true } | { ok: false; reason: string } {
|
|
96
101
|
const preconditions = edit.documentPreconditions ?? [];
|
|
97
102
|
if (preconditions.length === 0) return { ok: true };
|
|
@@ -103,23 +108,39 @@ function validateDocumentPreconditions(
|
|
|
103
108
|
}
|
|
104
109
|
|
|
105
110
|
for (const precondition of preconditions) {
|
|
106
|
-
const
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
}
|
|
113
|
-
if (precondition.kind === "disk-content" && currentVersion !== null) {
|
|
114
|
-
return {
|
|
115
|
-
ok: false,
|
|
116
|
-
reason: `File ${precondition.file} is now open and no longer uses disk content as its master.`,
|
|
117
|
-
};
|
|
118
|
-
}
|
|
111
|
+
const reason = validateDocumentPrecondition(
|
|
112
|
+
precondition,
|
|
113
|
+
getOpenDocumentVersion,
|
|
114
|
+
expectedFingerprints,
|
|
115
|
+
);
|
|
116
|
+
if (reason) return { ok: false, reason };
|
|
119
117
|
}
|
|
120
118
|
return { ok: true };
|
|
121
119
|
}
|
|
122
120
|
|
|
121
|
+
function validateDocumentPrecondition(
|
|
122
|
+
precondition: NonNullable<WorkspaceEdit["documentPreconditions"]>[number],
|
|
123
|
+
getOpenDocumentVersion: NonNullable<ApplyOptions["getOpenDocumentVersion"]>,
|
|
124
|
+
expectedFingerprints: ApplyOptions["expectedFingerprints"],
|
|
125
|
+
): string | null {
|
|
126
|
+
const currentVersion = getOpenDocumentVersion(precondition.file);
|
|
127
|
+
if (precondition.kind === "disk-content") {
|
|
128
|
+
return currentVersion === null
|
|
129
|
+
? null
|
|
130
|
+
: `File ${precondition.file} is now open and no longer uses disk content as its master.`;
|
|
131
|
+
}
|
|
132
|
+
if (currentVersion !== precondition.version) {
|
|
133
|
+
return `File ${precondition.file} open document version has changed since the plan was generated.`;
|
|
134
|
+
}
|
|
135
|
+
if (
|
|
136
|
+
precondition.kind === "open-document-content" &&
|
|
137
|
+
expectedFingerprints?.get(precondition.file) !== precondition.fingerprint
|
|
138
|
+
) {
|
|
139
|
+
return `File ${precondition.file} synchronized content fingerprint does not match the stored plan.`;
|
|
140
|
+
}
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
|
|
123
144
|
function validateFingerprints(
|
|
124
145
|
files: string[],
|
|
125
146
|
expected: ReadonlyMap<string, string>,
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Structural callee lookup — finds direct calls in the enclosing scope at a target position.
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
|
-
import type { CodeRequestControl } from "@mrclrchtr/supi-code-runtime/api";
|
|
5
|
+
import type { CodeRequestControl, SourceRange } from "@mrclrchtr/supi-code-runtime/api";
|
|
6
6
|
import type { CalleeEntry, CalleeScope, RelationsServiceDeps } from "./types.ts";
|
|
7
7
|
|
|
8
8
|
export interface CalleesResult {
|
|
@@ -14,6 +14,8 @@ export interface CalleesResult {
|
|
|
14
14
|
/** Original provider reason when callee evidence is unavailable. */
|
|
15
15
|
message: string | null;
|
|
16
16
|
depth: "direct" | "deep";
|
|
17
|
+
/** Syntax recovery that may hide call sites in the analyzed file. */
|
|
18
|
+
partial: { file: string; reason: string; errorRanges: readonly SourceRange[] } | null;
|
|
17
19
|
}
|
|
18
20
|
|
|
19
21
|
/**
|
|
@@ -42,7 +44,7 @@ export async function collectCallees(
|
|
|
42
44
|
targetCharacter,
|
|
43
45
|
depthOrOptions,
|
|
44
46
|
);
|
|
45
|
-
if (result.kind !== "success") {
|
|
47
|
+
if (result.kind !== "success" && result.kind !== "partial") {
|
|
46
48
|
return unavailableCallees(targetName, result.message, depth);
|
|
47
49
|
}
|
|
48
50
|
|
|
@@ -69,6 +71,10 @@ export async function collectCallees(
|
|
|
69
71
|
confidence: "structural",
|
|
70
72
|
message: null,
|
|
71
73
|
depth: result.data.depth ?? depth,
|
|
74
|
+
partial:
|
|
75
|
+
result.kind === "partial"
|
|
76
|
+
? { file: result.file, reason: result.reason, errorRanges: result.errorRanges }
|
|
77
|
+
: null,
|
|
72
78
|
};
|
|
73
79
|
}
|
|
74
80
|
|
|
@@ -85,6 +91,7 @@ function unavailableCallees(
|
|
|
85
91
|
confidence: "unavailable",
|
|
86
92
|
message,
|
|
87
93
|
depth,
|
|
94
|
+
partial: null,
|
|
88
95
|
};
|
|
89
96
|
}
|
|
90
97
|
|
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
} from "./provider-locations.ts";
|
|
11
11
|
import type { ImplementationEntry, RelationsServiceDeps } from "./types.ts";
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
interface ImplementationsResultBase {
|
|
14
14
|
kind: "implementations";
|
|
15
15
|
targetName: string;
|
|
16
16
|
implementations: ImplementationEntry[];
|
|
@@ -18,9 +18,12 @@ export interface ImplementationsResult {
|
|
|
18
18
|
/** Provider locations omitted because their URI or position was unusable. */
|
|
19
19
|
invalidLocationCount: number;
|
|
20
20
|
partialReason: RelationLocationPartialReason | null;
|
|
21
|
-
confidence: "semantic" | "unavailable";
|
|
22
21
|
}
|
|
23
22
|
|
|
23
|
+
/** An implementation lookup result with a reason on every unavailable outcome. */
|
|
24
|
+
export type ImplementationsResult = ImplementationsResultBase &
|
|
25
|
+
({ confidence: "semantic" } | { confidence: "unavailable"; message: string });
|
|
26
|
+
|
|
24
27
|
/**
|
|
25
28
|
* Collect implementations for a target file/position using semantic provider.
|
|
26
29
|
*/
|
|
@@ -41,6 +44,7 @@ export async function collectImplementations(
|
|
|
41
44
|
invalidLocationCount: 0,
|
|
42
45
|
partialReason: null,
|
|
43
46
|
confidence: "unavailable",
|
|
47
|
+
message: "No semantic implementations provider",
|
|
44
48
|
};
|
|
45
49
|
}
|
|
46
50
|
|
|
@@ -54,6 +58,7 @@ export async function collectImplementations(
|
|
|
54
58
|
invalidLocationCount: 0,
|
|
55
59
|
partialReason: null,
|
|
56
60
|
confidence: "unavailable",
|
|
61
|
+
message: result.reason,
|
|
57
62
|
};
|
|
58
63
|
}
|
|
59
64
|
|
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
isCodeRequestDeadlineError,
|
|
5
5
|
isCodeRequestInterruption,
|
|
6
6
|
type OutlineData,
|
|
7
|
+
type SourceRange,
|
|
7
8
|
type StructuralProvider as StructuralSubstrate,
|
|
8
9
|
} from "@mrclrchtr/supi-code-runtime/api";
|
|
9
10
|
import type { CodeFindAstKind } from "../../tool/code_find/ast-kinds.ts";
|
|
@@ -20,8 +21,14 @@ export interface StructuredPatternParams {
|
|
|
20
21
|
export interface StructuredMatch {
|
|
21
22
|
readonly file: string;
|
|
22
23
|
readonly name: string;
|
|
24
|
+
/** Display kind: native kind when available, otherwise common structural kind. */
|
|
23
25
|
readonly kind: string;
|
|
24
26
|
readonly line: number;
|
|
27
|
+
readonly startCharacter: number;
|
|
28
|
+
readonly endLine: number;
|
|
29
|
+
readonly endCharacter: number;
|
|
30
|
+
readonly commonKind?: string;
|
|
31
|
+
readonly nativeKind?: string;
|
|
25
32
|
}
|
|
26
33
|
|
|
27
34
|
export type StructuredFailureKind = Exclude<CodeResult<never>, { kind: "success" }>["kind"];
|
|
@@ -30,9 +37,13 @@ export interface StructuredFailure {
|
|
|
30
37
|
readonly file: string;
|
|
31
38
|
readonly kind: StructuredFailureKind;
|
|
32
39
|
readonly reason: string;
|
|
40
|
+
readonly errorRanges?: readonly SourceRange[];
|
|
33
41
|
}
|
|
34
42
|
|
|
35
|
-
export type StructuredScanLimitation =
|
|
43
|
+
export type StructuredScanLimitation =
|
|
44
|
+
| AstScanLimitation
|
|
45
|
+
| ProviderScanLimitation
|
|
46
|
+
| SyntaxRecoveryScanLimitation;
|
|
36
47
|
|
|
37
48
|
export interface ProviderScanLimitation {
|
|
38
49
|
readonly reason: "provider-failure";
|
|
@@ -40,6 +51,13 @@ export interface ProviderScanLimitation {
|
|
|
40
51
|
readonly examples: readonly string[];
|
|
41
52
|
}
|
|
42
53
|
|
|
54
|
+
/** Recovered syntax files that limit the scan without losing collected matches. */
|
|
55
|
+
export interface SyntaxRecoveryScanLimitation {
|
|
56
|
+
readonly reason: "syntax-recovery";
|
|
57
|
+
readonly pathCount: number;
|
|
58
|
+
readonly examples: readonly string[];
|
|
59
|
+
}
|
|
60
|
+
|
|
43
61
|
export interface StructuredFileAnalysis {
|
|
44
62
|
readonly matches: StructuredMatch[];
|
|
45
63
|
readonly failures: StructuredFailure[];
|
|
@@ -125,11 +143,20 @@ export async function analyzeStructuredFiles(
|
|
|
125
143
|
if (fileFailures.length === 0) analyzedFileCount += 1;
|
|
126
144
|
}
|
|
127
145
|
|
|
128
|
-
|
|
146
|
+
const recoveredFiles = failures.filter((failure) => failure.kind === "partial");
|
|
147
|
+
if (recoveredFiles.length > 0) {
|
|
148
|
+
limitations.push({
|
|
149
|
+
reason: "syntax-recovery",
|
|
150
|
+
pathCount: recoveredFiles.length,
|
|
151
|
+
examples: recoveredFiles.slice(0, 5).map((failure) => failure.file),
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
const failedFiles = failures.filter((failure) => failure.kind !== "partial");
|
|
155
|
+
if (failedFiles.length > 0) {
|
|
129
156
|
limitations.push({
|
|
130
157
|
reason: "provider-failure",
|
|
131
|
-
pathCount:
|
|
132
|
-
examples:
|
|
158
|
+
pathCount: failedFiles.length,
|
|
159
|
+
examples: failedFiles.slice(0, 5).map((failure) => failure.file),
|
|
133
160
|
});
|
|
134
161
|
}
|
|
135
162
|
return { matches, failures, limitations, analyzedFileCount };
|
|
@@ -159,8 +186,17 @@ async function collectMatchesForFile(
|
|
|
159
186
|
matcher: (value: string) => boolean,
|
|
160
187
|
requestControl: CodeRequestControl,
|
|
161
188
|
): Promise<void> {
|
|
162
|
-
const recordFailure = (
|
|
163
|
-
|
|
189
|
+
const recordFailure = (
|
|
190
|
+
failureKind: StructuredFailureKind,
|
|
191
|
+
reason: string,
|
|
192
|
+
errorRanges?: readonly SourceRange[],
|
|
193
|
+
) => {
|
|
194
|
+
failures.push({
|
|
195
|
+
file: relFile,
|
|
196
|
+
kind: failureKind,
|
|
197
|
+
reason,
|
|
198
|
+
...(errorRanges ? { errorRanges } : {}),
|
|
199
|
+
});
|
|
164
200
|
};
|
|
165
201
|
|
|
166
202
|
if (kind === "definition") {
|
|
@@ -168,7 +204,7 @@ async function collectMatchesForFile(
|
|
|
168
204
|
if (!handleStructuralResult(outline, recordFailure)) return;
|
|
169
205
|
for (const item of flattenOutlineItems(outline.data)) {
|
|
170
206
|
if (!matcher(item.name)) continue;
|
|
171
|
-
matches.push(
|
|
207
|
+
matches.push(outlineMatch(relFile, item));
|
|
172
208
|
}
|
|
173
209
|
return;
|
|
174
210
|
}
|
|
@@ -178,7 +214,15 @@ async function collectMatchesForFile(
|
|
|
178
214
|
if (!handleStructuralResult(exportsResult, recordFailure)) return;
|
|
179
215
|
for (const item of exportsResult.data) {
|
|
180
216
|
if (!matcher(item.name)) continue;
|
|
181
|
-
matches.push({
|
|
217
|
+
matches.push({
|
|
218
|
+
file: relFile,
|
|
219
|
+
name: item.name,
|
|
220
|
+
kind: item.kind,
|
|
221
|
+
line: item.startLine,
|
|
222
|
+
startCharacter: item.startCharacter,
|
|
223
|
+
endLine: item.endLine,
|
|
224
|
+
endCharacter: item.endCharacter,
|
|
225
|
+
});
|
|
182
226
|
}
|
|
183
227
|
return;
|
|
184
228
|
}
|
|
@@ -193,6 +237,9 @@ async function collectMatchesForFile(
|
|
|
193
237
|
name: item.moduleSpecifier,
|
|
194
238
|
kind: "import",
|
|
195
239
|
line: item.startLine,
|
|
240
|
+
startCharacter: item.startCharacter,
|
|
241
|
+
endLine: item.endLine,
|
|
242
|
+
endCharacter: item.endCharacter,
|
|
196
243
|
});
|
|
197
244
|
}
|
|
198
245
|
return;
|
|
@@ -203,7 +250,15 @@ async function collectMatchesForFile(
|
|
|
203
250
|
if (!handleStructuralResult(callResult, recordFailure)) return;
|
|
204
251
|
for (const call of callResult.data) {
|
|
205
252
|
if (!matcher(callableExpressionForMatching(call.name))) continue;
|
|
206
|
-
matches.push({
|
|
253
|
+
matches.push({
|
|
254
|
+
file: relFile,
|
|
255
|
+
name: call.name,
|
|
256
|
+
kind: "call",
|
|
257
|
+
line: call.startLine,
|
|
258
|
+
startCharacter: call.startCharacter,
|
|
259
|
+
endLine: call.endLine,
|
|
260
|
+
endCharacter: call.endCharacter,
|
|
261
|
+
});
|
|
207
262
|
}
|
|
208
263
|
return;
|
|
209
264
|
}
|
|
@@ -217,20 +272,43 @@ async function collectMatchesForFile(
|
|
|
217
272
|
if (kind === "method" && item.kind.toLowerCase() !== "method") continue;
|
|
218
273
|
if (kind === "enum" && item.kind.toLowerCase() !== "enum") continue;
|
|
219
274
|
if (!matcher(item.name)) continue;
|
|
220
|
-
matches.push(
|
|
275
|
+
matches.push(outlineMatch(relFile, item));
|
|
221
276
|
}
|
|
222
277
|
}
|
|
223
278
|
|
|
224
279
|
/** Flatten provider outlines so nested class/interface/enum declarations remain searchable. */
|
|
280
|
+
function outlineMatch(file: string, item: OutlineData): StructuredMatch {
|
|
281
|
+
return {
|
|
282
|
+
file,
|
|
283
|
+
name: item.name,
|
|
284
|
+
kind: item.nativeKind ?? item.kind,
|
|
285
|
+
...(item.nativeKind ? { commonKind: item.kind, nativeKind: item.nativeKind } : {}),
|
|
286
|
+
line: item.startLine,
|
|
287
|
+
startCharacter: item.startCharacter,
|
|
288
|
+
endLine: item.endLine,
|
|
289
|
+
endCharacter: item.endCharacter,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
|
|
225
293
|
function flattenOutlineItems(items: readonly OutlineData[]): OutlineData[] {
|
|
226
294
|
return items.flatMap((item) => [item, ...flattenOutlineItems(item.children ?? [])]);
|
|
227
295
|
}
|
|
228
296
|
|
|
297
|
+
type StructuralDataResult<T> = Extract<CodeResult<T>, { kind: "success" | "partial" }>;
|
|
298
|
+
|
|
229
299
|
function handleStructuralResult<T>(
|
|
230
300
|
result: CodeResult<T>,
|
|
231
|
-
recordFailure: (
|
|
232
|
-
|
|
301
|
+
recordFailure: (
|
|
302
|
+
kind: StructuredFailureKind,
|
|
303
|
+
reason: string,
|
|
304
|
+
errorRanges?: readonly SourceRange[],
|
|
305
|
+
) => void,
|
|
306
|
+
): result is StructuralDataResult<T> {
|
|
233
307
|
if (result.kind === "success") return true;
|
|
308
|
+
if (result.kind === "partial") {
|
|
309
|
+
recordFailure("partial", result.reason, result.errorRanges);
|
|
310
|
+
return true;
|
|
311
|
+
}
|
|
234
312
|
recordFailure(result.kind, result.message);
|
|
235
313
|
return false;
|
|
236
314
|
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { SourceRange } from "@mrclrchtr/supi-code-runtime/api";
|
|
2
|
+
|
|
3
|
+
export interface TargetDiscoveryResult<T> {
|
|
4
|
+
readonly available: boolean;
|
|
5
|
+
readonly targets: readonly T[];
|
|
6
|
+
readonly partial?: { readonly reason: string; readonly errorRanges: readonly SourceRange[] };
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Combine provider recovery without discarding structurally usable targets. */
|
|
10
|
+
export function mergeDiscoveryPartial(
|
|
11
|
+
semantic: TargetDiscoveryResult<unknown>,
|
|
12
|
+
structural: TargetDiscoveryResult<unknown>,
|
|
13
|
+
): { partial?: { reason: string; errorRanges: readonly SourceRange[] } } {
|
|
14
|
+
const partials = [semantic.partial, structural.partial].filter(
|
|
15
|
+
(partial): partial is NonNullable<TargetDiscoveryResult<unknown>["partial"]> =>
|
|
16
|
+
partial !== undefined,
|
|
17
|
+
);
|
|
18
|
+
if (partials.length === 0) return {};
|
|
19
|
+
const ranges = new Map<string, SourceRange>();
|
|
20
|
+
for (const partial of partials) {
|
|
21
|
+
for (const range of partial.errorRanges) ranges.set(JSON.stringify(range), range);
|
|
22
|
+
}
|
|
23
|
+
return {
|
|
24
|
+
partial: {
|
|
25
|
+
reason: partials.map((partial) => partial.reason).join(" "),
|
|
26
|
+
errorRanges: [...ranges.values()],
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
}
|
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
} from "@mrclrchtr/supi-code-runtime/api";
|
|
21
21
|
import type { AnchorKind } from "../../session/target-store.ts";
|
|
22
22
|
import { normalizePath } from "../search/paths.ts";
|
|
23
|
+
import { mergeDiscoveryPartial, type TargetDiscoveryResult } from "./discovery.ts";
|
|
23
24
|
import {
|
|
24
25
|
reconcileContainer,
|
|
25
26
|
reconcileNesting,
|
|
@@ -61,16 +62,13 @@ const BINARY_EXTENSIONS = new Set([
|
|
|
61
62
|
".node",
|
|
62
63
|
]);
|
|
63
64
|
|
|
65
|
+
type DiscoveryResult = TargetDiscoveryResult<DiscoveredTargetData>;
|
|
66
|
+
|
|
64
67
|
export interface DiscoveredTargetData extends ResolvedTargetData {
|
|
65
68
|
/** Provider-backed hierarchy used only for file-result presentation ranking. */
|
|
66
69
|
readonly nesting: DeclarationNesting;
|
|
67
70
|
}
|
|
68
71
|
|
|
69
|
-
interface DiscoveryResult {
|
|
70
|
-
readonly available: boolean;
|
|
71
|
-
readonly targets: DiscoveredTargetData[];
|
|
72
|
-
}
|
|
73
|
-
|
|
74
72
|
/** Validated file-discovery input with its normalized absolute path. */
|
|
75
73
|
export type FileDiscoveryValidation =
|
|
76
74
|
| { kind: "valid"; file: string }
|
|
@@ -130,6 +128,7 @@ export async function resolveFileTargetGroup(
|
|
|
130
128
|
discoveryProvenance,
|
|
131
129
|
confidence: targetGroupConfidence(targets, discoveryProvenance),
|
|
132
130
|
unknownNestingCount,
|
|
131
|
+
...mergeDiscoveryPartial(semantic, structural),
|
|
133
132
|
},
|
|
134
133
|
};
|
|
135
134
|
}
|
|
@@ -166,7 +165,7 @@ async function discoverSemantic(
|
|
|
166
165
|
): Promise<DiscoveryResult> {
|
|
167
166
|
if (!semantic) return { available: false, targets: [] };
|
|
168
167
|
try {
|
|
169
|
-
const result = await semantic.documentSymbols(file);
|
|
168
|
+
const result = await semantic.documentSymbols(file, control);
|
|
170
169
|
if (result.kind === "unavailable") return { available: false, targets: [] };
|
|
171
170
|
return {
|
|
172
171
|
available: true,
|
|
@@ -177,6 +176,7 @@ async function discoverSemantic(
|
|
|
177
176
|
return { ...refined, nesting: target.nesting };
|
|
178
177
|
}),
|
|
179
178
|
),
|
|
179
|
+
...(result.kind === "partial" ? { partial: { reason: result.reason, errorRanges: [] } } : {}),
|
|
180
180
|
};
|
|
181
181
|
} catch (error) {
|
|
182
182
|
if (isCodeRequestInterruption(error, control)) throw error;
|
|
@@ -218,9 +218,17 @@ async function discoverStructural(
|
|
|
218
218
|
): Promise<DiscoveryResult> {
|
|
219
219
|
if (!structural) return { available: false, targets: [] };
|
|
220
220
|
try {
|
|
221
|
-
const result = await structural.outline(file);
|
|
222
|
-
if (result.kind !== "success"
|
|
223
|
-
|
|
221
|
+
const result = await structural.outline(file, control);
|
|
222
|
+
if (result.kind !== "success" && result.kind !== "partial") {
|
|
223
|
+
return { available: false, targets: [] };
|
|
224
|
+
}
|
|
225
|
+
return {
|
|
226
|
+
available: true,
|
|
227
|
+
targets: flattenOutline(file, result.data),
|
|
228
|
+
...(result.kind === "partial"
|
|
229
|
+
? { partial: { reason: result.reason, errorRanges: result.errorRanges } }
|
|
230
|
+
: {}),
|
|
231
|
+
};
|
|
224
232
|
} catch (error) {
|
|
225
233
|
if (isCodeRequestInterruption(error, control)) throw error;
|
|
226
234
|
return { available: false, targets: [] };
|
|
@@ -247,6 +255,7 @@ function flattenOutline(
|
|
|
247
255
|
declarationOccurrence: 0,
|
|
248
256
|
name: item.name,
|
|
249
257
|
kind: item.kind,
|
|
258
|
+
...(item.nativeKind ? { nativeKind: item.nativeKind } : {}),
|
|
250
259
|
identityKind:
|
|
251
260
|
canonicalFileDeclarationKind(file, item.kind, item.name) ??
|
|
252
261
|
canonicalDeclarationKind(item.kind),
|
|
@@ -279,6 +288,7 @@ function mergeDiscoveries(
|
|
|
279
288
|
{
|
|
280
289
|
...refinedSemantic,
|
|
281
290
|
provenance: ["semantic", "structural"] as const,
|
|
291
|
+
nativeKind: structuralTarget.nativeKind ?? semanticTarget.nativeKind,
|
|
282
292
|
container: reconcileContainer(semanticTarget, structuralTarget),
|
|
283
293
|
nesting: reconcileNesting(semanticTarget.nesting, structuralTarget.nesting),
|
|
284
294
|
},
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
|
|
9
9
|
import type {
|
|
10
10
|
SemanticProvider as SemanticSubstrate,
|
|
11
|
+
SourceRange,
|
|
11
12
|
StructuralProvider as StructuralSubstrate,
|
|
12
13
|
} from "@mrclrchtr/supi-code-runtime/api";
|
|
13
14
|
import type { TargetSymbolKind } from "../../session/target-input.ts";
|
|
@@ -81,6 +82,8 @@ export interface ResolvedTargetData {
|
|
|
81
82
|
declarationOccurrence: number;
|
|
82
83
|
name: string | null;
|
|
83
84
|
kind: string | null;
|
|
85
|
+
/** Structural source-language declaration kind, separate from common identity kind. */
|
|
86
|
+
nativeKind?: string;
|
|
84
87
|
/** Evidence-backed provider-independent kind used for matching and handle identity. */
|
|
85
88
|
identityKind?: string;
|
|
86
89
|
confidence: "semantic" | "structural" | "heuristic" | "unavailable";
|
|
@@ -111,6 +114,8 @@ export interface ResolvedTargetGroupData {
|
|
|
111
114
|
confidence: "semantic" | "structural" | "heuristic" | "unavailable";
|
|
112
115
|
/** Complete-group declarations whose provider observations could not establish hierarchy. */
|
|
113
116
|
unknownNestingCount: number;
|
|
117
|
+
/** Partial provider collection; targets remain usable and exact absence is not claimed. */
|
|
118
|
+
partial?: { reason: string; errorRanges: readonly SourceRange[] };
|
|
114
119
|
}
|
|
115
120
|
|
|
116
121
|
/**
|
package/src/config.ts
CHANGED
|
@@ -2,9 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
|
|
4
4
|
import {
|
|
5
|
+
type CFamilyFileAssociationResolver,
|
|
6
|
+
createCFamilyFileAssociationResolver,
|
|
7
|
+
} from "@mrclrchtr/supi-code-runtime/api";
|
|
8
|
+
import {
|
|
9
|
+
getSupiConfigPath,
|
|
5
10
|
loadAutomaticExclusionPatterns,
|
|
6
11
|
loadSupiConfig,
|
|
7
12
|
loadSupiConfigForScope,
|
|
13
|
+
loadSupiConfigSectionForScope,
|
|
8
14
|
} from "@mrclrchtr/supi-core/config";
|
|
9
15
|
import {
|
|
10
16
|
defineConfigSettings,
|
|
@@ -46,16 +52,49 @@ export function loadCodeIntelligenceConfig(
|
|
|
46
52
|
return loaded;
|
|
47
53
|
}
|
|
48
54
|
|
|
55
|
+
/**
|
|
56
|
+
* Load C-family associations from trusted project configuration only.
|
|
57
|
+
*
|
|
58
|
+
* `fileAssociations` is an ordered array of `{ pattern, language }` rules.
|
|
59
|
+
* Patterns are case-sensitive globs. Use `*`, `?`, `**`, character classes,
|
|
60
|
+
* and brace alternatives. Patterns
|
|
61
|
+
* match POSIX-style paths relative to the workspace root. The first match
|
|
62
|
+
* wins. A rule accepts
|
|
63
|
+
* only `c` or `cpp` and only changes an existing C-family suffix. Global
|
|
64
|
+
* values do not apply. An untrusted project returns the default mapping
|
|
65
|
+
* without reading its configuration. The workspace host keeps this resolver
|
|
66
|
+
* until its last provider lease ends.
|
|
67
|
+
*
|
|
68
|
+
* @throws If a trusted project rule is invalid.
|
|
69
|
+
*/
|
|
70
|
+
export function loadProjectFileAssociations(
|
|
71
|
+
cwd: string,
|
|
72
|
+
projectTrusted: boolean,
|
|
73
|
+
): CFamilyFileAssociationResolver {
|
|
74
|
+
if (!projectTrusted) return createCFamilyFileAssociationResolver(cwd);
|
|
75
|
+
const section = loadSupiConfigSectionForScope("code-intelligence", cwd, {
|
|
76
|
+
scope: "project",
|
|
77
|
+
});
|
|
78
|
+
if (!section || !Object.hasOwn(section, "fileAssociations")) {
|
|
79
|
+
return createCFamilyFileAssociationResolver(cwd);
|
|
80
|
+
}
|
|
81
|
+
try {
|
|
82
|
+
return createCFamilyFileAssociationResolver(cwd, section.fileAssociations);
|
|
83
|
+
} catch (error) {
|
|
84
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
85
|
+
throw new Error(
|
|
86
|
+
`Invalid trusted project configuration in ${getSupiConfigPath("project", cwd)}: ${detail}`,
|
|
87
|
+
{ cause: error },
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
49
92
|
/**
|
|
50
93
|
* Resolve the overview setting for one session boundary.
|
|
51
94
|
*
|
|
52
|
-
* Project-scoped values apply only when the project is trusted
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
* values, fails closed. Unreadable or invalid config files and non-object
|
|
56
|
-
* sections fall back to defaults through the shared supi-core loader, the
|
|
57
|
-
* same semantics every other SuPi setting uses; fail-closed covers values
|
|
58
|
-
* inside a well-formed section.
|
|
95
|
+
* Project-scoped values apply only when the project is trusted. Only a strict
|
|
96
|
+
* boolean `true` enables injection; malformed values fail closed. Unreadable
|
|
97
|
+
* files and non-object sections use the shared config-loader defaults.
|
|
59
98
|
*/
|
|
60
99
|
export function resolveOverviewEnabled(
|
|
61
100
|
cwd: string,
|
|
@@ -156,7 +156,7 @@ async function collectCalleesRelation(options: CollectRelationOptions): Promise<
|
|
|
156
156
|
return {
|
|
157
157
|
kind: "ok",
|
|
158
158
|
rel: "callees",
|
|
159
|
-
data: { enclosingScope, calls, depth: result.depth },
|
|
159
|
+
data: { enclosingScope, calls, depth: result.depth, recovery: result.partial },
|
|
160
160
|
readNext: [
|
|
161
161
|
readNextEnclosingScope(
|
|
162
162
|
toDisplayPath(options.cwd, options.file),
|
|
@@ -187,7 +187,7 @@ async function collectImplementationsRelation(
|
|
|
187
187
|
},
|
|
188
188
|
});
|
|
189
189
|
if (result.confidence === "unavailable") {
|
|
190
|
-
return { kind: "unavailable", rel: "implements", message:
|
|
190
|
+
return { kind: "unavailable", rel: "implements", message: result.message };
|
|
191
191
|
}
|
|
192
192
|
|
|
193
193
|
return {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { SourceRange } from "@mrclrchtr/supi-code-runtime/api";
|
|
1
2
|
import type { ReadNextItem } from "../analysis/read-next.ts";
|
|
2
3
|
import type { RelationLocationPartialReason } from "../analysis/relations/provider-locations.ts";
|
|
3
4
|
import type {
|
|
@@ -42,6 +43,11 @@ export type GraphSection =
|
|
|
42
43
|
readonly enclosingScope: CalleeScope;
|
|
43
44
|
readonly calls: readonly CallEntry[];
|
|
44
45
|
readonly depth: "direct" | "deep";
|
|
46
|
+
readonly recovery: {
|
|
47
|
+
readonly file: string;
|
|
48
|
+
readonly reason: string;
|
|
49
|
+
readonly errorRanges: readonly SourceRange[];
|
|
50
|
+
} | null;
|
|
45
51
|
};
|
|
46
52
|
readonly readNext: readonly ReadNextItem[];
|
|
47
53
|
}
|