@mrclrchtr/supi-code-intelligence 1.16.1 → 2.0.1
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,297 +0,0 @@
|
|
|
1
|
-
// Affected orchestration use-case — blast-radius analysis for a symbol change.
|
|
2
|
-
// Coordinates target resolution, reference collection, architecture analysis, and
|
|
3
|
-
// returns fully rendered content + details metadata.
|
|
4
|
-
|
|
5
|
-
import * as path from "node:path";
|
|
6
|
-
import { buildArchitectureModel, findModuleForPath, getDependents } from "../model.ts";
|
|
7
|
-
import {
|
|
8
|
-
renderAffectedFileLevel,
|
|
9
|
-
renderAffectedSingle,
|
|
10
|
-
} from "../presentation/markdown/affected.ts";
|
|
11
|
-
import { summarizePrioritySignalsForFiles } from "../prioritization-signals.ts";
|
|
12
|
-
import { resolveTarget } from "../resolve-target.ts";
|
|
13
|
-
import { isResolvedTargetGroup } from "../semantic-action-helpers.ts";
|
|
14
|
-
import type { ResolvedTarget, ResolvedTargetGroup } from "../target-resolution.ts";
|
|
15
|
-
import type { AffectedDetails, CodeIntelResult, ConfidenceMode } from "../types.ts";
|
|
16
|
-
import type { CodeProvider } from "../workspace/request-context.ts";
|
|
17
|
-
import {
|
|
18
|
-
aggregatePerTarget,
|
|
19
|
-
collectReferences,
|
|
20
|
-
type ReferenceCollection,
|
|
21
|
-
} from "./support/semantic-references.ts";
|
|
22
|
-
|
|
23
|
-
export interface AffectedInput {
|
|
24
|
-
file?: string;
|
|
25
|
-
line?: number;
|
|
26
|
-
character?: number;
|
|
27
|
-
symbol?: string;
|
|
28
|
-
exportedOnly?: boolean;
|
|
29
|
-
maxResults?: number;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export interface AffectedDeps {
|
|
33
|
-
cwd: string;
|
|
34
|
-
provider: CodeProvider | null;
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
/** Execute the affected use-case — target resolution, reference collection, analysis, and rendering. */
|
|
38
|
-
export async function executeAffected(
|
|
39
|
-
input: AffectedInput,
|
|
40
|
-
deps: AffectedDeps,
|
|
41
|
-
): Promise<CodeIntelResult> {
|
|
42
|
-
const semantic = deps.provider;
|
|
43
|
-
if (!semantic) {
|
|
44
|
-
return {
|
|
45
|
-
content:
|
|
46
|
-
"**Error:** Affected analysis requires an active code provider (LSP). Enable LSP and retry.",
|
|
47
|
-
details: {
|
|
48
|
-
type: "affected" as const,
|
|
49
|
-
data: {
|
|
50
|
-
confidence: "unavailable",
|
|
51
|
-
directCount: 0,
|
|
52
|
-
downstreamCount: 0,
|
|
53
|
-
riskLevel: "low",
|
|
54
|
-
checkNext: [],
|
|
55
|
-
likelyTests: [],
|
|
56
|
-
omittedCount: 0,
|
|
57
|
-
nextQueries: ["Provide `file`, `line`, `character` or a `symbol` to resolve the target"],
|
|
58
|
-
},
|
|
59
|
-
},
|
|
60
|
-
};
|
|
61
|
-
}
|
|
62
|
-
const target = await resolveTarget(input, deps.cwd, semantic);
|
|
63
|
-
|
|
64
|
-
if (typeof target === "string") {
|
|
65
|
-
return {
|
|
66
|
-
content: target,
|
|
67
|
-
details: {
|
|
68
|
-
type: "affected" as const,
|
|
69
|
-
data: {
|
|
70
|
-
confidence: "unavailable",
|
|
71
|
-
directCount: 0,
|
|
72
|
-
downstreamCount: 0,
|
|
73
|
-
riskLevel: "low",
|
|
74
|
-
checkNext: [],
|
|
75
|
-
likelyTests: [],
|
|
76
|
-
omittedCount: 0,
|
|
77
|
-
nextQueries: ["Provide `file`, `line`, `character` or a `symbol` to resolve the target"],
|
|
78
|
-
},
|
|
79
|
-
},
|
|
80
|
-
};
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
if (isResolvedTargetGroup(target)) {
|
|
84
|
-
return executeFileLevelAffected(target, input, deps.cwd, semantic);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const symbolName =
|
|
88
|
-
target.name ?? `symbol at ${path.relative(deps.cwd, target.file)}:${target.displayLine}`;
|
|
89
|
-
return executeSingleAffected(target, symbolName, input, deps.cwd, semantic);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// ── Single target ────────────────────────────────────────────────────
|
|
93
|
-
|
|
94
|
-
interface ImpactAnalysis {
|
|
95
|
-
confidence: ConfidenceMode;
|
|
96
|
-
affectedFiles: Set<string>;
|
|
97
|
-
affectedModules: Set<string>;
|
|
98
|
-
downstreamCount: number;
|
|
99
|
-
checkNext: string[];
|
|
100
|
-
likelyTests: string[];
|
|
101
|
-
riskLevel: "low" | "medium" | "high";
|
|
102
|
-
externalRefs: number;
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// biome-ignore lint/complexity/useMaxParams: substrate injection and analysis inputs keep related parameters explicit
|
|
106
|
-
async function executeSingleAffected(
|
|
107
|
-
target: ResolvedTarget,
|
|
108
|
-
symbolName: string,
|
|
109
|
-
input: AffectedInput,
|
|
110
|
-
cwd: string,
|
|
111
|
-
semantic: CodeProvider,
|
|
112
|
-
): Promise<CodeIntelResult> {
|
|
113
|
-
const refs = await collectReferences(target, cwd, semantic);
|
|
114
|
-
const model = await buildArchitectureModel(cwd);
|
|
115
|
-
const analysis = analyzeImpact(refs, model, target.name, cwd);
|
|
116
|
-
|
|
117
|
-
const prioritySignals = summarizePrioritySignalsForFiles(
|
|
118
|
-
cwd,
|
|
119
|
-
analysis.affectedFiles.size > 0 ? [...analysis.affectedFiles] : [target.file],
|
|
120
|
-
);
|
|
121
|
-
|
|
122
|
-
const content = renderAffectedSingle({
|
|
123
|
-
symbolName,
|
|
124
|
-
refs,
|
|
125
|
-
analysis,
|
|
126
|
-
maxResults: input.maxResults ?? 8,
|
|
127
|
-
prioritySignals,
|
|
128
|
-
target,
|
|
129
|
-
cwd,
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
const details: AffectedDetails = {
|
|
133
|
-
confidence: analysis.confidence,
|
|
134
|
-
directCount: refs.refs.length,
|
|
135
|
-
downstreamCount: analysis.downstreamCount,
|
|
136
|
-
riskLevel: analysis.riskLevel,
|
|
137
|
-
checkNext: analysis.checkNext,
|
|
138
|
-
likelyTests: analysis.likelyTests,
|
|
139
|
-
omittedCount: computeOmittedCount(analysis.externalRefs, analysis.affectedFiles.size, input),
|
|
140
|
-
nextQueries: buildAffectedNextQueries(target, symbolName, cwd),
|
|
141
|
-
prioritySignals,
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
return { content, details: { type: "affected" as const, data: details } };
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
// ── File-level target group ──────────────────────────────────────────
|
|
148
|
-
|
|
149
|
-
async function executeFileLevelAffected(
|
|
150
|
-
targetGroup: ResolvedTargetGroup,
|
|
151
|
-
input: AffectedInput,
|
|
152
|
-
cwd: string,
|
|
153
|
-
semantic: CodeProvider,
|
|
154
|
-
): Promise<CodeIntelResult> {
|
|
155
|
-
const perTarget = await Promise.all(
|
|
156
|
-
targetGroup.targets.map(async (t) => ({
|
|
157
|
-
target: t,
|
|
158
|
-
refs: await collectReferences(t, cwd, semantic),
|
|
159
|
-
})),
|
|
160
|
-
);
|
|
161
|
-
|
|
162
|
-
const aggregated = await aggregatePerTarget(targetGroup.targets, (t) =>
|
|
163
|
-
collectReferences(t, cwd, semantic),
|
|
164
|
-
);
|
|
165
|
-
|
|
166
|
-
const model = await buildArchitectureModel(cwd);
|
|
167
|
-
const analysis = analyzeImpact(aggregated, model, null, cwd);
|
|
168
|
-
|
|
169
|
-
const prioritySignals = summarizePrioritySignalsForFiles(
|
|
170
|
-
cwd,
|
|
171
|
-
analysis.affectedFiles.size > 0 ? [...analysis.affectedFiles] : [targetGroup.file],
|
|
172
|
-
);
|
|
173
|
-
|
|
174
|
-
const content = renderAffectedFileLevel({
|
|
175
|
-
targetGroup,
|
|
176
|
-
perTarget,
|
|
177
|
-
aggregated,
|
|
178
|
-
analysis,
|
|
179
|
-
maxResults: input.maxResults ?? 8,
|
|
180
|
-
prioritySignals,
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
const details: AffectedDetails = {
|
|
184
|
-
confidence: analysis.confidence,
|
|
185
|
-
directCount: aggregated.refs.length,
|
|
186
|
-
downstreamCount: analysis.downstreamCount,
|
|
187
|
-
riskLevel: analysis.riskLevel,
|
|
188
|
-
checkNext: analysis.checkNext,
|
|
189
|
-
likelyTests: analysis.likelyTests,
|
|
190
|
-
omittedCount: computeOmittedCount(analysis.externalRefs, analysis.affectedFiles.size, input),
|
|
191
|
-
nextQueries: [
|
|
192
|
-
"`code_brief` on the most-affected module for deeper context",
|
|
193
|
-
"Use `file` + coordinates to inspect one exported target precisely",
|
|
194
|
-
],
|
|
195
|
-
prioritySignals,
|
|
196
|
-
};
|
|
197
|
-
|
|
198
|
-
return { content, details: { type: "affected" as const, data: details } };
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// ── Impact analysis ──────────────────────────────────────────────────
|
|
202
|
-
|
|
203
|
-
// biome-ignore lint/complexity/noExcessiveCognitiveComplexity: impact analysis with downstream module traversal and multiple risk dimensions is clearer as one function
|
|
204
|
-
function analyzeImpact(
|
|
205
|
-
result: ReferenceCollection,
|
|
206
|
-
model: Awaited<ReturnType<typeof buildArchitectureModel>>,
|
|
207
|
-
_symbolName: string | null,
|
|
208
|
-
cwd: string,
|
|
209
|
-
): ImpactAnalysis {
|
|
210
|
-
const affectedFiles = new Set(result.refs.map((r) => r.file));
|
|
211
|
-
const affectedModules = new Set<string>();
|
|
212
|
-
const checkNext: string[] = [];
|
|
213
|
-
let downstreamCount = 0;
|
|
214
|
-
|
|
215
|
-
if (model) {
|
|
216
|
-
for (const file of affectedFiles) {
|
|
217
|
-
const mod = findModuleForPath(model, path.resolve(cwd, file));
|
|
218
|
-
if (mod) affectedModules.add(mod.name);
|
|
219
|
-
}
|
|
220
|
-
|
|
221
|
-
const downstreamModules = new Set<string>();
|
|
222
|
-
const queue = [...affectedModules];
|
|
223
|
-
while (queue.length > 0) {
|
|
224
|
-
const modName = queue.shift() as string;
|
|
225
|
-
for (const dep of getDependents(model, modName)) {
|
|
226
|
-
if (!affectedModules.has(dep.name) && !downstreamModules.has(dep.name)) {
|
|
227
|
-
downstreamModules.add(dep.name);
|
|
228
|
-
queue.push(dep.name);
|
|
229
|
-
}
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
downstreamCount = downstreamModules.size;
|
|
233
|
-
|
|
234
|
-
for (const modName of [...affectedModules, ...downstreamModules].slice(0, 3)) {
|
|
235
|
-
const mod = model.modules.find((m) => m.name === modName);
|
|
236
|
-
if (mod) checkNext.push(`${mod.name.replace(/^@[^/]+\//, "")} (\`${mod.relativePath}\`)`);
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
const likelyTests = findLikelyTests(affectedFiles);
|
|
241
|
-
const riskLevel = assessRisk(
|
|
242
|
-
result.refs.length + result.externalCount,
|
|
243
|
-
affectedModules.size,
|
|
244
|
-
downstreamCount,
|
|
245
|
-
);
|
|
246
|
-
|
|
247
|
-
return {
|
|
248
|
-
confidence: result.confidence,
|
|
249
|
-
affectedFiles,
|
|
250
|
-
affectedModules,
|
|
251
|
-
downstreamCount,
|
|
252
|
-
checkNext,
|
|
253
|
-
likelyTests,
|
|
254
|
-
riskLevel,
|
|
255
|
-
externalRefs: result.externalCount,
|
|
256
|
-
};
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
function findLikelyTests(affectedFiles: Set<string>): string[] {
|
|
260
|
-
const tests: string[] = [];
|
|
261
|
-
for (const file of affectedFiles) {
|
|
262
|
-
if (file.includes("test") || file.includes("spec") || file.includes("__tests__")) {
|
|
263
|
-
tests.push(file);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
return tests.slice(0, 3);
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
function assessRisk(
|
|
270
|
-
totalRefs: number,
|
|
271
|
-
moduleCount: number,
|
|
272
|
-
downstreamCount: number,
|
|
273
|
-
): "low" | "medium" | "high" {
|
|
274
|
-
if (totalRefs > 10 || moduleCount > 3 || downstreamCount > 1) return "high";
|
|
275
|
-
if (totalRefs > 3 || moduleCount > 1 || downstreamCount >= 1) return "medium";
|
|
276
|
-
return "low";
|
|
277
|
-
}
|
|
278
|
-
|
|
279
|
-
function computeOmittedCount(
|
|
280
|
-
externalRefs: number,
|
|
281
|
-
affectedFileCount: number,
|
|
282
|
-
input: AffectedInput,
|
|
283
|
-
): number {
|
|
284
|
-
return externalRefs + Math.max(0, affectedFileCount - (input.maxResults ?? 8));
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
function buildAffectedNextQueries(
|
|
288
|
-
target: ResolvedTarget,
|
|
289
|
-
symbolName: string,
|
|
290
|
-
cwd: string,
|
|
291
|
-
): string[] {
|
|
292
|
-
const relPath = path.relative(cwd, target.file);
|
|
293
|
-
return [
|
|
294
|
-
`\`code_brief\` with \`file: "${relPath}"\`, \`line: ${target.displayLine}\`, and \`character: ${target.displayCharacter}\` for deeper context around ${symbolName}`,
|
|
295
|
-
`\`code_relations\` with \`kind: "callers"\`, \`file: "${relPath}"\`, \`line: ${target.displayLine}\`, and \`character: ${target.displayCharacter}\` for call sites`,
|
|
296
|
-
];
|
|
297
|
-
}
|
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
// Map use-case — typed filesystem scanning for factual project/directory inventory.
|
|
2
|
-
// Produces structured data for the markdown renderer.
|
|
3
|
-
|
|
4
|
-
import * as fs from "node:fs";
|
|
5
|
-
import * as path from "node:path";
|
|
6
|
-
|
|
7
|
-
// ── Types ────────────────────────────────────────────────────────────
|
|
8
|
-
|
|
9
|
-
export interface MapStats {
|
|
10
|
-
byExtension: Map<string, number>;
|
|
11
|
-
byChildDir: Map<string, number>;
|
|
12
|
-
landmarkFiles: string[];
|
|
13
|
-
total: number;
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
export interface MapData {
|
|
17
|
-
scope: string;
|
|
18
|
-
stats: MapStats;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const SOURCE_EXTENSIONS = new Map([
|
|
22
|
-
[".ts", "TypeScript"],
|
|
23
|
-
[".tsx", "TSX"],
|
|
24
|
-
[".js", "JavaScript"],
|
|
25
|
-
[".jsx", "JSX"],
|
|
26
|
-
[".mts", "TypeScript"],
|
|
27
|
-
[".cts", "TypeScript"],
|
|
28
|
-
[".mjs", "JavaScript"],
|
|
29
|
-
[".cjs", "JavaScript"],
|
|
30
|
-
[".py", "Python"],
|
|
31
|
-
[".pyi", "Python"],
|
|
32
|
-
[".rs", "Rust"],
|
|
33
|
-
[".go", "Go"],
|
|
34
|
-
[".mod", "Go"],
|
|
35
|
-
[".java", "Java"],
|
|
36
|
-
[".kt", "Kotlin"],
|
|
37
|
-
[".kts", "Kotlin"],
|
|
38
|
-
[".rb", "Ruby"],
|
|
39
|
-
[".php", "PHP"],
|
|
40
|
-
[".swift", "Swift"],
|
|
41
|
-
[".cpp", "C++"],
|
|
42
|
-
[".hpp", "C++"],
|
|
43
|
-
[".cc", "C++"],
|
|
44
|
-
[".cxx", "C++"],
|
|
45
|
-
[".hxx", "C++ Header"],
|
|
46
|
-
[".c++", "C++"],
|
|
47
|
-
[".h++", "C++ Header"],
|
|
48
|
-
[".c", "C"],
|
|
49
|
-
[".h", "C Header"],
|
|
50
|
-
[".css", "CSS"],
|
|
51
|
-
[".scss", "SCSS"],
|
|
52
|
-
[".less", "Less"],
|
|
53
|
-
[".html", "HTML"],
|
|
54
|
-
[".htm", "HTML"],
|
|
55
|
-
[".xhtml", "HTML"],
|
|
56
|
-
[".json", "JSON"],
|
|
57
|
-
[".yaml", "YAML"],
|
|
58
|
-
[".yml", "YAML"],
|
|
59
|
-
[".toml", "TOML"],
|
|
60
|
-
[".md", "Markdown"],
|
|
61
|
-
[".sh", "Shell"],
|
|
62
|
-
[".bash", "Shell"],
|
|
63
|
-
[".zsh", "Shell"],
|
|
64
|
-
[".r", "R"],
|
|
65
|
-
[".sql", "SQL"],
|
|
66
|
-
[".cs", "C#"],
|
|
67
|
-
]);
|
|
68
|
-
|
|
69
|
-
const LANDMARK_FILES = new Set([
|
|
70
|
-
"package.json",
|
|
71
|
-
"tsconfig.json",
|
|
72
|
-
"jsconfig.json",
|
|
73
|
-
"vite.config.ts",
|
|
74
|
-
"vitest.config.ts",
|
|
75
|
-
"jest.config.ts",
|
|
76
|
-
"playwright.config.ts",
|
|
77
|
-
"biome.json",
|
|
78
|
-
"eslint.config.js",
|
|
79
|
-
".eslintrc.js",
|
|
80
|
-
"deno.json",
|
|
81
|
-
"deno.jsonc",
|
|
82
|
-
"Cargo.toml",
|
|
83
|
-
"go.mod",
|
|
84
|
-
"pyproject.toml",
|
|
85
|
-
"setup.py",
|
|
86
|
-
"requirements.txt",
|
|
87
|
-
"Makefile",
|
|
88
|
-
"justfile",
|
|
89
|
-
"Taskfile.yml",
|
|
90
|
-
"Dockerfile",
|
|
91
|
-
"docker-compose.yml",
|
|
92
|
-
".env.example",
|
|
93
|
-
".env.local.example",
|
|
94
|
-
]);
|
|
95
|
-
|
|
96
|
-
const SKIP_DIRS = new Set(["node_modules", "dist", "build", ".git"]);
|
|
97
|
-
|
|
98
|
-
// ── Public entrypoint ────────────────────────────────────────────────
|
|
99
|
-
|
|
100
|
-
export function buildMapData(scopePath: string, cwd: string): MapData {
|
|
101
|
-
const stats = gatherStats(scopePath);
|
|
102
|
-
const scope = formatScope(scopePath, cwd);
|
|
103
|
-
return { scope, stats };
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
function gatherStats(scopePath: string): MapStats {
|
|
107
|
-
const stats: MapStats = {
|
|
108
|
-
byExtension: new Map<string, number>(),
|
|
109
|
-
byChildDir: new Map<string, number>(),
|
|
110
|
-
landmarkFiles: [],
|
|
111
|
-
total: 0,
|
|
112
|
-
};
|
|
113
|
-
|
|
114
|
-
walkDirectory(scopePath, "", stats);
|
|
115
|
-
return stats;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function walkDirectory(dir: string, rel: string, stats: MapStats): void {
|
|
119
|
-
const entries = readEntries(dir);
|
|
120
|
-
if (!entries) return;
|
|
121
|
-
|
|
122
|
-
for (const entry of entries) {
|
|
123
|
-
if (shouldSkipEntry(entry)) continue;
|
|
124
|
-
visitEntry(dir, rel, entry, stats);
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
function readEntries(dir: string): fs.Dirent[] | null {
|
|
129
|
-
try {
|
|
130
|
-
return fs.readdirSync(dir, { withFileTypes: true });
|
|
131
|
-
} catch {
|
|
132
|
-
return null;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
function shouldSkipEntry(entry: fs.Dirent): boolean {
|
|
137
|
-
// Skip hidden directories and node_modules, but keep dot-prefixed landmark files
|
|
138
|
-
if (entry.name.startsWith(".") && entry.isDirectory()) return true;
|
|
139
|
-
return SKIP_DIRS.has(entry.name);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
function visitEntry(dir: string, rel: string, entry: fs.Dirent, stats: MapStats): void {
|
|
143
|
-
const entryRel = rel ? `${rel}/${entry.name}` : entry.name;
|
|
144
|
-
const fullPath = path.join(dir, entry.name);
|
|
145
|
-
|
|
146
|
-
if (entry.isDirectory()) {
|
|
147
|
-
walkDirectory(fullPath, entryRel, stats);
|
|
148
|
-
return;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
recordFileStats(entry.name, entryRel, stats);
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
function recordFileStats(entryName: string, entryRel: string, stats: MapStats): void {
|
|
155
|
-
stats.total++;
|
|
156
|
-
const ext = path.extname(entryName).toLowerCase();
|
|
157
|
-
stats.byExtension.set(ext, (stats.byExtension.get(ext) ?? 0) + 1);
|
|
158
|
-
|
|
159
|
-
const firstSegment = entryRel.split("/")[0];
|
|
160
|
-
if (firstSegment && entryRel.includes("/")) {
|
|
161
|
-
stats.byChildDir.set(firstSegment, (stats.byChildDir.get(firstSegment) ?? 0) + 1);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
if (LANDMARK_FILES.has(entryName)) {
|
|
165
|
-
stats.landmarkFiles.push(entryRel);
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
|
|
169
|
-
function formatScope(scopePath: string, cwd: string): string {
|
|
170
|
-
const relative = path.relative(cwd, scopePath);
|
|
171
|
-
if (relative === "") return ".";
|
|
172
|
-
if (relative.startsWith(`..${path.sep}`) || relative === "..") return scopePath;
|
|
173
|
-
return relative.replaceAll(path.sep, "/");
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
export { SOURCE_EXTENSIONS };
|