@mrclrchtr/supi-code-intelligence 2.0.5 → 2.1.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.
Files changed (121) hide show
  1. package/README.md +71 -1
  2. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/README.md +29 -21
  3. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +2 -1
  4. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +88 -69
  5. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config.ts +22 -8
  6. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/prompt-surface.ts +357 -0
  7. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/prompt-surface.ts +4 -0
  8. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-command.ts +1 -1
  9. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +51 -29
  10. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +64 -18
  11. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings.ts +11 -5
  12. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/tool-framework.ts +10 -0
  13. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +2 -2
  14. package/node_modules/@mrclrchtr/supi-core/README.md +29 -21
  15. package/node_modules/@mrclrchtr/supi-core/package.json +2 -1
  16. package/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +88 -69
  17. package/node_modules/@mrclrchtr/supi-core/src/config/config.ts +22 -8
  18. package/node_modules/@mrclrchtr/supi-core/src/config/prompt-surface.ts +357 -0
  19. package/node_modules/@mrclrchtr/supi-core/src/prompt-surface.ts +4 -0
  20. package/node_modules/@mrclrchtr/supi-core/src/settings/settings-command.ts +1 -1
  21. package/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +51 -29
  22. package/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +64 -18
  23. package/node_modules/@mrclrchtr/supi-core/src/settings.ts +11 -5
  24. package/node_modules/@mrclrchtr/supi-core/src/tool-framework.ts +10 -0
  25. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/README.md +29 -21
  26. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +2 -1
  27. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +88 -69
  28. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config.ts +22 -8
  29. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/prompt-surface.ts +357 -0
  30. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/prompt-surface.ts +4 -0
  31. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-command.ts +1 -1
  32. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +51 -29
  33. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +64 -18
  34. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings.ts +11 -5
  35. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/tool-framework.ts +10 -0
  36. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +2 -2
  37. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/README.md +29 -21
  38. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +2 -1
  39. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +88 -69
  40. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config/config.ts +22 -8
  41. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config/prompt-surface.ts +357 -0
  42. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/prompt-surface.ts +4 -0
  43. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-command.ts +1 -1
  44. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +51 -29
  45. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +64 -18
  46. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings.ts +11 -5
  47. package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/tool-framework.ts +10 -0
  48. package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
  49. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/README.md +29 -21
  50. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +2 -1
  51. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +88 -69
  52. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config.ts +22 -8
  53. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/prompt-surface.ts +357 -0
  54. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/prompt-surface.ts +4 -0
  55. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-command.ts +1 -1
  56. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +51 -29
  57. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +64 -18
  58. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings.ts +11 -5
  59. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/tool-framework.ts +10 -0
  60. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +2 -2
  61. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/README.md +29 -21
  62. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +2 -1
  63. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +88 -69
  64. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/config.ts +22 -8
  65. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/prompt-surface.ts +357 -0
  66. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/prompt-surface.ts +4 -0
  67. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-command.ts +1 -1
  68. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +51 -29
  69. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +64 -18
  70. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings.ts +11 -5
  71. package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/tool-framework.ts +10 -0
  72. package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
  73. package/package.json +5 -5
  74. package/src/analysis/evidence.ts +13 -0
  75. package/src/analysis/search/pattern.ts +24 -13
  76. package/src/analysis/search/ripgrep.ts +92 -7
  77. package/src/extension.ts +1 -1
  78. package/src/session/capability-adapter.ts +218 -0
  79. package/src/session/session.ts +39 -1
  80. package/src/session/target-workflow.ts +430 -0
  81. package/src/substrate/lsp/settings.ts +7 -3
  82. package/src/tool/find/execute.ts +23 -10
  83. package/src/tool/find/orchestrate.ts +67 -54
  84. package/src/tool/find/semantic-search.ts +30 -16
  85. package/src/tool/graph/collect-relation.ts +2 -1
  86. package/src/tool/graph/execute.ts +40 -12
  87. package/src/tool/graph/markdown-base.ts +5 -37
  88. package/src/tool/graph/orchestrate.ts +9 -35
  89. package/src/tool/graph/tui.ts +2 -0
  90. package/src/tool/guidance.ts +1 -1
  91. package/src/tool/health/markdown.ts +12 -70
  92. package/src/tool/health/orchestrate.ts +5 -13
  93. package/src/tool/impact/analysis.ts +0 -27
  94. package/src/tool/impact/change-set-impact.ts +3 -2
  95. package/src/tool/impact/execute.ts +27 -0
  96. package/src/tool/impact/file-level-impact.ts +3 -2
  97. package/src/tool/impact/result.ts +2 -21
  98. package/src/tool/impact/single-impact.ts +3 -2
  99. package/src/tool/infra/error-results.ts +18 -196
  100. package/src/tool/infra/pipeline.ts +24 -1
  101. package/src/tool/inspect/markdown.ts +4 -41
  102. package/src/tool/inspect/orchestrate.ts +27 -28
  103. package/src/tool/orientation/orchestrate.ts +5 -8
  104. package/src/tool/orientation/precise-target.ts +65 -69
  105. package/src/tool/refactor-apply/orchestrate.ts +2 -7
  106. package/src/tool/refactor-plan/orchestrate.ts +31 -39
  107. package/src/tool/resolve/markdown.ts +5 -6
  108. package/src/tool/resolve/orchestrate.ts +7 -103
  109. package/src/tool/result/errors.ts +199 -0
  110. package/src/tool/result/find.ts +29 -0
  111. package/src/tool/result/graph.ts +93 -0
  112. package/src/tool/result/health.ts +94 -0
  113. package/src/tool/result/impact.ts +50 -0
  114. package/src/tool/result/inspect.ts +60 -0
  115. package/src/tool/result/orientation.ts +30 -0
  116. package/src/tool/result/refactor.ts +35 -0
  117. package/src/tool/result/resolve.ts +114 -0
  118. package/src/tool/result/types.ts +188 -0
  119. package/src/tool/schemas.ts +22 -1
  120. package/src/types/details.ts +17 -185
  121. package/src/ui/tui/common.ts +45 -1
@@ -0,0 +1,114 @@
1
+ import { relative } from "node:path";
2
+ import type { ResolveServiceResult } from "../../analysis/target/service.ts";
3
+ import type { ResolveDetails } from "./types.ts";
4
+
5
+ export interface ResolveResultAssembly {
6
+ result: ResolveServiceResult;
7
+ cwd: string;
8
+ details: ResolveDetails;
9
+ }
10
+
11
+ /** Assemble code_resolve evidence/details before markdown and TUI adapters render it. */
12
+ export function assembleResolveResult(
13
+ result: ResolveServiceResult,
14
+ cwd: string,
15
+ ): ResolveResultAssembly {
16
+ return { result, cwd, details: buildResolveDetails(result, cwd) };
17
+ }
18
+
19
+ function buildResolveDetails(result: ResolveServiceResult, cwd: string): ResolveDetails {
20
+ if (result.kind === "resolved") {
21
+ return {
22
+ confidence: result.confidence,
23
+ targetCount: result.targets.length + result.omittedCount,
24
+ omittedCount: result.omittedCount,
25
+ evidenceLists: [
26
+ {
27
+ key: "resolve.targets",
28
+ totalCount: result.targets.length + result.omittedCount,
29
+ shownCount: result.targets.length,
30
+ omittedCount: result.omittedCount,
31
+ partialReason: null,
32
+ },
33
+ ],
34
+ targets: result.targets.map((t) => ({
35
+ targetId: t.targetId,
36
+ spanId: t.spanId,
37
+ file: relative(cwd, t.file) || t.file,
38
+ displayLine: t.displayLine,
39
+ displayCharacter: t.displayCharacter,
40
+ name: t.name,
41
+ kind: t.kind,
42
+ anchorKind: t.anchorKind,
43
+ confidence: t.confidence,
44
+ provenance: t.provenance,
45
+ resolution: t.resolution,
46
+ })),
47
+ nextQueries: result.nextQueries,
48
+ };
49
+ }
50
+
51
+ if (result.kind === "disambiguation") {
52
+ return {
53
+ confidence: "semantic",
54
+ targetCount: result.candidates.length + result.omittedCount,
55
+ omittedCount: result.omittedCount,
56
+ evidenceLists: [
57
+ {
58
+ key: "resolve.candidates",
59
+ totalCount: result.candidates.length + result.omittedCount,
60
+ shownCount: result.candidates.length,
61
+ omittedCount: result.omittedCount,
62
+ partialReason: null,
63
+ },
64
+ ],
65
+ targets: [],
66
+ candidates: result.candidates.map((cand) => ({
67
+ targetId: cand.targetId,
68
+ name: cand.name,
69
+ kind: cand.kind,
70
+ container: cand.container,
71
+ file: cand.file,
72
+ line: cand.line,
73
+ character: cand.character,
74
+ reason: cand.reason,
75
+ rank: cand.rank,
76
+ anchorKind: cand.anchorKind,
77
+ })),
78
+ nextQueries: result.nextQueries,
79
+ };
80
+ }
81
+
82
+ return {
83
+ confidence: "unavailable",
84
+ targetCount: 0,
85
+ omittedCount: 0,
86
+ targets: [],
87
+ nextQueries: [
88
+ "Refine the `query` or `scope`",
89
+ "Use anchored `file` + `line` + `character` for a precise target",
90
+ ],
91
+ };
92
+ }
93
+
94
+ /** Suggested `code_graph` relations for a resolved symbol kind. */
95
+ export function suggestedResolveRelations(kind: string | undefined | null): string[] | undefined {
96
+ switch (kind?.toLowerCase()) {
97
+ case "function":
98
+ case "method":
99
+ case "constructor":
100
+ return ["references", "callees", "tests"];
101
+ case "class":
102
+ case "interface":
103
+ case "type":
104
+ case "enum":
105
+ return ["references", "implements"];
106
+ case "file":
107
+ case "module":
108
+ return ["imports", "exports"];
109
+ case "test":
110
+ return ["tests"];
111
+ default:
112
+ return undefined;
113
+ }
114
+ }
@@ -0,0 +1,188 @@
1
+ import type { ConfidenceMode } from "@mrclrchtr/supi-code-runtime/api";
2
+ import type { EvidenceListMetadata } from "../../analysis/evidence.ts";
3
+ import type { PrioritySignalsSummary } from "../../analysis/signals/project.ts";
4
+ import type { TestSurfaceDetails } from "../../analysis/tests/test-discovery.ts";
5
+ import type { AnchorKind, TargetStoreEntry } from "../../session/target-store.ts";
6
+
7
+ export type { TestSurfaceDetails } from "../../analysis/tests/test-discovery.ts";
8
+
9
+ // ── Anchored coordinate resolution metadata ───────────────────────────
10
+
11
+ /**
12
+ * Provider-backed evidence source that identified an anchored coordinate
13
+ * target. Drives the markdown provenance note and structured resolution
14
+ * metadata per ADR 0003/0004.
15
+ *
16
+ * - `semantic` — LSP document symbols identified the symbol and its anchors.
17
+ * - `structural` — tree-sitter structural evidence (outline/exports/nodeAt)
18
+ * identified the declaration and/or identifier.
19
+ * - `structural-identifier` — tree-sitter `nodeAt` classified the coordinate
20
+ * as an identifier token and snapped it to a declaration via ancestry.
21
+ */
22
+ export type AnchoredResolutionSource = "semantic" | "structural" | "structural-identifier";
23
+
24
+ /**
25
+ * Resolution metadata for a target resolved from anchored coordinates.
26
+ *
27
+ * Records the requested coordinate, the resolved anchor coordinate, whether
28
+ * the resolved anchor differs from the request (a snap), and the
29
+ * provider-backed evidence source. Structured details always carry this when
30
+ * a target was resolved from coordinates; markdown surfaces a note only when
31
+ * the resolution was non-obvious (snapped or degraded).
32
+ */
33
+ export interface AnchoredResolutionMetadata {
34
+ /** The 1-based coordinate the caller requested. */
35
+ requested: { line: number; character: number };
36
+ /** The 1-based anchor coordinate the target was resolved to. */
37
+ resolved: { line: number; character: number };
38
+ /** Whether the resolved anchor differs from the requested coordinate. */
39
+ snapped: boolean;
40
+ /** Provider-backed evidence source that identified the target. */
41
+ source: AnchoredResolutionSource;
42
+ }
43
+
44
+ /** Structured details metadata returned alongside markdown brief content. */
45
+ export interface BriefDetails {
46
+ confidence: ConfidenceMode;
47
+ focusTarget: string | null;
48
+ startHere: Array<{ target: string; reason: string }>;
49
+ publicSurfaces: string[];
50
+ dependencySummary: { moduleCount: number; edgeCount: number } | null;
51
+ omittedCount: number;
52
+ evidenceLists?: EvidenceListMetadata[];
53
+ nextQueries: string[];
54
+ prioritySignals?: PrioritySignalsSummary | null;
55
+ }
56
+
57
+ /** Structured details metadata for relationship and pattern results. */
58
+ export interface SearchDetails {
59
+ confidence: ConfidenceMode;
60
+ scope: string | null;
61
+ candidateCount: number;
62
+ omittedCount: number;
63
+ evidenceLists?: EvidenceListMetadata[];
64
+ nextQueries: string[];
65
+ tests?: TestSurfaceDetails;
66
+ }
67
+
68
+ /** Structured details metadata for affected analysis results. */
69
+ export interface AffectedDetails {
70
+ confidence: ConfidenceMode;
71
+ directCount: number;
72
+ downstreamCount: number;
73
+ riskLevel: "low" | "medium" | "high";
74
+ checkNext: string[];
75
+ likelyTests: string[];
76
+ /** Concrete test commands to run relevant verification. */
77
+ likelyTestCommands: string[];
78
+ omittedCount: number;
79
+ evidenceLists?: EvidenceListMetadata[];
80
+ nextQueries: string[];
81
+ prioritySignals?: PrioritySignalsSummary | null;
82
+ tests?: TestSurfaceDetails;
83
+ }
84
+
85
+ /**
86
+ * Structured details metadata for workflow-oriented impact analysis results.
87
+ *
88
+ * Currently structurally identical to `AffectedDetails`. When adding own fields,
89
+ * audit callers in `orchestrate.ts` that construct `{ type: "impact", data }`
90
+ * so they return `ImpactDetails`, not just `AffectedDetails`.
91
+ */
92
+ export interface ImpactDetails extends AffectedDetails {}
93
+
94
+ // Canonical disambiguation candidate — re-exported from resolution/types.ts
95
+ export type { DisambiguationCandidateData as DisambiguationCandidate } from "../../analysis/target/types.ts";
96
+
97
+ /** Structured details metadata for code_resolve results. */
98
+ export interface ResolveDetails {
99
+ confidence: ConfidenceMode;
100
+ targetCount: number;
101
+ omittedCount: number;
102
+ evidenceLists?: EvidenceListMetadata[];
103
+ /** Resolved targets with relative paths (computed from {@link TargetStoreEntry} at detail-build time). */
104
+ targets: Array<{
105
+ targetId: string;
106
+ spanId: string;
107
+ /** Workspace-relative path. */
108
+ file: string;
109
+ displayLine: number;
110
+ displayCharacter: number;
111
+ name: string | null;
112
+ kind: string | null;
113
+ anchorKind: AnchorKind;
114
+ confidence: ConfidenceMode;
115
+ provenance: string;
116
+ /** Resolution provenance — present when the target was resolved from anchored coordinates. */
117
+ resolution?: AnchoredResolutionMetadata;
118
+ }>;
119
+ /** Disambiguation candidates from the resolve service. */
120
+ candidates?: Array<{
121
+ targetId: string;
122
+ name: string;
123
+ kind: string | null;
124
+ container: string | null;
125
+ file: string;
126
+ line: number;
127
+ character: number;
128
+ reason: string;
129
+ rank: number;
130
+ anchorKind: AnchorKind;
131
+ }>;
132
+ nextQueries: string[];
133
+ }
134
+
135
+ /** Structured details metadata for code_orientation results. */
136
+ export interface ContextDetails {
137
+ confidence: ConfidenceMode;
138
+ task: string | null;
139
+ focusTarget: string | null;
140
+ requestedSections: string[];
141
+ renderedSections: string[];
142
+ omittedCount: number;
143
+ evidenceLists?: EvidenceListMetadata[];
144
+ nextQueries: string[];
145
+ tests?: TestSurfaceDetails;
146
+ /**
147
+ * Resolved target store entry — populated for both coordinate and targetId
148
+ * precise-target inputs. Absent for orientation/scope-only calls and for
149
+ * ambiguous coordinate resolution (see `candidates`).
150
+ * File paths are absolute; compute relative paths at render time.
151
+ */
152
+ target?: TargetStoreEntry;
153
+ /**
154
+ * Disambiguation candidates with targetIds — populated only when coordinate
155
+ * resolution was ambiguous. No task sections are rendered in that case.
156
+ */
157
+ candidates?: Array<{
158
+ targetId: string;
159
+ name: string;
160
+ kind: string | null;
161
+ container: string | null;
162
+ file: string;
163
+ line: number;
164
+ character: number;
165
+ rank: number;
166
+ }>;
167
+ }
168
+
169
+ /** Structured details metadata for code_inspect results. */
170
+ export interface InspectDetails {
171
+ confidence: ConfidenceMode;
172
+ focusTarget: string;
173
+ unavailableSections: string[];
174
+ evidenceLists?: EvidenceListMetadata[];
175
+ nextQueries: string[];
176
+ }
177
+
178
+ /** Structured details metadata for code_health results. */
179
+ export interface HealthDetails {
180
+ lspAvailable: boolean;
181
+ lspStatus: string;
182
+ recovered: boolean;
183
+ /** Structural (tree-sitter) substrate readiness. Undefined when not evaluated. */
184
+ structuralStatus?: string;
185
+ diagnosticFileCount: number;
186
+ serverCount: number;
187
+ evidenceLists?: EvidenceListMetadata[];
188
+ }
@@ -5,6 +5,27 @@ import type { CodeIntelligenceToolName } from "../types/index.ts";
5
5
  const ScopeParam = Type.String({
6
6
  description: "Workspace-relative path, package, or directory scope for the workflow query.",
7
7
  });
8
+ const FindScopeParam = Type.Union(
9
+ [
10
+ Type.String({
11
+ description: "Workspace-relative path, package, or directory scope for the search query.",
12
+ }),
13
+ Type.Array(
14
+ Type.String({
15
+ description: "Workspace-relative path, package, or directory search scope.",
16
+ }),
17
+ {
18
+ description: "One or more workspace-relative paths, packages, or directories to search.",
19
+ minItems: 1,
20
+ uniqueItems: true,
21
+ },
22
+ ),
23
+ ],
24
+ {
25
+ description:
26
+ "Workspace-relative path, package, directory, or array of scopes for the search query.",
27
+ },
28
+ );
8
29
  const FileParam = Type.String({ description: "Target file path." });
9
30
  const QueryParam = Type.String({
10
31
  description: "Human or code reference to resolve or search for.",
@@ -129,7 +150,7 @@ export const CodeOrientationParameters = Type.Object(
129
150
  export const CodeFindParameters = Type.Object(
130
151
  {
131
152
  query: QueryParam,
132
- scope: Type.Optional(ScopeParam),
153
+ scope: Type.Optional(FindScopeParam),
133
154
  mode: Type.Optional(
134
155
  StringEnum(["text", "regex", "ast", "semantic"], {
135
156
  description:
@@ -1,188 +1,20 @@
1
- import type { ConfidenceMode } from "@mrclrchtr/supi-code-runtime/api";
2
- import type { EvidenceListMetadata } from "../analysis/evidence.ts";
3
- import type { PrioritySignalsSummary } from "../analysis/signals/project.ts";
4
- import type { TestSurfaceDetails } from "../analysis/tests/test-discovery.ts";
5
- import type { AnchorKind, TargetStoreEntry } from "../session/target-store.ts";
6
-
7
- export type { TestSurfaceDetails } from "../analysis/tests/test-discovery.ts";
8
-
9
- // ── Anchored coordinate resolution metadata ───────────────────────────
10
-
11
1
  /**
12
- * Provider-backed evidence source that identified an anchored coordinate
13
- * target. Drives the markdown provenance note and structured resolution
14
- * metadata per ADR 0003/0004.
2
+ * Compatibility export for tool-result detail shapes.
15
3
  *
16
- * - `semantic` LSP document symbols identified the symbol and its anchors.
17
- * - `structural` tree-sitter structural evidence (outline/exports/nodeAt)
18
- * identified the declaration and/or identifier.
19
- * - `structural-identifier` — tree-sitter `nodeAt` classified the coordinate
20
- * as an identifier token and snapped it to a declaration via ancestry.
4
+ * Public code-intelligence details are assembled in `src/tool/result/`.
5
+ * Import new result assembly code from `../tool/result/types.ts` directly.
21
6
  */
22
- export type AnchoredResolutionSource = "semantic" | "structural" | "structural-identifier";
23
-
24
- /**
25
- * Resolution metadata for a target resolved from anchored coordinates.
26
- *
27
- * Records the requested coordinate, the resolved anchor coordinate, whether
28
- * the resolved anchor differs from the request (a snap), and the
29
- * provider-backed evidence source. Structured details always carry this when
30
- * a target was resolved from coordinates; markdown surfaces a note only when
31
- * the resolution was non-obvious (snapped or degraded).
32
- */
33
- export interface AnchoredResolutionMetadata {
34
- /** The 1-based coordinate the caller requested. */
35
- requested: { line: number; character: number };
36
- /** The 1-based anchor coordinate the target was resolved to. */
37
- resolved: { line: number; character: number };
38
- /** Whether the resolved anchor differs from the requested coordinate. */
39
- snapped: boolean;
40
- /** Provider-backed evidence source that identified the target. */
41
- source: AnchoredResolutionSource;
42
- }
43
-
44
- /** Structured details metadata returned alongside markdown brief content. */
45
- export interface BriefDetails {
46
- confidence: ConfidenceMode;
47
- focusTarget: string | null;
48
- startHere: Array<{ target: string; reason: string }>;
49
- publicSurfaces: string[];
50
- dependencySummary: { moduleCount: number; edgeCount: number } | null;
51
- omittedCount: number;
52
- evidenceLists?: EvidenceListMetadata[];
53
- nextQueries: string[];
54
- prioritySignals?: PrioritySignalsSummary | null;
55
- }
56
-
57
- /** Structured details metadata for relationship and pattern results. */
58
- export interface SearchDetails {
59
- confidence: ConfidenceMode;
60
- scope: string | null;
61
- candidateCount: number;
62
- omittedCount: number;
63
- evidenceLists?: EvidenceListMetadata[];
64
- nextQueries: string[];
65
- tests?: TestSurfaceDetails;
66
- }
67
-
68
- /** Structured details metadata for affected analysis results. */
69
- export interface AffectedDetails {
70
- confidence: ConfidenceMode;
71
- directCount: number;
72
- downstreamCount: number;
73
- riskLevel: "low" | "medium" | "high";
74
- checkNext: string[];
75
- likelyTests: string[];
76
- /** Concrete test commands to run relevant verification. */
77
- likelyTestCommands: string[];
78
- omittedCount: number;
79
- evidenceLists?: EvidenceListMetadata[];
80
- nextQueries: string[];
81
- prioritySignals?: PrioritySignalsSummary | null;
82
- tests?: TestSurfaceDetails;
83
- }
84
-
85
- /**
86
- * Structured details metadata for workflow-oriented impact analysis results.
87
- *
88
- * Currently structurally identical to `AffectedDetails`. When adding own fields,
89
- * audit callers in `orchestrate.ts` that construct `{ type: "impact", data }`
90
- * so they return `ImpactDetails`, not just `AffectedDetails`.
91
- */
92
- export interface ImpactDetails extends AffectedDetails {}
93
-
94
- // Canonical disambiguation candidate — re-exported from resolution/types.ts
95
- export type { DisambiguationCandidateData as DisambiguationCandidate } from "../analysis/target/types.ts";
96
-
97
- /** Structured details metadata for code_resolve results. */
98
- export interface ResolveDetails {
99
- confidence: ConfidenceMode;
100
- targetCount: number;
101
- omittedCount: number;
102
- evidenceLists?: EvidenceListMetadata[];
103
- /** Resolved targets with relative paths (computed from {@link TargetStoreEntry} at detail-build time). */
104
- targets: Array<{
105
- targetId: string;
106
- spanId: string;
107
- /** Workspace-relative path. */
108
- file: string;
109
- displayLine: number;
110
- displayCharacter: number;
111
- name: string | null;
112
- kind: string | null;
113
- anchorKind: AnchorKind;
114
- confidence: ConfidenceMode;
115
- provenance: string;
116
- /** Resolution provenance — present when the target was resolved from anchored coordinates. */
117
- resolution?: AnchoredResolutionMetadata;
118
- }>;
119
- /** Disambiguation candidates from the resolve service. */
120
- candidates?: Array<{
121
- targetId: string;
122
- name: string;
123
- kind: string | null;
124
- container: string | null;
125
- file: string;
126
- line: number;
127
- character: number;
128
- reason: string;
129
- rank: number;
130
- anchorKind: AnchorKind;
131
- }>;
132
- nextQueries: string[];
133
- }
134
-
135
- /** Structured details metadata for code_orientation results. */
136
- export interface ContextDetails {
137
- confidence: ConfidenceMode;
138
- task: string | null;
139
- focusTarget: string | null;
140
- requestedSections: string[];
141
- renderedSections: string[];
142
- omittedCount: number;
143
- evidenceLists?: EvidenceListMetadata[];
144
- nextQueries: string[];
145
- tests?: TestSurfaceDetails;
146
- /**
147
- * Resolved target store entry — populated for both coordinate and targetId
148
- * precise-target inputs. Absent for orientation/scope-only calls and for
149
- * ambiguous coordinate resolution (see `candidates`).
150
- * File paths are absolute; compute relative paths at render time.
151
- */
152
- target?: TargetStoreEntry;
153
- /**
154
- * Disambiguation candidates with targetIds — populated only when coordinate
155
- * resolution was ambiguous. No task sections are rendered in that case.
156
- */
157
- candidates?: Array<{
158
- targetId: string;
159
- name: string;
160
- kind: string | null;
161
- container: string | null;
162
- file: string;
163
- line: number;
164
- character: number;
165
- rank: number;
166
- }>;
167
- }
168
-
169
- /** Structured details metadata for code_inspect results. */
170
- export interface InspectDetails {
171
- confidence: ConfidenceMode;
172
- focusTarget: string;
173
- unavailableSections: string[];
174
- evidenceLists?: EvidenceListMetadata[];
175
- nextQueries: string[];
176
- }
177
-
178
- /** Structured details metadata for code_health results. */
179
- export interface HealthDetails {
180
- lspAvailable: boolean;
181
- lspStatus: string;
182
- recovered: boolean;
183
- /** Structural (tree-sitter) substrate readiness. Undefined when not evaluated. */
184
- structuralStatus?: string;
185
- diagnosticFileCount: number;
186
- serverCount: number;
187
- evidenceLists?: EvidenceListMetadata[];
188
- }
7
+ export type {
8
+ AffectedDetails,
9
+ AnchoredResolutionMetadata,
10
+ AnchoredResolutionSource,
11
+ BriefDetails,
12
+ ContextDetails,
13
+ DisambiguationCandidate,
14
+ HealthDetails,
15
+ ImpactDetails,
16
+ InspectDetails,
17
+ ResolveDetails,
18
+ SearchDetails,
19
+ TestSurfaceDetails,
20
+ } from "../tool/result/types.ts";
@@ -147,9 +147,9 @@ function buildExpandedView(
147
147
  if (lists && lists.length > 0) {
148
148
  container.addChild(new Spacer(1));
149
149
  renderEvidenceLines(container, lists, theme);
150
- container.addChild(new Spacer(1));
151
150
  }
152
151
 
152
+ renderStructuredDetailBody(container, data, theme);
153
153
  renderMarkdownDetail(container, result, theme);
154
154
 
155
155
  return container;
@@ -189,6 +189,50 @@ export function buildSimpleCompact(
189
189
  return new Text(segments.join(` ${dot} `), 0, 0);
190
190
  }
191
191
 
192
+ export function renderStructuredDetailBody(
193
+ container: Container,
194
+ data: Record<string, unknown> | undefined,
195
+ theme: Theme,
196
+ ): void {
197
+ if (!data) return;
198
+ const lines = structuredDetailLines(data);
199
+ if (lines.length === 0) return;
200
+ container.addChild(new Spacer(1));
201
+ for (const line of lines) {
202
+ container.addChild(new Text(theme.fg("muted", line), 0, 0));
203
+ }
204
+ }
205
+
206
+ function structuredDetailLines(data: Record<string, unknown>): string[] {
207
+ const lines: string[] = [];
208
+ const focusTarget = data.focusTarget;
209
+ if (typeof focusTarget === "string" && focusTarget.length > 0) {
210
+ lines.push(`target: ${focusTarget}`);
211
+ }
212
+
213
+ const unavailable = data.unavailableSections;
214
+ if (Array.isArray(unavailable) && unavailable.length > 0) {
215
+ lines.push(`unavailable: ${unavailable.join(", ")}`);
216
+ }
217
+
218
+ const checkNext = data.checkNext;
219
+ if (Array.isArray(checkNext) && checkNext.length > 0) {
220
+ lines.push(`check next: ${checkNext.slice(0, 3).join(" · ")}`);
221
+ }
222
+
223
+ const likelyTests = data.likelyTests;
224
+ if (Array.isArray(likelyTests) && likelyTests.length > 0) {
225
+ lines.push(`likely tests: ${likelyTests.slice(0, 3).join(" · ")}`);
226
+ }
227
+
228
+ const nextQueries = data.nextQueries;
229
+ if (Array.isArray(nextQueries) && nextQueries.length > 0) {
230
+ lines.push(`next: ${nextQueries.slice(0, 2).join(" · ")}`);
231
+ }
232
+
233
+ return lines;
234
+ }
235
+
192
236
  export function buildSimpleHeader(
193
237
  data: Record<string, unknown> | undefined,
194
238
  theme: Theme,