@mrclrchtr/supi-code-intelligence 1.16.1 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +373 -63
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
- package/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
- package/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/README.md +44 -56
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/package.json +4 -31
- package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +27 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-refresh.ts +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +246 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +4 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/config/lsp-settings.ts +102 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-actions.ts +59 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/index.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/capability-index.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +115 -26
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +177 -134
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +214 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +320 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registration.ts +26 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/session/service-registry.ts +81 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/summary.ts +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +18 -37
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/LICENSE +21 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/README.md +265 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs +4661 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js +4605 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +57 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +100 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs +4063 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts +1025 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts.map +58 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts +1025 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +58 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js +4007 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +55 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +6 -12
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/api.ts +29 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/index.ts +28 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/language.ts +5 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/provider/tree-sitter-provider.ts +14 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-controller.ts +157 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/session.ts +8 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +86 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +35 -16
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/structure.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/types.ts +10 -0
- package/package.json +14 -9
- package/src/{model.ts → analysis/architecture/discovery.ts} +15 -72
- package/src/analysis/architecture/model.ts +76 -0
- package/src/analysis/brief/directory.ts +324 -0
- package/src/analysis/brief/enrich.ts +157 -0
- package/src/analysis/brief/file.ts +84 -0
- package/src/analysis/brief/inventory.ts +177 -0
- package/src/analysis/brief/main.ts +176 -0
- package/src/analysis/brief/models.ts +75 -0
- package/src/{brief.ts → analysis/brief/public-brief.ts} +21 -26
- package/src/analysis/brief/summarize.ts +208 -0
- package/src/analysis/brief/types.ts +27 -0
- package/src/{use-case/generate-brief.ts → analysis/brief/use-case.ts} +67 -144
- package/src/analysis/coverage/coverage-warnings.ts +224 -0
- package/src/analysis/evidence.ts +91 -0
- package/src/{semantic-action-helpers.ts → analysis/helpers.ts} +4 -4
- package/src/analysis/provider.ts +186 -0
- package/src/analysis/read-next.ts +126 -0
- package/src/analysis/readiness.ts +73 -0
- package/src/{refactor → analysis/refactor}/safety.ts +1 -1
- package/src/{use-case/support/semantic-references.ts → analysis/references/semantic-refs.ts} +58 -26
- package/src/analysis/search/pattern.ts +345 -0
- package/src/analysis/search/ripgrep.ts +473 -0
- package/src/{git-context.ts → analysis/signals/git.ts} +20 -7
- package/src/{prioritization-signals.ts → analysis/signals/project.ts} +33 -19
- package/src/analysis/target/anchored.ts +349 -0
- package/src/analysis/target/bridge.ts +152 -0
- package/src/analysis/target/file-resolution.ts +125 -0
- package/src/{targeting/resolve-file.ts → analysis/target/file.ts} +40 -20
- package/src/{planner → analysis/target}/planner.ts +30 -20
- package/src/{targeting → analysis/target}/query.ts +17 -3
- package/src/analysis/target/resolve-common.ts +115 -0
- package/src/analysis/target/service.ts +229 -0
- package/src/analysis/target/symbol.ts +196 -0
- package/src/{targeting → analysis/target}/types.ts +17 -1
- package/src/analysis/tests/likely-tests.ts +174 -0
- package/src/analysis/tests/test-discovery.ts +540 -0
- package/src/analysis/tests/vitest.ts +87 -0
- package/src/api.ts +34 -41
- package/src/app/app.ts +125 -0
- package/src/app/manager.ts +65 -0
- package/src/extension.ts +132 -1
- package/src/index.ts +1 -57
- package/src/session/refactor-plans.ts +82 -0
- package/src/session/session.ts +300 -0
- package/src/session/target-store.ts +293 -0
- package/src/substrate/lsp/diagnostic-injection.ts +218 -0
- package/src/substrate/lsp/lifecycle.ts +66 -0
- package/src/substrate/lsp/overrides.ts +132 -0
- package/src/substrate/lsp/recovery.ts +55 -0
- package/src/substrate/lsp/settings.ts +286 -0
- package/src/substrate/lsp/state.ts +46 -0
- package/src/substrate/lsp/utils.ts +17 -0
- package/src/substrate/tree-sitter/lifecycle.ts +52 -0
- package/src/tool/find/execute.ts +118 -0
- package/src/{presentation/markdown/pattern.ts → tool/find/markdown.ts} +102 -53
- package/src/{use-case/generate-pattern.ts → tool/find/orchestrate.ts} +67 -33
- package/src/tool/find/semantic-search.ts +114 -0
- package/src/tool/find/tui.ts +39 -0
- package/src/tool/graph/callees.ts +87 -0
- package/src/tool/graph/calls-md.ts +54 -0
- package/src/tool/graph/collect-relation.ts +371 -0
- package/src/tool/graph/execute.ts +95 -0
- package/src/tool/graph/implementations-md.ts +79 -0
- package/src/tool/graph/implementations.ts +76 -0
- package/src/tool/graph/markdown-base.ts +243 -0
- package/src/tool/graph/orchestrate.ts +285 -0
- package/src/tool/graph/references-md.ts +34 -0
- package/src/tool/graph/references.ts +81 -0
- package/src/tool/graph/tui.ts +120 -0
- package/src/tool/graph/types.ts +97 -0
- package/src/tool/guidance.ts +96 -49
- package/src/tool/health/execute.ts +76 -0
- package/src/tool/health/markdown.ts +280 -0
- package/src/tool/health/orchestrate.ts +159 -0
- package/src/tool/health/sections/diagnostics.ts +182 -0
- package/src/tool/health/sections/recovery.ts +89 -0
- package/src/tool/health/sections/signals.ts +89 -0
- package/src/tool/health/tui.ts +137 -0
- package/src/tool/impact/analysis.ts +247 -0
- package/src/tool/impact/change-set-impact.ts +151 -0
- package/src/tool/impact/execute.ts +98 -0
- package/src/tool/impact/file-level-impact.ts +81 -0
- package/src/tool/impact/markdown.ts +283 -0
- package/src/tool/impact/orchestrate.ts +97 -0
- package/src/tool/impact/result.ts +21 -0
- package/src/tool/impact/single-impact.ts +89 -0
- package/src/tool/impact/tui.ts +39 -0
- package/src/tool/impact/types.ts +34 -0
- package/src/tool/infra/cross-field.ts +335 -0
- package/src/tool/infra/error-results.ts +199 -0
- package/src/tool/infra/pipeline.ts +311 -0
- package/src/tool/infra/progress.ts +21 -0
- package/src/tool/infra/readiness-message.ts +5 -0
- package/src/tool/infra/truncate.ts +49 -0
- package/src/tool/inspect/execute.ts +76 -0
- package/src/tool/inspect/markdown.ts +169 -0
- package/src/tool/inspect/orchestrate.ts +156 -0
- package/src/tool/inspect/tui.ts +36 -0
- package/src/tool/orientation/deps.ts +63 -0
- package/src/tool/orientation/execute.ts +50 -0
- package/src/tool/orientation/markdown.ts +35 -0
- package/src/tool/orientation/mode.ts +88 -0
- package/src/tool/orientation/orchestrate.ts +478 -0
- package/src/tool/orientation/precise-target.ts +257 -0
- package/src/tool/orientation/tui.ts +131 -0
- package/src/{refactor/apply-workspace-edit.ts → tool/refactor-apply/apply.ts} +39 -16
- package/src/tool/refactor-apply/execute.ts +20 -0
- package/src/tool/refactor-apply/markdown.ts +118 -0
- package/src/tool/refactor-apply/orchestrate.ts +89 -0
- package/src/tool/refactor-apply/tui.ts +51 -0
- package/src/tool/refactor-plan/execute.ts +73 -0
- package/src/tool/refactor-plan/markdown.ts +118 -0
- package/src/tool/refactor-plan/orchestrate.ts +363 -0
- package/src/tool/refactor-plan/tui.ts +42 -0
- package/src/tool/register.ts +123 -0
- package/src/tool/resolve/execute.ts +82 -0
- package/src/tool/resolve/markdown.ts +150 -0
- package/src/tool/resolve/orchestrate.ts +134 -0
- package/src/tool/resolve/tui.ts +40 -0
- package/src/tool/schemas.ts +337 -0
- package/src/tool/specs.ts +257 -0
- package/src/types/details.ts +188 -0
- package/src/types/execution.ts +60 -0
- package/src/types/index.ts +28 -0
- package/src/{intent/types.ts → types/tool-names.ts} +15 -14
- package/src/ui/footer.ts +52 -0
- package/src/ui/markdown/brief.ts +218 -0
- package/src/ui/markdown/gather.ts +177 -0
- package/src/{use-case/build-overview.ts → ui/markdown/overview-data.ts} +2 -2
- package/src/{presentation → ui}/markdown/overview.ts +2 -2
- package/src/ui/markdown/types.ts +80 -0
- package/{node_modules/@mrclrchtr/supi-lsp/src/ui/renderer.ts → src/ui/message-renderer.ts} +11 -10
- package/src/ui/status-command.ts +260 -0
- package/src/ui/status-overlay.ts +500 -0
- package/src/ui/tui/common.ts +220 -0
- package/src/ui/tui/index.ts +37 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/extension.ts +0 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/format.ts +0 -373
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/diagnostic-injection.ts +0 -182
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/session-lifecycle.ts +0 -149
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/status-command.ts +0 -38
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/workspace-recovery.ts +0 -92
- package/node_modules/@mrclrchtr/supi-lsp/src/lsp.ts +0 -37
- package/node_modules/@mrclrchtr/supi-lsp/src/session/lsp-state.ts +0 -93
- package/node_modules/@mrclrchtr/supi-lsp/src/session/settings-registration.ts +0 -296
- package/node_modules/@mrclrchtr/supi-lsp/src/session/tree-persist.ts +0 -75
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/guidance.ts +0 -69
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/names.ts +0 -27
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/overrides.ts +0 -204
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/register-tools.ts +0 -69
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/service-actions.ts +0 -399
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/tool-specs.ts +0 -248
- package/node_modules/@mrclrchtr/supi-lsp/src/ui/ui.ts +0 -360
- package/node_modules/@mrclrchtr/supi-lsp/src/workspace-change.ts +0 -40
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/extension.ts +0 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/formatting.ts +0 -104
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/guidance.ts +0 -35
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/handlers.ts +0 -196
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/register-tools.ts +0 -107
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/tool-specs.ts +0 -117
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tree-sitter.ts +0 -47
- package/src/brief-focused.ts +0 -563
- package/src/code-intelligence.ts +0 -70
- package/src/pattern-structured.ts +0 -194
- package/src/presentation/markdown/affected.ts +0 -170
- package/src/presentation/markdown/brief.ts +0 -174
- package/src/presentation/markdown/map.ts +0 -54
- package/src/presentation/markdown/refactor.ts +0 -27
- package/src/presentation/markdown/relations.ts +0 -121
- package/src/resolve-target.ts +0 -130
- package/src/search-helpers.ts +0 -303
- package/src/substrates/types.ts +0 -30
- package/src/target-resolution.ts +0 -122
- package/src/targeting/resolve-anchored.ts +0 -80
- package/src/targeting/resolve-symbol.ts +0 -110
- package/src/tool/execute-affected.ts +0 -71
- package/src/tool/execute-brief.ts +0 -59
- package/src/tool/execute-map.ts +0 -35
- package/src/tool/execute-pattern.ts +0 -29
- package/src/tool/execute-refactor.ts +0 -101
- package/src/tool/execute-relations.ts +0 -79
- package/src/tool/register-tools.ts +0 -32
- package/src/tool/tool-specs.ts +0 -190
- package/src/tool/validation.ts +0 -43
- package/src/types.ts +0 -169
- package/src/use-case/generate-affected.ts +0 -297
- package/src/use-case/generate-map.ts +0 -176
- package/src/use-case/generate-relations.ts +0 -438
- package/src/use-case/types.ts +0 -43
- package/src/workspace/request-context.ts +0 -139
- /package/src/{query-params.ts → tool/params.ts} +0 -0
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { mkdtempSync, writeFileSync } from "node:fs";
|
|
2
|
+
import { tmpdir } from "node:os";
|
|
3
|
+
import { join } from "node:path";
|
|
4
|
+
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
5
|
+
import type { Component } from "@earendil-works/pi-tui";
|
|
6
|
+
import type { WorkspaceCodeIntelligenceSession } from "../session/session.ts";
|
|
7
|
+
import { renderFindCall, renderFindResult } from "./find/tui.ts";
|
|
8
|
+
import { renderGraphCall, renderGraphResult } from "./graph/tui.ts";
|
|
9
|
+
import {
|
|
10
|
+
CODE_INTELLIGENCE_TOOL_PROMPT_SURFACES,
|
|
11
|
+
type CodeIntelligenceToolPromptSurfaceMap,
|
|
12
|
+
} from "./guidance.ts";
|
|
13
|
+
import { renderHealthCall, renderHealthResult } from "./health/tui.ts";
|
|
14
|
+
import { renderImpactCall, renderImpactResult } from "./impact/tui.ts";
|
|
15
|
+
import { truncateToolContent } from "./infra/truncate.ts";
|
|
16
|
+
import { renderInspectCall, renderInspectResult } from "./inspect/tui.ts";
|
|
17
|
+
import { renderOrientationCall, renderOrientationResult } from "./orientation/tui.ts";
|
|
18
|
+
import { renderRefactorApplyCall, renderRefactorApplyResult } from "./refactor-apply/tui.ts";
|
|
19
|
+
import { renderRefactorPlanCall, renderRefactorPlanResult } from "./refactor-plan/tui.ts";
|
|
20
|
+
import { renderResolveCall, renderResolveResult } from "./resolve/tui.ts";
|
|
21
|
+
import { CODE_INTELLIGENCE_TOOL_SPECS, type CodeIntelligenceToolDefinitionSpec } from "./specs.ts";
|
|
22
|
+
|
|
23
|
+
interface ToolRenderer {
|
|
24
|
+
// biome-ignore lint/suspicious/noExplicitAny: pi render call/result signatures vary per tool; spread into pi.registerTool where concrete typing handles variance
|
|
25
|
+
renderCall?: (...args: any[]) => Component;
|
|
26
|
+
// biome-ignore lint/suspicious/noExplicitAny: same variance reason as renderCall
|
|
27
|
+
renderResult?: (...args: any[]) => Component;
|
|
28
|
+
renderShell?: "self";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
function getToolRenderer(name: string): ToolRenderer {
|
|
32
|
+
switch (name) {
|
|
33
|
+
case "code_graph":
|
|
34
|
+
return {
|
|
35
|
+
renderCall: renderGraphCall,
|
|
36
|
+
renderResult: renderGraphResult,
|
|
37
|
+
};
|
|
38
|
+
case "code_health":
|
|
39
|
+
return {
|
|
40
|
+
renderCall: renderHealthCall,
|
|
41
|
+
renderResult: renderHealthResult,
|
|
42
|
+
};
|
|
43
|
+
case "code_orientation":
|
|
44
|
+
return {
|
|
45
|
+
renderCall: renderOrientationCall,
|
|
46
|
+
renderResult: renderOrientationResult,
|
|
47
|
+
};
|
|
48
|
+
case "code_resolve":
|
|
49
|
+
return { renderCall: renderResolveCall, renderResult: renderResolveResult };
|
|
50
|
+
case "code_inspect":
|
|
51
|
+
return { renderCall: renderInspectCall, renderResult: renderInspectResult };
|
|
52
|
+
case "code_find":
|
|
53
|
+
return { renderCall: renderFindCall, renderResult: renderFindResult };
|
|
54
|
+
case "code_impact":
|
|
55
|
+
return { renderCall: renderImpactCall, renderResult: renderImpactResult };
|
|
56
|
+
case "code_refactor_plan":
|
|
57
|
+
return {
|
|
58
|
+
renderCall: renderRefactorPlanCall,
|
|
59
|
+
renderResult: renderRefactorPlanResult,
|
|
60
|
+
};
|
|
61
|
+
case "code_refactor_apply":
|
|
62
|
+
return {
|
|
63
|
+
renderCall: renderRefactorApplyCall,
|
|
64
|
+
renderResult: renderRefactorApplyResult,
|
|
65
|
+
};
|
|
66
|
+
default:
|
|
67
|
+
return {};
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Register the focused code-intelligence tool surface from shared specs.
|
|
73
|
+
*
|
|
74
|
+
* @param getOrCreateSession — session factory; production passes the app-managed
|
|
75
|
+
* sessions, tests pass a `createSessionCache`-backed factory.
|
|
76
|
+
*/
|
|
77
|
+
export function registerCodeIntelligenceTools(
|
|
78
|
+
pi: ExtensionAPI,
|
|
79
|
+
getOrCreateSession: (cwd: string) => WorkspaceCodeIntelligenceSession,
|
|
80
|
+
promptSurfaces: CodeIntelligenceToolPromptSurfaceMap = CODE_INTELLIGENCE_TOOL_PROMPT_SURFACES,
|
|
81
|
+
specs: readonly CodeIntelligenceToolDefinitionSpec[] = CODE_INTELLIGENCE_TOOL_SPECS,
|
|
82
|
+
): void {
|
|
83
|
+
for (const spec of specs) {
|
|
84
|
+
const surface = promptSurfaces[spec.name];
|
|
85
|
+
pi.registerTool({
|
|
86
|
+
name: spec.name,
|
|
87
|
+
label: spec.label,
|
|
88
|
+
description: surface.description,
|
|
89
|
+
promptSnippet: surface.promptSnippet,
|
|
90
|
+
promptGuidelines: surface.promptGuidelines,
|
|
91
|
+
parameters: spec.parameters,
|
|
92
|
+
// biome-ignore lint/complexity/useMaxParams: pi ToolDefinition.execute signature
|
|
93
|
+
execute: async (_toolCallId, params, signal, onUpdate, ctx: ExtensionContext) => {
|
|
94
|
+
const session = getOrCreateSession(ctx.cwd);
|
|
95
|
+
const { content, details } = await spec.run(params, {
|
|
96
|
+
cwd: ctx.cwd,
|
|
97
|
+
signal,
|
|
98
|
+
onUpdate,
|
|
99
|
+
session,
|
|
100
|
+
});
|
|
101
|
+
const { text, truncated } = truncateToolContent(content, {
|
|
102
|
+
maxLines: spec.maxLines,
|
|
103
|
+
maxBytes: spec.maxBytes,
|
|
104
|
+
});
|
|
105
|
+
if (truncated && spec.spillToTempFile && content.length > 0) {
|
|
106
|
+
const dir = mkdtempSync(join(tmpdir(), "supi-ci-"));
|
|
107
|
+
const spillPath = join(dir, `${spec.name}-output.md`);
|
|
108
|
+
writeFileSync(spillPath, content, "utf-8");
|
|
109
|
+
const notice = `\n_Full output saved to: \`${spillPath}\`_`;
|
|
110
|
+
return {
|
|
111
|
+
content: [{ type: "text" as const, text: text + notice }],
|
|
112
|
+
details,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
return {
|
|
116
|
+
content: [{ type: "text" as const, text }],
|
|
117
|
+
details,
|
|
118
|
+
};
|
|
119
|
+
},
|
|
120
|
+
...getToolRenderer(spec.name),
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool executor for code_resolve.
|
|
3
|
+
*
|
|
4
|
+
* Thin adapter: validates params, gates readiness, delegates to orchestrate.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
8
|
+
import { resolveCrossFieldRules } from "../infra/cross-field.ts";
|
|
9
|
+
import { unavailableResolveDetails } from "../infra/error-results.ts";
|
|
10
|
+
import {
|
|
11
|
+
expandTargetId,
|
|
12
|
+
gateSemanticReadiness,
|
|
13
|
+
resolveScopeParam,
|
|
14
|
+
runPipe,
|
|
15
|
+
validateParams,
|
|
16
|
+
} from "../infra/pipeline.ts";
|
|
17
|
+
import { renderSemanticReadinessTimeout } from "../infra/readiness-message.ts";
|
|
18
|
+
import { orchestrateResolve } from "./orchestrate.ts";
|
|
19
|
+
|
|
20
|
+
export interface CodeResolveToolParams {
|
|
21
|
+
query?: string;
|
|
22
|
+
scope?: string;
|
|
23
|
+
kind?: string;
|
|
24
|
+
file?: string;
|
|
25
|
+
line?: number;
|
|
26
|
+
character?: number;
|
|
27
|
+
maxResults?: number;
|
|
28
|
+
targetId?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export async function executeResolveTool(
|
|
32
|
+
params: CodeResolveToolParams,
|
|
33
|
+
ctx: CodeIntelToolExecCtx,
|
|
34
|
+
): Promise<CodeIntelResult> {
|
|
35
|
+
const needsSemantic = Boolean(params.query) && params.kind !== "file" && params.kind !== "File";
|
|
36
|
+
|
|
37
|
+
return runPipe(
|
|
38
|
+
params,
|
|
39
|
+
ctx,
|
|
40
|
+
[
|
|
41
|
+
expandTargetId((msg) => ({
|
|
42
|
+
content: msg,
|
|
43
|
+
details: unavailableResolveDetails([
|
|
44
|
+
"Fix the input parameters and retry",
|
|
45
|
+
"Use anchored `file` + `line` + `character` or a `query` for resolution",
|
|
46
|
+
]),
|
|
47
|
+
})),
|
|
48
|
+
resolveScopeParam((reason) => ({
|
|
49
|
+
content: `**Error:** ${reason}`,
|
|
50
|
+
details: unavailableResolveDetails([
|
|
51
|
+
"Verify the `scope` path exists and is within the workspace",
|
|
52
|
+
"Use an existing workspace-relative file or directory path",
|
|
53
|
+
]),
|
|
54
|
+
})),
|
|
55
|
+
validateParams(resolveCrossFieldRules, (msg) => ({
|
|
56
|
+
content: msg,
|
|
57
|
+
details: unavailableResolveDetails([
|
|
58
|
+
"Fix the input parameters and retry",
|
|
59
|
+
"Use anchored `file` + `line` + `character` or a `query` for resolution",
|
|
60
|
+
]),
|
|
61
|
+
})),
|
|
62
|
+
...(needsSemantic
|
|
63
|
+
? [
|
|
64
|
+
gateSemanticReadiness("code_resolve", {
|
|
65
|
+
onTimeout: () => ({
|
|
66
|
+
content: renderSemanticReadinessTimeout("code_resolve", 15_000),
|
|
67
|
+
details: unavailableResolveDetails(["Retry shortly or check `code_health`"]),
|
|
68
|
+
}),
|
|
69
|
+
throwOnUnavailable: true,
|
|
70
|
+
}),
|
|
71
|
+
]
|
|
72
|
+
: []),
|
|
73
|
+
],
|
|
74
|
+
async (p, c) => {
|
|
75
|
+
return orchestrateResolve({
|
|
76
|
+
params: { ...p, scope: p.scope },
|
|
77
|
+
session: c.session,
|
|
78
|
+
cwd: c.cwd,
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
);
|
|
82
|
+
}
|
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Markdown renderer for code_resolve results.
|
|
3
|
+
*
|
|
4
|
+
* Produces compact, agent-friendly markdown showing resolved targets
|
|
5
|
+
* with stable handles, disambiguation candidates, or actionable errors.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { relative } from "node:path";
|
|
9
|
+
import { renderEvidenceListMetadataDisclosure } from "../../analysis/evidence.ts";
|
|
10
|
+
import type {
|
|
11
|
+
DisambiguationCandidate,
|
|
12
|
+
ResolveServiceResult,
|
|
13
|
+
} from "../../analysis/target/service.ts";
|
|
14
|
+
import type { TargetStoreEntry } from "../../session/target-store.ts";
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Render a provenance note for an anchored resolution, but only when the
|
|
18
|
+
* resolution was non-obvious — i.e. the coordinate was snapped to a different
|
|
19
|
+
* anchor, or the evidence was structural rather than semantic. Exact
|
|
20
|
+
* name-anchor hits resolved from semantic evidence stay quiet.
|
|
21
|
+
*/
|
|
22
|
+
function renderAnchoredResolutionNote(t: TargetStoreEntry): string | null {
|
|
23
|
+
const r = t.resolution;
|
|
24
|
+
if (!r) return null;
|
|
25
|
+
const degraded = r.source !== "semantic";
|
|
26
|
+
if (!r.snapped && !degraded) return null;
|
|
27
|
+
|
|
28
|
+
const req = `${r.requested.line}:${r.requested.character}`;
|
|
29
|
+
const res = `${r.resolved.line}:${r.resolved.character}`;
|
|
30
|
+
if (r.snapped) {
|
|
31
|
+
return `_Note: snapped from requested coordinate ${req} to name anchor ${res} (evidence: ${r.source})._`;
|
|
32
|
+
}
|
|
33
|
+
return `_Note: resolved from ${r.source} evidence; confirm with \`code_inspect\` if you need point-level facts._`;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** Render the single-target resolved block (with optional provenance note). */
|
|
37
|
+
function renderSingleTarget(t: TargetStoreEntry, confidence: string, cwd: string): string[] {
|
|
38
|
+
const relFile = relative(cwd, t.file) || t.file;
|
|
39
|
+
const kind = t.kind ? ` \`${t.kind}\`` : "";
|
|
40
|
+
const name = t.name ? ` **${t.name}**${kind}` : "";
|
|
41
|
+
const lines: string[] = [
|
|
42
|
+
`Resolved${name}:`,
|
|
43
|
+
"",
|
|
44
|
+
`- File: \`${relFile}\``,
|
|
45
|
+
`- Line: ${t.displayLine}, Column: ${t.displayCharacter}`,
|
|
46
|
+
`- Target ID: \`${t.targetId}\``,
|
|
47
|
+
`- Span ID: \`${t.spanId}\``,
|
|
48
|
+
`- Confidence: \`${confidence}\``,
|
|
49
|
+
`- Provenance: \`${t.provenance}\``,
|
|
50
|
+
];
|
|
51
|
+
const note = renderAnchoredResolutionNote(t);
|
|
52
|
+
if (note) {
|
|
53
|
+
lines.push("");
|
|
54
|
+
lines.push(note);
|
|
55
|
+
}
|
|
56
|
+
lines.push("");
|
|
57
|
+
return lines;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/** Render a full resolve service result into markdown. */
|
|
61
|
+
export function renderResolveResult(result: ResolveServiceResult, cwd: string): string {
|
|
62
|
+
switch (result.kind) {
|
|
63
|
+
case "resolved":
|
|
64
|
+
return renderResolved(result.targets, result.omittedCount, result.confidence, cwd);
|
|
65
|
+
case "disambiguation":
|
|
66
|
+
return renderDisambiguation(result.candidates, result.omittedCount, cwd);
|
|
67
|
+
case "error":
|
|
68
|
+
return result.message;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function renderResolved(
|
|
73
|
+
targets: TargetStoreEntry[],
|
|
74
|
+
omittedCount: number,
|
|
75
|
+
confidence: string,
|
|
76
|
+
cwd: string,
|
|
77
|
+
): string {
|
|
78
|
+
if (targets.length === 0) {
|
|
79
|
+
return "No targets resolved.";
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const lines: string[] = [];
|
|
83
|
+
|
|
84
|
+
if (targets.length === 1) {
|
|
85
|
+
lines.push(...renderSingleTarget(targets[0], confidence, cwd));
|
|
86
|
+
} else {
|
|
87
|
+
lines.push(`Resolved ${targets.length} target(s):`);
|
|
88
|
+
lines.push("");
|
|
89
|
+
|
|
90
|
+
for (const t of targets) {
|
|
91
|
+
const relFile = relative(cwd, t.file) || t.file;
|
|
92
|
+
const kind = t.kind ? ` (\`${t.kind}\`)` : "";
|
|
93
|
+
const name = t.name ?? "(unnamed)";
|
|
94
|
+
lines.push(
|
|
95
|
+
`- \`${relFile}\`:${t.displayLine}:${t.displayCharacter} — **${name}**${kind} — \`${t.targetId}\``,
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
const disclosure = renderEvidenceListMetadataDisclosure({
|
|
100
|
+
key: "resolve.targets",
|
|
101
|
+
totalCount: targets.length + omittedCount,
|
|
102
|
+
shownCount: targets.length,
|
|
103
|
+
omittedCount,
|
|
104
|
+
partialReason: null,
|
|
105
|
+
});
|
|
106
|
+
if (disclosure) {
|
|
107
|
+
lines.push(disclosure);
|
|
108
|
+
}
|
|
109
|
+
lines.push("");
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
return lines.join("\n");
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
function renderDisambiguation(
|
|
116
|
+
candidates: DisambiguationCandidate[],
|
|
117
|
+
omittedCount: number,
|
|
118
|
+
cwd: string,
|
|
119
|
+
): string {
|
|
120
|
+
const lines: string[] = [];
|
|
121
|
+
|
|
122
|
+
lines.push("# Multiple matches found");
|
|
123
|
+
lines.push("");
|
|
124
|
+
lines.push("Resolve by file + line + character, or refine with scope/kind:");
|
|
125
|
+
lines.push("");
|
|
126
|
+
|
|
127
|
+
for (const c of candidates) {
|
|
128
|
+
const relFile = relative(cwd, c.entry.file) || c.file;
|
|
129
|
+
const kind = c.kind ? ` (\`${c.kind}\`)` : "";
|
|
130
|
+
const container = c.container ? ` in \`${c.container}\`` : "";
|
|
131
|
+
lines.push(
|
|
132
|
+
`${c.rank}. **${c.name}**${kind}${container} — \`${relFile}\`:${c.line}:${c.character}`,
|
|
133
|
+
);
|
|
134
|
+
lines.push(` Target ID: \`${c.targetId}\``);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
const disclosure = renderEvidenceListMetadataDisclosure({
|
|
138
|
+
key: "resolve.candidates",
|
|
139
|
+
totalCount: candidates.length + omittedCount,
|
|
140
|
+
shownCount: candidates.length,
|
|
141
|
+
omittedCount,
|
|
142
|
+
partialReason: null,
|
|
143
|
+
});
|
|
144
|
+
if (disclosure) {
|
|
145
|
+
lines.push("");
|
|
146
|
+
lines.push(disclosure);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
return lines.join("\n");
|
|
150
|
+
}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* code_resolve orchestration — result assembly and details construction.
|
|
3
|
+
*
|
|
4
|
+
* Receives raw resolution outcomes from the resolution service and
|
|
5
|
+
* assembles the markdown content and structured details.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { relative } from "node:path";
|
|
9
|
+
import { executeResolveService, type ResolveServiceParams } from "../../analysis/target/service.ts";
|
|
10
|
+
import type { WorkspaceCodeIntelligenceSession } from "../../session/session.ts";
|
|
11
|
+
import type { CodeIntelResult, ResolveDetails } from "../../types/index.ts";
|
|
12
|
+
import { unavailableResolveDetails } from "../infra/error-results.ts";
|
|
13
|
+
import { renderResolveResult } from "./markdown.ts";
|
|
14
|
+
|
|
15
|
+
export interface ResolveOrchestrateInput {
|
|
16
|
+
params: ResolveServiceParams;
|
|
17
|
+
session: WorkspaceCodeIntelligenceSession;
|
|
18
|
+
cwd: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export async function orchestrateResolve(input: ResolveOrchestrateInput): Promise<CodeIntelResult> {
|
|
22
|
+
const { params, session, cwd } = input;
|
|
23
|
+
const result = await executeResolveService(params, session);
|
|
24
|
+
|
|
25
|
+
let content = renderResolveResult(result, cwd);
|
|
26
|
+
|
|
27
|
+
// For single-target resolutions, append actionable "Chain next" guidance.
|
|
28
|
+
if (result.kind === "resolved" && result.targets.length === 1) {
|
|
29
|
+
const target = result.targets[0];
|
|
30
|
+
const rels = suggestedRelations(target.kind);
|
|
31
|
+
if (rels) {
|
|
32
|
+
const chainLine = `Chain next: \`code_graph(targetId: "${target.targetId}", relations: ${JSON.stringify(rels)})\``;
|
|
33
|
+
content = `${content}\n${chainLine}\n`;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
// Build structured details
|
|
38
|
+
if (result.kind === "resolved") {
|
|
39
|
+
const details: ResolveDetails = {
|
|
40
|
+
confidence: result.confidence,
|
|
41
|
+
targetCount: result.targets.length + result.omittedCount,
|
|
42
|
+
omittedCount: result.omittedCount,
|
|
43
|
+
evidenceLists: [
|
|
44
|
+
{
|
|
45
|
+
key: "resolve.targets",
|
|
46
|
+
totalCount: result.targets.length + result.omittedCount,
|
|
47
|
+
shownCount: result.targets.length,
|
|
48
|
+
omittedCount: result.omittedCount,
|
|
49
|
+
partialReason: null,
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
|
+
targets: result.targets.map((t) => ({
|
|
53
|
+
targetId: t.targetId,
|
|
54
|
+
spanId: t.spanId,
|
|
55
|
+
file: relative(cwd, t.file) || t.file,
|
|
56
|
+
displayLine: t.displayLine,
|
|
57
|
+
displayCharacter: t.displayCharacter,
|
|
58
|
+
name: t.name,
|
|
59
|
+
kind: t.kind,
|
|
60
|
+
anchorKind: t.anchorKind,
|
|
61
|
+
confidence: t.confidence,
|
|
62
|
+
provenance: t.provenance,
|
|
63
|
+
resolution: t.resolution,
|
|
64
|
+
})),
|
|
65
|
+
nextQueries: result.nextQueries,
|
|
66
|
+
};
|
|
67
|
+
return { content, details: { type: "resolve", data: details } };
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if (result.kind === "disambiguation") {
|
|
71
|
+
const details: ResolveDetails = {
|
|
72
|
+
confidence: "semantic",
|
|
73
|
+
targetCount: result.candidates.length + result.omittedCount,
|
|
74
|
+
omittedCount: result.omittedCount,
|
|
75
|
+
evidenceLists: [
|
|
76
|
+
{
|
|
77
|
+
key: "resolve.candidates",
|
|
78
|
+
totalCount: result.candidates.length + result.omittedCount,
|
|
79
|
+
shownCount: result.candidates.length,
|
|
80
|
+
omittedCount: result.omittedCount,
|
|
81
|
+
partialReason: null,
|
|
82
|
+
},
|
|
83
|
+
],
|
|
84
|
+
targets: [],
|
|
85
|
+
candidates: result.candidates.map((cand) => ({
|
|
86
|
+
targetId: cand.targetId,
|
|
87
|
+
name: cand.name,
|
|
88
|
+
kind: cand.kind,
|
|
89
|
+
container: cand.container,
|
|
90
|
+
file: cand.file,
|
|
91
|
+
line: cand.line,
|
|
92
|
+
character: cand.character,
|
|
93
|
+
reason: cand.reason,
|
|
94
|
+
rank: cand.rank,
|
|
95
|
+
anchorKind: cand.anchorKind,
|
|
96
|
+
})),
|
|
97
|
+
nextQueries: result.nextQueries,
|
|
98
|
+
};
|
|
99
|
+
return { content, details: { type: "resolve", data: details } };
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
// Error — still return structured details
|
|
103
|
+
return {
|
|
104
|
+
content,
|
|
105
|
+
details: unavailableResolveDetails([
|
|
106
|
+
"Refine the `query` or `scope`",
|
|
107
|
+
"Use anchored `file` + `line` + `character` for a precise target",
|
|
108
|
+
]),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Suggested `code_graph` relations for a resolved symbol kind.
|
|
114
|
+
*/
|
|
115
|
+
function suggestedRelations(kind: string | undefined | null): string[] | undefined {
|
|
116
|
+
switch (kind?.toLowerCase()) {
|
|
117
|
+
case "function":
|
|
118
|
+
case "method":
|
|
119
|
+
case "constructor":
|
|
120
|
+
return ["references", "callees", "tests"];
|
|
121
|
+
case "class":
|
|
122
|
+
case "interface":
|
|
123
|
+
case "type":
|
|
124
|
+
case "enum":
|
|
125
|
+
return ["references", "implements"];
|
|
126
|
+
case "file":
|
|
127
|
+
case "module":
|
|
128
|
+
return ["imports", "exports"];
|
|
129
|
+
case "test":
|
|
130
|
+
return ["tests"];
|
|
131
|
+
default:
|
|
132
|
+
return undefined;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TUI renderer for code_resolve — renderCall + renderResult.
|
|
3
|
+
*/
|
|
4
|
+
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
5
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
6
|
+
import { type ResultOptios, renderSimpleResult, type ToolResult } from "../../ui/tui/common.ts";
|
|
7
|
+
import type { CodeResolveToolParams } from "./execute.ts";
|
|
8
|
+
|
|
9
|
+
/** ── renderCall ────────────────────────────────────────────────── */
|
|
10
|
+
|
|
11
|
+
export function renderResolveCall(args: unknown, theme: Theme, _context: unknown): Text {
|
|
12
|
+
const params = (args ?? {}) as CodeResolveToolParams;
|
|
13
|
+
|
|
14
|
+
let content = theme.fg("toolTitle", "code_resolve");
|
|
15
|
+
|
|
16
|
+
if (params.query) {
|
|
17
|
+
content += ` ${theme.fg("accent", params.query)}`;
|
|
18
|
+
} else if (params.file) {
|
|
19
|
+
const file = params.file.split("/").pop() ?? params.file;
|
|
20
|
+
content += ` ${theme.fg("accent", file)}`;
|
|
21
|
+
if (params.line) content += theme.fg("warning", `:${params.line}`);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
if (params.kind) {
|
|
25
|
+
content += theme.fg("dim", ` [${params.kind}]`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
return new Text(content, 0, 0);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** ── renderResult ──────────────────────────────────────────────── */
|
|
32
|
+
|
|
33
|
+
export function renderResolveResult(
|
|
34
|
+
result: ToolResult,
|
|
35
|
+
options: ResultOptios,
|
|
36
|
+
theme: Theme,
|
|
37
|
+
_context: unknown,
|
|
38
|
+
): ReturnType<typeof renderSimpleResult> {
|
|
39
|
+
return renderSimpleResult(result, options, theme, "Resolving…");
|
|
40
|
+
}
|