@mycodemap/mycodemap 1.9.0 → 2.7.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/CHANGELOG.md +38 -0
- package/README.md +63 -978
- package/README.zh-CN.md +1096 -0
- package/dist/cli/commands/agent-metrics/human.d.ts +4 -0
- package/dist/cli/commands/agent-metrics/human.d.ts.map +1 -0
- package/dist/cli/commands/agent-metrics/human.js +134 -0
- package/dist/cli/commands/agent-metrics/human.js.map +1 -0
- package/dist/cli/commands/agent-metrics/index.d.ts +15 -0
- package/dist/cli/commands/agent-metrics/index.d.ts.map +1 -0
- package/dist/cli/commands/agent-metrics/index.js +116 -0
- package/dist/cli/commands/agent-metrics/index.js.map +1 -0
- package/dist/cli/commands/analyze-options.d.ts.map +1 -1
- package/dist/cli/commands/analyze-options.js +8 -0
- package/dist/cli/commands/analyze-options.js.map +1 -1
- package/dist/cli/commands/analyze.d.ts +3 -196
- package/dist/cli/commands/analyze.d.ts.map +1 -1
- package/dist/cli/commands/analyze.js +27 -1162
- package/dist/cli/commands/analyze.js.map +1 -1
- package/dist/cli/commands/benchmark.d.ts +8 -0
- package/dist/cli/commands/benchmark.d.ts.map +1 -0
- package/dist/cli/commands/benchmark.js +153 -0
- package/dist/cli/commands/benchmark.js.map +1 -0
- package/dist/cli/commands/complexity.d.ts.map +1 -1
- package/dist/cli/commands/complexity.js +62 -95
- package/dist/cli/commands/complexity.js.map +1 -1
- package/dist/cli/commands/deps.d.ts +3 -59
- package/dist/cli/commands/deps.d.ts.map +1 -1
- package/dist/cli/commands/deps.js +25 -331
- package/dist/cli/commands/deps.js.map +1 -1
- package/dist/cli/commands/doctor.d.ts +3 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +34 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/env-contract.d.ts +3 -0
- package/dist/cli/commands/env-contract.d.ts.map +1 -0
- package/dist/cli/commands/env-contract.js +221 -0
- package/dist/cli/commands/env-contract.js.map +1 -0
- package/dist/cli/commands/generate.d.ts +19 -1
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +735 -89
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/commands/impact.d.ts +4 -38
- package/dist/cli/commands/impact.d.ts.map +1 -1
- package/dist/cli/commands/impact.js +133 -375
- package/dist/cli/commands/impact.js.map +1 -1
- package/dist/cli/commands/init.d.ts +1 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +61 -2
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/preview.d.ts +3 -0
- package/dist/cli/commands/preview.d.ts.map +1 -0
- package/dist/cli/commands/preview.js +216 -0
- package/dist/cli/commands/preview.js.map +1 -0
- package/dist/cli/commands/query.d.ts +2 -20
- package/dist/cli/commands/query.d.ts.map +1 -1
- package/dist/cli/commands/query.js +23 -708
- package/dist/cli/commands/query.js.map +1 -1
- package/dist/cli/commands/watch-foreground.d.ts.map +1 -1
- package/dist/cli/commands/watch-foreground.js +5 -1
- package/dist/cli/commands/watch-foreground.js.map +1 -1
- package/dist/cli/config-loader.d.ts.map +1 -1
- package/dist/cli/config-loader.js +51 -13
- package/dist/cli/config-loader.js.map +1 -1
- package/dist/cli/doctor/check-agent.d.ts +3 -0
- package/dist/cli/doctor/check-agent.d.ts.map +1 -0
- package/dist/cli/doctor/check-agent.js +60 -0
- package/dist/cli/doctor/check-agent.js.map +1 -0
- package/dist/cli/doctor/check-env-contract.d.ts +3 -0
- package/dist/cli/doctor/check-env-contract.d.ts.map +1 -0
- package/dist/cli/doctor/check-env-contract.js +96 -0
- package/dist/cli/doctor/check-env-contract.js.map +1 -0
- package/dist/cli/doctor/check-ghost-commands.d.ts +3 -0
- package/dist/cli/doctor/check-ghost-commands.d.ts.map +1 -0
- package/dist/cli/doctor/check-ghost-commands.js +86 -0
- package/dist/cli/doctor/check-ghost-commands.js.map +1 -0
- package/dist/cli/doctor/check-native-deps.d.ts +3 -0
- package/dist/cli/doctor/check-native-deps.d.ts.map +1 -0
- package/dist/cli/doctor/check-native-deps.js +70 -0
- package/dist/cli/doctor/check-native-deps.js.map +1 -0
- package/dist/cli/doctor/check-workspace-drift.d.ts +3 -0
- package/dist/cli/doctor/check-workspace-drift.d.ts.map +1 -0
- package/dist/cli/doctor/check-workspace-drift.js +83 -0
- package/dist/cli/doctor/check-workspace-drift.js.map +1 -0
- package/dist/cli/doctor/formatter.d.ts +20 -0
- package/dist/cli/doctor/formatter.d.ts.map +1 -0
- package/dist/cli/doctor/formatter.js +91 -0
- package/dist/cli/doctor/formatter.js.map +1 -0
- package/dist/cli/doctor/index.d.ts +8 -0
- package/dist/cli/doctor/index.d.ts.map +1 -0
- package/dist/cli/doctor/index.js +9 -0
- package/dist/cli/doctor/index.js.map +1 -0
- package/dist/cli/doctor/orchestrator.d.ts +3 -0
- package/dist/cli/doctor/orchestrator.d.ts.map +1 -0
- package/dist/cli/doctor/orchestrator.js +40 -0
- package/dist/cli/doctor/orchestrator.js.map +1 -0
- package/dist/cli/doctor/types.d.ts +19 -0
- package/dist/cli/doctor/types.d.ts.map +1 -0
- package/dist/cli/doctor/types.js +4 -0
- package/dist/cli/doctor/types.js.map +1 -0
- package/dist/cli/env-contract/check.d.ts +18 -0
- package/dist/cli/env-contract/check.d.ts.map +1 -0
- package/dist/cli/env-contract/check.js +118 -0
- package/dist/cli/env-contract/check.js.map +1 -0
- package/dist/cli/env-contract/discovery.d.ts +12 -0
- package/dist/cli/env-contract/discovery.d.ts.map +1 -0
- package/dist/cli/env-contract/discovery.js +249 -0
- package/dist/cli/env-contract/discovery.js.map +1 -0
- package/dist/cli/env-contract/filters.d.ts +10 -0
- package/dist/cli/env-contract/filters.d.ts.map +1 -0
- package/dist/cli/env-contract/filters.js +23 -0
- package/dist/cli/env-contract/filters.js.map +1 -0
- package/dist/cli/env-contract/index.d.ts +6 -0
- package/dist/cli/env-contract/index.d.ts.map +1 -0
- package/dist/cli/env-contract/index.js +8 -0
- package/dist/cli/env-contract/index.js.map +1 -0
- package/dist/cli/env-contract/reminder-engine.d.ts +34 -0
- package/dist/cli/env-contract/reminder-engine.d.ts.map +1 -0
- package/dist/cli/env-contract/reminder-engine.js +51 -0
- package/dist/cli/env-contract/reminder-engine.js.map +1 -0
- package/dist/cli/env-contract/reminder-hook-runner.d.ts +45 -0
- package/dist/cli/env-contract/reminder-hook-runner.d.ts.map +1 -0
- package/dist/cli/env-contract/reminder-hook-runner.js +273 -0
- package/dist/cli/env-contract/reminder-hook-runner.js.map +1 -0
- package/dist/cli/env-contract/reminder-ledger.d.ts +11 -0
- package/dist/cli/env-contract/reminder-ledger.d.ts.map +1 -0
- package/dist/cli/env-contract/reminder-ledger.js +37 -0
- package/dist/cli/env-contract/reminder-ledger.js.map +1 -0
- package/dist/cli/env-contract/types.d.ts +48 -0
- package/dist/cli/env-contract/types.d.ts.map +1 -0
- package/dist/cli/env-contract/types.js +22 -0
- package/dist/cli/env-contract/types.js.map +1 -0
- package/dist/cli/env-contract/validation.d.ts +10 -0
- package/dist/cli/env-contract/validation.d.ts.map +1 -0
- package/dist/cli/env-contract/validation.js +116 -0
- package/dist/cli/env-contract/validation.js.map +1 -0
- package/dist/cli/first-run-guide.d.ts.map +1 -1
- package/dist/cli/first-run-guide.js +8 -3
- package/dist/cli/first-run-guide.js.map +1 -1
- package/dist/cli/index.js +94 -22
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/assistant-plan.d.ts +14 -0
- package/dist/cli/init/assistant-plan.d.ts.map +1 -0
- package/dist/cli/init/assistant-plan.js +208 -0
- package/dist/cli/init/assistant-plan.js.map +1 -0
- package/dist/cli/init/detect.d.ts +28 -0
- package/dist/cli/init/detect.d.ts.map +1 -0
- package/dist/cli/init/detect.js +63 -0
- package/dist/cli/init/detect.js.map +1 -0
- package/dist/cli/init/env-contract-plan.d.ts +28 -0
- package/dist/cli/init/env-contract-plan.d.ts.map +1 -0
- package/dist/cli/init/env-contract-plan.js +184 -0
- package/dist/cli/init/env-contract-plan.js.map +1 -0
- package/dist/cli/init/manifest-extractors.d.ts +22 -0
- package/dist/cli/init/manifest-extractors.d.ts.map +1 -0
- package/dist/cli/init/manifest-extractors.js +185 -0
- package/dist/cli/init/manifest-extractors.js.map +1 -0
- package/dist/cli/init/profile-loader.d.ts +49 -0
- package/dist/cli/init/profile-loader.d.ts.map +1 -0
- package/dist/cli/init/profile-loader.js +107 -0
- package/dist/cli/init/profile-loader.js.map +1 -0
- package/dist/cli/init/profile-plan.d.ts +38 -0
- package/dist/cli/init/profile-plan.d.ts.map +1 -0
- package/dist/cli/init/profile-plan.js +120 -0
- package/dist/cli/init/profile-plan.js.map +1 -0
- package/dist/cli/init/profiles/generic.json +16 -0
- package/dist/cli/init/profiles/go.json +12 -0
- package/dist/cli/init/profiles/nodejs.json +16 -0
- package/dist/cli/init/profiles/python.json +17 -0
- package/dist/cli/init/profiles/rust.json +12 -0
- package/dist/cli/init/receipt.d.ts.map +1 -1
- package/dist/cli/init/receipt.js +107 -7
- package/dist/cli/init/receipt.js.map +1 -1
- package/dist/cli/init/reconciler.d.ts +10 -1
- package/dist/cli/init/reconciler.d.ts.map +1 -1
- package/dist/cli/init/reconciler.js +85 -15
- package/dist/cli/init/reconciler.js.map +1 -1
- package/dist/cli/interface-contract/commands/agent-metrics.d.ts +3 -0
- package/dist/cli/interface-contract/commands/agent-metrics.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/agent-metrics.js +217 -0
- package/dist/cli/interface-contract/commands/agent-metrics.js.map +1 -0
- package/dist/cli/interface-contract/commands/analyze.d.ts +3 -0
- package/dist/cli/interface-contract/commands/analyze.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/analyze.js +139 -0
- package/dist/cli/interface-contract/commands/analyze.js.map +1 -0
- package/dist/cli/interface-contract/commands/benchmark.d.ts +3 -0
- package/dist/cli/interface-contract/commands/benchmark.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/benchmark.js +108 -0
- package/dist/cli/interface-contract/commands/benchmark.js.map +1 -0
- package/dist/cli/interface-contract/commands/deps.d.ts +3 -0
- package/dist/cli/interface-contract/commands/deps.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/deps.js +130 -0
- package/dist/cli/interface-contract/commands/deps.js.map +1 -0
- package/dist/cli/interface-contract/commands/doctor.d.ts +3 -0
- package/dist/cli/interface-contract/commands/doctor.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/doctor.js +60 -0
- package/dist/cli/interface-contract/commands/doctor.js.map +1 -0
- package/dist/cli/interface-contract/commands/env-contract.d.ts +3 -0
- package/dist/cli/interface-contract/commands/env-contract.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/env-contract.js +168 -0
- package/dist/cli/interface-contract/commands/env-contract.js.map +1 -0
- package/dist/cli/interface-contract/commands/index.d.ts +12 -0
- package/dist/cli/interface-contract/commands/index.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/index.js +24 -0
- package/dist/cli/interface-contract/commands/index.js.map +1 -0
- package/dist/cli/interface-contract/commands/init.d.ts +3 -0
- package/dist/cli/interface-contract/commands/init.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/init.js +96 -0
- package/dist/cli/interface-contract/commands/init.js.map +1 -0
- package/dist/cli/interface-contract/commands/preview.d.ts +3 -0
- package/dist/cli/interface-contract/commands/preview.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/preview.js +118 -0
- package/dist/cli/interface-contract/commands/preview.js.map +1 -0
- package/dist/cli/interface-contract/commands/query.d.ts +3 -0
- package/dist/cli/interface-contract/commands/query.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/query.js +186 -0
- package/dist/cli/interface-contract/commands/query.js.map +1 -0
- package/dist/cli/interface-contract/index.d.ts +22 -0
- package/dist/cli/interface-contract/index.d.ts.map +1 -0
- package/dist/cli/interface-contract/index.js +41 -0
- package/dist/cli/interface-contract/index.js.map +1 -0
- package/dist/cli/interface-contract/schema.d.ts +30 -0
- package/dist/cli/interface-contract/schema.d.ts.map +1 -0
- package/dist/cli/interface-contract/schema.js +73 -0
- package/dist/cli/interface-contract/schema.js.map +1 -0
- package/dist/cli/interface-contract/types.d.ts +77 -0
- package/dist/cli/interface-contract/types.d.ts.map +1 -0
- package/dist/cli/interface-contract/types.js +4 -0
- package/dist/cli/interface-contract/types.js.map +1 -0
- package/dist/cli/output/apply-suggestion.d.ts +12 -0
- package/dist/cli/output/apply-suggestion.d.ts.map +1 -0
- package/dist/cli/output/apply-suggestion.js +29 -0
- package/dist/cli/output/apply-suggestion.js.map +1 -0
- package/dist/cli/output/error-codes.d.ts +24 -0
- package/dist/cli/output/error-codes.d.ts.map +1 -0
- package/dist/cli/output/error-codes.js +94 -0
- package/dist/cli/output/error-codes.js.map +1 -0
- package/dist/cli/output/errors.d.ts +14 -0
- package/dist/cli/output/errors.d.ts.map +1 -0
- package/dist/cli/output/errors.js +182 -0
- package/dist/cli/output/errors.js.map +1 -0
- package/dist/cli/output/index.d.ts +13 -0
- package/dist/cli/output/index.d.ts.map +1 -0
- package/dist/cli/output/index.js +11 -0
- package/dist/cli/output/index.js.map +1 -0
- package/dist/cli/output/mode.d.ts +12 -0
- package/dist/cli/output/mode.d.ts.map +1 -0
- package/dist/cli/output/mode.js +23 -0
- package/dist/cli/output/mode.js.map +1 -0
- package/dist/cli/output/progress.d.ts +9 -0
- package/dist/cli/output/progress.d.ts.map +1 -0
- package/dist/cli/output/progress.js +65 -0
- package/dist/cli/output/progress.js.map +1 -0
- package/dist/cli/output/render.d.ts +11 -0
- package/dist/cli/output/render.d.ts.map +1 -0
- package/dist/cli/output/render.js +18 -0
- package/dist/cli/output/render.js.map +1 -0
- package/dist/cli/output/types.d.ts +53 -0
- package/dist/cli/output/types.d.ts.map +1 -0
- package/dist/cli/output/types.js +14 -0
- package/dist/cli/output/types.js.map +1 -0
- package/dist/cli/output/wasm-fallback.d.ts +14 -0
- package/dist/cli/output/wasm-fallback.d.ts.map +1 -0
- package/dist/cli/output/wasm-fallback.js +92 -0
- package/dist/cli/output/wasm-fallback.js.map +1 -0
- package/dist/cli/preview/complexity-scanner.d.ts +21 -0
- package/dist/cli/preview/complexity-scanner.d.ts.map +1 -0
- package/dist/cli/preview/complexity-scanner.js +52 -0
- package/dist/cli/preview/complexity-scanner.js.map +1 -0
- package/dist/cli/preview/dependency-extractor.d.ts +38 -0
- package/dist/cli/preview/dependency-extractor.d.ts.map +1 -0
- package/dist/cli/preview/dependency-extractor.js +140 -0
- package/dist/cli/preview/dependency-extractor.js.map +1 -0
- package/dist/cli/preview/preview-renderer.d.ts +32 -0
- package/dist/cli/preview/preview-renderer.d.ts.map +1 -0
- package/dist/cli/preview/preview-renderer.js +54 -0
- package/dist/cli/preview/preview-renderer.js.map +1 -0
- package/dist/cli/storage-runtime.d.ts +7 -0
- package/dist/cli/storage-runtime.d.ts.map +1 -1
- package/dist/cli/storage-runtime.js +22 -0
- package/dist/cli/storage-runtime.js.map +1 -1
- package/dist/cli/tree-sitter-check.d.ts +6 -1
- package/dist/cli/tree-sitter-check.d.ts.map +1 -1
- package/dist/cli/tree-sitter-check.js +23 -1
- package/dist/cli/tree-sitter-check.js.map +1 -1
- package/dist/cli-new/index.js +1 -1
- package/dist/cli-new/index.js.map +1 -1
- package/dist/composition/parser-composition.d.ts +7 -0
- package/dist/composition/parser-composition.d.ts.map +1 -0
- package/dist/composition/parser-composition.js +15 -0
- package/dist/composition/parser-composition.js.map +1 -0
- package/dist/core/analyzer.d.ts.map +1 -1
- package/dist/core/analyzer.js +83 -67
- package/dist/core/analyzer.js.map +1 -1
- package/dist/core/ast-complexity-analyzer.d.ts +12 -6
- package/dist/core/ast-complexity-analyzer.d.ts.map +1 -1
- package/dist/core/ast-complexity-analyzer.js +368 -209
- package/dist/core/ast-complexity-analyzer.js.map +1 -1
- package/dist/core/file-discovery.d.ts +1 -1
- package/dist/core/file-discovery.d.ts.map +1 -1
- package/dist/core/file-discovery.js +3 -0
- package/dist/core/file-discovery.js.map +1 -1
- package/dist/core/global-index.d.ts +3 -1
- package/dist/core/global-index.d.ts.map +1 -1
- package/dist/core/global-index.js +69 -4
- package/dist/core/global-index.js.map +1 -1
- package/dist/domain/entities/CodeGraph.d.ts +3 -0
- package/dist/domain/entities/CodeGraph.d.ts.map +1 -1
- package/dist/domain/entities/CodeGraph.js +19 -2
- package/dist/domain/entities/CodeGraph.js.map +1 -1
- package/dist/domain/entities/Dependency.d.ts +5 -2
- package/dist/domain/entities/Dependency.d.ts.map +1 -1
- package/dist/domain/entities/Dependency.js +49 -3
- package/dist/domain/entities/Dependency.js.map +1 -1
- package/dist/domain/repositories/CodeGraphRepository.d.ts +5 -0
- package/dist/domain/repositories/CodeGraphRepository.d.ts.map +1 -1
- package/dist/domain/repositories/CodeGraphRepository.js.map +1 -1
- package/dist/execution/contract-tools/analyze.d.ts +205 -0
- package/dist/execution/contract-tools/analyze.d.ts.map +1 -0
- package/dist/execution/contract-tools/analyze.js +1215 -0
- package/dist/execution/contract-tools/analyze.js.map +1 -0
- package/dist/execution/contract-tools/deps.d.ts +62 -0
- package/dist/execution/contract-tools/deps.d.ts.map +1 -0
- package/dist/execution/contract-tools/deps.js +234 -0
- package/dist/execution/contract-tools/deps.js.map +1 -0
- package/dist/execution/contract-tools/index.d.ts +5 -0
- package/dist/execution/contract-tools/index.d.ts.map +1 -0
- package/dist/execution/contract-tools/index.js +7 -0
- package/dist/execution/contract-tools/index.js.map +1 -0
- package/dist/execution/contract-tools/query.d.ts +60 -0
- package/dist/execution/contract-tools/query.d.ts.map +1 -0
- package/dist/execution/contract-tools/query.js +532 -0
- package/dist/execution/contract-tools/query.js.map +1 -0
- package/dist/execution/contract-tools/types.d.ts +26 -0
- package/dist/execution/contract-tools/types.d.ts.map +1 -0
- package/dist/execution/contract-tools/types.js +32 -0
- package/dist/execution/contract-tools/types.js.map +1 -0
- package/dist/generator/index.d.ts.map +1 -1
- package/dist/generator/index.js +0 -3
- package/dist/generator/index.js.map +1 -1
- package/dist/infrastructure/parser/enhancers/TypeScriptTypeEnhancer.d.ts +12 -0
- package/dist/infrastructure/parser/enhancers/TypeScriptTypeEnhancer.d.ts.map +1 -0
- package/dist/infrastructure/parser/enhancers/TypeScriptTypeEnhancer.js +55 -0
- package/dist/infrastructure/parser/enhancers/TypeScriptTypeEnhancer.js.map +1 -0
- package/dist/infrastructure/parser/implementations/GoParser.d.ts +2 -1
- package/dist/infrastructure/parser/implementations/GoParser.d.ts.map +1 -1
- package/dist/infrastructure/parser/implementations/GoParser.js +13 -1
- package/dist/infrastructure/parser/implementations/GoParser.js.map +1 -1
- package/dist/infrastructure/parser/implementations/PythonTreeSitterParser.d.ts +114 -0
- package/dist/infrastructure/parser/implementations/PythonTreeSitterParser.d.ts.map +1 -0
- package/dist/infrastructure/parser/implementations/PythonTreeSitterParser.js +1022 -0
- package/dist/infrastructure/parser/implementations/PythonTreeSitterParser.js.map +1 -0
- package/dist/infrastructure/parser/implementations/TreeSitterParser.d.ts +78 -0
- package/dist/infrastructure/parser/implementations/TreeSitterParser.d.ts.map +1 -0
- package/dist/infrastructure/parser/implementations/TreeSitterParser.js +648 -0
- package/dist/infrastructure/parser/implementations/TreeSitterParser.js.map +1 -0
- package/dist/infrastructure/parser/implementations/TypeScriptParser.d.ts +3 -55
- package/dist/infrastructure/parser/implementations/TypeScriptParser.d.ts.map +1 -1
- package/dist/infrastructure/parser/implementations/TypeScriptParser.js +4 -411
- package/dist/infrastructure/parser/implementations/TypeScriptParser.js.map +1 -1
- package/dist/infrastructure/parser/index.d.ts +2 -0
- package/dist/infrastructure/parser/index.d.ts.map +1 -1
- package/dist/infrastructure/parser/index.js +9 -6
- package/dist/infrastructure/parser/index.js.map +1 -1
- package/dist/infrastructure/parser/interfaces/ParserBase.d.ts.map +1 -1
- package/dist/infrastructure/parser/interfaces/ParserBase.js +1 -0
- package/dist/infrastructure/parser/interfaces/ParserBase.js.map +1 -1
- package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.d.ts +2 -0
- package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.d.ts.map +1 -1
- package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.js +4 -0
- package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.js.map +1 -1
- package/dist/infrastructure/storage/StorageFactory.d.ts +5 -18
- package/dist/infrastructure/storage/StorageFactory.d.ts.map +1 -1
- package/dist/infrastructure/storage/StorageFactory.js +30 -98
- package/dist/infrastructure/storage/StorageFactory.js.map +1 -1
- package/dist/infrastructure/storage/adapters/SQLiteStorage.d.ts +13 -1
- package/dist/infrastructure/storage/adapters/SQLiteStorage.d.ts.map +1 -1
- package/dist/infrastructure/storage/adapters/SQLiteStorage.js +322 -76
- package/dist/infrastructure/storage/adapters/SQLiteStorage.js.map +1 -1
- package/dist/infrastructure/storage/adapters/sqlite-loader.d.ts +45 -0
- package/dist/infrastructure/storage/adapters/sqlite-loader.d.ts.map +1 -0
- package/dist/infrastructure/storage/adapters/sqlite-loader.js +266 -0
- package/dist/infrastructure/storage/adapters/sqlite-loader.js.map +1 -0
- package/dist/infrastructure/storage/community-helpers.d.ts +4 -0
- package/dist/infrastructure/storage/community-helpers.d.ts.map +1 -0
- package/dist/infrastructure/storage/community-helpers.js +392 -0
- package/dist/infrastructure/storage/community-helpers.js.map +1 -0
- package/dist/infrastructure/storage/graph-helpers.d.ts +22 -5
- package/dist/infrastructure/storage/graph-helpers.d.ts.map +1 -1
- package/dist/infrastructure/storage/graph-helpers.js +496 -91
- package/dist/infrastructure/storage/graph-helpers.js.map +1 -1
- package/dist/infrastructure/storage/index.d.ts +1 -1
- package/dist/infrastructure/storage/index.d.ts.map +1 -1
- package/dist/infrastructure/storage/index.js +1 -1
- package/dist/infrastructure/storage/index.js.map +1 -1
- package/dist/infrastructure/storage/interfaces/StorageBase.d.ts +2 -2
- package/dist/infrastructure/storage/interfaces/StorageBase.d.ts.map +1 -1
- package/dist/infrastructure/storage/interfaces/StorageBase.js.map +1 -1
- package/dist/infrastructure/storage/sqlite/GovernanceGraphCache.d.ts +2 -0
- package/dist/infrastructure/storage/sqlite/GovernanceGraphCache.d.ts.map +1 -1
- package/dist/infrastructure/storage/sqlite/GovernanceGraphCache.js +52 -12
- package/dist/infrastructure/storage/sqlite/GovernanceGraphCache.js.map +1 -1
- package/dist/infrastructure/storage/sqlite/schema.d.ts +2 -2
- package/dist/infrastructure/storage/sqlite/schema.d.ts.map +1 -1
- package/dist/infrastructure/storage/sqlite/schema.js +49 -1
- package/dist/infrastructure/storage/sqlite/schema.js.map +1 -1
- package/dist/interface/config/index.d.ts +5 -3
- package/dist/interface/config/index.d.ts.map +1 -1
- package/dist/interface/types/index.d.ts +37 -6
- package/dist/interface/types/index.d.ts.map +1 -1
- package/dist/interface/types/parser.d.ts +85 -0
- package/dist/interface/types/parser.d.ts.map +1 -1
- package/dist/interface/types/storage.d.ts +227 -10
- package/dist/interface/types/storage.d.ts.map +1 -1
- package/dist/orchestrator/agent-metrics-service.d.ts +126 -0
- package/dist/orchestrator/agent-metrics-service.d.ts.map +1 -0
- package/dist/orchestrator/agent-metrics-service.js +444 -0
- package/dist/orchestrator/agent-metrics-service.js.map +1 -0
- package/dist/orchestrator/types.d.ts +2 -0
- package/dist/orchestrator/types.d.ts.map +1 -1
- package/dist/orchestrator/types.js.map +1 -1
- package/dist/parser/enhancers/PythonTypeEnhancer.d.ts +26 -0
- package/dist/parser/enhancers/PythonTypeEnhancer.d.ts.map +1 -0
- package/dist/parser/enhancers/PythonTypeEnhancer.js +440 -0
- package/dist/parser/enhancers/PythonTypeEnhancer.js.map +1 -0
- package/dist/parser/implementations/smart-parser.d.ts.map +1 -1
- package/dist/parser/implementations/smart-parser.js +7 -69
- package/dist/parser/implementations/smart-parser.js.map +1 -1
- package/dist/parser/implementations/tree-sitter-loader.d.ts +18 -0
- package/dist/parser/implementations/tree-sitter-loader.d.ts.map +1 -0
- package/dist/parser/implementations/tree-sitter-loader.js +136 -0
- package/dist/parser/implementations/tree-sitter-loader.js.map +1 -0
- package/dist/parser/index.d.ts +5 -3
- package/dist/parser/index.d.ts.map +1 -1
- package/dist/parser/index.js +68 -6
- package/dist/parser/index.js.map +1 -1
- package/dist/parser/interfaces/IParser.d.ts +19 -6
- package/dist/parser/interfaces/IParser.d.ts.map +1 -1
- package/dist/parser/interfaces/IParser.js +2 -3
- package/dist/parser/interfaces/IParser.js.map +1 -1
- package/dist/server/handlers/AnalysisHandler.d.ts +13 -2
- package/dist/server/handlers/AnalysisHandler.d.ts.map +1 -1
- package/dist/server/handlers/AnalysisHandler.js +24 -0
- package/dist/server/handlers/AnalysisHandler.js.map +1 -1
- package/dist/server/handlers/QueryHandler.d.ts.map +1 -1
- package/dist/server/handlers/QueryHandler.js +11 -30
- package/dist/server/handlers/QueryHandler.js.map +1 -1
- package/dist/server/mcp/context-tool.d.ts +9 -0
- package/dist/server/mcp/context-tool.d.ts.map +1 -0
- package/dist/server/mcp/context-tool.js +257 -0
- package/dist/server/mcp/context-tool.js.map +1 -0
- package/dist/server/mcp/schema-adapter.d.ts +55 -0
- package/dist/server/mcp/schema-adapter.d.ts.map +1 -0
- package/dist/server/mcp/schema-adapter.js +409 -0
- package/dist/server/mcp/schema-adapter.js.map +1 -0
- package/dist/server/mcp/server.d.ts +3 -3
- package/dist/server/mcp/server.d.ts.map +1 -1
- package/dist/server/mcp/server.js +134 -20
- package/dist/server/mcp/server.js.map +1 -1
- package/dist/server/mcp/service.d.ts +6 -2
- package/dist/server/mcp/service.d.ts.map +1 -1
- package/dist/server/mcp/service.js +138 -36
- package/dist/server/mcp/service.js.map +1 -1
- package/dist/server/mcp/stdio-transport.d.ts +23 -0
- package/dist/server/mcp/stdio-transport.d.ts.map +1 -0
- package/dist/server/mcp/stdio-transport.js +101 -0
- package/dist/server/mcp/stdio-transport.js.map +1 -0
- package/dist/server/mcp/types.d.ts +133 -8
- package/dist/server/mcp/types.d.ts.map +1 -1
- package/dist/server/routes/api.d.ts.map +1 -1
- package/dist/server/routes/api.js +11 -2
- package/dist/server/routes/api.js.map +1 -1
- package/docs/AI_ASSISTANT_SETUP.md +281 -12
- package/docs/API.md +170 -0
- package/docs/CONFIGURATION.md +141 -0
- package/docs/DEVELOPMENT.md +96 -0
- package/docs/GETTING-STARTED.md +114 -0
- package/docs/README.md +40 -1
- package/docs/SETUP_GUIDE.md +60 -14
- package/docs/TESTING.md +81 -0
- package/docs/ai-guide/COMMANDS.md +68 -10
- package/docs/ai-guide/INTEGRATION.md +77 -10
- package/docs/ai-guide/OUTPUT.md +345 -9
- package/docs/ai-guide/PROMPTS.md +2 -2
- package/docs/ai-guide/QUICKSTART.md +28 -1
- package/docs/ai-guide/README.md +2 -2
- package/docs/archive/ideation/2026-04-15-executable-architecture-constitution-ideation-archive.md +70 -0
- package/docs/archive/ideation/2026-04-20-mycodemap-init-enhancements-ideation-archive.md +109 -0
- package/docs/archive/ideation/2026-04-22-rules-entry-docs-optimization-consolidated-ideation-archive.md +54 -0
- package/docs/backlog.md +232 -144
- package/docs/brainstorms/2026-05-10-agent-effectiveness-validation-requirements.md +112 -0
- package/docs/generated/phase-58/subagent-evidence/claude-hook-example.json +15 -0
- package/docs/generated/phase-58/subagent-evidence/claude-session.md +146 -0
- package/docs/generated/phase-58/subagent-evidence/claude-subagent.json +28 -0
- package/docs/generated/phase-58/subagent-evidence/codex-agent-example.toml +19 -0
- package/docs/generated/phase-58/subagent-evidence/codex-session.md +150 -0
- package/docs/generated/phase-58/subagent-evidence/codex-subagent.json +20 -0
- package/docs/generated/phase-58/subagent-evidence/negative-no-retrieval.json +12 -0
- package/docs/generated/phase-58/subagent-evidence/verification-manifest.json +19 -0
- package/docs/ideation/2026-04-15-executable-architecture-constitution-ideation.md +10 -22
- package/docs/ideation/2026-04-20-mycodemap-init-enhancements-ideation.md +15 -60
- package/docs/ideation/2026-04-22-rules-entry-docs-optimization-consolidated-ideation.md +47 -52
- package/docs/ideation/2026-04-29-ux-install-agent-experience-ideation.md +256 -0
- package/docs/ideation/2026-05-02-subagent-environment-contract-injection-ideation.md +183 -0
- package/docs/ideation/2026-05-04-subagent-hooks-deep-dive-ideation.md +133 -0
- package/docs/ideation/2026-05-10-agent-effectiveness-validation-ideation.md +219 -0
- package/docs/plans/2026-04-30-install-guide-and-repo-analyzer-design.md +394 -0
- package/docs/rules/README.md +1 -0
- package/docs/rules/architecture-guardrails.md +2 -1
- package/docs/rules/engineering-with-codex-openai.md +1 -1
- package/docs/rules/harness.md +106 -0
- package/docs/rules/pre-release-checklist.md +28 -0
- package/docs/rules/testing.md +51 -0
- package/examples/claude/skills/mycodemap-repo-analyzer/SKILL.md +294 -0
- package/examples/claude/skills/mycodemap-repo-analyzer/references/analysis-guide.md +166 -0
- package/examples/claude/skills/mycodemap-repo-analyzer/references/module-analysis-guide.md +150 -0
- package/package.json +12 -4
- package/scripts/copy-build-assets.mjs +23 -0
- package/scripts/hooks/templates/pre-commit +33 -2
- package/scripts/sync-analyze-docs.js +2 -2
- package/scripts/tests/test_rule_control_workflow.py +15 -1
- package/scripts/validate-docs.js +113 -16
- package/scripts/verify-subagent-env-contract.mjs +279 -0
- package/dist/parser/implementations/tree-sitter-parser.d.ts +0 -57
- package/dist/parser/implementations/tree-sitter-parser.d.ts.map +0 -1
- package/dist/parser/implementations/tree-sitter-parser.js +0 -375
- package/dist/parser/implementations/tree-sitter-parser.js.map +0 -1
- package/docs/references/tmp.md +0 -527
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/cli/output/types.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;AAE1C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IAC/C,QAAQ,IAAI,IAAI,CAAC;IACjB,IAAI,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,WAAW,eAAgB,SAAQ,eAAe;IACtD,IAAI,EAAE,OAAO,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,eAAe,EAAE,CAAC;CAC5B;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,eAAe,GAAG,eAAe,GAAG,KAAK,IAAI,eAAe,CAEpG;AAED;;;GAGG;AACH,eAAO,MAAM,qCAAqC,MAAM,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// [META] since:2026-04-30 | owner:cli-team | stable:false
|
|
2
|
+
// [WHY] Shared types for AI-first output mode — single source of truth for mode, progress, error shapes
|
|
3
|
+
/**
|
|
4
|
+
* Type guard: checks if an error has actionable recovery fields
|
|
5
|
+
*/
|
|
6
|
+
export function isActionableError(error) {
|
|
7
|
+
return 'attempted' in error && 'rootCause' in error && 'confidence' in error;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Confidence threshold for --apply-suggestion auto-execution.
|
|
11
|
+
* Suggestions below this threshold are not auto-executed.
|
|
12
|
+
*/
|
|
13
|
+
export const APPLY_SUGGESTION_CONFIDENCE_THRESHOLD = 0.8;
|
|
14
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/cli/output/types.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,wGAAwG;AAkDxG;;GAEG;AACH,MAAM,UAAU,iBAAiB,CAAC,KAAwC;IACxE,OAAO,WAAW,IAAI,KAAK,IAAI,WAAW,IAAI,KAAK,IAAI,YAAY,IAAI,KAAK,CAAC;AAC/E,CAAC;AAED;;;GAGG;AACH,MAAM,CAAC,MAAM,qCAAqC,GAAG,GAAG,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ActionableError } from './types.js';
|
|
2
|
+
export interface WasmFallbackResult {
|
|
3
|
+
nativeAvailable: boolean;
|
|
4
|
+
wasmAvailable: boolean;
|
|
5
|
+
fallbackActivated: boolean;
|
|
6
|
+
module: 'tree-sitter' | 'better-sqlite3';
|
|
7
|
+
implementation?: 'native' | 'wasm' | 'node:sqlite' | 'sql.js';
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
10
|
+
export declare function checkAndActivateWasmFallback(mod: 'tree-sitter' | 'better-sqlite3', options: {
|
|
11
|
+
wasmFallback?: boolean;
|
|
12
|
+
}): Promise<WasmFallbackResult>;
|
|
13
|
+
export declare function createNativeDepError(mod: 'tree-sitter' | 'better-sqlite3', nativeError: Error, wasmAvailable: boolean): ActionableError;
|
|
14
|
+
//# sourceMappingURL=wasm-fallback.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm-fallback.d.ts","sourceRoot":"","sources":["../../../src/cli/output/wasm-fallback.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAIlD,MAAM,WAAW,kBAAkB;IACjC,eAAe,EAAE,OAAO,CAAC;IACzB,aAAa,EAAE,OAAO,CAAC;IACvB,iBAAiB,EAAE,OAAO,CAAC;IAC3B,MAAM,EAAE,aAAa,GAAG,gBAAgB,CAAC;IACzC,cAAc,CAAC,EAAE,QAAQ,GAAG,MAAM,GAAG,aAAa,GAAG,QAAQ,CAAC;IAC9D,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,wBAAsB,4BAA4B,CAChD,GAAG,EAAE,aAAa,GAAG,gBAAgB,EACrC,OAAO,EAAE;IAAE,YAAY,CAAC,EAAE,OAAO,CAAA;CAAE,GAClC,OAAO,CAAC,kBAAkB,CAAC,CA2C7B;AAED,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,aAAa,GAAG,gBAAgB,EACrC,WAAW,EAAE,KAAK,EAClB,aAAa,EAAE,OAAO,GACrB,eAAe,CAkBjB"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
// [META] since:2026-05-01 | owner:cli-team | stable:false
|
|
2
|
+
// [WHY] Reactive WASM fallback — intercepts native dep failures and switches to WASM loading paths
|
|
3
|
+
import { createActionableError } from './errors.js';
|
|
4
|
+
import { ErrorCodes } from './error-codes.js';
|
|
5
|
+
export async function checkAndActivateWasmFallback(mod, options) {
|
|
6
|
+
if (!options.wasmFallback) {
|
|
7
|
+
return {
|
|
8
|
+
nativeAvailable: await checkNativeModule(mod),
|
|
9
|
+
wasmAvailable: false,
|
|
10
|
+
fallbackActivated: false,
|
|
11
|
+
module: mod,
|
|
12
|
+
message: '--wasm-fallback not requested',
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
const nativeAvailable = await checkNativeModule(mod);
|
|
16
|
+
if (nativeAvailable) {
|
|
17
|
+
return {
|
|
18
|
+
nativeAvailable: true,
|
|
19
|
+
wasmAvailable: true,
|
|
20
|
+
fallbackActivated: false,
|
|
21
|
+
module: mod,
|
|
22
|
+
message: 'Native module available, WASM fallback not needed',
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
const wasmAvailable = await checkWasmModule(mod);
|
|
26
|
+
if (wasmAvailable) {
|
|
27
|
+
const envKey = `CODEMAP_USE_WASM_${mod.replace('-', '_').toUpperCase()}`;
|
|
28
|
+
process.env[envKey] = '1';
|
|
29
|
+
return {
|
|
30
|
+
nativeAvailable: false,
|
|
31
|
+
wasmAvailable: true,
|
|
32
|
+
fallbackActivated: true,
|
|
33
|
+
module: mod,
|
|
34
|
+
message: `Native ${mod} unavailable — activated WASM fallback`,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return {
|
|
38
|
+
nativeAvailable: false,
|
|
39
|
+
wasmAvailable: false,
|
|
40
|
+
fallbackActivated: false,
|
|
41
|
+
module: mod,
|
|
42
|
+
message: `Both native and WASM ${mod} unavailable — install build tools or check WASM module`,
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export function createNativeDepError(mod, nativeError, wasmAvailable) {
|
|
46
|
+
const suggestions = ['--wasm-fallback'];
|
|
47
|
+
if (wasmAvailable) {
|
|
48
|
+
suggestions.push('WASM module detected — add --wasm-fallback to activate');
|
|
49
|
+
}
|
|
50
|
+
suggestions.push('npm rebuild (rebuild native modules)');
|
|
51
|
+
return createActionableError(wasmAvailable ? ErrorCodes.DEP_WASM_FALLBACK_AVAILABLE : ErrorCodes.DEP_NATIVE_MISSING, `${mod} cannot be loaded: ${nativeError.message}`, `loading ${mod}`, {
|
|
52
|
+
rootCause: nativeError.message,
|
|
53
|
+
remediationPlan: suggestions.join('; '),
|
|
54
|
+
confidence: wasmAvailable ? 0.95 : 0.9,
|
|
55
|
+
nextCommand: 'codemap --wasm-fallback',
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
async function checkNativeModule(mod) {
|
|
59
|
+
try {
|
|
60
|
+
if (mod === 'tree-sitter') {
|
|
61
|
+
const ts = await import('tree-sitter');
|
|
62
|
+
return !!ts.default || !!ts;
|
|
63
|
+
}
|
|
64
|
+
const sqlite = await import('better-sqlite3');
|
|
65
|
+
return !!sqlite.default || !!sqlite;
|
|
66
|
+
}
|
|
67
|
+
catch {
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
async function checkWasmModule(mod) {
|
|
72
|
+
try {
|
|
73
|
+
if (mod === 'tree-sitter') {
|
|
74
|
+
const wasmModule = 'web-tree-sitter';
|
|
75
|
+
await import(wasmModule);
|
|
76
|
+
return true;
|
|
77
|
+
}
|
|
78
|
+
const nodeVersion = process.versions.node.split('.').map(Number);
|
|
79
|
+
if (nodeVersion[0] >= 22) {
|
|
80
|
+
const sqliteModule = 'node:sqlite';
|
|
81
|
+
await import(sqliteModule);
|
|
82
|
+
return true;
|
|
83
|
+
}
|
|
84
|
+
const sqlJsModule = 'sql.js';
|
|
85
|
+
await import(sqlJsModule);
|
|
86
|
+
return true;
|
|
87
|
+
}
|
|
88
|
+
catch {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=wasm-fallback.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wasm-fallback.js","sourceRoot":"","sources":["../../../src/cli/output/wasm-fallback.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,mGAAmG;AAGnG,OAAO,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAW9C,MAAM,CAAC,KAAK,UAAU,4BAA4B,CAChD,GAAqC,EACrC,OAAmC;IAEnC,IAAI,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC;QAC1B,OAAO;YACL,eAAe,EAAE,MAAM,iBAAiB,CAAC,GAAG,CAAC;YAC7C,aAAa,EAAE,KAAK;YACpB,iBAAiB,EAAE,KAAK;YACxB,MAAM,EAAE,GAAG;YACX,OAAO,EAAE,+BAA+B;SACzC,CAAC;IACJ,CAAC;IAED,MAAM,eAAe,GAAG,MAAM,iBAAiB,CAAC,GAAG,CAAC,CAAC;IACrD,IAAI,eAAe,EAAE,CAAC;QACpB,OAAO;YACL,eAAe,EAAE,IAAI;YACrB,aAAa,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;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ComplexityHotspot {
|
|
2
|
+
file: string;
|
|
3
|
+
score: number;
|
|
4
|
+
functions: number;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Scan a single file's cyclomatic complexity via escomplex.
|
|
8
|
+
* Returns null for non-JS/TS files, missing files, or parse errors.
|
|
9
|
+
* Never throws — individual file failures are silently skipped.
|
|
10
|
+
*/
|
|
11
|
+
export declare function scanFileComplexity(filePath: string, rootDir: string): ComplexityHotspot | null;
|
|
12
|
+
/**
|
|
13
|
+
* Scan multiple files and return the top-5 cyclomatic complexity hotspots.
|
|
14
|
+
* Filters out null results (non-JS/TS files and parse failures),
|
|
15
|
+
* sorts by score descending, and caps at 5 results (per D-08).
|
|
16
|
+
*
|
|
17
|
+
* This function is synchronous because escomplex is synchronous
|
|
18
|
+
* and readFileSync is synchronous.
|
|
19
|
+
*/
|
|
20
|
+
export declare function scanComplexity(files: string[], rootDir: string): ComplexityHotspot[];
|
|
21
|
+
//# sourceMappingURL=complexity-scanner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complexity-scanner.d.ts","sourceRoot":"","sources":["../../../src/cli/preview/complexity-scanner.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,iBAAiB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB;AAQD;;;;GAIG;AACH,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,GACd,iBAAiB,GAAG,IAAI,CAkB1B;AAED;;;;;;;GAOG;AACH,wBAAgB,cAAc,CAC5B,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,EAAE,MAAM,GACd,iBAAiB,EAAE,CAMrB"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// [META] since:2026-05-02 | owner:cli-team | stable:false
|
|
2
|
+
// [WHY] escomplex-based file-level cyclomatic complexity scoring for codemap preview —
|
|
3
|
+
// lightweight alternative to tree-sitter-based ast-complexity-analyzer.ts, no native deps
|
|
4
|
+
// required. Per-file try-catch prevents individual parse failures from aborting the scan.
|
|
5
|
+
import { readFileSync } from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import escomplex from 'typhonjs-escomplex';
|
|
8
|
+
/**
|
|
9
|
+
* Only feed JS/TS files to escomplex — it cannot parse Python, Go, Rust, etc.
|
|
10
|
+
* Prevents RESEARCH Pitfall 6 (escomplex barfs on non-JS/TS files).
|
|
11
|
+
*/
|
|
12
|
+
const JS_TS_EXTENSIONS = new Set(['.js', '.jsx', '.ts', '.tsx', '.mjs', '.cjs']);
|
|
13
|
+
/**
|
|
14
|
+
* Scan a single file's cyclomatic complexity via escomplex.
|
|
15
|
+
* Returns null for non-JS/TS files, missing files, or parse errors.
|
|
16
|
+
* Never throws — individual file failures are silently skipped.
|
|
17
|
+
*/
|
|
18
|
+
export function scanFileComplexity(filePath, rootDir) {
|
|
19
|
+
const ext = path.extname(filePath);
|
|
20
|
+
if (!JS_TS_EXTENSIONS.has(ext)) {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
const source = readFileSync(filePath, 'utf8');
|
|
25
|
+
const report = escomplex.analyzeModule(source);
|
|
26
|
+
return {
|
|
27
|
+
file: path.relative(rootDir, filePath),
|
|
28
|
+
score: report.aggregate?.cyclomatic ?? 0,
|
|
29
|
+
functions: report.methods.length,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
catch {
|
|
33
|
+
// Skip individual file failures — do NOT throw
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Scan multiple files and return the top-5 cyclomatic complexity hotspots.
|
|
39
|
+
* Filters out null results (non-JS/TS files and parse failures),
|
|
40
|
+
* sorts by score descending, and caps at 5 results (per D-08).
|
|
41
|
+
*
|
|
42
|
+
* This function is synchronous because escomplex is synchronous
|
|
43
|
+
* and readFileSync is synchronous.
|
|
44
|
+
*/
|
|
45
|
+
export function scanComplexity(files, rootDir) {
|
|
46
|
+
return files
|
|
47
|
+
.map((file) => scanFileComplexity(file, rootDir))
|
|
48
|
+
.filter((h) => h !== null)
|
|
49
|
+
.sort((a, b) => b.score - a.score)
|
|
50
|
+
.slice(0, 5);
|
|
51
|
+
}
|
|
52
|
+
//# sourceMappingURL=complexity-scanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"complexity-scanner.js","sourceRoot":"","sources":["../../../src/cli/preview/complexity-scanner.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,uFAAuF;AACvF,0FAA0F;AAC1F,0FAA0F;AAE1F,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,SAAS,MAAM,oBAAoB,CAAC;AAQ3C;;;GAGG;AACH,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAEjF;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAChC,QAAgB,EAChB,OAAe;IAEf,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,IAAI,CAAC,gBAAgB,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC9C,MAAM,MAAM,GAAG,SAAS,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAC/C,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC;YACtC,KAAK,EAAE,MAAM,CAAC,SAAS,EAAE,UAAU,IAAI,CAAC;YACxC,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,MAAM;SACjC,CAAC;IACJ,CAAC;IAAC,MAAM,CAAC;QACP,+CAA+C;QAC/C,OAAO,IAAI,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,cAAc,CAC5B,KAAe,EACf,OAAe;IAEf,OAAO,KAAK;SACT,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,kBAAkB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;SAChD,MAAM,CAAC,CAAC,CAAC,EAA0B,EAAE,CAAC,CAAC,KAAK,IAAI,CAAC;SACjD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;SACjC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
export interface DependencyExtractionResult {
|
|
2
|
+
direct: string[];
|
|
3
|
+
count: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Extract direct and dev dependencies from a Node.js package.json.
|
|
7
|
+
* Returns concatenated keys of `dependencies` and `devDependencies`.
|
|
8
|
+
* Returns [] on any error (missing file, invalid JSON, etc.).
|
|
9
|
+
*/
|
|
10
|
+
export declare function extractNodeDeps(rootDir: string): string[];
|
|
11
|
+
/**
|
|
12
|
+
* Extract direct dependencies from a Go go.mod file.
|
|
13
|
+
* Handles both `require (` blocks and single-line `require` statements.
|
|
14
|
+
* Strips `// indirect` and `// direct` inline comments before parsing.
|
|
15
|
+
* Returns [] on any error (missing file, read failure, etc.).
|
|
16
|
+
*/
|
|
17
|
+
export declare function extractGoDeps(rootDir: string): string[];
|
|
18
|
+
/**
|
|
19
|
+
* Extract direct and dev dependencies from a Rust Cargo.toml file.
|
|
20
|
+
* Uses smol-toml (dynamic import) for TOML parsing.
|
|
21
|
+
* Returns [] on any error (missing file, parse failure, smol-toml import failure, etc.).
|
|
22
|
+
*/
|
|
23
|
+
export declare function extractRustDeps(rootDir: string): Promise<string[]>;
|
|
24
|
+
/**
|
|
25
|
+
* Extract direct dependencies from a Python pyproject.toml file.
|
|
26
|
+
* Supports both PEP 621 `[project.dependencies]` and Poetry
|
|
27
|
+
* `[tool.poetry.dependencies]` formats.
|
|
28
|
+
* Uses smol-toml (dynamic import) for TOML parsing.
|
|
29
|
+
* Returns [] on any error (missing file, parse failure, smol-toml import failure, etc.).
|
|
30
|
+
*/
|
|
31
|
+
export declare function extractPythonDeps(rootDir: string): Promise<string[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Extract all direct dependencies from all supported marker files.
|
|
34
|
+
* Calls all four extractors and deduplicates the results.
|
|
35
|
+
* Returns { direct: string[], count: number }.
|
|
36
|
+
*/
|
|
37
|
+
export declare function extractDependencies(rootDir: string): Promise<DependencyExtractionResult>;
|
|
38
|
+
//# sourceMappingURL=dependency-extractor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency-extractor.d.ts","sourceRoot":"","sources":["../../../src/cli/preview/dependency-extractor.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,0BAA0B;IACzC,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;GAIG;AACH,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAWzD;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAkCvD;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CAiBxE;AAED;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC,CA2B1E;AAED;;;;GAIG;AACH,wBAAsB,mBAAmB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,0BAA0B,CAAC,CAW9F"}
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
// [META] since:2026-05-02 | owner:cli-team | stable:false
|
|
2
|
+
// [WHY] Marker-file dependency extraction for codemap preview — reads package.json,
|
|
3
|
+
// go.mod, Cargo.toml, pyproject.toml to list direct dependencies without source-code
|
|
4
|
+
// parsing. Graceful degradation: each extractor returns [] on missing/unparseable files.
|
|
5
|
+
import { readFileSync } from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
/**
|
|
8
|
+
* Extract direct and dev dependencies from a Node.js package.json.
|
|
9
|
+
* Returns concatenated keys of `dependencies` and `devDependencies`.
|
|
10
|
+
* Returns [] on any error (missing file, invalid JSON, etc.).
|
|
11
|
+
*/
|
|
12
|
+
export function extractNodeDeps(rootDir) {
|
|
13
|
+
try {
|
|
14
|
+
const content = readFileSync(path.join(rootDir, 'package.json'), 'utf8');
|
|
15
|
+
const pkg = JSON.parse(content);
|
|
16
|
+
return [
|
|
17
|
+
...Object.keys(pkg.dependencies || {}),
|
|
18
|
+
...Object.keys(pkg.devDependencies || {}),
|
|
19
|
+
];
|
|
20
|
+
}
|
|
21
|
+
catch {
|
|
22
|
+
return [];
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Extract direct dependencies from a Go go.mod file.
|
|
27
|
+
* Handles both `require (` blocks and single-line `require` statements.
|
|
28
|
+
* Strips `// indirect` and `// direct` inline comments before parsing.
|
|
29
|
+
* Returns [] on any error (missing file, read failure, etc.).
|
|
30
|
+
*/
|
|
31
|
+
export function extractGoDeps(rootDir) {
|
|
32
|
+
try {
|
|
33
|
+
const content = readFileSync(path.join(rootDir, 'go.mod'), 'utf8');
|
|
34
|
+
const deps = [];
|
|
35
|
+
let inRequire = false;
|
|
36
|
+
for (const line of content.split('\n')) {
|
|
37
|
+
const trimmed = line.trim();
|
|
38
|
+
if (trimmed.startsWith('require (')) {
|
|
39
|
+
inRequire = true;
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (inRequire && trimmed === ')') {
|
|
43
|
+
inRequire = false;
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
if (inRequire) {
|
|
47
|
+
// Strip inline comments: "github.com/pkg v1.0 // indirect"
|
|
48
|
+
const depLine = trimmed.replace(/\/\/.*$/, '').trim();
|
|
49
|
+
const match = depLine.match(/^(\S+)\s+v\S+/);
|
|
50
|
+
if (match)
|
|
51
|
+
deps.push(match[1]);
|
|
52
|
+
}
|
|
53
|
+
else if (trimmed.startsWith('require ')) {
|
|
54
|
+
// Single-line require: "require github.com/pkg v1.0"
|
|
55
|
+
const depLine = trimmed.replace(/\/\/.*$/, '').trim();
|
|
56
|
+
const match = depLine.match(/^require\s+(\S+)\s+v\S+/);
|
|
57
|
+
if (match)
|
|
58
|
+
deps.push(match[1]);
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return deps;
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
return [];
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Extract direct and dev dependencies from a Rust Cargo.toml file.
|
|
69
|
+
* Uses smol-toml (dynamic import) for TOML parsing.
|
|
70
|
+
* Returns [] on any error (missing file, parse failure, smol-toml import failure, etc.).
|
|
71
|
+
*/
|
|
72
|
+
export async function extractRustDeps(rootDir) {
|
|
73
|
+
try {
|
|
74
|
+
const content = readFileSync(path.join(rootDir, 'Cargo.toml'), 'utf8');
|
|
75
|
+
const { parse: parseToml } = await import('smol-toml');
|
|
76
|
+
const parsed = parseToml(content);
|
|
77
|
+
const deps = [];
|
|
78
|
+
if (parsed.dependencies && typeof parsed.dependencies === 'object') {
|
|
79
|
+
deps.push(...Object.keys(parsed.dependencies));
|
|
80
|
+
}
|
|
81
|
+
if (parsed['dev-dependencies'] && typeof parsed['dev-dependencies'] === 'object') {
|
|
82
|
+
deps.push(...Object.keys(parsed['dev-dependencies']));
|
|
83
|
+
}
|
|
84
|
+
return deps;
|
|
85
|
+
}
|
|
86
|
+
catch {
|
|
87
|
+
return [];
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Extract direct dependencies from a Python pyproject.toml file.
|
|
92
|
+
* Supports both PEP 621 `[project.dependencies]` and Poetry
|
|
93
|
+
* `[tool.poetry.dependencies]` formats.
|
|
94
|
+
* Uses smol-toml (dynamic import) for TOML parsing.
|
|
95
|
+
* Returns [] on any error (missing file, parse failure, smol-toml import failure, etc.).
|
|
96
|
+
*/
|
|
97
|
+
export async function extractPythonDeps(rootDir) {
|
|
98
|
+
try {
|
|
99
|
+
const content = readFileSync(path.join(rootDir, 'pyproject.toml'), 'utf8');
|
|
100
|
+
const { parse: parseToml } = await import('smol-toml');
|
|
101
|
+
const parsed = parseToml(content);
|
|
102
|
+
const deps = [];
|
|
103
|
+
// PEP 621 format: [project.dependencies]
|
|
104
|
+
const project = parsed.project;
|
|
105
|
+
if (project?.dependencies && Array.isArray(project.dependencies)) {
|
|
106
|
+
for (const dep of project.dependencies) {
|
|
107
|
+
const name = dep.match(/^([A-Za-z0-9_-]+)/)?.[1];
|
|
108
|
+
if (name)
|
|
109
|
+
deps.push(name);
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
// Poetry format: [tool.poetry.dependencies]
|
|
113
|
+
const tool = parsed.tool;
|
|
114
|
+
const poetry = tool?.poetry;
|
|
115
|
+
if (poetry?.dependencies && typeof poetry.dependencies === 'object') {
|
|
116
|
+
deps.push(...Object.keys(poetry.dependencies));
|
|
117
|
+
}
|
|
118
|
+
return deps;
|
|
119
|
+
}
|
|
120
|
+
catch {
|
|
121
|
+
return [];
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Extract all direct dependencies from all supported marker files.
|
|
126
|
+
* Calls all four extractors and deduplicates the results.
|
|
127
|
+
* Returns { direct: string[], count: number }.
|
|
128
|
+
*/
|
|
129
|
+
export async function extractDependencies(rootDir) {
|
|
130
|
+
const [nodeDeps, goDeps, rustDeps, pythonDeps] = await Promise.all([
|
|
131
|
+
Promise.resolve(extractNodeDeps(rootDir)),
|
|
132
|
+
Promise.resolve(extractGoDeps(rootDir)),
|
|
133
|
+
extractRustDeps(rootDir),
|
|
134
|
+
extractPythonDeps(rootDir),
|
|
135
|
+
]);
|
|
136
|
+
const all = [...nodeDeps, ...goDeps, ...rustDeps, ...pythonDeps];
|
|
137
|
+
const direct = Array.from(new Set(all));
|
|
138
|
+
return { direct, count: direct.length };
|
|
139
|
+
}
|
|
140
|
+
//# sourceMappingURL=dependency-extractor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dependency-extractor.js","sourceRoot":"","sources":["../../../src/cli/preview/dependency-extractor.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,oFAAoF;AACpF,qFAAqF;AACrF,yFAAyF;AAEzF,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,IAAI,MAAM,WAAW,CAAC;AAO7B;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,CAAC;QACzE,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAA4B,CAAC;QAC3D,OAAO;YACL,GAAG,MAAM,CAAC,IAAI,CAAE,GAAG,CAAC,YAAwC,IAAI,EAAE,CAAC;YACnE,GAAG,MAAM,CAAC,IAAI,CAAE,GAAG,CAAC,eAA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CAAC,GAAG,CAAC;QACjE,OAAO,CAAC,OAAO,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACzC,OAAO,CAAC,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACvC,eAAe,CAAC,OAAO,CAAC;QACxB,iBAAiB,CAAC,OAAO,CAAC;KAC3B,CAAC,CAAC;IAEH,MAAM,GAAG,GAAG,CAAC,GAAG,QAAQ,EAAE,GAAG,MAAM,EAAE,GAAG,QAAQ,EAAE,GAAG,UAAU,CAAC,CAAC;IACjE,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC;IACxC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC;AAC1C,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface PreviewData {
|
|
2
|
+
projectType: string;
|
|
3
|
+
profile: string;
|
|
4
|
+
files: {
|
|
5
|
+
total: number;
|
|
6
|
+
byExtension: Record<string, number>;
|
|
7
|
+
};
|
|
8
|
+
modules: {
|
|
9
|
+
count: number;
|
|
10
|
+
top: string[];
|
|
11
|
+
};
|
|
12
|
+
dependencies: {
|
|
13
|
+
direct: string[];
|
|
14
|
+
count: number;
|
|
15
|
+
};
|
|
16
|
+
complexity: {
|
|
17
|
+
hotspots: Array<{
|
|
18
|
+
file: string;
|
|
19
|
+
score: number;
|
|
20
|
+
functions: number;
|
|
21
|
+
}>;
|
|
22
|
+
};
|
|
23
|
+
hint: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Format preview data as human-readable output with chalk colors.
|
|
27
|
+
*
|
|
28
|
+
* Renders four sections (files, modules, dependencies, complexity hotspots)
|
|
29
|
+
* and always appends the hint text at the end (per D-10).
|
|
30
|
+
*/
|
|
31
|
+
export declare function formatPreviewHuman(data: PreviewData): string;
|
|
32
|
+
//# sourceMappingURL=preview-renderer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-renderer.d.ts","sourceRoot":"","sources":["../../../src/cli/preview/preview-renderer.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE;QACL,KAAK,EAAE,MAAM,CAAC;QACd,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACrC,CAAC;IACF,OAAO,EAAE;QACP,KAAK,EAAE,MAAM,CAAC;QACd,GAAG,EAAE,MAAM,EAAE,CAAC;KACf,CAAC;IACF,YAAY,EAAE;QACZ,MAAM,EAAE,MAAM,EAAE,CAAC;QACjB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;IACF,UAAU,EAAE;QACV,QAAQ,EAAE,KAAK,CAAC;YACd,IAAI,EAAE,MAAM,CAAC;YACb,KAAK,EAAE,MAAM,CAAC;YACd,SAAS,EAAE,MAAM,CAAC;SACnB,CAAC,CAAC;KACJ,CAAC;IACF,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAiD5D"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// [META] since:2026-05-02 | owner:cli-team | stable:false
|
|
2
|
+
// [WHY] Human-readable output formatting for codemap preview — renders the four-section
|
|
3
|
+
// summary as a table/color console output.
|
|
4
|
+
import chalk from 'chalk';
|
|
5
|
+
/**
|
|
6
|
+
* Format preview data as human-readable output with chalk colors.
|
|
7
|
+
*
|
|
8
|
+
* Renders four sections (files, modules, dependencies, complexity hotspots)
|
|
9
|
+
* and always appends the hint text at the end (per D-10).
|
|
10
|
+
*/
|
|
11
|
+
export function formatPreviewHuman(data) {
|
|
12
|
+
const lines = [];
|
|
13
|
+
// Header
|
|
14
|
+
lines.push(chalk.cyan.bold('CodeMap Preview'));
|
|
15
|
+
lines.push('');
|
|
16
|
+
// Project type & profile
|
|
17
|
+
lines.push(chalk.white('Project: ') + `${data.projectType} (profile: ${data.profile})`);
|
|
18
|
+
lines.push('');
|
|
19
|
+
// Files section
|
|
20
|
+
const extBreakdown = Object.entries(data.files.byExtension)
|
|
21
|
+
.sort((a, b) => b[1] - a[1])
|
|
22
|
+
.map(([ext, count]) => `${ext.toUpperCase().replace('.', '')}: ${count}`)
|
|
23
|
+
.join(', ');
|
|
24
|
+
lines.push(chalk.blue('Files: ') + `${data.files.total} total source files` +
|
|
25
|
+
(extBreakdown ? ` (${extBreakdown})` : ''));
|
|
26
|
+
lines.push('');
|
|
27
|
+
// Modules section
|
|
28
|
+
const topDirs = data.modules.top.length > 0
|
|
29
|
+
? data.modules.top.join(', ')
|
|
30
|
+
: 'none';
|
|
31
|
+
lines.push(chalk.blue('Modules: ') + `${data.modules.count} modules — ${topDirs}`);
|
|
32
|
+
lines.push('');
|
|
33
|
+
// Dependencies section
|
|
34
|
+
const depDisplay = data.dependencies.count > 0
|
|
35
|
+
? `${data.dependencies.count} direct dependencies — ${data.dependencies.direct.slice(0, 10).join(', ')}`
|
|
36
|
+
: 'none detected';
|
|
37
|
+
lines.push(chalk.blue('Dependencies: ') + depDisplay);
|
|
38
|
+
lines.push('');
|
|
39
|
+
// Complexity hotspots section
|
|
40
|
+
lines.push(chalk.blue('Complexity hotspots:'));
|
|
41
|
+
if (data.complexity.hotspots.length === 0) {
|
|
42
|
+
lines.push(chalk.gray(' (no JS/TS files found for complexity analysis)'));
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
data.complexity.hotspots.forEach((hotspot, i) => {
|
|
46
|
+
lines.push(` ${i + 1}. ${chalk.white(hotspot.file)} (score=${hotspot.score}, functions=${hotspot.functions})`);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
lines.push('');
|
|
50
|
+
// Hint (always appended per D-10)
|
|
51
|
+
lines.push(chalk.gray(data.hint));
|
|
52
|
+
return lines.join('\n');
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=preview-renderer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"preview-renderer.js","sourceRoot":"","sources":["../../../src/cli/preview/preview-renderer.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,wFAAwF;AACxF,2CAA2C;AAE3C,OAAO,KAAK,MAAM,OAAO,CAAC;AA2B1B;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAiB;IAClD,MAAM,KAAK,GAAa,EAAE,CAAC;IAE3B,SAAS;IACT,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,CAAC;IAC/C,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,yBAAyB;IACzB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,WAAW,CAAC,GAAG,GAAG,IAAI,CAAC,WAAW,cAAc,IAAI,CAAC,OAAO,GAAG,CAAC,CAAC;IACxF,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,gBAAgB;IAChB,MAAM,YAAY,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,WAAW,CAAC;SACxD,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;SAC3B,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,KAAK,KAAK,EAAE,CAAC;SACxE,IAAI,CAAC,IAAI,CAAC,CAAC;IACd,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,GAAG,IAAI,CAAC,KAAK,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AC;IAC7E,CAAC;SAAM,CAAC;QACN,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,EAAE;YAC9C,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,WAAW,OAAO,CAAC,KAAK,eAAe,OAAO,CAAC,SAAS,GAAG,CAAC,CAAC;QAClH,CAAC,CAAC,CAAC;IACL,CAAC;IACD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,kCAAkC;IAClC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;IAElC,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
import type { IStorage } from '../interface/types/storage.js';
|
|
2
|
+
import type { CodeMap } from '../types/index.js';
|
|
2
3
|
import { type LoadedCodemapConfig } from './config-loader.js';
|
|
3
4
|
export interface LoadedStorageRuntime {
|
|
4
5
|
loadedConfig: LoadedCodemapConfig;
|
|
5
6
|
storage: IStorage;
|
|
6
7
|
}
|
|
8
|
+
export interface LoadedCodeMapRuntime {
|
|
9
|
+
rootDir: string;
|
|
10
|
+
dataPath: string;
|
|
11
|
+
codeMap: CodeMap;
|
|
12
|
+
}
|
|
7
13
|
export declare function createConfiguredStorage(rootDir?: string): Promise<LoadedStorageRuntime>;
|
|
14
|
+
export declare function loadCodeMapRuntime(rootDir?: string): Promise<LoadedCodeMapRuntime>;
|
|
8
15
|
//# sourceMappingURL=storage-runtime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-runtime.d.ts","sourceRoot":"","sources":["../../src/cli/storage-runtime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"storage-runtime.d.ts","sourceRoot":"","sources":["../../src/cli/storage-runtime.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,+BAA+B,CAAC;AAC9D,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAGjD,OAAO,EAAqB,KAAK,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AAEjF,MAAM,WAAW,oBAAoB;IACnC,YAAY,EAAE,mBAAmB,CAAC;IAClC,OAAO,EAAE,QAAQ,CAAC;CACnB;AAED,MAAM,WAAW,oBAAoB;IACnC,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,uBAAuB,CAAC,OAAO,GAAE,MAAc,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAQpG;AAED,wBAAsB,kBAAkB,CAAC,OAAO,GAAE,MAAc,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAsB/F"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
// [META] since:2026-03-24 | owner:cli-team | stable:false
|
|
2
2
|
// [WHY] Centralize CLI storage configuration loading so runtime commands honor the configured backend
|
|
3
|
+
import { readFile } from 'node:fs/promises';
|
|
3
4
|
import { cwd } from 'node:process';
|
|
4
5
|
import { storageFactory } from '../infrastructure/storage/StorageFactory.js';
|
|
6
|
+
import { resolveDataPath } from './paths.js';
|
|
5
7
|
import { loadCodemapConfig } from './config-loader.js';
|
|
6
8
|
export async function createConfiguredStorage(rootDir = cwd()) {
|
|
7
9
|
const loadedConfig = await loadCodemapConfig(rootDir);
|
|
@@ -11,4 +13,24 @@ export async function createConfiguredStorage(rootDir = cwd()) {
|
|
|
11
13
|
storage,
|
|
12
14
|
};
|
|
13
15
|
}
|
|
16
|
+
export async function loadCodeMapRuntime(rootDir = cwd()) {
|
|
17
|
+
const dataPath = resolveDataPath(rootDir);
|
|
18
|
+
try {
|
|
19
|
+
const raw = await readFile(dataPath, 'utf-8');
|
|
20
|
+
return {
|
|
21
|
+
rootDir,
|
|
22
|
+
dataPath,
|
|
23
|
+
codeMap: JSON.parse(raw),
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
catch (error) {
|
|
27
|
+
const runtimeError = new Error(error instanceof Error && error.message
|
|
28
|
+
? error.message
|
|
29
|
+
: 'Code map not found, run codemap generate first');
|
|
30
|
+
runtimeError.code = 'INDEX_NOT_FOUND';
|
|
31
|
+
runtimeError.remediation = 'Run codemap generate to create the code map';
|
|
32
|
+
runtimeError.cause = error;
|
|
33
|
+
throw runtimeError;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
14
36
|
//# sourceMappingURL=storage-runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"storage-runtime.js","sourceRoot":"","sources":["../../src/cli/storage-runtime.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,sGAAsG;AAEtG,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"storage-runtime.js","sourceRoot":"","sources":["../../src/cli/storage-runtime.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,sGAAsG;AAEtG,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,GAAG,EAAE,MAAM,cAAc,CAAC;AAGnC,OAAO,EAAE,cAAc,EAAE,MAAM,6CAA6C,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAA4B,MAAM,oBAAoB,CAAC;AAajF,MAAM,CAAC,KAAK,UAAU,uBAAuB,CAAC,UAAkB,GAAG,EAAE;IACnE,MAAM,YAAY,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;IACtD,MAAM,OAAO,GAAG,MAAM,cAAc,CAAC,gBAAgB,CAAC,OAAO,EAAE,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;IAE5F,OAAO;QACL,YAAY;QACZ,OAAO;KACR,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,kBAAkB,CAAC,UAAkB,GAAG,EAAE;IAC9D,MAAM,QAAQ,GAAG,eAAe,CAAC,OAAO,CAAC,CAAC;IAE1C,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC9C,OAAO;YACL,OAAO;YACP,QAAQ;YACR,OAAO,EAAE,IAAI,CAAC,KAAK,CAAC,GAAG,CAAY;SACpC,CAAC;IACJ,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,YAAY,GAAG,IAAI,KAAK,CAC5B,KAAK,YAAY,KAAK,IAAI,KAAK,CAAC,OAAO;YACrC,CAAC,CAAC,KAAK,CAAC,OAAO;YACf,CAAC,CAAC,gDAAgD,CACa,CAAC;QAEpE,YAAY,CAAC,IAAI,GAAG,iBAAiB,CAAC;QACtC,YAAY,CAAC,WAAW,GAAG,6CAA6C,CAAC;QACzE,YAAY,CAAC,KAAK,GAAG,KAAK,CAAC;QAC3B,MAAM,YAAY,CAAC;IACrB,CAAC;AACH,CAAC"}
|
|
@@ -25,7 +25,12 @@ export declare const COMMANDS_NOT_REQUIRING_TREE_SITTER: Set<string>;
|
|
|
25
25
|
*/
|
|
26
26
|
export declare function commandRequiresTreeSitter(commandName: string): boolean;
|
|
27
27
|
/**
|
|
28
|
-
*
|
|
28
|
+
* 异步验证 tree-sitter 可用性,使用 loader-aware 检测。
|
|
29
|
+
* 不可用时抛出 ActionableError,包含 WASM fallback 建议。
|
|
30
|
+
*/
|
|
31
|
+
export declare function validateTreeSitterAsync(): Promise<TreeSitterInfo>;
|
|
32
|
+
/**
|
|
33
|
+
* 验证 tree-sitter 可用性,不可用时抛出错误(同步版本,保持向后兼容)
|
|
29
34
|
*/
|
|
30
35
|
export declare function validateTreeSitter(): TreeSitterInfo;
|
|
31
36
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tree-sitter-check.d.ts","sourceRoot":"","sources":["../../src/cli/tree-sitter-check.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,cAAc,CAAC,CAoBhE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,cAAc,CAqBrD;AAqBD;;GAEG;AACH,eAAO,MAAM,8BAA8B,aAOzC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kCAAkC,aAO7C,CAAC;AAEH;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAWtE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,CAgBnD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQlE"}
|
|
1
|
+
{"version":3,"file":"tree-sitter-check.d.ts","sourceRoot":"","sources":["../../src/cli/tree-sitter-check.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;GAEG;AACH,wBAAsB,gBAAgB,IAAI,OAAO,CAAC,cAAc,CAAC,CAoBhE;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,cAAc,CAqBrD;AAqBD;;GAEG;AACH,eAAO,MAAM,8BAA8B,aAOzC,CAAC;AAEH;;GAEG;AACH,eAAO,MAAM,kCAAkC,aAO7C,CAAC;AAEH;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,WAAW,EAAE,MAAM,GAAG,OAAO,CAWtE;AAED;;;GAGG;AACH,wBAAsB,uBAAuB,IAAI,OAAO,CAAC,cAAc,CAAC,CAqBvE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,cAAc,CAgBnD;AAED;;GAEG;AACH,wBAAgB,wBAAwB,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAQlE"}
|
|
@@ -101,7 +101,29 @@ export function commandRequiresTreeSitter(commandName) {
|
|
|
101
101
|
return true;
|
|
102
102
|
}
|
|
103
103
|
/**
|
|
104
|
-
*
|
|
104
|
+
* 异步验证 tree-sitter 可用性,使用 loader-aware 检测。
|
|
105
|
+
* 不可用时抛出 ActionableError,包含 WASM fallback 建议。
|
|
106
|
+
*/
|
|
107
|
+
export async function validateTreeSitterAsync() {
|
|
108
|
+
const info = await detectTreeSitter();
|
|
109
|
+
if (!info.isAvailable) {
|
|
110
|
+
const error = new Error([
|
|
111
|
+
`❌ tree-sitter 不可用`,
|
|
112
|
+
` 错误: ${info.error || '未知错误'}`,
|
|
113
|
+
'',
|
|
114
|
+
'某些命令需要 tree-sitter 才能运行。',
|
|
115
|
+
'请确保已正确安装依赖: npm install',
|
|
116
|
+
'',
|
|
117
|
+
'或使用 --wasm-fallback 自动切换到 WASM 版本。',
|
|
118
|
+
].join('\n'));
|
|
119
|
+
error.code = 'DEP_NATIVE_MISSING';
|
|
120
|
+
error.remediation = 'tree-sitter WASM fallback';
|
|
121
|
+
throw error;
|
|
122
|
+
}
|
|
123
|
+
return info;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* 验证 tree-sitter 可用性,不可用时抛出错误(同步版本,保持向后兼容)
|
|
105
127
|
*/
|
|
106
128
|
export function validateTreeSitter() {
|
|
107
129
|
const info = detectTreeSitterSync();
|