@dommaker/harness 0.16.9 → 0.17.1

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 (337) hide show
  1. package/CHANGELOG.md +39 -0
  2. package/README.md +33 -32
  3. package/bin/harness.js +33 -20
  4. package/dist/cli/commands/check.d.ts +3 -2
  5. package/dist/cli/commands/check.d.ts.map +1 -1
  6. package/dist/cli/commands/check.js +69 -36
  7. package/dist/cli/commands/check.js.map +1 -1
  8. package/dist/cli/commands/constraints-report.d.ts +42 -0
  9. package/dist/cli/commands/constraints-report.d.ts.map +1 -0
  10. package/dist/cli/commands/constraints-report.js +233 -0
  11. package/dist/cli/commands/constraints-report.js.map +1 -0
  12. package/dist/cli/commands/constraints-retire.d.ts +71 -0
  13. package/dist/cli/commands/constraints-retire.d.ts.map +1 -0
  14. package/dist/cli/commands/constraints-retire.js +384 -0
  15. package/dist/cli/commands/constraints-retire.js.map +1 -0
  16. package/dist/cli/commands/constraints.d.ts +1 -1
  17. package/dist/cli/commands/constraints.d.ts.map +1 -1
  18. package/dist/cli/commands/constraints.js +4 -4
  19. package/dist/cli/commands/constraints.js.map +1 -1
  20. package/dist/cli/commands/index.d.ts +2 -1
  21. package/dist/cli/commands/index.d.ts.map +1 -1
  22. package/dist/cli/commands/index.js +10 -4
  23. package/dist/cli/commands/index.js.map +1 -1
  24. package/dist/cli/commands/init.d.ts +20 -0
  25. package/dist/cli/commands/init.d.ts.map +1 -1
  26. package/dist/cli/commands/init.js +81 -59
  27. package/dist/cli/commands/init.js.map +1 -1
  28. package/dist/cli/commands/report.js +4 -4
  29. package/dist/cli/commands/report.js.map +1 -1
  30. package/dist/cli/commands/status.d.ts.map +1 -1
  31. package/dist/cli/commands/status.js +3 -4
  32. package/dist/cli/commands/status.js.map +1 -1
  33. package/dist/cli/commands/sync-docs/capabilities-syncer.d.ts +5 -1
  34. package/dist/cli/commands/sync-docs/capabilities-syncer.d.ts.map +1 -1
  35. package/dist/cli/commands/sync-docs/capabilities-syncer.js +2 -10
  36. package/dist/cli/commands/sync-docs/capabilities-syncer.js.map +1 -1
  37. package/dist/cli/commands/validate.d.ts.map +1 -1
  38. package/dist/cli/commands/validate.js +1 -5
  39. package/dist/cli/commands/validate.js.map +1 -1
  40. package/dist/core/constraints/capabilities-parser.d.ts +7 -0
  41. package/dist/core/constraints/capabilities-parser.d.ts.map +1 -1
  42. package/dist/core/constraints/capabilities-parser.js +13 -0
  43. package/dist/core/constraints/capabilities-parser.js.map +1 -1
  44. package/dist/core/constraints/checker.d.ts +13 -5
  45. package/dist/core/constraints/checker.d.ts.map +1 -1
  46. package/dist/core/constraints/checker.js +62 -25
  47. package/dist/core/constraints/checker.js.map +1 -1
  48. package/dist/core/constraints/checkers/capability-sync.d.ts +9 -2
  49. package/dist/core/constraints/checkers/capability-sync.d.ts.map +1 -1
  50. package/dist/core/constraints/checkers/capability-sync.js +55 -22
  51. package/dist/core/constraints/checkers/capability-sync.js.map +1 -1
  52. package/dist/core/constraints/checkers/context-doc-sync.d.ts +3 -0
  53. package/dist/core/constraints/checkers/context-doc-sync.d.ts.map +1 -1
  54. package/dist/core/constraints/checkers/context-doc-sync.js +8 -2
  55. package/dist/core/constraints/checkers/context-doc-sync.js.map +1 -1
  56. package/dist/core/constraints/checkers/docs-freshness.d.ts +1 -0
  57. package/dist/core/constraints/checkers/docs-freshness.d.ts.map +1 -1
  58. package/dist/core/constraints/checkers/docs-freshness.js +39 -0
  59. package/dist/core/constraints/checkers/docs-freshness.js.map +1 -1
  60. package/dist/core/constraints/checkers/index.d.ts +8 -4
  61. package/dist/core/constraints/checkers/index.d.ts.map +1 -1
  62. package/dist/core/constraints/checkers/index.js +29 -46
  63. package/dist/core/constraints/checkers/index.js.map +1 -1
  64. package/dist/core/constraints/checkers/iron-flags.d.ts +6 -7
  65. package/dist/core/constraints/checkers/iron-flags.d.ts.map +1 -1
  66. package/dist/core/constraints/checkers/iron-flags.js +10 -17
  67. package/dist/core/constraints/checkers/iron-flags.js.map +1 -1
  68. package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts +13 -0
  69. package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts.map +1 -0
  70. package/dist/core/constraints/checkers/no-hardcoded-credentials.js +91 -0
  71. package/dist/core/constraints/checkers/no-hardcoded-credentials.js.map +1 -0
  72. package/dist/core/constraints/checkers/types.d.ts +15 -4
  73. package/dist/core/constraints/checkers/types.d.ts.map +1 -1
  74. package/dist/core/constraints/checkers/types.js +16 -4
  75. package/dist/core/constraints/checkers/types.js.map +1 -1
  76. package/dist/core/constraints/context-builder.d.ts +6 -3
  77. package/dist/core/constraints/context-builder.d.ts.map +1 -1
  78. package/dist/core/constraints/context-builder.js +29 -20
  79. package/dist/core/constraints/context-builder.js.map +1 -1
  80. package/dist/core/constraints/definitions/guidelines.d.ts +6 -2
  81. package/dist/core/constraints/definitions/guidelines.d.ts.map +1 -1
  82. package/dist/core/constraints/definitions/guidelines.js +29 -572
  83. package/dist/core/constraints/definitions/guidelines.js.map +1 -1
  84. package/dist/core/constraints/definitions/iron-laws.d.ts +6 -2
  85. package/dist/core/constraints/definitions/iron-laws.d.ts.map +1 -1
  86. package/dist/core/constraints/definitions/iron-laws.js +48 -231
  87. package/dist/core/constraints/definitions/iron-laws.js.map +1 -1
  88. package/dist/core/constraints/definitions/prompts.d.ts +12 -0
  89. package/dist/core/constraints/definitions/prompts.d.ts.map +1 -0
  90. package/dist/core/constraints/definitions/prompts.js +405 -0
  91. package/dist/core/constraints/definitions/prompts.js.map +1 -0
  92. package/dist/core/constraints/definitions.d.ts +15 -9
  93. package/dist/core/constraints/definitions.d.ts.map +1 -1
  94. package/dist/core/constraints/definitions.js +18 -12
  95. package/dist/core/constraints/definitions.js.map +1 -1
  96. package/dist/core/constraints/index.d.ts +3 -2
  97. package/dist/core/constraints/index.d.ts.map +1 -1
  98. package/dist/core/constraints/index.js +8 -2
  99. package/dist/core/constraints/index.js.map +1 -1
  100. package/dist/core/constraints/injection-drift.d.ts +48 -0
  101. package/dist/core/constraints/injection-drift.d.ts.map +1 -0
  102. package/dist/core/constraints/injection-drift.js +140 -0
  103. package/dist/core/constraints/injection-drift.js.map +1 -0
  104. package/dist/core/constraints/injection-renderer.d.ts +23 -0
  105. package/dist/core/constraints/injection-renderer.d.ts.map +1 -0
  106. package/dist/core/constraints/injection-renderer.js +44 -0
  107. package/dist/core/constraints/injection-renderer.js.map +1 -0
  108. package/dist/core/constraints/interceptor.d.ts.map +1 -1
  109. package/dist/core/constraints/interceptor.js +3 -2
  110. package/dist/core/constraints/interceptor.js.map +1 -1
  111. package/dist/core/constraints/usage-report.d.ts +95 -0
  112. package/dist/core/constraints/usage-report.d.ts.map +1 -0
  113. package/dist/core/constraints/usage-report.js +206 -0
  114. package/dist/core/constraints/usage-report.js.map +1 -0
  115. package/dist/core/effective-constraints.d.ts +47 -0
  116. package/dist/core/effective-constraints.d.ts.map +1 -0
  117. package/dist/core/effective-constraints.js +60 -0
  118. package/dist/core/effective-constraints.js.map +1 -0
  119. package/dist/core/index.d.ts +1 -0
  120. package/dist/core/index.d.ts.map +1 -1
  121. package/dist/core/index.js +2 -0
  122. package/dist/core/index.js.map +1 -1
  123. package/dist/core/project-config-loader.d.ts +17 -2
  124. package/dist/core/project-config-loader.d.ts.map +1 -1
  125. package/dist/core/project-config-loader.js +55 -8
  126. package/dist/core/project-config-loader.js.map +1 -1
  127. package/dist/dashboard/data.d.ts +1 -9
  128. package/dist/dashboard/data.d.ts.map +1 -1
  129. package/dist/dashboard/data.js +7 -15
  130. package/dist/dashboard/data.js.map +1 -1
  131. package/dist/dashboard/types.d.ts +13 -1
  132. package/dist/dashboard/types.d.ts.map +1 -1
  133. package/dist/index.d.ts +0 -4
  134. package/dist/index.d.ts.map +1 -1
  135. package/dist/index.js +1 -13
  136. package/dist/index.js.map +1 -1
  137. package/dist/monitoring/index.d.ts +0 -2
  138. package/dist/monitoring/index.d.ts.map +1 -1
  139. package/dist/monitoring/index.js +0 -2
  140. package/dist/monitoring/index.js.map +1 -1
  141. package/dist/monitoring/knowledge-evolver.d.ts +1 -1
  142. package/dist/monitoring/knowledge-evolver.js +1 -1
  143. package/dist/monitoring/trace-analyzer.d.ts +1 -1
  144. package/dist/monitoring/trace-analyzer.d.ts.map +1 -1
  145. package/dist/monitoring/trace-analyzer.js +16 -10
  146. package/dist/monitoring/trace-analyzer.js.map +1 -1
  147. package/dist/monitoring/traces.d.ts +2 -1
  148. package/dist/monitoring/traces.d.ts.map +1 -1
  149. package/dist/monitoring/traces.js +5 -3
  150. package/dist/monitoring/traces.js.map +1 -1
  151. package/dist/presets/standard.d.ts +3 -1
  152. package/dist/presets/standard.d.ts.map +1 -1
  153. package/dist/presets/standard.js +18 -8
  154. package/dist/presets/standard.js.map +1 -1
  155. package/dist/types/constraint.d.ts +51 -11
  156. package/dist/types/constraint.d.ts.map +1 -1
  157. package/dist/types/constraint.js +8 -4
  158. package/dist/types/constraint.js.map +1 -1
  159. package/dist/types/index.d.ts +1 -1
  160. package/dist/types/index.d.ts.map +1 -1
  161. package/dist/types/index.js.map +1 -1
  162. package/dist/types/monitoring-types.d.ts +2 -63
  163. package/dist/types/monitoring-types.d.ts.map +1 -1
  164. package/dist/types/monitoring-types.js +2 -2
  165. package/dist/types/project-config.d.ts +26 -1
  166. package/dist/types/project-config.d.ts.map +1 -1
  167. package/dist/types/trace.d.ts +16 -7
  168. package/dist/types/trace.d.ts.map +1 -1
  169. package/dist/types/trace.js +8 -0
  170. package/dist/types/trace.js.map +1 -1
  171. package/package.json +1 -1
  172. package/src/CONTEXT.md +2 -2
  173. package/src/__tests__/checker-extra.test.ts +228 -333
  174. package/src/__tests__/checker.test.ts +87 -724
  175. package/src/__tests__/constraint-doctor.test.ts +5 -5
  176. package/src/__tests__/doctor-extra.test.ts +164 -0
  177. package/src/__tests__/effective-constraints.test.ts +147 -0
  178. package/src/__tests__/extend-exceptions.test.ts +3 -3
  179. package/src/__tests__/iron-laws.test.ts +115 -91
  180. package/src/__tests__/no-hardcoded-credentials.test.ts +90 -0
  181. package/src/__tests__/presets.test.ts +7 -7
  182. package/src/__tests__/project-config-loader-extra.test.ts +41 -4
  183. package/src/__tests__/skip-semantics.test.ts +322 -0
  184. package/src/cli/commands/CONTEXT.md +5 -3
  185. package/src/cli/commands/__tests__/check-drift.test.ts +127 -0
  186. package/src/cli/commands/__tests__/check-skip-output.test.ts +128 -0
  187. package/src/cli/commands/__tests__/check.test.ts +14 -25
  188. package/src/cli/commands/__tests__/constraints-report.test.ts +327 -0
  189. package/src/cli/commands/__tests__/constraints-retire.test.ts +283 -0
  190. package/src/cli/commands/__tests__/init-injection.test.ts +234 -0
  191. package/src/cli/commands/__tests__/status-extra.test.ts +11 -11
  192. package/src/cli/commands/__tests__/status.test.ts +1 -1
  193. package/src/cli/commands/check.ts +72 -38
  194. package/src/cli/commands/constraints-report.ts +234 -0
  195. package/src/cli/commands/constraints-retire.ts +443 -0
  196. package/src/cli/commands/constraints.ts +5 -5
  197. package/src/cli/commands/index.ts +2 -1
  198. package/src/cli/commands/init.ts +94 -66
  199. package/src/cli/commands/report.ts +6 -6
  200. package/src/cli/commands/status.ts +3 -4
  201. package/src/cli/commands/sync-docs/capabilities-syncer.ts +5 -7
  202. package/src/cli/commands/validate.ts +1 -5
  203. package/src/core/CONTEXT.md +7 -4
  204. package/src/core/constraints/__tests__/injection-drift.test.ts +164 -0
  205. package/src/core/constraints/__tests__/interceptor.test.ts +4 -0
  206. package/src/core/constraints/capabilities-parser.ts +13 -0
  207. package/src/core/constraints/checker.ts +73 -28
  208. package/src/core/constraints/checkers/capability-sync.ts +72 -29
  209. package/src/core/constraints/checkers/context-doc-sync.ts +9 -2
  210. package/src/core/constraints/checkers/docs-freshness.ts +43 -0
  211. package/src/core/constraints/checkers/index.ts +38 -71
  212. package/src/core/constraints/checkers/iron-flags.ts +13 -49
  213. package/src/core/constraints/checkers/no-hardcoded-credentials.ts +93 -0
  214. package/src/core/constraints/checkers/types.ts +27 -5
  215. package/src/core/constraints/context-builder.ts +28 -19
  216. package/src/core/constraints/definitions/guidelines.ts +29 -597
  217. package/src/core/constraints/definitions/iron-laws.ts +48 -239
  218. package/src/core/constraints/definitions/prompts.ts +419 -0
  219. package/src/core/constraints/definitions.ts +18 -11
  220. package/src/core/constraints/index.ts +10 -1
  221. package/src/core/constraints/injection-drift.ts +139 -0
  222. package/src/core/constraints/injection-renderer.ts +44 -0
  223. package/src/core/constraints/interceptor.ts +3 -2
  224. package/src/core/constraints/usage-report.ts +254 -0
  225. package/src/core/effective-constraints.ts +85 -0
  226. package/src/core/index.ts +4 -1
  227. package/src/core/project-config-loader.ts +59 -9
  228. package/src/dashboard/__tests__/data.test.ts +5 -12
  229. package/src/dashboard/data.ts +9 -19
  230. package/src/dashboard/types.ts +18 -1
  231. package/src/index.ts +0 -12
  232. package/src/knowledge/CONTEXT.md +2 -2
  233. package/src/monitoring/CONTEXT.md +3 -4
  234. package/src/monitoring/index.ts +0 -2
  235. package/src/monitoring/knowledge-evolver.ts +1 -1
  236. package/src/monitoring/trace-analyzer.ts +15 -10
  237. package/src/monitoring/traces.ts +10 -6
  238. package/src/presets/__tests__/standard.test.ts +11 -9
  239. package/src/presets/standard.ts +24 -15
  240. package/src/types/constraint.ts +59 -14
  241. package/src/types/index.ts +1 -3
  242. package/src/types/monitoring-types.ts +2 -84
  243. package/src/types/project-config.ts +30 -1
  244. package/src/types/trace.ts +18 -7
  245. package/src/verification/CONTEXT.md +1 -1
  246. package/dist/cli/commands/flow.d.ts +0 -22
  247. package/dist/cli/commands/flow.d.ts.map +0 -1
  248. package/dist/cli/commands/flow.js +0 -275
  249. package/dist/cli/commands/flow.js.map +0 -1
  250. package/dist/constraints/lifecycle-runner.d.ts +0 -52
  251. package/dist/constraints/lifecycle-runner.d.ts.map +0 -1
  252. package/dist/constraints/lifecycle-runner.js +0 -151
  253. package/dist/constraints/lifecycle-runner.js.map +0 -1
  254. package/dist/constraints/registry.d.ts +0 -27
  255. package/dist/constraints/registry.d.ts.map +0 -1
  256. package/dist/constraints/registry.js +0 -128
  257. package/dist/constraints/registry.js.map +0 -1
  258. package/dist/constraints/types.d.ts +0 -53
  259. package/dist/constraints/types.d.ts.map +0 -1
  260. package/dist/constraints/types.js +0 -8
  261. package/dist/constraints/types.js.map +0 -1
  262. package/dist/core/constraints/checkers/always-pass.d.ts +0 -17
  263. package/dist/core/constraints/checkers/always-pass.d.ts.map +0 -1
  264. package/dist/core/constraints/checkers/always-pass.js +0 -23
  265. package/dist/core/constraints/checkers/always-pass.js.map +0 -1
  266. package/dist/core/constraints/checkers/guideline-flags.d.ts +0 -9
  267. package/dist/core/constraints/checkers/guideline-flags.d.ts.map +0 -1
  268. package/dist/core/constraints/checkers/guideline-flags.js +0 -13
  269. package/dist/core/constraints/checkers/guideline-flags.js.map +0 -1
  270. package/dist/core/constraints/checkers/no-any-type.d.ts +0 -6
  271. package/dist/core/constraints/checkers/no-any-type.d.ts.map +0 -1
  272. package/dist/core/constraints/checkers/no-any-type.js +0 -42
  273. package/dist/core/constraints/checkers/no-any-type.js.map +0 -1
  274. package/dist/core/constraints/checkers/no-excuse-patterns.d.ts +0 -6
  275. package/dist/core/constraints/checkers/no-excuse-patterns.d.ts.map +0 -1
  276. package/dist/core/constraints/checkers/no-excuse-patterns.js +0 -25
  277. package/dist/core/constraints/checkers/no-excuse-patterns.js.map +0 -1
  278. package/dist/core/constraints/checkers/no-fuzzy-completion-claim.d.ts +0 -6
  279. package/dist/core/constraints/checkers/no-fuzzy-completion-claim.d.ts.map +0 -1
  280. package/dist/core/constraints/checkers/no-fuzzy-completion-claim.js +0 -34
  281. package/dist/core/constraints/checkers/no-fuzzy-completion-claim.js.map +0 -1
  282. package/dist/core/constraints/checkers/no-performative-agreement.d.ts +0 -8
  283. package/dist/core/constraints/checkers/no-performative-agreement.d.ts.map +0 -1
  284. package/dist/core/constraints/checkers/no-performative-agreement.js +0 -23
  285. package/dist/core/constraints/checkers/no-performative-agreement.js.map +0 -1
  286. package/dist/core/constraints/checkers/no-simplification-without-approval.d.ts +0 -6
  287. package/dist/core/constraints/checkers/no-simplification-without-approval.d.ts.map +0 -1
  288. package/dist/core/constraints/checkers/no-simplification-without-approval.js +0 -30
  289. package/dist/core/constraints/checkers/no-simplification-without-approval.js.map +0 -1
  290. package/dist/core/constraints/checkers/test-coverage.d.ts +0 -6
  291. package/dist/core/constraints/checkers/test-coverage.d.ts.map +0 -1
  292. package/dist/core/constraints/checkers/test-coverage.js +0 -33
  293. package/dist/core/constraints/checkers/test-coverage.js.map +0 -1
  294. package/dist/core/constraints/checkers/yagni.d.ts +0 -8
  295. package/dist/core/constraints/checkers/yagni.d.ts.map +0 -1
  296. package/dist/core/constraints/checkers/yagni.js +0 -96
  297. package/dist/core/constraints/checkers/yagni.js.map +0 -1
  298. package/dist/core/constraints/definitions/tips.d.ts +0 -7
  299. package/dist/core/constraints/definitions/tips.d.ts.map +0 -1
  300. package/dist/core/constraints/definitions/tips.js +0 -62
  301. package/dist/core/constraints/definitions/tips.js.map +0 -1
  302. package/dist/evolution/auto-evolve.d.ts +0 -35
  303. package/dist/evolution/auto-evolve.d.ts.map +0 -1
  304. package/dist/evolution/auto-evolve.js +0 -64
  305. package/dist/evolution/auto-evolve.js.map +0 -1
  306. package/dist/evolution/index.d.ts +0 -2
  307. package/dist/evolution/index.d.ts.map +0 -1
  308. package/dist/evolution/index.js +0 -18
  309. package/dist/evolution/index.js.map +0 -1
  310. package/dist/monitoring/constraint-evolver.d.ts +0 -120
  311. package/dist/monitoring/constraint-evolver.d.ts.map +0 -1
  312. package/dist/monitoring/constraint-evolver.js +0 -410
  313. package/dist/monitoring/constraint-evolver.js.map +0 -1
  314. package/src/__tests__/constraint-evolver.test.ts +0 -405
  315. package/src/__tests__/doctor-evolver.test.ts +0 -381
  316. package/src/cli/commands/__tests__/flow.test.ts +0 -343
  317. package/src/cli/commands/flow.ts +0 -277
  318. package/src/constraints/__tests__/lifecycle-runner.test.ts +0 -246
  319. package/src/constraints/__tests__/registry.test.ts +0 -196
  320. package/src/constraints/lifecycle-runner.ts +0 -184
  321. package/src/constraints/registry.ts +0 -134
  322. package/src/constraints/types.ts +0 -59
  323. package/src/core/constraints/checkers/always-pass.ts +0 -22
  324. package/src/core/constraints/checkers/guideline-flags.ts +0 -30
  325. package/src/core/constraints/checkers/no-any-type.ts +0 -42
  326. package/src/core/constraints/checkers/no-excuse-patterns.ts +0 -24
  327. package/src/core/constraints/checkers/no-fuzzy-completion-claim.ts +0 -33
  328. package/src/core/constraints/checkers/no-performative-agreement.ts +0 -22
  329. package/src/core/constraints/checkers/no-simplification-without-approval.ts +0 -29
  330. package/src/core/constraints/checkers/test-coverage.ts +0 -35
  331. package/src/core/constraints/checkers/yagni.ts +0 -65
  332. package/src/core/constraints/definitions/tips.ts +0 -63
  333. package/src/evolution/CONTEXT.md +0 -22
  334. package/src/evolution/__tests__/auto-evolve.test.ts +0 -319
  335. package/src/evolution/auto-evolve.ts +0 -98
  336. package/src/evolution/index.ts +0 -1
  337. package/src/monitoring/constraint-evolver.ts +0 -501
@@ -5,7 +5,24 @@
5
5
  */
6
6
 
7
7
  import type { KnowledgeType } from '../knowledge/types';
8
- import type { ConstraintLayer, DeprecationStatus } from '../constraints/types';
8
+
9
+ // ── 约束分层(原 src/constraints/types,约束分层子系统删除后归位 dashboard)──
10
+
11
+ /** 约束分层 */
12
+ export type ConstraintLayer = 'safety' | 'quality';
13
+
14
+ /** 退化状态(生命周期机制已删除,保留字段供消费方兼容,恒为 active) */
15
+ export type DeprecationStatus = 'active' | 'scheduled' | 'deprecated' | 'removed';
16
+
17
+ /** 约束拦截统计(generate/getConstraintHeatmap 的输入) */
18
+ export interface ConstraintStats {
19
+ constraintId: string;
20
+ triggerCount: number;
21
+ passCount: number;
22
+ interceptCount: number;
23
+ interceptRate: number;
24
+ lastTriggered?: string;
25
+ }
9
26
 
10
27
  // ── 知识库全景 ───────────────────────────────────────────
11
28
 
package/src/index.ts CHANGED
@@ -73,13 +73,6 @@ export * from './safety';
73
73
  // ========================================
74
74
  export * from './verification';
75
75
 
76
- // ========================================
77
- // 约束分层导出
78
- // ========================================
79
- export * from './constraints/types';
80
- export { ConstraintRegistry } from './constraints/registry';
81
- export { ConstraintLifecycleRunner } from './constraints/lifecycle-runner';
82
-
83
76
  // ========================================
84
77
  // Dashboard 数据导出
85
78
  // ========================================
@@ -114,11 +107,6 @@ export * from './agents';
114
107
  // ========================================
115
108
  export * from './presets';
116
109
 
117
- // ========================================
118
- // 约束进化导出
119
- // ========================================
120
- export * from './evolution';
121
-
122
110
  // ========================================
123
111
  // 便捷 API
124
112
  // ========================================
@@ -37,7 +37,7 @@
37
37
 
38
38
  ## 约定
39
39
  - 知识条目有明确的生命周期状态(按 consumptionMode 分化)
40
- - 约束退化时自动写入 KnowledgeStore
40
+ - 约束退役(`harness constraints retire`,人确认)时写入 KnowledgeStore:规则原文 + 退役原因 + 历史统计
41
41
  - Linter 检查完整性/一致性/时效性三个维度
42
42
  - Audit 6 维度评分:D1结构 D2内容 D3去重 D4成熟度 D5新鲜度 D6飞轮
43
43
  - Ingest gate: ingestEntry() 先经 audit.validate() 检查,reject 不入库
@@ -46,6 +46,6 @@
46
46
 
47
47
  ## 注意事项
48
48
  - Phase 1+4 实现的知识引擎核心
49
- - 约束"退化不删除"——降级时保留规则原文 + 退化原因 + 历史数据
49
+ - 约束"退役不删除"——retire 落盘 config.yml `enabled: false` + retired 元数据,保留规则原文 + 退役原因 + 历史统计(可回滚)
50
50
  - `MaturityLevel` 包含 6 个值: draft/verified/proven/archived/active/deprecated
51
51
  - `excludeArchived` 同时排除 archived 和 deprecated
@@ -1,13 +1,12 @@
1
1
  # monitoring/
2
2
 
3
3
  ## 职责
4
- 运行时监控:Execution Trace(收集/分析/诊断)、Performance Trace(收集/分析)、约束进化提案、知识进化、上下文追踪。
4
+ 运行时监控:Execution Trace(收集/分析/诊断)、Performance Trace(收集/分析)、知识进化、上下文追踪。
5
5
 
6
6
  ## 核心导出
7
- - `TraceCollector` — 执行追踪收集(append-only JSONL)
7
+ - `TraceCollector` — 执行追踪收集(append-only JSONL,`.harness/logs/traces.log`)
8
8
  - `TraceAnalyzer` — 追踪统计分析 + 异常检测
9
9
  - `ConstraintDoctor` — 约束诊断接口(Agent 消费)
10
- - `ConstraintEvolver` — 约束进化提案流程
11
10
  - `PerformanceCollector` — 性能日志收集
12
11
  - `PerformanceAnalyzer` — 性能统计分析
13
12
  - `ContextTracker` — 上下文追踪
@@ -25,5 +24,5 @@
25
24
  - 零 Token 成本:不调用 LLM
26
25
 
27
26
  ## 注意事项
28
- - 追踪数据用于约束退化分析(拦截率 < 阈值 自动降级)
27
+ - 追踪数据供 `harness constraints report` 统计与退役候选诊断消费(观测用途,不做自动降级)
29
28
  - PerformanceCollector 和 TraceCollector 独立运作
@@ -5,7 +5,6 @@
5
5
  * - TraceCollector:轻量收集,零 Token
6
6
  * - TraceAnalyzer:统计汇总,异常检测
7
7
  * - ConstraintDoctor:Agent 诊断接口
8
- * - ConstraintEvolver:约束提案流程
9
8
  *
10
9
  * Performance Trace 系统:
11
10
  * - PerformanceCollector:性能日志收集,零 Token
@@ -15,7 +14,6 @@
15
14
  export * from './traces';
16
15
  export * from './trace-analyzer';
17
16
  export * from './constraint-doctor';
18
- export * from './constraint-evolver';
19
17
  export * from './performance-collector';
20
18
  export * from './performance-analyzer';
21
19
  export * from './context-tracker';
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * 知识成熟度进化器
3
3
  *
4
- * 从 ConstraintEvolver 转型,聚焦知识成熟度进化:
4
+ * 聚焦知识成熟度进化:
5
5
  * - 基于引用数据提议成熟度变更
6
6
  * - 自动审核(安全规则)
7
7
  * - 执行变更
@@ -76,20 +76,22 @@ export class TraceAnalyzer {
76
76
  // 计算时间范围
77
77
  const timeRange = timeRangeOf(group.map(t => t.timestamp));
78
78
 
79
- // 单次遍历计算核心统计
79
+ // 单次遍历计算核心统计(skip 单独计数,不计入 pass/fail/bypass 率分母,ADR-0001)
80
80
  const totalChecks = group.length;
81
- let passCount = 0, failCount = 0, bypassCount = 0, ignoreCount = 0;
81
+ let passCount = 0, failCount = 0, bypassCount = 0, ignoreCount = 0, skipCount = 0;
82
82
  for (const t of group) {
83
83
  if (t.result === 'pass') passCount++;
84
84
  else if (t.result === 'fail') failCount++;
85
85
  else if (t.result === 'bypassed') bypassCount++;
86
+ else if (t.result === 'skip') skipCount++;
86
87
  if (t.userAction === 'ignore') ignoreCount++;
87
88
  }
88
89
 
89
- // 计算比率
90
- const passRate = totalChecks > 0 ? passCount / totalChecks : 0;
91
- const failRate = totalChecks > 0 ? failCount / totalChecks : 0;
92
- const bypassRate = totalChecks > 0 ? bypassCount / totalChecks : 0;
90
+ // 计算比率(分母 = 实际评估次数,skip 未评估不计入)
91
+ const evaluatedChecks = totalChecks - skipCount;
92
+ const passRate = evaluatedChecks > 0 ? passCount / evaluatedChecks : 0;
93
+ const failRate = evaluatedChecks > 0 ? failCount / evaluatedChecks : 0;
94
+ const bypassRate = evaluatedChecks > 0 ? bypassCount / evaluatedChecks : 0;
93
95
 
94
96
  // 计算例外统计
95
97
  const exceptionTraces = group.filter(t => t.exceptionApplied);
@@ -108,6 +110,7 @@ export class TraceAnalyzer {
108
110
  passCount,
109
111
  failCount,
110
112
  bypassCount,
113
+ skipCount,
111
114
  ignoreCount,
112
115
  passRate,
113
116
  failRate,
@@ -298,12 +301,13 @@ export class TraceAnalyzer {
298
301
  }
299
302
 
300
303
  /**
301
- * 计算通过率
304
+ * 计算通过率(skip 未评估,不计入分母)
302
305
  */
303
306
  private calcPassRate(traces: ExecutionTrace[]): number {
304
- if (traces.length === 0) return 0;
305
- const passCount = traces.filter(t => t.result === 'pass').length;
306
- return passCount / traces.length;
307
+ const evaluated = traces.filter(t => t.result !== 'skip');
308
+ if (evaluated.length === 0) return 0;
309
+ const passCount = evaluated.filter(t => t.result === 'pass').length;
310
+ return passCount / evaluated.length;
307
311
  }
308
312
 
309
313
  /**
@@ -374,6 +378,7 @@ export class TraceAnalyzer {
374
378
  const levelEmoji = {
375
379
  iron_law: '🔴',
376
380
  guideline: '🟡',
381
+ prompt: '🟣',
377
382
  tip: '🔵',
378
383
  }[summary.level];
379
384
 
@@ -11,17 +11,21 @@
11
11
 
12
12
  import * as fs from 'fs';
13
13
  import * as path from 'path';
14
- import type {
15
- ExecutionTrace,
16
- TraceFilter,
17
- TraceCollectorConfig,
14
+ import {
15
+ DEFAULT_TRACE_FILE,
16
+ type ExecutionTrace,
17
+ type TraceFilter,
18
+ type TraceCollectorConfig,
18
19
  } from '../types/trace';
19
20
 
21
+ // 路径常量再导出,保持既有从 monitoring/traces 导入的用法不破
22
+ export { DEFAULT_TRACE_FILE };
23
+
20
24
  /**
21
25
  * 默认配置
22
26
  */
23
27
  const DEFAULT_CONFIG: TraceCollectorConfig = {
24
- traceFile: '.harness/logs/traces.log',
28
+ traceFile: DEFAULT_TRACE_FILE,
25
29
  maxFileSize: 10 * 1024 * 1024, // 10MB
26
30
  enabled: true,
27
31
  };
@@ -260,7 +264,7 @@ export class TraceCollector {
260
264
  }
261
265
 
262
266
  const files = fs.readdirSync(dir);
263
- const backupFiles = files.filter(f => f.endsWith('.log') && f !== 'execution.log');
267
+ const backupFiles = files.filter(f => f.endsWith('.log') && f !== path.basename(this.traceFile));
264
268
 
265
269
  const cutoffTime = Date.now() - maxAgeDays * 24 * 3600 * 1000;
266
270
  let deletedCount = 0;
@@ -12,7 +12,7 @@ describe('getPreset', () => {
12
12
  expect(preset.name).toBe('strict');
13
13
  expect(preset.ironLaws).toBeNull();
14
14
  expect(preset.guidelines).toBeNull();
15
- expect(preset.tips).toBeNull();
15
+ expect(preset.prompts).toBeNull();
16
16
  });
17
17
 
18
18
  it('returns standard preset', () => {
@@ -25,7 +25,7 @@ describe('getPreset', () => {
25
25
  expect(preset.name).toBe('relaxed');
26
26
  expect(preset.ironLaws).toHaveLength(3);
27
27
  expect(preset.guidelines).toHaveLength(2);
28
- expect(preset.tips).toEqual([]);
28
+ expect(preset.prompts).toEqual([]);
29
29
  });
30
30
 
31
31
  it('defaults to standard for unknown preset name', () => {
@@ -47,8 +47,9 @@ describe('applyPreset with string preset names', () => {
47
47
  it('relaxed enables only specific constraints', () => {
48
48
  const config = applyPreset('relaxed');
49
49
  expect(config.ironLaws).toBeDefined();
50
- expect(config.ironLaws.no_self_approval).toBeDefined();
50
+ expect(config.ironLaws.no_completion_without_verification).toBeDefined();
51
51
  expect(Object.keys(config.tips).length).toBe(0);
52
+ expect(Object.keys(config.prompts ?? {}).length).toBe(0);
52
53
  expect(config.disabled.length).toBeGreaterThan(0);
53
54
  });
54
55
  });
@@ -57,13 +58,13 @@ describe('applyPreset with PresetConfig object', () => {
57
58
  it('filters iron laws when ids are provided', () => {
58
59
  const config = applyPreset({
59
60
  name: 'custom',
60
- ironLaws: ['no_self_approval', 'no_completion_without_verification'],
61
+ ironLaws: ['no_completion_without_verification', 'incremental_progress'],
61
62
  guidelines: null,
62
- tips: null,
63
+ prompts: null,
63
64
  });
64
65
  expect(Object.keys(config.ironLaws)).toHaveLength(2);
65
- expect(config.ironLaws.no_self_approval).toBeDefined();
66
- expect(config.ironLaws.no_fix_without_root_cause).toBeUndefined();
66
+ expect(config.ironLaws.no_completion_without_verification).toBeDefined();
67
+ expect(config.ironLaws.no_implementation_without_requirement).toBeUndefined();
67
68
  });
68
69
 
69
70
  it('includes all guidelines when null', () => {
@@ -71,10 +72,11 @@ describe('applyPreset with PresetConfig object', () => {
71
72
  name: 'custom',
72
73
  ironLaws: null,
73
74
  guidelines: null,
74
- tips: [],
75
+ prompts: [],
75
76
  });
76
77
  expect(Object.keys(config.guidelines).length).toBeGreaterThan(0);
77
78
  expect(Object.keys(config.tips).length).toBe(0);
79
+ expect(Object.keys(config.prompts ?? {}).length).toBe(0);
78
80
  });
79
81
 
80
82
  it('creates disabled list for omitted constraints', () => {
@@ -82,7 +84,7 @@ describe('applyPreset with PresetConfig object', () => {
82
84
  name: 'custom',
83
85
  ironLaws: [],
84
86
  guidelines: [],
85
- tips: [],
87
+ prompts: [],
86
88
  });
87
89
  expect(config.disabled.length).toBeGreaterThan(0);
88
90
  });
@@ -1,12 +1,14 @@
1
1
  /**
2
2
  * 约束预设
3
- *
3
+ *
4
4
  * 预设定义哪些约束被启用
5
+ *
6
+ * ADR-0001:tips 维度退役,替换为 prompts(纯注入层)。
5
7
  */
6
8
 
7
9
  import type { Constraint } from '../types/constraint';
8
10
  import type { MergedConstraintsConfig } from '../types/project-config';
9
- import { IRON_LAWS, GUIDELINES, TIPS } from '../core/constraints/definitions';
11
+ import { IRON_LAWS, GUIDELINES, PROMPTS } from '../core/constraints/definitions';
10
12
 
11
13
  /**
12
14
  * 预设配置
@@ -22,7 +24,7 @@ export interface PresetConfig {
22
24
  guidelines: string[] | null;
23
25
 
24
26
  /** 启用的提示 ID 列表(null 表示全部启用) */
25
- tips: string[] | null;
27
+ prompts: string[] | null;
26
28
  }
27
29
 
28
30
  /**
@@ -68,57 +70,64 @@ export function applyPreset(
68
70
  if (!cfg.guidelines.includes(id)) disabled.push(id);
69
71
  }
70
72
  }
73
+ if (cfg.prompts !== null) {
74
+ for (const id of Object.keys(PROMPTS)) {
75
+ if (!cfg.prompts.includes(id)) disabled.push(id);
76
+ }
77
+ }
71
78
 
72
79
  return {
73
80
  ironLaws: filterByIds(IRON_LAWS, cfg.ironLaws),
74
81
  guidelines: filterByIds(GUIDELINES, cfg.guidelines),
75
- tips: filterByIds(TIPS, cfg.tips),
82
+ tips: {},
83
+ prompts: filterByIds(PROMPTS, cfg.prompts),
76
84
  disabled,
77
85
  custom: [],
86
+ unknownIds: [],
78
87
  };
79
88
  }
80
89
 
81
90
  /**
82
91
  * 严格预设
83
- *
92
+ *
84
93
  * 所有约束全部启用
85
94
  */
86
95
  export const STRICT_PRESET: PresetConfig = {
87
96
  name: 'strict',
88
97
  ironLaws: null, // 全部启用
89
98
  guidelines: null, // 全部启用
90
- tips: null, // 全部启用
99
+ prompts: null, // 全部启用
91
100
  };
92
101
 
93
102
  /**
94
103
  * 标准预设
95
- *
104
+ *
96
105
  * 铁律全部启用,指导原则和提示选择性启用
97
106
  */
98
107
  export const STANDARD_PRESET: PresetConfig = {
99
108
  name: 'standard',
100
109
  ironLaws: null, // 全部启用
101
110
  guidelines: null, // 全部启用
102
- tips: null, // 全部启用
111
+ prompts: null, // 全部启用
103
112
  };
104
113
 
105
114
  /**
106
115
  * 宽松预设
107
- *
116
+ *
108
117
  * 仅启用核心铁律,禁用提示
109
118
  */
110
119
  export const RELAXED_PRESET: PresetConfig = {
111
120
  name: 'relaxed',
112
121
  ironLaws: [
113
- 'no_bypass_checkpoint',
114
- 'no_self_approval',
115
122
  'no_completion_without_verification',
123
+ 'incremental_progress',
124
+ 'no_implementation_without_requirement',
116
125
  ],
117
126
  guidelines: [
118
- 'no_fix_without_root_cause',
119
- 'no_code_without_test',
127
+ 'no_bypass_checkpoint',
128
+ 'no_hardcoded_credentials',
120
129
  ],
121
- tips: [], // 禁用提示
130
+ prompts: [], // 禁用提示
122
131
  };
123
132
 
124
133
  /**
@@ -135,4 +144,4 @@ export function getPreset(name: string): PresetConfig {
135
144
  default:
136
145
  return STANDARD_PRESET;
137
146
  }
138
- }
147
+ }
@@ -1,10 +1,14 @@
1
1
  /**
2
2
  * 约束类型定义
3
- *
4
- * 三层约束体系:
5
- * - Iron Laws:绝对禁止,无例外,违背即阻止执行
6
- * - Guidelines:优先建议,有例外,违背发警告但不阻止
7
- * - Tips:信息性提示,可忽略
3
+ *
4
+ * kind 二元模型(ADR-0001):
5
+ * - check:必须带真实 checker,参与运行时检查与 trace 统计
6
+ * - iron_law:绝对禁止,无例外,违背即阻止执行
7
+ * - guideline:优先建议,有例外,违背发警告但不阻止
8
+ * - prompt:纯文本提示,仅参与 prompt 注入,不占检查位、不产生 trace
9
+ *
10
+ * 'tip' 层级已随 TIPS 退役(ADR-0001),仅保留在类型上以兼容
11
+ * ConstraintCheckResult.tips 等历史结果形态,不再有新定义使用。
8
12
  */
9
13
 
10
14
  /**
@@ -12,10 +16,18 @@
12
16
  */
13
17
  export type ConstraintId = string;
14
18
 
19
+ /**
20
+ * 约束类别:check = 可执行检查;prompt = 纯文本注入
21
+ */
22
+ export type ConstraintKind = 'check' | 'prompt';
23
+
15
24
  /**
16
25
  * 约束层级
26
+ *
27
+ * check 层只使用 'iron_law' | 'guideline';prompt 类统一为 'prompt'。
28
+ * 'tip' 已退役,仅为历史结果结构兼容保留。
17
29
  */
18
- export type ConstraintLevel = 'iron_law' | 'guideline' | 'tip';
30
+ export type ConstraintLevel = 'iron_law' | 'guideline' | 'prompt' | 'tip';
19
31
 
20
32
  /**
21
33
  * 约束触发条件(开放扩展)
@@ -31,7 +43,14 @@ export type ConstraintTrigger = string;
31
43
  export interface Constraint {
32
44
  /** 约束 ID */
33
45
  id: ConstraintId;
34
-
46
+
47
+ /**
48
+ * 约束类别(ADR-0001):
49
+ * - check:必须带真实 checker,参与运行时检查
50
+ * - prompt:纯文本提示,仅参与注入,不执行 checker
51
+ */
52
+ kind: ConstraintKind;
53
+
35
54
  /** 约束规则(英文) */
36
55
  rule: string;
37
56
 
@@ -61,6 +80,12 @@ export interface Constraint {
61
80
 
62
81
  /** 例外条件(仅 Guidelines 有效) */
63
82
  exceptions?: string[];
83
+
84
+ /**
85
+ * 适用场景标签(prompt 类专用,如 'agent-skill'、'llm-app')。
86
+ * 未标注表示通用场景。消费端(init 注入 / studio 路由)可按标签过滤。
87
+ */
88
+ appliesTo?: string[];
64
89
  }
65
90
 
66
91
  /**
@@ -75,6 +100,15 @@ export interface ConstraintResult {
75
100
 
76
101
  /** 是否满足 */
77
102
  satisfied: boolean;
103
+
104
+ /**
105
+ * 是否跳过评估(ADR-0001 三态语义)
106
+ *
107
+ * skip = 约定未采用(存在性探测未命中)或证据 flag 未接线(undefined)。
108
+ * skip 时 satisfied 恒为 true(fail-open,不阻断、不计警告),
109
+ * 但不计入 pass/fail 统计;trace 记录为 result: 'skip'。
110
+ */
111
+ skipped?: boolean;
78
112
 
79
113
  /** 约束定义 */
80
114
  constraint?: Constraint;
@@ -95,6 +129,14 @@ export interface ConstraintResult {
95
129
  export interface ConstraintContext {
96
130
  /** 当前操作类型 */
97
131
  operation: ConstraintTrigger;
132
+
133
+ /**
134
+ * 附加触发条件(ADR-0001:detectTrigger 的次级推断)
135
+ *
136
+ * pre-commit 变更包含代码文件时,operation 保持主推断(如 module_modification),
137
+ * code_implementation 记录在此;匹配约束时 operation 与 extraTriggers 一并参与。
138
+ */
139
+ extraTriggers?: ConstraintTrigger[];
98
140
 
99
141
  /** 工作流 ID */
100
142
  workflowId?: string;
@@ -152,25 +194,25 @@ export interface ConstraintContext {
152
194
  /** 是否只处理单个任务(用于 incremental_progress) */
153
195
  hasSingleTask?: boolean;
154
196
 
155
- /** 是否已验证外部能力(用于 verify_external_capability) */
197
+ /** 是否已验证外部能力(对应约束已降级为 prompt,字段保留兼容) */
156
198
  hasExternalCapabilityVerification?: boolean;
157
199
 
158
- /** 是否已对比需求验证(用于 no_implementation_without_requirement_review) */
200
+ /** 是否已对比需求验证(review 变体已并入主约束,字段保留兼容) */
159
201
  hasRequirementReview?: boolean;
160
202
 
161
203
  /** 是否有需求文档(用于 no_implementation_without_requirement) */
162
204
  hasRequirement?: boolean;
163
205
 
164
- /** 是否在 worktree 中执行(用于 prefer_worktree) */
206
+ /** 是否在 worktree 中执行(对应约束已移出内置,字段保留兼容) */
165
207
  hasWorktree?: boolean;
166
208
 
167
209
  /** worktree 路径(用于 worktree 相关检查) */
168
210
  worktreePath?: string;
169
211
 
170
- /** 完成声明文本(用于 fuzzy/excuse 检查) */
212
+ /** 完成声明文本(对应检查已并入 prompt 层,字段保留兼容) */
171
213
  completionClaimText?: string;
172
214
 
173
- /** 是否完成两阶段审查(用于 two_stage_review_required) */
215
+ /** 是否完成两阶段审查(对应约束已移出内置,字段保留兼容) */
174
216
  hasTwoStageReview?: boolean;
175
217
 
176
218
  // ========================================
@@ -194,7 +236,7 @@ export interface ConstraintContext {
194
236
  isSimpleAccessor?: boolean;
195
237
  isPureDisplayComponent?: boolean;
196
238
 
197
- // no_any_type 例外
239
+ // any 类型相关例外(对应约束已退役,字段保留兼容)
198
240
  isJsonParseResult?: boolean;
199
241
  isThirdPartyNoTypes?: boolean;
200
242
  isLegacyMigration?: boolean;
@@ -238,7 +280,10 @@ export class ConstraintViolationError extends Error {
238
280
  }
239
281
 
240
282
  /**
241
- * 三层约束检查结果
283
+ * 约束检查结果(check 层)
284
+ *
285
+ * tips/tipCount 已随 TIPS 退役(ADR-0001),保留字段以兼容历史调用方,
286
+ * 内置约束下恒为空数组 / 0。
242
287
  */
243
288
  export interface ConstraintCheckResult {
244
289
  /** 铁律检查结果(必须全部通过) */
@@ -15,12 +15,10 @@ export * from './trace';
15
15
  // Performance 类型(Performance Trace 系统)
16
16
  export * from './performance';
17
17
 
18
- // 诊断和提案类型(定义已归位 types/monitoring-types.ts,monitoring 改从 types 导入)
18
+ // 诊断类型(定义已归位 types/monitoring-types.ts,monitoring 改从 types 导入)
19
19
  // 显式再导出(不用 export *):根入口同时星导出 ./monitoring,星-星歧义会静默丢符号
20
20
  export type {
21
21
  Diagnosis,
22
- ConstraintProposal,
23
- ProposalReviewResult,
24
22
  } from './monitoring-types';
25
23
 
26
24
  // Session 类型(排除与 passes-gate 冲突的类型)
@@ -1,7 +1,7 @@
1
1
  /**
2
- * 监控域类型(诊断 / 提案)
2
+ * 监控域类型(诊断)
3
3
  *
4
- * 原定义位于 monitoring/constraint-doctor.ts 与 monitoring/constraint-evolver.ts
4
+ * 原定义位于 monitoring/constraint-doctor.ts,
5
5
  * 但被 types/index.ts 反向再导出(类型层依赖业务模块,分层倒挂)。
6
6
  * 工单 14 将类型定义归位到 types 层,monitoring 改从 types 导入。
7
7
  */
@@ -66,85 +66,3 @@ export interface Diagnosis {
66
66
  /** 紧急程度 */
67
67
  urgency: 'low' | 'medium' | 'high';
68
68
  }
69
-
70
- /**
71
- * 约束提案
72
- */
73
- export interface ConstraintProposal {
74
- /** 提案 ID */
75
- id: string;
76
-
77
- /** 提案时间 */
78
- proposedAt: number;
79
-
80
- /** 来源诊断 */
81
- diagnosisId: string;
82
-
83
- /** 约束 ID */
84
- constraintId: string;
85
-
86
- /** 提案类型 */
87
- type: 'add_exception' | 'remove_exception' | 'adjust_trigger' | 'change_level' | 'modify_message' | 'new_constraint';
88
-
89
- /** 提案内容 */
90
- content: {
91
- /** 当前值(如果有) */
92
- current?: any;
93
-
94
- /** 建议值 */
95
- proposed: any;
96
-
97
- /** 变更描述 */
98
- description: string;
99
- };
100
-
101
- /** 理由 */
102
- reasoning: string;
103
-
104
- /** 预期效果 */
105
- expectedOutcome: string;
106
-
107
- /** 风险评估 */
108
- risk: {
109
- /** 风险等级 */
110
- level: 'low' | 'medium' | 'high';
111
-
112
- /** 风险描述 */
113
- description: string;
114
-
115
- /** 回滚方案 */
116
- rollbackPlan?: string;
117
- };
118
-
119
- /** 实施信息 */
120
- implementation: {
121
- /** 改动文件 */
122
- files: string[];
123
-
124
- /** 改动量估计 */
125
- linesChanged: number;
126
-
127
- /** 测试要求 */
128
- testsRequired: boolean;
129
- };
130
-
131
- /** 状态 */
132
- status: 'proposed' | 'reviewing' | 'accepted' | 'rejected' | 'implemented';
133
-
134
- /** 审核意见 */
135
- reviewComment?: string;
136
- }
137
-
138
- /**
139
- * 提案审核结果
140
- */
141
- export interface ProposalReviewResult {
142
- /** 是否接受 */
143
- accepted: boolean;
144
-
145
- /** 审核意见 */
146
- comment: string;
147
-
148
- /** 修改建议(如果拒绝) */
149
- modifications?: Partial<ConstraintProposal>;
150
- }