@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
package/docs/backlog.md
CHANGED
|
@@ -1,177 +1,265 @@
|
|
|
1
|
+
# mycodemap Backlog
|
|
1
2
|
|
|
3
|
+
> **版本**: v3.0-convergence
|
|
4
|
+
> **更新日期**: 2026-05-05
|
|
5
|
+
> **适用范围**: v2.2-v2.6 架构收敛 + 图智能,基于 CODEMAP_GRAPH_ENHANCEMENT_ASSESSMENT.md 和 BACKLOG_mycodemap-redesign-20260505.md 的 grill-with-docs 决策
|
|
6
|
+
> **核心约束**: AI Agents First | 4 语言 (TS/JS/Python/Go) | SQLite 唯一存储 | MCP 直接执行
|
|
2
7
|
|
|
3
|
-
|
|
4
|
-
**从"代码地图工具"到"架构契约治理引擎"**
|
|
8
|
+
---
|
|
5
9
|
|
|
6
|
-
##
|
|
10
|
+
## 一、规划来源
|
|
7
11
|
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
|
12
|
-
|
|
|
13
|
-
| **竞争差异** | 生成 JSON 地图供AI消费 | **生成决策:通过/阻断,并给出架构违反证据** |
|
|
14
|
-
| **技术重心** | Tree-sitter 解析 + 图数据库 | **Tree-sitter + SQLite + 轻量内存图** |
|
|
12
|
+
| 来源文档 | 角色 | 状态 |
|
|
13
|
+
|----------|------|------|
|
|
14
|
+
| `CODEMAP_GRAPH_ENHANCEMENT_ASSESSMENT.md` | 调研论文:识别什么已有/什么缺/什么可借鉴 | 已消化 |
|
|
15
|
+
| `BACKLOG_mycodemap-redesign-20260505.md` | 实施蓝图:19 个任务 (P0-P3, 4 sub-milestone) | 已过滤/增强/重排 |
|
|
16
|
+
| `docs/backlog.md` (v2.0-sync) | 现有待办:Must Do / Should Do / Could Do | 已合并/对齐 |
|
|
15
17
|
|
|
16
18
|
---
|
|
17
19
|
|
|
18
|
-
##
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
-
|
|
23
|
-
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
// 新命令示例
|
|
28
|
-
mycodemap verify --contract design.md --against src/
|
|
29
|
-
// 输出: { "passed": false, "violations": [{ "rule": "auth禁止直接调用payment", "location": "auth/login.ts:45" }] }
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
### 2. **Git 历史融合分析(Code Archaeology)**
|
|
33
|
-
利用 SQLite 存储 git blame + 变更历史:
|
|
34
|
-
- **危险区域标记**:高频修改且伴随回滚的代码区域自动标记"高风险"
|
|
35
|
-
- **契约漂移检测**:对比当前代码与历史契约版本,发现架构腐化趋势
|
|
36
|
-
- **影响评估增强**:不仅告诉AI"这修改影响3个文件",还告诉"这3个文件在过去6个月被修改了17次,回滚率35%"
|
|
37
|
-
|
|
38
|
-
### 3. **轻量级混合存储架构**
|
|
39
|
-
**放弃重型图数据库**,采用 SQLite + 内存图计算:
|
|
40
|
-
|
|
41
|
-
```typescript
|
|
42
|
-
// 技术架构示意
|
|
43
|
-
StorageLayer {
|
|
44
|
-
// Layer 1: SQLite 负责持久化 + BM25全文搜索 + 契约元数据
|
|
45
|
-
sqlite: BetterSQLite3Wrapper;
|
|
46
|
-
|
|
47
|
-
// Layer 2: 内存图计算(替代 NetworkX,使用 graphlib 或自研邻接表)
|
|
48
|
-
graph: DirectedGraph; // 基于 Map/Set 的轻量实现
|
|
49
|
-
|
|
50
|
-
// 启动时从 SQLite 加载符号关系到内存图,<500ms
|
|
51
|
-
loadGraph(): void;
|
|
52
|
-
|
|
53
|
-
// 核心操作:基于图的可达性分析(契约验证的关键)
|
|
54
|
-
computeImpact(symbol: string, depth: number): ImpactGraph;
|
|
55
|
-
}
|
|
56
|
-
```
|
|
57
|
-
|
|
58
|
-
**为什么这个架构对 TypeScript 项目更优:**
|
|
59
|
-
- `better-sqlite3`:Node.js 最快的 SQLite 绑定,零配置,单文件存储
|
|
60
|
-
- 内存图计算:对于 <50K 文件的 TypeScript 项目,纯 JavaScript 图遍历(DFS/BFS)性能足够(<100ms),无需引入沉重的图数据库客户端
|
|
61
|
-
|
|
62
|
-
### 4. **CI/CD 原生集成(Quality Gate)**
|
|
63
|
-
专为流水线设计的"硬阻断"模式:
|
|
64
|
-
- **退出码策略**:发现契约违反时返回非零退出码,直接阻断 CI 流程
|
|
65
|
-
- **JSON 报告**:生成结构化报告供 GitHub/GitLab 的 Code Review 界面渲染
|
|
66
|
-
- **增量验证**:仅验证 git diff 涉及的符号,<2秒完成门禁检查
|
|
20
|
+
## 二、Milestone 总览
|
|
21
|
+
|
|
22
|
+
| Milestone | 核心主题 | 主要内容 | 预估人天 |
|
|
23
|
+
|---|---|---|---|
|
|
24
|
+
| **v2.2** architecture-foundation | 架构根基 + Agent 入口 | P0-1 + P0-2 + P0-3 + P1-5 | 30-40 |
|
|
25
|
+
| **v2.3** schema-redesign-graph-capability | Schema 重设计 + 核心图能力 | Schema 重写 + P2-2 + P1-1 + P1-2 + P1-3 | 30-40 |
|
|
26
|
+
| **v2.4** agent-graph-experience | Agent 图体验 | P1-4 + P2-1 + P2-4 | 20-25 |
|
|
27
|
+
| **v2.5** deep-analysis-hooks | 深度分析 + Hook | P2-3 + P2-5 + P3-4 | 15-18 |
|
|
28
|
+
| **v2.6** polish-and-stabilize | 打磨收尾 | P3-2 + P3-5 + P3-6 + IC 1.0.0 + SQLite 优化 | 10-15 |
|
|
67
29
|
|
|
68
30
|
---
|
|
69
31
|
|
|
70
|
-
##
|
|
32
|
+
## 三、v2.2 — 架构根基 + Agent 入口
|
|
33
|
+
|
|
34
|
+
### 3.1 P0-1 Parser 统一
|
|
35
|
+
|
|
36
|
+
- **删除 FastParser**:TreeSitterParser + WASM 完全替代,无需正则解析器
|
|
37
|
+
- **删除 Hybrid 模式**:Tree-sitter 对所有规模够快,无需 50 文件阈值切换
|
|
38
|
+
- **SmartParser 缩减为 ~300 行 TS 类型增强层**:只做 TS Compiler API 类型推断(泛型、类型别名、typeof),内部委托给 TreeSitterParser
|
|
39
|
+
- **TreeSitterParser 接入主流程**:修改 `createParser` 工厂 + `analyzer.ts` 使用 ParserRegistry
|
|
40
|
+
- **4 语言支持**:TS/JS/Python/Go 通过 ParserRegistry 自动生效
|
|
41
|
+
- **PythonTypeEnhancer**(非阻塞验收项):基于 docstring 的类型推断,~100-150 行
|
|
42
|
+
|
|
43
|
+
**验收标准**:
|
|
44
|
+
- `mycodemap generate` 默认使用 Tree-sitter 解析
|
|
45
|
+
- FastParser/Hybrid 不再被主流程调用
|
|
46
|
+
- SmartParser 代码量 < 300 行
|
|
47
|
+
- 4 语言解析可用(TS/JS/Python/Go)
|
|
48
|
+
- WASM 降级路径正常工作
|
|
49
|
+
|
|
50
|
+
**Breaking Changes**:`mode: 'fast'` / `mode: 'hybrid'` 配置失效 → 明确错误码 + 修复建议
|
|
51
|
+
|
|
52
|
+
### 3.2 P0-2 存储收敛
|
|
53
|
+
|
|
54
|
+
- **删除 KùzuDB 后端**:`UNSUPPORTED_STORAGE_TYPE`
|
|
55
|
+
- **删除 FileSystem 后端**:`UNSUPPORTED_STORAGE_TYPE`
|
|
56
|
+
- **`auto` 策略改为 sqlite 唯一默认**:不可用时硬着陆报错 + Failure-to-Action 引导(`--wasm-fallback` / 安装命令)
|
|
57
|
+
- **SQLite 三层降级**:`better-sqlite3` native → `sql.js` WASM → `node:sqlite`(可选检测)
|
|
58
|
+
- **ARCHITECTURE.md 修复**并入验收标准
|
|
59
|
+
|
|
60
|
+
**验收标准**:
|
|
61
|
+
- `StorageFactory.create('auto')` 返回 SQLiteStorage
|
|
62
|
+
- 传入 `filesystem`/`kuzudb` 抛出 `UNSUPPORTED_STORAGE_TYPE`
|
|
63
|
+
- 不可用时返回 `{error: {code: 'STORAGE_UNAVAILABLE', remediation: '...'}}`
|
|
64
|
+
|
|
65
|
+
**Breaking Changes**:`storage: 'filesystem'` / `storage: 'kuzudb'` 配置失效
|
|
71
66
|
|
|
72
|
-
###
|
|
73
|
-
- **不做**:与 code-review-graph 竞争的"49倍Token节省"宣传
|
|
74
|
-
- **原因**:这是 code-review-graph 的核心赛道,且需要极其优化的增量算法和向量索引,投入产出比低
|
|
75
|
-
- **替代**:专注"**精准上下文**"——不是给AI更少代码,而是给AI**符合架构约束**的代码上下文
|
|
67
|
+
### 3.3 P0-3 MCP 直接执行
|
|
76
68
|
|
|
77
|
-
|
|
78
|
-
-
|
|
79
|
-
-
|
|
80
|
-
|
|
81
|
-
- 与静态分析工具定位冲突(用户不会同时安装两类工具)
|
|
82
|
-
- 报告中提到的"运行时图谱"目前仍是学术阶段,无成熟开源方案
|
|
69
|
+
- **全部 20+ 命令拆分为 pure function + CLI wrapper + MCP adapter**
|
|
70
|
+
- **统一接口规范**:typed object input + `ServiceResult<T>` + 统一错误码
|
|
71
|
+
- **CLI 瘦身验收**:每个 CLI 命令文件 < 300 行
|
|
72
|
+
- **SSE transport** 作为子任务
|
|
83
73
|
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
74
|
+
**验收标准**:
|
|
75
|
+
- MCP tool 调用一次即返回结果,无需二次 CLI 执行
|
|
76
|
+
- `cli_redirect` 模式彻底消灭
|
|
77
|
+
- `src/cli/commands/` 下无超过 300 行的文件
|
|
87
78
|
|
|
88
|
-
### 4
|
|
89
|
-
|
|
90
|
-
-
|
|
91
|
-
-
|
|
79
|
+
### 3.4 P1-5 MCP 路由门
|
|
80
|
+
|
|
81
|
+
- **`codemap_context` MCP tool**:~100 tokens 路由门
|
|
82
|
+
- v2.2 先支持 3 个 task:`review` / `debug` / `default`
|
|
83
|
+
- `graphStats`:modules, symbols, edges(不含 communities,v2.3 后加入)
|
|
84
|
+
- `riskScore`:简化版(基于模块数、循环依赖数、高复杂度文件数)
|
|
85
|
+
- `nextToolSuggestions`:根据 task 推荐下一步 tool
|
|
86
|
+
- **detail_level 三级**:minimal(摘要+计数) / standard(完整) / full(含代码片段)
|
|
87
|
+
- **tool 过滤**:`--tools` CLI 参数 / `CODEMAP_TOOLS` 环境变量
|
|
88
|
+
|
|
89
|
+
**验收标准**:
|
|
90
|
+
- `codemap_context --task review` 返回 `nextToolSuggestions: ["impact", "surprising"]`
|
|
91
|
+
- `detail_level=minimal` 输出比 `standard` 压缩 40-60%
|
|
92
92
|
|
|
93
93
|
---
|
|
94
94
|
|
|
95
|
-
##
|
|
95
|
+
## 四、v2.3 — Schema 重设计 + 核心图能力
|
|
96
|
+
|
|
97
|
+
### 4.1 SQLite Schema 重写
|
|
98
|
+
|
|
99
|
+
- **从 governance-v3 迁移到图优化 schema**:
|
|
100
|
+
- `nodes` 表:integer id PK + `qualified_name TEXT UNIQUE`
|
|
101
|
+
- `edges` 表:`source_qn`/`target_qn`(无外键,允许解析中临时不一致)+ `confidence_tier TEXT DEFAULT 'EXTRACTED'`
|
|
102
|
+
- `file_hashes` 表:增量更新基础
|
|
103
|
+
- `communities` 表:社区检测结果
|
|
104
|
+
- `nodes_fts` FTS5 虚拟表:全文搜索
|
|
105
|
+
- 复合索引:`edges(source_qn, kind)` / `edges(target_qn, kind)` / `nodes(file_path)`
|
|
106
|
+
- **迁移脚本**:`mycodemap migrate --from v2.2 --to v2.3`
|
|
107
|
+
|
|
108
|
+
**Breaking Changes**:Schema 不兼容 → `mycodemap migrate` 脚本
|
|
109
|
+
|
|
110
|
+
### 4.2 P2-2 边置信度
|
|
111
|
+
|
|
112
|
+
- edges 表加 `confidence_tier` 字段
|
|
113
|
+
- 解析器输出时标记每条边:EXTRACTED(AST 直接提取) / INFERRED(名称匹配解析) / AMBIGUOUS(多候选/动态调用)
|
|
114
|
+
- **置信度分布目标**:EXTRACTED >60%, INFERRED <30%, AMBIGUOUS <10%, EXTRACTED precision >95%
|
|
115
|
+
|
|
116
|
+
### 4.3 P1-1 增量更新
|
|
117
|
+
|
|
118
|
+
- **git-diff 驱动** + 2-hop 依赖级联 + 500 文件上限
|
|
119
|
+
- **`--on-change` 参数**:检测变更 + 增量更新(v2.5 通用 Hook 替换)
|
|
120
|
+
- **SHA-256 哈希比对**(复用 file-hash-cache)
|
|
121
|
+
- **Worker Threads 并行解析**(<8 文件串行)
|
|
122
|
+
- **SQLite 原子写入**:`BEGIN IMMEDIATE` → `DELETE` → `INSERT` → `COMMIT`
|
|
123
|
+
- **不需要 `--no-git`**,不需要 Watch mode
|
|
96
124
|
|
|
97
|
-
|
|
98
|
-
- **移除**:KuzuDB 依赖(如果当前有)
|
|
99
|
-
- **引入**:better-sqlite3 + 内存图结构(基于 Map 的邻接表)
|
|
100
|
-
- **基准**:10K 文件项目启动时间 <1s,内存占用 <200MB
|
|
125
|
+
**性能目标**:叶子节点 <1.5s,核心文件 <5s
|
|
101
126
|
|
|
102
|
-
###
|
|
103
|
-
- **设计契约 Schema 标准化**:`design.md` → JSON Schema 验证
|
|
104
|
-
- **护栏规则引擎**:支持复杂度、依赖方向、模块边界三类规则
|
|
105
|
-
- **Git 融合**:SQLite 存储 git blame 信息,支持 `mycodemap history --symbol X` 查询变更轨迹
|
|
127
|
+
### 4.4 P1-2 影响分析 CTE
|
|
106
128
|
|
|
107
|
-
|
|
108
|
-
-
|
|
109
|
-
-
|
|
110
|
-
-
|
|
129
|
+
- **SQLite Recursive CTE BFS** 替代内存图遍历
|
|
130
|
+
- **分层摘要 + detail_level 三级**:
|
|
131
|
+
- minimal:summary(total_nodes, max_depth, by_confidence)~50 tokens
|
|
132
|
+
- standard:summary + 前 3 层节点 ~200 tokens
|
|
133
|
+
- full:完整分层结果
|
|
134
|
+
- **`_impact_seeds` 临时表**避免 SQL 变量过多
|
|
135
|
+
- **内存图 BFS 保留为 fallback**
|
|
136
|
+
|
|
137
|
+
**性能目标**:1K 节点 <50ms,10K <200ms
|
|
138
|
+
|
|
139
|
+
### 4.5 P1-3 社区检测
|
|
140
|
+
|
|
141
|
+
- **ngraph + 自研 Louvain**(Research 阶段对比 CRG igraph / graphify graspologic / louvain npm)
|
|
142
|
+
- **边权重映射**:CALLS=1.0, IMPORTS_FROM=0.7, INHERITS=0.8, IMPLEMENTS=0.7, DEPENDS_ON=0.6, TESTED_BY=0.4, CONTAINS=0.3
|
|
143
|
+
- **超大社区拆分**:>25% 图节点时二次 Leiden
|
|
144
|
+
- **自动命名**:路径前缀优先(>60% 覆盖率)→ 前缀::主导类名 → community_N 兜底
|
|
145
|
+
- 后续可通过白名单/配置表覆盖,v2.3 不做编辑功能
|
|
146
|
+
- **凝聚力评分**:社区内实际边数 / 最大可能边数
|
|
111
147
|
|
|
112
148
|
---
|
|
113
149
|
|
|
114
|
-
##
|
|
115
|
-
|
|
116
|
-
###
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
**痛点**:不知道当前代码与最初架构设计偏离了多远
|
|
139
|
-
**使用**:
|
|
140
|
-
```bash
|
|
141
|
-
mycodemap drift --since 2024-01-01 --contract original-design.md
|
|
142
|
-
```
|
|
143
|
-
**价值**:量化"架构腐化度",为重构决策提供数据支撑(如"当前 23% 的调用违反了原始模块边界")
|
|
144
|
-
|
|
145
|
-
### 场景 D:高风险修改预警
|
|
146
|
-
**角色**:DevOps/运维
|
|
147
|
-
**痛点**:某些代码区域变更极易引发故障
|
|
148
|
-
**使用**:
|
|
149
|
-
```bash
|
|
150
|
-
mycodemap analyze -i modify -t "payment/" --include-history --json
|
|
151
|
-
# 输出标记:该区域过去 12 个月修改 47 次,回滚 12 次,事故 3 次
|
|
152
|
-
```
|
|
153
|
-
**价值**:在变更发布前识别"代码墓地"区域,强制增加 review 层级
|
|
150
|
+
## 五、v2.4 — Agent 图体验
|
|
151
|
+
|
|
152
|
+
### 5.1 P1-4 Surprise 评分
|
|
153
|
+
|
|
154
|
+
- **报告模式**:输出但不建议行动
|
|
155
|
+
- **通过 `codemap_context` 路由门间接引导**(task=review 时推荐 surprising)
|
|
156
|
+
- **多因子评分**:confidence_tier, 跨目录(+2), 跨社区(+1), Peripheral→Hub(+1), 历史回归(+2)
|
|
157
|
+
- 阈值默认 8 分,可配置
|
|
158
|
+
|
|
159
|
+
### 5.2 P2-1 执行流追踪
|
|
160
|
+
|
|
161
|
+
- **两阶段交互**:
|
|
162
|
+
- `mycodemap flows --summary`:返回入口点列表 + 置信度
|
|
163
|
+
- `mycodemap flows --trace <entry>`:返回调用链
|
|
164
|
+
- **三层入口点检测**:True root / 框架装饰器 / 传统命名
|
|
165
|
+
- **Criticality 评分**:深度 × 节点数 × 安全关键词 × 跨社区惩罚
|
|
166
|
+
- 输出带 confidence 标记,Agent 可决定信任哪些
|
|
167
|
+
|
|
168
|
+
### 5.3 P2-4 裸名解析
|
|
169
|
+
|
|
170
|
+
- 收集裸名 CALLS 边(target 不含 `::`)
|
|
171
|
+
- 单候选 → EXTRACTED,多候选 → INFERRED,零候选 → AMBIGUOUS
|
|
172
|
+
- 多候选时通过 IMPORTS_FROM 边判断源文件是否导入目标文件
|
|
173
|
+
- **置信度分布目标**替代精度百分比
|
|
154
174
|
|
|
155
175
|
---
|
|
156
176
|
|
|
157
|
-
##
|
|
177
|
+
## 六、v2.5 — 深度分析 + Hook
|
|
158
178
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
179
|
+
### 6.1 P2-3 Hub/Bridge 检测
|
|
180
|
+
|
|
181
|
+
- **Hub**:degree centrality + hub_tier (critical/major/minor) + God Node 排除
|
|
182
|
+
- **Bridge**:跨社区边数近似(不实时计算 betweenness,离线可选)
|
|
183
|
+
- 结果持久化到 SQLite `hub_bridge_scores` 表
|
|
184
|
+
|
|
185
|
+
### 6.2 P2-5 Hook 机制
|
|
186
|
+
|
|
187
|
+
- **首次提醒 + 后续静默**:同一会话只在第一次 Glob/Grep 时提醒
|
|
188
|
+
- **基于 Phase 58 env-contract 检索指引**:Hook 内容指向 `mycodemap env-contract` 接口
|
|
189
|
+
- **⚠️ 实施前必须 double-confirm Phase 58 兼容性**
|
|
190
|
+
- v2.3 的 `--on-change` 硬编码参数替换为通用 Hook 框架
|
|
191
|
+
|
|
192
|
+
### 6.3 P3-4 节点去重
|
|
193
|
+
|
|
194
|
+
- Layer 1(文件内):AST extractor 维护 `seen_ids` set
|
|
195
|
+
- Layer 2(跨文件):后写入覆盖策略
|
|
196
|
+
- Layer 3(缓存):显式 `seen` set 处理缓存命中
|
|
197
|
+
- 处理 TypeScript `export { x } from './y'` 重导出场景
|
|
166
198
|
|
|
167
199
|
---
|
|
168
200
|
|
|
169
|
-
##
|
|
201
|
+
## 七、v2.6 — 打磨收尾
|
|
170
202
|
|
|
171
|
-
|
|
203
|
+
| 项 | 内容 |
|
|
204
|
+
|---|---|
|
|
205
|
+
| P3-2 复杂度计算统一 | `ast-complexity-analyzer.ts` 为唯一源,SmartParser 调用其 API |
|
|
206
|
+
| P3-5 MCP 空白行过滤 | stdio transport 层过滤空白行输入 |
|
|
207
|
+
| P3-6 边 ID 归一化 | `[^a-zA-Z0-9]+` → `_` + 转小写 |
|
|
208
|
+
| Interface Contract 1.0.0 | 所有命令补全 outputShape/errorCodes/examples,`stable: true` |
|
|
209
|
+
| SQLite+In-Memory 优化 | LRU 查询缓存,内存邻接表加速多跳查询 |
|
|
172
210
|
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
211
|
+
---
|
|
212
|
+
|
|
213
|
+
## 八、已排除项(不在 v2.2-v2.6 范围)
|
|
214
|
+
|
|
215
|
+
| 项 | 排除原因 |
|
|
216
|
+
|---|---|
|
|
217
|
+
| FastParser / Hybrid 模式 | TreeSitterParser + WASM 完全替代 |
|
|
218
|
+
| FileSystem 后端 | SQLite 唯一主线,WASM 降级兜底 |
|
|
219
|
+
| KùzuDB 后端 | 与 SQLite 路线冲突 |
|
|
220
|
+
| Auto Storage Heuristic | SQLite 对所有规模够快,无需启发式切换 |
|
|
221
|
+
| Watch mode | 非 Agent First,推出范围 |
|
|
222
|
+
| `--no-git` 模式 | 随 Watch mode 一起排除 |
|
|
223
|
+
| viz 命令 | 不需要可视化 |
|
|
224
|
+
| 插件系统 | 推到 v3.0+ milestone |
|
|
225
|
+
| Parser 扩展 Rust/Java/C++ | 只支持 TS/JS/Python/Go |
|
|
226
|
+
| 14+ 语言 parser | 与 4 语言约束冲突 |
|
|
227
|
+
| LLM 语义提取 | 与纯静态分析定位冲突 |
|
|
228
|
+
| Embedding / 向量检索 | 与本地优先策略冲突 |
|
|
229
|
+
| 交互可视化 | Mermaid 已满足需求 |
|
|
230
|
+
| Betweenness centrality 实时计算 | O(n×m) 太慢,用跨社区边数近似 |
|
|
231
|
+
|
|
232
|
+
---
|
|
176
233
|
|
|
177
|
-
|
|
234
|
+
## 九、关键设计决策记录
|
|
235
|
+
|
|
236
|
+
| # | 决策 | 理由 | 日期 |
|
|
237
|
+
|---|------|------|------|
|
|
238
|
+
| D-01 | v2.1 保持原样 close,新规划从 v2.2 开始 | 避免 scope 膨胀 | 2026-05-05 |
|
|
239
|
+
| D-02 | SSE transport 合并到 P0-3 | 不依赖 cli_redirect 消灭,但同属 MCP 正式化 | 2026-05-05 |
|
|
240
|
+
| D-03 | Interface Contract 1.0.0 降到 v2.6 | 纯打磨项,不阻塞核心能力 | 2026-05-05 |
|
|
241
|
+
| D-04 | ARCHITECTURE.md 修复并入 P0-2 验收 | P0-2 删存储后端后架构文档必须同步 | 2026-05-05 |
|
|
242
|
+
| D-05 | 删 FileSystem + 硬着陆(不可用报错+引导) | WASM 降级覆盖绝大多数环境 | 2026-05-05 |
|
|
243
|
+
| D-06 | SmartParser 保留为独立 parser(~300 行) | TS Compiler API 类型推断仍有价值 | 2026-05-05 |
|
|
244
|
+
| D-07 | 删除 FastParser | TreeSitterParser + WASM 完全替代 | 2026-05-05 |
|
|
245
|
+
| D-08 | 全部 20+ 命令拆分 pure function | 避免新旧模式并存的混乱期 | 2026-05-05 |
|
|
246
|
+
| D-09 | Schema 一次性重写 + 单独 milestone 做重设计 | 避免在旧 schema 上写查询再重写 | 2026-05-05 |
|
|
247
|
+
| D-10 | Schema 保留 integer id + UNIQUE qn 索引 | B-tree 性能优势 + qn 查询效率 | 2026-05-05 |
|
|
248
|
+
| D-11 | P1-5 路由门前移到 v2.2 | Agent 体验的基石,越早做越好 | 2026-05-05 |
|
|
249
|
+
| D-12 | IMPORTS_FROM 权重提升到 0.7 | import 是影响传播第一跳,比 call 更静态确定 | 2026-05-05 |
|
|
250
|
+
| D-13 | 增量更新只做 CLI + Hook,不做 Watch | Agent First,Watch 服务人类 | 2026-05-05 |
|
|
251
|
+
| D-14 | `--on-change` 保持简单(只做增量更新) | Agent 可自己串联命令 | 2026-05-05 |
|
|
252
|
+
| D-15 | 影响 CTE 分层摘要 + detail_level 三级 | Agent token 预算有限 | 2026-05-05 |
|
|
253
|
+
| D-16 | 执行流两阶段交互(summary → trace) | Agent 有选择权,不被不完整数据淹没 | 2026-05-05 |
|
|
254
|
+
| D-17 | Surprise 报告模式 + 路由门间接引导 | 置信度不够,需人类确认 | 2026-05-05 |
|
|
255
|
+
| D-18 | Hub/Bridge 用 degree + 跨社区边数近似 | betweenness O(n×m) 太慢 | 2026-05-05 |
|
|
256
|
+
| D-19 | Hook 首次提醒+后续静默,基于 Phase 58 检索指引 | 平衡提醒与干扰 | 2026-05-05 |
|
|
257
|
+
| D-20 | 边置信度提前到 v2.3 | schema 重写时一并加字段,避免后续回填 | 2026-05-05 |
|
|
258
|
+
| D-21 | 置信度分布目标替代精度百分比 | Agent 根据 confidence_tier 自行判断信任度 | 2026-05-05 |
|
|
259
|
+
| D-22 | 社区自动命名(路径前缀优先),后续可加白名单/配置表 | v2.3 不做编辑,保持简单 | 2026-05-05 |
|
|
260
|
+
| D-23 | 每个 milestone 自行处理 breaking change | 诚实报错 + migrate 脚本 | 2026-05-05 |
|
|
261
|
+
| D-24 | PythonTypeEnhancer 纳入 v2.2 非阻塞 | ~150 行,docstring 类型推断有增量价值 | 2026-05-05 |
|
|
262
|
+
| D-25 | 插件系统移出 v2.2-v2.6 | 用户数极少,Agent 端价值有限 | 2026-05-05 |
|
|
263
|
+
| D-26 | P2-5 依赖 Phase 58 env-contract 接口,实施前 double-confirm | Phase 58 未通过验收,需确认兼容性 | 2026-05-05 |
|
|
264
|
+
| D-27 | `codemap_context` 渐进式:v2.2 简化版(3 task,无 communities),v2.3+ 扩展 | 与后端能力同步 | 2026-05-05 |
|
|
265
|
+
| D-28 | Pure function 统一接口:typed object input + ServiceResult<T> + 统一错误码 | MCP adapter 统一消费 | 2026-05-05 |
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
---
|
|
2
|
+
date: 2026-05-10
|
|
3
|
+
topic: agent-effectiveness-validation
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# CodeMap Agent 效果验证基础设施
|
|
7
|
+
|
|
8
|
+
## Summary
|
|
9
|
+
|
|
10
|
+
新建 `codemap agent-metrics` 命令,提供 token 成本分析维度的 agent 有效性指标。MVP 为 CLI 离线报告,后续演进到 MCP gateway 持续采集 + CI 门禁 + agent 行为分类。目标是消除"CodeMap 对 agent 划不划算"这个当前完全盲区。
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Problem Frame
|
|
15
|
+
|
|
16
|
+
CodeMap 声称将 agent 调用从 6+ 次降到 1 次,但从未算过 token 总账——一次 CodeMap 调用返回大量 JSON 可能消耗数千 tokens,而等价的文本搜索调用可能只需数百 tokens。调用次数下降不等于成本下降。
|
|
17
|
+
|
|
18
|
+
更根本的问题是:我们完全不知道 agent 用完 CodeMap 后做了什么。是直接继续工作(结果有用),还是掉头去用 rg/grep(结果没用)?没有任何信号能回答这个问题。parser 改动、输出格式变化都可能悄悄让 agent 变得不爱用 CodeMap,而我们发现不了。
|
|
19
|
+
|
|
20
|
+
现有的 benchmark 命令只做 WASM vs Native 启动性能对比,不覆盖 token 或行为维度。dogfood report 是一次性手动评估,无法检测回归。
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Actors
|
|
25
|
+
|
|
26
|
+
- A1. **CodeMap 开发者**:日常查看 agent-metrics 报告,据此决定优化方向(哪些查询类型 token 成本过高)
|
|
27
|
+
- A2. **CI pipeline**:自动运行 agent-metrics,当 token 成本超阈值时发出警告或阻断 merge
|
|
28
|
+
- A3. **AI agent**:CodeMap 的消费者,agent 的调用模式是指标的原始数据来源
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Requirements
|
|
33
|
+
|
|
34
|
+
**Token 成本分析**
|
|
35
|
+
|
|
36
|
+
- R1. 命令能对一组代表性 CodeMap 查询(find callers、impact analysis、dependency trace 等)执行 token 成本分析
|
|
37
|
+
- R2. 每个查询报告响应的 JSON 大小、估算 token 数(input + output),以及按查询类型的基线统计
|
|
38
|
+
- R3. 按查询类型追踪绝对 token 成本趋势(不与 rg/grep 对比,因为两者信息密度不同,直接对比无意义)
|
|
39
|
+
- R4. 识别 token 成本最高的查询类型,标注哪些场景的 token 消耗可能抵消调用次数减少的收益
|
|
40
|
+
|
|
41
|
+
**报告与输出**
|
|
42
|
+
|
|
43
|
+
- R8. 提供人类可读的格式化报告(表格 + 摘要)
|
|
44
|
+
- R9. 提供 JSON 输出模式(`--json`),支持 CI 管道消费
|
|
45
|
+
- R10. 报告包含按查询类型分组的汇总统计(平均 token 数、响应大小分布)
|
|
46
|
+
|
|
47
|
+
**CI 集成**
|
|
48
|
+
|
|
49
|
+
- R11. 支持阈值参数(`--max-tokens-per-query`),当单次查询 token 成本超过指定上限时返回非零退出码
|
|
50
|
+
- R12. CI 模式下输出简洁的 pass/fail 摘要,附带关键指标
|
|
51
|
+
|
|
52
|
+
**命令结构**
|
|
53
|
+
|
|
54
|
+
- R13. 命令入口为 `codemap agent-metrics`,子命令为 `token`(token 成本分析)和 `report`(聚合报告,支持 `--json` 和阈值参数)
|
|
55
|
+
- R14. 无参数运行时等价于 `codemap agent-metrics report`,执行完整 token 分析并输出报告
|
|
56
|
+
|
|
57
|
+
---
|
|
58
|
+
|
|
59
|
+
## Acceptance Examples
|
|
60
|
+
|
|
61
|
+
- AE1. **Covers R1, R2, R3.** Given a TypeScript project with 100+ files, when running `codemap agent-metrics token`, then the output shows per-query-type token estimates and cost trends.
|
|
62
|
+
- AE2. **Covers R11, R12.** Given `codemap agent-metrics report --max-tokens-per-query 5000`, when a query type averages 7000 tokens, then exit code is non-zero and output shows which query types exceeded the threshold.
|
|
63
|
+
- AE4. **Covers R8, R9.** When running `codemap agent-metrics report --json`, then the output is valid JSON containing all metrics. When running without `--json`, then the output is a human-readable formatted table.
|
|
64
|
+
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## Success Criteria
|
|
68
|
+
|
|
69
|
+
- 开发者能在一个命令中看到 CodeMap 的 token 经济账,不再依赖感觉判断工具成本效益
|
|
70
|
+
- CI pipeline 能自动检测 token 成本回归(如 parser 改动导致输出膨胀)
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Scope Boundaries
|
|
75
|
+
|
|
76
|
+
- 不做 A/B harness(CodeMap-enabled vs text-search-only 对比)——太重,需要定义 ground truth,后续可作为独立功能
|
|
77
|
+
- 不做 Zero-Touch Git History 自动测试用例生成——好方向但实现成本高,后续可作为 `agent-metrics` 的数据源。注意:从 git history 提取查询场景(Key Decisions)是该方向的轻量子集——只提取场景描述(commit message pattern → query type 映射),不自动生成测试用例或 ground truth 验证
|
|
78
|
+
- 不做 Adoption Decay 持续监控——需要 gateway 持续采集,CLI-only 模式做不了
|
|
79
|
+
- 不做 Precision-Weighted Cost Model——需要真实 agent session 数据校准,当前阶段缺乏数据
|
|
80
|
+
- 不做 Agent-Perceived Latency 重定义——相关但独立,可以后续扩展
|
|
81
|
+
- 不做 MCP gateway 持续采集——v2 范围,本次只做 CLI 离线报告
|
|
82
|
+
- 不做 Agent 行为分类(accepted/re-queried/abandoned)——需要 MCP gateway 实时数据,CLI-only 模式无法实现,推迟到 v2
|
|
83
|
+
|
|
84
|
+
---
|
|
85
|
+
|
|
86
|
+
## Key Decisions
|
|
87
|
+
|
|
88
|
+
- **新建命令而非扩展 benchmark**:benchmark 聚焦 parser/storage 性能,agent-metrics 聚焦 agent 有效性,职责不同。分开避免 benchmark 命令膨胀。
|
|
89
|
+
- **token 估算用近似值**:JSON 大小 → token 数的启发式转换(约 4 chars/token),不要求精确到个位 token。精确计算需要实际 tokenizer 集成,成本不值得。校准 deferred to planning。
|
|
90
|
+
- **查询场景从 git history 提取**:不手动定义场景,而是从项目 git history 中自动提取真实的 impact analysis / refactoring / dependency tracing 场景。与 Zero-Touch Git History (#2) 思路一致但范围更小——只提取场景描述,不自动生成测试用例。
|
|
91
|
+
- **阈值默认值 deferred to planning**:需要先跑一次 token report 看实际数据分布,再决定合理的默认阈值。
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Dependencies / Assumptions
|
|
96
|
+
|
|
97
|
+
- 现有 benchmark 命令和 MCP server 基础设施可复用(已验证:`src/cli/commands/benchmark.ts`、`src/server/mcp/server.ts`)
|
|
98
|
+
- 行为分类逻辑目前不存在于代码库中,需要在 MCP gateway 阶段从头设计
|
|
99
|
+
- 项目 git history 包含可识别的 impact analysis / refactoring / dependency tracing 场景(需 planning 阶段确认提取策略和场景类型映射)
|
|
100
|
+
|
|
101
|
+
---
|
|
102
|
+
|
|
103
|
+
## Outstanding Questions
|
|
104
|
+
|
|
105
|
+
### Resolve Before Planning
|
|
106
|
+
|
|
107
|
+
(无。所有 blocking questions 已解决。)
|
|
108
|
+
|
|
109
|
+
### Deferred to Planning
|
|
110
|
+
|
|
111
|
+
- [Affects R2][Technical] token 估算的具体启发式公式——JSON 大小到 token 数的转换系数需要基于实际数据校准
|
|
112
|
+
- [Affects R11][Needs research] 默认阈值的合理范围——需要先跑一次 token report 看数据分布
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"hooks": {
|
|
3
|
+
"SubagentStart": [
|
|
4
|
+
{
|
|
5
|
+
"matcher": "Explore",
|
|
6
|
+
"hooks": [
|
|
7
|
+
{
|
|
8
|
+
"type": "command",
|
|
9
|
+
"command": "echo '{\"hookSpecificOutput\":{\"hookEventName\":\"SubagentStart\",\"additionalContext\":\"Before starting work, run: mycodemap env-contract --for explore --json\"}}'"
|
|
10
|
+
}
|
|
11
|
+
]
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
15
|
+
}
|