@dommaker/harness 0.19.0 → 1.0.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 (348) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/bin/harness.js +136 -557
  3. package/dist/cli/commands/check.d.ts.map +1 -1
  4. package/dist/cli/commands/check.js +2 -13
  5. package/dist/cli/commands/check.js.map +1 -1
  6. package/dist/cli/commands/definitions.d.ts +90 -0
  7. package/dist/cli/commands/definitions.d.ts.map +1 -0
  8. package/dist/cli/commands/definitions.js +519 -0
  9. package/dist/cli/commands/definitions.js.map +1 -0
  10. package/dist/cli/commands/knowledge.js.map +1 -1
  11. package/dist/cli/commands/sync-docs/capabilities-syncer.d.ts +3 -25
  12. package/dist/cli/commands/sync-docs/capabilities-syncer.d.ts.map +1 -1
  13. package/dist/cli/commands/sync-docs/capabilities-syncer.js +3 -93
  14. package/dist/cli/commands/sync-docs/capabilities-syncer.js.map +1 -1
  15. package/dist/cli/commands/sync-docs/index.d.ts +1 -1
  16. package/dist/cli/commands/sync-docs/index.d.ts.map +1 -1
  17. package/dist/cli/commands/sync-docs/index.js +4 -4
  18. package/dist/cli/commands/sync-docs/index.js.map +1 -1
  19. package/dist/context/index.d.ts +1 -5
  20. package/dist/context/index.d.ts.map +1 -1
  21. package/dist/context/index.js +1 -5
  22. package/dist/context/index.js.map +1 -1
  23. package/dist/context/knowledge-injector.d.ts +3 -3
  24. package/dist/context/knowledge-injector.d.ts.map +1 -1
  25. package/dist/context/knowledge-injector.js +1 -1
  26. package/dist/context/session-manager.d.ts +1 -12
  27. package/dist/context/session-manager.d.ts.map +1 -1
  28. package/dist/context/session-manager.js +0 -63
  29. package/dist/context/session-manager.js.map +1 -1
  30. package/dist/context/types.d.ts +1 -39
  31. package/dist/context/types.d.ts.map +1 -1
  32. package/dist/context/types.js +2 -15
  33. package/dist/context/types.js.map +1 -1
  34. package/dist/core/constraints/agent-prompt-renderer.d.ts +1 -1
  35. package/dist/core/constraints/agent-prompt-renderer.js +1 -1
  36. package/dist/core/constraints/capabilities-parser.d.ts +17 -2
  37. package/dist/core/constraints/capabilities-parser.d.ts.map +1 -1
  38. package/dist/core/constraints/capabilities-parser.js +84 -2
  39. package/dist/core/constraints/capabilities-parser.js.map +1 -1
  40. package/dist/core/constraints/checker.d.ts +3 -17
  41. package/dist/core/constraints/checker.d.ts.map +1 -1
  42. package/dist/core/constraints/checker.js +7 -47
  43. package/dist/core/constraints/checker.js.map +1 -1
  44. package/dist/core/constraints/definitions.d.ts +0 -7
  45. package/dist/core/constraints/definitions.d.ts.map +1 -1
  46. package/dist/core/constraints/definitions.js +1 -8
  47. package/dist/core/constraints/definitions.js.map +1 -1
  48. package/dist/core/constraints/doc-freshness/runner.d.ts +0 -2
  49. package/dist/core/constraints/doc-freshness/runner.d.ts.map +1 -1
  50. package/dist/core/constraints/doc-freshness/runner.js.map +1 -1
  51. package/dist/core/constraints/index.d.ts +1 -1
  52. package/dist/core/constraints/index.d.ts.map +1 -1
  53. package/dist/core/constraints/index.js +2 -3
  54. package/dist/core/constraints/index.js.map +1 -1
  55. package/dist/core/constraints/interceptor.d.ts.map +1 -1
  56. package/dist/core/constraints/interceptor.js +1 -5
  57. package/dist/core/constraints/interceptor.js.map +1 -1
  58. package/dist/core/effective-constraints.d.ts.map +1 -1
  59. package/dist/core/effective-constraints.js +0 -1
  60. package/dist/core/effective-constraints.js.map +1 -1
  61. package/dist/core/project-config-loader.d.ts.map +1 -1
  62. package/dist/core/project-config-loader.js +1 -8
  63. package/dist/core/project-config-loader.js.map +1 -1
  64. package/dist/dashboard/stats.d.ts.map +1 -1
  65. package/dist/dashboard/stats.js.map +1 -1
  66. package/dist/dashboard/types.d.ts +2 -2
  67. package/dist/dashboard/types.d.ts.map +1 -1
  68. package/dist/failure/constraint-handler.d.ts.map +1 -1
  69. package/dist/failure/constraint-handler.js +0 -2
  70. package/dist/failure/constraint-handler.js.map +1 -1
  71. package/dist/gates/acceptance.d.ts +9 -1
  72. package/dist/gates/acceptance.d.ts.map +1 -1
  73. package/dist/gates/acceptance.js +21 -0
  74. package/dist/gates/acceptance.js.map +1 -1
  75. package/dist/gates/checker-gate.d.ts +23 -0
  76. package/dist/gates/checker-gate.d.ts.map +1 -0
  77. package/dist/gates/checker-gate.js +53 -0
  78. package/dist/gates/checker-gate.js.map +1 -0
  79. package/dist/gates/command.d.ts +9 -2
  80. package/dist/gates/command.d.ts.map +1 -1
  81. package/dist/gates/command.js +10 -0
  82. package/dist/gates/command.js.map +1 -1
  83. package/dist/gates/contract.d.ts +8 -2
  84. package/dist/gates/contract.d.ts.map +1 -1
  85. package/dist/gates/contract.js +9 -0
  86. package/dist/gates/contract.js.map +1 -1
  87. package/dist/gates/decision.d.ts +17 -0
  88. package/dist/gates/decision.d.ts.map +1 -0
  89. package/dist/gates/decision.js +25 -0
  90. package/dist/gates/decision.js.map +1 -0
  91. package/dist/gates/definitions.d.ts +63 -0
  92. package/dist/gates/definitions.d.ts.map +1 -0
  93. package/dist/gates/definitions.js +160 -0
  94. package/dist/gates/definitions.js.map +1 -0
  95. package/dist/gates/effective-gates.d.ts +30 -0
  96. package/dist/gates/effective-gates.d.ts.map +1 -0
  97. package/dist/gates/effective-gates.js +85 -0
  98. package/dist/gates/effective-gates.js.map +1 -0
  99. package/dist/gates/index.d.ts +25 -1
  100. package/dist/gates/index.d.ts.map +1 -1
  101. package/dist/gates/index.js +37 -1
  102. package/dist/gates/index.js.map +1 -1
  103. package/dist/gates/performance.d.ts +8 -2
  104. package/dist/gates/performance.d.ts.map +1 -1
  105. package/dist/gates/performance.js +9 -0
  106. package/dist/gates/performance.js.map +1 -1
  107. package/dist/gates/registry.d.ts +32 -0
  108. package/dist/gates/registry.d.ts.map +1 -0
  109. package/dist/gates/registry.js +90 -0
  110. package/dist/gates/registry.js.map +1 -0
  111. package/dist/gates/review.d.ts +8 -2
  112. package/dist/gates/review.d.ts.map +1 -1
  113. package/dist/gates/review.js +9 -0
  114. package/dist/gates/review.js.map +1 -1
  115. package/dist/gates/runner.d.ts +30 -0
  116. package/dist/gates/runner.d.ts.map +1 -0
  117. package/dist/gates/runner.js +38 -0
  118. package/dist/gates/runner.js.map +1 -0
  119. package/dist/gates/security.d.ts +8 -2
  120. package/dist/gates/security.d.ts.map +1 -1
  121. package/dist/gates/security.js +9 -0
  122. package/dist/gates/security.js.map +1 -1
  123. package/dist/gates/types.d.ts +41 -1
  124. package/dist/gates/types.d.ts.map +1 -1
  125. package/dist/hooks/bootstrap.d.ts.map +1 -1
  126. package/dist/hooks/bootstrap.js +0 -2
  127. package/dist/hooks/bootstrap.js.map +1 -1
  128. package/dist/hooks/config.d.ts +26 -0
  129. package/dist/hooks/config.d.ts.map +1 -0
  130. package/dist/hooks/config.js +30 -0
  131. package/dist/hooks/config.js.map +1 -0
  132. package/dist/hooks/index.d.ts +2 -1
  133. package/dist/hooks/index.d.ts.map +1 -1
  134. package/dist/hooks/index.js +4 -1
  135. package/dist/hooks/index.js.map +1 -1
  136. package/dist/hooks/registry.d.ts +18 -1
  137. package/dist/hooks/registry.d.ts.map +1 -1
  138. package/dist/hooks/registry.js +45 -0
  139. package/dist/hooks/registry.js.map +1 -1
  140. package/dist/hooks/types.d.ts +20 -0
  141. package/dist/hooks/types.d.ts.map +1 -1
  142. package/dist/index.d.ts +4 -8
  143. package/dist/index.d.ts.map +1 -1
  144. package/dist/index.js +5 -20
  145. package/dist/index.js.map +1 -1
  146. package/dist/knowledge/import.d.ts +2 -2
  147. package/dist/knowledge/import.d.ts.map +1 -1
  148. package/dist/knowledge/ingest.js.map +1 -1
  149. package/dist/knowledge/lifecycle-hooks.d.ts +2 -2
  150. package/dist/knowledge/lifecycle-hooks.d.ts.map +1 -1
  151. package/dist/knowledge/types.d.ts +5 -7
  152. package/dist/knowledge/types.d.ts.map +1 -1
  153. package/dist/knowledge/types.js +1 -1
  154. package/dist/knowledge/types.js.map +1 -1
  155. package/dist/monitoring/constraint-doctor.d.ts +4 -22
  156. package/dist/monitoring/constraint-doctor.d.ts.map +1 -1
  157. package/dist/monitoring/constraint-doctor.js +7 -94
  158. package/dist/monitoring/constraint-doctor.js.map +1 -1
  159. package/dist/presets/standard.d.ts +1 -1
  160. package/dist/presets/standard.d.ts.map +1 -1
  161. package/dist/presets/standard.js +1 -2
  162. package/dist/presets/standard.js.map +1 -1
  163. package/dist/spec/annotation-checker.d.ts.map +1 -1
  164. package/dist/spec/annotation-checker.js +6 -26
  165. package/dist/spec/annotation-checker.js.map +1 -1
  166. package/dist/tools/index.d.ts +0 -4
  167. package/dist/tools/index.d.ts.map +1 -1
  168. package/dist/tools/index.js +0 -4
  169. package/dist/tools/index.js.map +1 -1
  170. package/dist/types/constraint.d.ts +1 -12
  171. package/dist/types/constraint.d.ts.map +1 -1
  172. package/dist/types/constraint.js +0 -3
  173. package/dist/types/constraint.js.map +1 -1
  174. package/dist/types/project-config.d.ts +0 -2
  175. package/dist/types/project-config.d.ts.map +1 -1
  176. package/dist/utils/file-walk.d.ts +2 -2
  177. package/dist/utils/file-walk.js +2 -2
  178. package/package.json +6 -1
  179. package/src/CONTEXT.md +14 -0
  180. package/src/__tests__/checker-extra.test.ts +2 -59
  181. package/src/__tests__/constraint-doctor.test.ts +1 -140
  182. package/src/__tests__/constraint-handler.test.ts +0 -4
  183. package/src/__tests__/project-config-loader-extra.test.ts +0 -20
  184. package/src/__tests__/project-config-loader.test.ts +0 -1
  185. package/src/cli/commands/CONTEXT.md +15 -7
  186. package/src/cli/commands/__tests__/check-drift.test.ts +0 -3
  187. package/src/cli/commands/__tests__/check-skip-output.test.ts +0 -5
  188. package/src/cli/commands/__tests__/check.test.ts +7 -75
  189. package/src/cli/commands/__tests__/registry.test.ts +201 -0
  190. package/src/cli/commands/check.ts +2 -14
  191. package/src/cli/commands/definitions.ts +593 -0
  192. package/src/cli/commands/knowledge.ts +3 -3
  193. package/src/cli/commands/sync-docs/capabilities-syncer.ts +4 -110
  194. package/src/cli/commands/sync-docs/index.ts +8 -5
  195. package/src/context/CONTEXT.md +2 -7
  196. package/src/context/__tests__/session-manager.test.ts +0 -91
  197. package/src/context/index.ts +1 -5
  198. package/src/context/knowledge-injector.ts +3 -3
  199. package/src/context/session-manager.ts +0 -74
  200. package/src/context/types.ts +2 -63
  201. package/src/core/constraints/__tests__/interceptor.test.ts +0 -2
  202. package/src/core/constraints/agent-prompt-renderer.ts +1 -1
  203. package/src/core/constraints/capabilities-parser.ts +95 -2
  204. package/src/core/constraints/checker.ts +8 -53
  205. package/src/core/constraints/definitions.ts +0 -8
  206. package/src/core/constraints/doc-freshness/runner.ts +1 -2
  207. package/src/core/constraints/index.ts +1 -2
  208. package/src/core/constraints/interceptor.ts +1 -6
  209. package/src/core/effective-constraints.ts +0 -1
  210. package/src/core/project-config-loader.ts +1 -7
  211. package/src/dashboard/stats.ts +2 -2
  212. package/src/dashboard/types.ts +2 -2
  213. package/src/failure/constraint-handler.ts +0 -2
  214. package/src/gates/CONTEXT.md +16 -13
  215. package/src/gates/__tests__/checker-gate.test.ts +45 -0
  216. package/src/gates/__tests__/contract.test.ts +73 -0
  217. package/src/gates/__tests__/effective-gates.test.ts +82 -0
  218. package/src/gates/__tests__/gate-interface.test.ts +202 -0
  219. package/src/gates/__tests__/registry.test.ts +87 -0
  220. package/src/gates/__tests__/runner.test.ts +81 -0
  221. package/src/gates/acceptance.ts +24 -1
  222. package/src/gates/checker-gate.ts +54 -0
  223. package/src/gates/command.ts +13 -2
  224. package/src/gates/contract.ts +12 -2
  225. package/src/gates/decision.ts +27 -0
  226. package/src/gates/definitions.ts +207 -0
  227. package/src/gates/effective-gates.ts +106 -0
  228. package/src/gates/index.ts +38 -0
  229. package/src/gates/performance.ts +12 -2
  230. package/src/gates/registry.ts +107 -0
  231. package/src/gates/review.ts +12 -2
  232. package/src/gates/runner.ts +57 -0
  233. package/src/gates/security.ts +12 -2
  234. package/src/gates/types.ts +48 -1
  235. package/src/hooks/CONTEXT.md +12 -2
  236. package/src/hooks/__tests__/bootstrap.test.ts +0 -1
  237. package/src/hooks/__tests__/config.test.ts +19 -0
  238. package/src/hooks/__tests__/pipeline.test.ts +79 -0
  239. package/src/hooks/__tests__/registry.test.ts +67 -0
  240. package/src/hooks/bootstrap.ts +0 -2
  241. package/src/hooks/config.ts +29 -0
  242. package/src/hooks/index.ts +2 -1
  243. package/src/hooks/registry.ts +60 -1
  244. package/src/hooks/types.ts +21 -0
  245. package/src/index.ts +5 -22
  246. package/src/knowledge/import.ts +3 -3
  247. package/src/knowledge/ingest.ts +4 -4
  248. package/src/knowledge/lifecycle-hooks.ts +3 -3
  249. package/src/knowledge/types.ts +5 -8
  250. package/src/monitoring/constraint-doctor.ts +7 -106
  251. package/src/presets/__tests__/standard.test.ts +0 -2
  252. package/src/presets/standard.ts +1 -2
  253. package/src/spec/__tests__/annotation-checker.test.ts +9 -3
  254. package/src/spec/annotation-checker.ts +7 -29
  255. package/src/tools/CONTEXT.md +7 -14
  256. package/src/tools/index.ts +0 -4
  257. package/src/types/constraint.ts +1 -14
  258. package/src/types/project-config.ts +0 -3
  259. package/src/utils/file-walk.ts +2 -2
  260. package/dist/architecture/constraint-engine.d.ts +0 -67
  261. package/dist/architecture/constraint-engine.d.ts.map +0 -1
  262. package/dist/architecture/constraint-engine.js +0 -295
  263. package/dist/architecture/constraint-engine.js.map +0 -1
  264. package/dist/architecture/cross-project-checker.d.ts +0 -54
  265. package/dist/architecture/cross-project-checker.d.ts.map +0 -1
  266. package/dist/architecture/cross-project-checker.js +0 -467
  267. package/dist/architecture/cross-project-checker.js.map +0 -1
  268. package/dist/cli/commands/index.d.ts +0 -30
  269. package/dist/cli/commands/index.d.ts.map +0 -1
  270. package/dist/cli/commands/index.js +0 -91
  271. package/dist/cli/commands/index.js.map +0 -1
  272. package/dist/context/file-budget.d.ts +0 -40
  273. package/dist/context/file-budget.d.ts.map +0 -1
  274. package/dist/context/file-budget.js +0 -147
  275. package/dist/context/file-budget.js.map +0 -1
  276. package/dist/context/progressive-loader.d.ts +0 -109
  277. package/dist/context/progressive-loader.d.ts.map +0 -1
  278. package/dist/context/progressive-loader.js +0 -166
  279. package/dist/context/progressive-loader.js.map +0 -1
  280. package/dist/context/token-pipeline.d.ts +0 -55
  281. package/dist/context/token-pipeline.d.ts.map +0 -1
  282. package/dist/context/token-pipeline.js +0 -220
  283. package/dist/context/token-pipeline.js.map +0 -1
  284. package/dist/context/tool-output-budget.d.ts +0 -59
  285. package/dist/context/tool-output-budget.d.ts.map +0 -1
  286. package/dist/context/tool-output-budget.js +0 -177
  287. package/dist/context/tool-output-budget.js.map +0 -1
  288. package/dist/core/constraints/default-executors.d.ts +0 -10
  289. package/dist/core/constraints/default-executors.d.ts.map +0 -1
  290. package/dist/core/constraints/default-executors.js +0 -120
  291. package/dist/core/constraints/default-executors.js.map +0 -1
  292. package/dist/llm/adapter.d.ts +0 -36
  293. package/dist/llm/adapter.d.ts.map +0 -1
  294. package/dist/llm/adapter.js +0 -118
  295. package/dist/llm/adapter.js.map +0 -1
  296. package/dist/llm/index.d.ts +0 -3
  297. package/dist/llm/index.d.ts.map +0 -1
  298. package/dist/llm/index.js +0 -19
  299. package/dist/llm/index.js.map +0 -1
  300. package/dist/llm/types.d.ts +0 -62
  301. package/dist/llm/types.d.ts.map +0 -1
  302. package/dist/llm/types.js +0 -8
  303. package/dist/llm/types.js.map +0 -1
  304. package/dist/tools/core/index.d.ts +0 -13
  305. package/dist/tools/core/index.d.ts.map +0 -1
  306. package/dist/tools/core/index.js +0 -198
  307. package/dist/tools/core/index.js.map +0 -1
  308. package/dist/tools/loader.d.ts +0 -21
  309. package/dist/tools/loader.d.ts.map +0 -1
  310. package/dist/tools/loader.js +0 -199
  311. package/dist/tools/loader.js.map +0 -1
  312. package/dist/tools/registry.d.ts +0 -59
  313. package/dist/tools/registry.d.ts.map +0 -1
  314. package/dist/tools/registry.js +0 -115
  315. package/dist/tools/registry.js.map +0 -1
  316. package/dist/tools/types.d.ts +0 -38
  317. package/dist/tools/types.d.ts.map +0 -1
  318. package/dist/tools/types.js +0 -6
  319. package/dist/tools/types.js.map +0 -1
  320. package/src/__tests__/architecture-engine.test.ts +0 -619
  321. package/src/__tests__/context/progressive-loader.test.ts +0 -131
  322. package/src/__tests__/cross-project-checker.test.ts +0 -318
  323. package/src/architecture/CONTEXT.md +0 -22
  324. package/src/architecture/constraint-engine.ts +0 -351
  325. package/src/architecture/cross-project-checker.ts +0 -545
  326. package/src/cli/commands/index.ts +0 -30
  327. package/src/context/__tests__/file-budget.test.ts +0 -142
  328. package/src/context/__tests__/progressive-loader.test.ts +0 -264
  329. package/src/context/__tests__/token-pipeline.test.ts +0 -178
  330. package/src/context/__tests__/tool-output-budget.test.ts +0 -95
  331. package/src/context/file-budget.ts +0 -142
  332. package/src/context/progressive-loader.ts +0 -260
  333. package/src/context/token-pipeline.ts +0 -265
  334. package/src/context/tool-output-budget.ts +0 -178
  335. package/src/core/constraints/__tests__/default-executors.test.ts +0 -57
  336. package/src/core/constraints/default-executors.ts +0 -92
  337. package/src/llm/CONTEXT.md +0 -21
  338. package/src/llm/__tests__/adapter.test.ts +0 -172
  339. package/src/llm/adapter.ts +0 -149
  340. package/src/llm/index.ts +0 -2
  341. package/src/llm/types.ts +0 -81
  342. package/src/tools/__tests__/loader.test.ts +0 -252
  343. package/src/tools/__tests__/registry.test.ts +0 -157
  344. package/src/tools/core/__tests__/core.test.ts +0 -122
  345. package/src/tools/core/index.ts +0 -201
  346. package/src/tools/loader.ts +0 -216
  347. package/src/tools/registry.ts +0 -128
  348. package/src/tools/types.ts +0 -46
@@ -0,0 +1,593 @@
1
+ /**
2
+ * CLI 命令定义表(H5:命令定义即注册的单一来源,R6 消灭 commands/index.ts
3
+ * 与 bin/harness.js 两处手工同步)
4
+ *
5
+ * - bin/harness.js 遍历本表注册表驱动生成全部 commander 命令块,
6
+ * 不再手写命令注册;新增命令 = 命令实现文件 + 本表一条定义 + 测试。
7
+ * - 每个实现引用(CommandImplRef)标注实现文件与导出名;bin 按需
8
+ * per-command 懒加载(O2):只在 action 执行时 require 对应命令模块,
9
+ * 不再经单一 barrel 加载全部命令实现。
10
+ * - 本模块是纯数据模块:禁止 import 任何命令实现(含运行时依赖),
11
+ * 保证 --help/--version 懒加载不被破坏;注册表完整性断言(引用实现
12
+ * 可解析)在 __tests__/registry.test.ts 构建/测试期校验。
13
+ */
14
+
15
+ /**
16
+ * 命令 CLI 选项元数据(直接映射 commander `.option()`)
17
+ */
18
+ export interface CommandCliOption {
19
+ /** commander option flags,如 '-p, --project-path <path>' */
20
+ flags: string;
21
+ /** 选项描述 */
22
+ description: string;
23
+ /** commander 缺省值;negated option(如 --no-strict)不设,由 commander 默认 true */
24
+ defaultValue?: string | boolean;
25
+ }
26
+
27
+ /**
28
+ * 命令实现引用(per-command 懒加载路径)
29
+ */
30
+ export interface CommandImplRef {
31
+ /** 实现模块名(相对 src/cli/commands,如 'check' / 'sync-docs') */
32
+ module: string;
33
+ /** 模块内导出函数名 */
34
+ export: string;
35
+ }
36
+
37
+ /**
38
+ * 子命令条目:别名 → 实现 + 实参构造
39
+ */
40
+ export interface CommandSubcommand {
41
+ /** 实现引用 */
42
+ impl: CommandImplRef;
43
+ /** 实参构造:positionals = 子命令名之后的位置参数(无则 []) */
44
+ args?: (positionals: (string | undefined)[], options: Record<string, unknown>) => unknown[];
45
+ }
46
+
47
+ /**
48
+ * 选项条件路由(如 check --list):选项值匹配时以路由替代默认 action;
49
+ * 同一选项可挂多条路由(按声明顺序执行,如 passes-gate --coverage)
50
+ */
51
+ export interface CommandOptionRoute {
52
+ /** 触发选项键(commander options 对象键名,如 'list') */
53
+ flag: string;
54
+ /** 触发值 */
55
+ when: unknown;
56
+ /** 实现引用 */
57
+ impl: CommandImplRef;
58
+ /** 实参构造(缺省为 [options]) */
59
+ args?: (positionals: (string | undefined)[], options: Record<string, unknown>) => unknown[];
60
+ }
61
+
62
+ /**
63
+ * 命令定义
64
+ */
65
+ export interface CommandDefinition {
66
+ /** 命令名(commander 注册字符串,可含位置参数,如 'retire [id]') */
67
+ command: string;
68
+ /** 命令描述 */
69
+ description: string;
70
+ /** 命令别名 */
71
+ alias?: string;
72
+ /** 位置参数声明(如 '[subcommand]' / '[subcommand] [arg]' / '<planPath>') */
73
+ argument?: string;
74
+ /** 命令选项 */
75
+ options: CommandCliOption[];
76
+ /** 子命令(commander 嵌套命令,如 constraints report / retire) */
77
+ children?: CommandDefinition[];
78
+ /** 默认 action 实现引用;缺省时裸调用显示帮助(subcommand 命令) */
79
+ action?: CommandImplRef;
80
+ /** 子命令路由:位置参数首值 → 条目;未知值报错退出(strict) */
81
+ subcommands?: Record<string, CommandSubcommand>;
82
+ /** false = 未知位置参数不报错、落回默认 action(spec 的文件参数用法) */
83
+ subcommandStrict?: boolean;
84
+ /** 选项条件路由(匹配时替代默认 action 执行) */
85
+ optionRoutes?: CommandOptionRoute[];
86
+ /** 默认 action 实参构造(缺省为 [options]) */
87
+ mapActionArgs?: (positionals: (string | undefined)[], options: Record<string, unknown>) => unknown[];
88
+ /** action 完成后处理(接收返回值,如 sync-docs --check 失败 exit(1)) */
89
+ afterRun?: (result: unknown, options: Record<string, unknown>) => void;
90
+ }
91
+
92
+ /**
93
+ * 全部非门禁 CLI 命令定义(门禁命令由 GATE_DEFINITIONS 生成,见 src/gates/definitions.ts)
94
+ */
95
+ export const COMMAND_DEFINITIONS: CommandDefinition[] = [
96
+ {
97
+ command: 'check',
98
+ description: '检查铁律是否满足',
99
+ options: [
100
+ { flags: '-p, --preset <preset>', description: '预设名称', defaultValue: 'standard' },
101
+ { flags: '-s, --staged', description: '只检查暂存文件', defaultValue: false },
102
+ { flags: '-t, --trigger <trigger>', description: '触发条件' },
103
+ { flags: '--project-path <path>', description: '项目路径' },
104
+ { flags: '--list', description: '列出所有铁律' },
105
+ ],
106
+ action: { module: 'check', export: 'check' },
107
+ optionRoutes: [
108
+ { flag: 'list', when: true, impl: { module: 'check', export: 'listLaws' }, args: () => [] },
109
+ ],
110
+ },
111
+ {
112
+ command: 'validate',
113
+ description: '验证检查点是否满足',
114
+ options: [
115
+ { flags: '-f, --file <path>', description: '检查点文件路径' },
116
+ { flags: '-p, --project-path <path>', description: '项目路径' },
117
+ { flags: '--strict', description: '严格模式(任何失败都退出)', defaultValue: false },
118
+ ],
119
+ action: { module: 'validate', export: 'validate' },
120
+ },
121
+ {
122
+ command: 'passes-gate',
123
+ alias: 'pg',
124
+ description: '运行测试门控,确保测试通过',
125
+ options: [
126
+ { flags: '-t, --test-command <command>', description: '测试命令' },
127
+ { flags: '-p, --project-path <path>', description: '项目路径' },
128
+ { flags: '--allow-partial', description: '允许部分测试通过', defaultValue: false },
129
+ { flags: '--max-retries <n>', description: '最大重试次数', defaultValue: '2' },
130
+ { flags: '--coverage', description: '检查测试覆盖率' },
131
+ { flags: '--coverage-threshold <n>', description: '覆盖率阈值', defaultValue: '80' },
132
+ ],
133
+ action: { module: 'passes-gate', export: 'runPassesGate' },
134
+ optionRoutes: [
135
+ { flag: 'coverage', when: true, impl: { module: 'passes-gate', export: 'runPassesGate' } },
136
+ {
137
+ flag: 'coverage',
138
+ when: true,
139
+ impl: { module: 'passes-gate', export: 'checkCoverage' },
140
+ args: (_pos, options) => [
141
+ options.projectPath || process.cwd(),
142
+ parseInt(String(options.coverageThreshold), 10),
143
+ ],
144
+ },
145
+ ],
146
+ },
147
+ {
148
+ command: 'init',
149
+ description: '初始化项目的 harness 配置',
150
+ options: [
151
+ { flags: '-p, --preset <preset>', description: '预设名称 (strict/standard/relaxed)', defaultValue: 'standard' },
152
+ { flags: '-g, --governance <level>', description: '治理级别 (minimal/standard/strict)' },
153
+ { flags: '-t, --type <type>', description: '项目类型 (node-api/nextjs-app/python-api/custom)' },
154
+ { flags: '--project-path <path>', description: '项目路径' },
155
+ { flags: '--no-git-hooks', description: '不创建 Git hooks' },
156
+ { flags: '--no-github-actions', description: '不创建 GitHub Actions' },
157
+ { flags: '--print-snippets', description: '只输出代码片段,不创建文件' },
158
+ ],
159
+ action: { module: 'init', export: 'init' },
160
+ },
161
+ {
162
+ command: 'report',
163
+ description: '生成检查报告',
164
+ options: [
165
+ { flags: '-o, --output <path>', description: '输出文件路径' },
166
+ { flags: '-f, --format <format>', description: '输出格式 (json/markdown/html)', defaultValue: 'markdown' },
167
+ { flags: '-p, --project-path <path>', description: '项目路径' },
168
+ ],
169
+ action: { module: 'report', export: 'report' },
170
+ },
171
+ {
172
+ command: 'status',
173
+ description: '显示 Harness 状态、统计、异常检测',
174
+ options: [
175
+ { flags: '-p, --project-path <path>', description: '项目路径' },
176
+ { flags: '-d, --detail', description: '显示详细信息', defaultValue: false },
177
+ { flags: '-a, --anomalies', description: '只显示异常', defaultValue: false },
178
+ { flags: '--hours <n>', description: '分析最近 N 小时', defaultValue: '24' },
179
+ ],
180
+ action: { module: 'status', export: 'status' },
181
+ mapActionArgs: (_pos, options) => [
182
+ {
183
+ projectPath: options.projectPath,
184
+ detail: options.detail,
185
+ anomalies: options.anomalies,
186
+ hours: parseInt(String(options.hours), 10),
187
+ },
188
+ ],
189
+ },
190
+ {
191
+ command: 'spec',
192
+ argument: '[subcommand]',
193
+ description: 'Spec 验证命令',
194
+ options: [
195
+ { flags: '-s, --schema <path>', description: 'Schema 路径(项目定义)' },
196
+ { flags: '--staged', description: '只验证暂存文件', defaultValue: false },
197
+ { flags: '-f, --file <path>', description: '验证指定文件' },
198
+ { flags: '-p, --project-path <path>', description: '项目路径' },
199
+ { flags: '-v, --verbose', description: '详细输出', defaultValue: false },
200
+ ],
201
+ action: { module: 'spec', export: 'specValidate' },
202
+ subcommands: {
203
+ list: { impl: { module: 'spec', export: 'listSpecTypes' }, args: () => [] },
204
+ },
205
+ // 未知位置参数按文件路径落回默认 action(spec foo.yaml 合法用法)
206
+ subcommandStrict: false,
207
+ mapActionArgs: (positionals, options) => [
208
+ {
209
+ schema: options.schema,
210
+ staged: options.staged,
211
+ file: options.file ||
212
+ (positionals[0] && !String(positionals[0]).startsWith('-') ? positionals[0] : undefined),
213
+ projectPath: options.projectPath,
214
+ verbose: options.verbose,
215
+ },
216
+ ],
217
+ },
218
+ {
219
+ command: 'sync-docs',
220
+ description: '同步项目文档(CAPABILITIES.md、CONTEXT.md、AGENTS.md)',
221
+ options: [
222
+ { flags: '-p, --project-path <path>', description: '项目路径' },
223
+ { flags: '-c, --check', description: '只检查不修改(CI 模式)', defaultValue: false },
224
+ { flags: '--json', description: '输出 JSON 格式(供 LLM 消费)', defaultValue: false },
225
+ { flags: '--agents', description: '同步 AGENTS.md(agent 导读;PRESERVE 标记段重新生成时保留)', defaultValue: false },
226
+ { flags: '--compact', description: '一次性迁移:将 CAPABILITIES.md 文件表格折叠为目录条目', defaultValue: false },
227
+ ],
228
+ action: { module: 'sync-docs', export: 'syncDocs' },
229
+ afterRun: (ok, options) => {
230
+ if (!ok && options.check) {
231
+ process.exit(1);
232
+ }
233
+ },
234
+ },
235
+ {
236
+ command: 'knowledge',
237
+ argument: '[subcommand] [arg]',
238
+ alias: 'kb',
239
+ description: '知识库管理(list/search/import/decay/stats/audit)',
240
+ options: [
241
+ { flags: '-p, --project-path <path>', description: '项目路径' },
242
+ { flags: '--type <types>', description: '按类型过滤(逗号分隔)' },
243
+ { flags: '--maturity <levels>', description: '按成熟度过滤(逗号分隔)' },
244
+ { flags: '--tag <tags>', description: '按标签过滤(逗号分隔)' },
245
+ { flags: '--sources <sources>', description: '导入源(逗号分隔: code,git,docs)' },
246
+ { flags: '--limit <n>', description: '结果数量限制', defaultValue: '20' },
247
+ { flags: '--reset', description: '重置导入状态', defaultValue: false },
248
+ { flags: '--scope <scope>', description: '知识范围(用于 upsert 去重)' },
249
+ { flags: '--title <title>', description: '知识标题(用于 upsert)' },
250
+ { flags: '--content <content>', description: '知识内容 Markdown(用于 upsert)' },
251
+ { flags: '--file <path>', description: '从文件读取内容(用于 upsert)' },
252
+ { flags: '--source <source>', description: '知识来源 (analyst/cli/design)', defaultValue: 'cli' },
253
+ { flags: '--fix', description: '自动修复(用于 audit)', defaultValue: false },
254
+ { flags: '--dry-run', description: '只输出报告不修改(用于 audit)', defaultValue: false },
255
+ { flags: '--threshold <n>', description: '短内容阈值(字符数,用于 audit)', defaultValue: '50' },
256
+ { flags: '--dir <path>', description: '知识库目录(覆盖默认路径)' },
257
+ { flags: '--json', description: 'JSON 格式输出', defaultValue: false },
258
+ ],
259
+ subcommands: {
260
+ list: {
261
+ impl: { module: 'knowledge', export: 'knowledgeList' },
262
+ args: (_pos, options) => [{
263
+ projectPath: options.projectPath, json: options.json,
264
+ type: options.type, maturity: options.maturity, tag: options.tag,
265
+ }],
266
+ },
267
+ ls: {
268
+ impl: { module: 'knowledge', export: 'knowledgeList' },
269
+ args: (_pos, options) => [{
270
+ projectPath: options.projectPath, json: options.json,
271
+ type: options.type, maturity: options.maturity, tag: options.tag,
272
+ }],
273
+ },
274
+ search: {
275
+ impl: { module: 'knowledge', export: 'knowledgeSearch' },
276
+ args: (positionals, options) => {
277
+ if (!positionals[0]) {
278
+ console.error('请提供搜索关键词');
279
+ process.exit(1);
280
+ }
281
+ return [positionals[0], {
282
+ projectPath: options.projectPath, json: options.json,
283
+ limit: parseInt(String(options.limit), 10),
284
+ }];
285
+ },
286
+ },
287
+ s: {
288
+ impl: { module: 'knowledge', export: 'knowledgeSearch' },
289
+ args: (positionals, options) => {
290
+ if (!positionals[0]) {
291
+ console.error('请提供搜索关键词');
292
+ process.exit(1);
293
+ }
294
+ return [positionals[0], {
295
+ projectPath: options.projectPath, json: options.json,
296
+ limit: parseInt(String(options.limit), 10),
297
+ }];
298
+ },
299
+ },
300
+ import: {
301
+ impl: { module: 'knowledge', export: 'knowledgeImport' },
302
+ args: (_pos, options) => [{
303
+ projectPath: options.projectPath, json: options.json,
304
+ sources: options.sources, reset: options.reset,
305
+ }],
306
+ },
307
+ i: {
308
+ impl: { module: 'knowledge', export: 'knowledgeImport' },
309
+ args: (_pos, options) => [{
310
+ projectPath: options.projectPath, json: options.json,
311
+ sources: options.sources, reset: options.reset,
312
+ }],
313
+ },
314
+ decay: {
315
+ impl: { module: 'knowledge', export: 'knowledgeDecay' },
316
+ args: (_pos, options) => [{ projectPath: options.projectPath, json: options.json }],
317
+ },
318
+ d: {
319
+ impl: { module: 'knowledge', export: 'knowledgeDecay' },
320
+ args: (_pos, options) => [{ projectPath: options.projectPath, json: options.json }],
321
+ },
322
+ stats: {
323
+ impl: { module: 'knowledge', export: 'knowledgeStats' },
324
+ args: (_pos, options) => [{ projectPath: options.projectPath, json: options.json }],
325
+ },
326
+ st: {
327
+ impl: { module: 'knowledge', export: 'knowledgeStats' },
328
+ args: (_pos, options) => [{ projectPath: options.projectPath, json: options.json }],
329
+ },
330
+ 'sync-rag': {
331
+ impl: { module: 'knowledge', export: 'knowledgeSyncRag' },
332
+ args: (_pos, options) => [{ projectPath: options.projectPath, json: options.json }],
333
+ },
334
+ 'sync-status': {
335
+ impl: { module: 'knowledge', export: 'knowledgeSyncStatus' },
336
+ args: (_pos, options) => [{ projectPath: options.projectPath, json: options.json }],
337
+ },
338
+ sync: {
339
+ impl: { module: 'knowledge', export: 'knowledgeSyncStatus' },
340
+ args: (_pos, options) => [{ projectPath: options.projectPath, json: options.json }],
341
+ },
342
+ upsert: {
343
+ impl: { module: 'knowledge', export: 'knowledgeUpsert' },
344
+ args: (_pos, options) => [{
345
+ scope: options.scope || '',
346
+ title: options.title || '',
347
+ content: options.content || '',
348
+ file: options.file || '',
349
+ type: options.type || 'architecture',
350
+ source: options.source || 'cli',
351
+ }],
352
+ },
353
+ up: {
354
+ impl: { module: 'knowledge', export: 'knowledgeUpsert' },
355
+ args: (_pos, options) => [{
356
+ scope: options.scope || '',
357
+ title: options.title || '',
358
+ content: options.content || '',
359
+ file: options.file || '',
360
+ type: options.type || 'architecture',
361
+ source: options.source || 'cli',
362
+ }],
363
+ },
364
+ audit: {
365
+ impl: { module: 'knowledge', export: 'knowledgeAudit' },
366
+ args: (_pos, options) => [{
367
+ projectPath: options.projectPath, json: options.json,
368
+ fix: options.fix, dryRun: options.dryRun,
369
+ threshold: options.threshold, dir: options.dir,
370
+ }],
371
+ },
372
+ a: {
373
+ impl: { module: 'knowledge', export: 'knowledgeAudit' },
374
+ args: (_pos, options) => [{
375
+ projectPath: options.projectPath, json: options.json,
376
+ fix: options.fix, dryRun: options.dryRun,
377
+ threshold: options.threshold, dir: options.dir,
378
+ }],
379
+ },
380
+ snapshot: {
381
+ impl: { module: 'knowledge', export: 'knowledgeSnapshot' },
382
+ args: (_pos, options) => [{ projectPath: options.projectPath, json: options.json, dir: options.dir }],
383
+ },
384
+ migrate: {
385
+ impl: { module: 'knowledge', export: 'knowledgeMigrate' },
386
+ args: (_pos, options) => [{ projectPath: options.projectPath, json: options.json, dir: options.dir }],
387
+ },
388
+ index: {
389
+ impl: { module: 'knowledge', export: 'knowledgeIndex' },
390
+ args: (_pos, options) => [{ projectPath: options.projectPath, json: options.json, dir: options.dir }],
391
+ },
392
+ idx: {
393
+ impl: { module: 'knowledge', export: 'knowledgeIndex' },
394
+ args: (_pos, options) => [{ projectPath: options.projectPath, json: options.json, dir: options.dir }],
395
+ },
396
+ health: {
397
+ impl: { module: 'knowledge', export: 'knowledgeHealth' },
398
+ args: (_pos, options) => [{ projectPath: options.projectPath, json: options.json, dir: options.dir }],
399
+ },
400
+ h: {
401
+ impl: { module: 'knowledge', export: 'knowledgeHealth' },
402
+ args: (_pos, options) => [{ projectPath: options.projectPath, json: options.json, dir: options.dir }],
403
+ },
404
+ },
405
+ },
406
+ {
407
+ command: 'sdd',
408
+ argument: '[subcommand]',
409
+ description: 'SDD 管理(index)',
410
+ options: [
411
+ { flags: '-p, --project-path <path>', description: '项目路径' },
412
+ { flags: '--dir <dir>', description: '指定基础目录' },
413
+ { flags: '--json', description: 'JSON 输出' },
414
+ ],
415
+ subcommands: {
416
+ index: {
417
+ impl: { module: 'sdd', export: 'sddIndex' },
418
+ args: (_pos, options) => [{ projectPath: options.projectPath, json: options.json, dir: options.dir }],
419
+ },
420
+ idx: {
421
+ impl: { module: 'sdd', export: 'sddIndex' },
422
+ args: (_pos, options) => [{ projectPath: options.projectPath, json: options.json, dir: options.dir }],
423
+ },
424
+ },
425
+ },
426
+ {
427
+ command: 'failure',
428
+ argument: '[subcommand]',
429
+ description: '失败记录管理(list/stats/clear)',
430
+ options: [
431
+ { flags: '-p, --project-path <path>', description: '项目路径' },
432
+ { flags: '--type <type>', description: '按错误类型过滤' },
433
+ { flags: '--level <level>', description: '按失败等级过滤 (L1/L2/L3/L4)' },
434
+ { flags: '--limit <n>', description: '结果数量限制', defaultValue: '20' },
435
+ { flags: '--json', description: 'JSON 格式输出', defaultValue: false },
436
+ ],
437
+ subcommands: {
438
+ list: {
439
+ impl: { module: 'failure', export: 'failureList' },
440
+ args: (_pos, options) => [{
441
+ projectPath: options.projectPath, json: options.json,
442
+ limit: parseInt(String(options.limit), 10),
443
+ type: options.type, level: options.level,
444
+ }],
445
+ },
446
+ ls: {
447
+ impl: { module: 'failure', export: 'failureList' },
448
+ args: (_pos, options) => [{
449
+ projectPath: options.projectPath, json: options.json,
450
+ limit: parseInt(String(options.limit), 10),
451
+ type: options.type, level: options.level,
452
+ }],
453
+ },
454
+ stats: {
455
+ impl: { module: 'failure', export: 'failureStats' },
456
+ args: (_pos, options) => [{ projectPath: options.projectPath, json: options.json }],
457
+ },
458
+ st: {
459
+ impl: { module: 'failure', export: 'failureStats' },
460
+ args: (_pos, options) => [{ projectPath: options.projectPath, json: options.json }],
461
+ },
462
+ clear: {
463
+ impl: { module: 'failure', export: 'failureClear' },
464
+ args: (_pos, options) => [{ projectPath: options.projectPath, json: options.json }],
465
+ },
466
+ },
467
+ },
468
+ {
469
+ command: 'posteval-plan',
470
+ argument: '<planPath>',
471
+ description: '验证 plan 文件的 checklist items 是否都有对应的 staged diff',
472
+ options: [],
473
+ action: { module: 'posteval-plan', export: 'postevalPlan' },
474
+ mapActionArgs: (positionals) => [{ planPath: positionals[0] }],
475
+ },
476
+ {
477
+ command: 'update-user-model',
478
+ alias: 'uum',
479
+ description: '从新对话中提取信号,更新用户思维模型(增量演化)',
480
+ options: [
481
+ { flags: '--json', description: 'JSON 格式输出', defaultValue: false },
482
+ { flags: '--dry-run', description: '只显示变化,不更新状态', defaultValue: false },
483
+ { flags: '--days <n>', description: '只处理最近 N 天的会话(自然日,含今天)' },
484
+ ],
485
+ action: { module: 'update-user-model', export: 'updateUserModel' },
486
+ mapActionArgs: (_pos, options) => [{
487
+ days: options.days !== undefined ? parseInt(String(options.days), 10) : undefined,
488
+ json: options.json,
489
+ dryRun: options.dryRun,
490
+ }],
491
+ },
492
+ {
493
+ command: 'release',
494
+ description: 'npm 发布流水线:tsc → dist 验证 → npm version → git push → npm publish → gh release。不依赖 Studio API。',
495
+ options: [
496
+ { flags: '--bump <type>', description: '版本递增类型', defaultValue: 'patch' },
497
+ { flags: '--dry-run <bool>', description: '仅模拟执行', defaultValue: 'false' },
498
+ ],
499
+ action: { module: 'release', export: 'release' },
500
+ mapActionArgs: (_pos, options) => [{ bumpType: options.bump, dryRun: options.dryRun }],
501
+ },
502
+ {
503
+ command: 'analyze-sessions',
504
+ alias: 'analyze',
505
+ description: '分析 Claude Code 对话,挖掘纠正模式和高频概念,生成规则候选',
506
+ options: [
507
+ { flags: '-d, --days <n>', description: '分析最近 N 天的会话', defaultValue: '7' },
508
+ { flags: '--json', description: 'JSON 格式输出', defaultValue: false },
509
+ ],
510
+ action: { module: 'analyze-sessions', export: 'analyzeSessions' },
511
+ mapActionArgs: (_pos, options) => [{
512
+ days: parseInt(String(options.days), 10),
513
+ json: options.json,
514
+ }],
515
+ },
516
+ {
517
+ command: 'constraints',
518
+ description: '输出约束集合元数据(版本、hash、计数、文本大小)',
519
+ options: [
520
+ { flags: '--json', description: '输出 JSON 格式', defaultValue: false },
521
+ ],
522
+ action: { module: 'constraints', export: 'constraints' },
523
+ children: [
524
+ {
525
+ command: 'report',
526
+ description: '约束使用报告:check 层统计表、退役候选诊断、prompt 注入清单、配置健康(只读)',
527
+ options: [
528
+ { flags: '-p, --project-path <path>', description: '项目路径' },
529
+ { flags: '--export [file]', description: '导出脱敏 markdown 摘要(缺省 .harness/reports/constraints-<YYYYMMDD>.md)' },
530
+ { flags: '--json', description: '输出 JSON 格式', defaultValue: false },
531
+ { flags: '--zero-intercept-min <n>', description: '零拦截候选的最小评估样本数', defaultValue: '50' },
532
+ { flags: '--noise-fail-rate <rate>', description: '高噪候选 fail 率阈值', defaultValue: '0.8' },
533
+ { flags: '--noise-min-total <n>', description: '高噪候选最小评估样本数', defaultValue: '20' },
534
+ ],
535
+ action: { module: 'constraints-report', export: 'constraintsReport' },
536
+ mapActionArgs: (_pos, options) => [{
537
+ projectPath: options.projectPath,
538
+ export: options.export,
539
+ json: options.json,
540
+ zeroInterceptMin: parseInt(String(options.zeroInterceptMin), 10),
541
+ noiseFailRate: parseFloat(String(options.noiseFailRate)),
542
+ noiseMinTotal: parseInt(String(options.noiseMinTotal), 10),
543
+ }],
544
+ },
545
+ {
546
+ command: 'retire',
547
+ argument: '[id]',
548
+ description: '退役约束:无 id 进入交互式候选选择(人确认);带 id 直达退役需显式 --yes(写 config.yml + KnowledgeStore + 同步 CLAUDE.md 注入段)',
549
+ options: [
550
+ { flags: '-p, --project-path <path>', description: '项目路径' },
551
+ { flags: '--reason <text>', description: '退役原因' },
552
+ { flags: '-y, --yes', description: '显式确认直达退役(人确认闸门;无此 flag 直达报错并提示改走交互模式)', defaultValue: false },
553
+ ],
554
+ action: { module: 'constraints-retire', export: 'constraintsRetire' },
555
+ mapActionArgs: (positionals, options) => [positionals[0], {
556
+ projectPath: options.projectPath,
557
+ reason: options.reason,
558
+ yes: options.yes,
559
+ }],
560
+ },
561
+ ],
562
+ },
563
+ {
564
+ command: 'doc-freshness-check',
565
+ argument: '<docPath>',
566
+ description: '检查文档声明的新鲜度:提取可验证声明,与代码对照',
567
+ options: [
568
+ { flags: '--changed-files <list>', description: '变更文件列表(逗号分隔)' },
569
+ { flags: '--format <format>', description: '输出格式 (table/json)', defaultValue: 'table' },
570
+ { flags: '-p, --project-path <path>', description: '项目路径' },
571
+ ],
572
+ action: { module: 'doc-freshness-check', export: 'docFreshnessCheck' },
573
+ mapActionArgs: (positionals, options) => [positionals[0], {
574
+ changedFiles: options.changedFiles,
575
+ format: options.format,
576
+ projectPath: options.projectPath,
577
+ }],
578
+ },
579
+ {
580
+ command: 'spec-baseline-check',
581
+ argument: '<specPath>',
582
+ description: '验证 spec 文件的前置条件是否满足',
583
+ options: [
584
+ { flags: '-p, --project-path <path>', description: '项目路径' },
585
+ { flags: '--json', description: '输出 JSON 格式', defaultValue: false },
586
+ ],
587
+ action: { module: 'spec-baseline-check', export: 'specBaselineCheck' },
588
+ mapActionArgs: (positionals, options) => [positionals[0], {
589
+ projectPath: options.projectPath,
590
+ json: options.json,
591
+ }],
592
+ },
593
+ ];
@@ -15,7 +15,7 @@ import { ColdStartImporter } from '../../knowledge/import';
15
15
  import { KnowledgeAudit } from '../../knowledge/audit';
16
16
  import { migrateKnowledgeEntries } from '../../knowledge/migration';
17
17
  import { KnowledgeIndexGenerator } from '../../knowledge/index-generator';
18
- import type { KnowledgeType, MaturityLevel, QueryFilter } from '../../knowledge/types';
18
+ import type { KnowledgeSubsystem, MaturityLevel, QueryFilter } from '../../knowledge/types';
19
19
 
20
20
  export interface KnowledgeOptions {
21
21
  /** 项目路径 */
@@ -36,7 +36,7 @@ export async function knowledgeList(options: KnowledgeOptions & {
36
36
 
37
37
  const filter: QueryFilter = { excludeArchived: false };
38
38
  if (options.type) {
39
- filter.types = options.type.split(',') as KnowledgeType[];
39
+ filter.types = options.type.split(',') as KnowledgeSubsystem[];
40
40
  }
41
41
  if (options.maturity) {
42
42
  filter.maturity = options.maturity.split(',') as MaturityLevel[];
@@ -85,7 +85,7 @@ export async function knowledgeSearch(
85
85
  phase: 'cli',
86
86
  maxTokens: 10000,
87
87
  maxEntries: options.limit || 20,
88
- focusTypes: [] as KnowledgeType[],
88
+ focusTypes: [] as KnowledgeSubsystem[],
89
89
  };
90
90
 
91
91
  const result = queryEngine.query(budget);