@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,156 @@
|
|
|
1
|
+
import * as fs from "node:fs";
|
|
2
|
+
import * as path from "node:path";
|
|
3
|
+
import { createEvidenceList } from "../../analysis/evidence.ts";
|
|
4
|
+
import { normalizePath } from "../../analysis/search/ripgrep.ts";
|
|
5
|
+
import { gatherNearbyDiagnostics, gatherTreeSitterContext } from "../../ui/markdown/gather.ts";
|
|
6
|
+
import type { InspectDeps, InspectInput, InspectUseCaseResult } from "../../ui/markdown/types.ts";
|
|
7
|
+
import { renderInspectResult } from "./markdown.ts";
|
|
8
|
+
|
|
9
|
+
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: inspect orchestration keeps data gathering and unavailable-section derivation in one place
|
|
10
|
+
export async function executeInspect(
|
|
11
|
+
input: InspectInput,
|
|
12
|
+
deps: InspectDeps,
|
|
13
|
+
): Promise<InspectUseCaseResult> {
|
|
14
|
+
const resolvedFile = normalizePath(input.file, deps.cwd);
|
|
15
|
+
if (!fs.existsSync(resolvedFile)) {
|
|
16
|
+
const relTarget = `${input.file}:${input.line}:${input.character}`;
|
|
17
|
+
return {
|
|
18
|
+
content: `**Error:** File not found: \`${input.file}\``,
|
|
19
|
+
details: {
|
|
20
|
+
confidence: "unavailable",
|
|
21
|
+
focusTarget: relTarget,
|
|
22
|
+
unavailableSections: ["syntax", "hover", "definition", "diagnostics", "codeActions"],
|
|
23
|
+
nextQueries: ["Use `code_health` to inspect provider state"],
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const relPath = path.relative(deps.cwd, resolvedFile);
|
|
29
|
+
const context = await gatherTreeSitterContext(
|
|
30
|
+
deps.provider,
|
|
31
|
+
relPath,
|
|
32
|
+
input.line,
|
|
33
|
+
input.character,
|
|
34
|
+
);
|
|
35
|
+
const diagnostics = await gatherNearbyDiagnostics(
|
|
36
|
+
deps.cwd,
|
|
37
|
+
relPath,
|
|
38
|
+
input.line,
|
|
39
|
+
input.maxResults ?? 5,
|
|
40
|
+
deps.lspService,
|
|
41
|
+
);
|
|
42
|
+
const enclosing = context.outline.find(
|
|
43
|
+
(item) => item.startLine <= input.line && item.endLine >= input.line,
|
|
44
|
+
);
|
|
45
|
+
const definitions = (context.definition ?? []).map((def) => {
|
|
46
|
+
const absFile = def.uri.startsWith("file://") ? decodeURIComponent(def.uri.slice(7)) : def.uri;
|
|
47
|
+
return {
|
|
48
|
+
file: path.relative(deps.cwd, absFile),
|
|
49
|
+
line: def.range.start.line + 1,
|
|
50
|
+
character: def.range.start.character + 1,
|
|
51
|
+
};
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const unavailableSections: string[] = [];
|
|
55
|
+
if (!context.nodeInfo && context.outline.length === 0) unavailableSections.push("syntax");
|
|
56
|
+
if (!context.hover && deps.provider?.hover == null) unavailableSections.push("hover");
|
|
57
|
+
if (definitions.length === 0 && deps.provider?.definition == null)
|
|
58
|
+
unavailableSections.push("definition");
|
|
59
|
+
if (diagnostics.length === 0 && deps.lspService.kind !== "ready")
|
|
60
|
+
unavailableSections.push("diagnostics");
|
|
61
|
+
if ((context.codeActions?.length ?? 0) === 0 && deps.provider?.codeActionTitles == null) {
|
|
62
|
+
unavailableSections.push("codeActions");
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (
|
|
66
|
+
!context.nodeInfo &&
|
|
67
|
+
!enclosing &&
|
|
68
|
+
!context.hover &&
|
|
69
|
+
definitions.length === 0 &&
|
|
70
|
+
diagnostics.length === 0 &&
|
|
71
|
+
(context.codeActions?.length ?? 0) === 0
|
|
72
|
+
) {
|
|
73
|
+
unavailableSections.push("providers");
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
const confidence = deriveConfidence({
|
|
77
|
+
hasSemantic: Boolean(
|
|
78
|
+
context.hover || definitions.length > 0 || (context.codeActions?.length ?? 0) > 0,
|
|
79
|
+
),
|
|
80
|
+
hasStructural: Boolean(context.nodeInfo || enclosing),
|
|
81
|
+
hasDiagnostics: diagnostics.length > 0,
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const maxResults = input.maxResults ?? 5;
|
|
85
|
+
const codeActions = createEvidenceList({
|
|
86
|
+
key: "inspect.codeActions",
|
|
87
|
+
items: context.codeActions ?? [],
|
|
88
|
+
maxResults,
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
const nextQueries = buildNextQueries(relPath, input.line, input.character, confidence);
|
|
92
|
+
const content = renderInspectResult({
|
|
93
|
+
relPath,
|
|
94
|
+
line: input.line,
|
|
95
|
+
character: input.character,
|
|
96
|
+
confidence,
|
|
97
|
+
node: context.nodeInfo,
|
|
98
|
+
enclosingSymbol: enclosing
|
|
99
|
+
? {
|
|
100
|
+
name: enclosing.name,
|
|
101
|
+
kind: enclosing.kind,
|
|
102
|
+
startLine: enclosing.startLine,
|
|
103
|
+
endLine: enclosing.endLine,
|
|
104
|
+
}
|
|
105
|
+
: null,
|
|
106
|
+
hover: context.hover?.contents ?? null,
|
|
107
|
+
definitions,
|
|
108
|
+
diagnostics,
|
|
109
|
+
codeActions: codeActions.items,
|
|
110
|
+
codeActionEvidence: codeActions.metadata,
|
|
111
|
+
unavailableSections: dedupe(unavailableSections),
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
return {
|
|
115
|
+
content,
|
|
116
|
+
details: {
|
|
117
|
+
confidence,
|
|
118
|
+
focusTarget: `${relPath}:${input.line}:${input.character}`,
|
|
119
|
+
unavailableSections: dedupe(unavailableSections),
|
|
120
|
+
evidenceLists: [codeActions.metadata],
|
|
121
|
+
nextQueries,
|
|
122
|
+
},
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
function deriveConfidence(input: {
|
|
127
|
+
hasSemantic: boolean;
|
|
128
|
+
hasStructural: boolean;
|
|
129
|
+
hasDiagnostics: boolean;
|
|
130
|
+
}): "semantic" | "structural" | "unavailable" {
|
|
131
|
+
if (input.hasSemantic || input.hasDiagnostics) return "semantic";
|
|
132
|
+
if (input.hasStructural) return "structural";
|
|
133
|
+
return "unavailable";
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function buildNextQueries(
|
|
137
|
+
relPath: string,
|
|
138
|
+
line: number,
|
|
139
|
+
character: number,
|
|
140
|
+
confidence: "semantic" | "structural" | "unavailable",
|
|
141
|
+
): string[] {
|
|
142
|
+
const next = [
|
|
143
|
+
`\`code_graph\`, \`file: "${relPath}"\`, \`line: ${line}\`, and \`character: ${character}\` for relationships`,
|
|
144
|
+
`\`code_orientation\` with \`focus: "${relPath}"\` for broader orientation`,
|
|
145
|
+
];
|
|
146
|
+
if (confidence === "unavailable") {
|
|
147
|
+
next.push("Use `code_health` to inspect provider state");
|
|
148
|
+
} else {
|
|
149
|
+
next.push("Use `code_health` when you need provider or diagnostic status");
|
|
150
|
+
}
|
|
151
|
+
return next;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
function dedupe(values: string[]): string[] {
|
|
155
|
+
return [...new Set(values)];
|
|
156
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TUI renderer for code_inspect — renderCall + renderResult.
|
|
3
|
+
*/
|
|
4
|
+
import type { Theme } from "@earendil-works/pi-coding-agent";
|
|
5
|
+
import { Text } from "@earendil-works/pi-tui";
|
|
6
|
+
import { type ResultOptios, renderSimpleResult, type ToolResult } from "../../ui/tui/common.ts";
|
|
7
|
+
|
|
8
|
+
/** ── renderCall ────────────────────────────────────────────────── */
|
|
9
|
+
|
|
10
|
+
export function renderInspectCall(args: unknown, theme: Theme, _context: unknown): Text {
|
|
11
|
+
const params = (args ?? {}) as { file?: string; line?: number; character?: number };
|
|
12
|
+
|
|
13
|
+
let content = theme.fg("toolTitle", "code_inspect");
|
|
14
|
+
|
|
15
|
+
if (params.file) {
|
|
16
|
+
const file = params.file.split("/").pop() ?? params.file;
|
|
17
|
+
content += ` ${theme.fg("accent", file)}`;
|
|
18
|
+
if (params.line) {
|
|
19
|
+
content += theme.fg("warning", `:${params.line}`);
|
|
20
|
+
if (params.character) content += theme.fg("dim", `:${params.character}`);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
return new Text(content, 0, 0);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/** ── renderResult ──────────────────────────────────────────────── */
|
|
28
|
+
|
|
29
|
+
export function renderInspectResult(
|
|
30
|
+
result: ToolResult,
|
|
31
|
+
options: ResultOptios,
|
|
32
|
+
theme: Theme,
|
|
33
|
+
_context: unknown,
|
|
34
|
+
): ReturnType<typeof renderSimpleResult> {
|
|
35
|
+
return renderSimpleResult(result, options, theme, "Inspecting…");
|
|
36
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared context dependency assembly for code_orientation.
|
|
3
|
+
*
|
|
4
|
+
* Used by both the precise-target and orientation-mode execution paths
|
|
5
|
+
* to build the provider/model/LSP deps needed by the use-case layer.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { buildArchitectureModel } from "../../analysis/architecture/discovery.ts";
|
|
9
|
+
import type { CodeProvider } from "../../analysis/provider.ts";
|
|
10
|
+
import { ensureSemanticReadiness } from "../../analysis/readiness.ts";
|
|
11
|
+
import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
12
|
+
import type { OrientationDeps as UseCaseOrientationDeps } from "../../ui/markdown/types.ts";
|
|
13
|
+
import { unavailableContextDetails } from "../infra/error-results.ts";
|
|
14
|
+
import { renderSemanticReadinessTimeout } from "../infra/readiness-message.ts";
|
|
15
|
+
import type { CodeOrientationToolParams } from "./execute.ts";
|
|
16
|
+
|
|
17
|
+
/** Shared context dependencies (provider/model/lsp) or a readiness error result. */
|
|
18
|
+
export type OrientationDeps = Omit<UseCaseOrientationDeps, "cwd"> | CodeIntelResult;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Assemble provider deps and architecture model for the use-case layer.
|
|
22
|
+
*
|
|
23
|
+
* If the semantic provider is not ready and a precise target is requested,
|
|
24
|
+
* gates behind readiness (which may timeout). Returns a CodeIntelResult
|
|
25
|
+
* on timeout or the assembled deps on success.
|
|
26
|
+
*/
|
|
27
|
+
export async function prepareOrientationDeps(
|
|
28
|
+
params: CodeOrientationToolParams,
|
|
29
|
+
ctx: CodeIntelToolExecCtx,
|
|
30
|
+
): Promise<OrientationDeps> {
|
|
31
|
+
const readinessResult = await gateSemanticReadiness(params, ctx.cwd);
|
|
32
|
+
if (readinessResult) return readinessResult;
|
|
33
|
+
|
|
34
|
+
const providerState = ctx.session.getProviders();
|
|
35
|
+
const provider: CodeProvider | null =
|
|
36
|
+
providerState.kind === "ready" ? providerState.provider : null;
|
|
37
|
+
const lspService =
|
|
38
|
+
providerState.kind === "ready"
|
|
39
|
+
? providerState.lspService
|
|
40
|
+
: { kind: "unavailable" as const, reason: "No provider" };
|
|
41
|
+
const model = await buildArchitectureModel(ctx.cwd);
|
|
42
|
+
return { model, provider, lspService };
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async function gateSemanticReadiness(
|
|
46
|
+
params: CodeOrientationToolParams,
|
|
47
|
+
cwd: string,
|
|
48
|
+
): Promise<CodeIntelResult | null> {
|
|
49
|
+
const hasSemanticTarget = params.file != null && params.line != null && params.character != null;
|
|
50
|
+
if (!hasSemanticTarget) return null;
|
|
51
|
+
|
|
52
|
+
const readiness = await ensureSemanticReadiness(
|
|
53
|
+
cwd,
|
|
54
|
+
params.file ? { kind: "file", file: params.file } : { kind: "workspace" },
|
|
55
|
+
);
|
|
56
|
+
if (readiness.kind === "timeout") {
|
|
57
|
+
return {
|
|
58
|
+
content: renderSemanticReadinessTimeout("code_orientation", 15_000),
|
|
59
|
+
details: unavailableContextDetails(["Retry shortly or check `code_health`"]),
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
return null;
|
|
63
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* code_orientation tool executor.
|
|
3
|
+
*
|
|
4
|
+
* Thin orchestrator: dispatches to precise-target resolution or
|
|
5
|
+
* orientation-mode depending on whether targetId/coordinates or
|
|
6
|
+
* a plain focus is provided.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
10
|
+
import { runOrientationMode } from "./mode.ts";
|
|
11
|
+
import { resolvePreciseTarget } from "./precise-target.ts";
|
|
12
|
+
|
|
13
|
+
export interface CodeOrientationToolParams {
|
|
14
|
+
/** Workspace-relative path or discovered module name for orientation. */
|
|
15
|
+
focus?: string;
|
|
16
|
+
/** Resolved target handle from code_resolve. Wins over focus/coordinates. */
|
|
17
|
+
targetId?: string;
|
|
18
|
+
/** 1-based line for symbol orientation. Requires focus. */
|
|
19
|
+
line?: number;
|
|
20
|
+
/** 1-based UTF-16 column for symbol orientation. Requires focus and line. */
|
|
21
|
+
character?: number;
|
|
22
|
+
/** Maximum results per rendered list. Defaults to 10. */
|
|
23
|
+
maxResults?: number;
|
|
24
|
+
// Internal-only expansion fields populated from targetId or coordinate resolution.
|
|
25
|
+
file?: string;
|
|
26
|
+
targetName?: string | null;
|
|
27
|
+
targetKind?: string | null;
|
|
28
|
+
targetAnchorKind?: "name" | "declaration";
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Execute the public code_orientation tool.
|
|
33
|
+
*
|
|
34
|
+
* When `targetId` or `line`/`character` coordinates are provided,
|
|
35
|
+
* resolves a precise symbol target and runs symbol-centered sections.
|
|
36
|
+
* Otherwise runs project/module/directory/file orientation mode.
|
|
37
|
+
*/
|
|
38
|
+
export async function executeOrientationTool(
|
|
39
|
+
params: CodeOrientationToolParams,
|
|
40
|
+
ctx: CodeIntelToolExecCtx,
|
|
41
|
+
): Promise<CodeIntelResult> {
|
|
42
|
+
const hasCoords = params.line !== undefined || params.character !== undefined;
|
|
43
|
+
const hasTargetId = params.targetId !== undefined && params.targetId !== null;
|
|
44
|
+
|
|
45
|
+
if (hasTargetId || hasCoords) {
|
|
46
|
+
const outcome = await resolvePreciseTarget(params, ctx, hasCoords);
|
|
47
|
+
if (outcome.kind === "resolved") return outcome.result;
|
|
48
|
+
}
|
|
49
|
+
return runOrientationMode(params, ctx);
|
|
50
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ReadNextItem, renderReadNextSection } from "../../analysis/read-next.ts";
|
|
2
|
+
import type { OrientationSection } from "../../ui/markdown/types.ts";
|
|
3
|
+
|
|
4
|
+
export interface RenderedOrientationSection {
|
|
5
|
+
key: OrientationSection;
|
|
6
|
+
title: string;
|
|
7
|
+
lines: string[];
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface RenderOrientationParams {
|
|
11
|
+
focusTarget: string | null;
|
|
12
|
+
sections: RenderedOrientationSection[];
|
|
13
|
+
readNext?: ReadNextItem[];
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Render a symbol-centered code_orientation result into markdown. */
|
|
17
|
+
export function renderOrientationResult(params: RenderOrientationParams): string {
|
|
18
|
+
const lines: string[] = ["# Code Orientation", ""];
|
|
19
|
+
|
|
20
|
+
if (params.focusTarget) {
|
|
21
|
+
lines.push("## Focus", `- \`${params.focusTarget}\``, "");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
for (const section of params.sections) {
|
|
25
|
+
lines.push(`## ${section.title}`);
|
|
26
|
+
if (section.lines.length > 0) {
|
|
27
|
+
lines.push(...section.lines);
|
|
28
|
+
}
|
|
29
|
+
lines.push("");
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
lines.push(...renderReadNextSection(params.readNext ?? []));
|
|
33
|
+
|
|
34
|
+
return lines.join("\n");
|
|
35
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orientation-mode execution for code_orientation.
|
|
3
|
+
*
|
|
4
|
+
* Runs the non-target path: validates/resolves the focus parameter
|
|
5
|
+
* and delegates to the use-case layer for project/module/directory/file
|
|
6
|
+
* orientation.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import { existsSync } from "node:fs";
|
|
10
|
+
import type { ArchitectureModel } from "../../analysis/architecture/model.ts";
|
|
11
|
+
import { normalizePath } from "../../analysis/search/ripgrep.ts";
|
|
12
|
+
import type { CodeIntelResult, CodeIntelToolExecCtx } from "../../types/index.ts";
|
|
13
|
+
import { unavailableContextDetails } from "../infra/error-results.ts";
|
|
14
|
+
import { prepareOrientationDeps } from "./deps.ts";
|
|
15
|
+
import type { CodeOrientationToolParams } from "./execute.ts";
|
|
16
|
+
import { executeOrientation } from "./orchestrate.ts";
|
|
17
|
+
|
|
18
|
+
/** Track which cwds have already shown git context in this session. */
|
|
19
|
+
const shownGitContextCwds = new Set<string>();
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Run orientation mode: validate/resolve focus and produce a
|
|
23
|
+
* project/module/directory/file brief through the use-case layer.
|
|
24
|
+
*/
|
|
25
|
+
export async function runOrientationMode(
|
|
26
|
+
params: CodeOrientationToolParams,
|
|
27
|
+
ctx: CodeIntelToolExecCtx,
|
|
28
|
+
): Promise<CodeIntelResult> {
|
|
29
|
+
const deps = await prepareOrientationDeps(params, ctx);
|
|
30
|
+
if ("content" in deps) return deps;
|
|
31
|
+
|
|
32
|
+
const focusResolution = resolveOrientationFocus(params.focus, ctx.cwd, deps.model);
|
|
33
|
+
if (focusResolution.kind === "error") {
|
|
34
|
+
return {
|
|
35
|
+
content: `**Error:** ${focusResolution.reason}`,
|
|
36
|
+
details: unavailableContextDetails([
|
|
37
|
+
"Provide a workspace-relative path or a discovered module name as `focus`",
|
|
38
|
+
]),
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const showGitContext = !shownGitContextCwds.has(ctx.cwd);
|
|
43
|
+
shownGitContextCwds.add(ctx.cwd);
|
|
44
|
+
|
|
45
|
+
const result = await executeOrientation(
|
|
46
|
+
{
|
|
47
|
+
focus: focusResolution.path,
|
|
48
|
+
maxResults: params.maxResults ?? 10,
|
|
49
|
+
showGitContext,
|
|
50
|
+
},
|
|
51
|
+
{ ...deps, cwd: ctx.cwd },
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
return { content: result.content, details: { type: "context", data: result.details } };
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Resolve a focus string to a concrete filesystem path or discovered
|
|
59
|
+
* module root. Returns an error reason when the focus is ambiguous or
|
|
60
|
+
* not found.
|
|
61
|
+
*/
|
|
62
|
+
function resolveOrientationFocus(
|
|
63
|
+
focus: string | undefined,
|
|
64
|
+
cwd: string,
|
|
65
|
+
model: ArchitectureModel | null,
|
|
66
|
+
): { kind: "ok"; path: string | undefined } | { kind: "error"; reason: string } {
|
|
67
|
+
if (!focus) return { kind: "ok", path: undefined };
|
|
68
|
+
|
|
69
|
+
const pathCandidate = normalizePath(focus, cwd);
|
|
70
|
+
if (existsSync(pathCandidate)) return { kind: "ok", path: pathCandidate };
|
|
71
|
+
|
|
72
|
+
const matches =
|
|
73
|
+
model?.modules.filter(
|
|
74
|
+
(mod) => mod.name === focus || mod.name.replace(/^@[^/]+\//, "") === focus,
|
|
75
|
+
) ?? [];
|
|
76
|
+
if (matches.length === 1) return { kind: "ok", path: matches[0].root };
|
|
77
|
+
if (matches.length > 1) {
|
|
78
|
+
const candidates = matches
|
|
79
|
+
.map((mod) => `\`${mod.name}\` at \`${mod.relativePath}\``)
|
|
80
|
+
.join(", ");
|
|
81
|
+
return { kind: "error", reason: `Focus is ambiguous: ${candidates}` };
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return {
|
|
85
|
+
kind: "error",
|
|
86
|
+
reason: `Focus not found: \`${focus}\`. Provide a workspace-relative path or discovered module name.`,
|
|
87
|
+
};
|
|
88
|
+
}
|