@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/dist/cli/index.js
CHANGED
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// [META] since:2026-03-03 | owner:orchestrator-team | stable:true
|
|
3
3
|
// [WHY] CLI 入口点,注册命令并初始化运行日志
|
|
4
|
+
import { createRequire } from 'module';
|
|
4
5
|
import { Command } from 'commander';
|
|
6
|
+
const require = createRequire(import.meta.url);
|
|
7
|
+
const pkg = require('../../package.json');
|
|
5
8
|
import { generateCommand } from './commands/generate.js';
|
|
6
9
|
import { initCommand } from './commands/init.js';
|
|
7
10
|
import { queryCommand } from './commands/query.js';
|
|
@@ -20,6 +23,9 @@ import { readinessGateCommand } from './commands/readiness-gate.js';
|
|
|
20
23
|
import { mcpCommand, isMcpStartInvocation } from './commands/mcp.js';
|
|
21
24
|
import { doctorCommand } from './commands/doctor.js';
|
|
22
25
|
import { benchmarkCommand } from './commands/benchmark.js';
|
|
26
|
+
import { previewCommand } from './commands/preview.js';
|
|
27
|
+
import { envContractCommand } from './commands/env-contract.js';
|
|
28
|
+
import { agentMetricsCommand } from './commands/agent-metrics/index.js';
|
|
23
29
|
import { shipCommand } from './commands/ship/index.js';
|
|
24
30
|
import { ANALYZE_COMMAND_DESCRIPTION, configureAnalyzeCommand } from './commands/analyze-options.js';
|
|
25
31
|
import { setupRuntimeLogging } from './runtime-logger.js';
|
|
@@ -96,8 +102,8 @@ async function createActionHandler(commandName, action) {
|
|
|
96
102
|
program
|
|
97
103
|
.name('mycodemap')
|
|
98
104
|
.alias('codemap') // 兼容旧命令名
|
|
99
|
-
.description(
|
|
100
|
-
.version(
|
|
105
|
+
.description(`TypeScript 代码地图工具 v${pkg.version} - 为 AI 辅助开发提供结构化上下文`)
|
|
106
|
+
.version(pkg.version)
|
|
101
107
|
.option('--apply-suggestion', 'Allow automatic execution of high-confidence remediation suggestions (confidence >= 0.8)')
|
|
102
108
|
.option('--wasm-fallback', 'Automatically use WASM fallback when native dependencies fail to compile')
|
|
103
109
|
.option('--native', 'Force native binary usage for tree-sitter and better-sqlite3 (disables WASM fallback)');
|
|
@@ -106,14 +112,22 @@ program
|
|
|
106
112
|
.description('初始化并收敛 CodeMap 项目状态')
|
|
107
113
|
.option('-y, --yes', '使用默认配置')
|
|
108
114
|
.option('--interactive', '仅显示 reconciliation preview,不写入文件')
|
|
115
|
+
.option('--profile <name>', '指定 bootstrap profile(nodejs|python|go|rust|generic),跳过自动检测')
|
|
109
116
|
.action(initCommand);
|
|
110
117
|
program
|
|
111
118
|
.command('generate')
|
|
112
119
|
.description('生成代码地图')
|
|
113
|
-
.option('-m, --mode <mode>', '
|
|
120
|
+
.option('-m, --mode <mode>', 'Parser 兼容输入;默认使用单一路径 parser,fast/smart/hybrid 将返回废弃错误', 'tree-sitter')
|
|
114
121
|
.option('-o, --output <dir>', '输出目录', '.mycodemap')
|
|
115
122
|
.option('--symbol-level', '额外 materialize symbol-level 调用依赖到代码图存储', false)
|
|
123
|
+
.option('--incremental', '基于 persisted graph truth 执行 scoped incremental refresh', false)
|
|
124
|
+
.option('--changed-files <paths...>', '显式指定 changed files,启用 incremental refresh')
|
|
125
|
+
.option('--base <rev>', '增量刷新时用于 git diff 的 base revision')
|
|
126
|
+
.option('--against <rev>', '增量刷新时用于 git diff 的 against revision')
|
|
116
127
|
.option('--ai-context', '为每个文件生成 AI 描述(需要 AI Provider)', false)
|
|
128
|
+
.option('-j, --json', 'JSON 格式输出')
|
|
129
|
+
.option('--human', '强制人类可读输出')
|
|
130
|
+
.option('--structured', '输出完全结构化的 JSON(不包含自然语言字符串,需要配合 --json 使用)')
|
|
117
131
|
.action(await createActionHandler('generate', async (options, command) => {
|
|
118
132
|
await generateCommand({
|
|
119
133
|
...options,
|
|
@@ -195,6 +209,12 @@ program.addCommand(readinessGateCommand);
|
|
|
195
209
|
program.addCommand(mcpCommand);
|
|
196
210
|
// Doctor command
|
|
197
211
|
program.addCommand(doctorCommand);
|
|
212
|
+
// Preview command
|
|
213
|
+
program.addCommand(previewCommand);
|
|
214
|
+
// Env-contract command
|
|
215
|
+
program.addCommand(envContractCommand);
|
|
216
|
+
// Agent-metrics command
|
|
217
|
+
program.addCommand(agentMetricsCommand);
|
|
198
218
|
// Benchmark command
|
|
199
219
|
program
|
|
200
220
|
.command('benchmark')
|
package/dist/cli/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA,kEAAkE;AAClE,6BAA6B;AAE7B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/cli/index.ts"],"names":[],"mappings":";AAEA,kEAAkE;AAClE,6BAA6B;AAE7B,OAAO,EAAE,aAAa,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,OAAO,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC/C,MAAM,GAAG,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAA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generic';
|
|
3
|
+
interface FileWriteAction {
|
|
4
|
+
targetPath: string;
|
|
5
|
+
content: string;
|
|
6
|
+
}
|
|
7
|
+
export interface AssistantPlan {
|
|
8
|
+
assets: InitAsset[];
|
|
9
|
+
writes: FileWriteAction[];
|
|
10
|
+
}
|
|
11
|
+
export declare function createAssistantPlan(rootDir: string, assistantProfile?: AssistantProfile, profileName?: string): AssistantPlan;
|
|
12
|
+
export declare function applyAssistantPlan(plan: AssistantPlan): Promise<void>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=assistant-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant-plan.d.ts","sourceRoot":"","sources":["../../../src/cli/init/assistant-plan.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,MAAM,MAAM,gBAAgB,GAAG,QAAQ,GAAG,OAAO,GAAG,SAAS,CAAC;AAE9D,UAAU,eAAe;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,aAAa;IAC5B,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAiKD,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,MAAM,EACf,gBAAgB,CAAC,EAAE,gBAAgB,EACnC,WAAW,CAAC,EAAE,MAAM,GACnB,aAAa,CA4Df;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC,CAK3E"}
|
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
// [META] since:2026-05-02 | owner:cli-team | stable:false
|
|
2
|
+
// [WHY] 为 init 提供 per-runtime assistant bootstrap 资产生成,让 Claude/Codex/generic 助手快速连接项目上下文
|
|
3
|
+
import { createHash } from 'node:crypto';
|
|
4
|
+
import { existsSync, readFileSync } from 'node:fs';
|
|
5
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
function hashText(text) {
|
|
8
|
+
return createHash('sha256').update(text).digest('hex').slice(0, 12);
|
|
9
|
+
}
|
|
10
|
+
function safeReadText(filePath) {
|
|
11
|
+
if (!existsSync(filePath)) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
return readFileSync(filePath, 'utf8');
|
|
15
|
+
}
|
|
16
|
+
function generateClaudeContext(_rootDir, profileName) {
|
|
17
|
+
return `# CodeMap - Claude Context
|
|
18
|
+
|
|
19
|
+
> Auto-generated by \`mycodemap init\`. Review and copy relevant sections into your project CLAUDE.md.
|
|
20
|
+
|
|
21
|
+
## Project Setup
|
|
22
|
+
|
|
23
|
+
- **Profile:** ${profileName ?? 'generic'}
|
|
24
|
+
- **Env Contract:** \`.mycodemap/env-contract.json\`
|
|
25
|
+
- **Rules:** \`.mycodemap/rules/\`
|
|
26
|
+
- **Init Receipt:** \`.mycodemap/status/init-last.json\`
|
|
27
|
+
|
|
28
|
+
## Quick Commands
|
|
29
|
+
|
|
30
|
+
\`\`\`bash
|
|
31
|
+
mycodemap doctor # Diagnose project health
|
|
32
|
+
mycodemap generate # Generate code map
|
|
33
|
+
mycodemap preview # Preview without config
|
|
34
|
+
\`\`\`
|
|
35
|
+
|
|
36
|
+
## Subagent Retrieval
|
|
37
|
+
|
|
38
|
+
For delegated-start reminders, enable the runtime hook adapter:
|
|
39
|
+
|
|
40
|
+
mycodemap env-contract --run-reminder-hook claude
|
|
41
|
+
|
|
42
|
+
When you need the Project Environment Contract directly, query:
|
|
43
|
+
|
|
44
|
+
mycodemap env-contract --for default --json
|
|
45
|
+
|
|
46
|
+
Use --for explore, --for plan, --for worker, or --for verify when the delegated role is known.
|
|
47
|
+
|
|
48
|
+
> This file is a copy-paste suggestion. Do NOT auto-rewrite your CLAUDE.md.
|
|
49
|
+
`;
|
|
50
|
+
}
|
|
51
|
+
function generateAgentsContext(_rootDir, profileName) {
|
|
52
|
+
return `# CodeMap - Agents Context
|
|
53
|
+
|
|
54
|
+
> Auto-generated by \`mycodemap init\`. Review and copy relevant sections into your project AGENTS.md.
|
|
55
|
+
|
|
56
|
+
## Project Setup
|
|
57
|
+
|
|
58
|
+
- **Profile:** ${profileName ?? 'generic'}
|
|
59
|
+
- **Env Contract:** \`.mycodemap/env-contract.json\`
|
|
60
|
+
- **Rules:** \`.mycodemap/rules/\`
|
|
61
|
+
- **Init Receipt:** \`.mycodemap/status/init-last.json\`
|
|
62
|
+
|
|
63
|
+
## Quick Commands
|
|
64
|
+
|
|
65
|
+
\`\`\`bash
|
|
66
|
+
mycodemap doctor # Diagnose project health
|
|
67
|
+
mycodemap generate # Generate code map
|
|
68
|
+
mycodemap preview # Preview without config
|
|
69
|
+
\`\`\`
|
|
70
|
+
|
|
71
|
+
## Subagent Retrieval
|
|
72
|
+
|
|
73
|
+
For delegated-start reminders, enable the runtime hook adapter:
|
|
74
|
+
|
|
75
|
+
mycodemap env-contract --run-reminder-hook codex
|
|
76
|
+
|
|
77
|
+
When you need the Project Environment Contract directly, query:
|
|
78
|
+
|
|
79
|
+
mycodemap env-contract --for default --json
|
|
80
|
+
|
|
81
|
+
Use --for explore, --for plan, --for worker, or --for verify when the delegated role is known.
|
|
82
|
+
|
|
83
|
+
> This file is a copy-paste suggestion. Do NOT auto-rewrite your AGENTS.md.
|
|
84
|
+
`;
|
|
85
|
+
}
|
|
86
|
+
function generateClaudeHookExample() {
|
|
87
|
+
return JSON.stringify({
|
|
88
|
+
_comment: 'Example Claude Code SubagentStart hook — NOT active by default. Copy to .claude/settings.json to enable.',
|
|
89
|
+
hooks: {
|
|
90
|
+
SubagentStart: [
|
|
91
|
+
{
|
|
92
|
+
matcher: '',
|
|
93
|
+
hooks: [
|
|
94
|
+
{
|
|
95
|
+
type: 'command',
|
|
96
|
+
command: 'mycodemap env-contract --run-reminder-hook claude',
|
|
97
|
+
},
|
|
98
|
+
],
|
|
99
|
+
},
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
}, null, 2);
|
|
103
|
+
}
|
|
104
|
+
function generateCodexAgentExample() {
|
|
105
|
+
return `# Example Codex agent developer_instructions — NOT active by default.
|
|
106
|
+
# Copy to .codex/agents/ to enable subagent contract retrieval.
|
|
107
|
+
|
|
108
|
+
[developer_instructions]
|
|
109
|
+
description = "Retrieve project environment contract for delegated agents"
|
|
110
|
+
|
|
111
|
+
developer_instructions = """
|
|
112
|
+
Enable the delegated-start reminder hook:
|
|
113
|
+
- mycodemap env-contract --run-reminder-hook codex
|
|
114
|
+
|
|
115
|
+
When you need the project environment contract:
|
|
116
|
+
- CLI: mycodemap env-contract --for worker --json
|
|
117
|
+
- MCP: codemap_env_contract(agentType="worker")
|
|
118
|
+
"""
|
|
119
|
+
`;
|
|
120
|
+
}
|
|
121
|
+
const ASSISTANT_ASSETS = [
|
|
122
|
+
{
|
|
123
|
+
runtime: 'claude',
|
|
124
|
+
fileName: 'claude-context.md',
|
|
125
|
+
generate: (rootDir, profileName) => generateClaudeContext(rootDir, profileName),
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
runtime: 'codex',
|
|
129
|
+
fileName: 'agents-context.md',
|
|
130
|
+
generate: (rootDir, profileName) => generateAgentsContext(rootDir, profileName),
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
runtime: 'claude',
|
|
134
|
+
fileName: 'claude-hook-example.json',
|
|
135
|
+
generate: () => generateClaudeHookExample(),
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
runtime: 'codex',
|
|
139
|
+
fileName: 'codex-agent-example.toml',
|
|
140
|
+
generate: () => generateCodexAgentExample(),
|
|
141
|
+
},
|
|
142
|
+
];
|
|
143
|
+
function assetKey(fileName) {
|
|
144
|
+
const base = fileName.replace(/\.[^.]+$/, '');
|
|
145
|
+
return `assistant:${base}`;
|
|
146
|
+
}
|
|
147
|
+
export function createAssistantPlan(rootDir, assistantProfile, profileName) {
|
|
148
|
+
const assets = [];
|
|
149
|
+
const writes = [];
|
|
150
|
+
for (const def of ASSISTANT_ASSETS) {
|
|
151
|
+
if (assistantProfile && def.runtime !== assistantProfile) {
|
|
152
|
+
continue;
|
|
153
|
+
}
|
|
154
|
+
const targetPath = path.join(rootDir, '.mycodemap', 'assistants', def.fileName);
|
|
155
|
+
const content = def.generate(rootDir, profileName);
|
|
156
|
+
const key = assetKey(def.fileName);
|
|
157
|
+
const currentText = safeReadText(targetPath);
|
|
158
|
+
if (currentText === content) {
|
|
159
|
+
assets.push({
|
|
160
|
+
key,
|
|
161
|
+
label: def.fileName,
|
|
162
|
+
status: 'already-synced',
|
|
163
|
+
ownership: 'tool-owned',
|
|
164
|
+
origin: 'assistant-bootstrap',
|
|
165
|
+
path: targetPath,
|
|
166
|
+
details: [`${def.fileName} 已同步,无需更新`],
|
|
167
|
+
hash: hashText(content),
|
|
168
|
+
});
|
|
169
|
+
continue;
|
|
170
|
+
}
|
|
171
|
+
if (currentText !== undefined) {
|
|
172
|
+
assets.push({
|
|
173
|
+
key,
|
|
174
|
+
label: def.fileName,
|
|
175
|
+
status: 'conflict',
|
|
176
|
+
ownership: 'tool-owned',
|
|
177
|
+
origin: 'assistant-bootstrap',
|
|
178
|
+
path: targetPath,
|
|
179
|
+
details: [
|
|
180
|
+
`检测到 .mycodemap/assistants/${def.fileName} 与预期内容存在差异;本次不会自动覆盖`,
|
|
181
|
+
],
|
|
182
|
+
hash: hashText(content),
|
|
183
|
+
manualAction: `手动审阅 .mycodemap/assistants/${def.fileName} 的内容,确认后可删除该文件再重跑 init`,
|
|
184
|
+
});
|
|
185
|
+
continue;
|
|
186
|
+
}
|
|
187
|
+
writes.push({ targetPath, content });
|
|
188
|
+
assets.push({
|
|
189
|
+
key,
|
|
190
|
+
label: def.fileName,
|
|
191
|
+
status: 'installed',
|
|
192
|
+
ownership: 'tool-owned',
|
|
193
|
+
origin: 'assistant-bootstrap',
|
|
194
|
+
path: targetPath,
|
|
195
|
+
details: [`将生成 .mycodemap/assistants/${def.fileName}`],
|
|
196
|
+
hash: hashText(content),
|
|
197
|
+
rollbackHint: `如需回退,可删除 .mycodemap/assistants/${def.fileName}`,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
return { assets, writes };
|
|
201
|
+
}
|
|
202
|
+
export async function applyAssistantPlan(plan) {
|
|
203
|
+
for (const writeAction of plan.writes) {
|
|
204
|
+
await mkdir(path.dirname(writeAction.targetPath), { recursive: true });
|
|
205
|
+
await writeFile(writeAction.targetPath, writeAction.content, 'utf8');
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
//# sourceMappingURL=assistant-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assistant-plan.js","sourceRoot":"","sources":["../../../src/cli/init/assistant-plan.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,0FAA0F;AAE1F,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,IAAI,MAAM,WAAW,CAAC;AAqB7B,SAAS,QAAQ,CAAC,IAAY;IAC5B,OAAO,UAAU,CAAC,QAAQ,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;AACtE,CAAC;AAED,SAAS,YAAY,CAAC,QAAgB;IACpC,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QAC1B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,YAAY,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;AACxC,CAAC;AAED,SAAS,qBAAqB,CAAC,QAAgB,EAAE,WAAoB;IACnE,OAAO;;;;;;iBAMQ,WAAW,IA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interface DetectionCandidate {
|
|
3
|
+
type: ProjectType;
|
|
4
|
+
markerFile: string;
|
|
5
|
+
confidence: 'high' | 'low';
|
|
6
|
+
}
|
|
7
|
+
export interface DetectionResult {
|
|
8
|
+
candidates: DetectionCandidate[];
|
|
9
|
+
recommended: ProjectType | null;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Detect dominant project type by marker files only.
|
|
13
|
+
*
|
|
14
|
+
* - 0 markers → `{ candidates: [], recommended: null }` (caller must refuse per D-04).
|
|
15
|
+
* - 1 marker → `{ candidates: [...], recommended: <type> }`.
|
|
16
|
+
* - 2+ markers → `{ candidates: [...], recommended: null }` forces disambiguation per D-02.
|
|
17
|
+
*
|
|
18
|
+
* Pure function: synchronous existsSync; no content reads; no process.exit.
|
|
19
|
+
*/
|
|
20
|
+
export declare function detectProjectType(rootDir: string): DetectionResult;
|
|
21
|
+
/**
|
|
22
|
+
* Interactive numeric-choice prompt for multi-marker disambiguation.
|
|
23
|
+
*
|
|
24
|
+
* Caller must verify TTY availability (D-12) before invoking this; non-TTY
|
|
25
|
+
* callers should require `--profile <name>` instead.
|
|
26
|
+
*/
|
|
27
|
+
export declare function promptForProfileSelection(candidates: DetectionCandidate[]): Promise<ProjectType>;
|
|
28
|
+
//# sourceMappingURL=detect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect.d.ts","sourceRoot":"","sources":["../../../src/cli/init/detect.ts"],"names":[],"mappings":"AAUA,MAAM,MAAM,WAAW,GAAG,QAAQ,GAAG,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,SAAS,CAAC;AAE1E,MAAM,WAAW,kBAAkB;IACjC,IAAI,EAAE,WAAW,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,GAAG,KAAK,CAAC;CAC5B;AAED,MAAM,WAAW,eAAe;IAC9B,UAAU,EAAE,kBAAkB,EAAE,CAAC;IACjC,WAAW,EAAE,WAAW,GAAG,IAAI,CAAC;CACjC;AASD;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,CAiBlE;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,UAAU,EAAE,kBAAkB,EAAE,GAC/B,OAAO,CAAC,WAAW,CAAC,CAiBtB"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
// [META] since:2026-05-01 | owner:cli-team | stable:false
|
|
2
|
+
// [WHY] Phase 53 marker-only project type detection for `mycodemap init`.
|
|
3
|
+
// Detects nodejs/python/go/rust by marker files (no content sniffing); supports
|
|
4
|
+
// interactive disambiguation when multiple markers coexist.
|
|
5
|
+
import { existsSync } from 'node:fs';
|
|
6
|
+
import path from 'node:path';
|
|
7
|
+
import { createInterface } from 'node:readline/promises';
|
|
8
|
+
import { stdin as input, stdout as output } from 'node:process';
|
|
9
|
+
const MARKER_MAP = Object.freeze({
|
|
10
|
+
'package.json': 'nodejs',
|
|
11
|
+
'pyproject.toml': 'python',
|
|
12
|
+
'go.mod': 'go',
|
|
13
|
+
'Cargo.toml': 'rust',
|
|
14
|
+
});
|
|
15
|
+
/**
|
|
16
|
+
* Detect dominant project type by marker files only.
|
|
17
|
+
*
|
|
18
|
+
* - 0 markers → `{ candidates: [], recommended: null }` (caller must refuse per D-04).
|
|
19
|
+
* - 1 marker → `{ candidates: [...], recommended: <type> }`.
|
|
20
|
+
* - 2+ markers → `{ candidates: [...], recommended: null }` forces disambiguation per D-02.
|
|
21
|
+
*
|
|
22
|
+
* Pure function: synchronous existsSync; no content reads; no process.exit.
|
|
23
|
+
*/
|
|
24
|
+
export function detectProjectType(rootDir) {
|
|
25
|
+
const candidates = [];
|
|
26
|
+
for (const [file, type] of Object.entries(MARKER_MAP)) {
|
|
27
|
+
if (existsSync(path.join(rootDir, file))) {
|
|
28
|
+
candidates.push({ type, markerFile: file, confidence: 'high' });
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
if (candidates.length === 0) {
|
|
32
|
+
return { candidates: [], recommended: null };
|
|
33
|
+
}
|
|
34
|
+
if (candidates.length === 1) {
|
|
35
|
+
return { candidates, recommended: candidates[0].type };
|
|
36
|
+
}
|
|
37
|
+
return { candidates, recommended: null };
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Interactive numeric-choice prompt for multi-marker disambiguation.
|
|
41
|
+
*
|
|
42
|
+
* Caller must verify TTY availability (D-12) before invoking this; non-TTY
|
|
43
|
+
* callers should require `--profile <name>` instead.
|
|
44
|
+
*/
|
|
45
|
+
export async function promptForProfileSelection(candidates) {
|
|
46
|
+
console.log('检测到多个项目类型标记:');
|
|
47
|
+
candidates.forEach((c, i) => {
|
|
48
|
+
console.log(` ${i + 1}) ${c.type} (${c.markerFile})`);
|
|
49
|
+
});
|
|
50
|
+
const readline = createInterface({ input, output });
|
|
51
|
+
try {
|
|
52
|
+
const answer = await readline.question('请选择 (输入编号): ');
|
|
53
|
+
const index = parseInt(answer.trim(), 10) - 1;
|
|
54
|
+
if (Number.isInteger(index) && index >= 0 && index < candidates.length) {
|
|
55
|
+
return candidates[index].type;
|
|
56
|
+
}
|
|
57
|
+
throw new Error('无效选择');
|
|
58
|
+
}
|
|
59
|
+
finally {
|
|
60
|
+
readline.close();
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=detect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"detect.js","sourceRoot":"","sources":["../../../src/cli/init/detect.ts"],"names":[],"mappings":"AAAA,0DAA0D;AAC1D,0EAA0E;AAC1E,gFAAgF;AAChF,4DAA4D;AAE5D,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,MAAM,IAAI,MAAM,EAAE,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AC,IAAI,KAAK,CAAC,CAAC,UAAU,GAAG,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,MAAM,QAAQ,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,CAAC,CAAC;IACpD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;QACvD,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC;QAC9C,IAAI,MAAM,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,IAAI,KAAK,GAAG,UAAU,CAAC,MAAM,EAAE,CAAC;YACvE,OAAO,UAAU,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC;QAChC,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,MAAM,CAAC,CAAC;IAC1B,CAAC;YAAS,CAAC;QACT,QAAQ,CAAC,KAAK,EAAE,CAAC;IACnB,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { InitAsset } from './reconciler.js';
|
|
2
|
+
interface FileWriteAction {
|
|
3
|
+
targetPath: string;
|
|
4
|
+
content: string;
|
|
5
|
+
}
|
|
6
|
+
export interface EnvContractPlan {
|
|
7
|
+
assets: InitAsset[];
|
|
8
|
+
writes: FileWriteAction[];
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Build an EnvContractPlan describing the env-contract.json decision.
|
|
12
|
+
*
|
|
13
|
+
* States:
|
|
14
|
+
* - file exists + same content → already-synced
|
|
15
|
+
* - file exists + seed v1 → migrate + installed (deterministic)
|
|
16
|
+
* - file exists + different + not seed → conflict (manual review)
|
|
17
|
+
* - file missing + preview mode → skipped
|
|
18
|
+
* - file missing + apply mode → installed + write action
|
|
19
|
+
*/
|
|
20
|
+
export declare function createEnvContractPlan(rootDir: string, profileName?: string, mode?: 'preview' | 'apply', options?: {
|
|
21
|
+
generatedAt?: string;
|
|
22
|
+
}): EnvContractPlan;
|
|
23
|
+
/**
|
|
24
|
+
* Apply the env-contract plan: write the JSON file to disk.
|
|
25
|
+
*/
|
|
26
|
+
export declare function applyEnvContractPlan(plan: EnvContractPlan): Promise<void>;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=env-contract-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-contract-plan.d.ts","sourceRoot":"","sources":["../../../src/cli/init/env-contract-plan.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAKjD,UAAU,eAAe;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,SAAS,EAAE,CAAC;IACpB,MAAM,EAAE,eAAe,EAAE,CAAC;CAC3B;AAiDD;;;;;;;;;GASG;AACH,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,MAAM,EACf,WAAW,CAAC,EAAE,MAAM,EACpB,IAAI,GAAE,SAAS,GAAG,OAAiB,EACnC,OAAO,CAAC,EAAE;IAAE,WAAW,CAAC,EAAE,MAAM,CAAA;CAAE,GACjC,eAAe,CAqIjB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAK/E"}
|