@mrclrchtr/supi-code-intelligence 1.16.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +373 -63
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
- package/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
- package/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
- package/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/README.md +44 -56
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.d.ts +21 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/lib/common/protocol.diagnostic.js +1 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/lib/common/protocol.inlineValue.d.ts +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/vscode-languageserver-protocol/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/package.json +4 -31
- package/node_modules/@mrclrchtr/supi-lsp/src/api.ts +27 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client-refresh.ts +5 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +246 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/client/transport.ts +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/capabilities.ts +3 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/config.ts +4 -2
- package/node_modules/@mrclrchtr/supi-lsp/src/config/lsp-settings.ts +102 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-actions.ts +59 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/config/server-config.ts +4 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/index.ts +11 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/capability-index.ts +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager-project-info.ts +2 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/manager/manager.ts +115 -26
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/lsp-semantic-provider.ts +177 -134
- package/node_modules/@mrclrchtr/supi-lsp/src/provider/refactor-planning.ts +214 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-controller.ts +320 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/session/runtime-registration.ts +26 -5
- package/node_modules/@mrclrchtr/supi-lsp/src/session/service-registry.ts +81 -4
- package/node_modules/@mrclrchtr/supi-lsp/src/summary.ts +2 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/README.md +18 -37
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +3 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/capability/types.ts +56 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/evidence-badge.ts +40 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +5 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/types.ts +76 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/runtime.ts +37 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +6 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/abort-utils.ts +31 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/api.ts +8 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +10 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/index.ts +6 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +134 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +9 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +109 -4
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +5 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +11 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +68 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/LICENSE +21 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/README.md +265 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs +4661 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.cjs.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js +4605 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.js.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/debug/web-tree-sitter.wasm.map +57 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/package.json +100 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs +4063 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.cjs.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts +1025 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.cts.map +58 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts +1025 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.d.ts.map +58 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js +4007 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.js.map +7 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm +0 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/web-tree-sitter/web-tree-sitter.wasm.map +55 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +6 -12
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/api.ts +29 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/index.ts +28 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/language.ts +5 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/provider/tree-sitter-provider.ts +14 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/runtime-controller.ts +157 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/session/session.ts +8 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/call-sites.ts +86 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/callees.ts +35 -16
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/structure.ts +1 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/types.ts +10 -0
- package/package.json +14 -9
- package/src/{model.ts → analysis/architecture/discovery.ts} +15 -72
- package/src/analysis/architecture/model.ts +76 -0
- package/src/analysis/brief/directory.ts +324 -0
- package/src/analysis/brief/enrich.ts +157 -0
- package/src/analysis/brief/file.ts +84 -0
- package/src/analysis/brief/inventory.ts +177 -0
- package/src/analysis/brief/main.ts +176 -0
- package/src/analysis/brief/models.ts +75 -0
- package/src/{brief.ts → analysis/brief/public-brief.ts} +21 -26
- package/src/analysis/brief/summarize.ts +208 -0
- package/src/analysis/brief/types.ts +27 -0
- package/src/{use-case/generate-brief.ts → analysis/brief/use-case.ts} +67 -144
- package/src/analysis/coverage/coverage-warnings.ts +224 -0
- package/src/analysis/evidence.ts +91 -0
- package/src/{semantic-action-helpers.ts → analysis/helpers.ts} +4 -4
- package/src/analysis/provider.ts +186 -0
- package/src/analysis/read-next.ts +126 -0
- package/src/analysis/readiness.ts +73 -0
- package/src/{refactor → analysis/refactor}/safety.ts +1 -1
- package/src/{use-case/support/semantic-references.ts → analysis/references/semantic-refs.ts} +58 -26
- package/src/analysis/search/pattern.ts +345 -0
- package/src/analysis/search/ripgrep.ts +473 -0
- package/src/{git-context.ts → analysis/signals/git.ts} +20 -7
- package/src/{prioritization-signals.ts → analysis/signals/project.ts} +33 -19
- package/src/analysis/target/anchored.ts +349 -0
- package/src/analysis/target/bridge.ts +152 -0
- package/src/analysis/target/file-resolution.ts +125 -0
- package/src/{targeting/resolve-file.ts → analysis/target/file.ts} +40 -20
- package/src/{planner → analysis/target}/planner.ts +30 -20
- package/src/{targeting → analysis/target}/query.ts +17 -3
- package/src/analysis/target/resolve-common.ts +115 -0
- package/src/analysis/target/service.ts +229 -0
- package/src/analysis/target/symbol.ts +196 -0
- package/src/{targeting → analysis/target}/types.ts +17 -1
- package/src/analysis/tests/likely-tests.ts +174 -0
- package/src/analysis/tests/test-discovery.ts +540 -0
- package/src/analysis/tests/vitest.ts +87 -0
- package/src/api.ts +34 -41
- package/src/app/app.ts +125 -0
- package/src/app/manager.ts +65 -0
- package/src/extension.ts +132 -1
- package/src/index.ts +1 -57
- package/src/session/refactor-plans.ts +82 -0
- package/src/session/session.ts +300 -0
- package/src/session/target-store.ts +293 -0
- package/src/substrate/lsp/diagnostic-injection.ts +218 -0
- package/src/substrate/lsp/lifecycle.ts +66 -0
- package/src/substrate/lsp/overrides.ts +132 -0
- package/src/substrate/lsp/recovery.ts +55 -0
- package/src/substrate/lsp/settings.ts +286 -0
- package/src/substrate/lsp/state.ts +46 -0
- package/src/substrate/lsp/utils.ts +17 -0
- package/src/substrate/tree-sitter/lifecycle.ts +52 -0
- package/src/tool/find/execute.ts +118 -0
- package/src/{presentation/markdown/pattern.ts → tool/find/markdown.ts} +102 -53
- package/src/{use-case/generate-pattern.ts → tool/find/orchestrate.ts} +67 -33
- package/src/tool/find/semantic-search.ts +114 -0
- package/src/tool/find/tui.ts +39 -0
- package/src/tool/graph/callees.ts +87 -0
- package/src/tool/graph/calls-md.ts +54 -0
- package/src/tool/graph/collect-relation.ts +371 -0
- package/src/tool/graph/execute.ts +95 -0
- package/src/tool/graph/implementations-md.ts +79 -0
- package/src/tool/graph/implementations.ts +76 -0
- package/src/tool/graph/markdown-base.ts +243 -0
- package/src/tool/graph/orchestrate.ts +285 -0
- package/src/tool/graph/references-md.ts +34 -0
- package/src/tool/graph/references.ts +81 -0
- package/src/tool/graph/tui.ts +120 -0
- package/src/tool/graph/types.ts +97 -0
- package/src/tool/guidance.ts +96 -49
- package/src/tool/health/execute.ts +76 -0
- package/src/tool/health/markdown.ts +280 -0
- package/src/tool/health/orchestrate.ts +159 -0
- package/src/tool/health/sections/diagnostics.ts +182 -0
- package/src/tool/health/sections/recovery.ts +89 -0
- package/src/tool/health/sections/signals.ts +89 -0
- package/src/tool/health/tui.ts +137 -0
- package/src/tool/impact/analysis.ts +247 -0
- package/src/tool/impact/change-set-impact.ts +151 -0
- package/src/tool/impact/execute.ts +98 -0
- package/src/tool/impact/file-level-impact.ts +81 -0
- package/src/tool/impact/markdown.ts +283 -0
- package/src/tool/impact/orchestrate.ts +97 -0
- package/src/tool/impact/result.ts +21 -0
- package/src/tool/impact/single-impact.ts +89 -0
- package/src/tool/impact/tui.ts +39 -0
- package/src/tool/impact/types.ts +34 -0
- package/src/tool/infra/cross-field.ts +335 -0
- package/src/tool/infra/error-results.ts +199 -0
- package/src/tool/infra/pipeline.ts +311 -0
- package/src/tool/infra/progress.ts +21 -0
- package/src/tool/infra/readiness-message.ts +5 -0
- package/src/tool/infra/truncate.ts +49 -0
- package/src/tool/inspect/execute.ts +76 -0
- package/src/tool/inspect/markdown.ts +169 -0
- package/src/tool/inspect/orchestrate.ts +156 -0
- package/src/tool/inspect/tui.ts +36 -0
- package/src/tool/orientation/deps.ts +63 -0
- package/src/tool/orientation/execute.ts +50 -0
- package/src/tool/orientation/markdown.ts +35 -0
- package/src/tool/orientation/mode.ts +88 -0
- package/src/tool/orientation/orchestrate.ts +478 -0
- package/src/tool/orientation/precise-target.ts +257 -0
- package/src/tool/orientation/tui.ts +131 -0
- package/src/{refactor/apply-workspace-edit.ts → tool/refactor-apply/apply.ts} +39 -16
- package/src/tool/refactor-apply/execute.ts +20 -0
- package/src/tool/refactor-apply/markdown.ts +118 -0
- package/src/tool/refactor-apply/orchestrate.ts +89 -0
- package/src/tool/refactor-apply/tui.ts +51 -0
- package/src/tool/refactor-plan/execute.ts +73 -0
- package/src/tool/refactor-plan/markdown.ts +118 -0
- package/src/tool/refactor-plan/orchestrate.ts +363 -0
- package/src/tool/refactor-plan/tui.ts +42 -0
- package/src/tool/register.ts +123 -0
- package/src/tool/resolve/execute.ts +82 -0
- package/src/tool/resolve/markdown.ts +150 -0
- package/src/tool/resolve/orchestrate.ts +134 -0
- package/src/tool/resolve/tui.ts +40 -0
- package/src/tool/schemas.ts +337 -0
- package/src/tool/specs.ts +257 -0
- package/src/types/details.ts +188 -0
- package/src/types/execution.ts +60 -0
- package/src/types/index.ts +28 -0
- package/src/{intent/types.ts → types/tool-names.ts} +15 -14
- package/src/ui/footer.ts +52 -0
- package/src/ui/markdown/brief.ts +218 -0
- package/src/ui/markdown/gather.ts +177 -0
- package/src/{use-case/build-overview.ts → ui/markdown/overview-data.ts} +2 -2
- package/src/{presentation → ui}/markdown/overview.ts +2 -2
- package/src/ui/markdown/types.ts +80 -0
- package/{node_modules/@mrclrchtr/supi-lsp/src/ui/renderer.ts → src/ui/message-renderer.ts} +11 -10
- package/src/ui/status-command.ts +260 -0
- package/src/ui/status-overlay.ts +500 -0
- package/src/ui/tui/common.ts +220 -0
- package/src/ui/tui/index.ts +37 -0
- package/node_modules/@mrclrchtr/supi-lsp/src/extension.ts +0 -1
- package/node_modules/@mrclrchtr/supi-lsp/src/format.ts +0 -373
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/diagnostic-injection.ts +0 -182
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/session-lifecycle.ts +0 -149
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/status-command.ts +0 -38
- package/node_modules/@mrclrchtr/supi-lsp/src/handlers/workspace-recovery.ts +0 -92
- package/node_modules/@mrclrchtr/supi-lsp/src/lsp.ts +0 -37
- package/node_modules/@mrclrchtr/supi-lsp/src/session/lsp-state.ts +0 -93
- package/node_modules/@mrclrchtr/supi-lsp/src/session/settings-registration.ts +0 -296
- package/node_modules/@mrclrchtr/supi-lsp/src/session/tree-persist.ts +0 -75
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/guidance.ts +0 -69
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/names.ts +0 -27
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/overrides.ts +0 -204
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/register-tools.ts +0 -69
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/service-actions.ts +0 -399
- package/node_modules/@mrclrchtr/supi-lsp/src/tool/tool-specs.ts +0 -248
- package/node_modules/@mrclrchtr/supi-lsp/src/ui/ui.ts +0 -360
- package/node_modules/@mrclrchtr/supi-lsp/src/workspace-change.ts +0 -40
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/extension.ts +0 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/formatting.ts +0 -104
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/guidance.ts +0 -35
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/handlers.ts +0 -196
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/register-tools.ts +0 -107
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tool/tool-specs.ts +0 -117
- package/node_modules/@mrclrchtr/supi-tree-sitter/src/tree-sitter.ts +0 -47
- package/src/brief-focused.ts +0 -563
- package/src/code-intelligence.ts +0 -70
- package/src/pattern-structured.ts +0 -194
- package/src/presentation/markdown/affected.ts +0 -170
- package/src/presentation/markdown/brief.ts +0 -174
- package/src/presentation/markdown/map.ts +0 -54
- package/src/presentation/markdown/refactor.ts +0 -27
- package/src/presentation/markdown/relations.ts +0 -121
- package/src/resolve-target.ts +0 -130
- package/src/search-helpers.ts +0 -303
- package/src/substrates/types.ts +0 -30
- package/src/target-resolution.ts +0 -122
- package/src/targeting/resolve-anchored.ts +0 -80
- package/src/targeting/resolve-symbol.ts +0 -110
- package/src/tool/execute-affected.ts +0 -71
- package/src/tool/execute-brief.ts +0 -59
- package/src/tool/execute-map.ts +0 -35
- package/src/tool/execute-pattern.ts +0 -29
- package/src/tool/execute-refactor.ts +0 -101
- package/src/tool/execute-relations.ts +0 -79
- package/src/tool/register-tools.ts +0 -32
- package/src/tool/tool-specs.ts +0 -190
- package/src/tool/validation.ts +0 -43
- package/src/types.ts +0 -169
- package/src/use-case/generate-affected.ts +0 -297
- package/src/use-case/generate-map.ts +0 -176
- package/src/use-case/generate-relations.ts +0 -438
- package/src/use-case/types.ts +0 -43
- package/src/workspace/request-context.ts +0 -139
- /package/src/{query-params.ts → tool/params.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrclrchtr/supi-code-intelligence",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "SuPi Code Intelligence extension — architecture briefs, caller/callee analysis, impact assessment, and pattern search for pi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -28,14 +28,16 @@
|
|
|
28
28
|
"lsp",
|
|
29
29
|
"tree-sitter"
|
|
30
30
|
],
|
|
31
|
+
"type": "module",
|
|
31
32
|
"files": [
|
|
32
33
|
"src/**/*.ts"
|
|
33
34
|
],
|
|
34
35
|
"dependencies": {
|
|
35
|
-
"
|
|
36
|
-
"@mrclrchtr/supi-
|
|
37
|
-
"@mrclrchtr/supi-core": "
|
|
38
|
-
"@mrclrchtr/supi-
|
|
36
|
+
"ts-pattern": "^5.9.0",
|
|
37
|
+
"@mrclrchtr/supi-code-runtime": "2.0.0",
|
|
38
|
+
"@mrclrchtr/supi-core": "2.0.0",
|
|
39
|
+
"@mrclrchtr/supi-lsp": "2.0.0",
|
|
40
|
+
"@mrclrchtr/supi-tree-sitter": "2.0.0"
|
|
39
41
|
},
|
|
40
42
|
"bundledDependencies": [
|
|
41
43
|
"@mrclrchtr/supi-code-runtime",
|
|
@@ -46,6 +48,7 @@
|
|
|
46
48
|
"peerDependencies": {
|
|
47
49
|
"@earendil-works/pi-ai": "*",
|
|
48
50
|
"@earendil-works/pi-coding-agent": "*",
|
|
51
|
+
"@earendil-works/pi-tui": "*",
|
|
49
52
|
"typebox": "*"
|
|
50
53
|
},
|
|
51
54
|
"peerDependenciesMeta": {
|
|
@@ -55,20 +58,22 @@
|
|
|
55
58
|
"@earendil-works/pi-coding-agent": {
|
|
56
59
|
"optional": true
|
|
57
60
|
},
|
|
61
|
+
"@earendil-works/pi-tui": {
|
|
62
|
+
"optional": true
|
|
63
|
+
},
|
|
58
64
|
"typebox": {
|
|
59
65
|
"optional": true
|
|
60
66
|
}
|
|
61
67
|
},
|
|
62
68
|
"pi": {
|
|
63
69
|
"extensions": [
|
|
64
|
-
"./src/extension.ts"
|
|
65
|
-
"node_modules/@mrclrchtr/supi-lsp/src/extension.ts",
|
|
66
|
-
"node_modules/@mrclrchtr/supi-tree-sitter/src/extension.ts"
|
|
70
|
+
"./src/extension.ts"
|
|
67
71
|
],
|
|
68
72
|
"image": "https://raw.githubusercontent.com/mrclrchtr/supi/main/screenshots/supi-code-intelligence.png"
|
|
69
73
|
},
|
|
70
|
-
"main": "src/
|
|
74
|
+
"main": "src/index.ts",
|
|
71
75
|
"exports": {
|
|
76
|
+
".": "./src/index.ts",
|
|
72
77
|
"./api": "./src/api.ts",
|
|
73
78
|
"./extension": "./src/extension.ts",
|
|
74
79
|
"./package.json": "./package.json"
|
|
@@ -1,52 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Architecture model discovery — scans project metadata to build a structural
|
|
3
|
+
* workspace model for auto-injected overviews and on-demand briefs.
|
|
4
|
+
*/
|
|
3
5
|
|
|
4
6
|
import * as fs from "node:fs";
|
|
5
7
|
import * as path from "node:path";
|
|
6
|
-
import { findProjectRoot,
|
|
7
|
-
|
|
8
|
-
// ── Types ─────────────────────────────────────────────────────────────
|
|
9
|
-
|
|
10
|
-
export interface ArchitectureModel {
|
|
11
|
-
/** Absolute root directory of the project */
|
|
12
|
-
root: string;
|
|
13
|
-
/** Project name from root manifest */
|
|
14
|
-
name: string | null;
|
|
15
|
-
/** Project description from root manifest */
|
|
16
|
-
description: string | null;
|
|
17
|
-
/** Detected modules/packages */
|
|
18
|
-
modules: ModuleInfo[];
|
|
19
|
-
/** Internal dependency edges between modules */
|
|
20
|
-
edges: DependencyEdge[];
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface ModuleInfo {
|
|
24
|
-
/** Package/module name */
|
|
25
|
-
name: string;
|
|
26
|
-
/** Short description from manifest */
|
|
27
|
-
description: string | null;
|
|
28
|
-
/** Absolute path to the module root */
|
|
29
|
-
root: string;
|
|
30
|
-
/** Relative path from project root */
|
|
31
|
-
relativePath: string;
|
|
32
|
-
/** Main entrypoint(s) from manifest */
|
|
33
|
-
entrypoints: string[];
|
|
34
|
-
/** Whether this is a leaf module (no internal dependents) */
|
|
35
|
-
isLeaf: boolean;
|
|
36
|
-
/** Internal dependency names */
|
|
37
|
-
internalDeps: string[];
|
|
38
|
-
/** External dependency names */
|
|
39
|
-
externalDeps: string[];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
export interface DependencyEdge {
|
|
43
|
-
/** Source module name */
|
|
44
|
-
from: string;
|
|
45
|
-
/** Target module name */
|
|
46
|
-
to: string;
|
|
47
|
-
}
|
|
8
|
+
import { findProjectRoot, walkProject } from "@mrclrchtr/supi-core/project";
|
|
9
|
+
import type { ArchitectureModel, DependencyEdge, ModuleInfo } from "./model.ts";
|
|
48
10
|
|
|
49
|
-
// ──
|
|
11
|
+
// ── Constants ─────────────────────────────────────────────────────────
|
|
50
12
|
|
|
51
13
|
const PROJECT_MARKERS = [
|
|
52
14
|
"package.json",
|
|
@@ -71,6 +33,8 @@ interface PackageJson {
|
|
|
71
33
|
pi?: { extensions?: string[] };
|
|
72
34
|
}
|
|
73
35
|
|
|
36
|
+
// ── Public entry point ────────────────────────────────────────────────
|
|
37
|
+
|
|
74
38
|
/**
|
|
75
39
|
* Build an architecture model from project metadata.
|
|
76
40
|
* Starts from cheap manifest scanning — no deep AST or LSP analysis.
|
|
@@ -116,6 +80,8 @@ export async function buildArchitectureModel(cwd: string): Promise<ArchitectureM
|
|
|
116
80
|
};
|
|
117
81
|
}
|
|
118
82
|
|
|
83
|
+
// ── Manifest reading ──────────────────────────────────────────────────
|
|
84
|
+
|
|
119
85
|
function readPackageJson(dir: string): PackageJson | null {
|
|
120
86
|
try {
|
|
121
87
|
const raw = fs.readFileSync(path.join(dir, "package.json"), "utf-8");
|
|
@@ -125,6 +91,8 @@ function readPackageJson(dir: string): PackageJson | null {
|
|
|
125
91
|
}
|
|
126
92
|
}
|
|
127
93
|
|
|
94
|
+
// ── Workspace detection ───────────────────────────────────────────────
|
|
95
|
+
|
|
128
96
|
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: workspace detection with manifest parsing
|
|
129
97
|
async function detectWorkspaceModules(
|
|
130
98
|
root: string,
|
|
@@ -241,6 +209,8 @@ function collectPackageDirs(baseDir: string, dirs: string[], depth: number): voi
|
|
|
241
209
|
}
|
|
242
210
|
}
|
|
243
211
|
|
|
212
|
+
// ── Fallback models ───────────────────────────────────────────────────
|
|
213
|
+
|
|
244
214
|
function buildSinglePackageModel(root: string, manifest: PackageJson): ArchitectureModel {
|
|
245
215
|
const entrypoints: string[] = [];
|
|
246
216
|
if (manifest.pi?.extensions) {
|
|
@@ -297,30 +267,3 @@ function buildMinimalModel(root: string): ArchitectureModel | null {
|
|
|
297
267
|
edges: [],
|
|
298
268
|
};
|
|
299
269
|
}
|
|
300
|
-
|
|
301
|
-
// ── Query helpers ─────────────────────────────────────────────────────
|
|
302
|
-
|
|
303
|
-
export function findModuleForPath(model: ArchitectureModel, filePath: string): ModuleInfo | null {
|
|
304
|
-
const resolved = path.resolve(filePath);
|
|
305
|
-
let best: ModuleInfo | null = null;
|
|
306
|
-
|
|
307
|
-
for (const mod of model.modules) {
|
|
308
|
-
if (isWithinOrEqual(mod.root, resolved)) {
|
|
309
|
-
if (!best || mod.root.length > best.root.length) {
|
|
310
|
-
best = mod;
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
return best;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
export function getDependents(model: ArchitectureModel, moduleName: string): ModuleInfo[] {
|
|
319
|
-
return model.modules.filter((m) => m.internalDeps.includes(moduleName));
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
export function getDependencies(model: ArchitectureModel, moduleName: string): ModuleInfo[] {
|
|
323
|
-
const mod = model.modules.find((m) => m.name === moduleName);
|
|
324
|
-
if (!mod) return [];
|
|
325
|
-
return model.modules.filter((m) => mod.internalDeps.includes(m.name));
|
|
326
|
-
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Architecture model types and query helpers.
|
|
3
|
+
*
|
|
4
|
+
* Discovery logic lives in {@link ./discovery.ts}.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import * as path from "node:path";
|
|
8
|
+
import { isWithinOrEqual } from "@mrclrchtr/supi-core/project";
|
|
9
|
+
|
|
10
|
+
// ── Types ─────────────────────────────────────────────────────────────
|
|
11
|
+
|
|
12
|
+
export interface ArchitectureModel {
|
|
13
|
+
/** Absolute root directory of the project */
|
|
14
|
+
root: string;
|
|
15
|
+
/** Project name from root manifest */
|
|
16
|
+
name: string | null;
|
|
17
|
+
/** Project description from root manifest */
|
|
18
|
+
description: string | null;
|
|
19
|
+
/** Detected modules/packages */
|
|
20
|
+
modules: ModuleInfo[];
|
|
21
|
+
/** Internal dependency edges between modules */
|
|
22
|
+
edges: DependencyEdge[];
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export interface ModuleInfo {
|
|
26
|
+
/** Package/module name */
|
|
27
|
+
name: string;
|
|
28
|
+
/** Short description from manifest */
|
|
29
|
+
description: string | null;
|
|
30
|
+
/** Absolute path to the module root */
|
|
31
|
+
root: string;
|
|
32
|
+
/** Relative path from project root */
|
|
33
|
+
relativePath: string;
|
|
34
|
+
/** Main entrypoint(s) from manifest */
|
|
35
|
+
entrypoints: string[];
|
|
36
|
+
/** Whether this is a leaf module (no internal dependents) */
|
|
37
|
+
isLeaf: boolean;
|
|
38
|
+
/** Internal dependency names */
|
|
39
|
+
internalDeps: string[];
|
|
40
|
+
/** External dependency names */
|
|
41
|
+
externalDeps: string[];
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export interface DependencyEdge {
|
|
45
|
+
/** Source module name */
|
|
46
|
+
from: string;
|
|
47
|
+
/** Target module name */
|
|
48
|
+
to: string;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ── Query helpers ─────────────────────────────────────────────────────
|
|
52
|
+
|
|
53
|
+
export function findModuleForPath(model: ArchitectureModel, filePath: string): ModuleInfo | null {
|
|
54
|
+
const resolved = path.resolve(filePath);
|
|
55
|
+
let best: ModuleInfo | null = null;
|
|
56
|
+
|
|
57
|
+
for (const mod of model.modules) {
|
|
58
|
+
if (isWithinOrEqual(mod.root, resolved)) {
|
|
59
|
+
if (!best || mod.root.length > best.root.length) {
|
|
60
|
+
best = mod;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return best;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export function getDependents(model: ArchitectureModel, moduleName: string): ModuleInfo[] {
|
|
69
|
+
return model.modules.filter((m) => m.internalDeps.includes(moduleName));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
export function getDependencies(model: ArchitectureModel, moduleName: string): ModuleInfo[] {
|
|
73
|
+
const mod = model.modules.find((m) => m.name === moduleName);
|
|
74
|
+
if (!mod) return [];
|
|
75
|
+
return model.modules.filter((m) => mod.internalDeps.includes(m.name));
|
|
76
|
+
}
|
|
@@ -0,0 +1,324 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Directory and module brief generation.
|
|
3
|
+
*
|
|
4
|
+
* Formats briefs for module directories (with dependency info, entrypoints,
|
|
5
|
+
* and aggregated diagnostics) and non-module directories (with recursive summaries
|
|
6
|
+
* and import/export counts).
|
|
7
|
+
*
|
|
8
|
+
* Extracted from brief-focused.ts.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import * as path from "node:path";
|
|
12
|
+
import type { SessionLspServiceState } from "@mrclrchtr/supi-lsp/api";
|
|
13
|
+
import { renderModuleDiagnostics } from "../../ui/markdown/brief.ts";
|
|
14
|
+
import type { ArchitectureModel } from "../architecture/model.ts";
|
|
15
|
+
import { findModuleForPath, getDependencies, getDependents } from "../architecture/model.ts";
|
|
16
|
+
import { addInventoryToLines, collectDirectoryInventory } from "./inventory.ts";
|
|
17
|
+
import type { BriefOpts } from "./models.ts";
|
|
18
|
+
import { listSourceFiles, summarizeDirectoryRecursively } from "./summarize.ts";
|
|
19
|
+
|
|
20
|
+
/** Generate a directory-level brief (handles both module and non-module directories). */
|
|
21
|
+
export async function generateDirectoryBrief(
|
|
22
|
+
model: ArchitectureModel,
|
|
23
|
+
resolvedPath: string,
|
|
24
|
+
originalPath: string,
|
|
25
|
+
opts?: BriefOpts,
|
|
26
|
+
): Promise<{
|
|
27
|
+
lines: string[];
|
|
28
|
+
publicSurfaces: string[];
|
|
29
|
+
nextQueries: string[];
|
|
30
|
+
startHere: Array<{ target: string; reason: string }>;
|
|
31
|
+
}> {
|
|
32
|
+
const mod = findModuleForPath(model, resolvedPath);
|
|
33
|
+
const lines: string[] = [];
|
|
34
|
+
const publicSurfaces: string[] = [];
|
|
35
|
+
const nextQueries: string[] = [];
|
|
36
|
+
|
|
37
|
+
if (mod && mod.root === resolvedPath) {
|
|
38
|
+
const startHere: Array<{ target: string; reason: string }> = [];
|
|
39
|
+
formatModuleBrief({
|
|
40
|
+
mod,
|
|
41
|
+
model,
|
|
42
|
+
lines,
|
|
43
|
+
startHere,
|
|
44
|
+
publicSurfaces,
|
|
45
|
+
nextQueries,
|
|
46
|
+
resolvedPath,
|
|
47
|
+
maxResults: opts?.maxResults ?? 10,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
// Add aggregated diagnostics for module source files
|
|
51
|
+
await enrichModuleWithDiagnostics(lines, resolvedPath, opts);
|
|
52
|
+
|
|
53
|
+
return { lines, publicSurfaces, nextQueries, startHere };
|
|
54
|
+
} else {
|
|
55
|
+
formatNonModuleDir({
|
|
56
|
+
model,
|
|
57
|
+
mod,
|
|
58
|
+
resolvedPath,
|
|
59
|
+
originalPath,
|
|
60
|
+
lines,
|
|
61
|
+
publicSurfaces,
|
|
62
|
+
nextQueries,
|
|
63
|
+
maxResults: opts?.maxResults ?? 10,
|
|
64
|
+
});
|
|
65
|
+
|
|
66
|
+
return { lines, publicSurfaces, nextQueries, startHere: [] };
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// ── Module brief ──────────────────────────────────────────────────────
|
|
71
|
+
|
|
72
|
+
interface ModuleBriefContext {
|
|
73
|
+
mod: NonNullable<ReturnType<typeof findModuleForPath>>;
|
|
74
|
+
model: ArchitectureModel;
|
|
75
|
+
lines: string[];
|
|
76
|
+
startHere: Array<{ target: string; reason: string }>;
|
|
77
|
+
publicSurfaces: string[];
|
|
78
|
+
nextQueries: string[];
|
|
79
|
+
resolvedPath: string;
|
|
80
|
+
maxResults: number;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
function formatModuleBrief(ctx: ModuleBriefContext): void {
|
|
84
|
+
const { mod, model, lines, startHere, publicSurfaces, nextQueries, resolvedPath } = ctx;
|
|
85
|
+
const shortName = mod.name.replace(/^@[^/]+\//, "");
|
|
86
|
+
lines.push(`# Module: ${shortName}`);
|
|
87
|
+
if (mod.description) {
|
|
88
|
+
lines.push("");
|
|
89
|
+
lines.push(mod.description);
|
|
90
|
+
}
|
|
91
|
+
lines.push("");
|
|
92
|
+
lines.push(`- Path: \`${mod.relativePath}\``);
|
|
93
|
+
|
|
94
|
+
if (mod.entrypoints.length > 0) {
|
|
95
|
+
lines.push(`- Entrypoints: ${mod.entrypoints.map((e) => `\`${e}\``).join(", ")}`);
|
|
96
|
+
for (const ep of mod.entrypoints) {
|
|
97
|
+
publicSurfaces.push(`${shortName}: ${ep}`);
|
|
98
|
+
startHere.push({ target: ep, reason: "module entrypoint" });
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
addDependenciesSection(model, mod, lines);
|
|
103
|
+
addDependentsSection(model, mod, lines, nextQueries);
|
|
104
|
+
addSourceFilesSection(resolvedPath, lines, ctx.maxResults);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function addDependenciesSection(
|
|
108
|
+
model: ArchitectureModel,
|
|
109
|
+
mod: NonNullable<ReturnType<typeof findModuleForPath>>,
|
|
110
|
+
lines: string[],
|
|
111
|
+
): void {
|
|
112
|
+
const deps = getDependencies(model, mod.name);
|
|
113
|
+
if (deps.length > 0) {
|
|
114
|
+
lines.push("");
|
|
115
|
+
lines.push("## Dependencies (internal)");
|
|
116
|
+
for (const dep of deps) {
|
|
117
|
+
const depShort = dep.name.replace(/^@[^/]+\//, "");
|
|
118
|
+
lines.push(`- ${depShort} (\`${dep.relativePath}\`)`);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
if (mod.externalDeps.length > 0) {
|
|
123
|
+
const shown = mod.externalDeps.slice(0, 8);
|
|
124
|
+
lines.push("");
|
|
125
|
+
lines.push("## Dependencies (external)");
|
|
126
|
+
for (const dep of shown) {
|
|
127
|
+
lines.push(`- ${dep}`);
|
|
128
|
+
}
|
|
129
|
+
if (mod.externalDeps.length > 8) {
|
|
130
|
+
lines.push(`- _+${mod.externalDeps.length - 8} more_`);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
function addDependentsSection(
|
|
136
|
+
model: ArchitectureModel,
|
|
137
|
+
mod: NonNullable<ReturnType<typeof findModuleForPath>>,
|
|
138
|
+
lines: string[],
|
|
139
|
+
nextQueries: string[],
|
|
140
|
+
): void {
|
|
141
|
+
const dependents = getDependents(model, mod.name);
|
|
142
|
+
if (dependents.length > 0) {
|
|
143
|
+
lines.push("");
|
|
144
|
+
lines.push("## Dependents");
|
|
145
|
+
for (const dep of dependents) {
|
|
146
|
+
const depShort = dep.name.replace(/^@[^/]+\//, "");
|
|
147
|
+
lines.push(`- ${depShort} (\`${dep.relativePath}\`)`);
|
|
148
|
+
}
|
|
149
|
+
nextQueries.push("`code_impact` before modifying exports from this module");
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
if (mod.entrypoints.length > 0) {
|
|
153
|
+
const ep = mod.entrypoints[0];
|
|
154
|
+
nextQueries.push(
|
|
155
|
+
`\`code_orientation\` with \`focus: "${mod.relativePath}/${ep.replace(/^\.\//, "")}"\` for entrypoint details`,
|
|
156
|
+
);
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
function addSourceFilesSection(resolvedPath: string, lines: string[], maxResults = 10): void {
|
|
161
|
+
const files = listSourceFiles(resolvedPath);
|
|
162
|
+
if (files.length > 0) {
|
|
163
|
+
const shown = files.slice(0, maxResults);
|
|
164
|
+
lines.push("");
|
|
165
|
+
lines.push("## Source Files");
|
|
166
|
+
for (const f of shown) {
|
|
167
|
+
lines.push(`- \`${f}\``);
|
|
168
|
+
}
|
|
169
|
+
if (files.length > maxResults) {
|
|
170
|
+
lines.push(`- _+${files.length - maxResults} more files_`);
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
const inventory = collectDirectoryInventory(resolvedPath);
|
|
175
|
+
if (inventory.totalFiles > 0) {
|
|
176
|
+
addInventoryToLines(lines, inventory);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
// ── Non-module directory brief ────────────────────────────────────────
|
|
181
|
+
|
|
182
|
+
interface NonModuleDirContext {
|
|
183
|
+
model: ArchitectureModel;
|
|
184
|
+
mod: ReturnType<typeof findModuleForPath>;
|
|
185
|
+
resolvedPath: string;
|
|
186
|
+
originalPath: string;
|
|
187
|
+
lines: string[];
|
|
188
|
+
publicSurfaces: string[];
|
|
189
|
+
nextQueries: string[];
|
|
190
|
+
maxResults: number;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: nested-directory brief formatting is clearer as one staged formatter
|
|
194
|
+
function formatNonModuleDir(ctx: NonModuleDirContext): void {
|
|
195
|
+
const { model, mod, resolvedPath, originalPath, lines, publicSurfaces, nextQueries, maxResults } =
|
|
196
|
+
ctx;
|
|
197
|
+
const relPath = path.relative(model.root, resolvedPath);
|
|
198
|
+
lines.push(`# Directory: ${relPath || originalPath}`);
|
|
199
|
+
lines.push("");
|
|
200
|
+
|
|
201
|
+
if (mod) {
|
|
202
|
+
const shortName = mod.name.replace(/^@[^/]+\//, "");
|
|
203
|
+
lines.push(`_Inside module: ${shortName} (\`${mod.relativePath}\`)_`);
|
|
204
|
+
lines.push("");
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
const summary = summarizeDirectoryRecursively(resolvedPath);
|
|
208
|
+
if (summary.directFiles.length > 0) {
|
|
209
|
+
lines.push("## Source Files");
|
|
210
|
+
for (const f of summary.directFiles.slice(0, maxResults)) {
|
|
211
|
+
lines.push(`- \`${f}\``);
|
|
212
|
+
}
|
|
213
|
+
if (summary.directFiles.length > maxResults) {
|
|
214
|
+
lines.push(`- _+${summary.directFiles.length - maxResults} more files_`);
|
|
215
|
+
}
|
|
216
|
+
lines.push("");
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (summary.totalSourceFiles > 0) {
|
|
220
|
+
lines.push("## Descendant Source Files");
|
|
221
|
+
lines.push(`- Total: ${summary.totalSourceFiles}`);
|
|
222
|
+
for (const subdir of summary.subdirs.slice(0, 8)) {
|
|
223
|
+
lines.push(
|
|
224
|
+
`- \`${subdir.name}/\` — ${subdir.fileCount} file${subdir.fileCount !== 1 ? "s" : ""}`,
|
|
225
|
+
);
|
|
226
|
+
}
|
|
227
|
+
if (summary.subdirs.length > 8) {
|
|
228
|
+
lines.push(`- _+${summary.subdirs.length - 8} more subdirectories_`);
|
|
229
|
+
}
|
|
230
|
+
lines.push("");
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
if (summary.publicSurfaces.length > 0) {
|
|
234
|
+
lines.push("## Public Surfaces");
|
|
235
|
+
for (const surface of summary.publicSurfaces.slice(0, 8)) {
|
|
236
|
+
lines.push(`- ${surface}`);
|
|
237
|
+
publicSurfaces.push(surface);
|
|
238
|
+
}
|
|
239
|
+
if (summary.publicSurfaces.length > 8) {
|
|
240
|
+
lines.push(`- _+${summary.publicSurfaces.length - 8} more exports_`);
|
|
241
|
+
}
|
|
242
|
+
lines.push("");
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
if (summary.totalSourceFiles > 0) {
|
|
246
|
+
lines.push("## Import / Export Summary");
|
|
247
|
+
lines.push(`- Imports: ${summary.importCount}`);
|
|
248
|
+
lines.push(`- Exports: ${summary.exportCount}`);
|
|
249
|
+
lines.push("");
|
|
250
|
+
nextQueries.push(
|
|
251
|
+
`\`code_find\` with \`query: "..."\` and \`scope: "${relPath || originalPath}"\` to inspect a specific nested symbol`,
|
|
252
|
+
);
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
const inventory = collectDirectoryInventory(resolvedPath);
|
|
256
|
+
if (inventory.totalFiles > 0) {
|
|
257
|
+
addInventoryToLines(lines, inventory);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
if (summary.totalSourceFiles === 0) {
|
|
261
|
+
lines.push("No recognized source files in this directory.");
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
// ── Module diagnostics ────────────────────────────────────────────────
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Enrich a module brief with aggregated diagnostics for all source files.
|
|
269
|
+
*/
|
|
270
|
+
async function enrichModuleWithDiagnostics(
|
|
271
|
+
lines: string[],
|
|
272
|
+
dirPath: string,
|
|
273
|
+
opts?: BriefOpts,
|
|
274
|
+
): Promise<void> {
|
|
275
|
+
const sourceFiles = listSourceFiles(dirPath);
|
|
276
|
+
if (sourceFiles.length === 0 || !opts?.cwd) return;
|
|
277
|
+
|
|
278
|
+
const enrichmentDiags = await gatherModuleDiagnostics(
|
|
279
|
+
sourceFiles,
|
|
280
|
+
dirPath,
|
|
281
|
+
opts.cwd,
|
|
282
|
+
opts.lspService ??
|
|
283
|
+
({ kind: "unavailable" as const, reason: "No LSP service" } as SessionLspServiceState),
|
|
284
|
+
opts.maxResults,
|
|
285
|
+
);
|
|
286
|
+
if (enrichmentDiags) {
|
|
287
|
+
lines.push(enrichmentDiags);
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
// biome-ignore lint/complexity/useMaxParams: lspService is a DI seam, not a logic parameter
|
|
292
|
+
async function gatherModuleDiagnostics(
|
|
293
|
+
sourceFiles: string[],
|
|
294
|
+
dirPath: string,
|
|
295
|
+
cwd: string,
|
|
296
|
+
lspService: SessionLspServiceState,
|
|
297
|
+
maxResults?: number,
|
|
298
|
+
): Promise<string | null> {
|
|
299
|
+
try {
|
|
300
|
+
if (lspService.kind !== "ready") return null;
|
|
301
|
+
|
|
302
|
+
const fileDiags: Array<{ file: string; errors: number; warnings: number }> = [];
|
|
303
|
+
for (const basename of sourceFiles) {
|
|
304
|
+
const fullPath = path.join(dirPath, basename);
|
|
305
|
+
const relPath = path.relative(cwd, fullPath);
|
|
306
|
+
try {
|
|
307
|
+
const diags = await lspService.service.fileDiagnostics(relPath, 2);
|
|
308
|
+
if (!diags || diags.length === 0) continue;
|
|
309
|
+
const errors = diags.filter((d) => (d.severity ?? 1) === 1).length;
|
|
310
|
+
const warnings = diags.filter((d) => (d.severity ?? 1) === 2).length;
|
|
311
|
+
if (errors > 0 || warnings > 0) {
|
|
312
|
+
fileDiags.push({ file: basename, errors, warnings });
|
|
313
|
+
}
|
|
314
|
+
} catch {
|
|
315
|
+
// Skip file
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
if (fileDiags.length === 0) return null;
|
|
320
|
+
return renderModuleDiagnostics(fileDiags, maxResults) ?? null;
|
|
321
|
+
} catch {
|
|
322
|
+
return null;
|
|
323
|
+
}
|
|
324
|
+
}
|