@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
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
// [META] since:2026-03-24 | owner:architecture-team | stable:false
|
|
2
2
|
// [WHY] Share CodeGraph clone/query/analysis helpers across storage backends to keep contract behavior consistent
|
|
3
|
+
function cloneDependencyList(dependencies) {
|
|
4
|
+
return dependencies.map((dependency) => ({ ...dependency }));
|
|
5
|
+
}
|
|
3
6
|
export function cloneCodeGraph(graph) {
|
|
4
7
|
return globalThis.structuredClone(graph);
|
|
5
8
|
}
|
|
@@ -19,6 +22,7 @@ export function deserializeCodeGraphSnapshot(snapshot, projectPath = '') {
|
|
|
19
22
|
graphStatus: parsedGraph.graphStatus ?? 'complete',
|
|
20
23
|
failedFileCount: parsedGraph.failedFileCount ?? 0,
|
|
21
24
|
parseFailureFiles: parsedGraph.parseFailureFiles ?? [],
|
|
25
|
+
lastRefresh: parsedGraph.lastRefresh,
|
|
22
26
|
};
|
|
23
27
|
}
|
|
24
28
|
export function createEmptyCodeGraph(projectPath = '') {
|
|
@@ -37,6 +41,7 @@ export function createEmptyCodeGraph(projectPath = '') {
|
|
|
37
41
|
graphStatus: 'complete',
|
|
38
42
|
failedFileCount: 0,
|
|
39
43
|
parseFailureFiles: [],
|
|
44
|
+
lastRefresh: undefined,
|
|
40
45
|
};
|
|
41
46
|
}
|
|
42
47
|
export function getGraphMetadataFromGraph(graph, generatedAt = null) {
|
|
@@ -50,6 +55,7 @@ export function getGraphMetadataFromGraph(graph, generatedAt = null) {
|
|
|
50
55
|
parseFailureFiles: [...(graph.parseFailureFiles ?? [])],
|
|
51
56
|
moduleCount: graph.modules.length,
|
|
52
57
|
symbolCount: graph.symbols.length,
|
|
58
|
+
lastRefresh: graph.lastRefresh,
|
|
53
59
|
};
|
|
54
60
|
}
|
|
55
61
|
export function upsertModuleInGraph(graph, module) {
|
|
@@ -70,6 +76,447 @@ export function deleteModuleFromGraph(graph, moduleId) {
|
|
|
70
76
|
nextGraph.dependencies = nextGraph.dependencies.filter(dependency => dependency.sourceId !== moduleId && dependency.targetId !== moduleId);
|
|
71
77
|
return nextGraph;
|
|
72
78
|
}
|
|
79
|
+
function normalizePath(filePath) {
|
|
80
|
+
return filePath.replace(/\\/gu, '/');
|
|
81
|
+
}
|
|
82
|
+
function matchesRequestedPath(candidatePath, requestedPath) {
|
|
83
|
+
const normalizedCandidate = normalizePath(candidatePath);
|
|
84
|
+
const normalizedRequested = normalizePath(requestedPath);
|
|
85
|
+
return normalizedCandidate === normalizedRequested
|
|
86
|
+
|| normalizedCandidate.endsWith(`/${normalizedRequested}`)
|
|
87
|
+
|| normalizedRequested.endsWith(`/${normalizedCandidate}`);
|
|
88
|
+
}
|
|
89
|
+
function isConservativeConfidence(confidence) {
|
|
90
|
+
return confidence === 'INFERRED' || confidence === 'AMBIGUOUS';
|
|
91
|
+
}
|
|
92
|
+
function createEmptyImpactResult(request, graphStatus, overrides) {
|
|
93
|
+
return {
|
|
94
|
+
status: overrides.status,
|
|
95
|
+
confidence: overrides.confidence,
|
|
96
|
+
graphStatus,
|
|
97
|
+
entrypoint: {
|
|
98
|
+
kind: request.kind,
|
|
99
|
+
name: request.kind === 'file' ? request.filePath : request.symbol,
|
|
100
|
+
filePath: request.filePath,
|
|
101
|
+
...overrides.entrypoint,
|
|
102
|
+
},
|
|
103
|
+
summary: {
|
|
104
|
+
requestedDepth: request.depth,
|
|
105
|
+
directCount: 0,
|
|
106
|
+
transitiveCount: 0,
|
|
107
|
+
totalCount: 0,
|
|
108
|
+
maxDepth: 0,
|
|
109
|
+
truncated: false,
|
|
110
|
+
},
|
|
111
|
+
direct: [],
|
|
112
|
+
transitiveLayers: [],
|
|
113
|
+
warnings: overrides.warnings ?? [],
|
|
114
|
+
truncated: false,
|
|
115
|
+
remediation: overrides.remediation,
|
|
116
|
+
error: overrides.error,
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
export function createGraphReadIndex(graph) {
|
|
120
|
+
const dependenciesBySourceId = new Map();
|
|
121
|
+
const dependenciesByTargetId = new Map();
|
|
122
|
+
for (const dependency of graph.dependencies) {
|
|
123
|
+
const sourceDependencies = dependenciesBySourceId.get(dependency.sourceId) ?? [];
|
|
124
|
+
sourceDependencies.push(dependency);
|
|
125
|
+
dependenciesBySourceId.set(dependency.sourceId, sourceDependencies);
|
|
126
|
+
const targetDependencies = dependenciesByTargetId.get(dependency.targetId) ?? [];
|
|
127
|
+
targetDependencies.push(dependency);
|
|
128
|
+
dependenciesByTargetId.set(dependency.targetId, targetDependencies);
|
|
129
|
+
}
|
|
130
|
+
return {
|
|
131
|
+
moduleById: new Map(graph.modules.map((module) => [module.id, module])),
|
|
132
|
+
symbolById: new Map(graph.symbols.map((symbol) => [symbol.id, symbol])),
|
|
133
|
+
dependenciesBySourceId,
|
|
134
|
+
dependenciesByTargetId,
|
|
135
|
+
moduleReverseAdjacency: buildModuleReverseAdjacency(graph),
|
|
136
|
+
symbolReverseAdjacency: buildSymbolReverseAdjacency(graph),
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
function toImpactCandidate(moduleOrSymbol) {
|
|
140
|
+
if ('moduleId' in moduleOrSymbol) {
|
|
141
|
+
return {
|
|
142
|
+
id: moduleOrSymbol.id,
|
|
143
|
+
kind: 'symbol',
|
|
144
|
+
name: moduleOrSymbol.name,
|
|
145
|
+
filePath: moduleOrSymbol.location.file,
|
|
146
|
+
line: moduleOrSymbol.location.line,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
return {
|
|
150
|
+
id: moduleOrSymbol.id,
|
|
151
|
+
kind: 'module',
|
|
152
|
+
name: moduleOrSymbol.path,
|
|
153
|
+
filePath: moduleOrSymbol.path,
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
function resolveImpactEntrypointInGraph(graph, request) {
|
|
157
|
+
const graphStatus = graph.modules.length > 0 || graph.symbols.length > 0
|
|
158
|
+
? (graph.graphStatus ?? 'complete')
|
|
159
|
+
: 'missing';
|
|
160
|
+
if (graphStatus === 'missing') {
|
|
161
|
+
return {
|
|
162
|
+
ok: false,
|
|
163
|
+
result: createEmptyImpactResult(request, 'missing', {
|
|
164
|
+
status: 'unavailable',
|
|
165
|
+
confidence: 'unavailable',
|
|
166
|
+
error: {
|
|
167
|
+
code: 'GRAPH_NOT_FOUND',
|
|
168
|
+
message: 'Code graph not found. Run `mycodemap generate --symbol-level` first.',
|
|
169
|
+
},
|
|
170
|
+
remediation: 'Run `mycodemap generate --symbol-level` to rebuild graph truth before querying impact.',
|
|
171
|
+
}),
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
if (request.kind === 'file') {
|
|
175
|
+
const matches = graph.modules.filter((module) => matchesRequestedPath(module.path, request.filePath));
|
|
176
|
+
if (matches.length === 1) {
|
|
177
|
+
return {
|
|
178
|
+
ok: true,
|
|
179
|
+
rootId: matches[0].id,
|
|
180
|
+
entrypoint: {
|
|
181
|
+
kind: 'file',
|
|
182
|
+
id: matches[0].id,
|
|
183
|
+
name: matches[0].path,
|
|
184
|
+
filePath: matches[0].path,
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
if (matches.length > 1) {
|
|
189
|
+
return {
|
|
190
|
+
ok: false,
|
|
191
|
+
result: createEmptyImpactResult(request, graphStatus, {
|
|
192
|
+
status: 'ambiguous',
|
|
193
|
+
confidence: 'ambiguous',
|
|
194
|
+
error: {
|
|
195
|
+
code: 'AMBIGUOUS_ENTRYPOINT',
|
|
196
|
+
message: `File "${request.filePath}" resolves to multiple modules.`,
|
|
197
|
+
details: {
|
|
198
|
+
candidates: matches.map(toImpactCandidate),
|
|
199
|
+
},
|
|
200
|
+
},
|
|
201
|
+
entrypoint: {
|
|
202
|
+
candidates: matches.map(toImpactCandidate),
|
|
203
|
+
},
|
|
204
|
+
}),
|
|
205
|
+
};
|
|
206
|
+
}
|
|
207
|
+
return {
|
|
208
|
+
ok: false,
|
|
209
|
+
result: createEmptyImpactResult(request, graphStatus, {
|
|
210
|
+
status: 'not_found',
|
|
211
|
+
confidence: 'unavailable',
|
|
212
|
+
error: {
|
|
213
|
+
code: 'FILE_NOT_FOUND',
|
|
214
|
+
message: `File "${request.filePath}" not found in the persisted graph.`,
|
|
215
|
+
},
|
|
216
|
+
remediation: 'Use a repo-relative path and regenerate graph truth if the file is newly added.',
|
|
217
|
+
}),
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
const matches = graph.symbols
|
|
221
|
+
.filter((symbol) => symbol.name === request.symbol)
|
|
222
|
+
.filter((symbol) => request.filePath ? matchesRequestedPath(symbol.location.file, request.filePath) : true);
|
|
223
|
+
if (matches.length === 1) {
|
|
224
|
+
return {
|
|
225
|
+
ok: true,
|
|
226
|
+
rootId: matches[0].id,
|
|
227
|
+
entrypoint: {
|
|
228
|
+
kind: 'symbol',
|
|
229
|
+
id: matches[0].id,
|
|
230
|
+
name: matches[0].name,
|
|
231
|
+
filePath: matches[0].location.file,
|
|
232
|
+
line: matches[0].location.line,
|
|
233
|
+
},
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
if (matches.length > 1) {
|
|
237
|
+
return {
|
|
238
|
+
ok: false,
|
|
239
|
+
result: createEmptyImpactResult(request, graphStatus, {
|
|
240
|
+
status: 'ambiguous',
|
|
241
|
+
confidence: 'ambiguous',
|
|
242
|
+
error: {
|
|
243
|
+
code: 'AMBIGUOUS_ENTRYPOINT',
|
|
244
|
+
message: `Symbol "${request.symbol}" resolves to multiple candidates.`,
|
|
245
|
+
details: {
|
|
246
|
+
candidates: matches.map(toImpactCandidate),
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
entrypoint: {
|
|
250
|
+
candidates: matches.map(toImpactCandidate),
|
|
251
|
+
},
|
|
252
|
+
}),
|
|
253
|
+
};
|
|
254
|
+
}
|
|
255
|
+
return {
|
|
256
|
+
ok: false,
|
|
257
|
+
result: createEmptyImpactResult(request, graphStatus, {
|
|
258
|
+
status: 'not_found',
|
|
259
|
+
confidence: 'unavailable',
|
|
260
|
+
error: {
|
|
261
|
+
code: 'SYMBOL_NOT_FOUND',
|
|
262
|
+
message: request.filePath
|
|
263
|
+
? `Symbol "${request.symbol}" not found in "${request.filePath}".`
|
|
264
|
+
: `Symbol "${request.symbol}" not found.`,
|
|
265
|
+
},
|
|
266
|
+
remediation: 'Use an exact symbol name and optionally pass filePath to disambiguate.',
|
|
267
|
+
}),
|
|
268
|
+
};
|
|
269
|
+
}
|
|
270
|
+
function buildModuleReverseAdjacency(graph) {
|
|
271
|
+
const adjacency = new Map();
|
|
272
|
+
const symbolToModuleId = new Map(graph.symbols.map((symbol) => [symbol.id, symbol.moduleId]));
|
|
273
|
+
for (const dependency of graph.dependencies) {
|
|
274
|
+
const sourceModuleId = dependency.sourceEntityType === 'symbol'
|
|
275
|
+
? symbolToModuleId.get(dependency.sourceId)
|
|
276
|
+
: dependency.sourceId;
|
|
277
|
+
const targetModuleId = dependency.targetEntityType === 'symbol'
|
|
278
|
+
? symbolToModuleId.get(dependency.targetId)
|
|
279
|
+
: dependency.targetId;
|
|
280
|
+
if (!sourceModuleId || !targetModuleId || sourceModuleId === targetModuleId) {
|
|
281
|
+
continue;
|
|
282
|
+
}
|
|
283
|
+
if (!adjacency.has(targetModuleId)) {
|
|
284
|
+
adjacency.set(targetModuleId, new Set());
|
|
285
|
+
}
|
|
286
|
+
adjacency.get(targetModuleId)?.add(sourceModuleId);
|
|
287
|
+
}
|
|
288
|
+
return new Map(Array.from(adjacency.entries()).map(([key, values]) => [key, Array.from(values)]));
|
|
289
|
+
}
|
|
290
|
+
function buildSymbolReverseAdjacency(graph) {
|
|
291
|
+
const adjacency = new Map();
|
|
292
|
+
for (const dependency of graph.dependencies) {
|
|
293
|
+
if (dependency.type !== 'call'
|
|
294
|
+
|| dependency.sourceEntityType !== 'symbol'
|
|
295
|
+
|| dependency.targetEntityType !== 'symbol') {
|
|
296
|
+
continue;
|
|
297
|
+
}
|
|
298
|
+
if (!adjacency.has(dependency.targetId)) {
|
|
299
|
+
adjacency.set(dependency.targetId, new Set());
|
|
300
|
+
}
|
|
301
|
+
adjacency.get(dependency.targetId)?.add(dependency.sourceId);
|
|
302
|
+
}
|
|
303
|
+
return new Map(Array.from(adjacency.entries()).map(([key, values]) => [key, Array.from(values)]));
|
|
304
|
+
}
|
|
305
|
+
function collectImpactTraversal(rootId, depth, limit, adjacency, resolveNode) {
|
|
306
|
+
const direct = [];
|
|
307
|
+
const transitiveLayerMap = new Map();
|
|
308
|
+
const visited = new Set([rootId]);
|
|
309
|
+
const queue = [{ id: rootId, depth: 0, path: [rootId] }];
|
|
310
|
+
let impactedCount = 0;
|
|
311
|
+
let truncated = false;
|
|
312
|
+
while (queue.length > 0) {
|
|
313
|
+
const current = queue.shift();
|
|
314
|
+
if (!current || current.depth >= depth) {
|
|
315
|
+
continue;
|
|
316
|
+
}
|
|
317
|
+
const neighbors = adjacency.get(current.id) ?? [];
|
|
318
|
+
for (const neighborId of neighbors) {
|
|
319
|
+
if (visited.has(neighborId)) {
|
|
320
|
+
continue;
|
|
321
|
+
}
|
|
322
|
+
if (impactedCount >= limit) {
|
|
323
|
+
truncated = true;
|
|
324
|
+
queue.length = 0;
|
|
325
|
+
break;
|
|
326
|
+
}
|
|
327
|
+
const nextDepth = current.depth + 1;
|
|
328
|
+
const nextPath = [...current.path, neighborId];
|
|
329
|
+
const node = resolveNode(neighborId, nextDepth, nextPath);
|
|
330
|
+
if (!node) {
|
|
331
|
+
continue;
|
|
332
|
+
}
|
|
333
|
+
visited.add(neighborId);
|
|
334
|
+
impactedCount += 1;
|
|
335
|
+
if (nextDepth === 1) {
|
|
336
|
+
direct.push(node);
|
|
337
|
+
}
|
|
338
|
+
else {
|
|
339
|
+
const layer = transitiveLayerMap.get(nextDepth) ?? [];
|
|
340
|
+
layer.push(node);
|
|
341
|
+
transitiveLayerMap.set(nextDepth, layer);
|
|
342
|
+
}
|
|
343
|
+
queue.push({
|
|
344
|
+
id: neighborId,
|
|
345
|
+
depth: nextDepth,
|
|
346
|
+
path: nextPath,
|
|
347
|
+
});
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
return {
|
|
351
|
+
direct,
|
|
352
|
+
transitiveLayers: Array.from(transitiveLayerMap.entries())
|
|
353
|
+
.sort((left, right) => left[0] - right[0])
|
|
354
|
+
.map(([layerDepth, nodes]) => ({
|
|
355
|
+
depth: layerDepth,
|
|
356
|
+
nodes,
|
|
357
|
+
})),
|
|
358
|
+
truncated,
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
function buildSharedImpactResult(graph, request, resolved, traversal) {
|
|
362
|
+
const graphStatus = graph.graphStatus ?? 'complete';
|
|
363
|
+
const warnings = [];
|
|
364
|
+
let confidence = 'high';
|
|
365
|
+
if (graphStatus === 'partial') {
|
|
366
|
+
warnings.push({
|
|
367
|
+
code: 'GRAPH_PARTIAL',
|
|
368
|
+
message: 'Graph truth is partial; parse failures may hide affected files or symbols.',
|
|
369
|
+
});
|
|
370
|
+
confidence = 'reduced';
|
|
371
|
+
}
|
|
372
|
+
if (traversal.truncated) {
|
|
373
|
+
warnings.push({
|
|
374
|
+
code: 'TRAVERSAL_TRUNCATED',
|
|
375
|
+
message: 'Impact traversal hit the configured depth/limit boundary before exhaustion.',
|
|
376
|
+
});
|
|
377
|
+
confidence = 'reduced';
|
|
378
|
+
}
|
|
379
|
+
const transitiveCount = traversal.transitiveLayers.reduce((sum, layer) => sum + layer.nodes.length, 0);
|
|
380
|
+
return {
|
|
381
|
+
status: 'ok',
|
|
382
|
+
confidence,
|
|
383
|
+
graphStatus,
|
|
384
|
+
entrypoint: resolved.entrypoint,
|
|
385
|
+
summary: {
|
|
386
|
+
requestedDepth: request.depth,
|
|
387
|
+
directCount: traversal.direct.length,
|
|
388
|
+
transitiveCount,
|
|
389
|
+
totalCount: traversal.direct.length + transitiveCount,
|
|
390
|
+
maxDepth: traversal.transitiveLayers.at(-1)?.depth ?? (traversal.direct.length > 0 ? 1 : 0),
|
|
391
|
+
truncated: traversal.truncated,
|
|
392
|
+
},
|
|
393
|
+
direct: traversal.direct,
|
|
394
|
+
transitiveLayers: traversal.transitiveLayers,
|
|
395
|
+
warnings,
|
|
396
|
+
truncated: traversal.truncated,
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
function toModuleImpactNode(module, depth, path) {
|
|
400
|
+
return {
|
|
401
|
+
id: module.id,
|
|
402
|
+
kind: 'module',
|
|
403
|
+
name: module.path,
|
|
404
|
+
filePath: module.path,
|
|
405
|
+
depth,
|
|
406
|
+
path,
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
function toSymbolImpactNode(symbol, depth, path) {
|
|
410
|
+
return {
|
|
411
|
+
id: symbol.id,
|
|
412
|
+
kind: 'symbol',
|
|
413
|
+
name: symbol.name,
|
|
414
|
+
filePath: symbol.location.file,
|
|
415
|
+
depth,
|
|
416
|
+
path,
|
|
417
|
+
symbol: { ...symbol },
|
|
418
|
+
};
|
|
419
|
+
}
|
|
420
|
+
export function analyzeImpactInGraph(graph, request, index) {
|
|
421
|
+
const resolved = resolveImpactEntrypointInGraph(graph, request);
|
|
422
|
+
if (!resolved.ok) {
|
|
423
|
+
return resolved.result;
|
|
424
|
+
}
|
|
425
|
+
if (request.kind === 'file') {
|
|
426
|
+
const moduleMap = index?.moduleById ?? new Map(graph.modules.map((module) => [module.id, module]));
|
|
427
|
+
const traversal = collectImpactTraversal(resolved.rootId, request.depth, request.limit ?? Number.MAX_SAFE_INTEGER, index?.moduleReverseAdjacency ?? buildModuleReverseAdjacency(graph), (id, hop, traversalPath) => {
|
|
428
|
+
const module = moduleMap.get(id);
|
|
429
|
+
return module ? toModuleImpactNode(module, hop, traversalPath) : null;
|
|
430
|
+
});
|
|
431
|
+
return buildSharedImpactResult(graph, request, resolved, traversal);
|
|
432
|
+
}
|
|
433
|
+
const symbolMap = index?.symbolById ?? new Map(graph.symbols.map((symbol) => [symbol.id, symbol]));
|
|
434
|
+
const traversal = collectImpactTraversal(resolved.rootId, request.depth, request.limit, index?.symbolReverseAdjacency ?? buildSymbolReverseAdjacency(graph), (id, hop, traversalPath) => {
|
|
435
|
+
const symbol = symbolMap.get(id);
|
|
436
|
+
return symbol ? toSymbolImpactNode(symbol, hop, traversalPath) : null;
|
|
437
|
+
});
|
|
438
|
+
return buildSharedImpactResult(graph, request, resolved, traversal);
|
|
439
|
+
}
|
|
440
|
+
export function collectIncrementalNeighborhood(graph, changedModulePaths) {
|
|
441
|
+
const normalizedChangedPaths = changedModulePaths.map(normalizePath);
|
|
442
|
+
const moduleById = new Map(graph.modules.map((module) => [module.id, module]));
|
|
443
|
+
const moduleIdByPath = new Map(graph.modules.map((module) => [normalizePath(module.path), module.id]));
|
|
444
|
+
const symbolToModuleId = new Map(graph.symbols.map((symbol) => [symbol.id, symbol.moduleId]));
|
|
445
|
+
const adjacency = new Map();
|
|
446
|
+
const reasonMap = new Map();
|
|
447
|
+
const addEdge = (fromId, toId, reason) => {
|
|
448
|
+
if (!adjacency.has(fromId)) {
|
|
449
|
+
adjacency.set(fromId, new Set());
|
|
450
|
+
}
|
|
451
|
+
adjacency.get(fromId)?.add(toId);
|
|
452
|
+
if (!reasonMap.has(`${fromId}->${toId}`)) {
|
|
453
|
+
reasonMap.set(`${fromId}->${toId}`, reason);
|
|
454
|
+
}
|
|
455
|
+
};
|
|
456
|
+
for (const dependency of graph.dependencies) {
|
|
457
|
+
const sourceModuleId = dependency.sourceEntityType === 'symbol'
|
|
458
|
+
? symbolToModuleId.get(dependency.sourceId)
|
|
459
|
+
: dependency.sourceId;
|
|
460
|
+
const targetModuleId = dependency.targetEntityType === 'symbol'
|
|
461
|
+
? symbolToModuleId.get(dependency.targetId)
|
|
462
|
+
: dependency.targetId;
|
|
463
|
+
if (!sourceModuleId || !targetModuleId || sourceModuleId === targetModuleId) {
|
|
464
|
+
continue;
|
|
465
|
+
}
|
|
466
|
+
const conservativeSuffix = isConservativeConfidence(dependency.confidence)
|
|
467
|
+
? '(保守扩张)'
|
|
468
|
+
: '';
|
|
469
|
+
const reason = `${dependency.type} ${sourceModuleId} -> ${targetModuleId}${conservativeSuffix}`;
|
|
470
|
+
addEdge(sourceModuleId, targetModuleId, reason);
|
|
471
|
+
addEdge(targetModuleId, sourceModuleId, reason);
|
|
472
|
+
}
|
|
473
|
+
const queue = [];
|
|
474
|
+
const visited = new Set();
|
|
475
|
+
const reasons = [];
|
|
476
|
+
for (const changedPath of normalizedChangedPaths) {
|
|
477
|
+
const changedModuleId = moduleIdByPath.get(changedPath);
|
|
478
|
+
if (!changedModuleId) {
|
|
479
|
+
continue;
|
|
480
|
+
}
|
|
481
|
+
queue.push({ moduleId: changedModuleId, depth: 0 });
|
|
482
|
+
reasons.push({
|
|
483
|
+
path: changedPath,
|
|
484
|
+
reason: 'changed file seed',
|
|
485
|
+
});
|
|
486
|
+
}
|
|
487
|
+
while (queue.length > 0) {
|
|
488
|
+
const current = queue.shift();
|
|
489
|
+
if (!current || visited.has(current.moduleId) || current.depth > 2) {
|
|
490
|
+
continue;
|
|
491
|
+
}
|
|
492
|
+
visited.add(current.moduleId);
|
|
493
|
+
const neighbors = adjacency.get(current.moduleId) ?? new Set();
|
|
494
|
+
for (const neighborId of neighbors) {
|
|
495
|
+
if (visited.has(neighborId)) {
|
|
496
|
+
continue;
|
|
497
|
+
}
|
|
498
|
+
const neighbor = moduleById.get(neighborId);
|
|
499
|
+
if (!neighbor) {
|
|
500
|
+
continue;
|
|
501
|
+
}
|
|
502
|
+
reasons.push({
|
|
503
|
+
path: normalizePath(neighbor.path),
|
|
504
|
+
reason: `2-hop invalidation: ${reasonMap.get(`${current.moduleId}->${neighborId}`) ?? 'dependency edge'}`,
|
|
505
|
+
});
|
|
506
|
+
queue.push({ moduleId: neighborId, depth: current.depth + 1 });
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
const invalidatedModuleIds = Array.from(visited);
|
|
510
|
+
const invalidatedModulePaths = invalidatedModuleIds
|
|
511
|
+
.map((moduleId) => moduleById.get(moduleId)?.path)
|
|
512
|
+
.filter((value) => Boolean(value))
|
|
513
|
+
.map(normalizePath);
|
|
514
|
+
return {
|
|
515
|
+
invalidatedModuleIds,
|
|
516
|
+
invalidatedModulePaths,
|
|
517
|
+
reasons,
|
|
518
|
+
};
|
|
519
|
+
}
|
|
73
520
|
export function findCallersInGraph(graph, functionId) {
|
|
74
521
|
const callerIds = new Set();
|
|
75
522
|
for (const dependency of graph.dependencies) {
|
|
@@ -92,12 +539,18 @@ export function findCalleesInGraph(graph, functionId) {
|
|
|
92
539
|
.filter(symbol => calleeIds.has(symbol.id))
|
|
93
540
|
.map(symbol => ({ ...symbol }));
|
|
94
541
|
}
|
|
95
|
-
export function findDependenciesInGraph(graph, moduleId) {
|
|
542
|
+
export function findDependenciesInGraph(graph, moduleId, index) {
|
|
543
|
+
if (index) {
|
|
544
|
+
return cloneDependencyList(index.dependenciesBySourceId.get(moduleId) ?? []);
|
|
545
|
+
}
|
|
96
546
|
return graph.dependencies
|
|
97
547
|
.filter(dependency => dependency.sourceId === moduleId)
|
|
98
548
|
.map(dependency => ({ ...dependency }));
|
|
99
549
|
}
|
|
100
|
-
export function findDependentsInGraph(graph, moduleId) {
|
|
550
|
+
export function findDependentsInGraph(graph, moduleId, index) {
|
|
551
|
+
if (index) {
|
|
552
|
+
return cloneDependencyList(index.dependenciesByTargetId.get(moduleId) ?? []);
|
|
553
|
+
}
|
|
101
554
|
return graph.dependencies
|
|
102
555
|
.filter(dependency => dependency.targetId === moduleId)
|
|
103
556
|
.map(dependency => ({ ...dependency }));
|
|
@@ -135,107 +588,59 @@ export function detectCyclesInGraph(graph) {
|
|
|
135
588
|
}
|
|
136
589
|
return cycles;
|
|
137
590
|
}
|
|
138
|
-
export function calculateImpactInGraph(graph, moduleId, depth) {
|
|
139
|
-
const
|
|
140
|
-
|
|
141
|
-
const
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
}
|
|
151
|
-
visited.add(id);
|
|
152
|
-
if (level > 0) {
|
|
153
|
-
const module = graph.modules.find(candidate => candidate.id === id);
|
|
154
|
-
if (module) {
|
|
155
|
-
affectedModules.push({ ...module });
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
for (const dependency of graph.dependencies) {
|
|
159
|
-
if (dependency.targetId === id && !visited.has(dependency.sourceId)) {
|
|
160
|
-
queue.push({ id: dependency.sourceId, level: level + 1 });
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
}
|
|
591
|
+
export function calculateImpactInGraph(graph, moduleId, depth, index) {
|
|
592
|
+
const module = index?.moduleById.get(moduleId)
|
|
593
|
+
?? graph.modules.find((candidate) => candidate.id === moduleId);
|
|
594
|
+
const shared = module
|
|
595
|
+
? analyzeImpactInGraph(graph, { kind: 'file', filePath: module.path, depth }, index)
|
|
596
|
+
: createEmptyImpactResult({ kind: 'file', filePath: moduleId, depth }, graph.graphStatus ?? 'complete', {
|
|
597
|
+
status: 'not_found',
|
|
598
|
+
confidence: 'unavailable',
|
|
599
|
+
error: {
|
|
600
|
+
code: 'FILE_NOT_FOUND',
|
|
601
|
+
message: `Module "${moduleId}" not found in the persisted graph.`,
|
|
602
|
+
},
|
|
603
|
+
});
|
|
164
604
|
return {
|
|
605
|
+
...shared,
|
|
165
606
|
rootModule: moduleId,
|
|
166
|
-
affectedModules,
|
|
607
|
+
affectedModules: [...shared.direct, ...shared.transitiveLayers.flatMap((layer) => layer.nodes)]
|
|
608
|
+
.map((node) => graph.modules.find((candidate) => candidate.id === node.id))
|
|
609
|
+
.filter((candidate) => Boolean(candidate))
|
|
610
|
+
.map((candidate) => ({ ...candidate })),
|
|
167
611
|
depth,
|
|
168
612
|
};
|
|
169
613
|
}
|
|
170
|
-
export function calculateSymbolImpactInGraph(graph, symbolId, depth, limit) {
|
|
171
|
-
const rootSymbol =
|
|
614
|
+
export function calculateSymbolImpactInGraph(graph, symbolId, depth, limit, index) {
|
|
615
|
+
const rootSymbol = index?.symbolById.get(symbolId)
|
|
616
|
+
?? graph.symbols.find(symbol => symbol.id === symbolId);
|
|
172
617
|
if (!rootSymbol) {
|
|
173
618
|
throw new Error(`Symbol ${symbolId} not found`);
|
|
174
619
|
}
|
|
175
|
-
const
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
}
|
|
187
|
-
const affectedSymbols = [];
|
|
188
|
-
const visited = new Set([symbolId]);
|
|
189
|
-
const queue = [{
|
|
190
|
-
id: symbolId,
|
|
191
|
-
level: 0,
|
|
192
|
-
path: [symbolId],
|
|
193
|
-
}];
|
|
194
|
-
let truncated = false;
|
|
195
|
-
while (queue.length > 0) {
|
|
196
|
-
const current = queue.shift();
|
|
197
|
-
if (!current) {
|
|
198
|
-
continue;
|
|
199
|
-
}
|
|
200
|
-
if (current.level >= depth) {
|
|
201
|
-
continue;
|
|
202
|
-
}
|
|
203
|
-
const callers = callerMap.get(current.id) ?? [];
|
|
204
|
-
for (const dependency of callers) {
|
|
205
|
-
if (affectedSymbols.length >= limit) {
|
|
206
|
-
truncated = true;
|
|
207
|
-
queue.length = 0;
|
|
208
|
-
break;
|
|
209
|
-
}
|
|
210
|
-
const callerId = dependency.sourceId;
|
|
211
|
-
if (visited.has(callerId)) {
|
|
212
|
-
continue;
|
|
213
|
-
}
|
|
214
|
-
const callerSymbol = symbolMap.get(callerId);
|
|
215
|
-
if (!callerSymbol) {
|
|
216
|
-
continue;
|
|
217
|
-
}
|
|
218
|
-
visited.add(callerId);
|
|
219
|
-
const nextPath = [...current.path, callerId];
|
|
220
|
-
const nextLevel = current.level + 1;
|
|
221
|
-
affectedSymbols.push({
|
|
222
|
-
symbol: { ...callerSymbol },
|
|
223
|
-
depth: nextLevel,
|
|
224
|
-
path: nextPath,
|
|
225
|
-
});
|
|
226
|
-
queue.push({
|
|
227
|
-
id: callerId,
|
|
228
|
-
level: nextLevel,
|
|
229
|
-
path: nextPath,
|
|
230
|
-
});
|
|
231
|
-
}
|
|
232
|
-
}
|
|
620
|
+
const shared = analyzeImpactInGraph(graph, {
|
|
621
|
+
kind: 'symbol',
|
|
622
|
+
symbol: rootSymbol.name,
|
|
623
|
+
filePath: rootSymbol.location.file,
|
|
624
|
+
depth,
|
|
625
|
+
limit,
|
|
626
|
+
}, index);
|
|
627
|
+
const flattenedNodes = [
|
|
628
|
+
...shared.direct,
|
|
629
|
+
...shared.transitiveLayers.flatMap((layer) => layer.nodes),
|
|
630
|
+
];
|
|
233
631
|
return {
|
|
632
|
+
...shared,
|
|
234
633
|
rootSymbol: { ...rootSymbol },
|
|
235
|
-
affectedSymbols
|
|
634
|
+
affectedSymbols: flattenedNodes
|
|
635
|
+
.map((node) => graph.symbols.find((candidate) => candidate.id === node.id))
|
|
636
|
+
.filter((candidate) => Boolean(candidate))
|
|
637
|
+
.map((candidate, index) => {
|
|
638
|
+
const flattenedNode = flattenedNodes[index];
|
|
639
|
+
return toSymbolImpactNode(candidate, flattenedNode.depth, flattenedNode.path);
|
|
640
|
+
}),
|
|
236
641
|
depth,
|
|
237
642
|
limit,
|
|
238
|
-
truncated,
|
|
643
|
+
truncated: shared.truncated,
|
|
239
644
|
};
|
|
240
645
|
}
|
|
241
646
|
export function getProjectStatisticsFromGraph(graph) {
|