@mrclrchtr/supi-code-intelligence 1.16.0 → 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/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.d.ts +21 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.d.ts +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/package.json +1 -1
- 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,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Semantic implementation lookup — finds implementations of a target.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { ImplementationEntry, RelationsServiceDeps } from "./types.ts";
|
|
6
|
+
|
|
7
|
+
export interface ImplementationsResult {
|
|
8
|
+
kind: "implementations";
|
|
9
|
+
targetName: string;
|
|
10
|
+
implementations: ImplementationEntry[];
|
|
11
|
+
externalCount: number;
|
|
12
|
+
confidence: "semantic" | "unavailable";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Collect implementations for a target file/position using semantic provider.
|
|
17
|
+
*/
|
|
18
|
+
// biome-ignore lint/complexity/useMaxParams: service function with clear positional parameters matching provider contract
|
|
19
|
+
export async function collectImplementations(
|
|
20
|
+
targetFile: string,
|
|
21
|
+
targetPosition: { line: number; character: number },
|
|
22
|
+
targetName: string | null,
|
|
23
|
+
deps: RelationsServiceDeps,
|
|
24
|
+
maxResults?: number,
|
|
25
|
+
): Promise<ImplementationsResult> {
|
|
26
|
+
if (!deps.provider?.implementation) {
|
|
27
|
+
return {
|
|
28
|
+
kind: "implementations",
|
|
29
|
+
targetName: targetName ?? "symbol",
|
|
30
|
+
implementations: [],
|
|
31
|
+
externalCount: 0,
|
|
32
|
+
confidence: "unavailable",
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
const impls = await deps.provider.implementation(targetFile, targetPosition);
|
|
37
|
+
if (!impls) {
|
|
38
|
+
return {
|
|
39
|
+
kind: "implementations",
|
|
40
|
+
targetName: targetName ?? "symbol",
|
|
41
|
+
implementations: [],
|
|
42
|
+
externalCount: 0,
|
|
43
|
+
confidence: "semantic",
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
const project: ImplementationEntry[] = [];
|
|
48
|
+
let externalCount = 0;
|
|
49
|
+
|
|
50
|
+
for (const loc of impls) {
|
|
51
|
+
const uri = loc.uri ?? loc.targetUri ?? "";
|
|
52
|
+
const filePath = uri.startsWith("file://") ? uri.slice(7) : uri;
|
|
53
|
+
const line = (loc.range?.start?.line ?? loc.targetRange?.start?.line ?? 0) + 1;
|
|
54
|
+
|
|
55
|
+
if (filePath?.startsWith(deps.cwd)) {
|
|
56
|
+
project.push({
|
|
57
|
+
file: filePath,
|
|
58
|
+
line,
|
|
59
|
+
character: 0,
|
|
60
|
+
name: targetName,
|
|
61
|
+
});
|
|
62
|
+
} else {
|
|
63
|
+
externalCount++;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
void maxResults;
|
|
68
|
+
|
|
69
|
+
return {
|
|
70
|
+
kind: "implementations",
|
|
71
|
+
targetName: targetName ?? "symbol",
|
|
72
|
+
implementations: project,
|
|
73
|
+
externalCount,
|
|
74
|
+
confidence: "semantic",
|
|
75
|
+
};
|
|
76
|
+
}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
// Relations markdown renderer — consumes use-case data and produces markdown content.
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
createEvidenceList,
|
|
5
|
+
type EvidenceListMetadata,
|
|
6
|
+
renderEvidenceListDisclosure,
|
|
7
|
+
} from "../../analysis/evidence.ts";
|
|
8
|
+
import { type ReadNextItem, renderReadNextSection } from "../../analysis/read-next.ts";
|
|
9
|
+
import type { ReferenceCollection } from "../../analysis/references/semantic-refs.ts";
|
|
10
|
+
import { formatReferenceList } from "../../analysis/references/semantic-refs.ts";
|
|
11
|
+
import type { TestSurfaceDetails } from "../../analysis/tests/test-discovery.ts";
|
|
12
|
+
|
|
13
|
+
// ── Callers ──────────────────────────────────────────────────────────
|
|
14
|
+
|
|
15
|
+
export function renderCallersResult(
|
|
16
|
+
symbolName: string,
|
|
17
|
+
result: ReferenceCollection,
|
|
18
|
+
_cwd: string,
|
|
19
|
+
maxResults: number,
|
|
20
|
+
): string {
|
|
21
|
+
const lines: string[] = [];
|
|
22
|
+
lines.push(`# Callers of \`${symbolName}\``);
|
|
23
|
+
lines.push("");
|
|
24
|
+
lines.push(
|
|
25
|
+
`**${result.refs.length} reference${result.refs.length !== 1 ? "s" : ""}** (${result.confidence})`,
|
|
26
|
+
);
|
|
27
|
+
if (result.externalCount > 0) {
|
|
28
|
+
lines.push(
|
|
29
|
+
`_+${result.externalCount} external reference${result.externalCount !== 1 ? "s" : ""}_`,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
lines.push("");
|
|
33
|
+
|
|
34
|
+
formatReferenceList(lines, result.refs, maxResults);
|
|
35
|
+
return lines.join("\n");
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// ── Callees ──────────────────────────────────────────────────────────
|
|
39
|
+
|
|
40
|
+
export function renderCalleesResult(
|
|
41
|
+
data: {
|
|
42
|
+
enclosingScope: { name: string; startLine?: number; endLine?: number };
|
|
43
|
+
callees: Array<{ name: string; startLine: number }>;
|
|
44
|
+
},
|
|
45
|
+
relPath: string,
|
|
46
|
+
maxResults: number,
|
|
47
|
+
): string {
|
|
48
|
+
const lines: string[] = [];
|
|
49
|
+
lines.push(`# Direct structural calls from \`${data.enclosingScope.name}\``);
|
|
50
|
+
lines.push("");
|
|
51
|
+
lines.push(
|
|
52
|
+
`**${data.callees.length} direct structural call${data.callees.length !== 1 ? "s" : ""}** from enclosing scope \`${data.enclosingScope.name}\`${formatOptionalScopeRange(data.enclosingScope)} in \`${relPath}\``,
|
|
53
|
+
);
|
|
54
|
+
lines.push("");
|
|
55
|
+
lines.push(
|
|
56
|
+
"_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._",
|
|
57
|
+
);
|
|
58
|
+
lines.push("");
|
|
59
|
+
|
|
60
|
+
const evidence = createEvidenceList({
|
|
61
|
+
key: "callees.calls",
|
|
62
|
+
items: data.callees,
|
|
63
|
+
maxResults,
|
|
64
|
+
});
|
|
65
|
+
for (const c of evidence.items) {
|
|
66
|
+
lines.push(`- \`${c.name}\` (L${c.startLine})`);
|
|
67
|
+
}
|
|
68
|
+
const disclosure = renderEvidenceListDisclosure(evidence);
|
|
69
|
+
if (disclosure) {
|
|
70
|
+
lines.push(disclosure);
|
|
71
|
+
}
|
|
72
|
+
lines.push("");
|
|
73
|
+
return lines.join("\n");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
function formatOptionalScopeRange(scope: { startLine?: number; endLine?: number }): string {
|
|
77
|
+
if (!scope.startLine) return "";
|
|
78
|
+
if (!scope.endLine || scope.startLine === scope.endLine) return ` (L${scope.startLine})`;
|
|
79
|
+
return ` (L${scope.startLine}–L${scope.endLine})`;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
// ── Imports ─────────────────────────────────────────────────────────
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* Render imports for a file as a graph section.
|
|
86
|
+
*
|
|
87
|
+
* Imports are file-level structural results from tree-sitter — they show
|
|
88
|
+
* every module specifier that the target file imports.
|
|
89
|
+
*/
|
|
90
|
+
export function renderImportsResult(
|
|
91
|
+
displayName: string,
|
|
92
|
+
imports: Array<{ moduleSpecifier: string; startLine: number }>,
|
|
93
|
+
relPath: string,
|
|
94
|
+
maxResults: number,
|
|
95
|
+
): { content: string; evidenceList: EvidenceListMetadata | null } {
|
|
96
|
+
const lines: string[] = [];
|
|
97
|
+
lines.push(`# Imports of \`${displayName}\` (structural)`);
|
|
98
|
+
lines.push("");
|
|
99
|
+
lines.push(`**${imports.length} import${imports.length !== 1 ? "s" : ""}** in \`${relPath}\``);
|
|
100
|
+
lines.push("");
|
|
101
|
+
|
|
102
|
+
const evidence = createEvidenceList({
|
|
103
|
+
key: "imports.modules",
|
|
104
|
+
items: imports,
|
|
105
|
+
maxResults,
|
|
106
|
+
});
|
|
107
|
+
for (const entry of evidence.items) {
|
|
108
|
+
lines.push(`- \`${entry.moduleSpecifier}\` (L${entry.startLine})`);
|
|
109
|
+
}
|
|
110
|
+
const disclosure = renderEvidenceListDisclosure(evidence);
|
|
111
|
+
if (disclosure) {
|
|
112
|
+
lines.push(disclosure);
|
|
113
|
+
}
|
|
114
|
+
return { content: lines.join("\n"), evidenceList: evidence.metadata };
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// ── Exports ─────────────────────────────────────────────────────────
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Render exports for a file as a graph section.
|
|
121
|
+
*
|
|
122
|
+
* Exports are file-level structural results from tree-sitter — they show
|
|
123
|
+
* every named export from the target file.
|
|
124
|
+
*/
|
|
125
|
+
export function renderExportsResult(
|
|
126
|
+
displayName: string,
|
|
127
|
+
exports: Array<{ name: string; kind: string; startLine: number }>,
|
|
128
|
+
relPath: string,
|
|
129
|
+
maxResults: number,
|
|
130
|
+
): { content: string; evidenceList: EvidenceListMetadata | null } {
|
|
131
|
+
const lines: string[] = [];
|
|
132
|
+
lines.push(`# Exports of \`${displayName}\` (structural)`);
|
|
133
|
+
lines.push("");
|
|
134
|
+
lines.push(`**${exports.length} export${exports.length !== 1 ? "s" : ""}** in \`${relPath}\``);
|
|
135
|
+
lines.push("");
|
|
136
|
+
|
|
137
|
+
const evidence = createEvidenceList({
|
|
138
|
+
key: "exports.symbols",
|
|
139
|
+
items: exports,
|
|
140
|
+
maxResults,
|
|
141
|
+
});
|
|
142
|
+
for (const entry of evidence.items) {
|
|
143
|
+
const kindLabel = entry.kind ? ` (${entry.kind})` : "";
|
|
144
|
+
lines.push(`- \`${entry.name}\`${kindLabel} (L${entry.startLine})`);
|
|
145
|
+
}
|
|
146
|
+
const disclosure = renderEvidenceListDisclosure(evidence);
|
|
147
|
+
if (disclosure) {
|
|
148
|
+
lines.push(disclosure);
|
|
149
|
+
}
|
|
150
|
+
return { content: lines.join("\n"), evidenceList: evidence.metadata };
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
// ── Combined graph ───────────────────────────────────────────────────
|
|
154
|
+
|
|
155
|
+
/** Relation families accepted by code_graph. */
|
|
156
|
+
export type GraphRelationKind =
|
|
157
|
+
| "all"
|
|
158
|
+
| "references"
|
|
159
|
+
| "callees"
|
|
160
|
+
| "imports"
|
|
161
|
+
| "exports"
|
|
162
|
+
| "implements"
|
|
163
|
+
| "tests";
|
|
164
|
+
|
|
165
|
+
/** A section in the combined graph output. */
|
|
166
|
+
export type GraphSection =
|
|
167
|
+
| {
|
|
168
|
+
kind: "ok";
|
|
169
|
+
rel: GraphRelationKind;
|
|
170
|
+
count: number;
|
|
171
|
+
content: string;
|
|
172
|
+
evidenceLists?: EvidenceListMetadata[];
|
|
173
|
+
tests?: TestSurfaceDetails;
|
|
174
|
+
readNext?: ReadNextItem[];
|
|
175
|
+
}
|
|
176
|
+
| { kind: "unavailable"; rel: GraphRelationKind; message: string; tests?: TestSurfaceDetails }
|
|
177
|
+
| {
|
|
178
|
+
kind: "not-implemented";
|
|
179
|
+
rel: GraphRelationKind;
|
|
180
|
+
message: string;
|
|
181
|
+
tests?: TestSurfaceDetails;
|
|
182
|
+
};
|
|
183
|
+
|
|
184
|
+
/**
|
|
185
|
+
* Render a combined graph result from multiple relation sections.
|
|
186
|
+
*
|
|
187
|
+
* Produces a unified markdown output with a summary header, per-section
|
|
188
|
+
* pre-rendered content, and a footer with follow-up hints.
|
|
189
|
+
*/
|
|
190
|
+
export function renderGraphResult(
|
|
191
|
+
displayName: string,
|
|
192
|
+
sections: GraphSection[],
|
|
193
|
+
resolvedFile: string,
|
|
194
|
+
): string {
|
|
195
|
+
const lines: string[] = [];
|
|
196
|
+
|
|
197
|
+
// Header
|
|
198
|
+
lines.push(`# Graph of \`${displayName}\``);
|
|
199
|
+
lines.push("");
|
|
200
|
+
lines.push(`_File: \`${resolvedFile}\`_`);
|
|
201
|
+
lines.push("");
|
|
202
|
+
|
|
203
|
+
// Summary
|
|
204
|
+
const okSections = sections.filter((s) => s.kind === "ok") as Extract<
|
|
205
|
+
GraphSection,
|
|
206
|
+
{ kind: "ok" }
|
|
207
|
+
>[];
|
|
208
|
+
const unavailable = sections.filter((s) => s.kind === "unavailable");
|
|
209
|
+
const notImpl = sections.filter((s) => s.kind === "not-implemented");
|
|
210
|
+
|
|
211
|
+
if (okSections.length > 0) {
|
|
212
|
+
const parts = okSections.map(
|
|
213
|
+
(s) => `**${s.rel}**: ${s.count} result${s.count !== 1 ? "s" : ""}`,
|
|
214
|
+
);
|
|
215
|
+
lines.push(parts.join(" | "));
|
|
216
|
+
lines.push("");
|
|
217
|
+
}
|
|
218
|
+
if (unavailable.length > 0) {
|
|
219
|
+
const names = unavailable.map((s) => `\`${s.rel}\``).join(", ");
|
|
220
|
+
lines.push(`_Unavailable: ${names}_`);
|
|
221
|
+
lines.push("");
|
|
222
|
+
}
|
|
223
|
+
if (notImpl.length > 0) {
|
|
224
|
+
const names = notImpl.map((s) => `\`${s.rel}\``).join(", ");
|
|
225
|
+
lines.push(`_Not yet implemented: ${names}_`);
|
|
226
|
+
lines.push("");
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Per-section content
|
|
230
|
+
for (const section of sections) {
|
|
231
|
+
if (section.kind === "ok") {
|
|
232
|
+
lines.push(section.content);
|
|
233
|
+
lines.push("");
|
|
234
|
+
} else if (section.kind === "unavailable") {
|
|
235
|
+
lines.push(`**${section.rel}**: ${section.message}`);
|
|
236
|
+
lines.push("");
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
lines.push(...renderReadNextSection(okSections.flatMap((section) => section.readNext ?? [])));
|
|
241
|
+
|
|
242
|
+
return lines.join("\n");
|
|
243
|
+
}
|
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Graph orchestration use-case — unified relation-graph data collection.
|
|
3
|
+
*
|
|
4
|
+
* Resolves a target and collects per-relation data (references, callees,
|
|
5
|
+
* imports, exports, implementations, tests) through the code provider.
|
|
6
|
+
* Returns a rendered CodeIntelResult with structured details.
|
|
7
|
+
*
|
|
8
|
+
* Extracted from execute-graph.ts as part of the thin-executor normalization.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import type { CodeProvider } from "../../analysis/provider.ts";
|
|
12
|
+
import { ensureSemanticReadiness } from "../../analysis/readiness.ts";
|
|
13
|
+
import { toDisplayPath } from "../../analysis/search/ripgrep.ts";
|
|
14
|
+
import { resolveTarget } from "../../analysis/target/bridge.ts";
|
|
15
|
+
import type { AnchorKind } from "../../session/target-store.ts";
|
|
16
|
+
import type { CodeIntelResult } from "../../types/index.ts";
|
|
17
|
+
import { searchErrorResult } from "../infra/error-results.ts";
|
|
18
|
+
import { emitToolProgress } from "../infra/progress.ts";
|
|
19
|
+
import { renderSemanticReadinessTimeout } from "../infra/readiness-message.ts";
|
|
20
|
+
import { type CollectRelationOptions, collectRelation } from "./collect-relation.ts";
|
|
21
|
+
import type { GraphRelation } from "./execute.ts";
|
|
22
|
+
import { renderGraphResult } from "./markdown-base.ts";
|
|
23
|
+
|
|
24
|
+
/** Relation kinds accepted by code_graph. */
|
|
25
|
+
export type { GraphRelation };
|
|
26
|
+
|
|
27
|
+
/** Default relation set when none specified. */
|
|
28
|
+
const DEFAULT_RELATIONS: GraphRelation[] = ["references"];
|
|
29
|
+
|
|
30
|
+
/** Relations that need semantic (LSP) readiness. */
|
|
31
|
+
const SEMANTIC_RELATIONS: GraphRelation[] = ["references", "implements"];
|
|
32
|
+
|
|
33
|
+
/** Relations that only need a file path, not a position. */
|
|
34
|
+
const FILE_LEVEL_RELATIONS: GraphRelation[] = ["imports", "exports"];
|
|
35
|
+
|
|
36
|
+
export interface GraphInput {
|
|
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?: AnchorKind;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
export interface GraphDeps {
|
|
53
|
+
cwd: string;
|
|
54
|
+
session: import("../../session/session.ts").WorkspaceCodeIntelligenceSession;
|
|
55
|
+
/** Ready code provider, or null. */
|
|
56
|
+
provider: CodeProvider | null;
|
|
57
|
+
/** Progress callback for long-running relation collection. */
|
|
58
|
+
onUpdate?: import("@earendil-works/pi-coding-agent").AgentToolUpdateCallback;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Execute the graph use-case.
|
|
63
|
+
*
|
|
64
|
+
* Resolves the target and collects all requested relations. The caller
|
|
65
|
+
* (tool executor) has already validated params, expanded targetId, and
|
|
66
|
+
* gated on capability availability.
|
|
67
|
+
*/
|
|
68
|
+
export async function executeGraph(input: GraphInput, deps: GraphDeps): Promise<CodeIntelResult> {
|
|
69
|
+
const requestedRelations = input.relations ?? DEFAULT_RELATIONS;
|
|
70
|
+
const relations = expandAllRelations(requestedRelations);
|
|
71
|
+
|
|
72
|
+
// Semantic readiness — degrades per-relation rather than blocking.
|
|
73
|
+
const requestedSemantic = relations.some((r) => SEMANTIC_RELATIONS.includes(r));
|
|
74
|
+
let semanticReadinessError: string | null = null;
|
|
75
|
+
if (requestedSemantic) {
|
|
76
|
+
const readiness = await ensureSemanticReadiness(
|
|
77
|
+
deps.cwd,
|
|
78
|
+
input.file ? { kind: "file", file: input.file } : { kind: "workspace" },
|
|
79
|
+
);
|
|
80
|
+
if (readiness.kind === "timeout") {
|
|
81
|
+
semanticReadinessError = renderSemanticReadinessTimeout("code_graph", 15_000);
|
|
82
|
+
} else if (readiness.kind === "unavailable") {
|
|
83
|
+
semanticReadinessError =
|
|
84
|
+
"No analysis provider is available for this workspace. Check `code_health` for LSP and tree-sitter status.";
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const allFileLevel =
|
|
89
|
+
relations.length > 0 && relations.every((r) => FILE_LEVEL_RELATIONS.includes(r));
|
|
90
|
+
|
|
91
|
+
// Resolve target
|
|
92
|
+
const target = await resolveGraphTarget(input, deps, allFileLevel);
|
|
93
|
+
if ("content" in target) return target;
|
|
94
|
+
|
|
95
|
+
const { resolvedFile, resolvedPosition, displayName, resolvedAnchorKind } = target;
|
|
96
|
+
const resolvedDisplayFile = toDisplayPath(deps.cwd, resolvedFile);
|
|
97
|
+
|
|
98
|
+
// Collect results per relation
|
|
99
|
+
const sections = [];
|
|
100
|
+
const maxResults = input.maxResults ?? 8;
|
|
101
|
+
|
|
102
|
+
emitToolProgress(deps.onUpdate, `code_graph: collecting ${relations.length} relation(s)...`);
|
|
103
|
+
|
|
104
|
+
for (const rel of relations) {
|
|
105
|
+
if (relations.length > 1) {
|
|
106
|
+
emitToolProgress(deps.onUpdate, `code_graph: ${rel}...`);
|
|
107
|
+
}
|
|
108
|
+
const opts: CollectRelationOptions = {
|
|
109
|
+
file: resolvedFile,
|
|
110
|
+
position: resolvedPosition,
|
|
111
|
+
displayName,
|
|
112
|
+
cwd: deps.cwd,
|
|
113
|
+
provider: deps.provider,
|
|
114
|
+
maxResults,
|
|
115
|
+
semanticReadinessError,
|
|
116
|
+
anchorKind: resolvedAnchorKind,
|
|
117
|
+
calleeDepth: input.calleeDepth,
|
|
118
|
+
};
|
|
119
|
+
const section = await collectRelation(rel, opts);
|
|
120
|
+
sections.push(section);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Render combined output
|
|
124
|
+
return buildGraphResult(displayName, sections, resolvedDisplayFile, input.scope);
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// ── Target resolution ─────────────────────────────────────────────────
|
|
128
|
+
|
|
129
|
+
interface ResolvedGraphTarget {
|
|
130
|
+
resolvedFile: string;
|
|
131
|
+
resolvedPosition: { line: number; character: number };
|
|
132
|
+
displayName: string;
|
|
133
|
+
resolvedAnchorKind: AnchorKind;
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
async function resolveGraphTarget(
|
|
137
|
+
input: GraphInput,
|
|
138
|
+
deps: GraphDeps,
|
|
139
|
+
allFileLevel: boolean,
|
|
140
|
+
): Promise<ResolvedGraphTarget | CodeIntelResult> {
|
|
141
|
+
if (allFileLevel) {
|
|
142
|
+
return resolveFileLevelTarget(input, deps);
|
|
143
|
+
}
|
|
144
|
+
return resolvePositionAnchoredTarget(input, deps);
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
async function resolveFileLevelTarget(
|
|
148
|
+
input: GraphInput,
|
|
149
|
+
deps: GraphDeps,
|
|
150
|
+
): Promise<ResolvedGraphTarget | CodeIntelResult> {
|
|
151
|
+
if (input.file) {
|
|
152
|
+
return {
|
|
153
|
+
resolvedFile: input.file,
|
|
154
|
+
resolvedPosition: { line: 1, character: 1 },
|
|
155
|
+
displayName: toDisplayPath(deps.cwd, input.file),
|
|
156
|
+
resolvedAnchorKind: "name",
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
if (input.symbol) {
|
|
161
|
+
const target = await resolveTarget(
|
|
162
|
+
{ symbol: input.symbol, path: input.scope },
|
|
163
|
+
deps.cwd,
|
|
164
|
+
deps.provider ?? undefined,
|
|
165
|
+
);
|
|
166
|
+
if (typeof target === "string") return searchErrorResult(target);
|
|
167
|
+
if ("targets" in target) {
|
|
168
|
+
return searchErrorResult(
|
|
169
|
+
"**Error:** `code_graph` requires a precise target for file-level relations. Use `file` or `targetId` from `code_resolve`.",
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
return {
|
|
173
|
+
resolvedFile: target.file,
|
|
174
|
+
resolvedPosition: { line: 1, character: 1 },
|
|
175
|
+
displayName: toDisplayPath(deps.cwd, target.file),
|
|
176
|
+
resolvedAnchorKind: "name",
|
|
177
|
+
};
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
if (input.scope) {
|
|
181
|
+
return searchErrorResult(
|
|
182
|
+
"**Error:** `code_graph` file-level relations require a `file` or `symbol`, not just `scope`.",
|
|
183
|
+
);
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
return searchErrorResult("**Error:** `code_graph` requires a target for file-level relations.");
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
async function resolvePositionAnchoredTarget(
|
|
190
|
+
input: GraphInput,
|
|
191
|
+
deps: GraphDeps,
|
|
192
|
+
): Promise<ResolvedGraphTarget | CodeIntelResult> {
|
|
193
|
+
const target = await resolveTarget(
|
|
194
|
+
{
|
|
195
|
+
file: input.file,
|
|
196
|
+
line: input.line,
|
|
197
|
+
character: input.character,
|
|
198
|
+
symbol: input.symbol,
|
|
199
|
+
path: input.scope,
|
|
200
|
+
},
|
|
201
|
+
deps.cwd,
|
|
202
|
+
deps.provider ?? undefined,
|
|
203
|
+
);
|
|
204
|
+
if (typeof target === "string") return searchErrorResult(target);
|
|
205
|
+
|
|
206
|
+
if ("targets" in target) {
|
|
207
|
+
return searchErrorResult(
|
|
208
|
+
"**Error:** `code_graph` requires a precise target. Use anchored coordinates (`file`, `line`, `character`), `symbol`, or pass a `targetId` from `code_resolve`.",
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
const resolvedAnchorKind = input._expandedAnchorKind ?? target.anchorKind;
|
|
213
|
+
const displayName =
|
|
214
|
+
input._expandedName ??
|
|
215
|
+
target.name ??
|
|
216
|
+
`symbol at ${toDisplayPath(deps.cwd, target.file)}:${target.displayLine}`;
|
|
217
|
+
|
|
218
|
+
return {
|
|
219
|
+
resolvedFile: target.file,
|
|
220
|
+
resolvedPosition: target.position,
|
|
221
|
+
displayName,
|
|
222
|
+
resolvedAnchorKind,
|
|
223
|
+
};
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// ── Result assembly ───────────────────────────────────────────────────
|
|
227
|
+
|
|
228
|
+
function buildGraphResult(
|
|
229
|
+
displayName: string,
|
|
230
|
+
sections: Awaited<ReturnType<typeof collectRelation>>[],
|
|
231
|
+
resolvedDisplayFile: string,
|
|
232
|
+
scope: string | undefined,
|
|
233
|
+
): CodeIntelResult {
|
|
234
|
+
const content = renderGraphResult(displayName, sections, resolvedDisplayFile);
|
|
235
|
+
|
|
236
|
+
const hasStructural = sections.some(
|
|
237
|
+
(s) =>
|
|
238
|
+
s.kind === "ok" &&
|
|
239
|
+
(s.rel === "callees" ||
|
|
240
|
+
s.rel === "imports" ||
|
|
241
|
+
s.rel === "exports" ||
|
|
242
|
+
(s.rel === "tests" && s.count > 0)),
|
|
243
|
+
);
|
|
244
|
+
const hasSemantic = sections.some(
|
|
245
|
+
(s) => s.kind === "ok" && (s.rel === "references" || s.rel === "implements"),
|
|
246
|
+
);
|
|
247
|
+
const confidence = hasSemantic ? "semantic" : hasStructural ? "structural" : "unavailable";
|
|
248
|
+
|
|
249
|
+
const tests = sections.find((section) => section.rel === "tests")?.tests;
|
|
250
|
+
const evidenceLists = sections.flatMap((section) =>
|
|
251
|
+
section.kind === "ok" ? (section.evidenceLists ?? []) : [],
|
|
252
|
+
);
|
|
253
|
+
const omittedCount = evidenceLists.reduce(
|
|
254
|
+
(sum, evidenceList) => sum + (evidenceList.omittedCount ?? 0),
|
|
255
|
+
0,
|
|
256
|
+
);
|
|
257
|
+
|
|
258
|
+
return {
|
|
259
|
+
content,
|
|
260
|
+
details: {
|
|
261
|
+
type: "search",
|
|
262
|
+
data: {
|
|
263
|
+
confidence,
|
|
264
|
+
scope: scope ?? null,
|
|
265
|
+
candidateCount: sections.reduce((sum, s) => (s.kind === "ok" ? sum + s.count : sum), 0),
|
|
266
|
+
omittedCount,
|
|
267
|
+
evidenceLists,
|
|
268
|
+
nextQueries: [
|
|
269
|
+
"`code_orientation` on individual results for deeper orientation",
|
|
270
|
+
"`code_impact` for impact analysis",
|
|
271
|
+
],
|
|
272
|
+
tests,
|
|
273
|
+
},
|
|
274
|
+
},
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// ── Helpers ───────────────────────────────────────────────────────────
|
|
279
|
+
|
|
280
|
+
function expandAllRelations(relations: GraphRelation[]): GraphRelation[] {
|
|
281
|
+
if (!relations.includes("all")) {
|
|
282
|
+
return relations;
|
|
283
|
+
}
|
|
284
|
+
return ["references", "callees", "imports", "exports", "implements", "tests"];
|
|
285
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* References markdown renderer — labels results as references/usages, not callers.
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { EvidenceListMetadata } from "../../analysis/evidence.ts";
|
|
6
|
+
import { formatReferenceList } from "../../analysis/references/semantic-refs.ts";
|
|
7
|
+
import { toDisplayPath } from "../../analysis/search/ripgrep.ts";
|
|
8
|
+
import type { ReferenceEntry } from "./types.ts";
|
|
9
|
+
|
|
10
|
+
// biome-ignore lint/complexity/useMaxParams: render function with independent display parameters
|
|
11
|
+
export function renderReferencesResult(
|
|
12
|
+
symbolName: string,
|
|
13
|
+
refs: ReferenceEntry[],
|
|
14
|
+
externalCount: number,
|
|
15
|
+
confidence: string,
|
|
16
|
+
cwd: string,
|
|
17
|
+
maxResults: number,
|
|
18
|
+
): { content: string; evidenceList: EvidenceListMetadata | null } {
|
|
19
|
+
const lines: string[] = [];
|
|
20
|
+
lines.push(`# References of \`${symbolName}\``);
|
|
21
|
+
lines.push("");
|
|
22
|
+
lines.push(`**${refs.length} reference${refs.length !== 1 ? "s" : ""}** (${confidence})`);
|
|
23
|
+
if (externalCount > 0) {
|
|
24
|
+
lines.push(`_+${externalCount} external reference${externalCount !== 1 ? "s" : ""}_`);
|
|
25
|
+
}
|
|
26
|
+
lines.push("");
|
|
27
|
+
|
|
28
|
+
const refLines: Array<{ file: string; line: number }> = refs.map((r) => ({
|
|
29
|
+
file: toDisplayPath(cwd, r.file),
|
|
30
|
+
line: r.line,
|
|
31
|
+
}));
|
|
32
|
+
const evidenceList = formatReferenceList(lines, refLines, maxResults);
|
|
33
|
+
return { content: lines.join("\n"), evidenceList };
|
|
34
|
+
}
|