@mrclrchtr/supi-code-intelligence 1.16.1 → 2.0.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 +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,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Structural callee lookup — finds direct calls in the enclosing scope at a target position.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { CalleeEntry, CalleeScope, RelationsServiceDeps } from "./types.ts";
|
|
6
|
+
|
|
7
|
+
export interface CalleesResult {
|
|
8
|
+
kind: "callees";
|
|
9
|
+
targetName: string;
|
|
10
|
+
enclosingScope: CalleeScope | null;
|
|
11
|
+
callees: CalleeEntry[];
|
|
12
|
+
confidence: "structural" | "unavailable";
|
|
13
|
+
depth: "direct" | "deep";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* Collect direct structural callees at a target file/position using the
|
|
18
|
+
* enclosing executable scope reported by the structural provider.
|
|
19
|
+
*/
|
|
20
|
+
// biome-ignore lint/complexity/useMaxParams: service function with clear positional parameters matching provider contract
|
|
21
|
+
export async function collectCallees(
|
|
22
|
+
targetFile: string,
|
|
23
|
+
targetLine: number,
|
|
24
|
+
targetCharacter: number,
|
|
25
|
+
targetName: string | null,
|
|
26
|
+
deps: RelationsServiceDeps,
|
|
27
|
+
maxResults?: number,
|
|
28
|
+
depth: "direct" | "deep" = "direct",
|
|
29
|
+
): Promise<CalleesResult> {
|
|
30
|
+
if (!deps.provider?.calleesAt) {
|
|
31
|
+
return unavailableCallees(targetName);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const result = await deps.provider.calleesAt(targetFile, targetLine, targetCharacter, depth);
|
|
35
|
+
if (result.kind !== "success" || !result.data) {
|
|
36
|
+
return unavailableCallees(targetName);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
void maxResults;
|
|
40
|
+
const enclosingScope = buildEnclosingScope(
|
|
41
|
+
result.data.enclosingScope,
|
|
42
|
+
targetFile,
|
|
43
|
+
targetLine,
|
|
44
|
+
targetName,
|
|
45
|
+
);
|
|
46
|
+
const callees: CalleeEntry[] = result.data.callees.map((c) => ({
|
|
47
|
+
name: c.name,
|
|
48
|
+
file: c.file ?? c.location ?? targetFile,
|
|
49
|
+
line: c.startLine ?? targetLine,
|
|
50
|
+
character: c.startCharacter ?? targetCharacter,
|
|
51
|
+
}));
|
|
52
|
+
|
|
53
|
+
return {
|
|
54
|
+
kind: "callees",
|
|
55
|
+
targetName: targetName ?? "symbol",
|
|
56
|
+
enclosingScope,
|
|
57
|
+
callees,
|
|
58
|
+
confidence: "structural",
|
|
59
|
+
depth: result.data.depth ?? depth,
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function unavailableCallees(targetName: string | null): CalleesResult {
|
|
64
|
+
return {
|
|
65
|
+
kind: "callees",
|
|
66
|
+
targetName: targetName ?? "symbol",
|
|
67
|
+
enclosingScope: null,
|
|
68
|
+
callees: [],
|
|
69
|
+
confidence: "unavailable",
|
|
70
|
+
depth: "direct",
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function buildEnclosingScope(
|
|
75
|
+
scope: { name?: string; startLine?: number; endLine?: number } | undefined,
|
|
76
|
+
targetFile: string,
|
|
77
|
+
targetLine: number,
|
|
78
|
+
targetName: string | null,
|
|
79
|
+
): CalleeScope {
|
|
80
|
+
const startLine = scope?.startLine ?? targetLine;
|
|
81
|
+
return {
|
|
82
|
+
name: scope?.name ?? targetName ?? "symbol",
|
|
83
|
+
file: targetFile,
|
|
84
|
+
startLine,
|
|
85
|
+
endLine: scope?.endLine ?? startLine,
|
|
86
|
+
};
|
|
87
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Calls markdown renderer — renders direct structural calls.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
createEvidenceList,
|
|
7
|
+
type EvidenceListMetadata,
|
|
8
|
+
renderEvidenceListDisclosure,
|
|
9
|
+
} from "../../analysis/evidence.ts";
|
|
10
|
+
import type { CallEntry, CalleeScope } from "./types.ts";
|
|
11
|
+
|
|
12
|
+
export // biome-ignore lint/complexity/useMaxParams: renderer needs target data + depth
|
|
13
|
+
function renderCallsResult(
|
|
14
|
+
enclosingScope: CalleeScope,
|
|
15
|
+
calls: CallEntry[],
|
|
16
|
+
relPath: string,
|
|
17
|
+
maxResults: number,
|
|
18
|
+
depth: "direct" | "deep" = "direct",
|
|
19
|
+
): { content: string; evidenceList: EvidenceListMetadata | null } {
|
|
20
|
+
const lines: string[] = [];
|
|
21
|
+
const depthLabel = depth === "deep" ? "Deep structural calls" : "Direct structural calls";
|
|
22
|
+
const depthNote =
|
|
23
|
+
depth === "deep"
|
|
24
|
+
? "_Deep: includes calls from nested function/method/callback scopes within the enclosing scope._"
|
|
25
|
+
: "_Structural only: call expressions are reported by source shape, not symbol identity; calls inside nested function/method/callback scopes are excluded from this enclosing scope._";
|
|
26
|
+
|
|
27
|
+
lines.push(`# ${depthLabel} from \`${enclosingScope.name}\``);
|
|
28
|
+
lines.push("");
|
|
29
|
+
lines.push(
|
|
30
|
+
`**${calls.length} ${depth === "deep" ? "" : "direct "}structural call${calls.length !== 1 ? "s" : ""}** from enclosing scope \`${enclosingScope.name}\` (${formatScopeRange(enclosingScope)}) in \`${relPath}\``,
|
|
31
|
+
);
|
|
32
|
+
lines.push("");
|
|
33
|
+
lines.push(depthNote);
|
|
34
|
+
lines.push("");
|
|
35
|
+
|
|
36
|
+
const evidence = createEvidenceList({
|
|
37
|
+
key: "callees.calls",
|
|
38
|
+
items: calls,
|
|
39
|
+
maxResults,
|
|
40
|
+
});
|
|
41
|
+
for (const c of evidence.items) {
|
|
42
|
+
lines.push(`- \`${c.name}\` (L${c.line})`);
|
|
43
|
+
}
|
|
44
|
+
const disclosure = renderEvidenceListDisclosure(evidence);
|
|
45
|
+
if (disclosure) {
|
|
46
|
+
lines.push(disclosure);
|
|
47
|
+
}
|
|
48
|
+
return { content: lines.join("\n"), evidenceList: evidence.metadata };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
function formatScopeRange(scope: CalleeScope): string {
|
|
52
|
+
if (scope.startLine === scope.endLine) return `L${scope.startLine}`;
|
|
53
|
+
return `L${scope.startLine}–L${scope.endLine}`;
|
|
54
|
+
}
|
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-relation data collection for code_graph.
|
|
3
|
+
*
|
|
4
|
+
* Extracted from execute-graph.ts to keep the graph executor focused on
|
|
5
|
+
* orchestration. Each relation dispatches to a dedicated handler that
|
|
6
|
+
* calls the appropriate relations module directly.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { CodeProvider } from "../../analysis/provider.ts";
|
|
10
|
+
import {
|
|
11
|
+
readNextEnclosingScope,
|
|
12
|
+
readNextTarget,
|
|
13
|
+
readNextTopSites,
|
|
14
|
+
} from "../../analysis/read-next.ts";
|
|
15
|
+
import { toDisplayPath } from "../../analysis/search/ripgrep.ts";
|
|
16
|
+
import {
|
|
17
|
+
buildTestSurfaceDetails,
|
|
18
|
+
discoverTestFilesForSource,
|
|
19
|
+
renderRankedTestLabelsForMarkdown,
|
|
20
|
+
} from "../../analysis/tests/test-discovery.ts";
|
|
21
|
+
import type { AnchorKind } from "../../session/target-store.ts";
|
|
22
|
+
import { collectCallees } from "./callees.ts";
|
|
23
|
+
import { renderCallsResult } from "./calls-md.ts";
|
|
24
|
+
import type { GraphRelation } from "./execute.ts";
|
|
25
|
+
import { collectImplementations } from "./implementations.ts";
|
|
26
|
+
import { renderImplementationsResult } from "./implementations-md.ts";
|
|
27
|
+
import { type GraphSection, renderExportsResult, renderImportsResult } from "./markdown-base.ts";
|
|
28
|
+
import { collectCallers } from "./references.ts";
|
|
29
|
+
import { renderReferencesResult } from "./references-md.ts";
|
|
30
|
+
import type { CallEntry } from "./types.ts";
|
|
31
|
+
|
|
32
|
+
// ── Shared context passed to each relation handler ────────────────────
|
|
33
|
+
|
|
34
|
+
interface CollectionContext {
|
|
35
|
+
file: string;
|
|
36
|
+
position: { line: number; character: number };
|
|
37
|
+
displayName: string;
|
|
38
|
+
cwd: string;
|
|
39
|
+
provider: CodeProvider | null;
|
|
40
|
+
maxResults: number;
|
|
41
|
+
anchorKind: AnchorKind;
|
|
42
|
+
calleeDepth: "direct" | "deep";
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// ── Dispatcher ────────────────────────────────────────────────────────
|
|
46
|
+
|
|
47
|
+
/** Options for {@link collectRelation}. */
|
|
48
|
+
export interface CollectRelationOptions {
|
|
49
|
+
file: string;
|
|
50
|
+
position: { line: number; character: number };
|
|
51
|
+
displayName: string;
|
|
52
|
+
cwd: string;
|
|
53
|
+
provider: CodeProvider | null;
|
|
54
|
+
maxResults: number;
|
|
55
|
+
semanticReadinessError: string | null;
|
|
56
|
+
anchorKind: AnchorKind;
|
|
57
|
+
calleeDepth?: "direct" | "deep";
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Collect data for one graph relation. Dispatches to the handler for the
|
|
62
|
+
* requested relation kind, gating semantic relations behind readiness.
|
|
63
|
+
*/
|
|
64
|
+
export async function collectRelation(
|
|
65
|
+
rel: GraphRelation,
|
|
66
|
+
opts: CollectRelationOptions,
|
|
67
|
+
): Promise<GraphSection> {
|
|
68
|
+
if (opts.semanticReadinessError && (rel === "references" || rel === "implements")) {
|
|
69
|
+
return { kind: "unavailable", rel, message: opts.semanticReadinessError };
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const ctx: CollectionContext = {
|
|
73
|
+
file: opts.file,
|
|
74
|
+
position: opts.position,
|
|
75
|
+
displayName: opts.displayName,
|
|
76
|
+
cwd: opts.cwd,
|
|
77
|
+
provider: opts.provider,
|
|
78
|
+
maxResults: opts.maxResults,
|
|
79
|
+
anchorKind: opts.anchorKind,
|
|
80
|
+
calleeDepth: opts.calleeDepth ?? "direct",
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
try {
|
|
84
|
+
const handler = RELATION_HANDLERS[rel];
|
|
85
|
+
if (!handler) {
|
|
86
|
+
return { kind: "not-implemented", rel, message: `Unknown relation: ${rel}` };
|
|
87
|
+
}
|
|
88
|
+
return handler(ctx);
|
|
89
|
+
} catch (err) {
|
|
90
|
+
return {
|
|
91
|
+
kind: "unavailable",
|
|
92
|
+
rel,
|
|
93
|
+
message: err instanceof Error ? err.message : "Unknown error",
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// ── Relation handlers ─────────────────────────────────────────────────
|
|
99
|
+
|
|
100
|
+
async function collectReferencesRelation(ctx: CollectionContext): Promise<GraphSection> {
|
|
101
|
+
const rel: GraphRelation = "references";
|
|
102
|
+
if (!ctx.provider?.references) {
|
|
103
|
+
return { kind: "unavailable", rel, message: "No semantic provider for references" };
|
|
104
|
+
}
|
|
105
|
+
const result = await collectCallers(ctx.file, ctx.position, ctx.displayName, {
|
|
106
|
+
cwd: ctx.cwd,
|
|
107
|
+
provider: { references: ctx.provider.references },
|
|
108
|
+
});
|
|
109
|
+
if (result.confidence === "unavailable") {
|
|
110
|
+
return { kind: "unavailable", rel, message: "No references available" };
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
// Filter out the declaration position (target file + position)
|
|
114
|
+
const targetLine = ctx.position.line + 1;
|
|
115
|
+
const targetChar = ctx.position.character + 1;
|
|
116
|
+
const refs = result.references.filter((r) => {
|
|
117
|
+
if (r.file !== ctx.file) return true;
|
|
118
|
+
if (r.line === targetLine && r.character === targetChar) return false;
|
|
119
|
+
return true;
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
const rendered = renderReferencesResult(
|
|
123
|
+
ctx.displayName,
|
|
124
|
+
refs,
|
|
125
|
+
result.externalCount,
|
|
126
|
+
result.confidence,
|
|
127
|
+
ctx.cwd,
|
|
128
|
+
ctx.maxResults,
|
|
129
|
+
);
|
|
130
|
+
return {
|
|
131
|
+
kind: "ok",
|
|
132
|
+
rel,
|
|
133
|
+
count: refs.length,
|
|
134
|
+
content: rendered.content,
|
|
135
|
+
evidenceLists: rendered.evidenceList ? [rendered.evidenceList] : [],
|
|
136
|
+
readNext: [
|
|
137
|
+
readNextTarget(
|
|
138
|
+
toDisplayPath(ctx.cwd, ctx.file),
|
|
139
|
+
ctx.position.line + 1,
|
|
140
|
+
"inspect the resolved target before editing",
|
|
141
|
+
),
|
|
142
|
+
...readNextTopSites(
|
|
143
|
+
refs.slice(0, ctx.maxResults).map((ref) => ({
|
|
144
|
+
file: toDisplayPath(ctx.cwd, ref.file),
|
|
145
|
+
line: ref.line,
|
|
146
|
+
})),
|
|
147
|
+
2,
|
|
148
|
+
"reference",
|
|
149
|
+
),
|
|
150
|
+
],
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
async function collectCalleesRelation(ctx: CollectionContext): Promise<GraphSection> {
|
|
155
|
+
const rel: GraphRelation = "callees";
|
|
156
|
+
if (ctx.anchorKind === "declaration") {
|
|
157
|
+
return {
|
|
158
|
+
kind: "unavailable",
|
|
159
|
+
rel,
|
|
160
|
+
message:
|
|
161
|
+
"Cannot collect callees from a declaration anchor. Re-resolve the target to a name anchor, or pass file + line + character anchored on the identifier.",
|
|
162
|
+
};
|
|
163
|
+
}
|
|
164
|
+
if (!ctx.provider?.calleesAt) {
|
|
165
|
+
return { kind: "unavailable", rel, message: "No structural provider for callees" };
|
|
166
|
+
}
|
|
167
|
+
const result = await collectCallees(
|
|
168
|
+
ctx.file,
|
|
169
|
+
ctx.position.line + 1,
|
|
170
|
+
ctx.position.character + 1,
|
|
171
|
+
ctx.displayName,
|
|
172
|
+
{ cwd: ctx.cwd, provider: { calleesAt: ctx.provider.calleesAt } },
|
|
173
|
+
undefined,
|
|
174
|
+
ctx.calleeDepth,
|
|
175
|
+
);
|
|
176
|
+
if (result.confidence === "unavailable") {
|
|
177
|
+
return { kind: "unavailable", rel, message: "No callees available" };
|
|
178
|
+
}
|
|
179
|
+
const enclosingScope = result.enclosingScope ?? {
|
|
180
|
+
name: ctx.displayName ?? "symbol",
|
|
181
|
+
file: ctx.file,
|
|
182
|
+
startLine: ctx.position.line + 1,
|
|
183
|
+
endLine: ctx.position.line + 1,
|
|
184
|
+
};
|
|
185
|
+
const calls: CallEntry[] = result.callees.map((c) => ({
|
|
186
|
+
name: c.name,
|
|
187
|
+
file: c.file,
|
|
188
|
+
line: c.line,
|
|
189
|
+
}));
|
|
190
|
+
const rendered = renderCallsResult(
|
|
191
|
+
enclosingScope,
|
|
192
|
+
calls,
|
|
193
|
+
toDisplayPath(ctx.cwd, ctx.file),
|
|
194
|
+
ctx.maxResults,
|
|
195
|
+
result.depth,
|
|
196
|
+
);
|
|
197
|
+
return {
|
|
198
|
+
kind: "ok",
|
|
199
|
+
rel,
|
|
200
|
+
count: calls.length,
|
|
201
|
+
content: rendered.content,
|
|
202
|
+
evidenceLists: rendered.evidenceList ? [rendered.evidenceList] : [],
|
|
203
|
+
readNext: [
|
|
204
|
+
readNextEnclosingScope(
|
|
205
|
+
toDisplayPath(ctx.cwd, ctx.file),
|
|
206
|
+
enclosingScope,
|
|
207
|
+
ctx.position.line + 1,
|
|
208
|
+
),
|
|
209
|
+
],
|
|
210
|
+
};
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
async function collectImplementationsRelation(ctx: CollectionContext): Promise<GraphSection> {
|
|
214
|
+
const rel: GraphRelation = "implements";
|
|
215
|
+
if (!ctx.provider?.implementation) {
|
|
216
|
+
return { kind: "unavailable", rel, message: "No semantic provider for implementations" };
|
|
217
|
+
}
|
|
218
|
+
const result = await collectImplementations(
|
|
219
|
+
ctx.file,
|
|
220
|
+
ctx.position,
|
|
221
|
+
ctx.displayName,
|
|
222
|
+
{ cwd: ctx.cwd, provider: { implementation: ctx.provider.implementation } },
|
|
223
|
+
ctx.maxResults,
|
|
224
|
+
);
|
|
225
|
+
if (result.confidence === "unavailable") {
|
|
226
|
+
return { kind: "unavailable", rel, message: "No implementations available" };
|
|
227
|
+
}
|
|
228
|
+
// Filter self-references: LSP returns the declaration itself as an
|
|
229
|
+
// "implementation" for non-interface symbols. Drop the target location.
|
|
230
|
+
const targetLine = ctx.position.line + 1;
|
|
231
|
+
const filtered = result.implementations.filter(
|
|
232
|
+
(impl) => !(impl.file === ctx.file && impl.line === targetLine),
|
|
233
|
+
);
|
|
234
|
+
const rendered = renderImplementationsResult(
|
|
235
|
+
filtered,
|
|
236
|
+
result.externalCount,
|
|
237
|
+
ctx.cwd,
|
|
238
|
+
ctx.maxResults,
|
|
239
|
+
ctx.displayName,
|
|
240
|
+
);
|
|
241
|
+
return {
|
|
242
|
+
kind: "ok",
|
|
243
|
+
rel,
|
|
244
|
+
count: filtered.length,
|
|
245
|
+
content: rendered.content,
|
|
246
|
+
evidenceLists: rendered.evidenceList ? [rendered.evidenceList] : [],
|
|
247
|
+
};
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
async function collectImportsRelation(ctx: CollectionContext): Promise<GraphSection> {
|
|
251
|
+
const rel: GraphRelation = "imports";
|
|
252
|
+
if (!ctx.provider?.imports) {
|
|
253
|
+
return { kind: "unavailable", rel, message: "No structural provider for imports" };
|
|
254
|
+
}
|
|
255
|
+
const importResult = await ctx.provider.imports(ctx.file);
|
|
256
|
+
if (importResult.kind !== "success") {
|
|
257
|
+
return { kind: "unavailable", rel, message: `Imports unavailable: ${importResult.kind}` };
|
|
258
|
+
}
|
|
259
|
+
const flatImports = importResult.data.map((entry) => ({
|
|
260
|
+
moduleSpecifier: entry.moduleSpecifier,
|
|
261
|
+
startLine: entry.startLine,
|
|
262
|
+
}));
|
|
263
|
+
const rendered = renderImportsResult(
|
|
264
|
+
ctx.displayName,
|
|
265
|
+
flatImports,
|
|
266
|
+
toDisplayPath(ctx.cwd, ctx.file),
|
|
267
|
+
ctx.maxResults,
|
|
268
|
+
);
|
|
269
|
+
return {
|
|
270
|
+
kind: "ok",
|
|
271
|
+
rel,
|
|
272
|
+
count: flatImports.length,
|
|
273
|
+
content: rendered.content,
|
|
274
|
+
evidenceLists: rendered.evidenceList ? [rendered.evidenceList] : [],
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
async function collectExportsRelation(ctx: CollectionContext): Promise<GraphSection> {
|
|
279
|
+
const rel: GraphRelation = "exports";
|
|
280
|
+
if (!ctx.provider?.exports) {
|
|
281
|
+
return { kind: "unavailable", rel, message: "No structural provider for exports" };
|
|
282
|
+
}
|
|
283
|
+
const exportResult = await ctx.provider.exports(ctx.file);
|
|
284
|
+
if (exportResult.kind !== "success") {
|
|
285
|
+
return { kind: "unavailable", rel, message: `Exports unavailable: ${exportResult.kind}` };
|
|
286
|
+
}
|
|
287
|
+
const flatExports = exportResult.data.map((entry) => ({
|
|
288
|
+
name: entry.name,
|
|
289
|
+
kind: entry.kind,
|
|
290
|
+
startLine: entry.startLine,
|
|
291
|
+
}));
|
|
292
|
+
const rendered = renderExportsResult(
|
|
293
|
+
ctx.displayName,
|
|
294
|
+
flatExports,
|
|
295
|
+
toDisplayPath(ctx.cwd, ctx.file),
|
|
296
|
+
ctx.maxResults,
|
|
297
|
+
);
|
|
298
|
+
return {
|
|
299
|
+
kind: "ok",
|
|
300
|
+
rel,
|
|
301
|
+
count: flatExports.length,
|
|
302
|
+
content: rendered.content,
|
|
303
|
+
evidenceLists: rendered.evidenceList ? [rendered.evidenceList] : [],
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
async function collectTestsRelation(ctx: CollectionContext): Promise<GraphSection> {
|
|
308
|
+
const rel: GraphRelation = "tests";
|
|
309
|
+
const discovery = await discoverTestFilesForSource(ctx.file, {
|
|
310
|
+
references: ctx.provider?.references,
|
|
311
|
+
outline: ctx.provider?.outline,
|
|
312
|
+
cwd: ctx.cwd,
|
|
313
|
+
cap: ctx.maxResults,
|
|
314
|
+
position: ctx.position,
|
|
315
|
+
});
|
|
316
|
+
const tests = buildTestSurfaceDetails(
|
|
317
|
+
{ status: discovery.kind, provenance: discovery.provenance, files: discovery.files },
|
|
318
|
+
ctx.cwd,
|
|
319
|
+
ctx.maxResults,
|
|
320
|
+
);
|
|
321
|
+
|
|
322
|
+
if (discovery.kind === "unavailable") {
|
|
323
|
+
return {
|
|
324
|
+
kind: "unavailable",
|
|
325
|
+
rel,
|
|
326
|
+
message: "No test provider available — semantic and structural providers are absent",
|
|
327
|
+
tests,
|
|
328
|
+
};
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if (discovery.kind === "empty") {
|
|
332
|
+
return {
|
|
333
|
+
kind: "ok",
|
|
334
|
+
rel,
|
|
335
|
+
count: 0,
|
|
336
|
+
content: `**Tests** — no companion test files found.\n`,
|
|
337
|
+
tests,
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
|
|
341
|
+
const testLines: string[] = [];
|
|
342
|
+
for (const testFile of tests.files.slice(0, 3)) {
|
|
343
|
+
testLines.push(`- \`${testFile.file}\``);
|
|
344
|
+
testLines.push(...renderRankedTestLabelsForMarkdown(testFile.labels, ctx.maxResults));
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
const provenanceNote = `, ${discovery.provenance}`;
|
|
348
|
+
const content = `**Tests** (${discovery.files.length} companion file${discovery.files.length !== 1 ? "s" : ""}${provenanceNote})\n\n${testLines.join("\n")}\n`;
|
|
349
|
+
return { kind: "ok", rel, count: discovery.files.length, content, tests };
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// ── Handler dispatch table ────────────────────────────────────────────
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Handler dispatch table for concrete relation kinds.
|
|
356
|
+
*
|
|
357
|
+
* The `"all"` pseudo-relation is expanded into the individual kinds by
|
|
358
|
+
* {@link expandAllRelations} in execute-graph.ts before iteration, so
|
|
359
|
+
* `collectRelation` is never called with `"all"` at runtime. The table
|
|
360
|
+
* is typed as a partial record to reflect this invariant.
|
|
361
|
+
*/
|
|
362
|
+
const RELATION_HANDLERS: Partial<
|
|
363
|
+
Record<GraphRelation, (ctx: CollectionContext) => Promise<GraphSection>>
|
|
364
|
+
> = {
|
|
365
|
+
references: collectReferencesRelation,
|
|
366
|
+
callees: collectCalleesRelation,
|
|
367
|
+
implements: collectImplementationsRelation,
|
|
368
|
+
imports: collectImportsRelation,
|
|
369
|
+
exports: collectExportsRelation,
|
|
370
|
+
tests: collectTestsRelation,
|
|
371
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tool executor for code_graph.
|
|
3
|
+
*
|
|
4
|
+
* Unified relation-graph tool — replaces code_references, code_calls,
|
|
5
|
+
* and code_implementations. Resolves one target, then dispatches to the
|
|
6
|
+
* appropriate analysis service per requested relation.
|
|
7
|
+
*
|
|
8
|
+
* Thin executor: validates params via pipeline, then delegates to the
|
|
9
|
+
* graph use-case for target resolution, data collection, and rendering.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import type { AnchorKind } from "../../session/target-store.ts";
|
|
13
|
+
import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
14
|
+
import { composeRules, focusedToolRules, requireAtLeastOne } from "../infra/cross-field.ts";
|
|
15
|
+
import { searchErrorResult } from "../infra/error-results.ts";
|
|
16
|
+
import {
|
|
17
|
+
expandTargetId,
|
|
18
|
+
gateCapability,
|
|
19
|
+
resolveScopeParam,
|
|
20
|
+
runPipe,
|
|
21
|
+
validateParams,
|
|
22
|
+
} from "../infra/pipeline.ts";
|
|
23
|
+
import { emitToolProgress } from "../infra/progress.ts";
|
|
24
|
+
import { executeGraph } from "./orchestrate.ts";
|
|
25
|
+
|
|
26
|
+
/** Relation kinds accepted by code_graph. */
|
|
27
|
+
export type GraphRelation =
|
|
28
|
+
| "references"
|
|
29
|
+
| "callees"
|
|
30
|
+
| "imports"
|
|
31
|
+
| "exports"
|
|
32
|
+
| "implements"
|
|
33
|
+
| "tests"
|
|
34
|
+
| "all";
|
|
35
|
+
|
|
36
|
+
export interface CodeGraphToolParams {
|
|
37
|
+
targetId?: string;
|
|
38
|
+
file?: string;
|
|
39
|
+
line?: number;
|
|
40
|
+
character?: number;
|
|
41
|
+
symbol?: string;
|
|
42
|
+
scope?: string;
|
|
43
|
+
relations?: GraphRelation[];
|
|
44
|
+
calleeDepth?: "direct" | "deep";
|
|
45
|
+
maxResults?: number;
|
|
46
|
+
/** Set by pipeline expandTargetId stage. */
|
|
47
|
+
_expandedName?: string | null;
|
|
48
|
+
/** Set by pipeline expandTargetId stage. */
|
|
49
|
+
_expandedAnchorKind?: string | null;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export async function executeGraphTool(
|
|
53
|
+
params: CodeGraphToolParams,
|
|
54
|
+
ctx: CodeIntelToolExecCtx,
|
|
55
|
+
): Promise<CodeIntelResult> {
|
|
56
|
+
emitToolProgress(ctx.onUpdate, "code_graph: resolving target...");
|
|
57
|
+
|
|
58
|
+
return runPipe(
|
|
59
|
+
params,
|
|
60
|
+
ctx,
|
|
61
|
+
[
|
|
62
|
+
expandTargetId((msg) => searchErrorResult(msg)),
|
|
63
|
+
resolveScopeParam((reason) => searchErrorResult(`**Error:** ${reason}`)),
|
|
64
|
+
validateParams(
|
|
65
|
+
composeRules(focusedToolRules(), requireAtLeastOne("file", "symbol", "scope")),
|
|
66
|
+
(msg) => searchErrorResult(msg),
|
|
67
|
+
),
|
|
68
|
+
gateCapability("code_graph"),
|
|
69
|
+
],
|
|
70
|
+
async (p, c) => {
|
|
71
|
+
emitToolProgress(c.onUpdate, "code_graph: collecting relations...");
|
|
72
|
+
return executeGraph(
|
|
73
|
+
{
|
|
74
|
+
targetId: p.targetId,
|
|
75
|
+
file: p.file,
|
|
76
|
+
line: p.line,
|
|
77
|
+
character: p.character,
|
|
78
|
+
symbol: p.symbol,
|
|
79
|
+
scope: p.scope,
|
|
80
|
+
relations: p.relations,
|
|
81
|
+
calleeDepth: p.calleeDepth,
|
|
82
|
+
maxResults: p.maxResults,
|
|
83
|
+
_expandedName: p._expandedName,
|
|
84
|
+
_expandedAnchorKind: p._expandedAnchorKind as AnchorKind | undefined,
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
cwd: c.cwd,
|
|
88
|
+
session: c.session,
|
|
89
|
+
provider: c.session.getProvider(),
|
|
90
|
+
onUpdate: c.onUpdate,
|
|
91
|
+
},
|
|
92
|
+
);
|
|
93
|
+
},
|
|
94
|
+
);
|
|
95
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Implementations markdown renderer — renders semantic implementation locations.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
createEvidenceList,
|
|
7
|
+
type EvidenceListMetadata,
|
|
8
|
+
renderEvidenceListDisclosure,
|
|
9
|
+
} from "../../analysis/evidence.ts";
|
|
10
|
+
import { compactLineRanges } from "../../analysis/references/semantic-refs.ts";
|
|
11
|
+
import { toDisplayPath } from "../../analysis/search/ripgrep.ts";
|
|
12
|
+
import type { ImplementationEntry } from "./types.ts";
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Group implementation entries by display file path, collecting line numbers.
|
|
16
|
+
*/
|
|
17
|
+
function groupByFile(impls: ImplementationEntry[], cwd: string): Map<string, number[]> {
|
|
18
|
+
const byFile = new Map<string, number[]>();
|
|
19
|
+
for (const impl of impls) {
|
|
20
|
+
const displayPath = toDisplayPath(cwd, impl.file);
|
|
21
|
+
const group = byFile.get(displayPath) ?? [];
|
|
22
|
+
group.push(impl.line);
|
|
23
|
+
byFile.set(displayPath, group);
|
|
24
|
+
}
|
|
25
|
+
return byFile;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// biome-ignore lint/complexity/useMaxParams: render function with independent display parameters
|
|
29
|
+
export function renderImplementationsResult(
|
|
30
|
+
impls: ImplementationEntry[],
|
|
31
|
+
externalCount: number,
|
|
32
|
+
cwd: string,
|
|
33
|
+
maxResults: number,
|
|
34
|
+
targetName?: string,
|
|
35
|
+
): { content: string; evidenceList: EvidenceListMetadata | null } {
|
|
36
|
+
const lines: string[] = [];
|
|
37
|
+
lines.push(
|
|
38
|
+
targetName
|
|
39
|
+
? `# Implementations of \`${targetName}\` (semantic)`
|
|
40
|
+
: "# Implementations (semantic)",
|
|
41
|
+
);
|
|
42
|
+
lines.push("");
|
|
43
|
+
if (impls.length > 0) {
|
|
44
|
+
lines.push(`**${impls.length} implementation${impls.length !== 1 ? "s" : ""}** in the project`);
|
|
45
|
+
lines.push("");
|
|
46
|
+
|
|
47
|
+
const evidence = createEvidenceList({
|
|
48
|
+
key: "implements.locations",
|
|
49
|
+
items: impls,
|
|
50
|
+
maxResults,
|
|
51
|
+
});
|
|
52
|
+
const byFile = groupByFile(evidence.items, cwd);
|
|
53
|
+
for (const [file, locations] of byFile) {
|
|
54
|
+
lines.push(`### ${file}`);
|
|
55
|
+
lines.push(`- ${compactLineRanges(locations)}`);
|
|
56
|
+
lines.push("");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const disclosure = renderEvidenceListDisclosure(evidence);
|
|
60
|
+
if (disclosure) {
|
|
61
|
+
lines.push(disclosure);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (externalCount > 0) {
|
|
66
|
+
lines.push(
|
|
67
|
+
`_+${externalCount} external location${externalCount !== 1 ? "s" : ""} (outside this project)_`,
|
|
68
|
+
);
|
|
69
|
+
lines.push("");
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
content: lines.join("\n"),
|
|
74
|
+
evidenceList:
|
|
75
|
+
impls.length > 0
|
|
76
|
+
? createEvidenceList({ key: "implements.locations", items: impls, maxResults }).metadata
|
|
77
|
+
: null,
|
|
78
|
+
};
|
|
79
|
+
}
|