@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
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
import * as fs from "node:fs";
|
|
2
|
-
import * as path from "node:path";
|
|
3
|
-
import type { CodeQueryParams as ActionParams } from "./query-params.ts";
|
|
4
|
-
import type { StructuralSubstrate } from "./substrates/types.ts";
|
|
5
|
-
|
|
6
|
-
export const STRUCTURED_PATTERN_FILE_CAP = 200;
|
|
7
|
-
const STRUCTURED_PATTERN_TIMEOUT_MS = 10_000;
|
|
8
|
-
|
|
9
|
-
export type StructuredPatternKind = "definition" | "export" | "import";
|
|
10
|
-
|
|
11
|
-
export interface StructuredMatch {
|
|
12
|
-
file: string;
|
|
13
|
-
name: string;
|
|
14
|
-
kind: string;
|
|
15
|
-
line: number;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export interface StructuredPatternResult {
|
|
19
|
-
matches: StructuredMatch[];
|
|
20
|
-
omittedCount: number;
|
|
21
|
-
partialReason: "file-cap" | "timeout" | null;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export function isStructuredPatternKind(kind: string | undefined): kind is StructuredPatternKind {
|
|
25
|
-
return kind === "definition" || kind === "export" || kind === "import";
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// biome-ignore lint/complexity/useMaxParams: substrate injection keeps related inputs explicit for readability
|
|
29
|
-
export async function getStructuredPatternMatches(
|
|
30
|
-
params: ActionParams & { pattern: string; kind: StructuredPatternKind },
|
|
31
|
-
scopePath: string,
|
|
32
|
-
cwd: string,
|
|
33
|
-
relScope: string,
|
|
34
|
-
structural: StructuralSubstrate,
|
|
35
|
-
): Promise<StructuredPatternResult | string | null> {
|
|
36
|
-
const deadline = Date.now() + STRUCTURED_PATTERN_TIMEOUT_MS;
|
|
37
|
-
const collected = collectStructuredFiles(scopePath, deadline);
|
|
38
|
-
if (collected.files.length === 0) {
|
|
39
|
-
return null;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
const matcher = createStructuredMatcher(params.pattern, params.regex ?? false);
|
|
43
|
-
if (typeof matcher === "string") {
|
|
44
|
-
return matcher;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
try {
|
|
48
|
-
const matches: StructuredMatch[] = [];
|
|
49
|
-
let timedOut = collected.timedOut;
|
|
50
|
-
|
|
51
|
-
for (const [index, file] of collected.files.entries()) {
|
|
52
|
-
if (Date.now() > deadline) {
|
|
53
|
-
collected.omittedCount += collected.files.length - index;
|
|
54
|
-
timedOut = true;
|
|
55
|
-
break;
|
|
56
|
-
}
|
|
57
|
-
const relFile = path.relative(cwd, file);
|
|
58
|
-
await collectMatchesForFile(matches, structural, relFile, params.kind, matcher);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return {
|
|
62
|
-
matches,
|
|
63
|
-
omittedCount: timedOut ? Math.max(1, collected.omittedCount) : collected.omittedCount,
|
|
64
|
-
partialReason: timedOut ? "timeout" : collected.omittedCount > 0 ? "file-cap" : null,
|
|
65
|
-
};
|
|
66
|
-
} catch {
|
|
67
|
-
return `No structured ${params.kind} search data available in \`${relScope}\`. Try omitting \`kind\` for plain text search.`;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// biome-ignore lint/complexity/useMaxParams: helper takes explicit collection inputs to avoid intermediate objects in the hot path
|
|
72
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: kind-specific tree-sitter matching is clearest as one helper
|
|
73
|
-
async function collectMatchesForFile(
|
|
74
|
-
matches: StructuredMatch[],
|
|
75
|
-
structural: StructuralSubstrate,
|
|
76
|
-
relFile: string,
|
|
77
|
-
kind: StructuredPatternKind,
|
|
78
|
-
matcher: (value: string) => boolean,
|
|
79
|
-
): Promise<void> {
|
|
80
|
-
if (kind === "definition") {
|
|
81
|
-
const outline = await structural.outline(relFile);
|
|
82
|
-
if (outline.kind !== "success") return;
|
|
83
|
-
for (const item of outline.data) {
|
|
84
|
-
if (!matcher(item.name)) continue;
|
|
85
|
-
matches.push({ file: relFile, name: item.name, kind: item.kind, line: item.startLine });
|
|
86
|
-
}
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
if (kind === "export") {
|
|
91
|
-
const exportsResult = await structural.exports(relFile);
|
|
92
|
-
if (exportsResult.kind !== "success") return;
|
|
93
|
-
for (const item of exportsResult.data) {
|
|
94
|
-
if (!matcher(item.name)) continue;
|
|
95
|
-
matches.push({ file: relFile, name: item.name, kind: item.kind, line: item.startLine });
|
|
96
|
-
}
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const importsResult = await structural.imports(relFile);
|
|
101
|
-
if (importsResult.kind !== "success") return;
|
|
102
|
-
for (const item of importsResult.data) {
|
|
103
|
-
if (!matcher(item.moduleSpecifier)) continue;
|
|
104
|
-
matches.push({
|
|
105
|
-
file: relFile,
|
|
106
|
-
name: item.moduleSpecifier,
|
|
107
|
-
kind: "import",
|
|
108
|
-
line: item.startLine,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
function collectStructuredFiles(
|
|
114
|
-
scopePath: string,
|
|
115
|
-
deadline: number,
|
|
116
|
-
): { files: string[]; omittedCount: number; timedOut: boolean } {
|
|
117
|
-
const files: string[] = [];
|
|
118
|
-
let omittedCount = 0;
|
|
119
|
-
let timedOut = false;
|
|
120
|
-
const skipDirs = new Set(["node_modules", ".git", "dist", "build", "coverage"]);
|
|
121
|
-
|
|
122
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: timeout, file, and directory branches stay adjacent for predictable short-circuiting
|
|
123
|
-
function walk(currentPath: string) {
|
|
124
|
-
if (timedOut) return;
|
|
125
|
-
if (Date.now() > deadline) {
|
|
126
|
-
timedOut = true;
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
let stat: fs.Stats;
|
|
131
|
-
try {
|
|
132
|
-
stat = fs.statSync(currentPath);
|
|
133
|
-
} catch {
|
|
134
|
-
return;
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
if (stat.isFile()) {
|
|
138
|
-
if (isStructuredFile(currentPath)) {
|
|
139
|
-
if (files.length < STRUCTURED_PATTERN_FILE_CAP) {
|
|
140
|
-
files.push(currentPath);
|
|
141
|
-
} else {
|
|
142
|
-
omittedCount++;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
let entries: fs.Dirent[];
|
|
149
|
-
try {
|
|
150
|
-
entries = fs.readdirSync(currentPath, { withFileTypes: true });
|
|
151
|
-
} catch {
|
|
152
|
-
return;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
for (const entry of entries) {
|
|
156
|
-
if (entry.name.startsWith(".")) continue;
|
|
157
|
-
if (entry.isDirectory() && skipDirs.has(entry.name)) continue;
|
|
158
|
-
walk(path.join(currentPath, entry.name));
|
|
159
|
-
if (timedOut) return;
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
walk(scopePath);
|
|
164
|
-
return { files: files.sort((a, b) => a.localeCompare(b)), omittedCount, timedOut };
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
function isStructuredFile(file: string): boolean {
|
|
168
|
-
return [".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs", ".cjs"].includes(
|
|
169
|
-
path.extname(file),
|
|
170
|
-
);
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
function createStructuredMatcher(
|
|
174
|
-
pattern: string,
|
|
175
|
-
regex: boolean,
|
|
176
|
-
): ((value: string) => boolean) | string {
|
|
177
|
-
const ignoreCase = !/[A-Z]/.test(pattern);
|
|
178
|
-
|
|
179
|
-
if (regex) {
|
|
180
|
-
try {
|
|
181
|
-
const compiled = new RegExp(pattern, ignoreCase ? "i" : undefined);
|
|
182
|
-
return (value: string) => compiled.test(value);
|
|
183
|
-
} catch (error) {
|
|
184
|
-
const message = error instanceof Error ? error.message : "Invalid regex";
|
|
185
|
-
return `**Error:** Invalid regex pattern \`${pattern}\`: ${message}`;
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
const needle = ignoreCase ? pattern.toLowerCase() : pattern;
|
|
190
|
-
return (value: string) => {
|
|
191
|
-
const haystack = ignoreCase ? value.toLowerCase() : value;
|
|
192
|
-
return haystack.includes(needle);
|
|
193
|
-
};
|
|
194
|
-
}
|
|
@@ -1,170 +0,0 @@
|
|
|
1
|
-
// Affected markdown renderer — consumes analysis data and produces markdown content.
|
|
2
|
-
|
|
3
|
-
import type { PrioritySignalsSummary } from "../../prioritization-signals.ts";
|
|
4
|
-
import { appendPrioritySignalsSection } from "../../prioritization-signals.ts";
|
|
5
|
-
import type { ResolvedTarget, ResolvedTargetGroup } from "../../target-resolution.ts";
|
|
6
|
-
import type { ReferenceCollection } from "../../use-case/support/semantic-references.ts";
|
|
7
|
-
import { formatReferenceList } from "../../use-case/support/semantic-references.ts";
|
|
8
|
-
|
|
9
|
-
// ── Types ────────────────────────────────────────────────────────────
|
|
10
|
-
|
|
11
|
-
export interface ImpactAnalysis {
|
|
12
|
-
confidence: "semantic" | "structural" | "heuristic" | "unavailable";
|
|
13
|
-
affectedFiles: Set<string>;
|
|
14
|
-
affectedModules: Set<string>;
|
|
15
|
-
downstreamCount: number;
|
|
16
|
-
checkNext: string[];
|
|
17
|
-
likelyTests: string[];
|
|
18
|
-
riskLevel: "low" | "medium" | "high";
|
|
19
|
-
externalRefs: number;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
interface RenderSingleParams {
|
|
23
|
-
symbolName: string;
|
|
24
|
-
refs: ReferenceCollection;
|
|
25
|
-
analysis: ImpactAnalysis;
|
|
26
|
-
maxResults: number;
|
|
27
|
-
prioritySignals: PrioritySignalsSummary | null;
|
|
28
|
-
target: ResolvedTarget;
|
|
29
|
-
cwd: string;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// ── Single target renderer ───────────────────────────────────────────
|
|
33
|
-
|
|
34
|
-
export function renderAffectedSingle(params: RenderSingleParams): string {
|
|
35
|
-
const { symbolName, refs, analysis, maxResults, prioritySignals, target, cwd } = params;
|
|
36
|
-
const totalRefs = refs.refs.length + analysis.externalRefs;
|
|
37
|
-
const lines: string[] = [];
|
|
38
|
-
|
|
39
|
-
lines.push(`# Affected: \`${symbolName}\``);
|
|
40
|
-
lines.push("");
|
|
41
|
-
|
|
42
|
-
const refSummary =
|
|
43
|
-
analysis.externalRefs > 0
|
|
44
|
-
? `${totalRefs} refs (${refs.refs.length} direct + ${analysis.externalRefs} external)`
|
|
45
|
-
: `${totalRefs} ref${totalRefs !== 1 ? "s" : ""}`;
|
|
46
|
-
lines.push(
|
|
47
|
-
`**Risk: ${analysis.riskLevel.toUpperCase()}** | ${refSummary} | ${analysis.affectedFiles.size} file${analysis.affectedFiles.size !== 1 ? "s" : ""} | ${analysis.affectedModules.size} module${analysis.affectedModules.size !== 1 ? "s" : ""} | ${analysis.downstreamCount} downstream (${analysis.confidence})`,
|
|
48
|
-
);
|
|
49
|
-
if (analysis.externalRefs > 0) {
|
|
50
|
-
lines.push(
|
|
51
|
-
"_External references are not listed individually (node_modules, .pnpm, or out-of-tree)_",
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
|
-
lines.push("");
|
|
55
|
-
|
|
56
|
-
addRiskSection(lines, analysis, totalRefs);
|
|
57
|
-
formatReferenceList(lines, refs.refs, maxResults, cwd);
|
|
58
|
-
appendPrioritySignalsSection(lines, prioritySignals);
|
|
59
|
-
addCheckNextSection(lines, analysis.checkNext);
|
|
60
|
-
addTestsSection(lines, analysis.likelyTests);
|
|
61
|
-
|
|
62
|
-
const relPath = target.file ? pathRelative(cwd, target.file) : "";
|
|
63
|
-
lines.push("## Next");
|
|
64
|
-
lines.push(
|
|
65
|
-
`- \`code_brief\` with \`file: "${relPath}"\`, \`line: ${target.displayLine}\`, and \`character: ${target.displayCharacter}\` for deeper context around ${symbolName}`,
|
|
66
|
-
);
|
|
67
|
-
lines.push(
|
|
68
|
-
`- \`code_relations\` with \`kind: "callers"\`, \`file: "${relPath}"\`, \`line: ${target.displayLine}\`, and \`character: ${target.displayCharacter}\` for call sites`,
|
|
69
|
-
);
|
|
70
|
-
lines.push("");
|
|
71
|
-
|
|
72
|
-
return lines.join("\n");
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
// ── File-level target group renderer ─────────────────────────────────
|
|
76
|
-
|
|
77
|
-
interface RenderFileLevelParams {
|
|
78
|
-
targetGroup: ResolvedTargetGroup;
|
|
79
|
-
perTarget: Array<{ target: ResolvedTarget; refs: ReferenceCollection }>;
|
|
80
|
-
aggregated: ReferenceCollection;
|
|
81
|
-
analysis: ImpactAnalysis;
|
|
82
|
-
maxResults: number;
|
|
83
|
-
prioritySignals: PrioritySignalsSummary | null;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
export function renderAffectedFileLevel(params: RenderFileLevelParams): string {
|
|
87
|
-
const { targetGroup, perTarget, aggregated, analysis, maxResults, prioritySignals } = params;
|
|
88
|
-
const totalRefs = aggregated.refs.length + aggregated.externalCount;
|
|
89
|
-
const refSummary =
|
|
90
|
-
aggregated.externalCount > 0
|
|
91
|
-
? `${totalRefs} refs (${aggregated.refs.length} direct + ${aggregated.externalCount} external)`
|
|
92
|
-
: `${totalRefs} ref${totalRefs !== 1 ? "s" : ""}`;
|
|
93
|
-
|
|
94
|
-
const lines: string[] = [];
|
|
95
|
-
lines.push(`# Affected: \`${targetGroup.displayName}\``);
|
|
96
|
-
lines.push("");
|
|
97
|
-
lines.push(
|
|
98
|
-
`**Risk: ${analysis.riskLevel.toUpperCase()}** | ${targetGroup.targets.length} exported target${targetGroup.targets.length !== 1 ? "s" : ""} | ${refSummary} | ${analysis.affectedFiles.size} file${analysis.affectedFiles.size !== 1 ? "s" : ""} | ${analysis.affectedModules.size} module${analysis.affectedModules.size !== 1 ? "s" : ""} | ${analysis.downstreamCount} downstream (${analysis.confidence})`,
|
|
99
|
-
);
|
|
100
|
-
lines.push("");
|
|
101
|
-
|
|
102
|
-
lines.push("## Exported Targets");
|
|
103
|
-
for (const entry of perTarget) {
|
|
104
|
-
lines.push(
|
|
105
|
-
`- \`${entry.target.name ?? "symbol"}\` — ${entry.refs.refs.length} ref${entry.refs.refs.length !== 1 ? "s" : ""}`,
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
lines.push("");
|
|
109
|
-
|
|
110
|
-
addRiskSection(lines, analysis, totalRefs);
|
|
111
|
-
formatReferenceList(lines, aggregated.refs, maxResults, "");
|
|
112
|
-
appendPrioritySignalsSection(lines, prioritySignals);
|
|
113
|
-
addCheckNextSection(lines, analysis.checkNext);
|
|
114
|
-
addTestsSection(lines, analysis.likelyTests);
|
|
115
|
-
lines.push("## Next");
|
|
116
|
-
lines.push("- `code_brief` on the most-affected module for deeper context");
|
|
117
|
-
lines.push("- Use `file` + coordinates to inspect one exported target precisely");
|
|
118
|
-
lines.push("");
|
|
119
|
-
|
|
120
|
-
return lines.join("\n");
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// ── Shared formatting helpers ────────────────────────────────────────
|
|
124
|
-
|
|
125
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: risk-level formatting with branching per level is clearer as one function
|
|
126
|
-
function addRiskSection(lines: string[], analysis: ImpactAnalysis, directCount: number): void {
|
|
127
|
-
lines.push("## Risk Assessment");
|
|
128
|
-
const { riskLevel, affectedFiles, affectedModules, downstreamCount } = analysis;
|
|
129
|
-
if (riskLevel === "low") {
|
|
130
|
-
lines.push(
|
|
131
|
-
`\`low\` — ${directCount} ref${directCount !== 1 ? "s" : ""}, local, no downstream dependents.`,
|
|
132
|
-
);
|
|
133
|
-
} else if (riskLevel === "medium") {
|
|
134
|
-
lines.push(
|
|
135
|
-
`\`medium\` — ${directCount} ref${directCount !== 1 ? "s" : ""} across ${affectedFiles.size} file${affectedFiles.size !== 1 ? "s" : ""}${downstreamCount > 0 ? `, ${downstreamCount} downstream` : ""}.`,
|
|
136
|
-
);
|
|
137
|
-
} else {
|
|
138
|
-
lines.push(
|
|
139
|
-
`\`high\` — ${directCount} ref${directCount !== 1 ? "s" : ""} across ${affectedFiles.size} file${affectedFiles.size !== 1 ? "s" : ""} in ${affectedModules.size} module${affectedModules.size !== 1 ? "s" : ""}${downstreamCount > 0 ? `, ${downstreamCount} downstream` : ""}.`,
|
|
140
|
-
);
|
|
141
|
-
}
|
|
142
|
-
lines.push("");
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
function addCheckNextSection(lines: string[], checkNext: string[]): void {
|
|
146
|
-
if (checkNext.length === 0) return;
|
|
147
|
-
lines.push("## Check Next");
|
|
148
|
-
for (const item of checkNext.slice(0, 3)) {
|
|
149
|
-
lines.push(`- ${item}`);
|
|
150
|
-
}
|
|
151
|
-
lines.push("");
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function addTestsSection(lines: string[], tests: string[]): void {
|
|
155
|
-
if (tests.length === 0) return;
|
|
156
|
-
lines.push("## Likely Tests");
|
|
157
|
-
for (const t of tests.slice(0, 3)) {
|
|
158
|
-
lines.push(`- \`${t}\``);
|
|
159
|
-
}
|
|
160
|
-
lines.push("");
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
function pathRelative(cwd: string, file: string): string {
|
|
164
|
-
// Simple relative path computation
|
|
165
|
-
if (file.startsWith(cwd)) {
|
|
166
|
-
const rel = file.slice(cwd.length).replace(/^[/\\]/, "");
|
|
167
|
-
return rel || ".";
|
|
168
|
-
}
|
|
169
|
-
return file;
|
|
170
|
-
}
|
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
// Brief markdown renderer — consumes use-case data and produces markdown content + details metadata.
|
|
2
|
-
|
|
3
|
-
import * as path from "node:path";
|
|
4
|
-
import type { ArchitectureModel } from "../../model.ts";
|
|
5
|
-
import { findModuleForPath } from "../../model.ts";
|
|
6
|
-
import type { BriefDetails } from "../../types.ts";
|
|
7
|
-
|
|
8
|
-
// ── Anchored brief ───────────────────────────────────────────────────
|
|
9
|
-
|
|
10
|
-
interface TreeSitterContext {
|
|
11
|
-
nodeInfo: { type: string; text: string; startLine: number; startCharacter: number } | null;
|
|
12
|
-
outline: Array<{ name: string; kind: string; startLine: number; endLine: number }>;
|
|
13
|
-
imports: Array<{ moduleSpecifier: string }>;
|
|
14
|
-
exports: Array<{ name: string; kind: string }>;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
export function renderAnchoredBrief(params: {
|
|
18
|
-
relPath: string;
|
|
19
|
-
line: number;
|
|
20
|
-
character: number;
|
|
21
|
-
context: TreeSitterContext;
|
|
22
|
-
model: ArchitectureModel | null;
|
|
23
|
-
details: BriefDetails;
|
|
24
|
-
cwd: string;
|
|
25
|
-
}): { content: string; details: BriefDetails } {
|
|
26
|
-
const lines: string[] = [];
|
|
27
|
-
lines.push(`# Anchored Brief: ${params.relPath}:${params.line}:${params.character}`);
|
|
28
|
-
lines.push("");
|
|
29
|
-
|
|
30
|
-
appendTreeSitterContext(lines, params.context, params.relPath, params.line, params.cwd);
|
|
31
|
-
|
|
32
|
-
if (params.model) {
|
|
33
|
-
const resolvedFile = path.resolve(params.cwd, params.relPath);
|
|
34
|
-
const mod = findModuleForPath(params.model, resolvedFile);
|
|
35
|
-
if (mod) {
|
|
36
|
-
const shortName = mod.name.replace(/^@[^/]+\//, "");
|
|
37
|
-
lines.push(`_Module: ${shortName} (\`${mod.relativePath}\`)_`);
|
|
38
|
-
lines.push("");
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
appendNextQueries(lines, params.relPath, params.line, params.character);
|
|
43
|
-
|
|
44
|
-
return { content: lines.join("\n"), details: params.details };
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// ── Symbol brief ──────────────────────────────────────────────────────
|
|
48
|
-
|
|
49
|
-
export function renderSymbolBrief(params: {
|
|
50
|
-
relPath: string;
|
|
51
|
-
symbolName: string;
|
|
52
|
-
targetLine: number;
|
|
53
|
-
targetCharacter: number;
|
|
54
|
-
targetKind: string | null;
|
|
55
|
-
context: TreeSitterContext;
|
|
56
|
-
model: ArchitectureModel | null;
|
|
57
|
-
details: BriefDetails;
|
|
58
|
-
cwd: string;
|
|
59
|
-
}): { content: string; details: BriefDetails } {
|
|
60
|
-
const lines: string[] = [];
|
|
61
|
-
lines.push(`# Symbol Brief: ${params.symbolName || params.relPath}`);
|
|
62
|
-
lines.push("");
|
|
63
|
-
lines.push(
|
|
64
|
-
`**Resolved to:** \`${params.relPath}:${params.targetLine}:${params.targetCharacter}\`${params.targetKind ? ` (${params.targetKind})` : ""}`,
|
|
65
|
-
);
|
|
66
|
-
lines.push("");
|
|
67
|
-
|
|
68
|
-
appendTreeSitterContext(lines, params.context, params.relPath, params.targetLine, params.cwd);
|
|
69
|
-
|
|
70
|
-
if (params.model) {
|
|
71
|
-
const resolvedFile = path.resolve(params.cwd, params.relPath);
|
|
72
|
-
const mod = findModuleForPath(params.model, resolvedFile);
|
|
73
|
-
if (mod) {
|
|
74
|
-
const shortName = mod.name.replace(/^@[^/]+\//, "");
|
|
75
|
-
lines.push(`_Module: ${shortName} (\`${mod.relativePath}\`)_`);
|
|
76
|
-
lines.push("");
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
appendNextQueries(lines, params.relPath, params.targetLine, params.targetCharacter);
|
|
81
|
-
|
|
82
|
-
return { content: lines.join("\n"), details: params.details };
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
// ── Tree-sitter context rendering ─────────────────────────────────────
|
|
86
|
-
|
|
87
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: tree-sitter context rendering with node/outline/imports/exports sections kept together for readability
|
|
88
|
-
// biome-ignore lint/complexity/useMaxParams: options-object refactor would reduce clarity for this rendering helper
|
|
89
|
-
function appendTreeSitterContext(
|
|
90
|
-
lines: string[],
|
|
91
|
-
context: TreeSitterContext,
|
|
92
|
-
relPath: string,
|
|
93
|
-
line: number,
|
|
94
|
-
_cwd: string,
|
|
95
|
-
): void {
|
|
96
|
-
if (context.nodeInfo) {
|
|
97
|
-
const node = context.nodeInfo;
|
|
98
|
-
lines.push(`**Node:** \`${node.type}\` at ${relPath}:${node.startLine}:${node.startCharacter}`);
|
|
99
|
-
if (node.text && node.text.length <= 200) {
|
|
100
|
-
lines.push("```");
|
|
101
|
-
lines.push(node.text);
|
|
102
|
-
lines.push("```");
|
|
103
|
-
}
|
|
104
|
-
lines.push("");
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
if (context.outline.length > 0) {
|
|
108
|
-
const enclosing = context.outline.find(
|
|
109
|
-
(item) => item.startLine <= line && item.endLine >= line,
|
|
110
|
-
);
|
|
111
|
-
if (enclosing) {
|
|
112
|
-
lines.push(`**Enclosing symbol:** \`${enclosing.name}\` (${enclosing.kind})`);
|
|
113
|
-
lines.push(`- Range: ${relPath}:${enclosing.startLine}–${enclosing.endLine}`);
|
|
114
|
-
lines.push("");
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
lines.push("## File Outline");
|
|
118
|
-
const shown = context.outline.slice(0, 15);
|
|
119
|
-
for (const item of shown) {
|
|
120
|
-
const prefix = getOutlinePrefix(item.kind);
|
|
121
|
-
lines.push(`- ${prefix} \`${item.name}\` (${item.kind}) L${item.startLine}`);
|
|
122
|
-
}
|
|
123
|
-
if (context.outline.length > 15) {
|
|
124
|
-
lines.push(`- _+${context.outline.length - 15} more declarations_`);
|
|
125
|
-
}
|
|
126
|
-
lines.push("");
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
if (context.imports.length > 0) {
|
|
130
|
-
lines.push("## Imports");
|
|
131
|
-
const shown = context.imports.slice(0, 10);
|
|
132
|
-
for (const imp of shown) {
|
|
133
|
-
lines.push(`- \`${imp.moduleSpecifier}\``);
|
|
134
|
-
}
|
|
135
|
-
if (context.imports.length > 10) {
|
|
136
|
-
lines.push(`- _+${context.imports.length - 10} more_`);
|
|
137
|
-
}
|
|
138
|
-
lines.push("");
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (context.exports.length > 0) {
|
|
142
|
-
lines.push("## Exports");
|
|
143
|
-
const shown = context.exports.slice(0, 10);
|
|
144
|
-
for (const exp of shown) {
|
|
145
|
-
lines.push(`- \`${exp.name}\` (${exp.kind})`);
|
|
146
|
-
}
|
|
147
|
-
if (context.exports.length > 10) {
|
|
148
|
-
lines.push(`- _+${context.exports.length - 10} more_`);
|
|
149
|
-
}
|
|
150
|
-
lines.push("");
|
|
151
|
-
}
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function getOutlinePrefix(kind: string): string {
|
|
155
|
-
if (kind === "function" || kind === "method") return "ƒ";
|
|
156
|
-
if (kind === "class") return "◆";
|
|
157
|
-
return "·";
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function appendNextQueries(
|
|
161
|
-
lines: string[],
|
|
162
|
-
relPath: string,
|
|
163
|
-
line: number,
|
|
164
|
-
character: number,
|
|
165
|
-
): void {
|
|
166
|
-
lines.push("## Next");
|
|
167
|
-
lines.push(
|
|
168
|
-
`- \`code_relations\` with \`kind: "callers"\`, \`file: "${relPath}"\`, \`line: ${line}\`, and \`character: ${character}\` for call sites`,
|
|
169
|
-
);
|
|
170
|
-
lines.push(
|
|
171
|
-
`- \`code_affected\` with \`file: "${relPath}"\`, \`line: ${line}\`, and \`character: ${character}\` for impact analysis`,
|
|
172
|
-
);
|
|
173
|
-
lines.push("");
|
|
174
|
-
}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
// Map markdown renderer — consumes MapData and produces markdown content + details metadata.
|
|
2
|
-
|
|
3
|
-
import type { MapDetails } from "../../types.ts";
|
|
4
|
-
import type { MapData, MapStats } from "../../use-case/generate-map.ts";
|
|
5
|
-
import { SOURCE_EXTENSIONS } from "../../use-case/generate-map.ts";
|
|
6
|
-
|
|
7
|
-
export function renderMap(data: MapData): { content: string; details: MapDetails } {
|
|
8
|
-
const content = formatMap(data.scope, data.stats);
|
|
9
|
-
const details: MapDetails = {
|
|
10
|
-
scope: data.scope,
|
|
11
|
-
totalFiles: data.stats.total,
|
|
12
|
-
childDirectoryCount: data.stats.byChildDir.size,
|
|
13
|
-
landmarkCount: data.stats.landmarkFiles.length,
|
|
14
|
-
nextQueries: ["`code_brief` for prioritized context on this scope"],
|
|
15
|
-
};
|
|
16
|
-
|
|
17
|
-
return { content, details };
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
function formatMap(scope: string, stats: MapStats): string {
|
|
21
|
-
const lines: string[] = [];
|
|
22
|
-
|
|
23
|
-
lines.push(`# Code Map: ${scope}`);
|
|
24
|
-
lines.push("");
|
|
25
|
-
lines.push(`**Files:** ${stats.total} total`);
|
|
26
|
-
for (const [ext, count] of [...stats.byExtension.entries()]
|
|
27
|
-
.sort((a, b) => b[1] - a[1])
|
|
28
|
-
.slice(0, 10)) {
|
|
29
|
-
const label = SOURCE_EXTENSIONS.get(ext) ?? (ext || "(no extension)");
|
|
30
|
-
lines.push(`- ${label}: ${count}`);
|
|
31
|
-
}
|
|
32
|
-
if (stats.byExtension.size > 10) {
|
|
33
|
-
lines.push(`- _+${stats.byExtension.size - 10} more extensions_`);
|
|
34
|
-
}
|
|
35
|
-
lines.push("");
|
|
36
|
-
|
|
37
|
-
if (stats.byChildDir.size > 0) {
|
|
38
|
-
lines.push("**Child directories:**");
|
|
39
|
-
for (const [dir, count] of [...stats.byChildDir.entries()].sort((a, b) => b[1] - a[1])) {
|
|
40
|
-
lines.push(`- ${dir}/ (${count} file${count !== 1 ? "s" : ""})`);
|
|
41
|
-
}
|
|
42
|
-
lines.push("");
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
if (stats.landmarkFiles.length > 0) {
|
|
46
|
-
lines.push("**Landmark files:**");
|
|
47
|
-
for (const file of stats.landmarkFiles) {
|
|
48
|
-
lines.push(`- \`${file}\``);
|
|
49
|
-
}
|
|
50
|
-
lines.push("");
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return lines.join("\n");
|
|
54
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Markdown renderer for refactor results.
|
|
3
|
-
*/
|
|
4
|
-
import type { ApplyResult } from "../../refactor/apply-workspace-edit.ts";
|
|
5
|
-
|
|
6
|
-
export interface RefactorRenderInput {
|
|
7
|
-
result: ApplyResult;
|
|
8
|
-
operation: string;
|
|
9
|
-
targetDescription: string;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Render a refactor result as human-readable markdown.
|
|
14
|
-
*/
|
|
15
|
-
export function renderRefactorResult(input: RefactorRenderInput): string {
|
|
16
|
-
const { result, operation, targetDescription } = input;
|
|
17
|
-
|
|
18
|
-
if (result.kind === "error") {
|
|
19
|
-
return `**Refactor failed:** ${result.reason}`;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
return [
|
|
23
|
-
`**Refactor applied:** ${operation} on ${targetDescription}`,
|
|
24
|
-
`- Files changed: ${result.filesChanged}`,
|
|
25
|
-
`- Total edits: ${result.totalEdits}`,
|
|
26
|
-
].join("\n");
|
|
27
|
-
}
|