@mrclrchtr/supi-code-intelligence 4.4.0 → 4.5.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 +84 -219
- package/node_modules/@mrclrchtr/supi-code-runtime/README.md +6 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/README.md +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-core/README.md +1 -1
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/README.md +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/README.md +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/README.md +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/README.md +1 -1
- 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/client/client-refresh.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +6 -6
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/README.md +6 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/README.md +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/README.md +1 -1
- 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/package.json +9 -8
- package/src/extension.ts +2 -2
- package/src/{ui/markdown → overview}/overview-data.ts +1 -1
- package/src/overview/types.ts +21 -0
- package/src/session/orientation/collect.ts +39 -26
- package/src/{ui/markdown → session/orientation}/gather.ts +44 -24
- package/src/session/orientation-types.ts +23 -0
- package/src/session/orientation-workflow.ts +1 -11
- package/src/types/execution.ts +1 -1
- package/src/types/index.ts +1 -1
- package/src/types/details.ts +0 -18
- package/src/ui/markdown/types.ts +0 -75
- /package/src/{ui/markdown → overview}/overview.ts +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<a href="https://github.com/mrclrchtr/supi/tree/main/packages/supi-core">
|
|
3
3
|
<picture>
|
|
4
|
-
<img src="https://raw.githubusercontent.com/mrclrchtr/supi/main/packages/supi-core/assets/
|
|
4
|
+
<img src="https://raw.githubusercontent.com/mrclrchtr/supi/main/packages/supi-core/assets/social-preview.png" alt="SuPi Core" width="100%">
|
|
5
5
|
</picture>
|
|
6
6
|
</a>
|
|
7
7
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrclrchtr/supi-code-runtime",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.1",
|
|
4
4
|
"description": "SuPi code-runtime — shared workspace context, capability contracts, and canonical types for the code-understanding stack",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"!__tests__"
|
|
30
30
|
],
|
|
31
31
|
"dependencies": {
|
|
32
|
-
"@mrclrchtr/supi-core": "4.
|
|
32
|
+
"@mrclrchtr/supi-core": "4.5.1"
|
|
33
33
|
},
|
|
34
34
|
"bundledDependencies": [
|
|
35
35
|
"@mrclrchtr/supi-core"
|
package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
<div align="center">
|
|
2
2
|
<a href="https://github.com/mrclrchtr/supi/tree/main/packages/supi-core">
|
|
3
3
|
<picture>
|
|
4
|
-
<img src="https://raw.githubusercontent.com/mrclrchtr/supi/main/packages/supi-core/assets/
|
|
4
|
+
<img src="https://raw.githubusercontent.com/mrclrchtr/supi/main/packages/supi-core/assets/social-preview.png" alt="SuPi Core" width="100%">
|
|
5
5
|
</picture>
|
|
6
6
|
</a>
|
|
7
7
|
</div>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrclrchtr/supi-tree-sitter",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.5.1",
|
|
4
4
|
"description": "SuPi Tree-sitter library — structural AST analysis for pi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -34,8 +34,8 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"web-tree-sitter": "^0.26.8",
|
|
37
|
-
"@mrclrchtr/supi-code-runtime": "4.
|
|
38
|
-
"@mrclrchtr/supi-core": "4.
|
|
37
|
+
"@mrclrchtr/supi-code-runtime": "4.5.1",
|
|
38
|
+
"@mrclrchtr/supi-core": "4.5.1"
|
|
39
39
|
},
|
|
40
40
|
"bundledDependencies": [
|
|
41
41
|
"@mrclrchtr/supi-code-runtime",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrclrchtr/supi-code-intelligence",
|
|
3
|
-
"version": "4.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "4.5.1",
|
|
4
|
+
"description": "LSP and Tree-sitter AST code intelligence for the Pi coding agent — semantic navigation, structural search, diagnostics, and safe refactoring",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
7
7
|
"type": "git",
|
|
@@ -26,7 +26,8 @@
|
|
|
26
26
|
"impact-analysis",
|
|
27
27
|
"refactoring",
|
|
28
28
|
"lsp",
|
|
29
|
-
"tree-sitter"
|
|
29
|
+
"tree-sitter",
|
|
30
|
+
"ast"
|
|
30
31
|
],
|
|
31
32
|
"type": "module",
|
|
32
33
|
"files": [
|
|
@@ -34,10 +35,10 @@
|
|
|
34
35
|
],
|
|
35
36
|
"dependencies": {
|
|
36
37
|
"yaml": "^2.9.0",
|
|
37
|
-
"@mrclrchtr/supi-
|
|
38
|
-
"@mrclrchtr/supi-
|
|
39
|
-
"@mrclrchtr/supi-
|
|
40
|
-
"@mrclrchtr/supi-
|
|
38
|
+
"@mrclrchtr/supi-core": "4.5.1",
|
|
39
|
+
"@mrclrchtr/supi-lsp": "4.5.1",
|
|
40
|
+
"@mrclrchtr/supi-code-runtime": "4.5.1",
|
|
41
|
+
"@mrclrchtr/supi-tree-sitter": "4.5.1"
|
|
41
42
|
},
|
|
42
43
|
"bundledDependencies": [
|
|
43
44
|
"@mrclrchtr/supi-code-runtime",
|
|
@@ -70,7 +71,7 @@
|
|
|
70
71
|
"extensions": [
|
|
71
72
|
"./src/extension.ts"
|
|
72
73
|
],
|
|
73
|
-
"image": "https://raw.githubusercontent.com/mrclrchtr/supi/main/
|
|
74
|
+
"image": "https://raw.githubusercontent.com/mrclrchtr/supi/main/packages/supi-code-intelligence/assets/social-preview.png"
|
|
74
75
|
},
|
|
75
76
|
"main": "src/index.ts",
|
|
76
77
|
"exports": {
|
package/src/extension.ts
CHANGED
|
@@ -5,6 +5,8 @@ import type { BeforeAgentStartEventResult, ExtensionAPI } from "@earendil-works/
|
|
|
5
5
|
import { buildArchitectureModel } from "./analysis/architecture/discovery.ts";
|
|
6
6
|
import { createCodeIntelligenceApp } from "./app/app.ts";
|
|
7
7
|
import { registerCodeIntelligenceSettings } from "./config.ts";
|
|
8
|
+
import { estimateTokens, OVERVIEW_TOKEN_BUDGET, renderOverview } from "./overview/overview.ts";
|
|
9
|
+
import { buildOverviewData } from "./overview/overview-data.ts";
|
|
8
10
|
import type { WorkspaceCodeIntelligenceSession } from "./session/session.ts";
|
|
9
11
|
import { registerLspSessionLifecycle } from "./substrate/lsp/lifecycle.ts";
|
|
10
12
|
import { registerWorkspaceRecoveryHandler } from "./substrate/lsp/recovery.ts";
|
|
@@ -12,8 +14,6 @@ import { registerLspSettings } from "./substrate/lsp/settings.ts";
|
|
|
12
14
|
import { createLspAdapterState } from "./substrate/lsp/state.ts";
|
|
13
15
|
import { registerCodeIntelligenceTools } from "./tool/register.ts";
|
|
14
16
|
import { registerLspFooterContribution } from "./ui/footer.ts";
|
|
15
|
-
import { estimateTokens, OVERVIEW_TOKEN_BUDGET, renderOverview } from "./ui/markdown/overview.ts";
|
|
16
|
-
import { buildOverviewData } from "./ui/markdown/overview-data.ts";
|
|
17
17
|
import { registerCiStatusCommand } from "./ui/status-command.ts";
|
|
18
18
|
|
|
19
19
|
const OVERVIEW_CUSTOM_TYPE = "code-intelligence-overview";
|
|
@@ -7,7 +7,7 @@ import type {
|
|
|
7
7
|
ArchitectureModel,
|
|
8
8
|
ManifestField,
|
|
9
9
|
ModuleInfo,
|
|
10
|
-
} from "
|
|
10
|
+
} from "../analysis/architecture/model.ts";
|
|
11
11
|
import type { OverviewData, OverviewModule } from "./types.ts";
|
|
12
12
|
|
|
13
13
|
/** Grammar ID to short language tag for the overview. */
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/** Use-case data for the workspace architecture overview. */
|
|
2
|
+
|
|
3
|
+
/** One discovered workspace package and its manifest-declared surface. */
|
|
4
|
+
export interface OverviewModule {
|
|
5
|
+
name: string;
|
|
6
|
+
shortName: string;
|
|
7
|
+
description: string | null;
|
|
8
|
+
/** Manifest-declared package relationships to other discovered packages. */
|
|
9
|
+
declaredDependencies: string[];
|
|
10
|
+
/** Field-labelled manifest path declarations, never selected by precedence. */
|
|
11
|
+
declaredEntrypoints: string[];
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/** Project-level overview data rendered by the overview markdown adapter. */
|
|
15
|
+
export interface OverviewData {
|
|
16
|
+
projectName: string | null;
|
|
17
|
+
projectDescription: string | null;
|
|
18
|
+
modules: OverviewModule[];
|
|
19
|
+
/** Detected source languages (e.g. ["ts", "js", "py"]). */
|
|
20
|
+
detectedLanguages: string[] | null;
|
|
21
|
+
}
|
|
@@ -15,19 +15,17 @@ import {
|
|
|
15
15
|
readNextTarget,
|
|
16
16
|
} from "../../analysis/read-next.ts";
|
|
17
17
|
import { diagnosticMessageString } from "../../substrate/lsp/utils.ts";
|
|
18
|
-
import { gatherTreeSitterContext } from "../../ui/markdown/gather.ts";
|
|
19
18
|
import type {
|
|
20
19
|
OrientationDeps,
|
|
21
20
|
OrientationInput,
|
|
22
|
-
OrientationSection,
|
|
23
|
-
OrientationTarget,
|
|
24
|
-
} from "../../ui/markdown/types.ts";
|
|
25
|
-
import type {
|
|
26
21
|
OrientationItem,
|
|
27
22
|
OrientationResultData,
|
|
23
|
+
OrientationSection,
|
|
28
24
|
OrientationSectionData,
|
|
29
25
|
} from "../orientation-types.ts";
|
|
26
|
+
import type { TargetStoreEntry } from "../target-store.ts";
|
|
30
27
|
import { collectContextOrientationFacts } from "./context-facts.ts";
|
|
28
|
+
import { gatherSubstrateContext } from "./gather.ts";
|
|
31
29
|
|
|
32
30
|
interface TargetSectionCollection {
|
|
33
31
|
readonly items: OrientationItem[];
|
|
@@ -126,7 +124,7 @@ async function executeTargetOrientation(
|
|
|
126
124
|
|
|
127
125
|
async function buildRequestedSection(options: {
|
|
128
126
|
section: OrientationSection;
|
|
129
|
-
target:
|
|
127
|
+
target: Readonly<TargetStoreEntry> | null | undefined;
|
|
130
128
|
deps: OrientationDeps;
|
|
131
129
|
limit: number;
|
|
132
130
|
treeContext: Awaited<ReturnType<typeof maybeGatherTreeContext>>;
|
|
@@ -159,7 +157,7 @@ async function buildRequestedSection(options: {
|
|
|
159
157
|
|
|
160
158
|
/** Build enriched defs section: tree-sitter definitions + LSP definition targets. */
|
|
161
159
|
async function buildEnrichedDefsSection(
|
|
162
|
-
target:
|
|
160
|
+
target: Readonly<TargetStoreEntry> | null | undefined,
|
|
163
161
|
deps: OrientationDeps,
|
|
164
162
|
treeContext: Awaited<ReturnType<typeof maybeGatherTreeContext>>,
|
|
165
163
|
limit: number,
|
|
@@ -206,7 +204,7 @@ async function buildEnrichedDefsSection(
|
|
|
206
204
|
}
|
|
207
205
|
|
|
208
206
|
async function collectDefinitionTargets(
|
|
209
|
-
target:
|
|
207
|
+
target: Readonly<TargetStoreEntry>,
|
|
210
208
|
deps: OrientationDeps,
|
|
211
209
|
limit: number,
|
|
212
210
|
): Promise<
|
|
@@ -226,8 +224,8 @@ async function collectDefinitionTargets(
|
|
|
226
224
|
}
|
|
227
225
|
try {
|
|
228
226
|
const result = await deps.provider.definition(target.file, {
|
|
229
|
-
line: target.
|
|
230
|
-
character: target.
|
|
227
|
+
line: target.displayLine - 1,
|
|
228
|
+
character: target.displayCharacter - 1,
|
|
231
229
|
});
|
|
232
230
|
if (result.kind === "unavailable") {
|
|
233
231
|
return {
|
|
@@ -275,7 +273,7 @@ async function collectDefinitionTargets(
|
|
|
275
273
|
}
|
|
276
274
|
|
|
277
275
|
async function buildDiagnosticsSection(
|
|
278
|
-
target:
|
|
276
|
+
target: Readonly<TargetStoreEntry> | null | undefined,
|
|
279
277
|
deps: OrientationDeps,
|
|
280
278
|
limit: number,
|
|
281
279
|
): Promise<TargetSectionCollection> {
|
|
@@ -306,7 +304,7 @@ async function buildDiagnosticsSection(
|
|
|
306
304
|
);
|
|
307
305
|
}
|
|
308
306
|
const nearby = result.data.filter(
|
|
309
|
-
(diagnostic) => Math.abs((diagnostic.range.start.line ?? 0) + 1 - target.
|
|
307
|
+
(diagnostic) => Math.abs((diagnostic.range.start.line ?? 0) + 1 - target.displayLine) <= 5,
|
|
310
308
|
);
|
|
311
309
|
const evidence =
|
|
312
310
|
result.kind === "partial"
|
|
@@ -380,7 +378,7 @@ function unavailableTargetSection(
|
|
|
380
378
|
|
|
381
379
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: JSDoc parsing naturally has state-machine complexity
|
|
382
380
|
async function buildDocsSection(
|
|
383
|
-
target:
|
|
381
|
+
target: Readonly<TargetStoreEntry> | null | undefined,
|
|
384
382
|
deps: OrientationDeps,
|
|
385
383
|
limit: number,
|
|
386
384
|
): Promise<TargetSectionCollection> {
|
|
@@ -404,7 +402,7 @@ async function buildDocsSection(
|
|
|
404
402
|
try {
|
|
405
403
|
const content = readFileSync(targetFile, "utf-8");
|
|
406
404
|
const lines = content.split("\n");
|
|
407
|
-
const startIdx = Math.max(0, target.
|
|
405
|
+
const startIdx = Math.max(0, target.displayLine - 2);
|
|
408
406
|
let jsdocStart = -1;
|
|
409
407
|
let jsdocEnd = -1;
|
|
410
408
|
|
|
@@ -483,16 +481,22 @@ async function buildDocsSection(
|
|
|
483
481
|
}
|
|
484
482
|
|
|
485
483
|
async function maybeGatherTreeContext(
|
|
486
|
-
target:
|
|
484
|
+
target: Readonly<TargetStoreEntry> | null | undefined,
|
|
487
485
|
deps: OrientationDeps,
|
|
488
486
|
) {
|
|
489
487
|
if (!target) return null;
|
|
490
488
|
const relPath = path.relative(deps.cwd, target.file);
|
|
491
|
-
return
|
|
489
|
+
return gatherSubstrateContext(
|
|
490
|
+
deps.provider,
|
|
491
|
+
relPath,
|
|
492
|
+
target.displayLine,
|
|
493
|
+
target.displayCharacter,
|
|
494
|
+
target.anchorKind !== "declaration",
|
|
495
|
+
);
|
|
492
496
|
}
|
|
493
497
|
|
|
494
498
|
function buildDefinitionItems(
|
|
495
|
-
target:
|
|
499
|
+
target: Readonly<TargetStoreEntry> | null | undefined,
|
|
496
500
|
cwd: string,
|
|
497
501
|
treeContext: Awaited<ReturnType<typeof maybeGatherTreeContext>>,
|
|
498
502
|
): OrientationItem[] {
|
|
@@ -507,6 +511,12 @@ function buildDefinitionItems(
|
|
|
507
511
|
text: `Symbol: \`${target.name}\`${target.kind ? ` (${target.kind})` : ""}`,
|
|
508
512
|
});
|
|
509
513
|
}
|
|
514
|
+
if (target.anchorKind === "declaration") {
|
|
515
|
+
items.push({
|
|
516
|
+
kind: "paragraph",
|
|
517
|
+
text: "Node and hover evidence withheld: this target has a declaration anchor, and position-strict substrates require a name anchor (ADR 0003).",
|
|
518
|
+
});
|
|
519
|
+
}
|
|
510
520
|
if (treeContext?.nodeInfo?.type) {
|
|
511
521
|
items.push({ kind: "list-item", text: `Node: \`${treeContext.nodeInfo.type}\`` });
|
|
512
522
|
}
|
|
@@ -593,22 +603,25 @@ function hoverBodyItems(lines: readonly string[]): OrientationItem[] {
|
|
|
593
603
|
return items;
|
|
594
604
|
}
|
|
595
605
|
|
|
596
|
-
function formatFocusTarget(target:
|
|
606
|
+
function formatFocusTarget(target: Readonly<TargetStoreEntry>, cwd: string): string {
|
|
597
607
|
const relPath = path.relative(cwd, target.file) || target.file;
|
|
598
|
-
return `${relPath}:${target.
|
|
608
|
+
return `${relPath}:${target.displayLine}:${target.displayCharacter}`;
|
|
599
609
|
}
|
|
600
610
|
|
|
601
|
-
function buildNextQueries(
|
|
611
|
+
function buildNextQueries(
|
|
612
|
+
target: Readonly<TargetStoreEntry> | null | undefined,
|
|
613
|
+
cwd: string,
|
|
614
|
+
): string[] {
|
|
602
615
|
if (!target) return ["Use `code_orientation` for a neutral orientation summary."];
|
|
603
616
|
|
|
604
617
|
const relPath = path.relative(cwd, target.file) || target.file;
|
|
605
618
|
return [
|
|
606
|
-
`\`code_graph\` with \`target: { anchor: { file: "${relPath}", line: ${target.
|
|
619
|
+
`\`code_graph\` with \`target: { anchor: { file: "${relPath}", line: ${target.displayLine}, character: ${target.displayCharacter} } }\` for relation follow-up`,
|
|
607
620
|
];
|
|
608
621
|
}
|
|
609
622
|
|
|
610
623
|
function buildReadNextGuidance(
|
|
611
|
-
target:
|
|
624
|
+
target: Readonly<TargetStoreEntry> | null | undefined,
|
|
612
625
|
treeContext: Awaited<ReturnType<typeof maybeGatherTreeContext>>,
|
|
613
626
|
cwd: string,
|
|
614
627
|
): ReadNextItem[] {
|
|
@@ -616,18 +629,18 @@ function buildReadNextGuidance(
|
|
|
616
629
|
const relPath = path.relative(cwd, target.file) || target.file;
|
|
617
630
|
const enclosing = findEnclosingOutlineItem(target, treeContext);
|
|
618
631
|
if (enclosing) {
|
|
619
|
-
return [readNextEnclosingScope(relPath, enclosing, target.
|
|
632
|
+
return [readNextEnclosingScope(relPath, enclosing, target.displayLine)];
|
|
620
633
|
}
|
|
621
|
-
return [readNextTarget(relPath, target.
|
|
634
|
+
return [readNextTarget(relPath, target.displayLine, "inspect the target implementation")];
|
|
622
635
|
}
|
|
623
636
|
|
|
624
637
|
function findEnclosingOutlineItem(
|
|
625
|
-
target:
|
|
638
|
+
target: Readonly<TargetStoreEntry>,
|
|
626
639
|
treeContext: Awaited<ReturnType<typeof maybeGatherTreeContext>>,
|
|
627
640
|
): { name: string; kind: string; startLine: number; endLine: number } | null {
|
|
628
641
|
if (!treeContext || treeContext.outline.length === 0) return null;
|
|
629
642
|
const candidates = treeContext.outline.filter(
|
|
630
|
-
(item) => item.startLine <= target.
|
|
643
|
+
(item) => item.startLine <= target.displayLine && item.endLine >= target.displayLine,
|
|
631
644
|
);
|
|
632
645
|
if (candidates.length === 0) return null;
|
|
633
646
|
const matchingName = candidates.find((item) => target.name && item.name === target.name);
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Substrate context gathering for symbol
|
|
2
|
+
* Substrate context gathering for symbol-centered Orientation.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Best-effort tree-sitter node/outline/imports/exports context plus LSP
|
|
5
|
+
* hover/definition at one target position. Consumed by the Orientation
|
|
6
|
+
* evidence collector in `collect.ts`.
|
|
6
7
|
*/
|
|
7
8
|
|
|
8
9
|
import type {
|
|
@@ -11,13 +12,18 @@ import type {
|
|
|
11
12
|
StructuralProvider,
|
|
12
13
|
} from "@mrclrchtr/supi-code-runtime/api";
|
|
13
14
|
|
|
15
|
+
/** Structural provider subset plus optional semantic hover/definition used for gathering. */
|
|
14
16
|
export type ContextGatherProvider = Pick<
|
|
15
17
|
StructuralProvider,
|
|
16
18
|
"nodeAt" | "outline" | "imports" | "exports"
|
|
17
19
|
> &
|
|
18
20
|
Partial<Pick<SemanticProvider, "hover" | "definition">>;
|
|
19
21
|
|
|
20
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Best-effort substrate evidence at one target position. `null` fields mean
|
|
24
|
+
* the evidence was unavailable, not that the position is invalid.
|
|
25
|
+
*/
|
|
26
|
+
export interface SubstrateContext {
|
|
21
27
|
nodeInfo: {
|
|
22
28
|
type: string;
|
|
23
29
|
text: string;
|
|
@@ -40,32 +46,46 @@ export interface TreeSitterContext {
|
|
|
40
46
|
definition: Array<{ uri: string; range: SourceRange }> | null;
|
|
41
47
|
}
|
|
42
48
|
|
|
49
|
+
/**
|
|
50
|
+
* Gather best-effort substrate context at one target position.
|
|
51
|
+
*
|
|
52
|
+
* `line`/`character` are 1-based display coordinates; LSP hover/definition
|
|
53
|
+
* queries convert to 0-based internally. Position-strict operations
|
|
54
|
+
* (tree-sitter `nodeAt`, hover-at) run only when `positionStrict` is true —
|
|
55
|
+
* callers holding a declaration-anchor target must pass false (ADR 0003).
|
|
56
|
+
* File-level evidence (outline, imports, exports) and position-tolerant
|
|
57
|
+
* definition lookups run regardless. Failures degrade to `null`/empty.
|
|
58
|
+
*/
|
|
43
59
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: best-effort substrate gathering with independent try/catch blocks kept together for readability
|
|
44
|
-
|
|
60
|
+
// biome-ignore lint/complexity/useMaxParams: one internal gather call site carries the full position context
|
|
61
|
+
export async function gatherSubstrateContext(
|
|
45
62
|
provider: ContextGatherProvider | null,
|
|
46
63
|
relPath: string,
|
|
47
64
|
line: number,
|
|
48
65
|
character: number,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
let
|
|
52
|
-
let
|
|
53
|
-
let
|
|
54
|
-
let
|
|
55
|
-
let
|
|
66
|
+
positionStrict: boolean,
|
|
67
|
+
): Promise<SubstrateContext> {
|
|
68
|
+
let nodeInfo: SubstrateContext["nodeInfo"] = null;
|
|
69
|
+
let outline: SubstrateContext["outline"] = [];
|
|
70
|
+
let imports: SubstrateContext["imports"] = [];
|
|
71
|
+
let exports: SubstrateContext["exports"] = [];
|
|
72
|
+
let hover: SubstrateContext["hover"] = null;
|
|
73
|
+
let definition: SubstrateContext["definition"] = null;
|
|
56
74
|
|
|
57
75
|
if (!provider) return { nodeInfo, outline, imports, exports, hover, definition: null };
|
|
58
76
|
|
|
59
77
|
try {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
78
|
+
if (positionStrict) {
|
|
79
|
+
const nodeResult = await provider.nodeAt(relPath, line, character);
|
|
80
|
+
if (nodeResult.kind === "success") {
|
|
81
|
+
nodeInfo = {
|
|
82
|
+
type: nodeResult.data.type,
|
|
83
|
+
text: nodeResult.data.text,
|
|
84
|
+
startLine: nodeResult.data.startLine,
|
|
85
|
+
startCharacter: nodeResult.data.startCharacter,
|
|
86
|
+
ancestry: nodeResult.data.ancestry ?? [],
|
|
87
|
+
};
|
|
88
|
+
}
|
|
69
89
|
}
|
|
70
90
|
|
|
71
91
|
const outlineResult = await provider.outline(relPath);
|
|
@@ -91,8 +111,8 @@ export async function gatherTreeSitterContext(
|
|
|
91
111
|
}));
|
|
92
112
|
}
|
|
93
113
|
|
|
94
|
-
// Best-effort hover — LSP expects 0-based coordinates
|
|
95
|
-
if (provider.hover) {
|
|
114
|
+
// Best-effort hover — LSP expects 0-based coordinates; hover-at is position-strict.
|
|
115
|
+
if (positionStrict && provider.hover) {
|
|
96
116
|
try {
|
|
97
117
|
const hoverResult = await provider.hover(relPath, {
|
|
98
118
|
line: line - 1,
|
|
@@ -104,7 +124,7 @@ export async function gatherTreeSitterContext(
|
|
|
104
124
|
}
|
|
105
125
|
}
|
|
106
126
|
|
|
107
|
-
// Best-effort definition — LSP expects 0-based coordinates
|
|
127
|
+
// Best-effort definition — LSP expects 0-based coordinates; definitions are position-tolerant.
|
|
108
128
|
if (provider.definition) {
|
|
109
129
|
try {
|
|
110
130
|
const defResult = await provider.definition(relPath, {
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import type { ConfidenceMode } from "@mrclrchtr/supi-code-runtime/api";
|
|
2
|
+
import type { WorkspaceLspRuntimeState } from "@mrclrchtr/supi-lsp/api";
|
|
3
|
+
import type { ArchitectureModel } from "../analysis/architecture/model.ts";
|
|
2
4
|
import type { EvidenceListMetadata } from "../analysis/evidence.ts";
|
|
3
5
|
import type { InstructionFilesMetadata } from "../analysis/instruction-files.ts";
|
|
6
|
+
import type { CodeProvider } from "../analysis/provider.ts";
|
|
4
7
|
import type { ReadNextItem } from "../analysis/read-next.ts";
|
|
5
8
|
import type { OrientationTargetInput, TargetSymbolKind } from "./target-input.ts";
|
|
6
9
|
import type { AnchorKind, TargetStoreEntry } from "./target-store.ts";
|
|
@@ -16,6 +19,26 @@ export interface OrientationWorkflowInput {
|
|
|
16
19
|
readonly maxResults?: number;
|
|
17
20
|
}
|
|
18
21
|
|
|
22
|
+
/** Section keys the Orientation evidence collector gathers for a precise target. */
|
|
23
|
+
export type OrientationSection = "defs" | "docs" | "diagnostics";
|
|
24
|
+
|
|
25
|
+
/** Input to the Orientation evidence collector. */
|
|
26
|
+
export interface OrientationInput {
|
|
27
|
+
/** Resolved target entry, consumed read-only; absent for context orientation. */
|
|
28
|
+
target?: Readonly<TargetStoreEntry> | null;
|
|
29
|
+
/** Resolved orientation focus path for project/module/directory/file orientation. */
|
|
30
|
+
focus?: string;
|
|
31
|
+
maxResults?: number;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Capabilities the Orientation evidence collector requires. */
|
|
35
|
+
export interface OrientationDeps {
|
|
36
|
+
readonly model: ArchitectureModel;
|
|
37
|
+
readonly provider: CodeProvider | null;
|
|
38
|
+
readonly cwd: string;
|
|
39
|
+
readonly lspRuntime: WorkspaceLspRuntimeState;
|
|
40
|
+
}
|
|
41
|
+
|
|
19
42
|
/**
|
|
20
43
|
* Presentation-neutral content atom a collector emits for one Orientation
|
|
21
44
|
* section. Collectors never build headings, section notes, or document
|
|
@@ -148,17 +148,7 @@ async function orientTarget(options: {
|
|
|
148
148
|
reason: readiness.kind === "timeout" ? "Semantic readiness timed out" : readiness.reason,
|
|
149
149
|
};
|
|
150
150
|
const result = await executeOrientation(
|
|
151
|
-
{
|
|
152
|
-
target: {
|
|
153
|
-
file: entry.file,
|
|
154
|
-
line: entry.displayLine,
|
|
155
|
-
character: entry.displayCharacter,
|
|
156
|
-
name: entry.name,
|
|
157
|
-
kind: entry.kind,
|
|
158
|
-
anchorKind: entry.anchorKind,
|
|
159
|
-
},
|
|
160
|
-
maxResults,
|
|
161
|
-
},
|
|
151
|
+
{ target: entry, maxResults },
|
|
162
152
|
{
|
|
163
153
|
model,
|
|
164
154
|
provider,
|
package/src/types/execution.ts
CHANGED
package/src/types/index.ts
CHANGED
package/src/types/details.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Compatibility export for tool-result detail shapes.
|
|
3
|
-
*
|
|
4
|
-
* Public code-intelligence details are assembled in `src/tool/result/`.
|
|
5
|
-
* Import new result assembly code from `../tool/result/types.ts` directly.
|
|
6
|
-
*/
|
|
7
|
-
export type {
|
|
8
|
-
AnchoredResolutionMetadata,
|
|
9
|
-
AnchoredResolutionSource,
|
|
10
|
-
ContextDetails,
|
|
11
|
-
DisambiguationCandidate,
|
|
12
|
-
HealthDetails,
|
|
13
|
-
HealthSectionDetails,
|
|
14
|
-
InspectDetails,
|
|
15
|
-
OrientationSectionDetails,
|
|
16
|
-
ResolveDetails,
|
|
17
|
-
SearchDetails,
|
|
18
|
-
} from "../tool/result/types.ts";
|
package/src/ui/markdown/types.ts
DELETED
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
// Shared typed data interfaces between use-case and presentation layers.
|
|
2
|
-
|
|
3
|
-
import type { WorkspaceLspRuntimeState } from "@mrclrchtr/supi-lsp/api";
|
|
4
|
-
import type { ArchitectureModel } from "../../analysis/architecture/model.ts";
|
|
5
|
-
import type { CodeProvider } from "../../analysis/provider.ts";
|
|
6
|
-
import type { AnchorKind } from "../../session/target-store.ts";
|
|
7
|
-
import type { InspectDetails } from "../../types/details.ts";
|
|
8
|
-
|
|
9
|
-
// ── Overview use-case ───────────────────────────────────────────────
|
|
10
|
-
|
|
11
|
-
export interface OverviewModule {
|
|
12
|
-
name: string;
|
|
13
|
-
shortName: string;
|
|
14
|
-
description: string | null;
|
|
15
|
-
/** Manifest-declared package relationships to other discovered packages. */
|
|
16
|
-
declaredDependencies: string[];
|
|
17
|
-
/** Field-labelled manifest path declarations, never selected by precedence. */
|
|
18
|
-
declaredEntrypoints: string[];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export interface OverviewData {
|
|
22
|
-
projectName: string | null;
|
|
23
|
-
projectDescription: string | null;
|
|
24
|
-
modules: OverviewModule[];
|
|
25
|
-
/** Detected source languages (e.g. ["ts", "js", "py"]). */
|
|
26
|
-
detectedLanguages: string[] | null;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
// ── Inspect use-case ─────────────────────────────────────────────────
|
|
30
|
-
|
|
31
|
-
export interface InspectInput {
|
|
32
|
-
file: string;
|
|
33
|
-
line: number;
|
|
34
|
-
character: number;
|
|
35
|
-
maxResults?: number;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface InspectDeps {
|
|
39
|
-
provider: CodeProvider | null;
|
|
40
|
-
cwd: string;
|
|
41
|
-
lspRuntime: WorkspaceLspRuntimeState;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export interface InspectUseCaseResult {
|
|
45
|
-
content: string;
|
|
46
|
-
details: InspectDetails;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// ── Orientation use-case ─────────────────────────────────────────────────
|
|
50
|
-
|
|
51
|
-
export type OrientationSection = "defs" | "docs" | "diagnostics";
|
|
52
|
-
|
|
53
|
-
export interface OrientationTarget {
|
|
54
|
-
file: string;
|
|
55
|
-
line: number;
|
|
56
|
-
character: number;
|
|
57
|
-
name: string | null;
|
|
58
|
-
kind: string | null;
|
|
59
|
-
/** Which anchor this target carries; strict consumers refuse declaration anchors. */
|
|
60
|
-
anchorKind: AnchorKind;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export interface OrientationInput {
|
|
64
|
-
target?: OrientationTarget | null;
|
|
65
|
-
/** Resolved orientation focus path for project/module/directory/file orientation. */
|
|
66
|
-
focus?: string;
|
|
67
|
-
maxResults?: number;
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export interface OrientationDeps {
|
|
71
|
-
model: ArchitectureModel;
|
|
72
|
-
provider: CodeProvider | null;
|
|
73
|
-
cwd: string;
|
|
74
|
-
lspRuntime: WorkspaceLspRuntimeState;
|
|
75
|
-
}
|
|
File without changes
|