@boyingliu01/xp-gate 0.38.125 → 0.39.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 (428) hide show
  1. package/README.md +93 -0
  2. package/adapters/gate-3.sh +45 -1
  3. package/adapters/gate-7.sh +15 -6
  4. package/adapters/python.sh +36 -38
  5. package/bin/xp-gate.js +35 -0
  6. package/build-integrity/gate-10-lines.ts +98 -0
  7. package/build-integrity/gate-10.ts +131 -117
  8. package/build-integrity/quote-masker.ts +17 -3
  9. package/gate-3.sh +45 -1
  10. package/gate-registry.sh +3 -1
  11. package/gates/common-process.ts +116 -34
  12. package/gates/common.ts +51 -15
  13. package/gates/gate-3.ts +166 -61
  14. package/gates/gate-8.ts +76 -24
  15. package/gates/gate-9.ts +276 -82
  16. package/gates/pbt-detect.ts +70 -39
  17. package/gates/python-health.ts +236 -98
  18. package/gates/test-layers.ts +103 -30
  19. package/hooks/deploy-manifest.sh +1 -0
  20. package/hooks/gate-3.sh +45 -1
  21. package/hooks/gate-entries/gate-1-entry.sh +44 -24
  22. package/hooks/gate-entries/gate-5-entry.sh +60 -20
  23. package/hooks/gate-entries/gate-6-entry.sh +15 -6
  24. package/hooks/gate-registry.sh +3 -1
  25. package/hooks/lib/gate-status.sh +164 -0
  26. package/hooks/lib/jscpd-run.sh +9 -1
  27. package/hooks/lib/native-path.sh +54 -0
  28. package/hooks/lib/toolchain-path.sh +38 -0
  29. package/hooks/lib/validate-code-walkthrough.cjs +324 -99
  30. package/hooks/pre-commit +52 -0
  31. package/hooks/pre-push +67 -7
  32. package/lib/agent-runtime-journal.js +104 -37
  33. package/lib/arch.js +6 -0
  34. package/lib/baseline.js +329 -201
  35. package/lib/check.js +38 -2
  36. package/lib/deploy-manifest.js +1 -0
  37. package/lib/doctor-constants.js +43 -0
  38. package/lib/doctor-tool-checks.js +129 -0
  39. package/lib/doctor.js +2014 -1038
  40. package/lib/flaky.js +178 -79
  41. package/lib/gate-audit.ts +80 -0
  42. package/lib/gate-runner.js +115 -63
  43. package/lib/init.js +6 -0
  44. package/lib/language-capability-surfaces.js +75 -8
  45. package/lib/language-capability.js +3 -0
  46. package/lib/language-registry.js +608 -0
  47. package/lib/language-tools.js +679 -894
  48. package/lib/phase-transition.js +646 -446
  49. package/lib/prepush-evidence.js +174 -0
  50. package/lib/sprint-audit.js +52 -22
  51. package/lib/sprint-discovery.js +66 -35
  52. package/lib/sprint-format.js +114 -0
  53. package/lib/sprint-init.js +372 -118
  54. package/lib/sprint-status.js +134 -90
  55. package/lib/star-notice.js +346 -0
  56. package/lib/tool-audit.js +729 -0
  57. package/lib/tool-display.js +52 -0
  58. package/lib/tool-install.js +179 -0
  59. package/lib/uninstall.js +331 -188
  60. package/mock-policy/gate-m3.ts +74 -23
  61. package/mock-policy/mock-decision-engine.ts +21 -7
  62. package/mock-policy/scope-scanner.ts +128 -69
  63. package/mutation/detect-ai-test.ts +20 -12
  64. package/mutation/gate-m.ts +6 -2
  65. package/mutation/init-baseline.ts +49 -13
  66. package/mutation/runners/go-mutant-runner.ts +7 -49
  67. package/mutation/runners/gremlins-runner.ts +53 -18
  68. package/mutation/runners/mutmut-runner.ts +455 -163
  69. package/mutation/runners/pitest-runner.ts +85 -131
  70. package/mutation/runners/spawn-with-capture.ts +304 -0
  71. package/mutation/runners/stryker-runner.ts +14 -55
  72. package/mutation/update-baseline.ts +25 -18
  73. package/package.json +20 -8
  74. package/plugins/claude-code/.claude-plugin/plugin.json +1 -1
  75. package/plugins/claude-code/bin/delphi-review-guard.sh +12 -61
  76. package/plugins/claude-code/skills/delphi-review/.delphi-config.json.example +6 -11
  77. package/plugins/claude-code/skills/delphi-review/AGENTS.md +1 -1
  78. package/plugins/claude-code/skills/reinstall-xp-gate/.architecture-skip +8 -0
  79. package/plugins/claude-code/skills/reinstall-xp-gate/.github/workflows/test.yml +106 -0
  80. package/plugins/claude-code/skills/reinstall-xp-gate/CHANGELOG.md +379 -0
  81. package/plugins/claude-code/skills/reinstall-xp-gate/LICENSE +21 -0
  82. package/plugins/claude-code/skills/reinstall-xp-gate/QUALITY-OVERVIEW.md +173 -0
  83. package/plugins/claude-code/skills/reinstall-xp-gate/README.md +167 -0
  84. package/plugins/claude-code/skills/reinstall-xp-gate/SKILL.md +271 -0
  85. package/plugins/claude-code/skills/reinstall-xp-gate/TODO.md +253 -0
  86. package/plugins/claude-code/skills/reinstall-xp-gate/VERSION +1 -0
  87. package/plugins/claude-code/skills/reinstall-xp-gate/package.json +28 -0
  88. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/audit.mjs +193 -0
  89. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/coverage.mjs +140 -0
  90. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/hp-gate.mjs +175 -0
  91. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/install.mjs +64 -0
  92. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/agent-paths.mjs +67 -0
  93. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/agents.mjs +247 -0
  94. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/backups.mjs +96 -0
  95. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/baseline.mjs +101 -0
  96. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/ccn.mjs +124 -0
  97. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/delphi.mjs +61 -0
  98. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/fs-tree.mjs +108 -0
  99. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/gatecheck.mjs +290 -0
  100. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/json-file.mjs +37 -0
  101. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/mutations.mjs +154 -0
  102. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/platform.mjs +92 -0
  103. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/probes.mjs +102 -0
  104. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/proc.mjs +33 -0
  105. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/report.mjs +29 -0
  106. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/residue.mjs +188 -0
  107. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/selfsync.mjs +75 -0
  108. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/skills.mjs +121 -0
  109. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/spawn.mjs +161 -0
  110. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/testreport.mjs +26 -0
  111. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/tools.mjs +238 -0
  112. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/util.mjs +33 -0
  113. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/verdict.mjs +45 -0
  114. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/version.mjs +29 -0
  115. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/lib/xp-cli.mjs +66 -0
  116. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/mutation.mjs +132 -0
  117. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/preflight.mjs +75 -0
  118. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/reinstall.mjs +297 -0
  119. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/setup-wsl.sh +633 -0
  120. package/plugins/claude-code/skills/reinstall-xp-gate/scripts/verify.mjs +222 -0
  121. package/plugins/claude-code/skills/reinstall-xp-gate/tests/agents.test.mjs +168 -0
  122. package/plugins/claude-code/skills/reinstall-xp-gate/tests/baseline.test.mjs +104 -0
  123. package/plugins/claude-code/skills/reinstall-xp-gate/tests/ccn.test.mjs +87 -0
  124. package/plugins/claude-code/skills/reinstall-xp-gate/tests/cleanup.test.mjs +128 -0
  125. package/plugins/claude-code/skills/reinstall-xp-gate/tests/coverage.test.mjs +69 -0
  126. package/plugins/claude-code/skills/reinstall-xp-gate/tests/delphi.test.mjs +78 -0
  127. package/plugins/claude-code/skills/reinstall-xp-gate/tests/fixtures.mjs +61 -0
  128. package/plugins/claude-code/skills/reinstall-xp-gate/tests/gatecheck-audit.test.mjs +157 -0
  129. package/plugins/claude-code/skills/reinstall-xp-gate/tests/gatecheck.test.mjs +57 -0
  130. package/plugins/claude-code/skills/reinstall-xp-gate/tests/mutation-anchors.test.mjs +49 -0
  131. package/plugins/claude-code/skills/reinstall-xp-gate/tests/proc-contract.test.mjs +58 -0
  132. package/plugins/claude-code/skills/reinstall-xp-gate/tests/proc.test.mjs +243 -0
  133. package/plugins/claude-code/skills/reinstall-xp-gate/tests/report.test.mjs +66 -0
  134. package/plugins/claude-code/skills/reinstall-xp-gate/tests/residue.test.mjs +278 -0
  135. package/plugins/claude-code/skills/reinstall-xp-gate/tests/selfsync.test.mjs +70 -0
  136. package/plugins/claude-code/skills/reinstall-xp-gate/tests/skills.test.mjs +171 -0
  137. package/plugins/claude-code/skills/reinstall-xp-gate/tests/testreport.test.mjs +40 -0
  138. package/plugins/claude-code/skills/reinstall-xp-gate/tests/timeout-budgets.test.mjs +38 -0
  139. package/plugins/claude-code/skills/reinstall-xp-gate/tests/tools-leaf.test.mjs +323 -0
  140. package/plugins/claude-code/skills/reinstall-xp-gate/tests/tools-probe.test.mjs +350 -0
  141. package/plugins/claude-code/skills/reinstall-xp-gate/tests/tools.test.mjs +131 -0
  142. package/plugins/claude-code/skills/reinstall-xp-gate/tests/util.test.mjs +154 -0
  143. package/plugins/claude-code/skills/sprint-flow/AGENTS.md +1 -1
  144. package/plugins/claude-code/skills/test-specification-alignment/AGENTS.md +1 -1
  145. package/plugins/dsh/package.json +1 -1
  146. package/plugins/dsh/scripts/prepack.cjs +43 -18
  147. package/plugins/dsh/scripts/verify-skill-provider.mjs +39 -14
  148. package/plugins/dsh/skills/delphi-review/.delphi-config.json.example +6 -11
  149. package/plugins/dsh/skills/delphi-review/AGENTS.md +1 -1
  150. package/plugins/dsh/skills/sprint-flow/AGENTS.md +1 -1
  151. package/plugins/dsh/skills/test-specification-alignment/AGENTS.md +1 -1
  152. package/plugins/dsh/src/skills.test.ts +9 -0
  153. package/plugins/opencode/index.ts +337 -123
  154. package/plugins/opencode/package.json +1 -1
  155. package/plugins/opencode/scripts/prepack.cjs +41 -16
  156. package/plugins/opencode/skills/delphi-review/.delphi-config.json.example +6 -11
  157. package/plugins/opencode/skills/delphi-review/AGENTS.md +1 -1
  158. package/plugins/opencode/skills/reinstall-xp-gate/.architecture-skip +8 -0
  159. package/plugins/opencode/skills/reinstall-xp-gate/.github/workflows/test.yml +106 -0
  160. package/plugins/opencode/skills/reinstall-xp-gate/CHANGELOG.md +379 -0
  161. package/plugins/opencode/skills/reinstall-xp-gate/LICENSE +21 -0
  162. package/plugins/opencode/skills/reinstall-xp-gate/QUALITY-OVERVIEW.md +173 -0
  163. package/plugins/opencode/skills/reinstall-xp-gate/README.md +167 -0
  164. package/plugins/opencode/skills/reinstall-xp-gate/SKILL.md +271 -0
  165. package/plugins/opencode/skills/reinstall-xp-gate/TODO.md +253 -0
  166. package/plugins/opencode/skills/reinstall-xp-gate/VERSION +1 -0
  167. package/plugins/opencode/skills/reinstall-xp-gate/package.json +28 -0
  168. package/plugins/opencode/skills/reinstall-xp-gate/scripts/audit.mjs +193 -0
  169. package/plugins/opencode/skills/reinstall-xp-gate/scripts/coverage.mjs +140 -0
  170. package/plugins/opencode/skills/reinstall-xp-gate/scripts/hp-gate.mjs +175 -0
  171. package/plugins/opencode/skills/reinstall-xp-gate/scripts/install.mjs +64 -0
  172. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/agent-paths.mjs +67 -0
  173. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/agents.mjs +247 -0
  174. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/backups.mjs +96 -0
  175. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/baseline.mjs +101 -0
  176. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/ccn.mjs +124 -0
  177. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/delphi.mjs +61 -0
  178. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/fs-tree.mjs +108 -0
  179. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/gatecheck.mjs +290 -0
  180. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/json-file.mjs +37 -0
  181. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/mutations.mjs +154 -0
  182. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/platform.mjs +92 -0
  183. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/probes.mjs +102 -0
  184. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/proc.mjs +33 -0
  185. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/report.mjs +29 -0
  186. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/residue.mjs +188 -0
  187. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/selfsync.mjs +75 -0
  188. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/skills.mjs +121 -0
  189. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/spawn.mjs +161 -0
  190. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/testreport.mjs +26 -0
  191. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/tools.mjs +238 -0
  192. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/util.mjs +33 -0
  193. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/verdict.mjs +45 -0
  194. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/version.mjs +29 -0
  195. package/plugins/opencode/skills/reinstall-xp-gate/scripts/lib/xp-cli.mjs +66 -0
  196. package/plugins/opencode/skills/reinstall-xp-gate/scripts/mutation.mjs +132 -0
  197. package/plugins/opencode/skills/reinstall-xp-gate/scripts/preflight.mjs +75 -0
  198. package/plugins/opencode/skills/reinstall-xp-gate/scripts/reinstall.mjs +297 -0
  199. package/plugins/opencode/skills/reinstall-xp-gate/scripts/setup-wsl.sh +633 -0
  200. package/plugins/opencode/skills/reinstall-xp-gate/scripts/verify.mjs +222 -0
  201. package/plugins/opencode/skills/reinstall-xp-gate/tests/agents.test.mjs +168 -0
  202. package/plugins/opencode/skills/reinstall-xp-gate/tests/baseline.test.mjs +104 -0
  203. package/plugins/opencode/skills/reinstall-xp-gate/tests/ccn.test.mjs +87 -0
  204. package/plugins/opencode/skills/reinstall-xp-gate/tests/cleanup.test.mjs +128 -0
  205. package/plugins/opencode/skills/reinstall-xp-gate/tests/coverage.test.mjs +69 -0
  206. package/plugins/opencode/skills/reinstall-xp-gate/tests/delphi.test.mjs +78 -0
  207. package/plugins/opencode/skills/reinstall-xp-gate/tests/fixtures.mjs +61 -0
  208. package/plugins/opencode/skills/reinstall-xp-gate/tests/gatecheck-audit.test.mjs +157 -0
  209. package/plugins/opencode/skills/reinstall-xp-gate/tests/gatecheck.test.mjs +57 -0
  210. package/plugins/opencode/skills/reinstall-xp-gate/tests/mutation-anchors.test.mjs +49 -0
  211. package/plugins/opencode/skills/reinstall-xp-gate/tests/proc-contract.test.mjs +58 -0
  212. package/plugins/opencode/skills/reinstall-xp-gate/tests/proc.test.mjs +243 -0
  213. package/plugins/opencode/skills/reinstall-xp-gate/tests/report.test.mjs +66 -0
  214. package/plugins/opencode/skills/reinstall-xp-gate/tests/residue.test.mjs +278 -0
  215. package/plugins/opencode/skills/reinstall-xp-gate/tests/selfsync.test.mjs +70 -0
  216. package/plugins/opencode/skills/reinstall-xp-gate/tests/skills.test.mjs +171 -0
  217. package/plugins/opencode/skills/reinstall-xp-gate/tests/testreport.test.mjs +40 -0
  218. package/plugins/opencode/skills/reinstall-xp-gate/tests/timeout-budgets.test.mjs +38 -0
  219. package/plugins/opencode/skills/reinstall-xp-gate/tests/tools-leaf.test.mjs +323 -0
  220. package/plugins/opencode/skills/reinstall-xp-gate/tests/tools-probe.test.mjs +350 -0
  221. package/plugins/opencode/skills/reinstall-xp-gate/tests/tools.test.mjs +131 -0
  222. package/plugins/opencode/skills/reinstall-xp-gate/tests/util.test.mjs +154 -0
  223. package/plugins/opencode/skills/sprint-flow/AGENTS.md +1 -1
  224. package/plugins/opencode/skills/test-specification-alignment/AGENTS.md +1 -1
  225. package/plugins/qoder/bin/sprint-flow-guard.sh +12 -60
  226. package/plugins/qoder/plugin.json +1 -1
  227. package/plugins/qoder/skills/delphi-review/.delphi-config.json.example +6 -11
  228. package/plugins/qoder/skills/delphi-review/AGENTS.md +1 -1
  229. package/plugins/qoder/skills/sprint-flow/AGENTS.md +1 -1
  230. package/plugins/qoder/skills/test-specification-alignment/AGENTS.md +1 -1
  231. package/plugins/shared/README.md +3 -0
  232. package/plugins/shared/bin/delphi-review-guard.sh +68 -0
  233. package/principles/adapters/control-nesting.ts +481 -168
  234. package/principles/adapters/cpp.ts +61 -22
  235. package/principles/adapters/csharp.ts +183 -66
  236. package/principles/adapters/dart.ts +11 -1
  237. package/principles/adapters/duplication.ts +49 -16
  238. package/principles/adapters/import-clause.ts +62 -15
  239. package/principles/adapters/java.ts +199 -70
  240. package/principles/adapters/line-comment.ts +18 -0
  241. package/principles/adapters/member-scan.ts +50 -8
  242. package/principles/adapters/php.ts +232 -103
  243. package/principles/adapters/python.ts +25 -18
  244. package/principles/adapters/quote-state.ts +21 -8
  245. package/principles/adapters/typescript-mask.ts +276 -0
  246. package/principles/adapters/typescript.ts +206 -200
  247. package/principles/analyzer.ts +16 -6
  248. package/principles/baseline-prune.ts +18 -8
  249. package/principles/baseline.ts +28 -11
  250. package/principles/boy-scout-usage.ts +26 -0
  251. package/principles/boy-scout.ts +261 -180
  252. package/principles/config.ts +183 -57
  253. package/principles/direct-execution.ts +24 -12
  254. package/principles/lint-baseline.ts +235 -122
  255. package/principles/rules/arch/dependency.ts +34 -25
  256. package/principles/rules/arch/shared.ts +24 -20
  257. package/principles/rules/clean-code/deep-nesting.ts +23 -13
  258. package/principles/rules/clean-code/god-class.ts +67 -41
  259. package/principles/rules/clean-code/large-file.ts +30 -23
  260. package/principles/rules/clean-code/long-function.ts +51 -37
  261. package/principles/rules/clean-code/magic-numbers.ts +51 -36
  262. package/principles/rules/clean-code/many-exports.ts +46 -29
  263. package/principles/rules/clean-code/missing-error-handling.ts +38 -20
  264. package/principles/rules/clean-code/too-many-params.ts +41 -22
  265. package/principles/rules/function-source.ts +62 -0
  266. package/principles/rules/solid/dip.ts +10 -6
  267. package/principles/rules/solid/isp.ts +64 -24
  268. package/principles/rules/solid/lsp.ts +66 -18
  269. package/principles/rules/solid/ocp.ts +29 -13
  270. package/principles/rules/solid/srp.ts +34 -18
  271. package/principles/warnings-count.ts +43 -0
  272. package/scripts/__tests__/prepush-source-classification.test.js +129 -0
  273. package/scripts/delphi-config-read.cjs +245 -0
  274. package/scripts/delphi-external-review.cjs +410 -585
  275. package/scripts/delphi-json-extract.cjs +108 -0
  276. package/scripts/delphi-model-validation.cjs +297 -0
  277. package/scripts/delphi-prompts.cjs +55 -0
  278. package/scripts/delphi-repo-tools.cjs +273 -0
  279. package/scripts/delphi-seat-calibration.cjs +204 -0
  280. package/scripts/run-bats-ci.cjs +240 -97
  281. package/scripts/sync-package-content.js +18 -2
  282. package/skills/delphi-review/.delphi-config.json.example +6 -11
  283. package/skills/delphi-review/AGENTS.md +1 -1
  284. package/skills/sprint-flow/AGENTS.md +1 -1
  285. package/skills/test-specification-alignment/AGENTS.md +1 -1
  286. package/lib/__tests__/agent-runtime-journal.test.js +0 -326
  287. package/lib/__tests__/arch-config-template.test.js +0 -190
  288. package/lib/__tests__/arch.test.js +0 -424
  289. package/lib/__tests__/assertion-debt.test.js +0 -99
  290. package/lib/__tests__/audit-cli-contract.test.ts +0 -117
  291. package/lib/__tests__/audit-log.test.ts +0 -107
  292. package/lib/__tests__/baseline-completeness.test.js +0 -264
  293. package/lib/__tests__/baseline-shell-scope.test.js +0 -60
  294. package/lib/__tests__/baseline-unevaluated.test.js +0 -142
  295. package/lib/__tests__/baseline.test.js +0 -212
  296. package/lib/__tests__/bootstrap.test.js +0 -60
  297. package/lib/__tests__/check-alignment-cli.test.mjs +0 -94
  298. package/lib/__tests__/check-alignment-reasons.test.mjs +0 -101
  299. package/lib/__tests__/check-all-skip-accounting.test.js +0 -171
  300. package/lib/__tests__/check-changed-brief.test.js +0 -63
  301. package/lib/__tests__/check-normalize-exit.test.js +0 -24
  302. package/lib/__tests__/check-single-file.test.js +0 -114
  303. package/lib/__tests__/check-version.test.js +0 -463
  304. package/lib/__tests__/coverage-scope.test.js +0 -140
  305. package/lib/__tests__/coverage-threshold.test.js +0 -80
  306. package/lib/__tests__/crap-cli.test.js +0 -87
  307. package/lib/__tests__/crap.test.js +0 -494
  308. package/lib/__tests__/debt-classify.test.js +0 -78
  309. package/lib/__tests__/delphi-channel-doctor.test.js +0 -116
  310. package/lib/__tests__/delphi-channel-uninstall.test.js +0 -128
  311. package/lib/__tests__/delphi-channel.test.js +0 -109
  312. package/lib/__tests__/delphi-setup.test.js +0 -203
  313. package/lib/__tests__/deploy-manifest-check-wired.test.js +0 -138
  314. package/lib/__tests__/deploy-manifest-completeness.test.js +0 -151
  315. package/lib/__tests__/deploy-manifest-consumers-adapter-uninstall.test.js +0 -40
  316. package/lib/__tests__/deploy-manifest-consumers-no-private-lists.test.js +0 -74
  317. package/lib/__tests__/deploy-manifest-projection.test.js +0 -66
  318. package/lib/__tests__/deploy-manifest-shell-parity.test.js +0 -108
  319. package/lib/__tests__/deploy-manifest.test.js +0 -97
  320. package/lib/__tests__/detect-deps-dsh-profile.test.js +0 -323
  321. package/lib/__tests__/detect-deps-gate-identity.test.js +0 -135
  322. package/lib/__tests__/detect-deps.test.js +0 -655
  323. package/lib/__tests__/doctor-469-hook-env.test.js +0 -211
  324. package/lib/__tests__/doctor-arch-tools.test.js +0 -169
  325. package/lib/__tests__/doctor-audit-ledger.test.js +0 -61
  326. package/lib/__tests__/doctor-brief.test.js +0 -59
  327. package/lib/__tests__/doctor-delphi.test.js +0 -628
  328. package/lib/__tests__/doctor-drift-direction.test.js +0 -104
  329. package/lib/__tests__/doctor-drift-round2.test.js +0 -215
  330. package/lib/__tests__/doctor-exec-retry.test.js +0 -162
  331. package/lib/__tests__/doctor-executed-surface.test.js +0 -230
  332. package/lib/__tests__/doctor-helpers.test.js +0 -139
  333. package/lib/__tests__/doctor-hook-drift.test.js +0 -329
  334. package/lib/__tests__/doctor-hook-signatures.test.js +0 -65
  335. package/lib/__tests__/doctor-machine-mutation.test.js +0 -116
  336. package/lib/__tests__/doctor-module-drift.test.js +0 -212
  337. package/lib/__tests__/doctor-module-resolution-parity.test.js +0 -463
  338. package/lib/__tests__/doctor-path-equivalence.test.js +0 -70
  339. package/lib/__tests__/doctor-repair-boundary.test.js +0 -52
  340. package/lib/__tests__/doctor-signature-stability.test.js +0 -55
  341. package/lib/__tests__/doctor-spawn-capability.test.js +0 -116
  342. package/lib/__tests__/doctor-timeout-partial.test.js +0 -79
  343. package/lib/__tests__/doctor-tui-skill-freshness.test.js +0 -385
  344. package/lib/__tests__/doctor.test.js +0 -1320
  345. package/lib/__tests__/find-bash-wsl.test.js +0 -121
  346. package/lib/__tests__/flaky.test.js +0 -128
  347. package/lib/__tests__/foreign-hooks-global.test.js +0 -125
  348. package/lib/__tests__/gate-audit-skip.test.ts +0 -81
  349. package/lib/__tests__/gate-audit.test.ts +0 -440
  350. package/lib/__tests__/gate-coverage-hook-floor.test.js +0 -94
  351. package/lib/__tests__/gate-coverage.test.js +0 -204
  352. package/lib/__tests__/gate-entry-provenance.test.js +0 -71
  353. package/lib/__tests__/gate-numbering.test.js +0 -79
  354. package/lib/__tests__/gate-rules.test.js +0 -58
  355. package/lib/__tests__/gate-runner-tsx-invocation.test.js +0 -149
  356. package/lib/__tests__/gate-runner-verdict.test.js +0 -105
  357. package/lib/__tests__/gate-runner.test.js +0 -371
  358. package/lib/__tests__/gate2-verdict.test.js +0 -183
  359. package/lib/__tests__/helpers/lib-sandbox.cjs +0 -55
  360. package/lib/__tests__/hook-health-path.test.js +0 -109
  361. package/lib/__tests__/hook-health.test.js +0 -85
  362. package/lib/__tests__/init-gitignore.test.js +0 -204
  363. package/lib/__tests__/init-gitleaks-notice.test.js +0 -57
  364. package/lib/__tests__/init.test.js +0 -530
  365. package/lib/__tests__/install-cmd.test.js +0 -6
  366. package/lib/__tests__/install-sh-deploy-manifest.test.js +0 -80
  367. package/lib/__tests__/install-skill-full-dir.test.js +0 -194
  368. package/lib/__tests__/install-skill.test.js +0 -416
  369. package/lib/__tests__/issue-519-phase-transition-guard.test.js +0 -233
  370. package/lib/__tests__/issue-566-sync-hooks-backup.test.js +0 -228
  371. package/lib/__tests__/issue-583-hook-deploy-log.test.js +0 -121
  372. package/lib/__tests__/issue-586-principles-cmdline.test.js +0 -218
  373. package/lib/__tests__/issue-589-check-all-gate3.test.js +0 -190
  374. package/lib/__tests__/issue-590-archlint-vacuous-pass.test.js +0 -138
  375. package/lib/__tests__/issue-618-gate-not-run.test.js +0 -100
  376. package/lib/__tests__/jscpd-entry-resolution.test.js +0 -143
  377. package/lib/__tests__/language-capability.test.js +0 -291
  378. package/lib/__tests__/language-tools-build-file-install.test.js +0 -82
  379. package/lib/__tests__/language-tools-detect.test.js +0 -301
  380. package/lib/__tests__/migrate.test.js +0 -232
  381. package/lib/__tests__/mirror-manifest.test.js +0 -64
  382. package/lib/__tests__/mirror-sync.test.js +0 -803
  383. package/lib/__tests__/next-sprint.test.js +0 -231
  384. package/lib/__tests__/npm-package.test.js +0 -140
  385. package/lib/__tests__/phase-transition.test.js +0 -1136
  386. package/lib/__tests__/principles-csharp-coverage.test.js +0 -227
  387. package/lib/__tests__/principles-directory.test.js +0 -87
  388. package/lib/__tests__/qoder-delphi-agents.test.js +0 -316
  389. package/lib/__tests__/retro-gate-m.test.js +0 -144
  390. package/lib/__tests__/retro.test.js +0 -131
  391. package/lib/__tests__/rework.test.js +0 -127
  392. package/lib/__tests__/rollback.test.js +0 -183
  393. package/lib/__tests__/runtime-journal.test.js +0 -164
  394. package/lib/__tests__/sastd-client.test.js +0 -514
  395. package/lib/__tests__/shared-paths-lazy-home.test.js +0 -67
  396. package/lib/__tests__/shared-paths.test.js +0 -130
  397. package/lib/__tests__/shared-utils-copyHooks-manifest.test.js +0 -69
  398. package/lib/__tests__/shared-utils.test.js +0 -180
  399. package/lib/__tests__/skill-flags.test.js +0 -48
  400. package/lib/__tests__/slo.test.js +0 -89
  401. package/lib/__tests__/sprint-audit.test.js +0 -207
  402. package/lib/__tests__/sprint-discovery.test.ts +0 -366
  403. package/lib/__tests__/sprint-state-manager.test.js +0 -310
  404. package/lib/__tests__/sprint-status-rework-704.test.js +0 -149
  405. package/lib/__tests__/sprint-status-rework.test.js +0 -329
  406. package/lib/__tests__/sprint-status.test.js +0 -193
  407. package/lib/__tests__/sprint-status.test.ts +0 -213
  408. package/lib/__tests__/test-alignment-java-702.test.ts +0 -177
  409. package/lib/__tests__/test-alignment-range-guard.test.ts +0 -82
  410. package/lib/__tests__/test-alignment.test.ts +0 -853
  411. package/lib/__tests__/tsconfig.json +0 -8
  412. package/lib/__tests__/tsx-resolution.test.js +0 -89
  413. package/lib/__tests__/ui-detector.test.ts +0 -459
  414. package/lib/__tests__/ui-review.test.ts +0 -132
  415. package/lib/__tests__/uninstall-global-residue.test.js +0 -545
  416. package/lib/__tests__/uninstall-skill.test.js +0 -189
  417. package/lib/__tests__/uninstall.test.js +0 -717
  418. package/lib/__tests__/update-hooks.test.js +0 -737
  419. package/lib/__tests__/update-skill-flags.test.js +0 -78
  420. package/lib/__tests__/update-skill.test.js +0 -644
  421. package/lib/__tests__/upgrade-exec.test.js +0 -273
  422. package/lib/__tests__/upgrade-skill-sync.test.js +0 -65
  423. package/lib/__tests__/upgrade.test.js +0 -78
  424. package/lib/__tests__/windows-bash-probe.test.js +0 -123
  425. package/lib/check-alignment-runner.cjs +0 -97
  426. package/lib/coverage-total.sh +0 -92
  427. package/lib/layer-baseline.cjs +0 -94
  428. package/lib/mattpocock-license-verdict.json +0 -7
@@ -51,6 +51,23 @@ _shell_changed_files() {
51
51
  # Gate body. `return` is used instead of `exit` so the driver decides to
52
52
  # stop: see scripts/wrap-gate-entries.cjs for why the two are equivalent
53
53
  # here, and why sub-shell exits are deliberately left as `exit`.
54
+ # Shared verdict rules: a gate that walks several languages carries the
55
+ # STRONGEST verdict any of them produced, never the last one written.
56
+ # Measured 2026-11-24: gate-1 recorded 0 PASS and 19 WARN, every warning being
57
+ # "PSSA module not installed" -- so an eslint pass could never be the verdict.
58
+ # Same relative-path trap as gate-3.sh: from inside githooks/, `dirname ./x-entry.sh` is
59
+ # `.` and `/../lib` climbs to `/lib`. Try the sibling layout first, then githooks/lib.
60
+ _GATE_STATUS_DIR="$(dirname "${BASH_SOURCE[0]}")"
61
+ _GATE_STATUS_LIB="$(cd "$_GATE_STATUS_DIR/../lib" 2>/dev/null && pwd)/gate-status.sh"
62
+ if [ ! -r "$_GATE_STATUS_LIB" ]; then
63
+ _GATE_STATUS_LIB="$(cd "$_GATE_STATUS_DIR" 2>/dev/null && pwd)/lib/gate-status.sh"
64
+ fi
65
+ if [ -r "$_GATE_STATUS_LIB" ]; then
66
+ # shellcheck source=/dev/null
67
+ . "$_GATE_STATUS_LIB"
68
+ fi
69
+ unset _GATE_STATUS_LIB
70
+
54
71
  gate_1_run() {
55
72
  2>&1 echo ""
56
73
  2>&1 echo "→ Gate 1: Code Quality (static analysis + linting)..."
@@ -299,7 +316,7 @@ else
299
316
  # `── Checking python ──`, while the run reported success. Record the
300
317
  # skip and let the loop continue.
301
318
  GATE_1_STATUS="SKIP"
302
- GATE_1_DETAIL="typescript: biome not installed"
319
+ xp_gate_detail_append GATE_1_DETAIL "typescript: biome not installed"
303
320
  continue
304
321
  fi
305
322
  if [ "$BIOME_STATUS" -ne 0 ]; then
@@ -392,7 +409,7 @@ else
392
409
  # journal recorded "passed" for a check that never ran. The Java branch ten
393
410
  # lines away sets WARN for the same situation; this is the same decision.
394
411
  GATE_1_STATUS="SKIP"
395
- GATE_1_DETAIL="python: ruff not installed"
412
+ xp_gate_detail_append GATE_1_DETAIL "python: ruff not installed"
396
413
  else
397
414
  # Run Ruff (includes syntax check, linting)
398
415
  echo "Running Ruff linting (syntax + lint)..."
@@ -567,7 +584,7 @@ else
567
584
  # driving gate_1_run with golangci-lint absent: the skip printed and
568
585
  # GATE_1_STATUS stayed "PASS" with an empty DETAIL.
569
586
  GATE_1_STATUS="SKIP"
570
- GATE_1_DETAIL="go: golangci-lint not installed"
587
+ xp_gate_detail_append GATE_1_DETAIL "go: golangci-lint not installed"
571
588
  else
572
589
  # #534: run golangci-lint over ONLY the staged .go files (incremental),
573
590
  # not the whole repo. `golangci-lint run` with no args scans every package
@@ -702,8 +719,8 @@ else
702
719
  ADAPTER_FILE=$(resolve_adapter_path "$CURRENT_LANG")
703
720
  if [ -z "$ADAPTER_FILE" ] || ! source "$ADAPTER_FILE" 2>/dev/null; then
704
721
  echo "⚠️ WARN - Java adapter not found (code quality NOT verified)"
705
- GATE_1_STATUS="WARN"
706
- GATE_1_DETAIL="java: adapter missing"
722
+ xp_gate_status_escalate GATE_1_STATUS "WARN"
723
+ xp_gate_detail_append GATE_1_DETAIL "java: adapter missing"
707
724
  else
708
725
  JAVA_G1_EXIT=0
709
726
  # `|| JAVA_G1_EXIT=$?` (not a bare assignment): under a set -e consumer a
@@ -736,13 +753,13 @@ else
736
753
  ;;
737
754
  3)
738
755
  echo "⚠️ WARN - Java code quality NOT verified (engine unavailable or downgraded)"
739
- GATE_1_STATUS="WARN"
740
- GATE_1_DETAIL="java: ${JAVA_G1_REASON:-unavailable (warn)}"
756
+ xp_gate_status_escalate GATE_1_STATUS "WARN"
757
+ xp_gate_detail_append GATE_1_DETAIL "java: ${JAVA_G1_REASON:-unavailable (warn)}"
741
758
  ;;
742
759
  *)
743
760
  echo "⚠️ WARN - Java code quality NOT verified (unexpected verdict $JAVA_G1_EXIT)"
744
- GATE_1_STATUS="WARN"
745
- GATE_1_DETAIL="java: unexpected verdict $JAVA_G1_EXIT"
761
+ xp_gate_status_escalate GATE_1_STATUS "WARN"
762
+ xp_gate_detail_append GATE_1_DETAIL "java: unexpected verdict $JAVA_G1_EXIT"
746
763
  ;;
747
764
  esac
748
765
  fi
@@ -758,8 +775,8 @@ else
758
775
  POWERSHELL_ADAPTER=$(resolve_adapter_path "powershell")
759
776
  if [ -z "$POWERSHELL_ADAPTER" ]; then
760
777
  echo "⚠️ WARN - PowerShell adapter not found (code quality NOT verified)"
761
- GATE_1_STATUS="WARN"
762
- GATE_1_DETAIL="powershell: adapter missing"
778
+ xp_gate_status_escalate GATE_1_STATUS "WARN"
779
+ xp_gate_detail_append GATE_1_DETAIL "powershell: adapter missing"
763
780
  else
764
781
  PS_G1_EXIT=0
765
782
  # Subshell: reasons cross as `XP_G1_REASON: ...` stdout lines, exactly
@@ -789,24 +806,24 @@ else
789
806
  echo " Rules: $PS_RULES"
790
807
  fi
791
808
  GATE_1_STATUS="BLOCK"
792
- GATE_1_DETAIL="powershell: PSScriptAnalyzer findings${PS_RULES:+ ($PS_RULES)}"
809
+ xp_gate_detail_append GATE_1_DETAIL "powershell: PSScriptAnalyzer findings${PS_RULES:+ ($PS_RULES)}"
793
810
  return 1
794
811
  ;;
795
812
  2)
796
813
  echo "❌ BLOCKED - PowerShell static analysis unusable (fail-closed): ${PS_G1_REASON:-unknown}"
797
814
  GATE_1_STATUS="BLOCK"
798
- GATE_1_DETAIL="powershell: ${PS_G1_REASON:-unusable}"
815
+ xp_gate_detail_append GATE_1_DETAIL "powershell: ${PS_G1_REASON:-unusable}"
799
816
  return 1
800
817
  ;;
801
818
  3)
802
819
  echo "⚠️ WARN - PowerShell code quality NOT verified: ${PS_G1_REASON:-engine unavailable}"
803
- GATE_1_STATUS="WARN"
804
- GATE_1_DETAIL="powershell: ${PS_G1_REASON:-engine unavailable}"
820
+ xp_gate_status_escalate GATE_1_STATUS "WARN"
821
+ xp_gate_detail_append GATE_1_DETAIL "powershell: ${PS_G1_REASON:-engine unavailable}"
805
822
  ;;
806
823
  *)
807
824
  echo "⚠️ WARN - PowerShell code quality NOT verified (unexpected verdict $PS_G1_EXIT)"
808
- GATE_1_STATUS="WARN"
809
- GATE_1_DETAIL="powershell: unexpected verdict $PS_G1_EXIT"
825
+ xp_gate_status_escalate GATE_1_STATUS "WARN"
826
+ xp_gate_detail_append GATE_1_DETAIL "powershell: unexpected verdict $PS_G1_EXIT"
810
827
  ;;
811
828
  esac
812
829
  fi
@@ -934,7 +951,7 @@ else
934
951
  1)
935
952
  echo "❌ BLOCKED - ${CURRENT_LANG} code quality violations (fix or add suppressions)"
936
953
  GATE_1_STATUS="BLOCK"
937
- GATE_1_DETAIL="${CURRENT_LANG}: analyzer findings"
954
+ xp_gate_detail_append GATE_1_DETAIL "${CURRENT_LANG}: analyzer findings"
938
955
  return 1
939
956
  ;;
940
957
  2)
@@ -947,18 +964,18 @@ else
947
964
  echo " A tool that could not run is not a clean tree. Install the toolchain,"
948
965
  echo " or set the adapter's documented escape valve if you accept the risk."
949
966
  GATE_1_STATUS="BLOCK"
950
- GATE_1_DETAIL="${CURRENT_LANG}: ${G1A_REASON:-unusable}"
967
+ xp_gate_detail_append GATE_1_DETAIL "${CURRENT_LANG}: ${G1A_REASON:-unusable}"
951
968
  return 1
952
969
  ;;
953
970
  3)
954
971
  echo "⚠️ WARN - ${CURRENT_LANG} code quality NOT verified: ${G1A_REASON:-adapter reported a non-blocking skip}"
955
- GATE_1_STATUS="WARN"
956
- GATE_1_DETAIL="${CURRENT_LANG}: ${G1A_REASON:-unavailable (warn)}"
972
+ xp_gate_status_escalate GATE_1_STATUS "WARN"
973
+ xp_gate_detail_append GATE_1_DETAIL "${CURRENT_LANG}: ${G1A_REASON:-unavailable (warn)}"
957
974
  ;;
958
975
  *)
959
976
  echo "⚠️ WARN - ${CURRENT_LANG} code quality NOT verified (unexpected verdict $G1_VERDICT)"
960
- GATE_1_STATUS="WARN"
961
- GATE_1_DETAIL="${CURRENT_LANG}: unexpected verdict $G1_VERDICT"
977
+ xp_gate_status_escalate GATE_1_STATUS "WARN"
978
+ xp_gate_detail_append GATE_1_DETAIL "${CURRENT_LANG}: unexpected verdict $G1_VERDICT"
962
979
  ;;
963
980
  esac
964
981
  else
@@ -969,7 +986,7 @@ else
969
986
  # journal. This is the arm that covers every language xp-gate has no
970
987
  # adapter for, so it was the single widest inherited-PASS hole in Gate 1.
971
988
  GATE_1_STATUS="SKIP"
972
- GATE_1_DETAIL="${CURRENT_LANG}: no adapter"
989
+ xp_gate_detail_append GATE_1_DETAIL "${CURRENT_LANG}: no adapter"
973
990
  fi
974
991
  ;;
975
992
  esac
@@ -977,6 +994,9 @@ else
977
994
  fi
978
995
  fi # End: if ! any_changed_files_match (Issue #312 skip)
979
996
  GATE_1_STATUS="${GATE_1_STATUS:-SKIP}"
997
+ # Consumed by gate-13-entry.sh ("tool" in the verdict JSON), which is a different file,
998
+ # so shellcheck cannot see the read and reports SC2034 on the write.
999
+ # shellcheck disable=SC2034
980
1000
  GATE_1_TOOL="${PROJECT_LANGS}"
981
1001
  # The java branch may set GATE_1_STATUS=WARN + a GATE_1_DETAIL warn reason
982
1002
  # (engine unavailable / soft or report downgrade); route it into the audit
@@ -165,6 +165,16 @@ _gate5_coverage_usable() {
165
165
  # stop: see scripts/wrap-gate-entries.cjs for why the two are equivalent
166
166
  # here, and why sub-shell exits are deliberately left as `exit`.
167
167
  gate_5_run() {
168
+ # Shared verdict rules: strongest verdict wins, details append.
169
+ # Loaded here because gate-5 walks PROJECT_LANGS and used to let the last
170
+ # language replace the reason of an earlier one (see githooks/lib/gate-status.sh).
171
+ _GATE_STATUS_LIB="$(cd "$(dirname "${BASH_SOURCE[0]}")/../lib" && pwd)/gate-status.sh"
172
+ if [ -r "$_GATE_STATUS_LIB" ]; then
173
+ # shellcheck source=/dev/null
174
+ . "$_GATE_STATUS_LIB"
175
+ fi
176
+ unset _GATE_STATUS_LIB
177
+
168
178
  # GATE 5: Tests & Coverage Combined (Combines Old Gates 3 - Tests and 4 - Coverage)
169
179
  # Uses adapter system to run tests + coverage for language
170
180
  #
@@ -189,12 +199,12 @@ GATE_5_STATUS=""
189
199
  if ! gate_enabled 5; then
190
200
  echo "⏭️ SKIPPED - Gate 5: Tests & coverage (not selected by XP_GATE_ONLY_GATE)"
191
201
  GATE_5_STATUS="SKIP"
192
- GATE_5_DETAIL="not_selected"
202
+ xp_gate_detail_append GATE_5_DETAIL "not_selected"
193
203
 
194
204
  elif [ "$PROJECT_LANG" = "documentation-only" ] || [ "$DOCS_ONLY_COMMIT" = true ]; then
195
205
  echo "⏭️ SKIPPED - Tests & coverage (documentation-only commit — no code changed to test)."
196
206
  GATE_5_STATUS="SKIP"
197
- GATE_5_DETAIL="docs_only_change"
207
+ xp_gate_detail_append GATE_5_DETAIL "docs_only_change"
198
208
 
199
209
  else
200
210
  # ========================================================================
@@ -817,7 +827,7 @@ else
817
827
  TESTS_EXIT_CODE=0
818
828
  TESTS_SKIPPED=true
819
829
  GATE_5_STATUS="SKIP"
820
- GATE_5_DETAIL="no_code_files_changed"
830
+ xp_gate_detail_append GATE_5_DETAIL "no_code_files_changed"
821
831
  GATE_5_END=$(gate_start_ms)
822
832
  GATE_5_ELAPSED=$((GATE_5_END - GATE_5_START))
823
833
  echo " ⏱️ Gate 5: ${GATE_5_ELAPSED}ms (skipped — no code changes)"
@@ -973,7 +983,11 @@ else
973
983
  echo " No related test files found, running full test suite..."
974
984
  TESTS_OUTPUT=$(run_without_git_context run_node_bin vitest vitest/vitest.mjs run --coverage 2>&1)
975
985
  TESTS_EXIT_CODE=$?
976
- echo "$TESTS_OUTPUT" | head -60
986
+ # `head` closes the pipe and the WRITER takes SIGPIPE, which is why the
987
+ # pipeline can print "write error: Broken pipe" -- harmless in itself, but it
988
+ # made a passing suite look like a failure in the log. Printed with printf and
989
+ # a bounded slice instead, so nothing downstream can break the writer.
990
+ printf '%s\n' "$(printf '%s\n' "$TESTS_OUTPUT" | sed -n '1,60p')"
977
991
  if [ "$TESTS_EXIT_CODE" -ne 0 ]; then
978
992
  handle_test_failure "$TESTS_OUTPUT" "full test suite" || return 1
979
993
  else
@@ -1055,7 +1069,7 @@ else
1055
1069
  _delegated_to="$(adapter_test_delegation_target)"
1056
1070
  echo "ℹ️ ${CURRENT_LANG}: tests run in ${_delegated_to}, not at commit time."
1057
1071
  echo " Not checked by this gate -- verified on push/PR instead."
1058
- GATE_5_DETAIL="${GATE_5_DETAIL:+${GATE_5_DETAIL}; }${CURRENT_LANG}: tests delegated to ${_delegated_to}"
1072
+ xp_gate_detail_append GATE_5_DETAIL "${CURRENT_LANG}: tests delegated to ${_delegated_to}"
1059
1073
  DELEGATED_LANGS="${DELEGATED_LANGS:+${DELEGATED_LANGS} }${CURRENT_LANG}"
1060
1074
  elif adapter_declares_coverage_runs_tests; then
1061
1075
  echo "ℹ️ ${CURRENT_LANG}: coverage run includes the tests — deferring test execution to a single pass."
@@ -1075,7 +1089,7 @@ else
1075
1089
  # Deliberately NOT appended to DELEGATED_LANGS: that variable is reported
1076
1090
  # further down as "tests delegated to CI", and a coverage-run deferral is
1077
1091
  # not a CI delegation. Reusing it would relabel this case as the other.
1078
- GATE_5_DETAIL="${GATE_5_DETAIL:+${GATE_5_DETAIL}; }${CURRENT_LANG}: tests deferred to the coverage run"
1092
+ xp_gate_detail_append GATE_5_DETAIL "${CURRENT_LANG}: tests deferred to the coverage run"
1079
1093
  else
1080
1094
  TESTS_OUTPUT=$(run_without_git_context run_tests 2>&1)
1081
1095
  TESTS_EXIT_CODE=$?
@@ -1475,7 +1489,7 @@ else
1475
1489
  # empty -- and an empty status renders as SKIP, so the summary line
1476
1490
  # one inch below reported a skip for a commit that was blocked.
1477
1491
  GATE_5_STATUS="BLOCK"
1478
- GATE_5_DETAIL="coverage_below_floor: typescript coverage under the 80% floor"
1492
+ xp_gate_detail_append GATE_5_DETAIL "coverage_below_floor: typescript coverage under the 80% floor"
1479
1493
  echo "❌ BLOCKED - TypeScript coverage ${COVERAGE_PERCENT}% below ${COVERAGE_THRESHOLD:-80}% threshold"
1480
1494
  return 1
1481
1495
  fi
@@ -1620,7 +1634,7 @@ else
1620
1634
  # gate's status variable, so the assignment belongs here, at the call site.
1621
1635
  if ! enforce_python_coverage; then
1622
1636
  GATE_5_STATUS="BLOCK"
1623
- GATE_5_DETAIL="coverage_below_floor: python coverage under the 80% floor"
1637
+ xp_gate_detail_append GATE_5_DETAIL "coverage_below_floor: python coverage under the 80% floor"
1624
1638
  return 1
1625
1639
  fi
1626
1640
  ;;
@@ -1707,7 +1721,7 @@ else
1707
1721
  # empty -- and an empty status renders as SKIP, so the summary line
1708
1722
  # one inch below reported a skip for a commit that was blocked.
1709
1723
  GATE_5_STATUS="BLOCK"
1710
- GATE_5_DETAIL="coverage_below_floor: java coverage under the 80% floor"
1724
+ xp_gate_detail_append GATE_5_DETAIL "coverage_below_floor: java coverage under the 80% floor"
1711
1725
  echo "❌ BLOCKED - Java coverage ${COVERAGE_ROUNDED}% below ${COVERAGE_THRESHOLD:-80}% threshold"
1712
1726
  return 1
1713
1727
  fi
@@ -1792,7 +1806,7 @@ else
1792
1806
  # Record the verdict as well as printing it -- see the typescript branch
1793
1807
  # above for the measurement. An unassigned status renders as SKIP.
1794
1808
  GATE_5_STATUS="BLOCK"
1795
- GATE_5_DETAIL="coverage_below_floor: flutter/dart coverage under the 80% floor"
1809
+ xp_gate_detail_append GATE_5_DETAIL "coverage_below_floor: flutter/dart coverage under the 80% floor"
1796
1810
  echo "❌ BLOCKED - Flutter/Dart coverage ${COVERAGE_PERCENT}% below ${COVERAGE_THRESHOLD:-80}% threshold"
1797
1811
  return 1
1798
1812
  fi
@@ -1841,10 +1855,27 @@ else
1841
1855
  echo "⏭️ SKIPPED - PowerShell coverage: no Pester tests in this project (*.Tests.ps1)"
1842
1856
  echo " Nothing can produce coverage.xml here, so the floor is not applicable."
1843
1857
  echo " This is NOT a pass: add Pester tests and coverage is enforced again."
1844
- if [ -n "$(printf '%s' "${GATE_5_STATUS:-}")" ] && [ "$GATE_5_STATUS" = "PASS" ]; then
1858
+ # A language with nothing to measure must not speak for the ones that
1859
+ # DID measure something. Gate 5 walks PROJECT_LANGS in config order
1860
+ # (typescript, shell, powershell, iac), and this branch used to demote a
1861
+ # PASS that a previous language had genuinely produced:
1862
+ #
1863
+ # if [ "$GATE_5_STATUS" = "PASS" ]; then GATE_5_STATUS="SKIP"; fi
1864
+ #
1865
+ # Measured 2026-11-24 across 343 audit records: gate-5 has 0 PASS and 21
1866
+ # SKIP, all 13 explained skips reading "powershell: no Pester tests", in
1867
+ # a repo carrying thousands of TypeScript tests. The gate never enforced
1868
+ # anything -- because the last language to have nothing to do overwrote
1869
+ # the verdict of the one that did.
1870
+ #
1871
+ # The downgrade is therefore removed. When powershell is the ONLY
1872
+ # language that reported (nothing ran before it), the status is still
1873
+ # set below, so the "nothing to measure" state keeps its own verdict and
1874
+ # its own reason -- it simply may no longer erase someone else's.
1875
+ if [ -z "${GATE_5_STATUS:-}" ]; then
1845
1876
  GATE_5_STATUS="SKIP"
1846
1877
  fi
1847
- GATE_5_DETAIL="powershell: no Pester tests (coverage not applicable)"
1878
+ xp_gate_detail_append GATE_5_DETAIL "powershell: no Pester tests (coverage not applicable)"
1848
1879
  COVERAGE_ENFORCED=false
1849
1880
  elif [ -f "coverage.xml" ]; then
1850
1881
  # The threshold is passed INTO node: the verdict used to be computed
@@ -1888,7 +1919,7 @@ else
1888
1919
  # Record the verdict as well as printing it -- see the typescript branch
1889
1920
  # above for the measurement. An unassigned status renders as SKIP.
1890
1921
  GATE_5_STATUS="BLOCK"
1891
- GATE_5_DETAIL="coverage_below_floor: powershell coverage under the 80% floor"
1922
+ xp_gate_detail_append GATE_5_DETAIL "coverage_below_floor: powershell coverage under the 80% floor"
1892
1923
  echo "❌ BLOCKED - PowerShell coverage ${COVERAGE_PERCENT}% below ${COVERAGE_THRESHOLD:-80}% threshold"
1893
1924
  return 1
1894
1925
  fi
@@ -1942,7 +1973,7 @@ else
1942
1973
  echo " Nothing can produce a coverage report here, so the floor is not applicable."
1943
1974
  echo " This is NOT a pass: add tests and coverage is enforced again."
1944
1975
  GATE_5_STATUS="SKIP"
1945
- GATE_5_DETAIL="${CURRENT_LANG}: no test sources (coverage not applicable)"
1976
+ xp_gate_detail_append GATE_5_DETAIL "${CURRENT_LANG}: no test sources (coverage not applicable)"
1946
1977
  COVERAGE_ENFORCED=false
1947
1978
  else
1948
1979
  COVERAGE_ENFORCED=true
@@ -2048,7 +2079,7 @@ else
2048
2079
  # verdict that only reaches the console is a verdict the journal
2049
2080
  # contradicts.
2050
2081
  GATE_5_STATUS="BLOCK"
2051
- GATE_5_DETAIL="coverage_below_floor: ${CURRENT_LANG} ${COVERAGE_PERCENT}% < ${COVERAGE_THRESHOLD:-80}%"
2082
+ xp_gate_detail_append GATE_5_DETAIL "coverage_below_floor: ${CURRENT_LANG} ${COVERAGE_PERCENT}% < ${COVERAGE_THRESHOLD:-80}%"
2052
2083
  echo "❌ BLOCKED - ${CURRENT_LANG} coverage ${COVERAGE_PERCENT}% below ${COVERAGE_THRESHOLD:-80}% threshold"
2053
2084
  return 1
2054
2085
  fi
@@ -2077,7 +2108,7 @@ else
2077
2108
  # return. A verdict that only reaches the console is a verdict the journal
2078
2109
  # contradicts.
2079
2110
  GATE_5_STATUS="BLOCK"
2080
- GATE_5_DETAIL="coverage_not_determined: no standard report file for ${CURRENT_LANG}"
2111
+ xp_gate_detail_append GATE_5_DETAIL "coverage_not_determined: no standard report file for ${CURRENT_LANG}"
2081
2112
  return 1
2082
2113
  fi
2083
2114
  fi
@@ -2193,7 +2224,16 @@ else
2193
2224
  # summary is what a reader keeps and what the journal records.
2194
2225
  if [ -n "${DELEGATED_LANGS:-}" ]; then
2195
2226
  GATE_5_STATUS="SKIP"
2196
- GATE_5_DETAIL="${GATE_5_DETAIL:+${GATE_5_DETAIL}; }tests delegated to CI for: ${DELEGATED_LANGS}"
2227
+ # Pass ONLY the new fragment. This used to re-prepend the existing detail
2228
+ # (`${GATE_5_DETAIL:+${GATE_5_DETAIL}; }...`), so every earlier segment was
2229
+ # duplicated inside the fragment itself -- and since the append de-duplicates
2230
+ # whole segments, a fragment that ALREADY CONTAINS them is never equal to any
2231
+ # one of them and slips through. Measured: the persisted reason read
2232
+ #
2233
+ # shell: tests delegated ...; shell: tests delegated ...; powershell: ...
2234
+ #
2235
+ # -- the same sentence four times, unreadable.
2236
+ xp_gate_detail_append GATE_5_DETAIL "tests delegated to CI for: ${DELEGATED_LANGS}"
2197
2237
  elif [ -z "$GATE_5_STATUS" ]; then
2198
2238
  GATE_5_STATUS="PASS"
2199
2239
  fi
@@ -2215,7 +2255,7 @@ if [ "${PARTIAL_TEST_RUN:-false}" = "true" ]; then
2215
2255
  # Never overwrite a reason the branch itself recorded (docs_only_change,
2216
2256
  # no_code_files_changed, ...) -- those explain a different verdict.
2217
2257
  if [ -z "${GATE_5_DETAIL:-}" ] && [ "$GATE_5_STATUS" = "PASS" ]; then
2218
- GATE_5_DETAIL="partial_test_run_coverage_not_applicable"
2258
+ xp_gate_detail_append GATE_5_DETAIL "partial_test_run_coverage_not_applicable"
2219
2259
  fi
2220
2260
  else
2221
2261
  GATE_5_COVERAGE_APPLIES_TO="project"
@@ -2249,7 +2289,7 @@ fi
2249
2289
  # dominated by process-startup noise and would just add bytes.
2250
2290
  _g5_elapsed=$(( $(gate_start_ms) - GATE_5_START ))
2251
2291
  if [ "${_g5t_a:-0}" != "0" ] && [ "$_g5_elapsed" -ge 3000 ]; then
2252
- GATE_5_DETAIL="${GATE_5_DETAIL:-} seg=pre:${_g5t_focus}ms,5a:${_g5t_a}ms,5b:${_g5t_b}ms,5c:${_g5t_c}ms,total:${_g5_elapsed}ms"
2292
+ xp_gate_detail_append GATE_5_DETAIL " seg=pre:${_g5t_focus}ms,5a:${_g5t_a}ms,5b:${_g5t_b}ms,5c:${_g5t_c}ms,total:${_g5_elapsed}ms"
2253
2293
  fi
2254
2294
 
2255
2295
  record_gate_audit "gate-5" "tests-coverage" "$GATE_5_STATUS" "0" "$GATE_5_START" "${GATE_5_DETAIL:-}"
@@ -2345,7 +2385,7 @@ _gate5_go_coverage_arm() {
2345
2385
  # Record the verdict as well as printing it -- see the typescript branch
2346
2386
  # above for the measurement. An unassigned status renders as SKIP.
2347
2387
  GATE_5_STATUS="BLOCK"
2348
- GATE_5_DETAIL="coverage_below_floor: go coverage under the 80% floor"
2388
+ xp_gate_detail_append GATE_5_DETAIL "coverage_below_floor: go coverage under the 80% floor"
2349
2389
  echo "❌ BLOCKED - Go coverage ${total}% below ${COVERAGE_THRESHOLD:-80}% threshold"
2350
2390
  COV_EXIT=$((COV_EXIT || 1))
2351
2391
  return 1
@@ -24,6 +24,14 @@
24
24
  # stop: see scripts/wrap-gate-entries.cjs for why the two are equivalent
25
25
  # here, and why sub-shell exits are deliberately left as `exit`.
26
26
  gate_6_run() {
27
+ # Shared verdict rules: strongest verdict wins, details append.
28
+ _GATE_STATUS_LIB="$(cd "$(dirname "${BASH_SOURCE[0]}")/../lib" && pwd)/gate-status.sh"
29
+ if [ -r "$_GATE_STATUS_LIB" ]; then
30
+ # shellcheck source=/dev/null
31
+ . "$_GATE_STATUS_LIB"
32
+ fi
33
+ unset _GATE_STATUS_LIB
34
+
27
35
  if ! gate_enabled 6; then
28
36
  # Recorded, not merely printed: this arm set the status and returned with no
29
37
  # journal line, so wherever XP_GATE_ONLY_GATE selects a subset, "deselected on
@@ -575,12 +583,13 @@ CSARCHPROJ
575
583
  ;;
576
584
  *)
577
585
  echo " ⏭️ SKIPPED - Architecture validation (not configured for $CURRENT_LANG)"
578
- GATE_6_DETAIL="architecture_skipped: not configured for ${CURRENT_LANG}"
579
- # #537: archlint ships no detector for this language. Say so in a way
580
- # the quality report can read, instead of leaving the dimension silent.
581
- if [ "${BASH_VERSINFO[0]:-0}" -ge 4 ]; then
582
- GATE_6_REASON_BY_LANG["$CURRENT_LANG"]="no_archlint_detector"
583
- fi
586
+ # Append rather than overwrite: languages are walked in config order, so
587
+ # the LAST language with no architecture detector used to replace the
588
+ # reason of a language that HAD one. Measured 2026-11-24: all 14 gate-6
589
+ # records in this repo said "not configured for iac", including runs where
590
+ # archlint genuinely executed for TypeScript -- the iac arm simply ran
591
+ # after it.
592
+ xp_gate_detail_append GATE_6_DETAIL "architecture_skipped: not configured for ${CURRENT_LANG}"
584
593
  ;;
585
594
  esac
586
595
  done # end for CURRENT_LANG (architecture)
@@ -54,7 +54,7 @@
54
54
  # already reads.
55
55
  #
56
56
  # Numbers are POSITIONAL LABELS, never identities, and nothing here orders them
57
- # numerically — pre-push numbers are strings (M, M2, ML, UI, MW, S). Do not add
57
+ # numerically — pre-push numbers are strings (M, ML, UI, MW, S). Do not add
58
58
  # `-gt`/`-lt`/`$((` logic against this field;
59
59
  # scripts/__tests__/gate-identity-cross-surface.test.cjs greps for it.
60
60
  #
@@ -94,6 +94,8 @@ GATE_REGISTRY_ROWS=(
94
94
  # deciding its own execution order and skip semantics. Before this the
95
95
  # registry knew nothing about half the gates this project runs (#769).
96
96
  "mutation|M|inline|YES|pre-push"
97
+ "mock-layering|ML|inline|YES|pre-push"
98
+ "ui-sprint|UI|inline|YES|pre-push"
97
99
  "code-walkthrough|MW|inline|YES|pre-push"
98
100
  "prepush-sprint|S|sprint-gate.sh|YES|pre-push"
99
101
  )
@@ -0,0 +1,164 @@
1
+ #!/bin/bash
2
+ # Gate status severity: one rule for every gate that walks several languages.
3
+ #
4
+ # WHY THIS FILE EXISTS
5
+ # --------------------
6
+ # A gate that iterates `PROJECT_LANGS` collects one verdict per language. Two
7
+ # defects followed from letting each iteration write the gate's status directly:
8
+ #
9
+ # 1. LAST WRITER WINS. Languages are walked in config order
10
+ # (typescript, shell, powershell, iac). A language that had nothing to
11
+ # measure ran AFTER one that did, and overwrote its verdict.
12
+ #
13
+ # Measured 2026-11-24 over 343 audit records:
14
+ # gate-5 0 PASS / 21 SKIP -- all skips "powershell: no Pester tests",
15
+ # in a repo carrying thousands of TypeScript tests.
16
+ # gate-6 0 PASS / 14 SKIP -- all "not configured for iac", including
17
+ # runs where archlint genuinely executed for TypeScript.
18
+ # gate-1 0 PASS / 19 WARN -- all "PSSA module not installed", so a real
19
+ # eslint pass could never be the gate's verdict.
20
+ #
21
+ # 2. DOWNGRADE. A branch could LOWER an existing verdict, turning "checked and
22
+ # clean" into "not checked". That is the fail-open direction: it makes the
23
+ # gate quieter without making it correct.
24
+ #
25
+ # THE RULE
26
+ # --------
27
+ # Carry the strongest verdict any language produced.
28
+ #
29
+ # BLOCK > WARN > SKIP > PASS
30
+ #
31
+ # A gate reports the worst thing that happened to it, never the last. `PASS` is
32
+ # "checked and clean", so ANY other state outranks it: an incomplete check must
33
+ # never be presented as a clean one.
34
+ #
35
+ # `SKIP` outranks `PASS` but is outranked by `WARN`, because:
36
+ # - SKIP says nothing was verified, and a neighbour that DID verify something
37
+ # successfully must not mask that with a PASS;
38
+ # - WARN says something was verified and came back imperfect, which is more
39
+ # informative than "nothing happened" and must not be buried by a later
40
+ # SKIP.
41
+ #
42
+ # CALL CONTRACT (round-3 review, expert B)
43
+ # ----------------------------------------
44
+ # Both helpers modify a variable in the CALLER'S shell through `printf -v`. A
45
+ # call made inside a pipeline (`... | while read x; do xp_gate_detail_append ...`)
46
+ # or a command substitution runs in a SUBSHELL and the update is silently
47
+ # discarded -- same shape as the defect this file exists to fix, and harder to
48
+ # see because the line still runs.
49
+ #
50
+ # # WRONG: the update is lost
51
+ # printf '%s\n' "$list" | while read -r _x; do xp_gate_detail_append D "$_x"; done
52
+ #
53
+ # # RIGHT: keep it in the current shell
54
+ # while read -r _x; do xp_gate_detail_append D "$_x"; done <<< "$list"
55
+ #
56
+ # Audited 2026-11-24: every call site in githooks/ is in the current shell, and
57
+ # `gate-status-call-site.test.bats` fails if a new one appears inside a pipeline.
58
+ # Sourced, not executed. Callers keep their own GATE_N_* variables; this file
59
+ # only provides the comparison so the rule lives in one place.
60
+ #
61
+ # ASCII only: this file is sourced by hooks that run under many locales.
62
+
63
+ # Numeric rank for a gate status. Unknown/empty ranks as the weakest value so a
64
+ # typo can never silently outrank a real verdict.
65
+ xp_gate_status_rank() {
66
+ case "${1:-}" in
67
+ BLOCK) printf '4' ;;
68
+ WARN) printf '3' ;;
69
+ SKIP) printf '2' ;;
70
+ PASS) printf '1' ;;
71
+ *) printf '0' ;;
72
+ esac
73
+ }
74
+
75
+ # Escalate a gate status variable to at least `candidate`.
76
+ #
77
+ # Usage:
78
+ # xp_gate_status_escalate GATE_5_STATUS "WARN"
79
+ #
80
+ # Sets the named variable through indirect assignment, so callers do not have to
81
+ # restructure their existing code. An empty current value is treated as unset.
82
+ xp_gate_status_escalate() {
83
+ local _var="${1:?variable name required}"
84
+ local _candidate="${2:?candidate status required}"
85
+ local _current="${!_var:-}"
86
+ local _cur_rank _new_rank
87
+ _cur_rank=$(xp_gate_status_rank "$_current")
88
+ _new_rank=$(xp_gate_status_rank "$_candidate")
89
+ # An unrecognised candidate would rank 0 and could never win; refuse it
90
+ # loudly rather than producing a gate whose status silently never moves.
91
+ if [ "$_new_rank" = "0" ]; then
92
+ printf 'xp_gate_status_escalate: unknown status %q (expected PASS|SKIP|WARN|BLOCK)\n' \
93
+ "$_candidate" >&2
94
+ return 2
95
+ fi
96
+ if [ "$_new_rank" -gt "$_cur_rank" ]; then
97
+ printf -v "$_var" '%s' "$_candidate"
98
+ fi
99
+ return 0
100
+ }
101
+
102
+ # Append a detail fragment without clobbering an earlier one.
103
+ #
104
+ # Detail is a DESCRIPTION, not a verdict: several languages may each have
105
+ # something to say, and replacing the earlier text is what made a skip reason
106
+ # unexplainable.
107
+ #
108
+ # SEPARATOR INJECTION (round-1 review, expert B): the first version joined with
109
+ # `; ` and de-duplicated by splitting on that same string. A fragment that
110
+ # CONTAINS `; ` was therefore split into pieces, never matched any single
111
+ # segment, and got appended every time -- and a later reader could not tell the
112
+ # pieces from separate reasons. Measured: appending "x; y" produced a value that
113
+ # re-appended itself as two segments.
114
+ #
115
+ # The fix is to keep the pieces unmistakable: a fragment's internal separators
116
+ # are neutralised on the way in, so the recorded text never contains the join
117
+ # separator. `; ` stays the human-readable join because every existing consumer
118
+ # parses the field that way.
119
+ #
120
+ # Usage:
121
+ # xp_gate_detail_append GATE_6_DETAIL "powershell: PSSA module not installed"
122
+ xp_gate_detail_append() {
123
+ local _var="${1:?variable name required}"
124
+ local _fragment="${2:-}"
125
+ # Whitespace-only is "no reason given", not a reason of spaces.
126
+ case "$_fragment" in
127
+ *[![:space:]]*) ;;
128
+ *) return 0 ;;
129
+ esac
130
+ # Flatten internal separators so one fragment is always one segment.
131
+ _fragment="${_fragment//; /, }"
132
+
133
+ local _current="${!_var:-}"
134
+ if [ -z "$_current" ]; then
135
+ printf -v "$_var" '%s' "$_fragment"
136
+ return 0
137
+ fi
138
+ # Compare whole segments. They cannot contain "; " after the flattening above,
139
+ # so the split is unambiguous.
140
+ local _segment _found=0
141
+ local _rest="$_current"
142
+ while [ -n "$_rest" ]; do
143
+ case "$_rest" in
144
+ *"; "*) _segment="${_rest%%; *}"; _rest="${_rest#*; }" ;;
145
+ *) _segment="$_rest"; _rest="" ;;
146
+ esac
147
+ if [ "$_segment" = "$_fragment" ]; then
148
+ _found=1
149
+ break
150
+ fi
151
+ done
152
+ if [ "$_found" -eq 1 ]; then
153
+ return 0
154
+ fi
155
+ printf -v "$_var" '%s; %s' "$_current" "$_fragment"
156
+ return 0
157
+ }
158
+
159
+ # A NOTE ON WHY THIS FILE EXISTS (kept with the code, not in a plan document)
160
+ # Three gates in this repo had never produced a PASS: gate-1, gate-5 and gate-6
161
+ # all reported the verdict of their LAST language instead of their strongest.
162
+ # Measured 2026-11-24 across 343 audit records. The rule is one line of policy
163
+ # (BLOCK > WARN > SKIP > PASS, with PASS never outranking anything) and it must
164
+ # not be re-derived per gate.
@@ -35,10 +35,18 @@
35
35
  # More findings about its own output than about the code it was asked to check,
36
36
  # in a report nobody can act on. Every other build-output directory was already
37
37
  # listed; the one this tool writes itself was the omission.
38
+ # `src/npm-package` joins for the same reason, and it was the largest remaining
39
+ # offender in that measurement (1923 files). It is a BYTE-IDENTICAL mirror of
40
+ # githooks/, plugins/ and skills/, regenerated at prepack -- two files that must
41
+ # be identical are not duplicated code, and a finding nobody can act on costs
42
+ # 28 s per run (measured 2026-11-24: `check 2` took 28.4 s and FAILED on exactly
43
+ # these pairs). Mirror drift is a real defect with its own gate (12b); Gate 2
44
+ # re-deriving it from line similarity is both wrong and slow.
45
+ #
38
46
  # *.md joins the set for the same reason *.yaml did: duplicate detection is
39
47
  # about CODE, and a prose document mirrored into several plugin directories is
40
48
  # duplicate by design. Measured before: 581 of 1410 findings were skill docs
41
- JSCPD_DEFAULT_IGNORE_PATTERNS='(^|/)(node_modules|dist|build|target|coverage|out|\.next|\.nuxt|vendor|\.xp-gate)/|\.log$|\.txt$|\.(ya?ml)$|golden|baseline\.json$|evidence|\.md$'
49
+ JSCPD_DEFAULT_IGNORE_PATTERNS='(^|/)(node_modules|dist|build|target|coverage|out|\.next|\.nuxt|vendor|\.xp-gate|src/npm-package)/|\.log$|\.txt$|\.(ya?ml)$|golden|baseline\.json$|evidence|\.md$'
42
50
 
43
51
  # The BUILD-OUTPUT half of the set above, alone (#649).
44
52
  #