@dommaker/harness 1.1.1 → 1.2.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 +10 -0
  2. package/README.md +2 -4
  3. package/bin/harness.js +12 -37
  4. package/dist/cli/commands/check.d.ts +2 -2
  5. package/dist/cli/commands/check.d.ts.map +1 -1
  6. package/dist/cli/commands/check.js +7 -32
  7. package/dist/cli/commands/check.js.map +1 -1
  8. package/dist/cli/commands/definitions.d.ts +2 -0
  9. package/dist/cli/commands/definitions.d.ts.map +1 -1
  10. package/dist/cli/commands/definitions.js.map +1 -1
  11. package/dist/cli/commands/init.d.ts.map +1 -1
  12. package/dist/cli/commands/init.js +6 -37
  13. package/dist/cli/commands/init.js.map +1 -1
  14. package/dist/cli/commands/knowledge.d.ts.map +1 -1
  15. package/dist/cli/commands/knowledge.js +1 -12
  16. package/dist/cli/commands/knowledge.js.map +1 -1
  17. package/dist/cli/commands/report.d.ts.map +1 -1
  18. package/dist/cli/commands/report.js +0 -2
  19. package/dist/cli/commands/report.js.map +1 -1
  20. package/dist/cli/commands/status.js +2 -2
  21. package/dist/cli/commands/status.js.map +1 -1
  22. package/dist/context/index.d.ts +9 -6
  23. package/dist/context/index.d.ts.map +1 -1
  24. package/dist/context/index.js +18 -20
  25. package/dist/context/index.js.map +1 -1
  26. package/dist/core/constraints/capabilities-parser.d.ts +3 -2
  27. package/dist/core/constraints/capabilities-parser.d.ts.map +1 -1
  28. package/dist/core/constraints/capabilities-parser.js +25 -47
  29. package/dist/core/constraints/capabilities-parser.js.map +1 -1
  30. package/dist/core/constraints/checker.d.ts +29 -32
  31. package/dist/core/constraints/checker.d.ts.map +1 -1
  32. package/dist/core/constraints/checker.js +34 -126
  33. package/dist/core/constraints/checker.js.map +1 -1
  34. package/dist/core/constraints/checkers/index.d.ts +2 -1
  35. package/dist/core/constraints/checkers/index.d.ts.map +1 -1
  36. package/dist/core/constraints/checkers/index.js +3 -0
  37. package/dist/core/constraints/checkers/index.js.map +1 -1
  38. package/dist/core/constraints/checkers/types.d.ts +25 -0
  39. package/dist/core/constraints/checkers/types.d.ts.map +1 -1
  40. package/dist/core/constraints/checkers/types.js +24 -0
  41. package/dist/core/constraints/checkers/types.js.map +1 -1
  42. package/dist/core/constraints/definitions/guidelines.d.ts.map +1 -1
  43. package/dist/core/constraints/definitions/guidelines.js +0 -2
  44. package/dist/core/constraints/definitions/guidelines.js.map +1 -1
  45. package/dist/core/constraints/definitions/prompts.d.ts.map +1 -1
  46. package/dist/core/constraints/definitions/prompts.js +0 -5
  47. package/dist/core/constraints/definitions/prompts.js.map +1 -1
  48. package/dist/core/constraints/index.d.ts +1 -2
  49. package/dist/core/constraints/index.d.ts.map +1 -1
  50. package/dist/core/constraints/index.js +1 -7
  51. package/dist/core/constraints/index.js.map +1 -1
  52. package/dist/core/constraints/usage-report.d.ts +1 -2
  53. package/dist/core/constraints/usage-report.d.ts.map +1 -1
  54. package/dist/core/constraints/usage-report.js +2 -5
  55. package/dist/core/constraints/usage-report.js.map +1 -1
  56. package/dist/core/effective-constraints.d.ts +24 -4
  57. package/dist/core/effective-constraints.d.ts.map +1 -1
  58. package/dist/core/effective-constraints.js +28 -7
  59. package/dist/core/effective-constraints.js.map +1 -1
  60. package/dist/core/effective-set.d.ts +30 -0
  61. package/dist/core/effective-set.d.ts.map +1 -0
  62. package/dist/core/effective-set.js +35 -0
  63. package/dist/core/effective-set.js.map +1 -0
  64. package/dist/core/index.d.ts +13 -6
  65. package/dist/core/index.d.ts.map +1 -1
  66. package/dist/core/index.js +44 -21
  67. package/dist/core/index.js.map +1 -1
  68. package/dist/core/project-config-loader.d.ts +3 -6
  69. package/dist/core/project-config-loader.d.ts.map +1 -1
  70. package/dist/core/project-config-loader.js +47 -61
  71. package/dist/core/project-config-loader.js.map +1 -1
  72. package/dist/failure/constraint-handler.d.ts +1 -1
  73. package/dist/failure/constraint-handler.js +1 -1
  74. package/dist/gates/checker-gate.d.ts +1 -4
  75. package/dist/gates/checker-gate.d.ts.map +1 -1
  76. package/dist/gates/checker-gate.js +3 -11
  77. package/dist/gates/checker-gate.js.map +1 -1
  78. package/dist/gates/definitions.d.ts +9 -38
  79. package/dist/gates/definitions.d.ts.map +1 -1
  80. package/dist/gates/definitions.js +24 -13
  81. package/dist/gates/definitions.js.map +1 -1
  82. package/dist/gates/effective-gates.d.ts.map +1 -1
  83. package/dist/gates/effective-gates.js +14 -18
  84. package/dist/gates/effective-gates.js.map +1 -1
  85. package/dist/gates/index.d.ts +1 -1
  86. package/dist/gates/index.d.ts.map +1 -1
  87. package/dist/gates/index.js.map +1 -1
  88. package/dist/hooks/bootstrap.d.ts.map +1 -1
  89. package/dist/hooks/bootstrap.js +0 -3
  90. package/dist/hooks/bootstrap.js.map +1 -1
  91. package/dist/index.d.ts +43 -60
  92. package/dist/index.d.ts.map +1 -1
  93. package/dist/index.js +180 -143
  94. package/dist/index.js.map +1 -1
  95. package/dist/knowledge/query.d.ts +15 -0
  96. package/dist/knowledge/query.d.ts.map +1 -1
  97. package/dist/knowledge/query.js +23 -0
  98. package/dist/knowledge/query.js.map +1 -1
  99. package/dist/monitoring/analyzer-base.d.ts +0 -4
  100. package/dist/monitoring/analyzer-base.d.ts.map +1 -1
  101. package/dist/monitoring/analyzer-base.js +0 -21
  102. package/dist/monitoring/analyzer-base.js.map +1 -1
  103. package/dist/monitoring/index.d.ts +6 -12
  104. package/dist/monitoring/index.d.ts.map +1 -1
  105. package/dist/monitoring/index.js +13 -29
  106. package/dist/monitoring/index.js.map +1 -1
  107. package/dist/monitoring/trace-analyzer.d.ts.map +1 -1
  108. package/dist/monitoring/trace-analyzer.js +2 -68
  109. package/dist/monitoring/trace-analyzer.js.map +1 -1
  110. package/dist/monitoring/traces.d.ts +0 -4
  111. package/dist/monitoring/traces.d.ts.map +1 -1
  112. package/dist/monitoring/traces.js +0 -14
  113. package/dist/monitoring/traces.js.map +1 -1
  114. package/dist/presets/index.d.ts +2 -2
  115. package/dist/presets/index.d.ts.map +1 -1
  116. package/dist/presets/index.js +3 -4
  117. package/dist/presets/index.js.map +1 -1
  118. package/dist/presets/standard.d.ts +10 -22
  119. package/dist/presets/standard.d.ts.map +1 -1
  120. package/dist/presets/standard.js +15 -75
  121. package/dist/presets/standard.js.map +1 -1
  122. package/dist/types/constraint.d.ts +1 -29
  123. package/dist/types/constraint.d.ts.map +1 -1
  124. package/dist/types/constraint.js +1 -1
  125. package/dist/types/constraint.js.map +1 -1
  126. package/dist/types/index.d.ts +0 -3
  127. package/dist/types/index.d.ts.map +1 -1
  128. package/dist/types/index.js +0 -4
  129. package/dist/types/index.js.map +1 -1
  130. package/dist/types/project-config.d.ts +4 -8
  131. package/dist/types/project-config.d.ts.map +1 -1
  132. package/dist/types/trace.d.ts +5 -18
  133. package/dist/types/trace.d.ts.map +1 -1
  134. package/package.json +2 -2
  135. package/src/CONTEXT.md +4 -5
  136. package/src/__tests__/checker-extra.test.ts +33 -139
  137. package/src/__tests__/checker.test.ts +0 -376
  138. package/src/__tests__/project-config-loader-extra.test.ts +42 -29
  139. package/src/__tests__/public-exports.test.ts +138 -0
  140. package/src/__tests__/trace-analyzer-extra.test.ts +6 -86
  141. package/src/__tests__/trace-analyzer.test.ts +4 -5
  142. package/src/__tests__/trace-collector.test.ts +0 -11
  143. package/src/__tests__/traces.test.ts +3 -22
  144. package/src/cli/commands/CONTEXT.md +2 -2
  145. package/src/cli/commands/__tests__/check-skip-output.test.ts +10 -7
  146. package/src/cli/commands/__tests__/check.test.ts +29 -69
  147. package/src/cli/commands/__tests__/constraints-report.test.ts +1 -1
  148. package/src/cli/commands/__tests__/knowledge.test.ts +90 -1
  149. package/src/cli/commands/__tests__/registry.test.ts +8 -6
  150. package/src/cli/commands/__tests__/status-extra.test.ts +6 -6
  151. package/src/cli/commands/__tests__/status.test.ts +6 -6
  152. package/src/cli/commands/check.ts +8 -34
  153. package/src/cli/commands/definitions.ts +2 -0
  154. package/src/cli/commands/init.ts +6 -37
  155. package/src/cli/commands/knowledge.ts +1 -16
  156. package/src/cli/commands/report.ts +0 -2
  157. package/src/cli/commands/status.ts +2 -2
  158. package/src/context/index.ts +29 -6
  159. package/src/core/CONTEXT.md +4 -3
  160. package/src/core/__tests__/effective-set.test.ts +80 -0
  161. package/src/core/constraints/capabilities-parser.ts +43 -49
  162. package/src/core/constraints/checker.ts +51 -145
  163. package/src/core/constraints/checkers/index.ts +2 -1
  164. package/src/core/constraints/checkers/types.ts +42 -0
  165. package/src/core/constraints/definitions/guidelines.ts +0 -2
  166. package/src/core/constraints/definitions/prompts.ts +0 -5
  167. package/src/core/constraints/index.ts +2 -17
  168. package/src/core/constraints/usage-report.ts +5 -8
  169. package/src/core/effective-constraints.ts +35 -7
  170. package/src/core/effective-set.ts +56 -0
  171. package/src/core/index.ts +80 -6
  172. package/src/core/project-config-loader.ts +53 -68
  173. package/src/failure/CONTEXT.md +1 -1
  174. package/src/failure/constraint-handler.ts +1 -1
  175. package/src/gates/CONTEXT.md +3 -3
  176. package/src/gates/checker-gate.ts +4 -12
  177. package/src/gates/definitions.ts +27 -50
  178. package/src/gates/effective-gates.ts +14 -21
  179. package/src/gates/index.ts +1 -1
  180. package/src/hooks/bootstrap.ts +0 -3
  181. package/src/index.ts +384 -148
  182. package/src/knowledge/CONTEXT.md +2 -2
  183. package/src/knowledge/__tests__/query.test.ts +64 -0
  184. package/src/knowledge/query.ts +28 -0
  185. package/src/monitoring/CONTEXT.md +7 -13
  186. package/src/monitoring/__tests__/traces.test.ts +0 -10
  187. package/src/monitoring/analyzer-base.ts +0 -22
  188. package/src/monitoring/index.ts +6 -12
  189. package/src/monitoring/trace-analyzer.ts +2 -73
  190. package/src/monitoring/traces.ts +0 -20
  191. package/src/presets/__tests__/standard.test.ts +48 -69
  192. package/src/presets/index.ts +3 -5
  193. package/src/presets/standard.ts +14 -79
  194. package/src/spec/CONTEXT.md +5 -13
  195. package/src/types/constraint.ts +1 -51
  196. package/src/types/index.ts +0 -12
  197. package/src/types/project-config.ts +4 -10
  198. package/src/types/trace.ts +5 -30
  199. package/dist/core/constraints/interceptor.d.ts +0 -39
  200. package/dist/core/constraints/interceptor.d.ts.map +0 -1
  201. package/dist/core/constraints/interceptor.js +0 -166
  202. package/dist/core/constraints/interceptor.js.map +0 -1
  203. package/dist/dashboard/data.d.ts +0 -31
  204. package/dist/dashboard/data.d.ts.map +0 -1
  205. package/dist/dashboard/data.js +0 -81
  206. package/dist/dashboard/data.js.map +0 -1
  207. package/dist/dashboard/index.d.ts +0 -4
  208. package/dist/dashboard/index.d.ts.map +0 -1
  209. package/dist/dashboard/index.js +0 -20
  210. package/dist/dashboard/index.js.map +0 -1
  211. package/dist/dashboard/stats.d.ts +0 -20
  212. package/dist/dashboard/stats.d.ts.map +0 -1
  213. package/dist/dashboard/stats.js +0 -115
  214. package/dist/dashboard/stats.js.map +0 -1
  215. package/dist/dashboard/types.d.ts +0 -110
  216. package/dist/dashboard/types.d.ts.map +0 -1
  217. package/dist/dashboard/types.js +0 -8
  218. package/dist/dashboard/types.js.map +0 -1
  219. package/dist/monitoring/constraint-doctor.d.ts +0 -76
  220. package/dist/monitoring/constraint-doctor.d.ts.map +0 -1
  221. package/dist/monitoring/constraint-doctor.js +0 -189
  222. package/dist/monitoring/constraint-doctor.js.map +0 -1
  223. package/dist/monitoring/diagnosis-rules.d.ts +0 -18
  224. package/dist/monitoring/diagnosis-rules.d.ts.map +0 -1
  225. package/dist/monitoring/diagnosis-rules.js +0 -119
  226. package/dist/monitoring/diagnosis-rules.js.map +0 -1
  227. package/dist/monitoring/knowledge-doctor.d.ts +0 -78
  228. package/dist/monitoring/knowledge-doctor.d.ts.map +0 -1
  229. package/dist/monitoring/knowledge-doctor.js +0 -266
  230. package/dist/monitoring/knowledge-doctor.js.map +0 -1
  231. package/dist/monitoring/knowledge-evolver.d.ts +0 -72
  232. package/dist/monitoring/knowledge-evolver.d.ts.map +0 -1
  233. package/dist/monitoring/knowledge-evolver.js +0 -205
  234. package/dist/monitoring/knowledge-evolver.js.map +0 -1
  235. package/dist/monitoring/performance-analyzer.d.ts +0 -92
  236. package/dist/monitoring/performance-analyzer.d.ts.map +0 -1
  237. package/dist/monitoring/performance-analyzer.js +0 -343
  238. package/dist/monitoring/performance-analyzer.js.map +0 -1
  239. package/dist/monitoring/performance-collector.d.ts +0 -103
  240. package/dist/monitoring/performance-collector.d.ts.map +0 -1
  241. package/dist/monitoring/performance-collector.js +0 -298
  242. package/dist/monitoring/performance-collector.js.map +0 -1
  243. package/dist/safety/index.d.ts +0 -6
  244. package/dist/safety/index.d.ts.map +0 -1
  245. package/dist/safety/index.js +0 -22
  246. package/dist/safety/index.js.map +0 -1
  247. package/dist/safety/input-guardrail.d.ts +0 -36
  248. package/dist/safety/input-guardrail.d.ts.map +0 -1
  249. package/dist/safety/input-guardrail.js +0 -118
  250. package/dist/safety/input-guardrail.js.map +0 -1
  251. package/dist/safety/output-guardrail.d.ts +0 -39
  252. package/dist/safety/output-guardrail.d.ts.map +0 -1
  253. package/dist/safety/output-guardrail.js +0 -147
  254. package/dist/safety/output-guardrail.js.map +0 -1
  255. package/dist/safety/sandbox.d.ts +0 -45
  256. package/dist/safety/sandbox.d.ts.map +0 -1
  257. package/dist/safety/sandbox.js +0 -134
  258. package/dist/safety/sandbox.js.map +0 -1
  259. package/dist/safety/tool-guardrail.d.ts +0 -51
  260. package/dist/safety/tool-guardrail.d.ts.map +0 -1
  261. package/dist/safety/tool-guardrail.js +0 -147
  262. package/dist/safety/tool-guardrail.js.map +0 -1
  263. package/dist/safety/types.d.ts +0 -104
  264. package/dist/safety/types.d.ts.map +0 -1
  265. package/dist/safety/types.js +0 -6
  266. package/dist/safety/types.js.map +0 -1
  267. package/dist/spec/annotation-checker.d.ts +0 -47
  268. package/dist/spec/annotation-checker.d.ts.map +0 -1
  269. package/dist/spec/annotation-checker.js +0 -279
  270. package/dist/spec/annotation-checker.js.map +0 -1
  271. package/dist/types/enforcement.d.ts +0 -42
  272. package/dist/types/enforcement.d.ts.map +0 -1
  273. package/dist/types/enforcement.js +0 -6
  274. package/dist/types/enforcement.js.map +0 -1
  275. package/dist/types/monitoring-types.d.ts +0 -53
  276. package/dist/types/monitoring-types.d.ts.map +0 -1
  277. package/dist/types/monitoring-types.js +0 -10
  278. package/dist/types/monitoring-types.js.map +0 -1
  279. package/dist/types/performance.d.ts +0 -204
  280. package/dist/types/performance.d.ts.map +0 -1
  281. package/dist/types/performance.js +0 -12
  282. package/dist/types/performance.js.map +0 -1
  283. package/dist/verification/index.d.ts +0 -4
  284. package/dist/verification/index.d.ts.map +0 -1
  285. package/dist/verification/index.js +0 -20
  286. package/dist/verification/index.js.map +0 -1
  287. package/dist/verification/loop.d.ts +0 -30
  288. package/dist/verification/loop.d.ts.map +0 -1
  289. package/dist/verification/loop.js +0 -114
  290. package/dist/verification/loop.js.map +0 -1
  291. package/dist/verification/rules-based.d.ts +0 -40
  292. package/dist/verification/rules-based.d.ts.map +0 -1
  293. package/dist/verification/rules-based.js +0 -130
  294. package/dist/verification/rules-based.js.map +0 -1
  295. package/dist/verification/types.d.ts +0 -69
  296. package/dist/verification/types.d.ts.map +0 -1
  297. package/dist/verification/types.js +0 -6
  298. package/dist/verification/types.js.map +0 -1
  299. package/src/__tests__/annotation-checker.test.ts +0 -183
  300. package/src/__tests__/constraint-doctor.test.ts +0 -271
  301. package/src/__tests__/doctor-extra.test.ts +0 -155
  302. package/src/__tests__/extend-exceptions.test.ts +0 -149
  303. package/src/__tests__/interceptor.test.ts +0 -89
  304. package/src/__tests__/performance-analyzer.test.ts +0 -499
  305. package/src/__tests__/performance-collector.test.ts +0 -276
  306. package/src/__tests__/presets.test.ts +0 -65
  307. package/src/core/constraints/__tests__/interceptor.test.ts +0 -267
  308. package/src/core/constraints/interceptor.ts +0 -217
  309. package/src/dashboard/CONTEXT.md +0 -21
  310. package/src/dashboard/__tests__/data.test.ts +0 -111
  311. package/src/dashboard/__tests__/stats.test.ts +0 -159
  312. package/src/dashboard/data.ts +0 -103
  313. package/src/dashboard/index.ts +0 -3
  314. package/src/dashboard/stats.ts +0 -127
  315. package/src/dashboard/types.ts +0 -130
  316. package/src/monitoring/__tests__/knowledge-doctor.test.ts +0 -278
  317. package/src/monitoring/__tests__/knowledge-evolver.test.ts +0 -368
  318. package/src/monitoring/__tests__/performance-analyzer.test.ts +0 -137
  319. package/src/monitoring/__tests__/performance-collector.test.ts +0 -331
  320. package/src/monitoring/constraint-doctor.ts +0 -228
  321. package/src/monitoring/diagnosis-rules.ts +0 -132
  322. package/src/monitoring/knowledge-doctor.ts +0 -322
  323. package/src/monitoring/knowledge-evolver.ts +0 -289
  324. package/src/monitoring/performance-analyzer.ts +0 -400
  325. package/src/monitoring/performance-collector.ts +0 -326
  326. package/src/safety/CONTEXT.md +0 -23
  327. package/src/safety/__tests__/input-guardrail.test.ts +0 -105
  328. package/src/safety/__tests__/output-guardrail.test.ts +0 -108
  329. package/src/safety/__tests__/sandbox.test.ts +0 -158
  330. package/src/safety/__tests__/tool-guardrail.test.ts +0 -127
  331. package/src/safety/index.ts +0 -5
  332. package/src/safety/input-guardrail.ts +0 -133
  333. package/src/safety/output-guardrail.ts +0 -170
  334. package/src/safety/sandbox.ts +0 -148
  335. package/src/safety/tool-guardrail.ts +0 -176
  336. package/src/safety/types.ts +0 -124
  337. package/src/spec/__tests__/annotation-checker.test.ts +0 -294
  338. package/src/spec/annotation-checker.ts +0 -320
  339. package/src/types/enforcement.ts +0 -48
  340. package/src/types/monitoring-types.ts +0 -68
  341. package/src/types/performance.ts +0 -295
  342. package/src/verification/CONTEXT.md +0 -23
  343. package/src/verification/__tests__/loop.test.ts +0 -303
  344. package/src/verification/__tests__/rules-based.test.ts +0 -240
  345. package/src/verification/index.ts +0 -3
  346. package/src/verification/loop.ts +0 -137
  347. package/src/verification/rules-based.ts +0 -152
  348. package/src/verification/types.ts +0 -81
package/src/core/index.ts CHANGED
@@ -1,13 +1,78 @@
1
1
  /**
2
- * 核心模块导出
2
+ * 核心模块导出(ADR-0003:显式清单,禁 export *)
3
+ *
4
+ * checkConstraints 与包根统一为 options 对象签名(CheckConstraintsOptions),
5
+ * 不再暴露位置参数版。
3
6
  */
4
7
 
5
8
  // 约束系统(三层:Iron Laws / Guidelines / Tips)
9
+ export {
10
+ IRON_LAWS,
11
+ GUIDELINES,
12
+ PROMPTS,
13
+ getAllConstraints,
14
+ findConstraintsByTrigger,
15
+ getConstraint,
16
+ ConstraintChecker,
17
+ checkConstraint,
18
+ checkConstraints,
19
+ checkBeforeExecution,
20
+ constraintChecker,
21
+ CONSTRAINTS_START_MARKER,
22
+ CONSTRAINTS_END_MARKER,
23
+ renderConstraintsSection,
24
+ CheckCache,
25
+ renderConstraintsByTrigger,
26
+ ConstraintViolationError,
27
+ } from './constraints';
28
+ export type {
29
+ CheckConstraintsOptions,
30
+ CheckCacheConfig,
31
+ CheckSamplingConfig,
32
+ RenderConstraintsByTriggerOptions,
33
+ ConstraintId,
34
+ ConstraintKind,
35
+ ConstraintLevel,
36
+ ConstraintTrigger,
37
+ Constraint,
38
+ ConstraintResult,
39
+ ConstraintContext,
40
+ ConstraintCheckResult,
41
+ IronLawContext,
42
+ } from './constraints';
6
43
 
7
- export * from './constraints';
44
+ // 验证器(检查点 / PassesGate / CSO)
45
+ export {
46
+ CheckpointValidator,
47
+ PassesGate,
48
+ createPassesGate,
49
+ CSOValidator,
50
+ } from './validators';
51
+ export type {
52
+ CSOValidationResult,
53
+ CSOIssue,
54
+ Checkpoint,
55
+ CheckpointCheck,
56
+ CheckpointResult,
57
+ CheckResult,
58
+ CheckpointContext,
59
+ CheckType,
60
+ CheckConfig,
61
+ PassesGateConfig,
62
+ PassesGateResult,
63
+ TaskTestResult,
64
+ DynamicTask,
65
+ } from './validators';
8
66
 
9
- export * from './validators';
10
- export * from './session';
67
+ // 会话启动 / 净室状态
68
+ export {
69
+ SessionStartup,
70
+ createSessionStartup,
71
+ DEFAULT_CODE_CHECKPOINTS,
72
+ MINIMAL_CHECKPOINTS,
73
+ CleanStateManager,
74
+ createCleanStateManager,
75
+ } from './session';
11
76
 
12
77
  // Spec 验证器
13
78
  export { SpecValidator } from './spec/validator';
@@ -20,7 +85,16 @@ export type {
20
85
  } from '../types/spec';
21
86
 
22
87
  // 项目配置加载器
23
- export * from './project-config-loader';
88
+ export {
89
+ ProjectConfigLoader,
90
+ loadRawProjectConfig,
91
+ getCapabilitiesMode,
92
+ } from './project-config-loader';
93
+ export type { CapabilitiesMode } from './project-config-loader';
24
94
 
25
95
  // 生效约束集(ADR-0001:唯一生效集来源)
26
- export * from './effective-constraints';
96
+ export {
97
+ getEffectiveConstraints,
98
+ lintEffectiveConfig,
99
+ } from './effective-constraints';
100
+ export type { EffectiveConfigLint } from './effective-constraints';
@@ -16,7 +16,8 @@ import type {
16
16
  CapabilitiesConfig,
17
17
  } from '../types/project-config';
18
18
  import { IRON_LAWS, GUIDELINES, PROMPTS } from './constraints/definitions';
19
- import { applyPreset } from '../presets';
19
+ import { PRESETS_BY_NAME, STANDARD_PRESET } from '../presets';
20
+ import { filterEnabledEntries } from './effective-set';
20
21
 
21
22
  /**
22
23
  * 默认配置
@@ -156,47 +157,72 @@ export class ProjectConfigLoader {
156
157
  * 合并内置约束和自定义约束(ADR-0001 生效集完整链路)
157
158
  *
158
159
  * 合并顺序:内置 → preset 裁剪 → config.yml `constraints.<id>.enabled:false`
159
- * 删除(对内置与 custom 同效)→ custom-constraints 追加/extend_exceptions
160
+ * 删除(对内置与 custom 同效)→ custom-constraints 追加
160
161
  * (禁用/已退役的 custom 不追加)→ scenes 过滤
161
162
  * (带 appliesTo 的 prompt 仅当 scenes 交集非空时保留)。
162
163
  *
163
164
  * config.yml 中未知约束 id(如已移除约束的禁用残留)静默忽略,
164
165
  * 记录在结果 unknownIds 中供诊断。
165
166
  *
166
- * @param options.preset 覆盖 config.yml 的 preset(CLI --preset 用)
167
+ * @param options.preset 覆盖 config.yml 的 preset(CLI --preset 用);
168
+ * 未知预设名回落 standard + stderr 警告
167
169
  */
168
170
  mergeConstraints(options?: { preset?: string }): MergedConstraintsConfig {
169
- // 0. preset 裁剪(未知预设名由 applyPreset 回落 standard)
170
- const presetMerged = applyPreset(options?.preset ?? this.config.preset ?? 'standard');
171
+ // 0. preset 裁剪(strict standard 的别名;未知名回落 standard)
172
+ const presetName = options?.preset ?? this.config.preset ?? 'standard';
173
+ let preset = PRESETS_BY_NAME[presetName];
174
+ if (!preset) {
175
+ console.error(`[harness] 未知预设 "${presetName}",已回落 standard`);
176
+ preset = STANDARD_PRESET;
177
+ }
178
+ const pick = (
179
+ source: Record<string, Constraint>,
180
+ ids: string[] | null
181
+ ): Record<string, Constraint> => {
182
+ if (ids === null) return { ...source };
183
+ const filtered: Record<string, Constraint> = {};
184
+ for (const id of ids) {
185
+ if (source[id]) filtered[id] = source[id];
186
+ }
187
+ return filtered;
188
+ };
189
+ const presetDisabled = (
190
+ source: Record<string, Constraint>,
191
+ ids: string[] | null
192
+ ): string[] => (ids === null ? [] : Object.keys(source).filter(id => !ids.includes(id)));
193
+
171
194
  const unknownIds: string[] = [];
172
195
  const result: MergedConstraintsConfig = {
173
- ironLaws: presetMerged.ironLaws,
174
- guidelines: presetMerged.guidelines,
175
- prompts: presetMerged.prompts ?? {},
176
- disabled: [...presetMerged.disabled],
196
+ ironLaws: pick(IRON_LAWS, preset.ironLaws),
197
+ guidelines: pick(GUIDELINES, preset.guidelines),
198
+ prompts: pick(PROMPTS, preset.prompts),
199
+ disabled: [
200
+ ...presetDisabled(IRON_LAWS, preset.ironLaws),
201
+ ...presetDisabled(GUIDELINES, preset.guidelines),
202
+ ...presetDisabled(PROMPTS, preset.prompts),
203
+ ],
177
204
  custom: [],
178
205
  unknownIds,
179
206
  };
180
207
 
181
- // 1. 处理启用/禁用配置
208
+ // 1. 处理启用/禁用配置(未知 id 静默忽略,记录供诊断)
182
209
  if (this.config.constraints) {
183
- for (const [constraintId, config] of Object.entries(this.config.constraints)) {
184
- const isKnown =
185
- !!IRON_LAWS[constraintId] ||
186
- !!GUIDELINES[constraintId] ||
187
- !!PROMPTS[constraintId] ||
188
- !!this.customConstraints[constraintId];
189
- if (!isKnown) {
190
- // 未知 id(如已移除约束的禁用残留):不报错,记录供诊断
191
- unknownIds.push(constraintId);
192
- }
193
- if (config.enabled === false) {
194
- result.disabled.push(constraintId);
195
- // 从对应层级中移除
196
- delete result.ironLaws[constraintId];
197
- delete result.guidelines[constraintId];
198
- delete result.prompts![constraintId];
199
- }
210
+ const knownIds = new Set([
211
+ ...Object.keys(IRON_LAWS),
212
+ ...Object.keys(GUIDELINES),
213
+ ...Object.keys(PROMPTS),
214
+ ...Object.keys(this.customConstraints),
215
+ ]);
216
+ const filtered = filterEnabledEntries(knownIds, this.config.constraints, {
217
+ onUnknownId: 'collect',
218
+ });
219
+ unknownIds.push(...filtered.unknownIds);
220
+ for (const constraintId of filtered.disabledIds) {
221
+ result.disabled.push(constraintId);
222
+ // 从对应层级中移除
223
+ delete result.ironLaws[constraintId];
224
+ delete result.guidelines[constraintId];
225
+ delete result.prompts![constraintId];
200
226
  }
201
227
  }
202
228
 
@@ -207,38 +233,8 @@ export class ProjectConfigLoader {
207
233
  if (result.disabled.includes(id) || customDef.retired) {
208
234
  continue;
209
235
  }
210
- const extendExceptions = customDef.extend_exceptions;
211
- const isExtendOnly =
212
- !!extendExceptions && extendExceptions.length > 0 &&
213
- !customDef.rule &&
214
- !customDef.exceptions;
215
-
216
- if (isExtendOnly) {
217
- const builtIn = this.findBuiltInConstraint(id, result);
218
- if (builtIn) {
219
- const constraint = { ...builtIn };
220
- constraint.exceptions = [
221
- ...(builtIn.exceptions || []),
222
- ...extendExceptions!,
223
- ];
224
- if (result.ironLaws[id]) result.ironLaws[id] = constraint;
225
- if (result.guidelines[id]) result.guidelines[id] = constraint;
226
- if (result.prompts![id]) result.prompts![id] = constraint;
227
- continue;
228
- }
229
- }
230
-
231
236
  const constraint = this.toConstraint(customDef, id);
232
237
 
233
- if (extendExceptions && extendExceptions.length > 0) {
234
- const builtIn = this.findBuiltInConstraint(id, result);
235
- constraint.exceptions = [
236
- ...(builtIn?.exceptions || []),
237
- ...(customDef.exceptions || []),
238
- ...extendExceptions,
239
- ];
240
- }
241
-
242
238
  result.custom.push(id);
243
239
 
244
240
  const level = customDef.level || 'guideline';
@@ -272,16 +268,6 @@ export class ProjectConfigLoader {
272
268
  return result;
273
269
  }
274
270
 
275
- /**
276
- * 在合并结果中查找内置约束
277
- */
278
- private findBuiltInConstraint(
279
- id: string,
280
- merged: MergedConstraintsConfig
281
- ): Constraint | undefined {
282
- return merged.ironLaws[id] || merged.guidelines[id] || merged.prompts?.[id];
283
- }
284
-
285
271
  /**
286
272
  * 将自定义约束定义转换为 Constraint
287
273
  *
@@ -298,7 +284,6 @@ export class ProjectConfigLoader {
298
284
  rule: def.rule || '',
299
285
  message: def.message || '',
300
286
  trigger: (def.trigger || 'manual') as ConstraintTrigger | ConstraintTrigger[],
301
- exceptions: def.exceptions,
302
287
  description: def.description,
303
288
  promptInjection: def.promptInjection,
304
289
  enabled: def.enabled !== false,
@@ -12,7 +12,7 @@
12
12
  ## 依赖关系
13
13
  - 依赖 `src/types/constraint` ConstraintViolationError
14
14
  - 依赖 `src/core/constraints/` 约束检查结果
15
- - 被 `src/core/constraints/interceptor.ts` 消费
15
+ - 被 `src/cli/commands/report.ts` 消费(executeWithCollect),并经包根导出
16
16
 
17
17
  ## 约定
18
18
  - 分类规则可扩展(自定义 ErrorClassifierConfig)
@@ -2,7 +2,7 @@
2
2
  * ConstraintViolationHandler — 约束违规统一处理(S4)
3
3
  *
4
4
  * 问题:ConstraintViolationError 在 4 个调用点有 4 种行为:
5
- * 1. 抛异常阻断(checker.ts / interceptor.ts
5
+ * 1. 抛异常阻断(checker.ts)
6
6
  * 2. 返回 null(report.ts catch 后返回空数据)
7
7
  * 3. 返回 403 HTTP 状态
8
8
  * 4. console.warn 静默吞掉
@@ -6,10 +6,10 @@
6
6
  ## 核心导出
7
7
  - 统一协议:`Gate{id, order, evaluate(ctx)}` → `GateDecision{status: deny|abstain|ask, result: GateResult}`(`types.ts`;`decisionFromResult` 报告→决策映射,浅冻结)
8
8
  - 注册表:`gateRegistry`(`registry.ts`)——定义即注册 + 构建期双向闭环(定义无实现/实现无定义/重复 id → 加载期抛错);`getGate`(未注册抛错)/`listRegisteredGates`/`registeredGateCount`
9
- - 定义表:`GATE_DEFINITIONS`(`definitions.ts`)——id/description/默认 order/CLI 元数据;bin/harness.js 注册表驱动生成 6 门禁命令(纯数据模块,禁 import 实现,保 --help 懒加载;CLI 实现引用为 module+export,per-command 懒加载,H5)
9
+ - 定义表:`GATE_DEFINITIONS`(`definitions.ts`)——id/description/默认 order/CLI 元数据;CLI 元数据形状即 `CommandDefinition`(ADR-0007:门禁与非门禁共用同一命令定义形状,bin 单引擎单循环;门禁特有语义 = `subcommandStrict:false` 未知子命令落回默认 action + `bareRunsAction:true` 裸跑执行 action);bin/harness.js 注册表驱动生成 6 门禁命令(纯数据模块,禁 import 实现,保 --help 懒加载;CLI 实现引用为 module+export,per-command 懒加载,H5)
10
10
  - 执行器:`runGates`(`runner.ts`)——按 order 升序;deny 单调(下游 abstain 不得改回 allow)+ ask 枚举预留 fail-closed = deny;决策浅冻结
11
- - 生效集:`getEffectiveGates(projectRoot)`(`effective-gates.ts`)——对齐 getEffectiveConstraints 裁剪模式:config.yml `gates.order` 重排 + `gates.<id>.enabled:false` 移除;引用未注册 id 抛错
12
- - checker-as-guard 接线点:`createCheckerGate(check)`(`checker-gate.ts`)——ConstraintCheck → Gate(studio #129 随动);false→deny,true/'skip'→abstain
11
+ - 生效集:`getEffectiveGates(projectRoot)`(`effective-gates.ts`)——对齐 getEffectiveConstraints 裁剪模式:config.yml `gates.order` 重排 + `gates.<id>.enabled:false` 移除;enabled 段未注册校验与裁剪走 core/effective-set 共享筛选器(throw 模式),order 重排与重复 id 检测留本侧
12
+ - checker-as-guard 接线点:`createCheckerGate(check)`(`checker-gate.ts`)——ConstraintCheck → Gate(studio #129 随动);false→deny,true/'skip'→abstain;env 经 `buildCheckEnv(..., 'none')` 构造(显式不接证据,语义见 core/constraints/checkers/types.ts 工厂 doc)
13
13
  - 门禁类:`ReviewGate` / `SecurityGate` / `PerformanceGate` / `ContractGate` / `SpecAcceptanceGate` / `CommandGate`(各自执行细节私有,保留 `check()`/`scan()` 报告方法)
14
14
  - `types.ts` — GateResult(报告结构,保留)/ GateContext / GateDecision 等公共类型
15
15
  - 便捷工厂函数:createReviewGate / createSecurityGate / createPerformanceGate / createContractGate / createSpecAcceptanceGate / createCommandGate
@@ -4,13 +4,11 @@
4
4
  * 把已注册的 ConstraintCheck 适配为统一 Gate,供守卫链(如 studio
5
5
  * runCompletionGuards)复用 runGates 的 deny 单调 / ask fail-closed 语义。
6
6
  *
7
- * 证据语义:本接线点构造的 CheckEnv 不带 git staged diff / 源码扫描证据
8
- * (stagedDiff 空、srcScan 空)——证据 flag 未接线的 checker 按契约返回
9
- * 'skip'(不阻断,映射为 abstain);纯上下文判断的 checker 照常判定。
10
- * studio 侧若需 git 证据,在 #129 接线时扩展 CheckEnv 构造。
7
+ * env buildCheckEnv(..., 'none') 构造(显式不接证据),语义见工厂 doc。
11
8
  */
12
9
 
13
- import type { CheckEnv, ConstraintCheck } from '../core/constraints/checkers';
10
+ import type { ConstraintCheck } from '../core/constraints/checkers';
11
+ import { buildCheckEnv } from '../core/constraints/checkers';
14
12
  import type { Gate, GateContext, GateDecision } from './types';
15
13
  import { decisionFromResult } from './decision';
16
14
 
@@ -29,13 +27,7 @@ export function createCheckerGate(check: ConstraintCheck, order = 0): Gate {
29
27
  async evaluate(ctx: GateContext): Promise<GateDecision> {
30
28
  const startTime = Date.now();
31
29
  const projectPath = ctx.projectPath || process.cwd();
32
- const env: CheckEnv = {
33
- context: { operation: 'manual', projectPath },
34
- projectPath,
35
- stagedDiff: async () => '',
36
- stagedDiffNames: async () => '',
37
- srcScan: () => [],
38
- };
30
+ const env = buildCheckEnv({ operation: 'manual', projectPath }, 'none');
39
31
  const outcome = await check.evaluate(env);
40
32
  return decisionFromResult({
41
33
  gate: check.id,
@@ -3,49 +3,18 @@
3
3
  *
4
4
  * - 每个门禁在此声明 id / description / 默认 order / CLI 元数据;
5
5
  * registry.ts 按此表做「定义↔实现」双向闭环校验(复制 checker 闭环模式)。
6
- * - CLI 元数据被 bin/harness.js 消费,注册表驱动生成 6 个门禁命令:
7
- * 命令名/别名/选项/子命令路由与历史手工块完全兼容;实现引用为
8
- * module+export(CommandImplRef),bin 按需 per-command 懒加载(H5/O2)。
6
+ * - CLI 元数据即 CommandDefinition(架构评审候选8,ADR-0007:形状对齐通用
7
+ * 命令定义,bin/harness.js 单引擎单循环生成全部命令):命令名/别名/选项/
8
+ * 子命令路由与历史手工块完全兼容;实现引用为 module+export(CommandImplRef),
9
+ * bin 按需 per-command 懒加载(H5/O2)。门禁特有语义由两个标志表达:
10
+ * subcommandStrict:false(未知位置参数落回默认 action)+
11
+ * bareRunsAction:true(无位置参数时跑默认 action 而非显示帮助)。
9
12
  * - 本模块禁止 import 任何门禁/命令实现(仅 type import,运行时零依赖)——
10
13
  * bin 启动期只加载本纯数据模块(保持 --help/--version 懒加载,
11
14
  * 闭环校验在 registry 加载期执行)。
12
15
  */
13
16
 
14
- import type { CommandImplRef } from '../cli/commands/definitions';
15
-
16
- /**
17
- * 门禁 CLI 选项元数据(直接映射 commander `.option()`)
18
- */
19
- export interface GateCliOption {
20
- /** commander option flags,如 '-p, --project-path <path>' */
21
- flags: string;
22
- /** 选项描述 */
23
- description: string;
24
- /** commander 缺省值;negated option(如 --no-strict)不设,由 commander 默认 true */
25
- defaultValue?: string | boolean;
26
- }
27
-
28
- /**
29
- * 门禁 CLI 命令元数据(bin/harness.js 注册表驱动生成)
30
- */
31
- export interface GateCliDefinition {
32
- /** 命令名(历史命令名兼容保留) */
33
- command: string;
34
- /** 命令别名 */
35
- alias?: string;
36
- /** 位置参数声明,如 '[subcommand]' / '[cmd]' */
37
- argument?: string;
38
- /** 命令描述 */
39
- description: string;
40
- /** 命令选项 */
41
- options: GateCliOption[];
42
- /** 子命令名 → 命令实现引用(module+export);命中后按 [options] 透传 */
43
- subcommands?: Record<string, CommandImplRef>;
44
- /** 默认 action 命令实现引用(module+export) */
45
- action: CommandImplRef;
46
- /** 默认 action 实参构造:arg = 位置参数(无位置参数时为 undefined),options = commander 选项对象 */
47
- mapActionArgs: (arg: string | undefined, options: Record<string, unknown>) => unknown[];
48
- }
17
+ import type { CommandDefinition } from '../cli/commands/definitions';
49
18
 
50
19
  /**
51
20
  * 门禁定义
@@ -57,8 +26,8 @@ export interface GateDefinition {
57
26
  description: string;
58
27
  /** 默认顺序(config.yml `gates.order` 可覆盖),小者先执行 */
59
28
  order: number;
60
- /** CLI 元数据(bin/harness.js 注册表驱动生成) */
61
- cli: GateCliDefinition;
29
+ /** CLI 元数据(形状 = CommandDefinition,bin/harness.js 通用引擎驱动生成) */
30
+ cli: CommandDefinition;
62
31
  }
63
32
 
64
33
  /**
@@ -81,9 +50,11 @@ export const GATE_DEFINITIONS: GateDefinition[] = [
81
50
  { flags: '--check-all', description: '检查所有任务', defaultValue: false },
82
51
  { flags: '--run-e2e', description: '运行 E2E 测试', defaultValue: false },
83
52
  ],
84
- subcommands: { list: { module: 'acceptance', export: 'listAcceptanceCriteria' } },
53
+ subcommands: { list: { impl: { module: 'acceptance', export: 'listAcceptanceCriteria' } } },
54
+ subcommandStrict: false,
55
+ bareRunsAction: true,
85
56
  action: { module: 'acceptance', export: 'acceptance' },
86
- mapActionArgs: (_arg, options) => [options],
57
+ mapActionArgs: (_positionals, options) => [options],
87
58
  },
88
59
  },
89
60
  {
@@ -102,7 +73,7 @@ export const GATE_DEFINITIONS: GateDefinition[] = [
102
73
  { flags: '--strict', description: '严格模式(warn 也阻止)' },
103
74
  ],
104
75
  action: { module: 'command', export: 'executeCommand' },
105
- mapActionArgs: (arg, options) => [arg, options],
76
+ mapActionArgs: (positionals, options) => [positionals[0], options],
106
77
  },
107
78
  },
108
79
  {
@@ -119,9 +90,11 @@ export const GATE_DEFINITIONS: GateDefinition[] = [
119
90
  { flags: '--no-strict', description: '关闭严格模式' },
120
91
  { flags: '--allow-breaking', description: '允许破坏性变更', defaultValue: false },
121
92
  ],
122
- subcommands: { validate: { module: 'contract', export: 'validateSchema' } },
93
+ subcommands: { validate: { impl: { module: 'contract', export: 'validateSchema' } } },
94
+ subcommandStrict: false,
95
+ bareRunsAction: true,
123
96
  action: { module: 'contract', export: 'contract' },
124
- mapActionArgs: (_arg, options) => [options],
97
+ mapActionArgs: (_positionals, options) => [options],
125
98
  },
126
99
  },
127
100
  {
@@ -142,7 +115,7 @@ export const GATE_DEFINITIONS: GateDefinition[] = [
142
115
  { flags: '--benchmark-timeout <n>', description: '基准测试超时(秒)', defaultValue: '60' },
143
116
  ],
144
117
  action: { module: 'performance', export: 'performance' },
145
- mapActionArgs: (_arg, options) => [
118
+ mapActionArgs: (_positionals, options) => [
146
119
  {
147
120
  projectPath: options.projectPath,
148
121
  coverage: options.coverage,
@@ -170,9 +143,11 @@ export const GATE_DEFINITIONS: GateDefinition[] = [
170
143
  { flags: '--no-block-on-changes', description: '不阻止变更请求' },
171
144
  { flags: '--allowed-reviewers <list>', description: '允许的审查者(逗号分隔)' },
172
145
  ],
173
- subcommands: { status: { module: 'review', export: 'reviewStatus' } },
146
+ subcommands: { status: { impl: { module: 'review', export: 'reviewStatus' } } },
147
+ subcommandStrict: false,
148
+ bareRunsAction: true,
174
149
  action: { module: 'review', export: 'review' },
175
- mapActionArgs: (_arg, options) => [
150
+ mapActionArgs: (_positionals, options) => [
176
151
  {
177
152
  projectPath: options.projectPath,
178
153
  minReviewers: parseInt(String(options.minReviewers), 10),
@@ -199,9 +174,11 @@ export const GATE_DEFINITIONS: GateDefinition[] = [
199
174
  { flags: '--ignore-dev-deps', description: '忽略开发依赖', defaultValue: false },
200
175
  { flags: '--scan-command <cmd>', description: '自定义扫描命令' },
201
176
  ],
202
- subcommands: { audit: { module: 'security', export: 'auditDetails' } },
177
+ subcommands: { audit: { impl: { module: 'security', export: 'auditDetails' } } },
178
+ subcommandStrict: false,
179
+ bareRunsAction: true,
203
180
  action: { module: 'security', export: 'security' },
204
- mapActionArgs: (_arg, options) => [options],
181
+ mapActionArgs: (_positionals, options) => [options],
205
182
  },
206
183
  },
207
184
  ];
@@ -12,6 +12,7 @@
12
12
  import type { Gate } from './types';
13
13
  import { listRegisteredGates } from './registry';
14
14
  import { loadRawProjectConfig } from '../core/project-config-loader';
15
+ import { filterEnabledEntries } from '../core/effective-set';
15
16
 
16
17
  /**
17
18
  * config.yml `gates` 段
@@ -40,7 +41,8 @@ export function getEffectiveGates(projectRoot: string = process.cwd()): Gate[] {
40
41
  }
41
42
 
42
43
  // ========================================
43
- // 闭环校验:引用未注册 抛错
44
+ // 闭环校验(order 重排与重复 id 检测留门禁侧;
45
+ // enabled 段的未注册校验走共享筛选器 throw 模式)
44
46
  // ========================================
45
47
  const orderIds = Array.isArray(config.order) ? (config.order as string[]) : undefined;
46
48
  if (orderIds) {
@@ -60,31 +62,22 @@ export function getEffectiveGates(projectRoot: string = process.cwd()): Gate[] {
60
62
  seen.add(id);
61
63
  }
62
64
  }
63
- for (const key of Object.keys(config)) {
64
- if (key === 'order') continue;
65
- if (!known.has(key)) {
66
- throw new Error(
67
- `[harness] config.yml gates.${key} 引用了未注册的门禁。` +
68
- `可用门禁: ${[...known].join(', ')}。`
69
- );
70
- }
71
- }
72
65
 
73
66
  // ========================================
74
67
  // enabled 裁剪(与 getEffectiveConstraints 的 enabled:false 删除同效)
75
68
  // ========================================
76
- const disabled = new Set<string>();
77
- for (const gate of gates) {
78
- const entry = config[gate.id];
79
- if (
80
- entry &&
81
- typeof entry === 'object' &&
82
- !Array.isArray(entry) &&
83
- entry.enabled === false
84
- ) {
85
- disabled.add(gate.id);
86
- }
69
+ const enabledEntries: Record<string, { enabled?: boolean } | undefined> = {};
70
+ for (const [key, value] of Object.entries(config)) {
71
+ if (key === 'order') continue;
72
+ enabledEntries[key] = value as { enabled?: boolean } | undefined;
87
73
  }
74
+ const { disabledIds } = filterEnabledEntries(known, enabledEntries, {
75
+ onUnknownId: 'throw',
76
+ unknownIdError: id =>
77
+ `[harness] config.yml gates.${id} 引用了未注册的门禁。` +
78
+ `可用门禁: ${[...known].join(', ')}。`,
79
+ });
80
+ const disabled = new Set(disabledIds);
88
81
  const effective = gates.filter(g => !disabled.has(g.id));
89
82
 
90
83
  // ========================================
@@ -35,7 +35,7 @@ export { decisionFromResult } from './decision';
35
35
  /**
36
36
  * 门禁定义表(定义即注册的单一定义源;bin/harness.js 注册表驱动生成 CLI)
37
37
  */
38
- export { GATE_DEFINITIONS, type GateDefinition, type GateCliDefinition, type GateCliOption } from './definitions';
38
+ export { GATE_DEFINITIONS, type GateDefinition } from './definitions';
39
39
 
40
40
  /**
41
41
  * 门禁注册表(定义↔实现双向闭环,加载期抛错)+ getGate 引用闭环
@@ -13,7 +13,6 @@
13
13
  */
14
14
 
15
15
  import { ConstraintChecker } from '../core/constraints/checker';
16
- import { getTraceCollector } from '../monitoring/traces';
17
16
  import { SessionManager } from '../context/session-manager';
18
17
  import { ProjectConfigLoader } from '../core/project-config-loader';
19
18
  import { HookRegistry } from './registry';
@@ -74,7 +73,6 @@ export async function bootstrapHarness(
74
73
 
75
74
  // 2. 初始化核心组件
76
75
  const checker = ConstraintChecker.getInstance();
77
- checker.setTraceRecorder(getTraceCollector());
78
76
 
79
77
  const sessions = new SessionManager(resolvedPath);
80
78
  const hooks = new HookRegistry();
@@ -111,7 +109,6 @@ export function bootstrapHarnessSync(
111
109
  const mergedConstraints = loader.mergeConstraints();
112
110
 
113
111
  const checker = ConstraintChecker.getInstance();
114
- checker.setTraceRecorder(getTraceCollector());
115
112
 
116
113
  const sessions = new SessionManager(resolvedPath);
117
114
  const hooks = new HookRegistry();