@mrclrchtr/supi-code-intelligence 11.0.1 → 11.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +68 -6
- package/gradle-helper/README.md +48 -0
- package/gradle-helper/build.sh +73 -0
- package/gradle-helper/lib/gradle-tooling-api-9.4.0.jar +0 -0
- package/gradle-helper/lib/slf4j-api-2.0.17.jar +0 -0
- package/gradle-helper/lib/slf4j-simple-2.0.17.jar +0 -0
- package/gradle-helper/lib/supi-gradle-observation.jar +0 -0
- package/gradle-helper/licenses/DEPENDENCIES.md +11 -0
- package/gradle-helper/licenses/LICENSE-gradle-tooling-api.txt +422 -0
- package/gradle-helper/licenses/LICENSE-slf4j.txt +21 -0
- package/gradle-helper/licenses/NOTICE-gradle.txt +21 -0
- package/gradle-helper/src/GradleObservation.java +597 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +41 -1
- package/node_modules/@mrclrchtr/supi-lsp/README.md +43 -6
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +41 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/LICENSE +15 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/README.md +680 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/bin/semver.js +195 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/comparator.js +143 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/index.js +7 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/range.js +577 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/classes/semver.js +350 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/clean.js +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/cmp.js +54 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/coerce.js +62 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/compare-build.js +9 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/compare-loose.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/compare.js +7 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/diff.js +60 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/eq.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/gt.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/gte.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/inc.js +21 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/lt.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/lte.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/major.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/minor.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/neq.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/parse.js +18 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/patch.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/prerelease.js +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/rcompare.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/rsort.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/satisfies.js +12 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/sort.js +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/truncate.js +48 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/functions/valid.js +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/index.js +93 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/constants.js +37 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/debug.js +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/identifiers.js +29 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/lrucache.js +42 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/parse-options.js +17 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/internal/re.js +223 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/package.json +78 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/preload.js +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/range.bnf +17 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/gtr.js +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/intersects.js +9 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/ltr.js +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/max-satisfying.js +27 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/min-satisfying.js +26 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/min-version.js +63 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/outside.js +82 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/simplify.js +49 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/subset.js +249 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/to-comparators.js +10 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/semver/ranges/valid.js +13 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/README.md +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/lib/browser/ril.js +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/lib/common/connection.js +7 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/lib/common/ral.d.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/lib/node/main.d.ts +14 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/lib/node/main.js +6 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/lib/node/ril.js +5 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-jsonrpc/package.json +4 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/package.json +4 -3
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-types/lib/esm/main.js +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-types/lib/umd/main.js +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-types/package.json +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/package.json +8 -6
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +44 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +53 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/config/operation-support.ts +19 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +22 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/typescript-launch.ts +276 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +22 -10
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +53 -20
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +4 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/session/scanner.ts +27 -15
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +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/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +41 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +5 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/LICENSE +21 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/tsx/tree-sitter-tsx.wasm.json +19 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/LICENSE +21 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/resources/grammars/typescript/tree-sitter-typescript.wasm.json +19 -2
- package/node_modules/ignore/README.md +36 -10
- package/node_modules/ignore/index.d.ts +3 -2
- package/node_modules/ignore/index.js +57 -53
- package/node_modules/ignore/legacy.js +50 -46
- package/node_modules/ignore/package.json +1 -1
- package/package.json +11 -6
- package/src/analysis/capability/capability-warnings.ts +18 -12
- package/src/analysis/gradle/query.ts +273 -0
- package/src/analysis/gradle/runtime.ts +173 -0
- package/src/analysis/gradle/types.ts +65 -0
- package/src/analysis/health/check.ts +115 -0
- package/src/analysis/health/diagnostics.ts +3 -0
- package/src/analysis/health/file-scope.ts +2 -3
- package/src/analysis/health/semantic-state.ts +38 -0
- package/src/analysis/health/server-status.ts +8 -0
- package/src/analysis/health/signals.ts +2 -0
- package/src/analysis/health/status.ts +82 -0
- package/src/analysis/read-next.ts +1 -4
- package/src/analysis/refactor/apply.ts +19 -10
- package/src/analysis/refactor/mutation-authority.ts +4 -1
- package/src/analysis/search/ast-scan.ts +143 -18
- package/src/analysis/workspace/safe-path.ts +14 -2
- package/src/analysis/workspace/types.ts +2 -0
- package/src/extension.ts +10 -1
- package/src/gradle/consent.ts +279 -0
- package/src/headless.ts +3 -0
- package/src/overview/collect.ts +11 -3
- package/src/session/health-types.ts +7 -0
- package/src/session/health-workflow.ts +8 -43
- package/src/session/orientation/collect.ts +138 -12
- package/src/session/orientation/context-facts.ts +27 -2
- package/src/session/orientation/context-sections.ts +47 -0
- package/src/session/orientation/facts.ts +124 -0
- package/src/session/orientation/gather.ts +98 -11
- package/src/session/orientation/workspace-context.ts +59 -28
- package/src/session/orientation-types.ts +16 -1
- package/src/session/orientation-workflow.ts +5 -2
- package/src/session/refactor-plans.ts +5 -2
- package/src/session/refactor-workflow.ts +4 -3
- package/src/session/session.ts +8 -0
- package/src/tool/code_find/execute.ts +1 -1
- package/src/tool/code_find/guidance.ts +1 -1
- package/src/tool/code_find/markdown.ts +24 -17
- package/src/tool/code_find/result.ts +18 -5
- package/src/tool/code_find/spec.ts +2 -0
- package/src/tool/code_find/structured.ts +161 -0
- package/src/tool/code_graph/result.ts +32 -15
- package/src/tool/code_graph/spec.ts +2 -0
- package/src/tool/code_graph/structured.ts +142 -0
- package/src/tool/code_health/markdown.ts +17 -17
- package/src/tool/code_health/result.ts +15 -2
- package/src/tool/code_health/spec.ts +2 -0
- package/src/tool/code_health/structured-schema.ts +250 -0
- package/src/tool/code_health/structured.ts +256 -0
- package/src/tool/code_inspect/markdown.ts +19 -11
- package/src/tool/code_inspect/result.ts +12 -5
- package/src/tool/code_inspect/spec.ts +2 -0
- package/src/tool/code_inspect/structured.ts +232 -0
- package/src/tool/code_orientation/directory-navigation.ts +66 -0
- package/src/tool/code_orientation/gradle-sections.ts +68 -0
- package/src/tool/code_orientation/markdown.ts +19 -8
- package/src/tool/code_orientation/result.ts +95 -11
- package/src/tool/code_orientation/spec.ts +2 -0
- package/src/tool/code_orientation/structured-schema.ts +607 -0
- package/src/tool/code_orientation/structured-workspace.ts +193 -0
- package/src/tool/code_orientation/structured.ts +195 -0
- package/src/tool/code_orientation/workspace-format.ts +2 -1
- package/src/tool/code_orientation/workspace-observations.ts +81 -0
- package/src/tool/code_orientation/workspace-output.ts +45 -13
- package/src/tool/code_orientation/workspace-projects.ts +180 -75
- package/src/tool/code_orientation/workspace-sections.ts +46 -31
- package/src/tool/code_refactor_apply/execute.ts +1 -1
- package/src/tool/code_refactor_apply/result.ts +13 -5
- package/src/tool/code_refactor_apply/spec.ts +2 -0
- package/src/tool/code_refactor_apply/structured.ts +49 -0
- package/src/tool/code_refactor_plan/result.ts +16 -8
- package/src/tool/code_refactor_plan/spec.ts +2 -0
- package/src/tool/code_refactor_plan/structured.ts +128 -0
- package/src/tool/code_resolve/markdown.ts +4 -10
- package/src/tool/code_resolve/result.ts +2 -0
- package/src/tool/code_resolve/spec.ts +2 -0
- package/src/tool/code_resolve/structured.ts +103 -0
- package/src/tool/infra/truncate.ts +12 -4
- package/src/tool/register.ts +10 -6
- package/src/tool/result/display.ts +17 -0
- package/src/tool/result/model-budget.ts +195 -0
- package/src/tool/result/structured.ts +62 -0
- package/src/tool/result/types.ts +10 -2
- package/src/tool/schemas.ts +7 -1
- package/src/tool/specs.ts +2 -0
- package/src/types/execution.ts +5 -1
- package/src/ui/status-command.ts +110 -321
- package/src/ui/status-overlay.ts +564 -420
- package/src/ui/tui/display.ts +10 -4
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import * as path from "node:path";
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from "../../
|
|
7
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
ProjectDeclaration,
|
|
4
|
+
ProjectMembership,
|
|
5
|
+
ProjectRelationship,
|
|
6
|
+
} from "../../analysis/workspace/types.ts";
|
|
7
|
+
import type { WorkspaceOrientationFacts } from "../../session/orientation/workspace-context.ts";
|
|
8
|
+
import type { OrientationItem, OrientationSectionData } from "../../session/orientation-types.ts";
|
|
8
9
|
import { code, plain, sourcePath, tableSection } from "./workspace-format.ts";
|
|
10
|
+
import {
|
|
11
|
+
declaredPathObservations,
|
|
12
|
+
projectObservations,
|
|
13
|
+
projectRelationships,
|
|
14
|
+
} from "./workspace-observations.ts";
|
|
9
15
|
|
|
10
16
|
/** Project identities and native declarations, without inferred roles or source roots. */
|
|
11
17
|
export function projectSections(
|
|
@@ -14,68 +20,19 @@ export function projectSections(
|
|
|
14
20
|
descriptions: boolean,
|
|
15
21
|
): OrientationSectionData[] {
|
|
16
22
|
const { observation, focus } = facts;
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
)
|
|
20
|
-
|
|
21
|
-
(project) => path.resolve(observation.root, project.directory) !== (focus ?? observation.root),
|
|
22
|
-
);
|
|
23
|
-
const header = [
|
|
24
|
-
"Kind",
|
|
25
|
-
"Name",
|
|
26
|
-
"Path",
|
|
27
|
-
"Identity source",
|
|
28
|
-
...(descriptions ? ["Declared description"] : []),
|
|
29
|
-
];
|
|
30
|
-
const result = [
|
|
31
|
-
tableSection("workspace.projects", "Project declarations", {
|
|
32
|
-
headers: header,
|
|
33
|
-
rows: nested.map((project) => [
|
|
34
|
-
project.kind,
|
|
35
|
-
code(project.name ?? "Unnamed declaration"),
|
|
36
|
-
code(sourcePath(facts, project.directory)),
|
|
37
|
-
code(
|
|
38
|
-
`${sourcePath(facts, project.manifestPath)}${project.nameField ? `#${project.nameField}` : ""}`,
|
|
39
|
-
),
|
|
40
|
-
...(descriptions
|
|
41
|
-
? [
|
|
42
|
-
project.description
|
|
43
|
-
? `${plain(project.description)} (${code(`${sourcePath(facts, project.manifestPath)}#${project.descriptionField}`)})`
|
|
44
|
-
: "—",
|
|
45
|
-
]
|
|
46
|
-
: []),
|
|
47
|
-
]),
|
|
23
|
+
const { nested, focused, memberships } = projectObservations(facts);
|
|
24
|
+
const result = [projectDeclarations(nested, facts, { limit, descriptions })];
|
|
25
|
+
if (!facts.overview) {
|
|
26
|
+
const section = membershipSection(memberships, facts, {
|
|
48
27
|
limit,
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
const memberships = projects.flatMap((project) =>
|
|
54
|
-
project.memberships.map((membership) => [
|
|
55
|
-
code(sourcePath(facts, project.directory)),
|
|
56
|
-
membership.kind,
|
|
57
|
-
code(`${sourcePath(facts, membership.manifestPath)}#${membership.field}`),
|
|
58
|
-
code(membership.value),
|
|
59
|
-
]),
|
|
60
|
-
);
|
|
61
|
-
if (memberships.length > 0 && !facts.overview)
|
|
62
|
-
result.push(
|
|
63
|
-
tableSection("workspace.memberships", "Declared memberships", {
|
|
64
|
-
headers: ["Project", "Kind", "Source", "Value"],
|
|
65
|
-
rows: memberships,
|
|
66
|
-
limit,
|
|
67
|
-
detail: "workspace configuration",
|
|
68
|
-
source: "manifest",
|
|
69
|
-
}),
|
|
70
|
-
);
|
|
28
|
+
listedProjects: nested.slice(0, limit),
|
|
29
|
+
});
|
|
30
|
+
if (section) result.push(section);
|
|
31
|
+
}
|
|
71
32
|
if (!focus) return result;
|
|
72
|
-
for (const project of
|
|
73
|
-
(project) => path.resolve(observation.root, project.directory) === focus,
|
|
74
|
-
)) {
|
|
33
|
+
for (const project of focused) {
|
|
75
34
|
result.push(declaredPaths(project, limit, facts));
|
|
76
|
-
const edges = observation
|
|
77
|
-
(edge) => edge.from === project.id || edge.to === project.id,
|
|
78
|
-
);
|
|
35
|
+
const edges = projectRelationships(observation, project);
|
|
79
36
|
result.push(relationshipSection(project, edges, facts, limit));
|
|
80
37
|
const unmatched =
|
|
81
38
|
project.dependencies.length - edges.filter((edge) => edge.from === project.id).length;
|
|
@@ -98,22 +55,168 @@ export function projectSections(
|
|
|
98
55
|
return result;
|
|
99
56
|
}
|
|
100
57
|
|
|
58
|
+
/** Bound declarations before grouping so shared provenance cannot multiply the list cap. */
|
|
59
|
+
function projectDeclarations(
|
|
60
|
+
projects: readonly ProjectDeclaration[],
|
|
61
|
+
facts: WorkspaceOrientationFacts,
|
|
62
|
+
options: { limit: number; descriptions: boolean },
|
|
63
|
+
): OrientationSectionData {
|
|
64
|
+
const selected = projects.slice(0, options.limit);
|
|
65
|
+
const groups = new Map<
|
|
66
|
+
string,
|
|
67
|
+
{ kind: ProjectDeclaration["kind"]; source: string; projects: ProjectDeclaration[] }
|
|
68
|
+
>();
|
|
69
|
+
for (const project of selected) {
|
|
70
|
+
const manifest = path.posix.relative(project.directory, project.manifestPath);
|
|
71
|
+
const source = `${manifest}${project.nameField ? `#${project.nameField}` : ""}`;
|
|
72
|
+
const key = JSON.stringify([project.kind, source]);
|
|
73
|
+
let group = groups.get(key);
|
|
74
|
+
if (!group) {
|
|
75
|
+
group = { kind: project.kind, source, projects: [] };
|
|
76
|
+
groups.set(key, group);
|
|
77
|
+
}
|
|
78
|
+
group.projects.push(project);
|
|
79
|
+
}
|
|
80
|
+
const items: OrientationItem[] = [];
|
|
81
|
+
for (const group of groups.values()) {
|
|
82
|
+
if (items.length > 0) items.push({ kind: "blank" });
|
|
83
|
+
items.push(
|
|
84
|
+
{
|
|
85
|
+
kind: "paragraph",
|
|
86
|
+
text: `${group.kind}; identity source: ${code(group.source)} relative to each listed project path.`,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
kind: "table",
|
|
90
|
+
headers: ["Name", "Path", ...(options.descriptions ? ["Declared description"] : [])],
|
|
91
|
+
rows: group.projects.map((project) => [
|
|
92
|
+
code(project.name ?? "Unnamed declaration"),
|
|
93
|
+
code(sourcePath(facts, project.directory)),
|
|
94
|
+
...(options.descriptions
|
|
95
|
+
? [
|
|
96
|
+
project.description
|
|
97
|
+
? `${plain(project.description)} (${code(`${sourcePath(facts, project.manifestPath)}#${project.descriptionField}`)})`
|
|
98
|
+
: "—",
|
|
99
|
+
]
|
|
100
|
+
: []),
|
|
101
|
+
]),
|
|
102
|
+
},
|
|
103
|
+
);
|
|
104
|
+
}
|
|
105
|
+
const section = projectListSection("workspace.projects", "Project declarations", {
|
|
106
|
+
totalCount: projects.length,
|
|
107
|
+
shownCount: selected.length,
|
|
108
|
+
items,
|
|
109
|
+
detail: "parsed project metadata",
|
|
110
|
+
});
|
|
111
|
+
return { ...section, tableEvidenceKey: section.key };
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/** Group only identical native declarations, retaining counts of individual memberships. */
|
|
115
|
+
function membershipSection(
|
|
116
|
+
memberships: ReturnType<typeof projectObservations>["memberships"],
|
|
117
|
+
facts: WorkspaceOrientationFacts,
|
|
118
|
+
options: { limit: number; listedProjects: readonly ProjectDeclaration[] },
|
|
119
|
+
): OrientationSectionData | null {
|
|
120
|
+
if (memberships.length === 0) return null;
|
|
121
|
+
const selected = memberships.slice(0, options.limit);
|
|
122
|
+
const groups = new Map<
|
|
123
|
+
string,
|
|
124
|
+
{ membership: ProjectMembership; projects: ProjectDeclaration[] }
|
|
125
|
+
>();
|
|
126
|
+
for (const { project, membership } of selected) {
|
|
127
|
+
const key = JSON.stringify([
|
|
128
|
+
membership.kind,
|
|
129
|
+
membership.manifestPath,
|
|
130
|
+
membership.field,
|
|
131
|
+
membership.value,
|
|
132
|
+
]);
|
|
133
|
+
let group = groups.get(key);
|
|
134
|
+
if (!group) {
|
|
135
|
+
group = { membership, projects: [] };
|
|
136
|
+
groups.set(key, group);
|
|
137
|
+
}
|
|
138
|
+
group.projects.push(project);
|
|
139
|
+
}
|
|
140
|
+
const items: OrientationItem[] = [];
|
|
141
|
+
for (const { membership, projects: members } of groups.values()) {
|
|
142
|
+
const source = `${sourcePath(facts, membership.manifestPath)}#${membership.field}`;
|
|
143
|
+
const reference = listedProjectReference(members, options.listedProjects);
|
|
144
|
+
const paths =
|
|
145
|
+
reference ?? members.map((project) => code(sourcePath(facts, project.directory))).join(", ");
|
|
146
|
+
items.push({
|
|
147
|
+
kind: "paragraph",
|
|
148
|
+
text: `${membership.kind}; source: ${code(source)}; value: ${code(membership.value)}. Projects: ${paths}.`,
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
return projectListSection("workspace.memberships", "Declared memberships", {
|
|
152
|
+
totalCount: memberships.length,
|
|
153
|
+
shownCount: selected.length,
|
|
154
|
+
items,
|
|
155
|
+
detail: "workspace configuration",
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/** A shared label is safe only when the selected members exactly match the named visible set. */
|
|
160
|
+
function listedProjectReference(
|
|
161
|
+
members: readonly ProjectDeclaration[],
|
|
162
|
+
listed: readonly ProjectDeclaration[],
|
|
163
|
+
): string | null {
|
|
164
|
+
const kind = members[0]?.kind;
|
|
165
|
+
const candidates = listed.filter((project) => project.kind === kind);
|
|
166
|
+
const ids = new Set(members.map((project) => project.id));
|
|
167
|
+
return candidates.length === members.length && candidates.every((project) => ids.has(project.id))
|
|
168
|
+
? `all ${members.length} listed ${kind} declarations`
|
|
169
|
+
: null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
function projectListSection(
|
|
173
|
+
key: string,
|
|
174
|
+
title: string,
|
|
175
|
+
options: {
|
|
176
|
+
totalCount: number;
|
|
177
|
+
shownCount: number;
|
|
178
|
+
items: OrientationItem[];
|
|
179
|
+
detail: string;
|
|
180
|
+
},
|
|
181
|
+
): OrientationSectionData {
|
|
182
|
+
return {
|
|
183
|
+
key,
|
|
184
|
+
title,
|
|
185
|
+
status: "complete",
|
|
186
|
+
reason: null,
|
|
187
|
+
confidence: "unavailable",
|
|
188
|
+
provenance: [{ source: "manifest", detail: options.detail }],
|
|
189
|
+
evidenceLists: [
|
|
190
|
+
{
|
|
191
|
+
key,
|
|
192
|
+
totalCount: options.totalCount,
|
|
193
|
+
shownCount: options.shownCount,
|
|
194
|
+
omittedCount: options.totalCount - options.shownCount,
|
|
195
|
+
partialReason: null,
|
|
196
|
+
},
|
|
197
|
+
],
|
|
198
|
+
items: options.items.length
|
|
199
|
+
? options.items
|
|
200
|
+
: [
|
|
201
|
+
{
|
|
202
|
+
kind: "paragraph",
|
|
203
|
+
text: options.totalCount > 0 ? "No entries shown." : "No collected entries.",
|
|
204
|
+
},
|
|
205
|
+
],
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
|
|
101
209
|
function declaredPaths(
|
|
102
210
|
project: ProjectDeclaration,
|
|
103
211
|
limit: number,
|
|
104
212
|
facts: WorkspaceOrientationFacts,
|
|
105
213
|
): OrientationSectionData {
|
|
106
|
-
const byPath = new Map<string, string[]>();
|
|
107
|
-
for (const entry of project.declaredPaths) {
|
|
108
|
-
const fields = byPath.get(entry.path) ?? [];
|
|
109
|
-
fields.push(entry.field);
|
|
110
|
-
byPath.set(entry.path, fields);
|
|
111
|
-
}
|
|
112
214
|
return tableSection(`${project.id}.paths`, "Declared paths (project-relative)", {
|
|
113
215
|
headers: ["Path", "Fields"],
|
|
114
|
-
rows: [
|
|
115
|
-
|
|
116
|
-
|
|
216
|
+
rows: declaredPathObservations(project).map(({ path: value, fields }) => [
|
|
217
|
+
code(value),
|
|
218
|
+
fields.map(code).join(", "),
|
|
219
|
+
]),
|
|
117
220
|
limit,
|
|
118
221
|
detail: sourcePath(facts, project.manifestPath),
|
|
119
222
|
source: "manifest",
|
|
@@ -127,7 +230,9 @@ function relationshipSection(
|
|
|
127
230
|
limit: number,
|
|
128
231
|
): OrientationSectionData {
|
|
129
232
|
const selected = edges.slice(0, limit);
|
|
130
|
-
const ids = [...new Set(selected.flatMap((edge) => [edge.from, edge.to]))].sort()
|
|
233
|
+
const ids = [...new Set(selected.flatMap((edge) => [edge.from, edge.to]))].sort((a, b) =>
|
|
234
|
+
a < b ? -1 : a > b ? 1 : 0,
|
|
235
|
+
);
|
|
131
236
|
const labels = new Map(facts.observation.projects.map((entry) => [entry.id, entry]));
|
|
132
237
|
const lines = ["flowchart LR"];
|
|
133
238
|
for (const [index, id] of ids.entries()) {
|
|
@@ -8,7 +8,9 @@ import type {
|
|
|
8
8
|
OrientationResultData,
|
|
9
9
|
OrientationSectionData,
|
|
10
10
|
} from "../../session/orientation-types.ts";
|
|
11
|
+
import { gradleSections } from "./gradle-sections.ts";
|
|
11
12
|
import { code, plain, sourcePath, tableSection } from "./workspace-format.ts";
|
|
13
|
+
import { workspaceCollectionStatus } from "./workspace-observations.ts";
|
|
12
14
|
import { projectSections } from "./workspace-projects.ts";
|
|
13
15
|
|
|
14
16
|
/** Build output facts from one captured observation, with no filesystem reads. */
|
|
@@ -53,6 +55,7 @@ export function workspaceSections(
|
|
|
53
55
|
}
|
|
54
56
|
const sections = inventorySections(entries, facts, limit);
|
|
55
57
|
sections.push(...projectSections(facts, limit, descriptions));
|
|
58
|
+
sections.push(...gradleSections(observation.gradle, limit));
|
|
56
59
|
const issues = [
|
|
57
60
|
...observation.collection.errors
|
|
58
61
|
.filter(
|
|
@@ -101,38 +104,26 @@ function collectionStatus(
|
|
|
101
104
|
section: OrientationSectionData,
|
|
102
105
|
observation: WorkspaceObservation,
|
|
103
106
|
): OrientationSectionData {
|
|
104
|
-
if (section.key === "workspace.issues") return section;
|
|
105
|
-
const
|
|
106
|
-
const inventoryPartial =
|
|
107
|
-
collection.stopReason !== "complete" ||
|
|
108
|
-
collection.errors.some((error) => error.stage === "inventory");
|
|
107
|
+
if (section.key === "workspace.issues" || section.key.startsWith("gradle.")) return section;
|
|
108
|
+
const state = workspaceCollectionStatus(observation.collection);
|
|
109
109
|
const partial = section.provenance.some((source) => source.source === "filesystem")
|
|
110
|
-
? inventoryPartial
|
|
111
|
-
:
|
|
110
|
+
? state.inventoryPartial
|
|
111
|
+
: state.metadataPartial;
|
|
112
112
|
if (!partial) return section;
|
|
113
|
-
const reason =
|
|
114
|
-
collection.stopReason === "entry-limit"
|
|
115
|
-
? "safety-limit"
|
|
116
|
-
: collection.stopReason === "deadline"
|
|
117
|
-
? "timeout"
|
|
118
|
-
: inventoryPartial
|
|
119
|
-
? "filesystem-error"
|
|
120
|
-
: "configuration-error";
|
|
121
113
|
return {
|
|
122
114
|
...section,
|
|
123
115
|
status: "partial",
|
|
124
|
-
reason:
|
|
125
|
-
? "Inventory collection is incomplete"
|
|
126
|
-
: "Metadata collection is incomplete",
|
|
116
|
+
reason: state.reason,
|
|
127
117
|
evidenceLists: section.evidenceLists.map((list) => ({
|
|
128
118
|
...list,
|
|
129
119
|
totalCount: null,
|
|
130
|
-
partialReason:
|
|
120
|
+
partialReason: state.partialReason,
|
|
131
121
|
})),
|
|
132
122
|
};
|
|
133
123
|
}
|
|
134
124
|
|
|
135
|
-
|
|
125
|
+
/** Nearest project declarations containing the focus, established by parsed metadata. */
|
|
126
|
+
export function containingProjects(facts: WorkspaceOrientationFacts, root: string) {
|
|
136
127
|
const candidates = facts.observation.projects.filter((project) =>
|
|
137
128
|
within(path.resolve(facts.observation.root, project.directory), root),
|
|
138
129
|
);
|
|
@@ -164,11 +155,17 @@ function inventoryNote(
|
|
|
164
155
|
return `Inventory: ${files} regular file${files === 1 ? "" : "s"} and ${links} symbolic links. Includes ${policy}; link targets are not followed.${exclusions} Collection ${collection.status}${collection.stopReason !== "complete" ? ` (${collection.stopReason}; more entries may exist)` : ""}.`;
|
|
165
156
|
}
|
|
166
157
|
|
|
167
|
-
|
|
158
|
+
/** Named inventory observations before presentation and per-list selection. */
|
|
159
|
+
export interface WorkspaceInventoryFacts {
|
|
160
|
+
readonly directories: readonly { path: string; entryCount: number }[];
|
|
161
|
+
readonly directFiles: readonly InventoryEntry[];
|
|
162
|
+
readonly extensions: readonly { extension: string; fileCount: number }[];
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
/** Derive direct children and extension counts from the already captured inventory. */
|
|
166
|
+
export function collectWorkspaceInventory(
|
|
168
167
|
entries: readonly InventoryEntry[],
|
|
169
|
-
|
|
170
|
-
limit: number,
|
|
171
|
-
): OrientationSectionData[] {
|
|
168
|
+
): WorkspaceInventoryFacts {
|
|
172
169
|
const directories = new Map<string, number>();
|
|
173
170
|
const extensions = new Map<string, number>();
|
|
174
171
|
for (const entry of entries) {
|
|
@@ -179,13 +176,30 @@ function inventorySections(
|
|
|
179
176
|
extensions.set(extension, (extensions.get(extension) ?? 0) + 1);
|
|
180
177
|
}
|
|
181
178
|
}
|
|
182
|
-
|
|
179
|
+
return {
|
|
180
|
+
directories: [...directories]
|
|
181
|
+
.sort(([a], [b]) => a.localeCompare(b))
|
|
182
|
+
.map(([name, count]) => ({ path: `${name}/`, entryCount: count })),
|
|
183
|
+
directFiles: entries.filter((entry) => !entry.path.includes("/")),
|
|
184
|
+
extensions: [...extensions]
|
|
185
|
+
.sort(([a, an], [b, bn]) => bn - an || a.localeCompare(b))
|
|
186
|
+
.map(([extension, count]) => ({ extension, fileCount: count })),
|
|
187
|
+
};
|
|
188
|
+
}
|
|
189
|
+
|
|
190
|
+
function inventorySections(
|
|
191
|
+
entries: readonly InventoryEntry[],
|
|
192
|
+
facts: WorkspaceOrientationFacts,
|
|
193
|
+
limit: number,
|
|
194
|
+
): OrientationSectionData[] {
|
|
195
|
+
const { directories, directFiles, extensions } = collectWorkspaceInventory(entries);
|
|
183
196
|
const sections = [
|
|
184
197
|
tableSection("workspace.directories", "Direct directories", {
|
|
185
198
|
headers: ["Path", "Entries at all depths"],
|
|
186
|
-
rows: [
|
|
187
|
-
|
|
188
|
-
|
|
199
|
+
rows: directories.map(({ path: directory, entryCount }) => [
|
|
200
|
+
code(directory),
|
|
201
|
+
String(entryCount),
|
|
202
|
+
]),
|
|
189
203
|
limit,
|
|
190
204
|
detail: "included paths",
|
|
191
205
|
}),
|
|
@@ -202,9 +216,10 @@ function inventorySections(
|
|
|
202
216
|
sections.push(
|
|
203
217
|
tableSection("workspace.extensions", "File extensions (filenames, not language support)", {
|
|
204
218
|
headers: ["Extension", "Regular files"],
|
|
205
|
-
rows: [
|
|
206
|
-
|
|
207
|
-
|
|
219
|
+
rows: extensions.map(({ extension, fileCount }) => [
|
|
220
|
+
extension ? code(extension) : "No extension",
|
|
221
|
+
String(fileCount),
|
|
222
|
+
]),
|
|
208
223
|
limit: facts.overview ? Math.min(5, limit) : limit,
|
|
209
224
|
detail: "included regular files",
|
|
210
225
|
}),
|
|
@@ -13,5 +13,5 @@ export async function executeRefactorApplyTool(
|
|
|
13
13
|
ctx: CodeIntelToolExecCtx,
|
|
14
14
|
): Promise<CodeIntelResult> {
|
|
15
15
|
const outcome = await ctx.session.applyRefactor(params, toWorkflowControl(ctx));
|
|
16
|
-
return finishRefactorApplyResult(outcome);
|
|
16
|
+
return finishRefactorApplyResult(outcome, ctx.cwd);
|
|
17
17
|
}
|
|
@@ -4,22 +4,30 @@ import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts
|
|
|
4
4
|
import { renderRefactorApplyResult } from "../refactor-markdown.ts";
|
|
5
5
|
import { searchErrorResult } from "../result/errors.ts";
|
|
6
6
|
import { assembleRefactorApplyDetails } from "../result/refactor.ts";
|
|
7
|
+
import { structuredRefactorApply } from "./structured.ts";
|
|
7
8
|
|
|
8
9
|
type RefactorApplyOutcome = Awaited<ReturnType<CodeIntelToolExecCtx["session"]["applyRefactor"]>>;
|
|
9
10
|
|
|
10
11
|
/** Assemble the final model-visible code_refactor_apply result for one workflow outcome. */
|
|
11
|
-
export function finishRefactorApplyResult(
|
|
12
|
+
export function finishRefactorApplyResult(
|
|
13
|
+
outcome: RefactorApplyOutcome,
|
|
14
|
+
cwd: string,
|
|
15
|
+
): CodeIntelResult {
|
|
12
16
|
if (outcome.kind === "unavailable") throw new Error(outcome.reason);
|
|
13
17
|
if (outcome.kind === "invalid-input") {
|
|
14
|
-
return
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
+
return {
|
|
19
|
+
...searchErrorResult(`**Error:** ${outcome.message}`, {
|
|
20
|
+
nextQueries: ["Generate a fresh plan with code_refactor_plan"],
|
|
21
|
+
message: outcome.message,
|
|
22
|
+
}),
|
|
23
|
+
structuredContent: structuredRefactorApply(outcome, cwd),
|
|
24
|
+
};
|
|
18
25
|
}
|
|
19
26
|
|
|
20
27
|
const assembly = assembleRefactorApplyDetails(outcome.result, outcome.plan);
|
|
21
28
|
return {
|
|
22
29
|
content: renderRefactorApplyResult(assembly),
|
|
30
|
+
structuredContent: structuredRefactorApply(outcome, cwd),
|
|
23
31
|
details: {
|
|
24
32
|
type: "search",
|
|
25
33
|
data: assembly.details,
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Type } from "typebox";
|
|
2
2
|
import type { CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
3
3
|
import { executeRefactorApplyTool } from "./execute.ts";
|
|
4
|
+
import { RefactorApplyOutputSchema } from "./structured.ts";
|
|
4
5
|
import { renderRefactorApplyCall, renderRefactorApplyResult } from "./tui.ts";
|
|
5
6
|
|
|
6
7
|
export const CODE_REFACTOR_APPLY_TOOL_NAME = "code_refactor_apply";
|
|
@@ -19,6 +20,7 @@ export const codeRefactorApplySpec = {
|
|
|
19
20
|
},
|
|
20
21
|
{ additionalProperties: false },
|
|
21
22
|
),
|
|
23
|
+
outputSchema: RefactorApplyOutputSchema,
|
|
22
24
|
run: (params: unknown, ctx: CodeIntelToolExecCtx) =>
|
|
23
25
|
executeRefactorApplyTool(params as Parameters<typeof executeRefactorApplyTool>[0], ctx),
|
|
24
26
|
renderCall: renderRefactorApplyCall,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { type Static, Type } from "typebox";
|
|
2
|
+
import { toDisplayPath } from "../../analysis/search/paths.ts";
|
|
3
|
+
import type { RefactorApplyWorkflowOutcome } from "../../session/refactor-types.ts";
|
|
4
|
+
|
|
5
|
+
/** Native application outcome, separate from recovery's absolute changed-file paths. */
|
|
6
|
+
export const RefactorApplyOutputSchema = Type.Union([
|
|
7
|
+
Type.Object(
|
|
8
|
+
{
|
|
9
|
+
kind: Type.Literal("applied"),
|
|
10
|
+
planId: Type.String(),
|
|
11
|
+
files: Type.Array(
|
|
12
|
+
Type.Object(
|
|
13
|
+
{ file: Type.String(), editCount: Type.Integer({ minimum: 0 }) },
|
|
14
|
+
{ additionalProperties: false },
|
|
15
|
+
),
|
|
16
|
+
),
|
|
17
|
+
fileCount: Type.Integer({ minimum: 0 }),
|
|
18
|
+
editCount: Type.Integer({ minimum: 0 }),
|
|
19
|
+
},
|
|
20
|
+
{ additionalProperties: false },
|
|
21
|
+
),
|
|
22
|
+
Type.Object(
|
|
23
|
+
{ kind: Type.Literal("invalid-input"), message: Type.String(), nextAction: Type.String() },
|
|
24
|
+
{ additionalProperties: false },
|
|
25
|
+
),
|
|
26
|
+
]);
|
|
27
|
+
|
|
28
|
+
/** Project applied file counts without exposing the stored plan. */
|
|
29
|
+
export function structuredRefactorApply(
|
|
30
|
+
outcome: Exclude<RefactorApplyWorkflowOutcome, { kind: "unavailable" }>,
|
|
31
|
+
cwd: string,
|
|
32
|
+
): Static<typeof RefactorApplyOutputSchema> {
|
|
33
|
+
if (outcome.kind === "invalid-input")
|
|
34
|
+
return {
|
|
35
|
+
kind: outcome.kind,
|
|
36
|
+
message: outcome.message,
|
|
37
|
+
nextAction: "Generate a fresh plan with code_refactor_plan",
|
|
38
|
+
};
|
|
39
|
+
const counts = new Map<string, number>();
|
|
40
|
+
for (const edit of outcome.plan.edits.edits)
|
|
41
|
+
counts.set(edit.file, (counts.get(edit.file) ?? 0) + 1);
|
|
42
|
+
return {
|
|
43
|
+
kind: "applied",
|
|
44
|
+
planId: outcome.plan.id,
|
|
45
|
+
files: [...counts].map(([file, editCount]) => ({ file: toDisplayPath(cwd, file), editCount })),
|
|
46
|
+
fileCount: outcome.result.filesChanged,
|
|
47
|
+
editCount: outcome.result.totalEdits,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
@@ -4,6 +4,7 @@ import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts
|
|
|
4
4
|
import { renderRefactorPlanResult } from "../refactor-markdown.ts";
|
|
5
5
|
import { searchErrorResult } from "../result/errors.ts";
|
|
6
6
|
import { assembleRefactorPlanDetails } from "../result/refactor.ts";
|
|
7
|
+
import { structuredRefactorPlan } from "./structured.ts";
|
|
7
8
|
|
|
8
9
|
type RefactorPlanOutcome = Awaited<ReturnType<CodeIntelToolExecCtx["session"]["planRefactor"]>>;
|
|
9
10
|
|
|
@@ -14,10 +15,13 @@ export function finishRefactorPlanResult(
|
|
|
14
15
|
): CodeIntelResult {
|
|
15
16
|
if (outcome.kind === "unavailable") throw new Error(outcome.reason);
|
|
16
17
|
if (outcome.kind === "invalid-input") {
|
|
17
|
-
return
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
return {
|
|
19
|
+
...searchErrorResult(`**Error:** ${outcome.message}`, {
|
|
20
|
+
nextQueries: ["Fix the target or operation and retry"],
|
|
21
|
+
message: outcome.message,
|
|
22
|
+
}),
|
|
23
|
+
structuredContent: structuredRefactorPlan(outcome, cwd),
|
|
24
|
+
};
|
|
21
25
|
}
|
|
22
26
|
if (outcome.kind === "ambiguous") {
|
|
23
27
|
const candidates = outcome.candidates
|
|
@@ -26,15 +30,19 @@ export function finishRefactorPlanResult(
|
|
|
26
30
|
`${index + 1}. ${candidate.description} (${candidate.file}:${candidate.line})`,
|
|
27
31
|
)
|
|
28
32
|
.join("\n");
|
|
29
|
-
return
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
+
return {
|
|
34
|
+
...searchErrorResult(`**Refactor ambiguous:**\n${candidates}`, {
|
|
35
|
+
nextQueries: ["Use a precise target handle or anchor"],
|
|
36
|
+
message: "The refactor target is ambiguous.",
|
|
37
|
+
}),
|
|
38
|
+
structuredContent: structuredRefactorPlan(outcome, cwd),
|
|
39
|
+
};
|
|
33
40
|
}
|
|
34
41
|
|
|
35
42
|
const assembly = assembleRefactorPlanDetails(outcome.plan, cwd);
|
|
36
43
|
return {
|
|
37
44
|
content: renderRefactorPlanResult(assembly),
|
|
45
|
+
structuredContent: structuredRefactorPlan(outcome, cwd),
|
|
38
46
|
details: {
|
|
39
47
|
type: "search",
|
|
40
48
|
data: assembly.details,
|
|
@@ -2,6 +2,7 @@ import { Type } from "typebox";
|
|
|
2
2
|
import type { CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
3
3
|
import { RefactorOperationParam, RefactorTargetParam } from "../schemas.ts";
|
|
4
4
|
import { executeRefactorPlanTool } from "./execute.ts";
|
|
5
|
+
import { RefactorPlanOutputSchema } from "./structured.ts";
|
|
5
6
|
import { renderRefactorPlanCall, renderRefactorPlanResult } from "./tui.ts";
|
|
6
7
|
|
|
7
8
|
export const CODE_REFACTOR_PLAN_TOOL_NAME = "code_refactor_plan";
|
|
@@ -18,6 +19,7 @@ export const codeRefactorPlanSpec = {
|
|
|
18
19
|
},
|
|
19
20
|
{ additionalProperties: false },
|
|
20
21
|
),
|
|
22
|
+
outputSchema: RefactorPlanOutputSchema,
|
|
21
23
|
run: (params: unknown, ctx: CodeIntelToolExecCtx) =>
|
|
22
24
|
executeRefactorPlanTool(params as Parameters<typeof executeRefactorPlanTool>[0], ctx),
|
|
23
25
|
renderCall: renderRefactorPlanCall,
|