@mycodemap/mycodemap 2.0.0 → 2.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +20 -0
- package/README.md +59 -184
- package/dist/cli/commands/agent-metrics/human.d.ts +4 -0
- package/dist/cli/commands/agent-metrics/human.d.ts.map +1 -0
- package/dist/cli/commands/agent-metrics/human.js +134 -0
- package/dist/cli/commands/agent-metrics/human.js.map +1 -0
- package/dist/cli/commands/agent-metrics/index.d.ts +15 -0
- package/dist/cli/commands/agent-metrics/index.d.ts.map +1 -0
- package/dist/cli/commands/agent-metrics/index.js +116 -0
- package/dist/cli/commands/agent-metrics/index.js.map +1 -0
- package/dist/cli/commands/analyze.d.ts +3 -196
- package/dist/cli/commands/analyze.d.ts.map +1 -1
- package/dist/cli/commands/analyze.js +9 -1163
- package/dist/cli/commands/analyze.js.map +1 -1
- package/dist/cli/commands/benchmark.d.ts.map +1 -1
- package/dist/cli/commands/benchmark.js +5 -2
- package/dist/cli/commands/benchmark.js.map +1 -1
- package/dist/cli/commands/complexity.d.ts.map +1 -1
- package/dist/cli/commands/complexity.js +62 -95
- package/dist/cli/commands/complexity.js.map +1 -1
- package/dist/cli/commands/deps.d.ts +3 -60
- package/dist/cli/commands/deps.d.ts.map +1 -1
- package/dist/cli/commands/deps.js +16 -351
- package/dist/cli/commands/deps.js.map +1 -1
- package/dist/cli/commands/env-contract.d.ts +3 -0
- package/dist/cli/commands/env-contract.d.ts.map +1 -0
- package/dist/cli/commands/env-contract.js +221 -0
- package/dist/cli/commands/env-contract.js.map +1 -0
- package/dist/cli/commands/generate.d.ts +19 -1
- package/dist/cli/commands/generate.d.ts.map +1 -1
- package/dist/cli/commands/generate.js +735 -89
- package/dist/cli/commands/generate.js.map +1 -1
- package/dist/cli/commands/impact.d.ts +4 -38
- package/dist/cli/commands/impact.d.ts.map +1 -1
- package/dist/cli/commands/impact.js +133 -375
- package/dist/cli/commands/impact.js.map +1 -1
- package/dist/cli/commands/init.d.ts +1 -0
- package/dist/cli/commands/init.d.ts.map +1 -1
- package/dist/cli/commands/init.js +61 -2
- package/dist/cli/commands/init.js.map +1 -1
- package/dist/cli/commands/preview.d.ts +3 -0
- package/dist/cli/commands/preview.d.ts.map +1 -0
- package/dist/cli/commands/preview.js +216 -0
- package/dist/cli/commands/preview.js.map +1 -0
- package/dist/cli/commands/query.d.ts +2 -21
- package/dist/cli/commands/query.d.ts.map +1 -1
- package/dist/cli/commands/query.js +15 -683
- package/dist/cli/commands/query.js.map +1 -1
- package/dist/cli/commands/watch-foreground.d.ts.map +1 -1
- package/dist/cli/commands/watch-foreground.js +5 -1
- package/dist/cli/commands/watch-foreground.js.map +1 -1
- package/dist/cli/config-loader.d.ts.map +1 -1
- package/dist/cli/config-loader.js +51 -13
- package/dist/cli/config-loader.js.map +1 -1
- package/dist/cli/doctor/check-env-contract.d.ts +3 -0
- package/dist/cli/doctor/check-env-contract.d.ts.map +1 -0
- package/dist/cli/doctor/check-env-contract.js +96 -0
- package/dist/cli/doctor/check-env-contract.js.map +1 -0
- package/dist/cli/doctor/check-native-deps.d.ts.map +1 -1
- package/dist/cli/doctor/check-native-deps.js +20 -4
- package/dist/cli/doctor/check-native-deps.js.map +1 -1
- package/dist/cli/doctor/orchestrator.d.ts.map +1 -1
- package/dist/cli/doctor/orchestrator.js +5 -2
- package/dist/cli/doctor/orchestrator.js.map +1 -1
- package/dist/cli/env-contract/check.d.ts +18 -0
- package/dist/cli/env-contract/check.d.ts.map +1 -0
- package/dist/cli/env-contract/check.js +118 -0
- package/dist/cli/env-contract/check.js.map +1 -0
- package/dist/cli/env-contract/discovery.d.ts +12 -0
- package/dist/cli/env-contract/discovery.d.ts.map +1 -0
- package/dist/cli/env-contract/discovery.js +249 -0
- package/dist/cli/env-contract/discovery.js.map +1 -0
- package/dist/cli/env-contract/filters.d.ts +10 -0
- package/dist/cli/env-contract/filters.d.ts.map +1 -0
- package/dist/cli/env-contract/filters.js +23 -0
- package/dist/cli/env-contract/filters.js.map +1 -0
- package/dist/cli/env-contract/index.d.ts +6 -0
- package/dist/cli/env-contract/index.d.ts.map +1 -0
- package/dist/cli/env-contract/index.js +8 -0
- package/dist/cli/env-contract/index.js.map +1 -0
- package/dist/cli/env-contract/reminder-engine.d.ts +34 -0
- package/dist/cli/env-contract/reminder-engine.d.ts.map +1 -0
- package/dist/cli/env-contract/reminder-engine.js +51 -0
- package/dist/cli/env-contract/reminder-engine.js.map +1 -0
- package/dist/cli/env-contract/reminder-hook-runner.d.ts +45 -0
- package/dist/cli/env-contract/reminder-hook-runner.d.ts.map +1 -0
- package/dist/cli/env-contract/reminder-hook-runner.js +273 -0
- package/dist/cli/env-contract/reminder-hook-runner.js.map +1 -0
- package/dist/cli/env-contract/reminder-ledger.d.ts +11 -0
- package/dist/cli/env-contract/reminder-ledger.d.ts.map +1 -0
- package/dist/cli/env-contract/reminder-ledger.js +37 -0
- package/dist/cli/env-contract/reminder-ledger.js.map +1 -0
- package/dist/cli/env-contract/types.d.ts +48 -0
- package/dist/cli/env-contract/types.d.ts.map +1 -0
- package/dist/cli/env-contract/types.js +22 -0
- package/dist/cli/env-contract/types.js.map +1 -0
- package/dist/cli/env-contract/validation.d.ts +10 -0
- package/dist/cli/env-contract/validation.d.ts.map +1 -0
- package/dist/cli/env-contract/validation.js +116 -0
- package/dist/cli/env-contract/validation.js.map +1 -0
- package/dist/cli/first-run-guide.d.ts.map +1 -1
- package/dist/cli/first-run-guide.js +8 -3
- package/dist/cli/first-run-guide.js.map +1 -1
- package/dist/cli/index.js +23 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/init/assistant-plan.d.ts +14 -0
- package/dist/cli/init/assistant-plan.d.ts.map +1 -0
- package/dist/cli/init/assistant-plan.js +208 -0
- package/dist/cli/init/assistant-plan.js.map +1 -0
- package/dist/cli/init/detect.d.ts +28 -0
- package/dist/cli/init/detect.d.ts.map +1 -0
- package/dist/cli/init/detect.js +63 -0
- package/dist/cli/init/detect.js.map +1 -0
- package/dist/cli/init/env-contract-plan.d.ts +28 -0
- package/dist/cli/init/env-contract-plan.d.ts.map +1 -0
- package/dist/cli/init/env-contract-plan.js +184 -0
- package/dist/cli/init/env-contract-plan.js.map +1 -0
- package/dist/cli/init/manifest-extractors.d.ts +22 -0
- package/dist/cli/init/manifest-extractors.d.ts.map +1 -0
- package/dist/cli/init/manifest-extractors.js +185 -0
- package/dist/cli/init/manifest-extractors.js.map +1 -0
- package/dist/cli/init/profile-loader.d.ts +49 -0
- package/dist/cli/init/profile-loader.d.ts.map +1 -0
- package/dist/cli/init/profile-loader.js +107 -0
- package/dist/cli/init/profile-loader.js.map +1 -0
- package/dist/cli/init/profile-plan.d.ts +38 -0
- package/dist/cli/init/profile-plan.d.ts.map +1 -0
- package/dist/cli/init/profile-plan.js +120 -0
- package/dist/cli/init/profile-plan.js.map +1 -0
- package/dist/cli/init/profiles/generic.json +16 -0
- package/dist/cli/init/profiles/go.json +12 -0
- package/dist/cli/init/profiles/nodejs.json +16 -0
- package/dist/cli/init/profiles/python.json +17 -0
- package/dist/cli/init/profiles/rust.json +12 -0
- package/dist/cli/init/receipt.d.ts.map +1 -1
- package/dist/cli/init/receipt.js +107 -7
- package/dist/cli/init/receipt.js.map +1 -1
- package/dist/cli/init/reconciler.d.ts +10 -1
- package/dist/cli/init/reconciler.d.ts.map +1 -1
- package/dist/cli/init/reconciler.js +85 -15
- package/dist/cli/init/reconciler.js.map +1 -1
- package/dist/cli/interface-contract/commands/agent-metrics.d.ts +3 -0
- package/dist/cli/interface-contract/commands/agent-metrics.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/agent-metrics.js +217 -0
- package/dist/cli/interface-contract/commands/agent-metrics.js.map +1 -0
- package/dist/cli/interface-contract/commands/analyze.d.ts.map +1 -1
- package/dist/cli/interface-contract/commands/analyze.js +1 -0
- package/dist/cli/interface-contract/commands/analyze.js.map +1 -1
- package/dist/cli/interface-contract/commands/benchmark.d.ts.map +1 -1
- package/dist/cli/interface-contract/commands/benchmark.js +1 -0
- package/dist/cli/interface-contract/commands/benchmark.js.map +1 -1
- package/dist/cli/interface-contract/commands/deps.d.ts.map +1 -1
- package/dist/cli/interface-contract/commands/deps.js +1 -0
- package/dist/cli/interface-contract/commands/deps.js.map +1 -1
- package/dist/cli/interface-contract/commands/doctor.d.ts.map +1 -1
- package/dist/cli/interface-contract/commands/doctor.js +1 -0
- package/dist/cli/interface-contract/commands/doctor.js.map +1 -1
- package/dist/cli/interface-contract/commands/env-contract.d.ts +3 -0
- package/dist/cli/interface-contract/commands/env-contract.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/env-contract.js +168 -0
- package/dist/cli/interface-contract/commands/env-contract.js.map +1 -0
- package/dist/cli/interface-contract/commands/index.d.ts +5 -2
- package/dist/cli/interface-contract/commands/index.d.ts.map +1 -1
- package/dist/cli/interface-contract/commands/index.js +7 -1
- package/dist/cli/interface-contract/commands/index.js.map +1 -1
- package/dist/cli/interface-contract/commands/init.d.ts.map +1 -1
- package/dist/cli/interface-contract/commands/init.js +9 -0
- package/dist/cli/interface-contract/commands/init.js.map +1 -1
- package/dist/cli/interface-contract/commands/preview.d.ts +3 -0
- package/dist/cli/interface-contract/commands/preview.d.ts.map +1 -0
- package/dist/cli/interface-contract/commands/preview.js +118 -0
- package/dist/cli/interface-contract/commands/preview.js.map +1 -0
- package/dist/cli/interface-contract/commands/query.d.ts.map +1 -1
- package/dist/cli/interface-contract/commands/query.js +1 -0
- package/dist/cli/interface-contract/commands/query.js.map +1 -1
- package/dist/cli/interface-contract/index.d.ts +1 -1
- package/dist/cli/interface-contract/index.d.ts.map +1 -1
- package/dist/cli/interface-contract/index.js +2 -2
- package/dist/cli/interface-contract/index.js.map +1 -1
- package/dist/cli/interface-contract/schema.d.ts.map +1 -1
- package/dist/cli/interface-contract/schema.js +1 -0
- package/dist/cli/interface-contract/schema.js.map +1 -1
- package/dist/cli/interface-contract/types.d.ts +1 -0
- package/dist/cli/interface-contract/types.d.ts.map +1 -1
- package/dist/cli/output/error-codes.d.ts +2 -0
- package/dist/cli/output/error-codes.d.ts.map +1 -1
- package/dist/cli/output/error-codes.js +12 -0
- package/dist/cli/output/error-codes.js.map +1 -1
- package/dist/cli/output/errors.d.ts.map +1 -1
- package/dist/cli/output/errors.js +12 -0
- package/dist/cli/output/errors.js.map +1 -1
- package/dist/cli/output/wasm-fallback.d.ts +1 -0
- package/dist/cli/output/wasm-fallback.d.ts.map +1 -1
- package/dist/cli/output/wasm-fallback.js.map +1 -1
- package/dist/cli/preview/complexity-scanner.d.ts +21 -0
- package/dist/cli/preview/complexity-scanner.d.ts.map +1 -0
- package/dist/cli/preview/complexity-scanner.js +52 -0
- package/dist/cli/preview/complexity-scanner.js.map +1 -0
- package/dist/cli/preview/dependency-extractor.d.ts +38 -0
- package/dist/cli/preview/dependency-extractor.d.ts.map +1 -0
- package/dist/cli/preview/dependency-extractor.js +140 -0
- package/dist/cli/preview/dependency-extractor.js.map +1 -0
- package/dist/cli/preview/preview-renderer.d.ts +32 -0
- package/dist/cli/preview/preview-renderer.d.ts.map +1 -0
- package/dist/cli/preview/preview-renderer.js +54 -0
- package/dist/cli/preview/preview-renderer.js.map +1 -0
- package/dist/cli/storage-runtime.d.ts +7 -0
- package/dist/cli/storage-runtime.d.ts.map +1 -1
- package/dist/cli/storage-runtime.js +22 -0
- package/dist/cli/storage-runtime.js.map +1 -1
- package/dist/cli-new/index.js +1 -1
- package/dist/cli-new/index.js.map +1 -1
- package/dist/composition/parser-composition.d.ts +7 -0
- package/dist/composition/parser-composition.d.ts.map +1 -0
- package/dist/composition/parser-composition.js +15 -0
- package/dist/composition/parser-composition.js.map +1 -0
- package/dist/core/analyzer.d.ts.map +1 -1
- package/dist/core/analyzer.js +83 -67
- package/dist/core/analyzer.js.map +1 -1
- package/dist/core/ast-complexity-analyzer.d.ts +12 -6
- package/dist/core/ast-complexity-analyzer.d.ts.map +1 -1
- package/dist/core/ast-complexity-analyzer.js +368 -209
- package/dist/core/ast-complexity-analyzer.js.map +1 -1
- package/dist/core/file-discovery.d.ts +1 -1
- package/dist/core/file-discovery.d.ts.map +1 -1
- package/dist/core/file-discovery.js +3 -0
- package/dist/core/file-discovery.js.map +1 -1
- package/dist/core/global-index.d.ts +3 -1
- package/dist/core/global-index.d.ts.map +1 -1
- package/dist/core/global-index.js +69 -4
- package/dist/core/global-index.js.map +1 -1
- package/dist/domain/entities/CodeGraph.d.ts +3 -0
- package/dist/domain/entities/CodeGraph.d.ts.map +1 -1
- package/dist/domain/entities/CodeGraph.js +19 -2
- package/dist/domain/entities/CodeGraph.js.map +1 -1
- package/dist/domain/entities/Dependency.d.ts +5 -2
- package/dist/domain/entities/Dependency.d.ts.map +1 -1
- package/dist/domain/entities/Dependency.js +49 -3
- package/dist/domain/entities/Dependency.js.map +1 -1
- package/dist/domain/repositories/CodeGraphRepository.d.ts +5 -0
- package/dist/domain/repositories/CodeGraphRepository.d.ts.map +1 -1
- package/dist/domain/repositories/CodeGraphRepository.js.map +1 -1
- package/dist/execution/contract-tools/analyze.d.ts +205 -0
- package/dist/execution/contract-tools/analyze.d.ts.map +1 -0
- package/dist/execution/contract-tools/analyze.js +1215 -0
- package/dist/execution/contract-tools/analyze.js.map +1 -0
- package/dist/execution/contract-tools/deps.d.ts +62 -0
- package/dist/execution/contract-tools/deps.d.ts.map +1 -0
- package/dist/execution/contract-tools/deps.js +234 -0
- package/dist/execution/contract-tools/deps.js.map +1 -0
- package/dist/execution/contract-tools/index.d.ts +5 -0
- package/dist/execution/contract-tools/index.d.ts.map +1 -0
- package/dist/execution/contract-tools/index.js +7 -0
- package/dist/execution/contract-tools/index.js.map +1 -0
- package/dist/execution/contract-tools/query.d.ts +60 -0
- package/dist/execution/contract-tools/query.d.ts.map +1 -0
- package/dist/execution/contract-tools/query.js +532 -0
- package/dist/execution/contract-tools/query.js.map +1 -0
- package/dist/execution/contract-tools/types.d.ts +26 -0
- package/dist/execution/contract-tools/types.d.ts.map +1 -0
- package/dist/execution/contract-tools/types.js +32 -0
- package/dist/execution/contract-tools/types.js.map +1 -0
- package/dist/generator/index.d.ts.map +1 -1
- package/dist/generator/index.js +0 -3
- package/dist/generator/index.js.map +1 -1
- package/dist/infrastructure/parser/enhancers/TypeScriptTypeEnhancer.d.ts +12 -0
- package/dist/infrastructure/parser/enhancers/TypeScriptTypeEnhancer.d.ts.map +1 -0
- package/dist/infrastructure/parser/enhancers/TypeScriptTypeEnhancer.js +55 -0
- package/dist/infrastructure/parser/enhancers/TypeScriptTypeEnhancer.js.map +1 -0
- package/dist/infrastructure/parser/implementations/GoParser.d.ts +2 -1
- package/dist/infrastructure/parser/implementations/GoParser.d.ts.map +1 -1
- package/dist/infrastructure/parser/implementations/GoParser.js +13 -1
- package/dist/infrastructure/parser/implementations/GoParser.js.map +1 -1
- package/dist/infrastructure/parser/implementations/PythonTreeSitterParser.d.ts +114 -0
- package/dist/infrastructure/parser/implementations/PythonTreeSitterParser.d.ts.map +1 -0
- package/dist/infrastructure/parser/implementations/PythonTreeSitterParser.js +1022 -0
- package/dist/infrastructure/parser/implementations/PythonTreeSitterParser.js.map +1 -0
- package/dist/infrastructure/parser/implementations/TreeSitterParser.d.ts +78 -0
- package/dist/infrastructure/parser/implementations/TreeSitterParser.d.ts.map +1 -0
- package/dist/infrastructure/parser/implementations/TreeSitterParser.js +648 -0
- package/dist/infrastructure/parser/implementations/TreeSitterParser.js.map +1 -0
- package/dist/infrastructure/parser/implementations/TypeScriptParser.d.ts +3 -55
- package/dist/infrastructure/parser/implementations/TypeScriptParser.d.ts.map +1 -1
- package/dist/infrastructure/parser/implementations/TypeScriptParser.js +4 -411
- package/dist/infrastructure/parser/implementations/TypeScriptParser.js.map +1 -1
- package/dist/infrastructure/parser/index.d.ts +2 -0
- package/dist/infrastructure/parser/index.d.ts.map +1 -1
- package/dist/infrastructure/parser/index.js +9 -6
- package/dist/infrastructure/parser/index.js.map +1 -1
- package/dist/infrastructure/parser/interfaces/ParserBase.d.ts.map +1 -1
- package/dist/infrastructure/parser/interfaces/ParserBase.js +1 -0
- package/dist/infrastructure/parser/interfaces/ParserBase.js.map +1 -1
- package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.d.ts +2 -0
- package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.d.ts.map +1 -1
- package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.js +4 -0
- package/dist/infrastructure/repositories/CodeGraphRepositoryImpl.js.map +1 -1
- package/dist/infrastructure/storage/StorageFactory.d.ts +5 -18
- package/dist/infrastructure/storage/StorageFactory.d.ts.map +1 -1
- package/dist/infrastructure/storage/StorageFactory.js +30 -98
- package/dist/infrastructure/storage/StorageFactory.js.map +1 -1
- package/dist/infrastructure/storage/adapters/SQLiteStorage.d.ts +13 -1
- package/dist/infrastructure/storage/adapters/SQLiteStorage.d.ts.map +1 -1
- package/dist/infrastructure/storage/adapters/SQLiteStorage.js +321 -75
- package/dist/infrastructure/storage/adapters/SQLiteStorage.js.map +1 -1
- package/dist/infrastructure/storage/adapters/sqlite-loader.d.ts +22 -0
- package/dist/infrastructure/storage/adapters/sqlite-loader.d.ts.map +1 -1
- package/dist/infrastructure/storage/adapters/sqlite-loader.js +78 -22
- package/dist/infrastructure/storage/adapters/sqlite-loader.js.map +1 -1
- package/dist/infrastructure/storage/community-helpers.d.ts +4 -0
- package/dist/infrastructure/storage/community-helpers.d.ts.map +1 -0
- package/dist/infrastructure/storage/community-helpers.js +392 -0
- package/dist/infrastructure/storage/community-helpers.js.map +1 -0
- package/dist/infrastructure/storage/graph-helpers.d.ts +22 -5
- package/dist/infrastructure/storage/graph-helpers.d.ts.map +1 -1
- package/dist/infrastructure/storage/graph-helpers.js +496 -91
- package/dist/infrastructure/storage/graph-helpers.js.map +1 -1
- package/dist/infrastructure/storage/index.d.ts +1 -1
- package/dist/infrastructure/storage/index.d.ts.map +1 -1
- package/dist/infrastructure/storage/index.js +1 -1
- package/dist/infrastructure/storage/index.js.map +1 -1
- package/dist/infrastructure/storage/interfaces/StorageBase.d.ts +2 -2
- package/dist/infrastructure/storage/interfaces/StorageBase.d.ts.map +1 -1
- package/dist/infrastructure/storage/interfaces/StorageBase.js.map +1 -1
- package/dist/infrastructure/storage/sqlite/GovernanceGraphCache.d.ts +2 -0
- package/dist/infrastructure/storage/sqlite/GovernanceGraphCache.d.ts.map +1 -1
- package/dist/infrastructure/storage/sqlite/GovernanceGraphCache.js +52 -12
- package/dist/infrastructure/storage/sqlite/GovernanceGraphCache.js.map +1 -1
- package/dist/infrastructure/storage/sqlite/schema.d.ts +2 -2
- package/dist/infrastructure/storage/sqlite/schema.d.ts.map +1 -1
- package/dist/infrastructure/storage/sqlite/schema.js +49 -1
- package/dist/infrastructure/storage/sqlite/schema.js.map +1 -1
- package/dist/interface/config/index.d.ts +5 -3
- package/dist/interface/config/index.d.ts.map +1 -1
- package/dist/interface/types/index.d.ts +37 -6
- package/dist/interface/types/index.d.ts.map +1 -1
- package/dist/interface/types/parser.d.ts +85 -0
- package/dist/interface/types/parser.d.ts.map +1 -1
- package/dist/interface/types/storage.d.ts +227 -10
- package/dist/interface/types/storage.d.ts.map +1 -1
- package/dist/orchestrator/agent-metrics-service.d.ts +126 -0
- package/dist/orchestrator/agent-metrics-service.d.ts.map +1 -0
- package/dist/orchestrator/agent-metrics-service.js +444 -0
- package/dist/orchestrator/agent-metrics-service.js.map +1 -0
- package/dist/parser/enhancers/PythonTypeEnhancer.d.ts +26 -0
- package/dist/parser/enhancers/PythonTypeEnhancer.d.ts.map +1 -0
- package/dist/parser/enhancers/PythonTypeEnhancer.js +440 -0
- package/dist/parser/enhancers/PythonTypeEnhancer.js.map +1 -0
- package/dist/parser/implementations/smart-parser.d.ts.map +1 -1
- package/dist/parser/implementations/smart-parser.js +7 -69
- package/dist/parser/implementations/smart-parser.js.map +1 -1
- package/dist/parser/implementations/tree-sitter-loader.d.ts +2 -0
- package/dist/parser/implementations/tree-sitter-loader.d.ts.map +1 -1
- package/dist/parser/implementations/tree-sitter-loader.js +46 -15
- package/dist/parser/implementations/tree-sitter-loader.js.map +1 -1
- package/dist/parser/index.d.ts +5 -3
- package/dist/parser/index.d.ts.map +1 -1
- package/dist/parser/index.js +68 -6
- package/dist/parser/index.js.map +1 -1
- package/dist/parser/interfaces/IParser.d.ts +19 -6
- package/dist/parser/interfaces/IParser.d.ts.map +1 -1
- package/dist/parser/interfaces/IParser.js +2 -3
- package/dist/parser/interfaces/IParser.js.map +1 -1
- package/dist/server/handlers/AnalysisHandler.d.ts +13 -2
- package/dist/server/handlers/AnalysisHandler.d.ts.map +1 -1
- package/dist/server/handlers/AnalysisHandler.js +24 -0
- package/dist/server/handlers/AnalysisHandler.js.map +1 -1
- package/dist/server/handlers/QueryHandler.d.ts.map +1 -1
- package/dist/server/handlers/QueryHandler.js +11 -30
- package/dist/server/handlers/QueryHandler.js.map +1 -1
- package/dist/server/mcp/context-tool.d.ts +9 -0
- package/dist/server/mcp/context-tool.d.ts.map +1 -0
- package/dist/server/mcp/context-tool.js +257 -0
- package/dist/server/mcp/context-tool.js.map +1 -0
- package/dist/server/mcp/schema-adapter.d.ts +11 -1
- package/dist/server/mcp/schema-adapter.d.ts.map +1 -1
- package/dist/server/mcp/schema-adapter.js +126 -7
- package/dist/server/mcp/schema-adapter.js.map +1 -1
- package/dist/server/mcp/server.d.ts +3 -3
- package/dist/server/mcp/server.d.ts.map +1 -1
- package/dist/server/mcp/server.js +114 -30
- package/dist/server/mcp/server.js.map +1 -1
- package/dist/server/mcp/service.d.ts +6 -2
- package/dist/server/mcp/service.d.ts.map +1 -1
- package/dist/server/mcp/service.js +138 -36
- package/dist/server/mcp/service.js.map +1 -1
- package/dist/server/mcp/stdio-transport.d.ts +23 -0
- package/dist/server/mcp/stdio-transport.d.ts.map +1 -0
- package/dist/server/mcp/stdio-transport.js +101 -0
- package/dist/server/mcp/stdio-transport.js.map +1 -0
- package/dist/server/mcp/types.d.ts +133 -8
- package/dist/server/mcp/types.d.ts.map +1 -1
- package/dist/server/routes/api.d.ts.map +1 -1
- package/dist/server/routes/api.js +11 -2
- package/dist/server/routes/api.js.map +1 -1
- package/docs/AI_ASSISTANT_SETUP.md +112 -0
- package/docs/API.md +170 -0
- package/docs/CONFIGURATION.md +141 -0
- package/docs/DEVELOPMENT.md +96 -0
- package/docs/GETTING-STARTED.md +114 -0
- package/docs/SETUP_GUIDE.md +49 -0
- package/docs/TESTING.md +81 -0
- package/docs/ai-guide/OUTPUT.md +51 -8
- package/docs/backlog.md +232 -144
- package/docs/brainstorms/2026-05-10-agent-effectiveness-validation-requirements.md +112 -0
- package/docs/generated/phase-58/subagent-evidence/claude-hook-example.json +15 -0
- package/docs/generated/phase-58/subagent-evidence/claude-session.md +146 -0
- package/docs/generated/phase-58/subagent-evidence/claude-subagent.json +28 -0
- package/docs/generated/phase-58/subagent-evidence/codex-agent-example.toml +19 -0
- package/docs/generated/phase-58/subagent-evidence/codex-session.md +150 -0
- package/docs/generated/phase-58/subagent-evidence/codex-subagent.json +20 -0
- package/docs/generated/phase-58/subagent-evidence/negative-no-retrieval.json +12 -0
- package/docs/generated/phase-58/subagent-evidence/verification-manifest.json +19 -0
- package/docs/ideation/2026-05-02-subagent-environment-contract-injection-ideation.md +183 -0
- package/docs/ideation/2026-05-04-subagent-hooks-deep-dive-ideation.md +133 -0
- package/docs/ideation/2026-05-10-agent-effectiveness-validation-ideation.md +219 -0
- package/package.json +8 -3
- package/scripts/copy-build-assets.mjs +23 -0
- package/scripts/hooks/templates/pre-commit +33 -2
- package/scripts/tests/test_rule_control_workflow.py +15 -1
- package/scripts/verify-subagent-env-contract.mjs +279 -0
- package/dist/parser/implementations/tree-sitter-parser.d.ts +0 -60
- package/dist/parser/implementations/tree-sitter-parser.d.ts.map +0 -1
- package/dist/parser/implementations/tree-sitter-parser.js +0 -380
- package/dist/parser/implementations/tree-sitter-parser.js.map +0 -1
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
---
|
|
2
|
+
date: 2026-05-04
|
|
3
|
+
topic: subagent-hooks-deep-dive
|
|
4
|
+
focus: Phase 58 hooks system deepening and security architecture
|
|
5
|
+
mode: repo-grounded
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Ideation: Subagent Hooks 安全体系深化
|
|
9
|
+
|
|
10
|
+
## Grounding Context
|
|
11
|
+
|
|
12
|
+
### Codebase Context
|
|
13
|
+
- **父代理 session 无防护**: settings.json hooks 为空,所有执行仅存在于 worker.md frontmatter
|
|
14
|
+
- **52 个第三方代理无 hooks**: /home/stark/.claude/agents/ 下所有 hooks 被注释掉
|
|
15
|
+
- **Transcript 审计脆弱**: subagent-stop-audit.js 使用正则扫描 JSONL,可被绕过
|
|
16
|
+
- **Dead hooks**: rule-route-advisory.js 和 check-gstack.sh 存在但未接入
|
|
17
|
+
- **Exit code 协议不一致**: process.exit(2) vs decision:'block' JSON 混用
|
|
18
|
+
- **L0-L3 分级存在但 hooks 不感知**: 分类系统是建议而非控制
|
|
19
|
+
|
|
20
|
+
### Past Learnings
|
|
21
|
+
- SubagentStart additionalContext 不可靠(压缩时可能丢弃,Issue #23885)
|
|
22
|
+
- PreToolUse updatedInput 对 Agent tool 静默丢弃(Issue #39814)
|
|
23
|
+
- 注入失败,检索成功:retrieval-based pattern 是验证的路径
|
|
24
|
+
- 渐进升级管道:report-only → warn → block
|
|
25
|
+
- env-contract 基础设施成熟:CLI、MCP、doctor、checker、validator
|
|
26
|
+
|
|
27
|
+
### External Context
|
|
28
|
+
- Claude Code hooks 支持 20+ 事件、5 种 handler(command, http, mcp_tool, prompt, agent)
|
|
29
|
+
- 无竞品有环境契约模式;OS 级沙箱是收敛趋势
|
|
30
|
+
- Codex CLI 使用 sandbox-exec/namespaces 做沙箱
|
|
31
|
+
- Langfuse 提供 session-level trace grouping 和 agent graph visualization
|
|
32
|
+
- 游戏反作弊从客户端控制转向服务端权威验证
|
|
33
|
+
|
|
34
|
+
## Ranked Ideas
|
|
35
|
+
|
|
36
|
+
### 1. 父代理升级为执行权威 (Invert Parent Session to Enforcer)
|
|
37
|
+
**Description:** 将主要执行点从子代理 frontmatter 移到父代理的 settings.json hooks。父代理成为主动防火墙,在子代理工具调用到达文件系统前进行检查、拦截和日志记录。子代理级 hooks 变为可选补充而非唯一执行机制。
|
|
38
|
+
**Warrant:** `direct:` — settings.json hooks 显式为空;所有执行仅存在于 worker.md frontmatter 中。父代理是所有子交互的唯一不变量。
|
|
39
|
+
**Rationale:** 每个其他 hook、审计和契约机制都是执行位置的下游。将执行移到父代理将多个 per-agent hook 配置折叠为单一策略面。这是单一最高杠杆的架构变更。
|
|
40
|
+
**Downsides:** 父代理 hooks 在每次工具调用时触发,增加延迟。需要精心设计 matcher 避免对父代理自身操作的误报。可能与现有父代理工具使用模式冲突。
|
|
41
|
+
**Confidence:** 85%
|
|
42
|
+
**Complexity:** Medium-High
|
|
43
|
+
**Status:** Unexplored
|
|
44
|
+
|
|
45
|
+
### 2. 用签名执行收据替代 Transcript 审计 (Signed Execution Receipts)
|
|
46
|
+
**Description:** 用结构化 JSON "执行收据" 替代 subagent-stop-audit.js 的正则扫描。收据包含:契约哈希、工具调用摘要、文件访问日志。父代理验证收据完整性而非 transcript 内容。
|
|
47
|
+
**Warrant:** `direct:` — 审计脚本存在于 subagent-stop-audit.js,其正则方法被确认为脆弱。JSONL transcript 不是为机器可验证合规设计的——它们是人类可读日志被误用为验证协议。
|
|
48
|
+
**Rationale:** 消除合规管道中最大单一误报/漏报源。将验证从"transcript 是否包含正确字符串"转向"执行是否产生了有效收据"。收据构造上即防篡改。
|
|
49
|
+
**Downsides:** 收据需要子代理配合(必须在 Stop 前发出)。收据格式需要版本化。需要从当前审计的迁移路径。
|
|
50
|
+
**Confidence:** 75%
|
|
51
|
+
**Complexity:** Medium
|
|
52
|
+
**Status:** Unexplored
|
|
53
|
+
|
|
54
|
+
### 3. 第三方代理包装模式 (Third-Party Agent Wrapping)
|
|
55
|
+
**Description:** 创建项目所有的包装代理 (.claude/agents/safe-*.md),委托给第三方代理同时添加 PreToolUse hooks for Bash safety 和 Stop 审计。包装器成为项目的执行边界;第三方代理行为不变。
|
|
56
|
+
**Warrant:** `reasoned:` — Claude Code 按名称从 .claude/agents/*.md 解析代理。如果项目定义了带 hooks 的 safe-brainstorm.md,用户调用 @safe-brainstorm 时 hooks 生效。这是装饰器模式应用于代理治理。
|
|
57
|
+
**Rationale:** 当前状态是二元的:要么完全信任 52 个代理,要么不使用它们。包装给出中间地带——使用代理能力同时执行项目级规则。对会生成自己子代理的代理(嵌套信任链)尤其有价值。
|
|
58
|
+
**Downsides:** 每个包装器是维护面。包装器可能与上游代理定义漂移。并非所有第三方代理都能干净地包装(复杂工具需求)。
|
|
59
|
+
**Confidence:** 80%
|
|
60
|
+
**Complexity:** Low-Medium
|
|
61
|
+
**Status:** Unexplored
|
|
62
|
+
|
|
63
|
+
### 4. 审计日志作为一等工件 (Audit Trail As First-Class Artifact)
|
|
64
|
+
**Description:** 创建结构化追加日志 (.mycodemap/audit.jsonl),每个 hook 调用追加一行 JSON(时间戳、事件、代理类型、决策、原因)。构建 `mycodemap audit` CLI 命令查询和趋势分析。
|
|
65
|
+
**Warrant:** `direct:` — subagent-stop-audit.js 已经读取 transcript、解析 JSONL 并提取结构化数据。如果它将发现写入结构化日志,审计轨迹将经受 transcript 轮换、可被 mycodemap doctor 查询、并支持趋势分析。
|
|
66
|
+
**Rationale:** 将合规从"我们认为代理遵循规则"转变为"我们可以证明,这是趋势"。使 mycodemap doctor 能报告合规率。创建反馈循环:如果规则产生大量违规,要么沟通不畅,要么规则过严。
|
|
67
|
+
**Downsides:** 日志文件随时间增长(需要轮换)。Hook 脚本稍微复杂(必须写入日志)。共享仓库的隐私考虑。
|
|
68
|
+
**Confidence:** 90%
|
|
69
|
+
**Complexity:** Low
|
|
70
|
+
**Status:** Unexplored
|
|
71
|
+
|
|
72
|
+
### 5. 服务端权威结果验证 (Server-Authoritative Outcome Validation)
|
|
73
|
+
**Description:** 不验证代理行为(调用了什么工具),而是验证代理结果(代码库状态变化)。运行确定性后置验证检查不变量——无意外文件修改、无规则违规、无能力边界突破。
|
|
74
|
+
**Warrant:** `reasoned:` — 游戏反作弊从客户端控制转向服务端权威验证,因为不能信任客户端。CodeMap 当前通过 PreToolUse hooks(客户端控制)控制代理行为。52 个无 hooks 代理 = 忽略反作弊的游戏客户端。但你可以通过检查代码库 diff 验证任何代理触碰后的状态。
|
|
75
|
+
**Rationale:** 直接解决"52 个代理无 hooks"盲区。即使无法拦截代理的工具调用,也可以通过检查结果代码库 diff 检测违规。从"控制代理"转向"控制后果"。
|
|
76
|
+
**Downsides:** 事后检测(损害已发生)。需要清晰定义不变量。合法但异常的变更可能产生误报。
|
|
77
|
+
**Confidence:** 80%
|
|
78
|
+
**Complexity:** Medium
|
|
79
|
+
**Status:** Unexplored
|
|
80
|
+
|
|
81
|
+
### 6. 契约运行时 API — 单一编译面 (Contract Runtime API)
|
|
82
|
+
**Description:** 构建 compileContract() 函数,从所有治理源(AGENTS.md, .githooks, package.json, docs/rules/, .mycodemap/rules/)产生单一 ProjectEnvironmentContract 工件。所有下游消费者——hooks、MCP、doctor、CI、transcript 审计——从这一个编译输出读取。
|
|
83
|
+
**Warrant:** `reasoned:` — 当前 discovery.ts 已部分实现(5 个硬编码 builder),但每个新执行面需要自己的集成代码。单一编译步骤加稳定 API 消除每消费者集成工作。添加新契约项 = 添加一个 builder 函数;所有消费者自动获取。
|
|
84
|
+
**Rationale:** 当前添加新契约规则需要分别修改 discovery、CLI、MCP tool、doctor 和可能的 hooks。运行时 API 意味着每个未来契约项以零额外接线流过所有执行路径。O(1) 集成而非 O(n)。
|
|
85
|
+
**Downsides:** 需要重构现有消费者使用 API。单一编译面成为单点故障。API 设计需要关注向后兼容。
|
|
86
|
+
**Confidence:** 85%
|
|
87
|
+
**Complexity:** Medium
|
|
88
|
+
**Status:** Unexplored
|
|
89
|
+
|
|
90
|
+
### 7. 反转 Read-Before-Edit;编辑前自动读取 (Auto-Read Before Edits)
|
|
91
|
+
**Description:** 不阻断未读文件的编辑,而是在 PreStep 中自动触发静默读取。Hook 拦截 Edit 调用,内部执行读取,将文件内容注入子代理上下文,然后允许编辑继续。执行是环境性的,非教育性的。
|
|
92
|
+
**Warrant:** `reasoned:` Read-Before-Edit 是已知的 AI 编程助手失败模式。阻断门创建摩擦并教会子代理添加形式化读取调用。不可见预读确保上下文始终存在,无需子代理显式请求。
|
|
93
|
+
**Rationale:** 消除最常见的 AI 编码错误类别(过时上下文编辑)而不增加摩擦。无论子代理是否"记得"先读都有效。执行是环境性的,非教育性的。
|
|
94
|
+
**Downsides:** Hook 必须注入文件内容到上下文(大文件的 token 成本)。可能与子代理自身读取策略冲突。实现依赖 Claude Code hook 注入内容的能力。
|
|
95
|
+
**Confidence:** 70%
|
|
96
|
+
**Complexity:** Medium-High
|
|
97
|
+
**Status:** Unexplored
|
|
98
|
+
|
|
99
|
+
## Rejection Summary
|
|
100
|
+
|
|
101
|
+
| # | Idea | Reason Rejected |
|
|
102
|
+
|---|------|-----------------|
|
|
103
|
+
| P6 | SubagentStart Context Injection Broken Promise | 已有文档覆盖 |
|
|
104
|
+
| P4 | Two-Language Exit Code Problem | 低于讨论门槛 — 清理任务 |
|
|
105
|
+
| P5 | Dead Hooks on Disk | 低于讨论门槛 — 接线任务 |
|
|
106
|
+
| I3 | Remove Explicit env-contract Calls via Hook Injection | Warrant 自相矛盾 |
|
|
107
|
+
| I7 | Remove Inconsistent Exit Code | 与 P4 重复 |
|
|
108
|
+
| A5 | The Contract Is The Hook | 与 I3 重复 |
|
|
109
|
+
| A6 | Treat Hook Bugs As Config | Bug 未修复时不可操作 |
|
|
110
|
+
| A7 | Agent-Type-less Contracts | 成本超过收益 |
|
|
111
|
+
| A2 | Behavioral Anomaly Scoring | 过于投机,无基础设施 |
|
|
112
|
+
| L6 | Contract Item Plugin Registry | 当前规模过度设计 |
|
|
113
|
+
| L7 | Drift-Aware Regeneration Pipeline | 低于讨论门槛 — 工程任务 |
|
|
114
|
+
| L8 | Contract Coverage Matrix | 低于讨论门槛 — doctor 扩展 |
|
|
115
|
+
| I4 | Convert Advisory to Mandatory Gates | 直接工程任务 |
|
|
116
|
+
| L5 | Platform-Agnostic Adapters | 非核心安全问题 |
|
|
117
|
+
| A1 | The Parent Is The Threat | 被更强 I1 吸收 |
|
|
118
|
+
| A3 | Transcript Audit As Prevention | 被更强 I1 吸收 |
|
|
119
|
+
| C6 | Parent Session Mirror | 被更强 I1 吸收 |
|
|
120
|
+
| L4 | Agent Behavior Ledger | 被更强 A8 吸收 |
|
|
121
|
+
| C7 | Honeypot Contract Injection | 被更强 C3 吸收 |
|
|
122
|
+
| L2 | Hook Action Bindings | 被更强 L1 吸收 |
|
|
123
|
+
| I6 | Automate L0-L3 Classification | 精度不足 |
|
|
124
|
+
| P7 | L0-L3 But Hooks Don't See It | 被 I6 吸收后拒绝 |
|
|
125
|
+
| P8 | 52-Agent Blind Spot in Audit | 被更强 C3 吸收 |
|
|
126
|
+
| L3 | Contract-as-Test Harness | 被更强 A8 吸收 |
|
|
127
|
+
| I5 | Remove Per-Agent Hook Config | 被更强 I1 吸收 |
|
|
128
|
+
| P3 | Retroactive Audit Theater | 被更强 I1 吸收 |
|
|
129
|
+
| C2 | All 20+ Events Telemetry Ring | 与 A8 重叠但更不实用 |
|
|
130
|
+
| C1 | Zero-Token Enforcement | 有趣但实现成本高 |
|
|
131
|
+
| C4 | Agent Registry & Capability Negotiation | 需要平台支持 |
|
|
132
|
+
| C5 | Contract-as-Runtime-Code Compiler | 高成本,增量收益有限 |
|
|
133
|
+
| C8 | Custom MCP Enforcement Gateway | 过度设计 |
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
---
|
|
2
|
+
date: 2026-05-10
|
|
3
|
+
topic: agent-effectiveness-validation
|
|
4
|
+
focus: 验证 mycodemap 工具已完成功能是否真正为 AI agent 产生了积极效果,需要数据指标支撑
|
|
5
|
+
mode: repo-grounded
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# Ideation: CodeMap Agent 效果验证——如何证明工具真的有用
|
|
9
|
+
|
|
10
|
+
## Grounding Context
|
|
11
|
+
|
|
12
|
+
**Codebase:** CodeMap v2.0.0, TypeScript, CLI/MCP/HTTP API surfaces, architecture CLI→Server→Domain→Infrastructure→Interface.
|
|
13
|
+
|
|
14
|
+
**Key existing evidence:**
|
|
15
|
+
- Comprehensive test report (2026-03): 5-scenario comparison, 3.35/5 overall score, 60-300x slower than rg but near-zero false positives
|
|
16
|
+
- Agent dogfood report (2026-04-17): 6/10 agent-friendliness, controlled A/B showing 6+→1 calls for impact analysis
|
|
17
|
+
- Validation guardrails (Phase 40.1): real-world validation as hard constraint
|
|
18
|
+
- Ghost command detection (Phase 46): docs accuracy validation
|
|
19
|
+
|
|
20
|
+
**Critical gap:** No continuous effectiveness metrics, no automated validation pipeline, no agent feedback loop.
|
|
21
|
+
|
|
22
|
+
**External benchmarks:** SWE-bench, HumanEval, GitHub Copilot (55% speed improvement), METR (AI tools may slow senior devs by 19%), Anthropic tool design evaluation, LangSmith, SPACE framework.
|
|
23
|
+
|
|
24
|
+
## Topic Axes
|
|
25
|
+
|
|
26
|
+
1. Agent task completion efficiency
|
|
27
|
+
2. Token/call efficiency
|
|
28
|
+
3. Accuracy/precision
|
|
29
|
+
4. Agent behavior quality
|
|
30
|
+
5. Developer experience
|
|
31
|
+
|
|
32
|
+
## Ranked Ideas
|
|
33
|
+
|
|
34
|
+
### 1. Agent Task Completion A/B Harness
|
|
35
|
+
|
|
36
|
+
**Description:** Build a harness that runs identical agent prompts (find callers, assess impact, trace dependencies) against two conditions: CodeMap-enabled vs text-search-only. Measures task completion rate, time-to-solution, and answer correctness. Runs as CI gate on every release.
|
|
37
|
+
|
|
38
|
+
**Axis:** Agent task completion efficiency
|
|
39
|
+
|
|
40
|
+
**Basis:** `direct:` Dogfood report (2026-04-17) showed 6+→1 calls for impact analysis, but was one-time manual evaluation with no repeatable infrastructure. The grounding summary explicitly states "No continuous effectiveness metrics, no automated validation pipeline."
|
|
41
|
+
|
|
42
|
+
**Rationale:** This is the foundational validation question. Without A/B infrastructure, every claim about CodeMap's value remains a proxy metric. The actual question — "does the agent solve the task better with CodeMap?" — is unanswered. All other metrics (speed, accuracy, tokens) are intermediate proxies of this core question.
|
|
43
|
+
|
|
44
|
+
**Downsides:** Requires defining ground truth for agent tasks (non-trivial). Agent variability adds noise. Needs 2-3 weeks of dedicated effort.
|
|
45
|
+
|
|
46
|
+
**Confidence:** 90%
|
|
47
|
+
|
|
48
|
+
**Complexity:** High
|
|
49
|
+
|
|
50
|
+
**Status:** Unexplored
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
### 2. Zero-Touch Benchmark from Git History
|
|
55
|
+
|
|
56
|
+
**Description:** Mine the repo's git history for real impact analysis, dependency tracing, and refactoring commits. Replay those exact scenarios through CodeMap automatically. Every merged PR becomes a free test case with ground truth (the human did the work). Eliminates manual test scenario design entirely.
|
|
57
|
+
|
|
58
|
+
**Axis:** Accuracy/precision
|
|
59
|
+
|
|
60
|
+
**Basis:** `direct:` Phase 40.1 established real-world validation as hard constraint. `external:` SWE-bench uses this exact pattern — GitHub issues + merged PRs as ground truth for agent evaluation.
|
|
61
|
+
|
|
62
|
+
**Rationale:** Currently validation requires manually constructing scenarios. This eliminates that cost — every merged PR in every participating repo becomes a growing validation dataset with zero human effort. Compounds over time: more PRs = stronger signal.
|
|
63
|
+
|
|
64
|
+
**Downsides:** Git history quality varies; not all commits have clear "ground truth." Requires mapping commit types to CodeMap query types. Initial harness investment needed.
|
|
65
|
+
|
|
66
|
+
**Confidence:** 85%
|
|
67
|
+
|
|
68
|
+
**Complexity:** Medium
|
|
69
|
+
|
|
70
|
+
**Status:** Unexplored
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
### 3. Token Cost Accounting
|
|
75
|
+
|
|
76
|
+
**Description:** Tag each CodeMap response with estimated token cost (input + output). Compare against raw-text alternatives (rg, grep). Build per-query-type token baselines. Expose as `codemap benchmark --token-report` command. Enables agents to make informed tool-choice decisions.
|
|
77
|
+
|
|
78
|
+
**Axis:** Token/call efficiency
|
|
79
|
+
|
|
80
|
+
**Basis:** `direct:` Dogfood report showed 6+→1 call reduction but never measured total token consumption. A single CodeMap call returning 50KB JSON might cost 15K tokens vs 200 bytes from rg. `external:` GitHub Copilot research (55% speed improvement) and Anthropic tool design emphasize minimizing agent processing burden.
|
|
81
|
+
|
|
82
|
+
**Rationale:** Agents pay for tokens, not tool calls. The 6+→1 reduction is CodeMap's strongest claim, but if each response is 50x larger, token savings may be negated. This is the cheapest metric to implement (just count) and most directly actionable (maps to real cost).
|
|
83
|
+
|
|
84
|
+
**Downsides:** Token estimation is approximate. Response size varies by query and codebase. Doesn't capture downstream token savings (agent doesn't need to read files).
|
|
85
|
+
|
|
86
|
+
**Confidence:** 85%
|
|
87
|
+
|
|
88
|
+
**Complexity:** Low
|
|
89
|
+
|
|
90
|
+
**Status:** Unexplored
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
### 4. Ghost Feedback — Agent Behavior Telemetry
|
|
95
|
+
|
|
96
|
+
**Description:** Instrument the MCP gateway to log post-CodeMap agent behavior. Classify into: "accepted" (moved on), "re-queried" (response insufficient), "abandoned" (fell back to rg/grep). Requires no cooperation from agents — just server-side observation. Produces continuous effectiveness signal.
|
|
97
|
+
|
|
98
|
+
**Axis:** Agent behavior quality
|
|
99
|
+
|
|
100
|
+
**Basis:** `direct:` Grounding summary identifies "no agent feedback loop" as key gap. Phase 46 ghost command detection shows infrastructure for detecting unexpected tool usage patterns already exists. `external:` METR finding that "AI tools may slow senior devs by 19%" suggests adoption friction matters more than tool capability.
|
|
101
|
+
|
|
102
|
+
**Rationale:** The agent dogfood report was one-time manual evaluation. Without continuous behavioral telemetry, we cannot detect regressions (parser change makes output harder to parse), adoption drops (agents learn to avoid CodeMap), or feature-specific problems. This is the cheapest continuous signal — captured automatically during normal operation.
|
|
103
|
+
|
|
104
|
+
**Downsides:** Classification of "accepted" vs "abandoned" requires heuristics that may be noisy. Privacy considerations for logging agent behavior. Doesn't capture WHY behavior changed.
|
|
105
|
+
|
|
106
|
+
**Confidence:** 80%
|
|
107
|
+
|
|
108
|
+
**Complexity:** Low-Medium
|
|
109
|
+
|
|
110
|
+
**Status:** Unexplored
|
|
111
|
+
|
|
112
|
+
---
|
|
113
|
+
|
|
114
|
+
### 5. Agent-Perceived Latency vs Raw Latency
|
|
115
|
+
|
|
116
|
+
**Description:** Redefine the benchmark: instead of comparing CodeMap-WASM vs CodeMap-Native, compare CodeMap single-call total time vs equivalent multi-call raw-tool workflow total time. An agent waiting 2s for CodeMap that replaces 6 rg calls (200ms each = 1200ms total) has net latency reduction. Set thresholds based on agent-perceived delta.
|
|
117
|
+
|
|
118
|
+
**Axis:** Developer experience
|
|
119
|
+
|
|
120
|
+
**Basis:** `direct:` Benchmark command states "[WHY] Compare WASM vs Native performance to verify <1s startup penalty on 10K-file repos." The 2026-03 report found "CodeMap 60-300x slower than rg" — but this compares single-call latency without accounting for multi-call alternative workflow.
|
|
121
|
+
|
|
122
|
+
**Rationale:** Current benchmark creates a false optimization target. If we optimize WASM from 800ms to 400ms, that's 50% improvement on benchmark — but agents don't care because the alternative (6×200ms = 1200ms) is still slower. Agent-perceived latency reframes the metric to what actually matters for agent workflows.
|
|
123
|
+
|
|
124
|
+
**Downsides:** Defining "equivalent workflow" requires judgment. Different task types have different alternative workflows. May need per-query-type latency budgets.
|
|
125
|
+
|
|
126
|
+
**Confidence:** 80%
|
|
127
|
+
|
|
128
|
+
**Complexity:** Low
|
|
129
|
+
|
|
130
|
+
**Status:** Unexplored
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
### 6. Adoption Decay Monitoring
|
|
135
|
+
|
|
136
|
+
**Description:** Track, over time, what percentage of eligible agent queries use CodeMap vs raw-text alternatives (rg, grep). A declining adoption rate is the ultimate effectiveness signal — it means the tool is failing at its core mission. Report weekly. Compare against baseline.
|
|
137
|
+
|
|
138
|
+
**Axis:** Agent behavior quality
|
|
139
|
+
|
|
140
|
+
**Basis:** `external:` METR's finding that AI tools may slow senior devs by 19% implies adoption decay is a real phenomenon — tools that don't deliver value get abandoned. `direct:` Grounding summary notes "no continuous effectiveness metrics" and "no agent feedback loop."
|
|
141
|
+
|
|
142
|
+
**Rationale:** All other metrics (speed, accuracy, token cost) are intermediate proxies. Adoption rate is the ground truth. If agents stop using CodeMap, nothing else matters. Tracking adoption decay is the cheapest, most informative validation we can build — it's the "vital sign" of tool effectiveness.
|
|
143
|
+
|
|
144
|
+
**Downsides:** Requires instrumenting agent tool selection (may not be available in all environments). Defining "eligible queries" needs thought. Adoption may fluctuate for reasons unrelated to tool quality.
|
|
145
|
+
|
|
146
|
+
**Confidence:** 75%
|
|
147
|
+
|
|
148
|
+
**Complexity:** Low-Medium
|
|
149
|
+
|
|
150
|
+
**Status:** Unexplored
|
|
151
|
+
|
|
152
|
+
---
|
|
153
|
+
|
|
154
|
+
### 7. Precision-Weighted Cost Model
|
|
155
|
+
|
|
156
|
+
**Description:** Quantify the downstream cost of false positives and false negatives in CodeMap outputs. Formula: `cost = (fp_rate × wasted_action_cost) + (fn_rate × missed_issue_cost)`. Track across query types. Reveals which query types have asymmetric costs (missing a security dependency is worse than listing an unused one).
|
|
157
|
+
|
|
158
|
+
**Axis:** Accuracy/precision
|
|
159
|
+
|
|
160
|
+
**Basis:** `direct:` 2026-03 test report showed near-zero false positives but measured in isolation. Dogfood report's 6/10 agent-friendliness suggests accuracy alone doesn't guarantee usefulness. `external:` METR findings imply tool outputs must be high-signal to justify integration cost.
|
|
161
|
+
|
|
162
|
+
**Rationale:** Transforms accuracy from binary metric ("is it correct?") to economic one ("what does correctness cost?"). Once established, lets you set precision thresholds per feature type and make trade-off decisions objective. Reveals where to invest accuracy improvements for maximum impact.
|
|
163
|
+
|
|
164
|
+
**Downsides:** Requires estimating "wasted action cost" and "missed issue cost" (judgment-dependent). Needs real agent session data to calibrate. May oversimplify complex failure modes.
|
|
165
|
+
|
|
166
|
+
**Confidence:** 75%
|
|
167
|
+
|
|
168
|
+
**Complexity:** Medium
|
|
169
|
+
|
|
170
|
+
**Status:** Unexplored
|
|
171
|
+
|
|
172
|
+
---
|
|
173
|
+
|
|
174
|
+
## Cross-Cutting Combinations
|
|
175
|
+
|
|
176
|
+
### CC1: Behavioral Telemetry + Adoption Decay (Ideas 4 + 6)
|
|
177
|
+
Micro-level (per-call behavior) + macro-level (adoption trends) = complete agent trust picture. Telemetry shows WHAT agents do; adoption shows WHETHER they keep doing it.
|
|
178
|
+
|
|
179
|
+
### CC2: Zero-Touch Git History + A/B Harness (Ideas 1 + 2)
|
|
180
|
+
Git mining generates test cases automatically; A/B harness runs them with/without CodeMap = continuous validation from real usage with zero manual effort.
|
|
181
|
+
|
|
182
|
+
### CC3: Token Accounting + Agent-Perceived Latency (Ideas 3 + 5)
|
|
183
|
+
Token cost per response + total workflow time comparison = true efficiency picture. Both reframe "CodeMap is slow" into "CodeMap is efficient when measured correctly."
|
|
184
|
+
|
|
185
|
+
---
|
|
186
|
+
|
|
187
|
+
## Rejection Summary
|
|
188
|
+
|
|
189
|
+
| # | Idea | Reason Rejected |
|
|
190
|
+
|---|------|-----------------|
|
|
191
|
+
| 1.2 | Dead Man's Switch | Overlaps with 1.1 (A/B harness); harder to implement, same insight |
|
|
192
|
+
| 1.3 | Production Shadow Tracing | Overlaps with 4 (Ghost Feedback); same telemetry, less structured |
|
|
193
|
+
| 1.4 | Agent-Native Validation Harness | Duplicate of 1.1 with different framing |
|
|
194
|
+
| 1.5 | Comparative A/B in Production | Duplicate of 1.1 at workflow level |
|
|
195
|
+
| 1.6 | Session Replay Infrastructure | Overlaps with 1.1; higher complexity for marginal gain |
|
|
196
|
+
| 1.8 | Pharmaceutical Clinical Trials | Same concept as 1.1, academic framing |
|
|
197
|
+
| 1.9 | Automated SWE-bench Pipeline | Same as 1.1, higher ambition not justified now |
|
|
198
|
+
| 1.10 | Open Benchmark Community | Too expensive for current stage; internal benchmarks sufficient |
|
|
199
|
+
| 2.3 | Automated Token-Per-Insight | Duplicate of 3 (Token Cost Accounting) |
|
|
200
|
+
| 2.4 | Token-Efficiency First-Class | Duplicate of 3 |
|
|
201
|
+
| 2.5 | Token Delta Tracking | Duplicate of 3 + 2.2 combined |
|
|
202
|
+
| 2.6 | Sports Biomechanics | Too academic; actionable metric is token cost (covered by 3) |
|
|
203
|
+
| 2.7 | Sharpe Ratio | Interesting reframing but overlaps with 7 (Precision-Weighted Cost) |
|
|
204
|
+
| 2.8 | Token Budget Pressure Test | Duplicate of 2.2 (Call Collapse) + 3 (Token Accounting) |
|
|
205
|
+
| 3.4 | "Fool the Agent" Adversarial | Overlaps with 3.5; 3.3 (Git History) more pragmatic |
|
|
206
|
+
| 3.5 | Red-Team Adversarial | Overlaps with 3.3 (Git History); git history provides real adversarial cases |
|
|
207
|
+
| 3.6 | Regression Canary | Overlaps with 3.3 (Git History); git mining is more comprehensive |
|
|
208
|
+
| 3.8 | Cross-Codebase Generalization | Good but lower priority than 3.3; can be added later |
|
|
209
|
+
| 4.3 | Behavioral Fingerprinting | Overlaps with 4 (Ghost Feedback); same signal, more complex |
|
|
210
|
+
| 4.4 | Agent-as-Judge | Overlaps with 4 (Ghost Feedback); explicit feedback less reliable than behavioral |
|
|
211
|
+
| 4.5 | Shadow-Mode Effect | Too complex for current stage; 4 (Ghost Feedback) captures similar signal |
|
|
212
|
+
| 4.6 | Measure What Don't Ask | Duplicate of 6 (Adoption Decay) |
|
|
213
|
+
| 4.7 | Override Signal | Overlaps with 4 (Ghost Feedback); override is one behavior class |
|
|
214
|
+
| 4.8 | Aviation Intervention Rate | Academic reframing of 4.7; same insight |
|
|
215
|
+
| 5.2 | Delete the Docs | Interesting but risky; 5 (Agent-Perceived Latency) more actionable |
|
|
216
|
+
| 5.3 | Single-User Instrumentation | Overlaps with 4 (Ghost Feedback); manual vs automated |
|
|
217
|
+
| 5.4 | Continuous Satisfaction Signal | Duplicate of 4 (Ghost Feedback) |
|
|
218
|
+
| 5.5 | Latency Budget | Good CI gate but subset of 5 (Agent-Perceived Latency) |
|
|
219
|
+
| 5.6 | Learning Curve Analysis | Too academic; adoption decay (6) captures similar signal |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mycodemap/mycodemap",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"description": "TypeScript 代码地图工具 - 为 AI 辅助开发提供结构化上下文",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -29,6 +29,7 @@
|
|
|
29
29
|
],
|
|
30
30
|
"scripts": {
|
|
31
31
|
"build": "tsc",
|
|
32
|
+
"postbuild": "node scripts/copy-build-assets.mjs",
|
|
32
33
|
"dev": "tsc --watch",
|
|
33
34
|
"docs:check": "node scripts/validate-docs.js && node scripts/validate-ai-docs.js",
|
|
34
35
|
"docs:check:human": "node scripts/validate-docs.js",
|
|
@@ -67,9 +68,13 @@
|
|
|
67
68
|
"commander": "^11.1.0",
|
|
68
69
|
"dependency-cruiser": "^17.3.10",
|
|
69
70
|
"globby": "^14.0.0",
|
|
71
|
+
"graphology": "^0.26.0",
|
|
72
|
+
"graphology-communities-louvain": "^2.0.2",
|
|
70
73
|
"hono": "^4.12.8",
|
|
71
74
|
"ora": "^8.0.1",
|
|
75
|
+
"smol-toml": "^1.6.1",
|
|
72
76
|
"tree-sitter": "^0.21.1",
|
|
77
|
+
"tree-sitter-python": "0.23.4",
|
|
73
78
|
"tree-sitter-typescript": "^0.23.2",
|
|
74
79
|
"typescript": "^5.3.3",
|
|
75
80
|
"typhonjs-escomplex": "^0.1.0",
|
|
@@ -85,8 +90,8 @@
|
|
|
85
90
|
"vitest": "^1.1.0"
|
|
86
91
|
},
|
|
87
92
|
"optionalDependencies": {
|
|
88
|
-
"
|
|
89
|
-
"
|
|
93
|
+
"sql.js": "^1.12.0",
|
|
94
|
+
"web-tree-sitter": "^0.24.0"
|
|
90
95
|
},
|
|
91
96
|
"engines": {
|
|
92
97
|
"node": ">=20.0.0"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
// Post-tsc copy step: ship non-TS assets that `tsc` does not emit into `dist/`.
|
|
2
|
+
// Phase 53: built-in bootstrap profile JSONs live next to the profile-loader
|
|
3
|
+
// and must be present at runtime in published packages (`files` ships `dist/`,
|
|
4
|
+
// not `src/`).
|
|
5
|
+
|
|
6
|
+
import { cpSync, mkdirSync } from 'node:fs';
|
|
7
|
+
import path from 'node:path';
|
|
8
|
+
import { fileURLToPath } from 'node:url';
|
|
9
|
+
|
|
10
|
+
const repoRoot = fileURLToPath(new URL('..', import.meta.url));
|
|
11
|
+
|
|
12
|
+
const copies = [
|
|
13
|
+
{
|
|
14
|
+
from: path.join(repoRoot, 'src', 'cli', 'init', 'profiles'),
|
|
15
|
+
to: path.join(repoRoot, 'dist', 'cli', 'init', 'profiles'),
|
|
16
|
+
},
|
|
17
|
+
];
|
|
18
|
+
|
|
19
|
+
for (const { from, to } of copies) {
|
|
20
|
+
mkdirSync(to, { recursive: true });
|
|
21
|
+
cpSync(from, to, { recursive: true });
|
|
22
|
+
console.log(`[copy-build-assets] ${path.relative(repoRoot, from)} -> ${path.relative(repoRoot, to)}`);
|
|
23
|
+
}
|
|
@@ -40,6 +40,35 @@ echo "Tests passed"
|
|
|
40
40
|
# 2. repo-local 规则校验(按 hard_gate.mode 决定 report-only / enforce)
|
|
41
41
|
RULE_CONFIG_PATH=".claude/rule-system.config.json"
|
|
42
42
|
RULE_HARD_GATE_MODE="report-only"
|
|
43
|
+
RULE_REPORT_ONLY_TIMEOUT_SECONDS="${RULE_REPORT_ONLY_TIMEOUT_SECONDS:-20}"
|
|
44
|
+
|
|
45
|
+
run_rule_validation_report_only() {
|
|
46
|
+
python3 - <<'PY'
|
|
47
|
+
import os
|
|
48
|
+
import subprocess
|
|
49
|
+
import sys
|
|
50
|
+
|
|
51
|
+
timeout_value = os.environ.get("RULE_REPORT_ONLY_TIMEOUT_SECONDS", "20")
|
|
52
|
+
|
|
53
|
+
try:
|
|
54
|
+
timeout_seconds = int(timeout_value)
|
|
55
|
+
except ValueError:
|
|
56
|
+
timeout_seconds = 20
|
|
57
|
+
|
|
58
|
+
try:
|
|
59
|
+
completed = subprocess.run(
|
|
60
|
+
["python3", "scripts/validate-rules.py", "code", "--report-only"],
|
|
61
|
+
check=False,
|
|
62
|
+
stdout=subprocess.DEVNULL,
|
|
63
|
+
stderr=subprocess.DEVNULL,
|
|
64
|
+
timeout=timeout_seconds,
|
|
65
|
+
)
|
|
66
|
+
except subprocess.TimeoutExpired:
|
|
67
|
+
sys.exit(124)
|
|
68
|
+
|
|
69
|
+
sys.exit(completed.returncode)
|
|
70
|
+
PY
|
|
71
|
+
}
|
|
43
72
|
|
|
44
73
|
if [ -f "$RULE_CONFIG_PATH" ]; then
|
|
45
74
|
RULE_HARD_GATE_MODE=$(python3 - <<'PY'
|
|
@@ -91,9 +120,11 @@ case "$RULE_HARD_GATE_MODE" in
|
|
|
91
120
|
if [ "$RULE_HARD_GATE_MODE" != "report-only" ]; then
|
|
92
121
|
echo "WARNING: Unknown hard gate mode '$RULE_HARD_GATE_MODE', defaulting to report-only"
|
|
93
122
|
fi
|
|
94
|
-
|
|
123
|
+
run_rule_validation_report_only
|
|
95
124
|
VALIDATE_EXIT=$?
|
|
96
|
-
if [ "$VALIDATE_EXIT" -
|
|
125
|
+
if [ "$VALIDATE_EXIT" -eq 124 ]; then
|
|
126
|
+
echo "WARNING: Rule validation report-only timed out after ${RULE_REPORT_ONLY_TIMEOUT_SECONDS}s, continuing commit"
|
|
127
|
+
elif [ "$VALIDATE_EXIT" -ne 0 ]; then
|
|
97
128
|
echo "WARNING: Rule validation report-only command exited with $VALIDATE_EXIT, continuing commit"
|
|
98
129
|
else
|
|
99
130
|
echo "Rule validation report-only completed"
|
|
@@ -35,8 +35,12 @@ class RuleControlWorkflowTests(unittest.TestCase):
|
|
|
35
35
|
ROOT / ".codex/get-shit-done/workflows/execute-phase.md",
|
|
36
36
|
ROOT / ".claude/get-shit-done/workflows/execute-phase.md",
|
|
37
37
|
]
|
|
38
|
+
existing_paths = [workflow_path for workflow_path in workflow_paths if workflow_path.exists()]
|
|
38
39
|
|
|
39
|
-
|
|
40
|
+
if not existing_paths:
|
|
41
|
+
self.skipTest("execute-phase workflow paths are not vendored in this checkout")
|
|
42
|
+
|
|
43
|
+
for workflow_path in existing_paths:
|
|
40
44
|
content = workflow_path.read_text(encoding="utf-8")
|
|
41
45
|
self.assertIn("rule-context.mjs --files", content)
|
|
42
46
|
self.assertIn("<rule_context>", content)
|
|
@@ -46,6 +50,16 @@ class RuleControlWorkflowTests(unittest.TestCase):
|
|
|
46
50
|
self.assertIn("Rule validation backstop", content)
|
|
47
51
|
self.assertIn("python3 scripts/validate-rules.py code", content)
|
|
48
52
|
|
|
53
|
+
def test_pre_commit_report_only_timeout_guard_exists(self):
|
|
54
|
+
for hook_path in [
|
|
55
|
+
ROOT / ".githooks" / "pre-commit",
|
|
56
|
+
ROOT / "scripts" / "hooks" / "templates" / "pre-commit",
|
|
57
|
+
]:
|
|
58
|
+
content = hook_path.read_text(encoding="utf-8")
|
|
59
|
+
self.assertIn("RULE_REPORT_ONLY_TIMEOUT_SECONDS", content)
|
|
60
|
+
self.assertIn("Rule validation report-only timed out after", content)
|
|
61
|
+
self.assertIn("subprocess.TimeoutExpired", content)
|
|
62
|
+
|
|
49
63
|
|
|
50
64
|
if __name__ == "__main__":
|
|
51
65
|
unittest.main()
|