@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,15 +1,16 @@
|
|
|
1
1
|
// Public facade — delegates to the new use-case and presentation layers.
|
|
2
|
-
// Existing callers (api.ts
|
|
2
|
+
// Existing callers (api.ts and index.ts) remain compatible.
|
|
3
3
|
|
|
4
|
-
import {
|
|
5
|
-
import type {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import type {
|
|
9
|
-
import {
|
|
4
|
+
import type { ConfidenceMode } from "@mrclrchtr/supi-code-runtime/api";
|
|
5
|
+
import type { BriefDetails } from "../../types/details.ts";
|
|
6
|
+
import { renderOverview } from "../../ui/markdown/overview.ts";
|
|
7
|
+
import { buildOverviewData } from "../../ui/markdown/overview-data.ts";
|
|
8
|
+
import type { ArchitectureModel } from "../architecture/model.ts";
|
|
9
|
+
import { getDependents } from "../architecture/model.ts";
|
|
10
|
+
import { formatGitContext, gatherGitContext } from "../signals/git.ts";
|
|
10
11
|
|
|
11
12
|
// Re-export focused brief generation
|
|
12
|
-
export { generateFocusedBrief } from "./
|
|
13
|
+
export { generateFocusedBrief } from "./main.ts";
|
|
13
14
|
|
|
14
15
|
// ── Overview (first-turn injection) ───────────────────────────────────
|
|
15
16
|
|
|
@@ -17,7 +18,7 @@ export { generateFocusedBrief } from "./brief-focused.ts";
|
|
|
17
18
|
* Generate a compact architecture overview for first-turn session injection.
|
|
18
19
|
* Targets roughly 500 tokens or less; prefers dense module-edge format.
|
|
19
20
|
*
|
|
20
|
-
* Delegates to
|
|
21
|
+
* Delegates to analysis overview data + ui/markdown/overview.
|
|
21
22
|
*/
|
|
22
23
|
export function generateOverview(model: ArchitectureModel): string | null {
|
|
23
24
|
const data = buildOverviewData(model);
|
|
@@ -30,7 +31,10 @@ export function generateOverview(model: ArchitectureModel): string | null {
|
|
|
30
31
|
/**
|
|
31
32
|
* Generate a full-project brief from the architecture model.
|
|
32
33
|
*/
|
|
33
|
-
export function generateProjectBrief(
|
|
34
|
+
export function generateProjectBrief(
|
|
35
|
+
model: ArchitectureModel,
|
|
36
|
+
opts?: { showGitContext?: boolean },
|
|
37
|
+
): {
|
|
34
38
|
content: string;
|
|
35
39
|
details: BriefDetails;
|
|
36
40
|
} {
|
|
@@ -45,9 +49,11 @@ export function generateProjectBrief(model: ArchitectureModel): {
|
|
|
45
49
|
lines.push("");
|
|
46
50
|
}
|
|
47
51
|
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
52
|
+
if (opts?.showGitContext !== false) {
|
|
53
|
+
const gitCtx = gatherGitContext(model.root);
|
|
54
|
+
if (gitCtx) {
|
|
55
|
+
lines.push(formatGitContext(gitCtx));
|
|
56
|
+
}
|
|
51
57
|
}
|
|
52
58
|
|
|
53
59
|
if (model.modules.length === 0) {
|
|
@@ -75,7 +81,6 @@ export function generateProjectBrief(model: ArchitectureModel): {
|
|
|
75
81
|
addStartHereSection(lines, topStartHere);
|
|
76
82
|
|
|
77
83
|
const nextQueries = buildNextQueries(model, publicSurfaces);
|
|
78
|
-
addNextSection(lines, nextQueries);
|
|
79
84
|
|
|
80
85
|
return {
|
|
81
86
|
content: lines.join("\n"),
|
|
@@ -164,21 +169,11 @@ function buildNextQueries(model: ArchitectureModel, publicSurfaces: string[]): s
|
|
|
164
169
|
if (model.modules.length > 0) {
|
|
165
170
|
const firstMod = model.modules[0];
|
|
166
171
|
nextQueries.push(
|
|
167
|
-
`\`
|
|
172
|
+
`\`code_orientation\` with \`focus: "${firstMod.relativePath}"\` for a focused module brief`,
|
|
168
173
|
);
|
|
169
174
|
}
|
|
170
175
|
if (publicSurfaces.length > 0) {
|
|
171
|
-
nextQueries.push("`
|
|
176
|
+
nextQueries.push("`code_impact` before modifying shared exports");
|
|
172
177
|
}
|
|
173
178
|
return nextQueries;
|
|
174
179
|
}
|
|
175
|
-
|
|
176
|
-
function addNextSection(lines: string[], nextQueries: string[]): void {
|
|
177
|
-
if (nextQueries.length === 0) return;
|
|
178
|
-
lines.push("## Next");
|
|
179
|
-
lines.push("");
|
|
180
|
-
for (const q of nextQueries.slice(0, 2)) {
|
|
181
|
-
lines.push(`- ${q}`);
|
|
182
|
-
}
|
|
183
|
-
lines.push("");
|
|
184
|
-
}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Recursive directory summary — source file discovery, import/export counting,
|
|
3
|
+
* and named-export extraction.
|
|
4
|
+
*
|
|
5
|
+
* Extracted from brief-focused.ts to keep the focus-generation modules
|
|
6
|
+
* cohesive and avoid a single 800+ line file.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import * as fs from "node:fs";
|
|
10
|
+
import * as path from "node:path";
|
|
11
|
+
|
|
12
|
+
// ── Types ─────────────────────────────────────────────────────────────
|
|
13
|
+
|
|
14
|
+
export interface RecursiveDirectorySummary {
|
|
15
|
+
directFiles: string[];
|
|
16
|
+
allFiles: string[];
|
|
17
|
+
totalSourceFiles: number;
|
|
18
|
+
subdirs: Array<{ name: string; fileCount: number }>;
|
|
19
|
+
publicSurfaces: string[];
|
|
20
|
+
importCount: number;
|
|
21
|
+
exportCount: number;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// ── Recognized source extensions ──────────────────────────────────────
|
|
25
|
+
|
|
26
|
+
export const SOURCE_EXTENSIONS = new Set([
|
|
27
|
+
// JS/TS
|
|
28
|
+
".ts",
|
|
29
|
+
".tsx",
|
|
30
|
+
".js",
|
|
31
|
+
".jsx",
|
|
32
|
+
".mts",
|
|
33
|
+
".cts",
|
|
34
|
+
".mjs",
|
|
35
|
+
".cjs",
|
|
36
|
+
// Python
|
|
37
|
+
".py",
|
|
38
|
+
".pyi",
|
|
39
|
+
// Rust
|
|
40
|
+
".rs",
|
|
41
|
+
// Go
|
|
42
|
+
".go",
|
|
43
|
+
".mod",
|
|
44
|
+
// C/C++
|
|
45
|
+
".c",
|
|
46
|
+
".h",
|
|
47
|
+
".cpp",
|
|
48
|
+
".hpp",
|
|
49
|
+
".cc",
|
|
50
|
+
".cxx",
|
|
51
|
+
".hxx",
|
|
52
|
+
".c++",
|
|
53
|
+
".h++",
|
|
54
|
+
// Java / Kotlin
|
|
55
|
+
".java",
|
|
56
|
+
".kt",
|
|
57
|
+
".kts",
|
|
58
|
+
// Ruby
|
|
59
|
+
".rb",
|
|
60
|
+
// Shell
|
|
61
|
+
".sh",
|
|
62
|
+
".bash",
|
|
63
|
+
".zsh",
|
|
64
|
+
// Web
|
|
65
|
+
".html",
|
|
66
|
+
".htm",
|
|
67
|
+
".xhtml",
|
|
68
|
+
".css",
|
|
69
|
+
".scss",
|
|
70
|
+
".less",
|
|
71
|
+
// Data / Config
|
|
72
|
+
".json",
|
|
73
|
+
".yaml",
|
|
74
|
+
".yml",
|
|
75
|
+
".toml",
|
|
76
|
+
".md",
|
|
77
|
+
// Other languages
|
|
78
|
+
".php",
|
|
79
|
+
".swift",
|
|
80
|
+
".cs",
|
|
81
|
+
".r",
|
|
82
|
+
".sql",
|
|
83
|
+
]);
|
|
84
|
+
|
|
85
|
+
// ── Public API ────────────────────────────────────────────────────────
|
|
86
|
+
|
|
87
|
+
/** List source files (by extension) in a flat directory. */
|
|
88
|
+
export function listSourceFiles(dir: string): string[] {
|
|
89
|
+
const files: string[] = [];
|
|
90
|
+
try {
|
|
91
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
92
|
+
for (const entry of entries) {
|
|
93
|
+
if (!entry.isFile()) continue;
|
|
94
|
+
if (entry.name.startsWith(".")) continue;
|
|
95
|
+
if (SOURCE_EXTENSIONS.has(path.extname(entry.name))) {
|
|
96
|
+
files.push(entry.name);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
} catch {
|
|
100
|
+
// Directory not readable
|
|
101
|
+
}
|
|
102
|
+
return files.sort((a, b) => a.localeCompare(b));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/** Recursively summarize a directory tree: source files, imports, exports, subdirectories. */
|
|
106
|
+
export function summarizeDirectoryRecursively(dir: string): RecursiveDirectorySummary {
|
|
107
|
+
const directFiles = listSourceFiles(dir);
|
|
108
|
+
const summary: RecursiveDirectorySummary = {
|
|
109
|
+
directFiles,
|
|
110
|
+
allFiles: directFiles.map((file) => path.join(dir, file)),
|
|
111
|
+
totalSourceFiles: directFiles.length,
|
|
112
|
+
subdirs: [],
|
|
113
|
+
publicSurfaces: [],
|
|
114
|
+
importCount: 0,
|
|
115
|
+
exportCount: 0,
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
accumulateJsTsSignals(summary, dir, directFiles, "");
|
|
119
|
+
|
|
120
|
+
try {
|
|
121
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
122
|
+
for (const entry of entries) {
|
|
123
|
+
if (!entry.isDirectory() || entry.name.startsWith(".")) continue;
|
|
124
|
+
const childDir = path.join(dir, entry.name);
|
|
125
|
+
const childSummary = summarizeDirectoryRecursively(childDir);
|
|
126
|
+
if (childSummary.totalSourceFiles === 0) continue;
|
|
127
|
+
summary.totalSourceFiles += childSummary.totalSourceFiles;
|
|
128
|
+
summary.allFiles.push(...childSummary.allFiles);
|
|
129
|
+
summary.subdirs.push({ name: entry.name, fileCount: childSummary.totalSourceFiles });
|
|
130
|
+
summary.publicSurfaces.push(
|
|
131
|
+
...childSummary.publicSurfaces.map((surface) => `${entry.name}/${surface}`),
|
|
132
|
+
);
|
|
133
|
+
summary.importCount += childSummary.importCount;
|
|
134
|
+
summary.exportCount += childSummary.exportCount;
|
|
135
|
+
}
|
|
136
|
+
} catch {
|
|
137
|
+
// Directory not readable
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
summary.subdirs.sort((a, b) => a.name.localeCompare(b.name));
|
|
141
|
+
return summary;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// ── Internal helpers ──────────────────────────────────────────────────
|
|
145
|
+
|
|
146
|
+
function accumulateJsTsSignals(
|
|
147
|
+
summary: RecursiveDirectorySummary,
|
|
148
|
+
dir: string,
|
|
149
|
+
files: string[],
|
|
150
|
+
prefix: string,
|
|
151
|
+
): void {
|
|
152
|
+
for (const file of files) {
|
|
153
|
+
if (!isJsTsFile(file)) continue;
|
|
154
|
+
try {
|
|
155
|
+
const relFile = prefix ? `${prefix}/${file}` : file;
|
|
156
|
+
const content = fs.readFileSync(path.join(dir, file), "utf-8");
|
|
157
|
+
summary.importCount += countMatches(content, /^import\s/gm);
|
|
158
|
+
const exports = extractNamedExports(content);
|
|
159
|
+
summary.exportCount += exports.length;
|
|
160
|
+
for (const exportedName of exports) {
|
|
161
|
+
summary.publicSurfaces.push(`\`${exportedName}\` — \`${relFile}\``);
|
|
162
|
+
}
|
|
163
|
+
} catch {
|
|
164
|
+
// File not readable
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
function isJsTsFile(file: string): boolean {
|
|
170
|
+
return [".ts", ".tsx", ".js", ".jsx", ".mts", ".cts", ".mjs", ".cjs"].includes(
|
|
171
|
+
path.extname(file),
|
|
172
|
+
);
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
/**
|
|
176
|
+
* Lightweight exported-name extraction for recursive directory briefs.
|
|
177
|
+
*
|
|
178
|
+
* Best-effort only: handles exported declarations and simple named export lists,
|
|
179
|
+
* but intentionally does not try to cover default exports, export-all forms,
|
|
180
|
+
* re-exported defaults, or every multiline formatting variant.
|
|
181
|
+
*/
|
|
182
|
+
function extractNamedExports(content: string): string[] {
|
|
183
|
+
const names = new Set<string>();
|
|
184
|
+
const declarationRegex =
|
|
185
|
+
/export\s+(?:async\s+)?(?:function|class|interface|type|const|let|var|enum)\s+([A-Za-z_$][\w$]*)/g;
|
|
186
|
+
const namedExportRegex = /export\s*\{\s*([^}]+)\s*\}/g;
|
|
187
|
+
|
|
188
|
+
for (const match of content.matchAll(declarationRegex)) {
|
|
189
|
+
if (match[1]) names.add(match[1]);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
for (const match of content.matchAll(namedExportRegex)) {
|
|
193
|
+
const parts = match[1]?.split(",") ?? [];
|
|
194
|
+
for (const part of parts) {
|
|
195
|
+
const candidate = part
|
|
196
|
+
.trim()
|
|
197
|
+
.split(/\s+as\s+/i)[0]
|
|
198
|
+
?.trim();
|
|
199
|
+
if (candidate) names.add(candidate);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
return [...names].sort((a, b) => a.localeCompare(b));
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
function countMatches(content: string, regex: RegExp): number {
|
|
207
|
+
return [...content.matchAll(regex)].length;
|
|
208
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// Brief use-case types — moved from shared/context/types.ts (Phase 2.5)
|
|
2
|
+
|
|
3
|
+
import type { SessionLspServiceState } from "@mrclrchtr/supi-lsp/api";
|
|
4
|
+
import type { BriefDetails } from "../../types/details.ts";
|
|
5
|
+
import type { ArchitectureModel } from "../architecture/model.ts";
|
|
6
|
+
import type { CodeProvider } from "../provider.ts";
|
|
7
|
+
|
|
8
|
+
export type BriefInput =
|
|
9
|
+
| { kind: "project"; maxResults?: number }
|
|
10
|
+
| { kind: "path"; path: string; maxResults?: number }
|
|
11
|
+
| { kind: "file"; file: string; maxResults?: number }
|
|
12
|
+
| { kind: "symbol"; symbol: string; path?: string; maxResults?: number };
|
|
13
|
+
|
|
14
|
+
export interface BriefDeps {
|
|
15
|
+
model: ArchitectureModel | null;
|
|
16
|
+
provider: CodeProvider | null;
|
|
17
|
+
cwd: string;
|
|
18
|
+
/** Show git context in orientation output. Defaults to true. */
|
|
19
|
+
showGitContext?: boolean;
|
|
20
|
+
/** LSP service state for diagnostic access. */
|
|
21
|
+
lspService: SessionLspServiceState;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface BriefUseCaseResult {
|
|
25
|
+
content: string;
|
|
26
|
+
details: BriefDetails;
|
|
27
|
+
}
|
|
@@ -1,27 +1,14 @@
|
|
|
1
|
-
// Brief orchestration use-case — dispatches by mode, coordinates substrate access,
|
|
2
|
-
// and returns fully rendered markdown content + details metadata.
|
|
3
|
-
|
|
4
|
-
import * as fs from "node:fs";
|
|
5
1
|
import * as path from "node:path";
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import { normalizePath } from "../search
|
|
11
|
-
import
|
|
12
|
-
import {
|
|
13
|
-
import
|
|
2
|
+
import { renderSymbolBrief } from "../../ui/markdown/brief.ts";
|
|
3
|
+
import { gatherTreeSitterContext } from "../../ui/markdown/gather.ts";
|
|
4
|
+
import type { ArchitectureModel } from "../architecture/model.ts";
|
|
5
|
+
import { findModuleForPath } from "../architecture/model.ts";
|
|
6
|
+
import { normalizePath } from "../search/ripgrep.ts";
|
|
7
|
+
import { resolveSymbolTarget } from "../target/symbol.ts";
|
|
8
|
+
import type { TargetOutcome } from "../target/types.ts";
|
|
9
|
+
import { generateFocusedBrief, generateProjectBrief } from "./public-brief.ts";
|
|
14
10
|
import type { BriefDeps, BriefInput, BriefUseCaseResult } from "./types.ts";
|
|
15
11
|
|
|
16
|
-
// ── TreeSitterContext is an intermediate data shape from the use-case ──
|
|
17
|
-
|
|
18
|
-
export interface TreeSitterContext {
|
|
19
|
-
nodeInfo: { type: string; text: string; startLine: number; startCharacter: number } | null;
|
|
20
|
-
outline: Array<{ name: string; kind: string; startLine: number; endLine: number }>;
|
|
21
|
-
imports: Array<{ moduleSpecifier: string }>;
|
|
22
|
-
exports: Array<{ name: string; kind: string }>;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
12
|
// ── Public entrypoint ─────────────────────────────────────────────────
|
|
26
13
|
|
|
27
14
|
export async function executeBrief(
|
|
@@ -31,15 +18,13 @@ export async function executeBrief(
|
|
|
31
18
|
switch (input.kind) {
|
|
32
19
|
case "project":
|
|
33
20
|
if (deps.model) {
|
|
34
|
-
return executeProjectBrief(deps.model);
|
|
21
|
+
return executeProjectBrief(deps.model, deps.showGitContext);
|
|
35
22
|
}
|
|
36
23
|
return noModelResult();
|
|
37
24
|
case "path":
|
|
38
|
-
return executePathBrief(input.path, deps);
|
|
25
|
+
return executePathBrief(input.path, deps, input);
|
|
39
26
|
case "file":
|
|
40
|
-
return executeFileBrief(input.file, deps);
|
|
41
|
-
case "anchored":
|
|
42
|
-
return executeAnchoredBrief(input, deps);
|
|
27
|
+
return executeFileBrief(input.file, deps, input);
|
|
43
28
|
case "symbol":
|
|
44
29
|
return executeSymbolBrief(input.symbol, input.path, deps);
|
|
45
30
|
}
|
|
@@ -47,85 +32,59 @@ export async function executeBrief(
|
|
|
47
32
|
|
|
48
33
|
// ── Project brief ─────────────────────────────────────────────────────
|
|
49
34
|
|
|
50
|
-
function executeProjectBrief(
|
|
35
|
+
function executeProjectBrief(
|
|
36
|
+
model: ArchitectureModel,
|
|
37
|
+
showGitContext?: boolean,
|
|
38
|
+
): BriefUseCaseResult {
|
|
51
39
|
if (!model) {
|
|
52
40
|
return noModelResult();
|
|
53
41
|
}
|
|
54
|
-
const result = generateProjectBrief(model);
|
|
42
|
+
const result = generateProjectBrief(model, { showGitContext });
|
|
55
43
|
return { content: result.content, details: result.details };
|
|
56
44
|
}
|
|
57
45
|
|
|
58
46
|
// ── Path / file briefs ────────────────────────────────────────────────
|
|
59
47
|
|
|
60
|
-
function executePathBrief(
|
|
48
|
+
async function executePathBrief(
|
|
49
|
+
requestPath: string,
|
|
50
|
+
deps: BriefDeps,
|
|
51
|
+
input: BriefInput,
|
|
52
|
+
): Promise<BriefUseCaseResult> {
|
|
61
53
|
if (!deps.model) {
|
|
62
54
|
return noModelResult();
|
|
63
55
|
}
|
|
64
56
|
const resolved = normalizePath(requestPath, deps.cwd);
|
|
65
|
-
const
|
|
57
|
+
const maxResults =
|
|
58
|
+
"maxResults" in input ? (input as { maxResults?: number }).maxResults : undefined;
|
|
59
|
+
const result = await generateFocusedBrief(deps.model, resolved, {
|
|
60
|
+
provider: deps.provider,
|
|
61
|
+
cwd: deps.cwd,
|
|
62
|
+
maxResults,
|
|
63
|
+
showGitContext: deps.showGitContext ?? true,
|
|
64
|
+
lspService: deps.lspService,
|
|
65
|
+
});
|
|
66
66
|
return { content: result.content, details: result.details };
|
|
67
67
|
}
|
|
68
68
|
|
|
69
|
-
function executeFileBrief(
|
|
69
|
+
async function executeFileBrief(
|
|
70
|
+
file: string,
|
|
71
|
+
deps: BriefDeps,
|
|
72
|
+
input: BriefInput,
|
|
73
|
+
): Promise<BriefUseCaseResult> {
|
|
70
74
|
if (!deps.model) {
|
|
71
75
|
return noModelResult();
|
|
72
76
|
}
|
|
73
77
|
const resolved = normalizePath(file, deps.cwd);
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
// ── Anchored brief ────────────────────────────────────────────────────
|
|
79
|
-
|
|
80
|
-
async function executeAnchoredBrief(
|
|
81
|
-
input: { file: string; line: number; character: number },
|
|
82
|
-
deps: BriefDeps,
|
|
83
|
-
): Promise<BriefUseCaseResult> {
|
|
84
|
-
const { file, line, character } = input;
|
|
85
|
-
const resolvedFile = normalizePath(file, deps.cwd);
|
|
86
|
-
|
|
87
|
-
if (!fs.existsSync(resolvedFile)) {
|
|
88
|
-
return {
|
|
89
|
-
content: `**Error:** File not found: \`${file}\``,
|
|
90
|
-
details: {
|
|
91
|
-
confidence: "unavailable",
|
|
92
|
-
focusTarget: `${file}:${line}:${character}`,
|
|
93
|
-
startHere: [],
|
|
94
|
-
publicSurfaces: [],
|
|
95
|
-
dependencySummary: null,
|
|
96
|
-
omittedCount: 0,
|
|
97
|
-
nextQueries: [],
|
|
98
|
-
},
|
|
99
|
-
};
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
const relPath = path.relative(deps.cwd, resolvedFile);
|
|
103
|
-
const context = await gatherTreeSitterContext(deps.provider, relPath, line, character);
|
|
104
|
-
|
|
105
|
-
const details = {
|
|
106
|
-
confidence: "structural" as const,
|
|
107
|
-
focusTarget: `${relPath}:${line}:${character}`,
|
|
108
|
-
startHere: [] as Array<{ target: string; reason: string }>,
|
|
109
|
-
publicSurfaces: [] as string[],
|
|
110
|
-
dependencySummary: null as { moduleCount: number; edgeCount: number } | null,
|
|
111
|
-
omittedCount: 0,
|
|
112
|
-
nextQueries: [
|
|
113
|
-
`\`code_relations\` with \`kind: "callers"\`, \`file: "${relPath}"\`, \`line: ${line}\`, and \`character: ${character}\` for call sites`,
|
|
114
|
-
`\`code_affected\` with \`file: "${relPath}"\`, \`line: ${line}\`, and \`character: ${character}\` for impact analysis`,
|
|
115
|
-
],
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const rendered = renderAnchoredBrief({
|
|
119
|
-
relPath,
|
|
120
|
-
line,
|
|
121
|
-
character,
|
|
122
|
-
context,
|
|
123
|
-
model: deps.model ?? null,
|
|
124
|
-
details,
|
|
78
|
+
const maxResults =
|
|
79
|
+
"maxResults" in input ? (input as { maxResults?: number }).maxResults : undefined;
|
|
80
|
+
const result = await generateFocusedBrief(deps.model, resolved, {
|
|
81
|
+
provider: deps.provider,
|
|
125
82
|
cwd: deps.cwd,
|
|
83
|
+
maxResults,
|
|
84
|
+
showGitContext: deps.showGitContext ?? true,
|
|
85
|
+
lspService: deps.lspService,
|
|
126
86
|
});
|
|
127
|
-
|
|
128
|
-
return rendered;
|
|
87
|
+
return { content: result.content, details: result.details };
|
|
129
88
|
}
|
|
130
89
|
|
|
131
90
|
// ── Symbol brief ──────────────────────────────────────────────────────
|
|
@@ -153,7 +112,8 @@ async function executeSymbolBrief(
|
|
|
153
112
|
const provider = deps.provider;
|
|
154
113
|
if (!provider) {
|
|
155
114
|
return {
|
|
156
|
-
content:
|
|
115
|
+
content:
|
|
116
|
+
"**Error:** Symbol discovery requires an active code provider. Use `code_orientation` with `focus` for file orientation, or use `code_inspect` with `file` + coordinates for point facts.",
|
|
157
117
|
details: {
|
|
158
118
|
confidence: "unavailable",
|
|
159
119
|
focusTarget: symbol,
|
|
@@ -162,7 +122,7 @@ async function executeSymbolBrief(
|
|
|
162
122
|
dependencySummary: null,
|
|
163
123
|
omittedCount: 0,
|
|
164
124
|
nextQueries: [
|
|
165
|
-
"Use `
|
|
125
|
+
"Use `code_orientation` with `focus` for file orientation, or `code_inspect` with file + coordinates for point facts",
|
|
166
126
|
],
|
|
167
127
|
},
|
|
168
128
|
};
|
|
@@ -182,7 +142,7 @@ async function executeSymbolBrief(
|
|
|
182
142
|
dependencySummary: null,
|
|
183
143
|
omittedCount: 0,
|
|
184
144
|
nextQueries: [
|
|
185
|
-
"Use `
|
|
145
|
+
"Use `code_orientation` with `focus` for file orientation, or `code_inspect` with file + coordinates for point facts",
|
|
186
146
|
],
|
|
187
147
|
},
|
|
188
148
|
};
|
|
@@ -200,12 +160,27 @@ async function executeSymbolBrief(
|
|
|
200
160
|
dependencySummary: null,
|
|
201
161
|
omittedCount: resolved.omittedCount,
|
|
202
162
|
nextQueries: [
|
|
203
|
-
"Use `
|
|
163
|
+
"Use `code_orientation` with `focus` for file orientation, or `code_inspect` with file + coordinates for point facts",
|
|
204
164
|
],
|
|
205
165
|
},
|
|
206
166
|
};
|
|
207
167
|
}
|
|
208
168
|
|
|
169
|
+
if (resolved.kind === "group") {
|
|
170
|
+
return {
|
|
171
|
+
content: `**Error:** Unexpected group result from symbol resolution for \`${symbol}\`. Use \`code_orientation\` with a file focus.`,
|
|
172
|
+
details: {
|
|
173
|
+
confidence: "unavailable",
|
|
174
|
+
focusTarget: symbol,
|
|
175
|
+
startHere: [],
|
|
176
|
+
publicSurfaces: [],
|
|
177
|
+
dependencySummary: null,
|
|
178
|
+
omittedCount: 0,
|
|
179
|
+
nextQueries: ["Use `code_orientation` with `focus` for file or directory orientation"],
|
|
180
|
+
},
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
|
|
209
184
|
const target = resolved.target;
|
|
210
185
|
const relPath = path.relative(deps.cwd, target.file);
|
|
211
186
|
|
|
@@ -225,8 +200,9 @@ async function executeSymbolBrief(
|
|
|
225
200
|
dependencySummary: mod ? { moduleCount: 1, edgeCount: mod.internalDeps.length } : null,
|
|
226
201
|
omittedCount: 0,
|
|
227
202
|
nextQueries: [
|
|
228
|
-
`\`
|
|
229
|
-
`\`
|
|
203
|
+
`\`code_inspect\` with \`file: "${relPath}"\`, \`line: ${target.displayLine}\`, and \`character: ${target.displayCharacter}\` for point facts`,
|
|
204
|
+
`\`code_graph\`, \`file: "${relPath}"\`, \`line: ${target.displayLine}\`, and \`character: ${target.displayCharacter}\` for reference sites`,
|
|
205
|
+
`\`code_impact\` with \`file: "${relPath}"\`, \`line: ${target.displayLine}\`, and \`character: ${target.displayCharacter}\` for impact analysis`,
|
|
230
206
|
],
|
|
231
207
|
};
|
|
232
208
|
|
|
@@ -247,59 +223,6 @@ async function executeSymbolBrief(
|
|
|
247
223
|
|
|
248
224
|
// ── Helpers ───────────────────────────────────────────────────────────
|
|
249
225
|
|
|
250
|
-
async function gatherTreeSitterContext(
|
|
251
|
-
provider: CodeProvider | null,
|
|
252
|
-
relPath: string,
|
|
253
|
-
line: number,
|
|
254
|
-
character: number,
|
|
255
|
-
): Promise<TreeSitterContext> {
|
|
256
|
-
let nodeInfo: TreeSitterContext["nodeInfo"] = null;
|
|
257
|
-
let outline: TreeSitterContext["outline"] = [];
|
|
258
|
-
let imports: TreeSitterContext["imports"] = [];
|
|
259
|
-
let exports: TreeSitterContext["exports"] = [];
|
|
260
|
-
|
|
261
|
-
if (!provider) return { nodeInfo, outline, imports, exports };
|
|
262
|
-
|
|
263
|
-
try {
|
|
264
|
-
const nodeResult = await provider.nodeAt(relPath, line, character);
|
|
265
|
-
if (nodeResult.kind === "success") {
|
|
266
|
-
nodeInfo = {
|
|
267
|
-
type: nodeResult.data.type,
|
|
268
|
-
text: nodeResult.data.text,
|
|
269
|
-
startLine: nodeResult.data.startLine,
|
|
270
|
-
startCharacter: nodeResult.data.startCharacter,
|
|
271
|
-
};
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
const outlineResult = await provider.outline(relPath);
|
|
275
|
-
if (outlineResult.kind === "success") {
|
|
276
|
-
outline = outlineResult.data.map((item) => ({
|
|
277
|
-
name: item.name,
|
|
278
|
-
kind: item.kind,
|
|
279
|
-
startLine: item.startLine,
|
|
280
|
-
endLine: item.endLine,
|
|
281
|
-
}));
|
|
282
|
-
}
|
|
283
|
-
|
|
284
|
-
const importsResult = await provider.imports(relPath);
|
|
285
|
-
if (importsResult.kind === "success") {
|
|
286
|
-
imports = importsResult.data;
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
const exportsResult = await provider.exports(relPath);
|
|
290
|
-
if (exportsResult.kind === "success") {
|
|
291
|
-
exports = exportsResult.data.map((item) => ({
|
|
292
|
-
name: item.name,
|
|
293
|
-
kind: item.kind,
|
|
294
|
-
}));
|
|
295
|
-
}
|
|
296
|
-
} catch {
|
|
297
|
-
// Provider not available
|
|
298
|
-
}
|
|
299
|
-
|
|
300
|
-
return { nodeInfo, outline, imports, exports };
|
|
301
|
-
}
|
|
302
|
-
|
|
303
226
|
function noModelResult(): BriefUseCaseResult {
|
|
304
227
|
return {
|
|
305
228
|
content:
|
|
@@ -318,7 +241,7 @@ function noModelResult(): BriefUseCaseResult {
|
|
|
318
241
|
|
|
319
242
|
function formatDisambiguation(
|
|
320
243
|
symbol: string,
|
|
321
|
-
result: Extract<
|
|
244
|
+
result: Extract<TargetOutcome, { kind: "disambiguation" }>,
|
|
322
245
|
): string {
|
|
323
246
|
const lines: string[] = [];
|
|
324
247
|
lines.push(`# Disambiguation needed for \`${symbol}\``);
|