@dommaker/harness 1.14.0 → 1.15.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 (281) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +4 -2
  3. package/dist/cli/commands/constraints-disable.d.ts +48 -0
  4. package/dist/cli/commands/constraints-disable.d.ts.map +1 -0
  5. package/dist/cli/commands/constraints-disable.js +156 -0
  6. package/dist/cli/commands/constraints-disable.js.map +1 -0
  7. package/dist/cli/commands/constraints-pack-proposal.d.ts +1 -1
  8. package/dist/cli/commands/constraints-pack-proposal.js +1 -1
  9. package/dist/cli/commands/constraints-reactivate.d.ts.map +1 -1
  10. package/dist/cli/commands/constraints-reactivate.js +4 -2
  11. package/dist/cli/commands/constraints-reactivate.js.map +1 -1
  12. package/dist/cli/commands/constraints-retire.d.ts +14 -4
  13. package/dist/cli/commands/constraints-retire.d.ts.map +1 -1
  14. package/dist/cli/commands/constraints-retire.js +10 -6
  15. package/dist/cli/commands/constraints-retire.js.map +1 -1
  16. package/dist/cli/commands/constraints.d.ts +1 -1
  17. package/dist/cli/commands/constraints.js +1 -1
  18. package/dist/cli/commands/definitions.d.ts.map +1 -1
  19. package/dist/cli/commands/definitions.js +16 -1
  20. package/dist/cli/commands/definitions.js.map +1 -1
  21. package/dist/cli/commands/knowledge-view.d.ts +3 -3
  22. package/dist/cli/commands/knowledge-view.js +4 -4
  23. package/dist/cli/commands/knowledge-view.js.map +1 -1
  24. package/dist/cli/commands/release.d.ts +2 -2
  25. package/dist/cli/commands/release.js +2 -2
  26. package/dist/cli/commands/sync-docs/agents-syncer.js +2 -4
  27. package/dist/cli/commands/sync-docs/agents-syncer.js.map +1 -1
  28. package/dist/cli/commands/sync-docs/head-gate.d.ts +34 -0
  29. package/dist/cli/commands/sync-docs/head-gate.d.ts.map +1 -0
  30. package/dist/cli/commands/sync-docs/head-gate.js +86 -0
  31. package/dist/cli/commands/sync-docs/head-gate.js.map +1 -0
  32. package/dist/cli/commands/sync-docs/index.d.ts +7 -0
  33. package/dist/cli/commands/sync-docs/index.d.ts.map +1 -1
  34. package/dist/cli/commands/sync-docs/index.js +51 -1
  35. package/dist/cli/commands/sync-docs/index.js.map +1 -1
  36. package/dist/completion-checkers/contract-presence.d.ts +1 -1
  37. package/dist/completion-checkers/contract-presence.js +1 -1
  38. package/dist/core/constraints/capabilities-parser.js +1 -1
  39. package/dist/core/constraints/check-cache.d.ts +1 -1
  40. package/dist/core/constraints/check-cache.js +1 -1
  41. package/dist/core/constraints/checkers/capability-sync.d.ts +1 -1
  42. package/dist/core/constraints/checkers/capability-sync.js +1 -1
  43. package/dist/core/constraints/checkers/docs-freshness.js +1 -1
  44. package/dist/core/constraints/checkers/docs-freshness.js.map +1 -1
  45. package/dist/core/constraints/checkers/governance-presence.d.ts +1 -1
  46. package/dist/core/constraints/checkers/governance-presence.js +1 -1
  47. package/dist/core/constraints/checkers/index.d.ts.map +1 -1
  48. package/dist/core/constraints/checkers/index.js +2 -2
  49. package/dist/core/constraints/checkers/index.js.map +1 -1
  50. package/dist/core/constraints/checkers/no-completion-without-verification.d.ts +34 -0
  51. package/dist/core/constraints/checkers/no-completion-without-verification.d.ts.map +1 -0
  52. package/dist/core/constraints/checkers/no-completion-without-verification.js +157 -0
  53. package/dist/core/constraints/checkers/no-completion-without-verification.js.map +1 -0
  54. package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts +3 -0
  55. package/dist/core/constraints/checkers/no-hardcoded-credentials.d.ts.map +1 -1
  56. package/dist/core/constraints/checkers/no-hardcoded-credentials.js +19 -2
  57. package/dist/core/constraints/checkers/no-hardcoded-credentials.js.map +1 -1
  58. package/dist/core/constraints/checkers/types.d.ts +1 -1
  59. package/dist/core/constraints/checkers/types.js +1 -1
  60. package/dist/core/constraints/context-builder.d.ts.map +1 -1
  61. package/dist/core/constraints/context-builder.js +0 -17
  62. package/dist/core/constraints/context-builder.js.map +1 -1
  63. package/dist/core/constraints/definitions/guidelines.js +1 -1
  64. package/dist/core/constraints/definitions/iron-laws.js +2 -2
  65. package/dist/core/constraints/definitions/iron-laws.js.map +1 -1
  66. package/dist/core/constraints/definitions.d.ts +1 -1
  67. package/dist/core/constraints/definitions.js +1 -1
  68. package/dist/core/constraints/index.d.ts +1 -1
  69. package/dist/core/constraints/index.d.ts.map +1 -1
  70. package/dist/core/constraints/index.js.map +1 -1
  71. package/dist/core/constraints/run-env.d.ts +3 -2
  72. package/dist/core/constraints/run-env.d.ts.map +1 -1
  73. package/dist/core/constraints/run-env.js +5 -4
  74. package/dist/core/constraints/run-env.js.map +1 -1
  75. package/dist/core/constraints/usage-report.d.ts +0 -5
  76. package/dist/core/constraints/usage-report.d.ts.map +1 -1
  77. package/dist/core/constraints/usage-report.js +3 -12
  78. package/dist/core/constraints/usage-report.js.map +1 -1
  79. package/dist/core/effective-constraints.d.ts +1 -1
  80. package/dist/core/effective-constraints.js +1 -1
  81. package/dist/core/index.d.ts +1 -1
  82. package/dist/core/index.d.ts.map +1 -1
  83. package/dist/core/index.js.map +1 -1
  84. package/dist/core/retired-constraints.d.ts +66 -0
  85. package/dist/core/retired-constraints.d.ts.map +1 -0
  86. package/dist/core/retired-constraints.js +52 -0
  87. package/dist/core/retired-constraints.js.map +1 -0
  88. package/dist/core/validators/checkpoint.d.ts +4 -2
  89. package/dist/core/validators/checkpoint.d.ts.map +1 -1
  90. package/dist/core/validators/checkpoint.js +4 -2
  91. package/dist/core/validators/checkpoint.js.map +1 -1
  92. package/dist/core/validators/passes-gate.d.ts +2 -2
  93. package/dist/core/validators/passes-gate.d.ts.map +1 -1
  94. package/dist/core/validators/passes-gate.js +4 -3
  95. package/dist/core/validators/passes-gate.js.map +1 -1
  96. package/dist/gates/checker-gate.d.ts +3 -3
  97. package/dist/gates/checker-gate.js +3 -3
  98. package/dist/gates/index.d.ts +1 -1
  99. package/dist/gates/index.js +1 -1
  100. package/dist/index.d.ts +3 -1
  101. package/dist/index.d.ts.map +1 -1
  102. package/dist/index.js +7 -5
  103. package/dist/index.js.map +1 -1
  104. package/dist/knowledge/audit-scoring.js +1 -1
  105. package/dist/knowledge/audit-scoring.js.map +1 -1
  106. package/dist/monitoring/trace-analyzer.d.ts +2 -2
  107. package/dist/monitoring/trace-analyzer.js +2 -2
  108. package/dist/monitoring/traces.d.ts +1 -1
  109. package/dist/monitoring/traces.js +4 -4
  110. package/dist/monitoring/traces.js.map +1 -1
  111. package/dist/pretool-use-hook.d.ts +1 -1
  112. package/dist/pretool-use-hook.d.ts.map +1 -1
  113. package/dist/pretool-use-hook.js +5 -5
  114. package/dist/pretool-use-hook.js.map +1 -1
  115. package/dist/release/integrity.d.ts +4 -4
  116. package/dist/release/integrity.js +4 -4
  117. package/dist/test-setup/mkdtemp-cleanup.js +1 -1
  118. package/dist/tools/definitions/core/notification/notify.yml +0 -1
  119. package/dist/tools/definitions/ext/browser/browser-close.yml +0 -1
  120. package/dist/tools/definitions/ext/browser/browser-start.yml +0 -1
  121. package/dist/tools/definitions/std/evolution/implement.yml +0 -1
  122. package/dist/tools/definitions/std/evolution/prioritize.yml +0 -1
  123. package/dist/tools/definitions/std/evolution/report-gap.yml +0 -1
  124. package/dist/tools/definitions/std/governance/aggregate-opinions.yml +0 -1
  125. package/dist/tools/definitions/std/governance/audit-task.yml +0 -1
  126. package/dist/tools/definitions/std/governance/cast-vote.yml +0 -1
  127. package/dist/tools/definitions/std/governance/create-voting-session.yml +0 -1
  128. package/dist/tools/definitions/std/governance/define-stance.yml +0 -1
  129. package/dist/tools/definitions/std/governance/impeach.yml +0 -1
  130. package/dist/tools/definitions/std/governance/multi-stance-review.yml +0 -1
  131. package/dist/tools/definitions/std/governance/rollback.yml +0 -1
  132. package/dist/tools/definitions/std/governance/stance-review.yml +0 -1
  133. package/dist/tools/definitions/std/governance/track-effect.yml +0 -1
  134. package/dist/tools/definitions/std/governance/vote-tally.yml +0 -1
  135. package/dist/tools/definitions/std/planning/split-batch.yml +0 -1
  136. package/dist/tools/definitions/std/planning/split-tasks.yml +0 -1
  137. package/dist/types/constraint.d.ts +1 -7
  138. package/dist/types/constraint.d.ts.map +1 -1
  139. package/dist/types/constraint.js.map +1 -1
  140. package/dist/types/passes-gate.d.ts +7 -0
  141. package/dist/types/passes-gate.d.ts.map +1 -1
  142. package/dist/types/passes-gate.js +8 -0
  143. package/dist/types/passes-gate.js.map +1 -1
  144. package/dist/utils/detect-source-roots.d.ts +1 -1
  145. package/dist/utils/detect-source-roots.d.ts.map +1 -1
  146. package/dist/utils/detect-source-roots.js +2 -21
  147. package/dist/utils/detect-source-roots.js.map +1 -1
  148. package/package.json +1 -2
  149. package/src/CONTEXT.md +2 -2
  150. package/src/__tests__/checker-extra.test.ts +32 -9
  151. package/src/__tests__/checker-primitives-sdk.test.ts +2 -2
  152. package/src/__tests__/checker.test.ts +16 -14
  153. package/src/__tests__/detect-source-roots.test.ts +5 -4
  154. package/src/__tests__/exec-checker-full-chain.test.ts +3 -3
  155. package/src/__tests__/iron-laws.test.ts +13 -20
  156. package/src/__tests__/no-studio-references.test.ts +54 -0
  157. package/src/__tests__/passes-gate-check.test.ts +1 -1
  158. package/src/__tests__/pretool-use-hook.test.ts +2 -2
  159. package/src/__tests__/public-exports.test.ts +1 -0
  160. package/src/__tests__/public-type-surface.test.ts +2 -2
  161. package/src/__tests__/retired-constraints.test.ts +99 -0
  162. package/src/__tests__/skip-semantics.test.ts +16 -33
  163. package/src/__tests__/usage-report-public-export.test.ts +3 -3
  164. package/src/cli/commands/CONTEXT.md +7 -6
  165. package/src/cli/commands/__tests__/check-read-count.test.ts +3 -0
  166. package/src/cli/commands/__tests__/check.test.ts +33 -6
  167. package/src/cli/commands/__tests__/constraints-disable.test.ts +229 -0
  168. package/src/cli/commands/__tests__/constraints-report-json-flag.test.ts +1 -1
  169. package/src/cli/commands/__tests__/constraints-report.test.ts +4 -4
  170. package/src/cli/commands/__tests__/knowledge-flywheel-consistency.test.ts +1 -1
  171. package/src/cli/commands/__tests__/knowledge.test.ts +3 -3
  172. package/src/cli/commands/__tests__/project-path-anchoring.test.ts +4 -1
  173. package/src/cli/commands/__tests__/project-path-convention.test.ts +1 -1
  174. package/src/cli/commands/__tests__/spec-baseline-index-cap.test.ts +1 -1
  175. package/src/cli/commands/__tests__/sync-docs-agents.test.ts +1 -24
  176. package/src/cli/commands/__tests__/sync-docs-gate.test.ts +154 -0
  177. package/src/cli/commands/__tests__/sync-docs-table-layout.test.ts +1 -1
  178. package/src/cli/commands/__tests__/sync-docs.test.ts +3 -3
  179. package/src/cli/commands/constraints-disable.ts +145 -0
  180. package/src/cli/commands/constraints-pack-proposal.ts +1 -1
  181. package/src/cli/commands/constraints-reactivate.ts +4 -2
  182. package/src/cli/commands/constraints-retire.ts +11 -8
  183. package/src/cli/commands/constraints.ts +1 -1
  184. package/src/cli/commands/definitions.ts +16 -1
  185. package/src/cli/commands/knowledge-view.ts +4 -4
  186. package/src/cli/commands/release.ts +2 -2
  187. package/src/cli/commands/sync-docs/agents-syncer.ts +2 -4
  188. package/src/cli/commands/sync-docs/head-gate.ts +87 -0
  189. package/src/cli/commands/sync-docs/index.ts +62 -1
  190. package/src/completion-checkers/contract-presence.ts +1 -1
  191. package/src/core/CONTEXT.md +4 -3
  192. package/src/core/constraints/__tests__/capabilities-reconcile.test.ts +1 -1
  193. package/src/core/constraints/__tests__/check-cache.test.ts +1 -1
  194. package/src/core/constraints/__tests__/collect-constraints.test.ts +42 -18
  195. package/src/core/constraints/__tests__/run-env.test.ts +7 -7
  196. package/src/core/constraints/__tests__/trace-injection.test.ts +8 -2
  197. package/src/core/constraints/capabilities-parser.ts +1 -1
  198. package/src/core/constraints/check-cache.ts +1 -1
  199. package/src/core/constraints/checkers/__tests__/fixtures/public-repo-sanitization.mjs +1 -1
  200. package/src/core/constraints/checkers/__tests__/governance-presence.test.ts +1 -1
  201. package/src/core/constraints/checkers/__tests__/input-contract.test.ts +3 -3
  202. package/src/core/constraints/checkers/__tests__/no-completion-without-verification.test.ts +208 -0
  203. package/src/core/constraints/checkers/__tests__/no-hardcoded-credentials.test.ts +17 -0
  204. package/src/core/constraints/checkers/capability-sync.ts +1 -1
  205. package/src/core/constraints/checkers/docs-freshness.ts +1 -1
  206. package/src/core/constraints/checkers/governance-presence.ts +1 -1
  207. package/src/core/constraints/checkers/index.ts +1 -3
  208. package/src/core/constraints/checkers/no-completion-without-verification.ts +126 -0
  209. package/src/core/constraints/checkers/no-hardcoded-credentials.ts +20 -2
  210. package/src/core/constraints/checkers/types.ts +1 -1
  211. package/src/core/constraints/context-builder.ts +0 -18
  212. package/src/core/constraints/definitions/guidelines.ts +1 -1
  213. package/src/core/constraints/definitions/iron-laws.ts +2 -2
  214. package/src/core/constraints/definitions.ts +1 -1
  215. package/src/core/constraints/doc-freshness/__tests__/runner.test.ts +3 -3
  216. package/src/core/constraints/index.ts +0 -1
  217. package/src/core/constraints/run-env.ts +6 -5
  218. package/src/core/constraints/usage-report.ts +2 -12
  219. package/src/core/effective-constraints.ts +1 -1
  220. package/src/core/index.ts +0 -1
  221. package/src/core/retired-constraints.ts +77 -0
  222. package/src/core/validators/checkpoint.ts +4 -2
  223. package/src/core/validators/passes-gate.ts +4 -3
  224. package/src/gates/CONTEXT.md +3 -2
  225. package/src/gates/__tests__/checker-gate.test.ts +3 -3
  226. package/src/gates/checker-gate.ts +3 -3
  227. package/src/gates/index.ts +1 -1
  228. package/src/hooks/CONTEXT.md +2 -2
  229. package/src/index.ts +9 -3
  230. package/src/knowledge/CONTEXT.md +2 -2
  231. package/src/knowledge/__tests__/audit.test.ts +1 -1
  232. package/src/knowledge/__tests__/flywheel-metrics.test.ts +1 -1
  233. package/src/knowledge/audit-scoring.ts +1 -1
  234. package/src/monitoring/CONTEXT.md +2 -2
  235. package/src/monitoring/__tests__/skipped-lines-report.test.ts +2 -2
  236. package/src/monitoring/__tests__/traces.test.ts +1 -1
  237. package/src/monitoring/trace-analyzer.ts +2 -2
  238. package/src/monitoring/traces.ts +4 -4
  239. package/src/pretool-use-hook.ts +5 -5
  240. package/src/release/CONTEXT.md +3 -3
  241. package/src/release/integrity.ts +4 -4
  242. package/src/test-setup/__tests__/mkdtemp-cleanup.test.ts +1 -1
  243. package/src/test-setup/mkdtemp-cleanup.ts +1 -1
  244. package/src/tools/CONTEXT.md +3 -3
  245. package/src/tools/__tests__/registry.test.ts +3 -3
  246. package/src/tools/definitions/core/notification/notify.yml +0 -1
  247. package/src/tools/definitions/ext/browser/browser-close.yml +0 -1
  248. package/src/tools/definitions/ext/browser/browser-start.yml +0 -1
  249. package/src/tools/definitions/std/evolution/implement.yml +0 -1
  250. package/src/tools/definitions/std/evolution/prioritize.yml +0 -1
  251. package/src/tools/definitions/std/evolution/report-gap.yml +0 -1
  252. package/src/tools/definitions/std/governance/aggregate-opinions.yml +0 -1
  253. package/src/tools/definitions/std/governance/audit-task.yml +0 -1
  254. package/src/tools/definitions/std/governance/cast-vote.yml +0 -1
  255. package/src/tools/definitions/std/governance/create-voting-session.yml +0 -1
  256. package/src/tools/definitions/std/governance/define-stance.yml +0 -1
  257. package/src/tools/definitions/std/governance/impeach.yml +0 -1
  258. package/src/tools/definitions/std/governance/multi-stance-review.yml +0 -1
  259. package/src/tools/definitions/std/governance/rollback.yml +0 -1
  260. package/src/tools/definitions/std/governance/stance-review.yml +0 -1
  261. package/src/tools/definitions/std/governance/track-effect.yml +0 -1
  262. package/src/tools/definitions/std/governance/vote-tally.yml +0 -1
  263. package/src/tools/definitions/std/planning/split-batch.yml +0 -1
  264. package/src/tools/definitions/std/planning/split-tasks.yml +0 -1
  265. package/src/types/constraint.ts +1 -8
  266. package/src/types/passes-gate.ts +8 -0
  267. package/src/utils/detect-source-roots.ts +2 -20
  268. package/bin/harness-knowledge-track.sh +0 -47
  269. package/bin/harness-sensitive-check.sh +0 -67
  270. package/dist/core/constraints/checkers/iron-flags.d.ts +0 -12
  271. package/dist/core/constraints/checkers/iron-flags.d.ts.map +0 -1
  272. package/dist/core/constraints/checkers/iron-flags.js +0 -16
  273. package/dist/core/constraints/checkers/iron-flags.js.map +0 -1
  274. package/src/core/constraints/checkers/__tests__/iron-flags.test.ts +0 -43
  275. package/src/core/constraints/checkers/iron-flags.ts +0 -17
  276. package/templates/nextjs-app/.github/workflows/ci.yml +0 -39
  277. package/templates/node-api/.github/workflows/ci.yml +0 -36
  278. package/templates/node-api/package.json +0 -23
  279. package/templates/node-api/src/index.ts +0 -2
  280. package/templates/node-api/tsconfig.json +0 -19
  281. package/templates/python-api/.github/workflows/ci.yml +0 -39
@@ -118,7 +118,6 @@ prompt: |
118
118
 
119
119
  # 元数据
120
120
  metadata:
121
- author: Agent Studio
122
121
  tags:
123
122
  - evolution
124
123
  - implementation
@@ -105,7 +105,6 @@ outputs:
105
105
 
106
106
  # 元数据
107
107
  metadata:
108
- author: Agent Studio
109
108
  tags:
110
109
  - evolution
111
110
  - prioritization
@@ -158,7 +158,6 @@ examples:
158
158
 
159
159
  # 元数据
160
160
  metadata:
161
- author: Agent Studio
162
161
  tags:
163
162
  - evolution
164
163
  - gap-analysis
@@ -70,7 +70,6 @@ execute:
70
70
 
71
71
  # 元数据
72
72
  metadata:
73
- author: Agent Studio
74
73
  tags:
75
74
  - governance
76
75
  - aggregation
@@ -171,7 +171,6 @@ outputs:
171
171
 
172
172
  # 元数据
173
173
  metadata:
174
- author: Agent Studio
175
174
  tags:
176
175
  - governance
177
176
  - audit
@@ -122,7 +122,6 @@ errors:
122
122
 
123
123
  # 元数据
124
124
  metadata:
125
- author: Agent Studio
126
125
  tags:
127
126
  - governance
128
127
  - voting
@@ -95,7 +95,6 @@ outputs:
95
95
 
96
96
  # 元数据
97
97
  metadata:
98
- author: Agent Studio
99
98
  tags:
100
99
  - governance
101
100
  - voting
@@ -74,7 +74,6 @@ execute:
74
74
 
75
75
  # 元数据
76
76
  metadata:
77
- author: Agent Studio
78
77
  tags:
79
78
  - governance
80
79
  - stance
@@ -172,7 +172,6 @@ protections:
172
172
 
173
173
  # 元数据
174
174
  metadata:
175
- author: Agent Studio
176
175
  tags:
177
176
  - governance
178
177
  - impeachment
@@ -145,7 +145,6 @@ max_parallel: 3
145
145
 
146
146
  # 元数据
147
147
  metadata:
148
- author: Agent Studio
149
148
  tags:
150
149
  - governance
151
150
  - review
@@ -179,7 +179,6 @@ errors:
179
179
 
180
180
  # 元数据
181
181
  metadata:
182
- author: Agent Studio
183
182
  tags:
184
183
  - governance
185
184
  - rollback
@@ -141,7 +141,6 @@ execute:
141
141
 
142
142
  # 元数据
143
143
  metadata:
144
- author: Agent Studio
145
144
  tags:
146
145
  - governance
147
146
  - review
@@ -192,7 +192,6 @@ outputs:
192
192
 
193
193
  # 元数据
194
194
  metadata:
195
- author: Agent Studio
196
195
  tags:
197
196
  - governance
198
197
  - effect-tracking
@@ -137,7 +137,6 @@ decision_priority:
137
137
 
138
138
  # 元数据
139
139
  metadata:
140
- author: Agent Studio
141
140
  tags:
142
141
  - governance
143
142
  - voting
@@ -458,7 +458,6 @@ examples:
458
458
  # ============================================================================
459
459
 
460
460
  metadata:
461
- author: Agent Studio
462
461
  version: 2.0.0
463
462
  changelog:
464
463
  - version: 2.0.0
@@ -343,7 +343,6 @@ examples:
343
343
  # ============================================================================
344
344
 
345
345
  metadata:
346
- author: Agent Studio
347
346
  version: 1.0.0
348
347
  changelog:
349
348
  - version: 1.0.0
@@ -35,7 +35,7 @@ export type ConstraintSeverity = 'error' | 'warning' | 'info';
35
35
  * - gate:硬门禁——带 checker、违规按 severity 阻断/告警(缺省通道,现有行为)
36
36
  * - workflow:流程机制承载——无 checker,由 CI/拆票等流程结构兜住,不进检查分发
37
37
  * - discipline:拦不住但数得出——无 checker 的登记记录,harness 永不渲染、
38
- * 永不注入、永不执行,仅供消费方(如 studio)做代理信号计数;
38
+ * 永不注入、永不执行,仅供消费方做代理信号计数;
39
39
  * 超阈值晋升毕业后原地翻回 gate(补上 checker)
40
40
  */
41
41
  export type ConstraintChannel = 'gate' | 'workflow' | 'discipline';
@@ -220,9 +220,6 @@ export interface ConstraintContext {
220
220
  /** 是否已通过诊断→修复闸门(设计方案已确认) */
221
221
  hasPlanApproval?: boolean;
222
222
 
223
- /** 是否有验证证据 */
224
- hasVerificationEvidence?: boolean;
225
-
226
223
  /** 是否有测试 */
227
224
  hasTest?: boolean;
228
225
 
@@ -277,7 +274,3 @@ export interface ConstraintCheckResult {
277
274
  warningCount: number;
278
275
  }
279
276
 
280
- /**
281
- * studio 兼容别名(P0 护栏):等价于 ConstraintContext
282
- */
283
- export type IronLawContext = ConstraintContext;
@@ -2,6 +2,14 @@
2
2
  * 测试门控类型定义
3
3
  */
4
4
 
5
+ /**
6
+ * 验证证据的约定落点(项目根相对路径)
7
+ *
8
+ * 写方 = PassesGate.runTests(真实跑测试命令后落盘)与消费方外部验证事件;
9
+ * 读方 = no_completion_without_verification checker(harness#183)。路径真相只此一处。
10
+ */
11
+ export const EVIDENCE_DIR_REL = '.harness/evidence';
12
+
5
13
  /**
6
14
  * 测试门控配置
7
15
  */
@@ -3,7 +3,7 @@
3
3
  *
4
4
  * 统一所有源码目录发现逻辑:
5
5
  * 1. monorepo: packages/下各包的 src 或 lib 子目录
6
- * 2. monorepo: apps/下各应用的 src/modules 子目录
6
+ * 2. monorepo: apps/下各应用的 src 子目录
7
7
  * 3. 单 repo: src/ lib/ 目录
8
8
  *
9
9
  * 返回相对 projectPath 的路径数组。全都不存在时返回空数组。
@@ -49,28 +49,10 @@ export function detectSourceRoots(projectPath: string): string[] {
49
49
  if (!entry.isDirectory() || entry.name.startsWith('.') || entry.name.startsWith('__')) continue;
50
50
  const appDir = join(appsDir, entry.name);
51
51
 
52
- // apps/api/src/modules/* 的子目录
53
- const modulesDir = join(appDir, 'src', 'modules');
54
- if (existsSync(modulesDir)) {
55
- try {
56
- const modEntries = readdirSync(modulesDir, { withFileTypes: true });
57
- for (const mod of modEntries) {
58
- if (!mod.isDirectory() || mod.name.startsWith('.') || mod.name.startsWith('__')) continue;
59
- const modPath = join(modulesDir, mod.name);
60
- if (hasSourceFiles(modPath)) {
61
- roots.push(`apps/${entry.name}/src/modules/${mod.name}`);
62
- }
63
- }
64
- } catch { /* skip */ }
65
- }
66
-
67
52
  // apps/xxx/src 本身
68
53
  const appSrcDir = join(appDir, 'src');
69
54
  if (existsSync(appSrcDir) && hasSourceFiles(appSrcDir)) {
70
- // 避免重复(modules 已覆盖子目录)
71
- if (!roots.some(r => r.startsWith(`apps/${entry.name}/src/`))) {
72
- roots.push(`apps/${entry.name}/src`);
73
- }
55
+ roots.push(`apps/${entry.name}/src`);
74
56
  }
75
57
  }
76
58
  } catch { /* skip */ }
@@ -1,47 +0,0 @@
1
- #!/bin/bash
2
- # PostToolUse hook — track deep analysis + session metrics
3
- # Matcher: EnterPlanMode|Agent|Read|Write|Edit|Bash (broad coverage)
4
- # DailyReflection: enriched session:summary events for behavioral analysis
5
-
6
- STATE_FILE=/tmp/claude-knowledge-capture-state.json
7
- INPUT=$(cat)
8
-
9
- tool_name=$(echo "$INPUT" | jq -r '.tool_name // ""')
10
- file_path=$(echo "$INPUT" | jq -r '.tool_input.file_path // ""')
11
-
12
- # Init state file if missing (tool: claude|codex|opencode|etc)
13
- _tool=$(echo "${CLAUDE_CODE_TOOL_NAME:-claude}" | tr '[:upper:]' '[:lower:]')
14
- [ -f "$STATE_FILE" ] || echo "{\"planned\":false,\"explored\":false,\"readDirs\":[],\"captured\":false,\"turnCount\":0,\"startTime\":$(date +%s)000,\"tool\":\"$_tool\"}" > "$STATE_FILE"
15
-
16
- # Always increment turn counter on substantive tools
17
- case "$tool_name" in
18
- EnterPlanMode)
19
- jq '.planned = true | .turnCount += 1' "$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
20
- ;;
21
- Agent)
22
- # Agent(Explore) spawned → deep analysis signal
23
- _agent_type=$(echo "$INPUT" | jq -r '.tool_input.subagent_type // ""')
24
- if [ "$_agent_type" = "Explore" ]; then
25
- jq '.explored = true | .turnCount += 1' "$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
26
- fi
27
- ;;
28
- Read)
29
- if [ -n "$file_path" ]; then
30
- dir=$(dirname "$file_path")
31
- if [ "$dir" != "." ] && [ "$dir" != "/" ]; then
32
- jq --arg d "$dir" '.readDirs += [$d] | .readDirs |= unique | .turnCount += 1' "$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
33
- fi
34
- fi
35
- ;;
36
- Write|Edit)
37
- jq '.turnCount += 1' "$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
38
- case "$file_path" in
39
- *.harness/knowledge-docs/*|*.harness/knowledge/*|*/memory/*.md|*/docs/*.md)
40
- jq '.captured = true' "$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
41
- ;;
42
- esac
43
- ;;
44
- Bash)
45
- jq '.turnCount += 1' "$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
46
- ;;
47
- esac
@@ -1,67 +0,0 @@
1
- #!/bin/bash
2
- # PostToolUse hook — check for operations on sensitive files without prior Read
3
- #
4
- # Detects: Bash(mv/rm), Edit, or Write targeting files in bin/, .harness/, or
5
- # package.json — and checks whether those files were Read earlier in this session.
6
- #
7
- # State file is maintained by harness-knowledge-track.sh which tracks all Read calls.
8
-
9
- STATE_FILE=/tmp/claude-knowledge-capture-state.json
10
- SENSITIVE_DIRS="bin/ .harness/"
11
-
12
- INPUT=$(cat)
13
- tool_name=$(echo "$INPUT" | jq -r '.tool_name // ""')
14
- file_path=$(echo "$INPUT" | jq -r '.tool_input.file_path // ""')
15
- content=$(echo "$INPUT" | jq -r '.tool_input.content // ""')
16
- command=$(echo "$INPUT" | jq -r '.tool_input.command // ""')
17
-
18
- # Check if this operation targets a sensitive file
19
- is_sensitive=false
20
- for dir in $SENSITIVE_DIRS; do
21
- case "$file_path" in
22
- *$dir*) is_sensitive=true; break ;;
23
- esac
24
- done
25
-
26
- # For Bash, check if the command involves mv/rm on sensitive paths
27
- if [ "$tool_name" = "Bash" ] && [ -n "$command" ]; then
28
- for dir in $SENSITIVE_DIRS; do
29
- if echo "$command" | grep -qE "(mv|rm|cp|git rm).*$dir"; then
30
- is_sensitive=true
31
- # Extract target from command for checking
32
- file_path=$(echo "$command" | grep -oE "$dir[^ ]*" | head -1)
33
- break
34
- fi
35
- done
36
- fi
37
-
38
- # Only check sensitive operations
39
- if [ "$is_sensitive" != "true" ] || [ -z "$file_path" ]; then
40
- exit 0
41
- fi
42
-
43
- # Check if this file was Read earlier in the session
44
- if [ -f "$STATE_FILE" ]; then
45
- read_dirs=$(jq -r '.readDirs // [] | join(" ")' "$STATE_FILE" 2>/dev/null || echo "")
46
-
47
- # Check if any read_dir is an ancestor of file_path
48
- verified=false
49
- file_dir=$(dirname "$file_path")
50
- for dir in $read_dirs; do
51
- case "$file_dir" in
52
- "$dir"|"$dir/"*) verified=true; break ;;
53
- esac
54
- done
55
-
56
- if [ "$verified" != "true" ]; then
57
- # Also check if the file itself was explicitly Read (file_path matches a read path)
58
- # The track hook only records directories, not individual files — conservative check
59
-
60
- # Emit warning via state file for Stop hook to pick up
61
- jq --arg op "$tool_name" --arg fp "$file_path" \
62
- '.sensitiveOps += [{"tool":$op,"file":$fp,"verified":false}]' \
63
- "$STATE_FILE" > "${STATE_FILE}.tmp" && mv "${STATE_FILE}.tmp" "$STATE_FILE"
64
- fi
65
- fi
66
-
67
- exit 0
@@ -1,12 +0,0 @@
1
- /**
2
- * error 级轻量检查(工单 21):纯上下文证据标志判定,无 I/O
3
- *
4
- * harness#174 后仅存活的 flag:hasVerificationEvidence
5
- *(incremental_progress / no_implementation_without_requirement 已随定义一并删除)
6
- *
7
- * 三态语义(ADR-0001 防爆措施):
8
- * - undefined = flag 未接线 → skip(不评估,CLI pre-commit 等路径不误报违规)
9
- * - 显式 false → fail;true → pass
10
- */
11
- export declare const noCompletionWithoutVerification: import("./types").ConstraintCheck;
12
- //# sourceMappingURL=iron-flags.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"iron-flags.d.ts","sourceRoot":"","sources":["../../../../src/core/constraints/checkers/iron-flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,eAAO,MAAM,+BAA+B,mCAG3C,CAAC"}
@@ -1,16 +0,0 @@
1
- "use strict";
2
- /**
3
- * error 级轻量检查(工单 21):纯上下文证据标志判定,无 I/O
4
- *
5
- * harness#174 后仅存活的 flag:hasVerificationEvidence
6
- *(incremental_progress / no_implementation_without_requirement 已随定义一并删除)
7
- *
8
- * 三态语义(ADR-0001 防爆措施):
9
- * - undefined = flag 未接线 → skip(不评估,CLI pre-commit 等路径不误报违规)
10
- * - 显式 false → fail;true → pass
11
- */
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.noCompletionWithoutVerification = void 0;
14
- const types_1 = require("./types");
15
- exports.noCompletionWithoutVerification = (0, types_1.contextEvidenceFlag)('no_completion_without_verification', 'hasVerificationEvidence');
16
- //# sourceMappingURL=iron-flags.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"iron-flags.js","sourceRoot":"","sources":["../../../../src/core/constraints/checkers/iron-flags.ts"],"names":[],"mappings":";AAAA;;;;;;;;;GASG;;;AAEH,mCAA8C;AAEjC,QAAA,+BAA+B,GAAG,IAAA,2BAAmB,EAChE,oCAAoC,EACpC,yBAAyB,CAC1B,CAAC"}
@@ -1,43 +0,0 @@
1
- /**
2
- * 铁律层 flag 检查旁测(架构评审候选4,ADR-0009 同模式)
3
- *
4
- * 唯一存活的 flag 铁律为 contextEvidenceFlag 构造,真实 bug 面 = 读错上下文字段
5
- * 与三态语义(undefined→skip / false→fail / true→pass)。直接喂不同字段组合
6
- * 钉死映射,不再经 engine facade(旧测在 skip-semantics/checker.test 间接打)。
7
- *
8
- * harness#174 删除 incremental_progress / no_implementation_without_requirement,
9
- * 对应用例一并移除。
10
- */
11
-
12
- import { describe, it, expect } from '@jest/globals';
13
- import { noCompletionWithoutVerification } from '../iron-flags';
14
- import { buildCheckEnv } from '../types';
15
- import type { ConstraintContext } from '../../../../types/constraint';
16
-
17
- const evaluate = (
18
- check: { evaluate: (env: any) => unknown },
19
- ctx: Partial<ConstraintContext>
20
- ) => check.evaluate(buildCheckEnv({ ...ctx, operation: 'code_implementation' }, 'none'));
21
-
22
- describe('iron flags — 三态与字段映射', () => {
23
- it('no_completion_without_verification → 读 hasVerificationEvidence', async () => {
24
- // 未接线 → 带原因的 skip(harness#182:undefined flag 不再静默 skip)
25
- expect(await evaluate(noCompletionWithoutVerification, {})).toEqual({
26
- skip: true,
27
- reason: '证据标志 hasVerificationEvidence 未接线',
28
- });
29
- expect(await evaluate(noCompletionWithoutVerification, { hasVerificationEvidence: false })).toBe(false);
30
- expect(await evaluate(noCompletionWithoutVerification, { hasVerificationEvidence: true })).toBe(true);
31
- // 相邻字段不串台:hasTest 不能顶替
32
- expect(await evaluate(noCompletionWithoutVerification, { hasTest: true })).toEqual({
33
- skip: true,
34
- reason: '证据标志 hasVerificationEvidence 未接线',
35
- });
36
- });
37
-
38
- it('声明 contextFlags 输入契约(harness#182):编排层据此在 evaluate 前降级', () => {
39
- expect(noCompletionWithoutVerification.needs).toEqual({
40
- contextFlags: ['hasVerificationEvidence'],
41
- });
42
- });
43
- });
@@ -1,17 +0,0 @@
1
- /**
2
- * error 级轻量检查(工单 21):纯上下文证据标志判定,无 I/O
3
- *
4
- * harness#174 后仅存活的 flag:hasVerificationEvidence
5
- *(incremental_progress / no_implementation_without_requirement 已随定义一并删除)
6
- *
7
- * 三态语义(ADR-0001 防爆措施):
8
- * - undefined = flag 未接线 → skip(不评估,CLI pre-commit 等路径不误报违规)
9
- * - 显式 false → fail;true → pass
10
- */
11
-
12
- import { contextEvidenceFlag } from './types';
13
-
14
- export const noCompletionWithoutVerification = contextEvidenceFlag(
15
- 'no_completion_without_verification',
16
- 'hasVerificationEvidence'
17
- );
@@ -1,39 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- branches: [main, master]
6
- pull_request:
7
- branches: [main, master]
8
-
9
- jobs:
10
- test:
11
- name: Test
12
- runs-on: ubuntu-latest
13
-
14
- steps:
15
- - uses: actions/checkout@v4
16
-
17
- - name: Setup Node.js
18
- uses: actions/setup-node@v4
19
- with:
20
- node-version: '20'
21
- cache: 'npm'
22
-
23
- - name: Install dependencies
24
- run: npm ci
25
-
26
- - name: Run linter
27
- run: npm run lint
28
-
29
- - name: Run tests
30
- run: npm test
31
-
32
- - name: Build
33
- run: npm run build
34
-
35
- harness:
36
- name: Harness Check
37
- uses: kww/harness/.github/workflows/harness-check.yml@v1
38
- with:
39
- preset: standard
@@ -1,36 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- branches: [main, master]
6
- pull_request:
7
- branches: [main, master]
8
-
9
- jobs:
10
- test:
11
- name: Test
12
- runs-on: ubuntu-latest
13
-
14
- steps:
15
- - uses: actions/checkout@v4
16
-
17
- - name: Setup Node.js
18
- uses: actions/setup-node@v4
19
- with:
20
- node-version: '20'
21
- cache: 'npm'
22
-
23
- - name: Install dependencies
24
- run: npm ci
25
-
26
- - name: Run tests
27
- run: npm test
28
-
29
- - name: Build
30
- run: npm run build
31
-
32
- harness:
33
- name: Harness Check
34
- uses: kww/harness/.github/workflows/harness-check.yml@v1
35
- with:
36
- preset: standard
@@ -1,23 +0,0 @@
1
- {
2
- "name": "{{project_name}}",
3
- "version": "0.1.0",
4
- "description": "",
5
- "type": "module",
6
- "main": "dist/index.js",
7
- "scripts": {
8
- "build": "tsc",
9
- "dev": "tsc --watch",
10
- "test": "node --experimental-vm-modules node_modules/jest/bin/jest.js",
11
- "lint": "eslint src --ext .ts"
12
- },
13
- "devDependencies": {
14
- "@types/node": "^20.11.0",
15
- "typescript": "^5.3.0",
16
- "jest": "^29.7.0",
17
- "@types/jest": "^29.5.0",
18
- "ts-jest": "^29.1.0"
19
- },
20
- "dependencies": {
21
- "@dommaker/harness": "^0.1.0"
22
- }
23
- }
@@ -1,2 +0,0 @@
1
- // 入口文件
2
- export {};
@@ -1,19 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "module": "ESNext",
5
- "moduleResolution": "Node",
6
- "lib": ["ES2022"],
7
- "outDir": "./dist",
8
- "rootDir": "./src",
9
- "strict": true,
10
- "esModuleInterop": true,
11
- "skipLibCheck": true,
12
- "forceConsistentCasingInFileNames": true,
13
- "declaration": true,
14
- "declarationMap": true,
15
- "sourceMap": true
16
- },
17
- "include": ["src/**/*"],
18
- "exclude": ["node_modules", "dist", "__tests__"]
19
- }
@@ -1,39 +0,0 @@
1
- name: CI
2
-
3
- on:
4
- push:
5
- branches: [main, master]
6
- pull_request:
7
- branches: [main, master]
8
-
9
- jobs:
10
- test:
11
- name: Test
12
- runs-on: ubuntu-latest
13
-
14
- steps:
15
- - uses: actions/checkout@v4
16
-
17
- - name: Setup Python
18
- uses: actions/setup-python@v5
19
- with:
20
- python-version: '3.11'
21
- cache: 'pip'
22
-
23
- - name: Install dependencies
24
- run: |
25
- pip install -r requirements.txt
26
- pip install pytest pytest-cov
27
-
28
- - name: Run tests
29
- run: pytest --cov=src --cov-report=xml
30
-
31
- - name: Upload coverage
32
- uses: codecov/codecov-action@v4
33
-
34
- harness:
35
- name: Harness Check
36
- uses: kww/harness/.github/workflows/harness-check.yml@v1
37
- with:
38
- preset: standard
39
- skip-tests: true # Python 项目使用 pytest