@mycodemap/mycodemap 2.0.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 +20 -0
- package/README.md +59 -184
- 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.d.ts +3 -196
- package/dist/cli/commands/analyze.d.ts.map +1 -1
- package/dist/cli/commands/analyze.js +9 -1163
- package/dist/cli/commands/analyze.js.map +1 -1
- package/dist/cli/commands/benchmark.d.ts.map +1 -1
- package/dist/cli/commands/benchmark.js +5 -2
- package/dist/cli/commands/benchmark.js.map +1 -1
- 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 -60
- package/dist/cli/commands/deps.d.ts.map +1 -1
- package/dist/cli/commands/deps.js +16 -351
- package/dist/cli/commands/deps.js.map +1 -1
- 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 -21
- package/dist/cli/commands/query.d.ts.map +1 -1
- package/dist/cli/commands/query.js +15 -683
- 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-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-native-deps.d.ts.map +1 -1
- package/dist/cli/doctor/check-native-deps.js +20 -4
- package/dist/cli/doctor/check-native-deps.js.map +1 -1
- package/dist/cli/doctor/orchestrator.d.ts.map +1 -1
- package/dist/cli/doctor/orchestrator.js +5 -2
- package/dist/cli/doctor/orchestrator.js.map +1 -1
- 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 +23 -3
- 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.map +1 -1
- package/dist/cli/interface-contract/commands/analyze.js +1 -0
- package/dist/cli/interface-contract/commands/analyze.js.map +1 -1
- package/dist/cli/interface-contract/commands/benchmark.d.ts.map +1 -1
- package/dist/cli/interface-contract/commands/benchmark.js +1 -0
- package/dist/cli/interface-contract/commands/benchmark.js.map +1 -1
- package/dist/cli/interface-contract/commands/deps.d.ts.map +1 -1
- package/dist/cli/interface-contract/commands/deps.js +1 -0
- package/dist/cli/interface-contract/commands/deps.js.map +1 -1
- package/dist/cli/interface-contract/commands/doctor.d.ts.map +1 -1
- package/dist/cli/interface-contract/commands/doctor.js +1 -0
- package/dist/cli/interface-contract/commands/doctor.js.map +1 -1
- 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 +5 -2
- package/dist/cli/interface-contract/commands/index.d.ts.map +1 -1
- package/dist/cli/interface-contract/commands/index.js +7 -1
- package/dist/cli/interface-contract/commands/index.js.map +1 -1
- package/dist/cli/interface-contract/commands/init.d.ts.map +1 -1
- package/dist/cli/interface-contract/commands/init.js +9 -0
- package/dist/cli/interface-contract/commands/init.js.map +1 -1
- 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.map +1 -1
- package/dist/cli/interface-contract/commands/query.js +1 -0
- package/dist/cli/interface-contract/commands/query.js.map +1 -1
- package/dist/cli/interface-contract/index.d.ts +1 -1
- package/dist/cli/interface-contract/index.d.ts.map +1 -1
- package/dist/cli/interface-contract/index.js +2 -2
- package/dist/cli/interface-contract/index.js.map +1 -1
- package/dist/cli/interface-contract/schema.d.ts.map +1 -1
- package/dist/cli/interface-contract/schema.js +1 -0
- package/dist/cli/interface-contract/schema.js.map +1 -1
- package/dist/cli/interface-contract/types.d.ts +1 -0
- package/dist/cli/interface-contract/types.d.ts.map +1 -1
- package/dist/cli/output/error-codes.d.ts +2 -0
- package/dist/cli/output/error-codes.d.ts.map +1 -1
- package/dist/cli/output/error-codes.js +12 -0
- package/dist/cli/output/error-codes.js.map +1 -1
- package/dist/cli/output/errors.d.ts.map +1 -1
- package/dist/cli/output/errors.js +12 -0
- package/dist/cli/output/errors.js.map +1 -1
- package/dist/cli/output/wasm-fallback.d.ts +1 -0
- package/dist/cli/output/wasm-fallback.d.ts.map +1 -1
- package/dist/cli/output/wasm-fallback.js.map +1 -1
- 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-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 +321 -75
- package/dist/infrastructure/storage/adapters/SQLiteStorage.js.map +1 -1
- package/dist/infrastructure/storage/adapters/sqlite-loader.d.ts +22 -0
- package/dist/infrastructure/storage/adapters/sqlite-loader.d.ts.map +1 -1
- package/dist/infrastructure/storage/adapters/sqlite-loader.js +78 -22
- package/dist/infrastructure/storage/adapters/sqlite-loader.js.map +1 -1
- 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/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 +2 -0
- package/dist/parser/implementations/tree-sitter-loader.d.ts.map +1 -1
- package/dist/parser/implementations/tree-sitter-loader.js +46 -15
- package/dist/parser/implementations/tree-sitter-loader.js.map +1 -1
- 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 +11 -1
- package/dist/server/mcp/schema-adapter.d.ts.map +1 -1
- package/dist/server/mcp/schema-adapter.js +126 -7
- package/dist/server/mcp/schema-adapter.js.map +1 -1
- 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 +114 -30
- 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 +112 -0
- 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/SETUP_GUIDE.md +49 -0
- package/docs/TESTING.md +81 -0
- package/docs/ai-guide/OUTPUT.md +51 -8
- 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-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/package.json +8 -3
- package/scripts/copy-build-assets.mjs +23 -0
- package/scripts/hooks/templates/pre-commit +33 -2
- package/scripts/tests/test_rule_control_workflow.py +15 -1
- package/scripts/verify-subagent-env-contract.mjs +279 -0
- package/dist/parser/implementations/tree-sitter-parser.d.ts +0 -60
- package/dist/parser/implementations/tree-sitter-parser.d.ts.map +0 -1
- package/dist/parser/implementations/tree-sitter-parser.js +0 -380
- package/dist/parser/implementations/tree-sitter-parser.js.map +0 -1
|
@@ -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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IAAI,MAAM,EAAE,YAAY,IAAI,OAAO,MAAM,CAAC,YAAY,KAAK,QAAQ,EAAE,CAAC;YACpE,IAAI,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,YAAuC,CAAC,CAAC,CAAC;QAC5E,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,EAAE,CAAC;IACZ,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,OAAe;IACvD,MAAM,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,UAAU,CAAC,GAAG,MAAM,OAAO,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,C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CAAC,EAAE;QACxG,CAAC,CAAC,eAAe,CAAC;IACpB,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG,UAAU,CAAC,CAAC;IACtD,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAEf,8BAA8B;IAC9B,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,sBAAsB,CAAC,CAAC,CAAC;IAC/C,IAAI,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1C,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC,CAAC;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,kBAA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|
@@ -38,7 +38,7 @@ export function createCLI() {
|
|
|
38
38
|
program
|
|
39
39
|
.command('generate')
|
|
40
40
|
.description('生成代码地图(原有命令)')
|
|
41
|
-
.option('-m, --mode <mode>', '
|
|
41
|
+
.option('-m, --mode <mode>', 'Parser 兼容输入;默认走单一路径 parser,旧 mode 会被拒绝', 'tree-sitter')
|
|
42
42
|
.option('-o, --output <path>', '输出目录')
|
|
43
43
|
.option('-w, --watch', '监视模式')
|
|
44
44
|
.action(async () => {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli-new/index.ts"],"names":[],"mappings":";AACA,+DAA+D;AAC/D,sEAAsE;AACtE,+CAA+C;AAC/C,2BAA2B;AAC3B,+CAA+C;AAE/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAEzD,qBAAqB;AACrB,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,oBAAoB,EAAE,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC;AACrF,MAAM,OAAO,GAAG,WAAW,CAAC,OAAO,CAAC,OAAO,IAAI,OAAO,CAAC;AAEvD;;GAEG;AACH,MAAM,UAAU,SAAS;IACvB,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;IAE9B,OAAO;SACJ,IAAI,CAAC,SAAS,CAAC;SACf,WAAW,CAAC,oBAAoB,CAAC;SACjC,OAAO,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,CAAC;SAC1C,MAAM,CAAC,WAAW,EAAE,QAAQ,EAAE,KAAK,CAAC;SACpC,MAAM,CAAC,UAAU,EAAE,YAAY,EAAE,KAAK,CAAC;SACvC,IAAI,CAAC,WAAW,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U,GAAG,CAAC,OAAiB,OAAO,CAAC,IAAI;IACrD,MAAM,OAAO,GAAG,SAAS,EAAE,CAAC;IAC5B,MAAM,OAAO,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;AACjC,CAAC;AAED,YAAY;AACZ,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,KAAK,UAAU,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC;IACpD,GAAG,EAAE,CAAC;AACR,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { IParserRegistry, ITypeEnhancer } from '../interface/types/parser.js';
|
|
2
|
+
export interface AnalysisContext {
|
|
3
|
+
parserRegistry: IParserRegistry;
|
|
4
|
+
typeEnhancers: ITypeEnhancer[];
|
|
5
|
+
}
|
|
6
|
+
export declare function buildAnalysisContext(rootDir: string, enhanceTypes?: boolean): AnalysisContext;
|
|
7
|
+
//# sourceMappingURL=parser-composition.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser-composition.d.ts","sourceRoot":"","sources":["../../src/composition/parser-composition.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAEnF,MAAM,WAAW,eAAe;IAC9B,cAAc,EAAE,eAAe,CAAC;IAChC,aAAa,EAAE,aAAa,EAAE,CAAC;CAChC;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,UAAO,GAAG,eAAe,CAQ1F"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// [META] since:2026-05 | owner:architecture-team | stable:false
|
|
2
|
+
// [WHY] Composition root for parser/analyzer wiring so Core consumes abstractions, not Infrastructure factories
|
|
3
|
+
import { createDefaultParserRegistry } from '../infrastructure/parser/index.js';
|
|
4
|
+
import { TypeScriptTypeEnhancer } from '../infrastructure/parser/enhancers/TypeScriptTypeEnhancer.js';
|
|
5
|
+
import { PythonTypeEnhancer } from '../parser/enhancers/PythonTypeEnhancer.js';
|
|
6
|
+
export function buildAnalysisContext(rootDir, enhanceTypes = true) {
|
|
7
|
+
return {
|
|
8
|
+
parserRegistry: createDefaultParserRegistry(),
|
|
9
|
+
typeEnhancers: [
|
|
10
|
+
new TypeScriptTypeEnhancer(rootDir, enhanceTypes),
|
|
11
|
+
new PythonTypeEnhancer(enhanceTypes),
|
|
12
|
+
],
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=parser-composition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser-composition.js","sourceRoot":"","sources":["../../src/composition/parser-composition.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,gHAAgH;AAEhH,OAAO,EAAE,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAChF,OAAO,EAAE,sBAAsB,EAAE,MAAM,8DAA8D,CAAC;AACtG,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAQ/E,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,YAAY,GAAG,IAAI;IACvE,OAAO;QACL,cAAc,EAAE,2BAA2B,EAAE;QAC7C,aAAa,EAAE;YACb,IAAI,sBAAsB,CAAC,OAAO,EAAE,YAAY,CAAC;YACjD,IAAI,kBAAkB,CAAC,YAAY,CAAC;SACrC;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../../src/core/analyzer.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"analyzer.d.ts","sourceRoot":"","sources":["../../src/core/analyzer.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,OAAO,EAAE,eAAe,EAA4D,MAAM,mBAAmB,CAAC;AAU5H,wBAAsB,OAAO,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,OAAO,CAAC,CA6HxE"}
|
package/dist/core/analyzer.js
CHANGED
|
@@ -2,86 +2,77 @@
|
|
|
2
2
|
// [WHY] Core analysis engine that orchestrates parsing, dependency analysis, and code map generation
|
|
3
3
|
import path from 'path';
|
|
4
4
|
import fs from 'fs/promises';
|
|
5
|
-
import {
|
|
6
|
-
import { createGlobalIndex
|
|
5
|
+
import { isDeprecatedParserMode } from '../parser/index.js';
|
|
6
|
+
import { createGlobalIndex } from './global-index.js';
|
|
7
7
|
import { discoverProjectFiles, DEFAULT_DISCOVERY_EXCLUDES } from './file-discovery.js';
|
|
8
|
-
|
|
9
|
-
const
|
|
8
|
+
import { ErrorCodes } from '../cli/output/error-codes.js';
|
|
9
|
+
const DEFAULT_ANALYSIS_INCLUDE = ['src/**/*.{ts,tsx,js,jsx,py,go}'];
|
|
10
10
|
// 主分析函数
|
|
11
11
|
export async function analyze(options) {
|
|
12
|
-
const { rootDir, include = [
|
|
12
|
+
const { rootDir, include = [...DEFAULT_ANALYSIS_INCLUDE], exclude = DEFAULT_DISCOVERY_EXCLUDES, mode = 'tree-sitter', enhanceTypes = true, parserRegistry, typeEnhancers = [], } = options;
|
|
13
|
+
if (isDeprecatedParserMode(mode)) {
|
|
14
|
+
const error = new Error(`Parser mode "${mode}" is deprecated. Remove the mode override and use the default parser flow.`);
|
|
15
|
+
error.code = ErrorCodes.DEPRECATED_PARSER_MODE;
|
|
16
|
+
throw error;
|
|
17
|
+
}
|
|
13
18
|
// 1. 发现文件
|
|
14
19
|
const files = await discoverProjectFiles({
|
|
15
20
|
rootDir,
|
|
16
21
|
include,
|
|
17
22
|
exclude
|
|
18
23
|
});
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
if (mode === 'hybrid') {
|
|
22
|
-
if (files.length >= HYBRID_THRESHOLD) {
|
|
23
|
-
actualMode = 'smart';
|
|
24
|
-
}
|
|
25
|
-
else {
|
|
26
|
-
actualMode = 'fast';
|
|
27
|
-
}
|
|
28
|
-
console.log(`[Hybrid] 检测到 ${files.length} 个文件,自动选择 ${actualMode} 模式`);
|
|
24
|
+
if (!parserRegistry) {
|
|
25
|
+
throw new Error('AnalysisOptions.parserRegistry is required. Use the composition root to build analysis context.');
|
|
29
26
|
}
|
|
30
|
-
|
|
31
|
-
const modules = [];
|
|
27
|
+
const initializedParsers = new Set();
|
|
32
28
|
let parseResults = [];
|
|
33
|
-
|
|
34
|
-
if (actualMode === 'smart') {
|
|
35
|
-
// Smart 模式:使用 SmartParser 获取复杂度、调用图、完整类型信息
|
|
36
|
-
const parser = createParser({ mode: 'smart', rootDir });
|
|
29
|
+
for (const file of files) {
|
|
37
30
|
try {
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
modules.push(moduleInfo);
|
|
31
|
+
const parser = parserRegistry.getParserByFile(file);
|
|
32
|
+
if (!parser) {
|
|
33
|
+
console.warn(`Warning: No parser registered for ${file}`);
|
|
34
|
+
continue;
|
|
43
35
|
}
|
|
36
|
+
if (!initializedParsers.has(parser.languageId)) {
|
|
37
|
+
await parser.initialize();
|
|
38
|
+
initializedParsers.add(parser.languageId);
|
|
39
|
+
}
|
|
40
|
+
const content = await fs.readFile(file, 'utf-8');
|
|
41
|
+
const parsed = await parser.parseFile(file, content, {
|
|
42
|
+
includeCallGraph: true,
|
|
43
|
+
includeComplexity: true,
|
|
44
|
+
includeTypeInfo: true,
|
|
45
|
+
});
|
|
46
|
+
parseResults.push(parsed);
|
|
44
47
|
}
|
|
45
48
|
catch (error) {
|
|
46
|
-
console.warn(`Warning:
|
|
47
|
-
// Fallback to basic parser
|
|
48
|
-
for (const file of files) {
|
|
49
|
-
try {
|
|
50
|
-
const moduleInfo = await parseFile(file);
|
|
51
|
-
moduleInfo.id = createModuleId(moduleInfo.path);
|
|
52
|
-
moduleInfo.dependencies = Array.from(new Set(moduleInfo.dependencies));
|
|
53
|
-
modules.push(moduleInfo);
|
|
54
|
-
}
|
|
55
|
-
catch (e) {
|
|
56
|
-
console.warn(`Warning: Failed to parse ${file}: ${e}`);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
49
|
+
console.warn(`Warning: Failed to parse ${file}: ${error}`);
|
|
59
50
|
}
|
|
60
51
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
try {
|
|
65
|
-
const moduleInfo = await parseFile(file);
|
|
66
|
-
moduleInfo.id = createModuleId(moduleInfo.path);
|
|
67
|
-
moduleInfo.dependencies = Array.from(new Set(moduleInfo.dependencies));
|
|
68
|
-
modules.push(moduleInfo);
|
|
69
|
-
}
|
|
70
|
-
catch (error) {
|
|
71
|
-
console.warn(`Warning: Failed to parse ${file}: ${error}`);
|
|
72
|
-
}
|
|
52
|
+
if (enhanceTypes) {
|
|
53
|
+
for (const enhancer of typeEnhancers) {
|
|
54
|
+
parseResults = await enhancer.enhance(parseResults);
|
|
73
55
|
}
|
|
74
56
|
}
|
|
75
|
-
|
|
76
|
-
|
|
57
|
+
const modules = parseResults.map((result) => convertToModuleInfo(result));
|
|
58
|
+
for (const enhancer of typeEnhancers) {
|
|
59
|
+
enhancer.dispose();
|
|
60
|
+
}
|
|
61
|
+
await Promise.all(parserRegistry.getSupportedLanguages().map(async (language) => {
|
|
62
|
+
const parser = parserRegistry.getParser(language);
|
|
63
|
+
if (parser) {
|
|
64
|
+
await parser.dispose();
|
|
65
|
+
}
|
|
66
|
+
}));
|
|
67
|
+
// 3. 构建全局符号索引和跨文件调用链
|
|
68
|
+
if (parseResults.length > 0) {
|
|
77
69
|
try {
|
|
78
70
|
console.log('[Analyzer] 构建全局符号索引...');
|
|
79
71
|
const globalIndex = createGlobalIndex(parseResults, rootDir);
|
|
80
72
|
// 将跨文件调用信息添加到模块
|
|
81
73
|
for (const mod of modules) {
|
|
82
74
|
const relativePath = path.relative(rootDir, mod.path);
|
|
83
|
-
const
|
|
84
|
-
const calls = builder.getCrossFileCalls(relativePath);
|
|
75
|
+
const calls = globalIndex.files.get(relativePath)?.crossFileCalls ?? [];
|
|
85
76
|
if (calls.length > 0 && mod.callGraph) {
|
|
86
77
|
// 增强 callGraph 包含跨文件调用信息
|
|
87
78
|
mod.callGraph = {
|
|
@@ -96,12 +87,12 @@ export async function analyze(options) {
|
|
|
96
87
|
console.warn(`Warning: 全局索引构建失败: ${error}`);
|
|
97
88
|
}
|
|
98
89
|
}
|
|
99
|
-
//
|
|
90
|
+
// 4. 构建依赖图
|
|
100
91
|
const dependencies = buildDependencyGraph(modules);
|
|
101
|
-
//
|
|
92
|
+
// 5. 计算摘要
|
|
102
93
|
const summary = calculateSummary(modules);
|
|
103
94
|
const graphIntegrity = calculateGraphIntegrity(files, modules);
|
|
104
|
-
//
|
|
95
|
+
// 6. 获取项目信息
|
|
105
96
|
const project = await getProjectInfo(rootDir);
|
|
106
97
|
return {
|
|
107
98
|
version: '1.0.0',
|
|
@@ -113,28 +104,53 @@ export async function analyze(options) {
|
|
|
113
104
|
graphStatus: graphIntegrity.graphStatus,
|
|
114
105
|
failedFileCount: graphIntegrity.failedFileCount,
|
|
115
106
|
parseFailureFiles: graphIntegrity.parseFailureFiles,
|
|
116
|
-
actualMode
|
|
117
107
|
};
|
|
118
108
|
}
|
|
119
109
|
// 转换 ParseResult 到 ModuleInfo
|
|
120
110
|
function convertToModuleInfo(result) {
|
|
121
111
|
return {
|
|
122
|
-
id: createModuleId(result.
|
|
123
|
-
path: result.
|
|
124
|
-
absolutePath: result.
|
|
125
|
-
type: result.
|
|
126
|
-
stats: result.stats,
|
|
112
|
+
id: createModuleId(result.filePath),
|
|
113
|
+
path: result.filePath,
|
|
114
|
+
absolutePath: result.filePath,
|
|
115
|
+
type: categorizeParsedFile(result.filePath),
|
|
116
|
+
stats: result.module.stats,
|
|
127
117
|
exports: result.exports,
|
|
128
118
|
imports: result.imports,
|
|
129
119
|
symbols: result.symbols,
|
|
130
|
-
dependencies: Array.from(new Set(result.
|
|
120
|
+
dependencies: Array.from(new Set(result.imports.map((entry) => resolveDependencyPath(result.filePath, entry.source)))),
|
|
131
121
|
dependents: [],
|
|
132
|
-
// Smart 模式额外信息
|
|
133
122
|
complexity: result.complexity,
|
|
134
|
-
callGraph: result.callGraph
|
|
123
|
+
callGraph: result.callGraph
|
|
124
|
+
? {
|
|
125
|
+
calls: result.callGraph.calls,
|
|
126
|
+
recursive: result.callGraph.recursive,
|
|
127
|
+
issues: result.callGraph.issues,
|
|
128
|
+
callCounts: result.callGraph.calls.reduce((counts, call) => {
|
|
129
|
+
counts[call.callee] = (counts[call.callee] ?? 0) + 1;
|
|
130
|
+
return counts;
|
|
131
|
+
}, {}),
|
|
132
|
+
}
|
|
133
|
+
: undefined,
|
|
135
134
|
typeInfo: result.typeInfo
|
|
136
135
|
};
|
|
137
136
|
}
|
|
137
|
+
function categorizeParsedFile(filePath) {
|
|
138
|
+
if (filePath.includes('.test.') || filePath.includes('.spec.'))
|
|
139
|
+
return 'test';
|
|
140
|
+
if (filePath.includes('config.') || filePath.endsWith('config.ts'))
|
|
141
|
+
return 'config';
|
|
142
|
+
return 'source';
|
|
143
|
+
}
|
|
144
|
+
function resolveDependencyPath(fromPath, importPath) {
|
|
145
|
+
if (!importPath.startsWith('.')) {
|
|
146
|
+
return importPath;
|
|
147
|
+
}
|
|
148
|
+
const resolved = path.resolve(path.dirname(fromPath), importPath);
|
|
149
|
+
if (/\.(ts|tsx|js|jsx|py|go)$/i.test(resolved)) {
|
|
150
|
+
return resolved;
|
|
151
|
+
}
|
|
152
|
+
return `${resolved}.ts`;
|
|
153
|
+
}
|
|
138
154
|
function calculateGraphIntegrity(discoveredFiles, modules) {
|
|
139
155
|
const discoveredSet = new Set(discoveredFiles.map(filePath => normalizePath(filePath)));
|
|
140
156
|
const parsedSet = new Set(modules.map(moduleInfo => normalizePath(moduleInfo.path)));
|