@mycodemap/mycodemap 0.4.1 → 0.5.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.
Files changed (309) hide show
  1. package/CHANGELOG.md +100 -0
  2. package/README.md +307 -243
  3. package/dist/ai/claude.d.ts +38 -0
  4. package/dist/ai/claude.d.ts.map +1 -0
  5. package/dist/ai/claude.js +169 -0
  6. package/dist/ai/claude.js.map +1 -0
  7. package/dist/ai/codex.d.ts +38 -0
  8. package/dist/ai/codex.d.ts.map +1 -0
  9. package/dist/ai/codex.js +169 -0
  10. package/dist/ai/codex.js.map +1 -0
  11. package/dist/ai/factory.d.ts +48 -0
  12. package/dist/ai/factory.d.ts.map +1 -0
  13. package/dist/ai/factory.js +95 -0
  14. package/dist/ai/factory.js.map +1 -0
  15. package/dist/ai/index.d.ts +12 -0
  16. package/dist/ai/index.d.ts.map +1 -0
  17. package/dist/ai/index.js +29 -0
  18. package/dist/ai/index.js.map +1 -0
  19. package/dist/ai/provider.d.ts +70 -0
  20. package/dist/ai/provider.d.ts.map +1 -0
  21. package/dist/ai/provider.js +31 -0
  22. package/dist/ai/provider.js.map +1 -0
  23. package/dist/ai/subagent-caller.d.ts +90 -0
  24. package/dist/ai/subagent-caller.d.ts.map +1 -0
  25. package/dist/ai/subagent-caller.js +280 -0
  26. package/dist/ai/subagent-caller.js.map +1 -0
  27. package/dist/ai/types.d.ts +70 -0
  28. package/dist/ai/types.d.ts.map +1 -0
  29. package/dist/ai/types.js +5 -0
  30. package/dist/ai/types.js.map +1 -0
  31. package/dist/cli/commands/analyze-options.d.ts +36 -0
  32. package/dist/cli/commands/analyze-options.d.ts.map +1 -0
  33. package/dist/cli/commands/analyze-options.js +147 -0
  34. package/dist/cli/commands/analyze-options.js.map +1 -0
  35. package/dist/cli/commands/analyze.d.ts +93 -4
  36. package/dist/cli/commands/analyze.d.ts.map +1 -1
  37. package/dist/cli/commands/analyze.js +592 -176
  38. package/dist/cli/commands/analyze.js.map +1 -1
  39. package/dist/cli/commands/ci.d.ts +47 -1
  40. package/dist/cli/commands/ci.d.ts.map +1 -1
  41. package/dist/cli/commands/ci.js +208 -1
  42. package/dist/cli/commands/ci.js.map +1 -1
  43. package/dist/cli/commands/design.d.ts +47 -0
  44. package/dist/cli/commands/design.d.ts.map +1 -0
  45. package/dist/cli/commands/design.js +268 -0
  46. package/dist/cli/commands/design.js.map +1 -0
  47. package/dist/cli/commands/export.d.ts.map +1 -1
  48. package/dist/cli/commands/export.js +2 -2
  49. package/dist/cli/commands/export.js.map +1 -1
  50. package/dist/cli/commands/generate.d.ts +8 -2
  51. package/dist/cli/commands/generate.d.ts.map +1 -1
  52. package/dist/cli/commands/generate.js +151 -22
  53. package/dist/cli/commands/generate.js.map +1 -1
  54. package/dist/cli/commands/init.d.ts.map +1 -1
  55. package/dist/cli/commands/init.js +2 -13
  56. package/dist/cli/commands/init.js.map +1 -1
  57. package/dist/cli/commands/server.d.ts.map +1 -1
  58. package/dist/cli/commands/server.js +2 -5
  59. package/dist/cli/commands/server.js.map +1 -1
  60. package/dist/cli/commands/ship/checker.d.ts.map +1 -1
  61. package/dist/cli/commands/ship/checker.js +0 -3
  62. package/dist/cli/commands/ship/checker.js.map +1 -1
  63. package/dist/cli/commands/ship/pipeline.d.ts.map +1 -1
  64. package/dist/cli/commands/ship/pipeline.js +8 -1
  65. package/dist/cli/commands/ship/pipeline.js.map +1 -1
  66. package/dist/cli/commands/ship/publisher.d.ts +9 -1
  67. package/dist/cli/commands/ship/publisher.d.ts.map +1 -1
  68. package/dist/cli/commands/ship/publisher.js +149 -6
  69. package/dist/cli/commands/ship/publisher.js.map +1 -1
  70. package/dist/cli/commands/ship/rules/quality-rules.d.ts +0 -1
  71. package/dist/cli/commands/ship/rules/quality-rules.d.ts.map +1 -1
  72. package/dist/cli/commands/ship/rules/quality-rules.js +4 -76
  73. package/dist/cli/commands/ship/rules/quality-rules.js.map +1 -1
  74. package/dist/cli/commands/workflow.js +4 -4
  75. package/dist/cli/commands/workflow.js.map +1 -1
  76. package/dist/cli/config-loader.d.ts +31 -0
  77. package/dist/cli/config-loader.d.ts.map +1 -0
  78. package/dist/cli/config-loader.js +235 -0
  79. package/dist/cli/config-loader.js.map +1 -0
  80. package/dist/cli/design-contract-loader.d.ts +15 -0
  81. package/dist/cli/design-contract-loader.d.ts.map +1 -0
  82. package/dist/cli/design-contract-loader.js +175 -0
  83. package/dist/cli/design-contract-loader.js.map +1 -0
  84. package/dist/cli/design-contract-schema.d.ts +11 -0
  85. package/dist/cli/design-contract-schema.d.ts.map +1 -0
  86. package/dist/cli/design-contract-schema.js +75 -0
  87. package/dist/cli/design-contract-schema.js.map +1 -0
  88. package/dist/cli/design-handoff-builder.d.ts +15 -0
  89. package/dist/cli/design-handoff-builder.d.ts.map +1 -0
  90. package/dist/cli/design-handoff-builder.js +345 -0
  91. package/dist/cli/design-handoff-builder.js.map +1 -0
  92. package/dist/cli/design-scope-resolver.d.ts +8 -0
  93. package/dist/cli/design-scope-resolver.d.ts.map +1 -0
  94. package/dist/cli/design-scope-resolver.js +712 -0
  95. package/dist/cli/design-scope-resolver.js.map +1 -0
  96. package/dist/cli/design-verification-builder.d.ts +8 -0
  97. package/dist/cli/design-verification-builder.d.ts.map +1 -0
  98. package/dist/cli/design-verification-builder.js +369 -0
  99. package/dist/cli/design-verification-builder.js.map +1 -0
  100. package/dist/cli/index.js +20 -63
  101. package/dist/cli/index.js.map +1 -1
  102. package/dist/cli/removed-commands.d.ts +9 -0
  103. package/dist/cli/removed-commands.d.ts.map +1 -0
  104. package/dist/cli/removed-commands.js +48 -0
  105. package/dist/cli/removed-commands.js.map +1 -0
  106. package/dist/cli/storage-runtime.d.ts +8 -0
  107. package/dist/cli/storage-runtime.d.ts.map +1 -0
  108. package/dist/cli/storage-runtime.js +14 -0
  109. package/dist/cli/storage-runtime.js.map +1 -0
  110. package/dist/cli/tree-sitter-check.d.ts.map +1 -1
  111. package/dist/cli/tree-sitter-check.js +0 -1
  112. package/dist/cli/tree-sitter-check.js.map +1 -1
  113. package/dist/cli-new/commands/export.d.ts.map +1 -1
  114. package/dist/cli-new/commands/export.js +2 -2
  115. package/dist/cli-new/commands/export.js.map +1 -1
  116. package/dist/cli-new/commands/query.d.ts.map +1 -1
  117. package/dist/cli-new/commands/query.js +5 -4
  118. package/dist/cli-new/commands/query.js.map +1 -1
  119. package/dist/cli-new/commands/server.d.ts.map +1 -1
  120. package/dist/cli-new/commands/server.js +2 -6
  121. package/dist/cli-new/commands/server.js.map +1 -1
  122. package/dist/cli-new/index.d.ts.map +1 -1
  123. package/dist/cli-new/index.js +0 -2
  124. package/dist/cli-new/index.js.map +1 -1
  125. package/dist/core/analyzer.d.ts.map +1 -1
  126. package/dist/core/analyzer.js +7 -39
  127. package/dist/core/analyzer.js.map +1 -1
  128. package/dist/core/file-discovery.d.ts +17 -0
  129. package/dist/core/file-discovery.d.ts.map +1 -0
  130. package/dist/core/file-discovery.js +75 -0
  131. package/dist/core/file-discovery.js.map +1 -0
  132. package/dist/core/global-index.d.ts +5 -0
  133. package/dist/core/global-index.d.ts.map +1 -1
  134. package/dist/core/global-index.js +71 -21
  135. package/dist/core/global-index.js.map +1 -1
  136. package/dist/generator/ai-overview.d.ts +51 -0
  137. package/dist/generator/ai-overview.d.ts.map +1 -0
  138. package/dist/generator/ai-overview.js +160 -0
  139. package/dist/generator/ai-overview.js.map +1 -0
  140. package/dist/generator/index.d.ts.map +1 -1
  141. package/dist/generator/index.js +8 -0
  142. package/dist/generator/index.js.map +1 -1
  143. package/dist/infrastructure/parser/implementations/GoParser.d.ts +2 -5
  144. package/dist/infrastructure/parser/implementations/GoParser.d.ts.map +1 -1
  145. package/dist/infrastructure/parser/implementations/GoParser.js +2 -5
  146. package/dist/infrastructure/parser/implementations/GoParser.js.map +1 -1
  147. package/dist/infrastructure/parser/implementations/PythonParser.d.ts +1 -5
  148. package/dist/infrastructure/parser/implementations/PythonParser.d.ts.map +1 -1
  149. package/dist/infrastructure/parser/implementations/PythonParser.js +1 -5
  150. package/dist/infrastructure/parser/implementations/PythonParser.js.map +1 -1
  151. package/dist/infrastructure/parser/implementations/TypeScriptParser.d.ts +1 -5
  152. package/dist/infrastructure/parser/implementations/TypeScriptParser.d.ts.map +1 -1
  153. package/dist/infrastructure/parser/implementations/TypeScriptParser.js +1 -5
  154. package/dist/infrastructure/parser/implementations/TypeScriptParser.js.map +1 -1
  155. package/dist/infrastructure/storage/StorageFactory.d.ts +12 -6
  156. package/dist/infrastructure/storage/StorageFactory.d.ts.map +1 -1
  157. package/dist/infrastructure/storage/StorageFactory.js +59 -43
  158. package/dist/infrastructure/storage/StorageFactory.js.map +1 -1
  159. package/dist/infrastructure/storage/adapters/FileSystemStorage.d.ts.map +1 -1
  160. package/dist/infrastructure/storage/adapters/FileSystemStorage.js +24 -137
  161. package/dist/infrastructure/storage/adapters/FileSystemStorage.js.map +1 -1
  162. package/dist/infrastructure/storage/adapters/KuzuDBStorage.d.ts +10 -18
  163. package/dist/infrastructure/storage/adapters/KuzuDBStorage.d.ts.map +1 -1
  164. package/dist/infrastructure/storage/adapters/KuzuDBStorage.js +103 -146
  165. package/dist/infrastructure/storage/adapters/KuzuDBStorage.js.map +1 -1
  166. package/dist/infrastructure/storage/adapters/MemoryStorage.d.ts +0 -1
  167. package/dist/infrastructure/storage/adapters/MemoryStorage.d.ts.map +1 -1
  168. package/dist/infrastructure/storage/adapters/MemoryStorage.js +16 -136
  169. package/dist/infrastructure/storage/adapters/MemoryStorage.js.map +1 -1
  170. package/dist/infrastructure/storage/adapters/Neo4jStorage.d.ts +9 -17
  171. package/dist/infrastructure/storage/adapters/Neo4jStorage.d.ts.map +1 -1
  172. package/dist/infrastructure/storage/adapters/Neo4jStorage.js +78 -138
  173. package/dist/infrastructure/storage/adapters/Neo4jStorage.js.map +1 -1
  174. package/dist/infrastructure/storage/graph-helpers.d.ts +16 -0
  175. package/dist/infrastructure/storage/graph-helpers.d.ts.map +1 -0
  176. package/dist/infrastructure/storage/graph-helpers.js +161 -0
  177. package/dist/infrastructure/storage/graph-helpers.js.map +1 -0
  178. package/dist/infrastructure/storage/index.d.ts.map +1 -1
  179. package/dist/interface/config/index.d.ts +10 -1
  180. package/dist/interface/config/index.d.ts.map +1 -1
  181. package/dist/interface/types/design-contract.d.ts +68 -0
  182. package/dist/interface/types/design-contract.d.ts.map +1 -0
  183. package/dist/interface/types/design-contract.js +7 -0
  184. package/dist/interface/types/design-contract.js.map +1 -0
  185. package/dist/interface/types/design-handoff.d.ts +68 -0
  186. package/dist/interface/types/design-handoff.d.ts.map +1 -0
  187. package/dist/interface/types/design-handoff.js +4 -0
  188. package/dist/interface/types/design-handoff.js.map +1 -0
  189. package/dist/interface/types/design-mapping.d.ts +51 -0
  190. package/dist/interface/types/design-mapping.d.ts.map +1 -0
  191. package/dist/interface/types/design-mapping.js +4 -0
  192. package/dist/interface/types/design-mapping.js.map +1 -0
  193. package/dist/interface/types/design-verification.d.ts +49 -0
  194. package/dist/interface/types/design-verification.d.ts.map +1 -0
  195. package/dist/interface/types/design-verification.js +4 -0
  196. package/dist/interface/types/design-verification.js.map +1 -0
  197. package/dist/interface/types/index.d.ts +17 -0
  198. package/dist/interface/types/index.d.ts.map +1 -1
  199. package/dist/interface/types/storage.d.ts +1 -4
  200. package/dist/interface/types/storage.d.ts.map +1 -1
  201. package/dist/orchestrator/ai-feed-generator.d.ts +210 -0
  202. package/dist/orchestrator/ai-feed-generator.d.ts.map +1 -0
  203. package/dist/orchestrator/ai-feed-generator.js +377 -0
  204. package/dist/orchestrator/ai-feed-generator.js.map +1 -0
  205. package/dist/orchestrator/confidence.d.ts +9 -9
  206. package/dist/orchestrator/confidence.d.ts.map +1 -1
  207. package/dist/orchestrator/confidence.js +44 -67
  208. package/dist/orchestrator/confidence.js.map +1 -1
  209. package/dist/orchestrator/file-header-scanner.d.ts.map +1 -1
  210. package/dist/orchestrator/file-header-scanner.js +22 -31
  211. package/dist/orchestrator/file-header-scanner.js.map +1 -1
  212. package/dist/orchestrator/intent-router.d.ts +2 -11
  213. package/dist/orchestrator/intent-router.d.ts.map +1 -1
  214. package/dist/orchestrator/intent-router.js +58 -49
  215. package/dist/orchestrator/intent-router.js.map +1 -1
  216. package/dist/orchestrator/tool-orchestrator.d.ts.map +1 -1
  217. package/dist/orchestrator/tool-orchestrator.js +6 -4
  218. package/dist/orchestrator/tool-orchestrator.js.map +1 -1
  219. package/dist/orchestrator/types.d.ts +113 -2
  220. package/dist/orchestrator/types.d.ts.map +1 -1
  221. package/dist/orchestrator/types.js +29 -0
  222. package/dist/orchestrator/types.js.map +1 -1
  223. package/dist/orchestrator/workflow/config.d.ts +4 -12
  224. package/dist/orchestrator/workflow/config.d.ts.map +1 -1
  225. package/dist/orchestrator/workflow/config.js +4 -6
  226. package/dist/orchestrator/workflow/config.js.map +1 -1
  227. package/dist/orchestrator/workflow/git-analyzer.d.ts.map +1 -1
  228. package/dist/orchestrator/workflow/git-analyzer.js +9 -19
  229. package/dist/orchestrator/workflow/git-analyzer.js.map +1 -1
  230. package/dist/orchestrator/workflow/phase-inheritance.d.ts.map +1 -1
  231. package/dist/orchestrator/workflow/phase-inheritance.js +14 -23
  232. package/dist/orchestrator/workflow/phase-inheritance.js.map +1 -1
  233. package/dist/orchestrator/workflow/result-fusion.d.ts.map +1 -1
  234. package/dist/orchestrator/workflow/result-fusion.js +9 -11
  235. package/dist/orchestrator/workflow/result-fusion.js.map +1 -1
  236. package/dist/orchestrator/workflow/templates.d.ts +4 -1
  237. package/dist/orchestrator/workflow/templates.d.ts.map +1 -1
  238. package/dist/orchestrator/workflow/templates.js +49 -207
  239. package/dist/orchestrator/workflow/templates.js.map +1 -1
  240. package/dist/orchestrator/workflow/test-linker.d.ts.map +1 -1
  241. package/dist/orchestrator/workflow/test-linker.js +12 -24
  242. package/dist/orchestrator/workflow/test-linker.js.map +1 -1
  243. package/dist/orchestrator/workflow/types.d.ts +11 -8
  244. package/dist/orchestrator/workflow/types.d.ts.map +1 -1
  245. package/dist/orchestrator/workflow/types.js +8 -1
  246. package/dist/orchestrator/workflow/types.js.map +1 -1
  247. package/dist/orchestrator/workflow/visualizer.d.ts.map +1 -1
  248. package/dist/orchestrator/workflow/visualizer.js +7 -9
  249. package/dist/orchestrator/workflow/visualizer.js.map +1 -1
  250. package/dist/orchestrator/workflow/workflow-context.d.ts.map +1 -1
  251. package/dist/orchestrator/workflow/workflow-context.js +3 -5
  252. package/dist/orchestrator/workflow/workflow-context.js.map +1 -1
  253. package/dist/orchestrator/workflow/workflow-orchestrator.d.ts +0 -4
  254. package/dist/orchestrator/workflow/workflow-orchestrator.d.ts.map +1 -1
  255. package/dist/orchestrator/workflow/workflow-orchestrator.js +7 -99
  256. package/dist/orchestrator/workflow/workflow-orchestrator.js.map +1 -1
  257. package/dist/parser/index.d.ts.map +1 -1
  258. package/dist/parser/index.js +2 -2
  259. package/dist/parser/index.js.map +1 -1
  260. package/dist/plugins/index.d.ts +5 -3
  261. package/dist/plugins/index.d.ts.map +1 -1
  262. package/dist/plugins/index.js +19 -8
  263. package/dist/plugins/index.js.map +1 -1
  264. package/dist/plugins/plugin-loader.d.ts +21 -6
  265. package/dist/plugins/plugin-loader.d.ts.map +1 -1
  266. package/dist/plugins/plugin-loader.js +170 -54
  267. package/dist/plugins/plugin-loader.js.map +1 -1
  268. package/dist/plugins/plugin-registry.d.ts +7 -4
  269. package/dist/plugins/plugin-registry.d.ts.map +1 -1
  270. package/dist/plugins/plugin-registry.js +62 -14
  271. package/dist/plugins/plugin-registry.js.map +1 -1
  272. package/dist/plugins/types.d.ts +16 -6
  273. package/dist/plugins/types.d.ts.map +1 -1
  274. package/dist/plugins/types.js +2 -0
  275. package/dist/plugins/types.js.map +1 -1
  276. package/dist/server/handlers/AnalysisHandler.d.ts +16 -2
  277. package/dist/server/handlers/AnalysisHandler.d.ts.map +1 -1
  278. package/dist/server/handlers/AnalysisHandler.js +31 -47
  279. package/dist/server/handlers/AnalysisHandler.js.map +1 -1
  280. package/dist/server/routes/api.d.ts.map +1 -1
  281. package/dist/server/routes/api.js +31 -12
  282. package/dist/server/routes/api.js.map +1 -1
  283. package/docs/AI_ASSISTANT_SETUP.md +3 -1
  284. package/docs/SETUP_GUIDE.md +41 -17
  285. package/docs/ai-guide/COMMANDS.md +179 -102
  286. package/docs/ai-guide/INTEGRATION.md +23 -21
  287. package/docs/ai-guide/OUTPUT.md +621 -10
  288. package/docs/ai-guide/PATTERNS.md +77 -18
  289. package/docs/ai-guide/PROMPTS.md +24 -18
  290. package/docs/ai-guide/QUICKSTART.md +35 -19
  291. package/docs/ai-guide/README.md +22 -4
  292. package/docs/archive/test-report-symbol-search.md +384 -0
  293. package/docs/archive/test-scenario-4-complexity-analysis.md +460 -0
  294. package/docs/archive/test_report_scenario5.md +615 -0
  295. package/docs/archive/test_scenario_3_impact_analysis_report.md +520 -0
  296. package/docs/product-specs/DESIGN_CONTRACT_TEMPLATE.md +79 -0
  297. package/docs/product-specs/MVP3-ARCHITECTURE-COMPARISON.md +159 -434
  298. package/docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-PRD.md +169 -261
  299. package/docs/product-specs/MVP3-ARCHITECTURE-REDESIGN-TECH-PRD.md +201 -1259
  300. package/docs/product-specs/README.md +9 -1
  301. package/docs/rules/architecture-guardrails.md +1 -2
  302. package/docs/rules/engineering-with-codex-openai.md +20 -10
  303. package/docs/rules/validation.md +29 -4
  304. package/mycodemap.config.schema.json +76 -5
  305. package/package.json +1 -1
  306. package/scripts/experiments/arcadedb-http-smoke.mjs +90 -0
  307. package/scripts/sync-analyze-docs.js +500 -0
  308. package/scripts/validate-ai-docs.js +54 -1
  309. package/scripts/validate-docs.js +992 -25
@@ -4,7 +4,18 @@
4
4
 
5
5
  ---
6
6
 
7
- ## 何时使用 --json
7
+ ## Phase 1 契约基线
8
+
9
+ | 维度 | 目标态 | 当前 CLI 现实 |
10
+ |------|--------|---------------|
11
+ | 机器可读 | 机器可读优先,适合 AI/Agent 继续处理 | 多数命令仍通过 `--json` 显式返回结构化结果 |
12
+ | 人类可读 | 显式的人类阅读入口 | `analyze` 当前支持 `--output-mode human`,其余命令多保留现有文本输出 |
13
+ | analyze 收敛 | 输出契约应逐步收敛 | 当前公共契约已固定为 `find` / `read` / `link` / `show`,legacy alias 通过 `warnings[]` 暴露迁移提示 |
14
+ | 文件发现 | 扫描类命令共享一个文件发现模块 | 先尊重仓库 `.gitignore`,无 `.gitignore` 时回退到默认 `exclude` |
15
+
16
+ ---
17
+
18
+ ## 当前 CLI 现实:何时使用 --json
8
19
 
9
20
  | 场景 | 使用 `--json` | 原因 |
10
21
  |------|--------------|------|
@@ -17,6 +28,88 @@
17
28
 
18
29
  ---
19
30
 
31
+ ## 文件发现契约
32
+
33
+ ```typescript
34
+ type DiscoveryFallbackExclude =
35
+ | "node_modules/**"
36
+ | "dist/**"
37
+ | "build/**"
38
+ | "coverage/**"
39
+ | "**/*.test.ts"
40
+ | "**/*.spec.ts"
41
+ | "**/*.d.ts";
42
+
43
+ interface DiscoveryContract {
44
+ gitignore: true;
45
+ fallbackExclude: DiscoveryFallbackExclude[];
46
+ sharedBy: ["generate", "analyze", "ci check-headers -d"];
47
+ }
48
+ ```
49
+
50
+ > `generate`、`analyze` 与 `ci check-headers -d` 会共享同一个文件发现模块;若仓库没有 `.gitignore`,则回退到上面的默认排除列表。
51
+
52
+ ---
53
+
54
+ ## generate / codemap.json 插件扩展字段
55
+
56
+ > 仅当 `mycodemap.config.json` **显式声明** `plugins` 段时,`generate` 输出才会包含 `pluginReport`。
57
+
58
+ ```typescript
59
+ interface PluginDiagnostic {
60
+ plugin?: string;
61
+ stage: "load" | "initialize" | "analyze" | "generate";
62
+ level: "warning" | "error";
63
+ message: string;
64
+ }
65
+
66
+ interface PluginExecutionReport {
67
+ loadedPlugins: string[];
68
+ generatedFiles: string[];
69
+ metrics: Record<string, unknown>;
70
+ diagnostics: PluginDiagnostic[];
71
+ }
72
+
73
+ interface CodeMap {
74
+ version: string;
75
+ generatedAt: string;
76
+ project: ProjectInfo;
77
+ summary: ProjectSummary;
78
+ modules: ModuleInfo[];
79
+ dependencies: DependencyGraph;
80
+ actualMode?: "fast" | "smart";
81
+ pluginReport?: PluginExecutionReport;
82
+ }
83
+ ```
84
+
85
+ ### 示例
86
+
87
+ ```json
88
+ {
89
+ "pluginReport": {
90
+ "loadedPlugins": ["complexity-analyzer", "my-local-plugin"],
91
+ "generatedFiles": ["plugins/good.txt"],
92
+ "metrics": {
93
+ "complexity-analyzer": {
94
+ "complexityAnalysis": {
95
+ "totalCyclomaticComplexity": 17
96
+ }
97
+ }
98
+ },
99
+ "diagnostics": [
100
+ {
101
+ "plugin": "my-local-plugin",
102
+ "stage": "analyze",
103
+ "level": "warning",
104
+ "message": "my-local-plugin warning"
105
+ }
106
+ ]
107
+ }
108
+ }
109
+ ```
110
+
111
+ ---
112
+
20
113
  ## query 命令输出结构
21
114
 
22
115
  ### JSON 输出 (-j)
@@ -101,18 +194,24 @@ interface ContextLine {
101
194
 
102
195
  ## analyze 命令输出结构
103
196
 
197
+ > 当前 `analyze` 的公共契约为 `find` / `read` / `link` / `show`;legacy alias 会在输出中返回 `warnings[]`,其中 `refactor` 不在兼容白名单内。
198
+
104
199
  ### 标准 JSON 输出 (--json)
105
200
 
106
201
  ```typescript
202
+ type AnalyzeIntent = "find" | "read" | "link" | "show";
203
+
107
204
  interface AnalyzeOutput {
108
205
  schemaVersion: "v1.0.0";
109
- intent: "impact" | "dependency" | "search" | "documentation" | "complexity" | "overview" | "refactor" | "reference";
206
+ intent: AnalyzeIntent;
110
207
  tool: string;
111
208
  confidence: {
112
209
  score: number; // 0.0 - 1.0
113
210
  level: "high" | "medium" | "low";
114
211
  };
115
212
  results: AnalyzeResult[];
213
+ warnings?: AnalyzeWarning[];
214
+ analysis?: ReadAnalysis | LinkAnalysis | ShowAnalysis;
116
215
  metadata: {
117
216
  total: number;
118
217
  scope: "direct" | "transitive";
@@ -120,6 +219,15 @@ interface AnalyzeOutput {
120
219
  };
121
220
  }
122
221
 
222
+ interface AnalyzeWarning {
223
+ code: "deprecated-intent";
224
+ severity: "warning";
225
+ message: string;
226
+ deprecatedIntent: "impact" | "dependency" | "search" | "documentation" | "complexity" | "overview" | "reference";
227
+ replacementIntent: AnalyzeIntent;
228
+ sunsetPolicy: "2-minor-window";
229
+ }
230
+
123
231
  interface AnalyzeResult {
124
232
  file: string;
125
233
  location?: {
@@ -131,10 +239,66 @@ interface AnalyzeResult {
131
239
  relevance: number; // 0.0 - 1.0
132
240
  metadata?: {
133
241
  testFile?: string; // 关联的测试文件
134
- complexity?: number; // 复杂度分数
135
- [key: string]: any;
242
+ dependencies?: string[];
243
+ impactCount?: number;
244
+ complexityMetrics?: {
245
+ cyclomatic: number;
246
+ cognitive: number;
247
+ maintainability: number;
248
+ };
249
+ riskLevel?: "high" | "medium" | "low";
250
+ [key: string]: unknown;
136
251
  };
137
252
  }
253
+
254
+ interface ReadAnalysis {
255
+ intent: "read";
256
+ impact?: Array<{
257
+ file: string;
258
+ changedFiles: string[];
259
+ transitiveDependencies: string[];
260
+ impactCount: number;
261
+ risk: "high" | "medium" | "low";
262
+ }>;
263
+ complexity?: Array<{
264
+ file: string;
265
+ metrics: {
266
+ cyclomatic: number;
267
+ cognitive: number;
268
+ maintainability: number;
269
+ };
270
+ risk: "high" | "medium" | "low";
271
+ }>;
272
+ }
273
+
274
+ interface LinkAnalysis {
275
+ intent: "link";
276
+ reference?: Array<{
277
+ target: string;
278
+ callers: string[];
279
+ callees: string[];
280
+ }>;
281
+ dependency?: Array<{
282
+ file: string;
283
+ imports: string[];
284
+ importedBy: string[];
285
+ }>;
286
+ }
287
+
288
+ interface ShowAnalysis {
289
+ intent: "show";
290
+ overview?: Array<{
291
+ title: string;
292
+ file: string;
293
+ overview: string;
294
+ exports: string[];
295
+ }>;
296
+ documentation?: Array<{
297
+ title: string;
298
+ file: string;
299
+ content: string;
300
+ }>;
301
+ }
138
302
  ```
139
303
 
140
304
  ### 纯结构化输出 (--structured --json)
@@ -144,13 +308,15 @@ interface AnalyzeResult {
144
308
  ```typescript
145
309
  interface StructuredAnalyzeOutput {
146
310
  schemaVersion: "v1.0.0";
147
- intent: string;
311
+ intent: AnalyzeIntent;
148
312
  tool: string;
149
313
  confidence: {
150
314
  score: number;
151
315
  level: "high" | "medium" | "low";
152
316
  };
153
317
  results: StructuredResult[];
318
+ warnings?: AnalyzeWarning[];
319
+ analysis?: ReadAnalysis | LinkAnalysis | ShowAnalysis;
154
320
  metadata: {
155
321
  total: number;
156
322
  scope: string;
@@ -168,7 +334,7 @@ interface StructuredResult {
168
334
  // 注意:没有 content 字段
169
335
  relevance: number;
170
336
  metadata?: {
171
- [key: string]: any;
337
+ [key: string]: unknown;
172
338
  };
173
339
  }
174
340
  ```
@@ -178,12 +344,22 @@ interface StructuredResult {
178
344
  ```json
179
345
  {
180
346
  "schemaVersion": "v1.0.0",
181
- "intent": "impact",
182
- "tool": "codemap-impact",
347
+ "intent": "read",
348
+ "tool": "codemap-read",
183
349
  "confidence": {
184
350
  "score": 0.85,
185
351
  "level": "high"
186
352
  },
353
+ "warnings": [
354
+ {
355
+ "code": "deprecated-intent",
356
+ "severity": "warning",
357
+ "message": "legacy intent \"impact\" 已弃用,请改用 \"read\"",
358
+ "deprecatedIntent": "impact",
359
+ "replacementIntent": "read",
360
+ "sunsetPolicy": "2-minor-window"
361
+ }
362
+ ],
187
363
  "results": [
188
364
  {
189
365
  "file": "src/cli/commands/analyze.ts",
@@ -192,13 +368,33 @@ interface StructuredResult {
192
368
  "line": 45,
193
369
  "column": 1
194
370
  },
195
- "content": "导入自 src/orchestrator/intent-router.ts 的 IntentRouter 类",
371
+ "content": " 3 个模块依赖",
196
372
  "relevance": 0.95,
197
373
  "metadata": {
198
- "testFile": "src/cli/commands/analyze.test.ts"
374
+ "impactCount": 3,
375
+ "dependencies": [
376
+ "src/orchestrator/intent-router.ts"
377
+ ],
378
+ "riskLevel": "medium"
199
379
  }
200
380
  }
201
381
  ],
382
+ "analysis": {
383
+ "intent": "read",
384
+ "impact": [
385
+ {
386
+ "file": "src/cli/commands/analyze.ts",
387
+ "changedFiles": [
388
+ "src/cli/commands/analyze.ts"
389
+ ],
390
+ "transitiveDependencies": [
391
+ "src/orchestrator/intent-router.ts"
392
+ ],
393
+ "impactCount": 3,
394
+ "risk": "medium"
395
+ }
396
+ ]
397
+ },
202
398
  "metadata": {
203
399
  "total": 8,
204
400
  "scope": "transitive",
@@ -209,6 +405,421 @@ interface StructuredResult {
209
405
 
210
406
  ---
211
407
 
408
+ ## design validate 命令输出结构
409
+
410
+ ### JSON 输出 (--json)
411
+
412
+ ```typescript
413
+ type DesignContractSectionId =
414
+ | "goal"
415
+ | "constraints"
416
+ | "acceptanceCriteria"
417
+ | "nonGoals"
418
+ | "context"
419
+ | "openQuestions"
420
+ | "notes";
421
+
422
+ type DesignContractDiagnosticCode =
423
+ | "file-not-found"
424
+ | "missing-section"
425
+ | "duplicate-section"
426
+ | "empty-section"
427
+ | "unknown-section"
428
+ | "ambiguous-heading";
429
+
430
+ interface DesignValidateOutput {
431
+ ok: boolean;
432
+ exists: boolean;
433
+ filePath: string;
434
+ title?: string;
435
+ missingRequiredSections: Array<"goal" | "constraints" | "acceptanceCriteria" | "nonGoals">;
436
+ diagnostics: DesignContractDiagnostic[];
437
+ sections: Array<{
438
+ id: DesignContractSectionId;
439
+ title: string;
440
+ line: number;
441
+ itemCount: number;
442
+ }>;
443
+ }
444
+
445
+ interface DesignContractDiagnostic {
446
+ code: DesignContractDiagnosticCode;
447
+ severity: "error" | "warning" | "info";
448
+ message: string;
449
+ section?: DesignContractSectionId;
450
+ heading?: string;
451
+ line?: number;
452
+ suggestion?: string;
453
+ }
454
+ ```
455
+
456
+ ### 示例
457
+
458
+ ```json
459
+ {
460
+ "ok": false,
461
+ "exists": true,
462
+ "filePath": "/repo/mycodemap.design.md",
463
+ "title": "Design Contract: Missing acceptance example",
464
+ "missingRequiredSections": [
465
+ "acceptanceCriteria"
466
+ ],
467
+ "diagnostics": [
468
+ {
469
+ "code": "missing-section",
470
+ "severity": "error",
471
+ "message": "缺少必填 section: Acceptance Criteria",
472
+ "section": "acceptanceCriteria"
473
+ }
474
+ ],
475
+ "sections": [
476
+ {
477
+ "id": "goal",
478
+ "title": "Goal",
479
+ "line": 3,
480
+ "itemCount": 1
481
+ }
482
+ ]
483
+ }
484
+ ```
485
+
486
+ > `design validate --json` 必须保持纯 JSON;不要在前后拼接说明性 prose。
487
+
488
+ ---
489
+
490
+ ## design map 命令输出结构
491
+
492
+ ### JSON 输出 (--json)
493
+
494
+ ```typescript
495
+ type DesignMappingCandidateKind = "file" | "module" | "symbol";
496
+
497
+ type DesignMappingDiagnosticCode =
498
+ | "no-candidates"
499
+ | "over-broad-scope"
500
+ | "high-risk-scope"
501
+ | string;
502
+
503
+ interface DesignMappingReason {
504
+ section: DesignContractSectionId;
505
+ matchedText: string;
506
+ evidenceType: string;
507
+ }
508
+
509
+ interface DesignMappingCandidate {
510
+ kind: DesignMappingCandidateKind;
511
+ path: string;
512
+ moduleName?: string;
513
+ symbolName?: string;
514
+ reasons: DesignMappingReason[];
515
+ dependencies: string[];
516
+ testImpact: string[];
517
+ risk: "high" | "medium" | "low";
518
+ confidence: {
519
+ score: number;
520
+ level: "high" | "medium" | "low";
521
+ };
522
+ unknowns: string[];
523
+ }
524
+
525
+ interface DesignMappingDiagnostic {
526
+ code: DesignMappingDiagnosticCode;
527
+ severity: "error" | "warning" | "info";
528
+ blocker: boolean;
529
+ message: string;
530
+ candidatePaths?: string[];
531
+ }
532
+
533
+ interface DesignMapOutput {
534
+ ok: boolean;
535
+ filePath: string;
536
+ summary: {
537
+ candidateCount: number;
538
+ blocked: boolean;
539
+ unknownCount: number;
540
+ diagnosticCount: number;
541
+ };
542
+ candidates: DesignMappingCandidate[];
543
+ diagnostics: DesignMappingDiagnostic[];
544
+ }
545
+ ```
546
+
547
+ ### 示例
548
+
549
+ ```json
550
+ {
551
+ "ok": false,
552
+ "filePath": "/repo/mycodemap.design.md",
553
+ "summary": {
554
+ "candidateCount": 1,
555
+ "blocked": true,
556
+ "unknownCount": 0,
557
+ "diagnosticCount": 1
558
+ },
559
+ "candidates": [
560
+ {
561
+ "kind": "file",
562
+ "path": "src/cli/commands/analyze.ts",
563
+ "reasons": [
564
+ {
565
+ "section": "goal",
566
+ "matchedText": "src/cli/commands/analyze.ts",
567
+ "evidenceType": "path-anchor"
568
+ }
569
+ ],
570
+ "dependencies": [],
571
+ "testImpact": [],
572
+ "risk": "high",
573
+ "confidence": {
574
+ "score": 0.92,
575
+ "level": "high"
576
+ },
577
+ "unknowns": []
578
+ }
579
+ ],
580
+ "diagnostics": [
581
+ {
582
+ "code": "high-risk-scope",
583
+ "severity": "error",
584
+ "blocker": true,
585
+ "message": "候选范围命中了高 blast-radius 文件;请先补充更具体的 design scope,再继续执行。"
586
+ }
587
+ ]
588
+ }
589
+ ```
590
+
591
+ > `design map --json` 必须保持纯 JSON;不要在前后拼接说明性 prose。`unknowns` 与 `diagnostics` 都属于正式契约,不是可选注释。
592
+
593
+ ---
594
+
595
+ ## design handoff 命令输出结构
596
+
597
+ ### JSON 输出 (--json)
598
+
599
+ ```typescript
600
+ type DesignHandoffApprovalStatus = "approved" | "needs-review";
601
+
602
+ interface DesignHandoffTraceItem {
603
+ id: string;
604
+ text: string;
605
+ sourceRefs: string[];
606
+ }
607
+
608
+ interface DesignHandoffOutput {
609
+ ok: boolean;
610
+ filePath: string;
611
+ outputDir: string;
612
+ readyForExecution: boolean;
613
+ artifacts: {
614
+ markdownPath: string;
615
+ jsonPath: string;
616
+ };
617
+ summary: {
618
+ approvalCount: number;
619
+ assumptionCount: number;
620
+ openQuestionCount: number;
621
+ requiresReview: boolean;
622
+ };
623
+ handoff: {
624
+ touchedFiles: string[];
625
+ constraints: string[];
626
+ tests: string[];
627
+ approvals: Array<DesignHandoffTraceItem & {
628
+ status: DesignHandoffApprovalStatus;
629
+ }>;
630
+ assumptions: DesignHandoffTraceItem[];
631
+ openQuestions: DesignHandoffTraceItem[];
632
+ };
633
+ diagnostics: Array<{
634
+ code: "blocked-mapping" | "review-required" | string;
635
+ blocker: boolean;
636
+ message: string;
637
+ }>;
638
+ }
639
+ ```
640
+
641
+ ### 示例
642
+
643
+ ```json
644
+ {
645
+ "ok": true,
646
+ "filePath": "/repo/mycodemap.design.md",
647
+ "outputDir": "/repo/.mycodemap/handoffs",
648
+ "readyForExecution": false,
649
+ "artifacts": {
650
+ "markdownPath": "/repo/.mycodemap/handoffs/mycodemap.handoff.md",
651
+ "jsonPath": "/repo/.mycodemap/handoffs/mycodemap.handoff.json"
652
+ },
653
+ "summary": {
654
+ "approvalCount": 4,
655
+ "assumptionCount": 1,
656
+ "openQuestionCount": 1,
657
+ "requiresReview": true
658
+ },
659
+ "handoff": {
660
+ "touchedFiles": [
661
+ "src/cli/design-handoff-builder.ts"
662
+ ],
663
+ "constraints": [
664
+ "默认 artifact path 必须复用 src/cli/paths.ts"
665
+ ],
666
+ "tests": [
667
+ "src/cli/__tests__/design-handoff-builder.test.ts"
668
+ ],
669
+ "approvals": [
670
+ {
671
+ "id": "approved-goal",
672
+ "status": "approved",
673
+ "text": "Goal 已被纳入 handoff 事实输入",
674
+ "sourceRefs": ["design:goal"]
675
+ }
676
+ ],
677
+ "assumptions": [
678
+ {
679
+ "id": "assumption-1-1",
680
+ "text": "需要补充 reviewer 对未知范围的确认",
681
+ "sourceRefs": ["candidate:src/cli/design-handoff-builder.ts"]
682
+ }
683
+ ],
684
+ "openQuestions": [
685
+ {
686
+ "id": "open-question-1",
687
+ "text": "低风险 assumptions 是否也必须显式批准?",
688
+ "sourceRefs": ["design:openQuestions"]
689
+ }
690
+ ]
691
+ },
692
+ "diagnostics": [
693
+ {
694
+ "code": "review-required",
695
+ "blocker": false,
696
+ "message": "Handoff generated successfully but still requires human review before execution."
697
+ }
698
+ ]
699
+ }
700
+ ```
701
+
702
+ > `design handoff --json` 必须保持纯 JSON;`readyForExecution`、`approvals`、`assumptions`、`openQuestions` 都属于正式契约。human mode 默认写出 `.mycodemap/handoffs/{stem}.handoff.md|json`。
703
+
704
+ ---
705
+
706
+ ## design verify 命令输出结构
707
+
708
+ ### JSON 输出 (--json)
709
+
710
+ ```typescript
711
+ type DesignVerificationStatus =
712
+ | "satisfied"
713
+ | "needs-review"
714
+ | "violated"
715
+ | "blocked";
716
+
717
+ type DesignDriftKind =
718
+ | "scope-extra"
719
+ | "acceptance-unverified"
720
+ | "handoff-missing"
721
+ | "blocked-input";
722
+
723
+ interface DesignVerificationOutput {
724
+ ok: boolean;
725
+ filePath: string;
726
+ readyForExecution: boolean;
727
+ summary: {
728
+ checklistCount: number;
729
+ satisfiedCount: number;
730
+ needsReviewCount: number;
731
+ violatedCount: number;
732
+ blockedCount: number;
733
+ driftCount: number;
734
+ diagnosticCount: number;
735
+ reviewRequired: boolean;
736
+ blocked: boolean;
737
+ };
738
+ checklist: Array<{
739
+ id: string;
740
+ text: string;
741
+ status: DesignVerificationStatus;
742
+ evidenceRefs: string[];
743
+ }>;
744
+ drift: Array<{
745
+ kind: DesignDriftKind;
746
+ severity: "error" | "warning" | "info";
747
+ message: string;
748
+ sourceRefs: string[];
749
+ }>;
750
+ diagnostics: Array<{
751
+ code: "handoff-missing" | "handoff-invalid" | "blocked-input" | string;
752
+ blocker: boolean;
753
+ message: string;
754
+ sourceRefs: string[];
755
+ }>;
756
+ }
757
+ ```
758
+
759
+ ### 示例
760
+
761
+ ```json
762
+ {
763
+ "ok": true,
764
+ "filePath": "/repo/tests/fixtures/design-contracts/verify-ready.design.md",
765
+ "readyForExecution": false,
766
+ "summary": {
767
+ "checklistCount": 3,
768
+ "satisfiedCount": 1,
769
+ "needsReviewCount": 2,
770
+ "violatedCount": 0,
771
+ "blockedCount": 0,
772
+ "driftCount": 3,
773
+ "diagnosticCount": 1,
774
+ "reviewRequired": true,
775
+ "blocked": false
776
+ },
777
+ "checklist": [
778
+ {
779
+ "id": "acceptance-1",
780
+ "text": "src/cli/design-verification-builder.ts 会产出 conservative verification result",
781
+ "status": "satisfied",
782
+ "evidenceRefs": [
783
+ "candidate:src/cli/design-verification-builder.ts",
784
+ "diagnostic:handoff-missing"
785
+ ]
786
+ },
787
+ {
788
+ "id": "acceptance-2",
789
+ "text": "src/interface/types/design-verification.ts 会定义正式 verification schema",
790
+ "status": "needs-review",
791
+ "evidenceRefs": [
792
+ "design:acceptanceCriteria"
793
+ ]
794
+ }
795
+ ],
796
+ "drift": [
797
+ {
798
+ "kind": "handoff-missing",
799
+ "severity": "warning",
800
+ "message": "Canonical handoff artifact is missing, so verification remains review-needed even though a live handoff was rebuilt.",
801
+ "sourceRefs": [
802
+ "diagnostic:handoff-missing"
803
+ ]
804
+ }
805
+ ],
806
+ "diagnostics": [
807
+ {
808
+ "code": "handoff-missing",
809
+ "blocker": false,
810
+ "message": "Canonical handoff artifact is missing, so verification remains review-needed even though a live handoff was rebuilt.",
811
+ "sourceRefs": [
812
+ "diagnostic:handoff-missing"
813
+ ]
814
+ }
815
+ ]
816
+ }
817
+ ```
818
+
819
+ > `design verify --json` 必须保持纯 JSON;`checklist` 与 `drift` 都属于正式契约。`readyForExecution=false` 不等于 blocker,只有 `ok=false` 或 blocker diagnostics 才应返回非零 exit code。
820
+
821
+ ---
822
+
212
823
  ## impact 命令输出结构
213
824
 
214
825
  ### JSON 输出 (-j)