@webpieces/ai-hook-rules 0.4.839 → 0.4.841

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 (390) hide show
  1. package/README.md +12 -140
  2. package/package.json +7 -15
  3. package/src/adapters/hook-app-fixtures.d.ts +1 -1
  4. package/src/adapters/hook-app-fixtures.js +0 -8
  5. package/src/adapters/hook-app-fixtures.js.map +1 -1
  6. package/src/adapters/hook-core.d.ts +1 -21
  7. package/src/adapters/hook-core.js +22 -341
  8. package/src/adapters/hook-core.js.map +1 -1
  9. package/src/core/load-rules.d.ts +4 -39
  10. package/src/core/load-rules.js +15 -127
  11. package/src/core/load-rules.js.map +1 -1
  12. package/src/core/rules/catch-error-pattern.d.ts +3 -3
  13. package/src/core/rules/catch-error-pattern.js +13 -13
  14. package/src/core/rules/catch-error-pattern.js.map +1 -1
  15. package/src/core/rules/index.d.ts +1 -14
  16. package/src/core/rules/index.js +1 -17
  17. package/src/core/rules/index.js.map +1 -1
  18. package/src/core/rules/match-rule.d.ts +3 -3
  19. package/src/core/rules/match-rule.js +6 -6
  20. package/src/core/rules/match-rule.js.map +1 -1
  21. package/src/core/rules/max-file-lines.d.ts +3 -3
  22. package/src/core/rules/max-file-lines.js +7 -7
  23. package/src/core/rules/max-file-lines.js.map +1 -1
  24. package/src/core/rules/no-any-unknown.d.ts +3 -3
  25. package/src/core/rules/no-any-unknown.js +6 -6
  26. package/src/core/rules/no-any-unknown.js.map +1 -1
  27. package/src/core/rules/no-custom-css.d.ts +3 -3
  28. package/src/core/rules/no-custom-css.js +7 -7
  29. package/src/core/rules/no-custom-css.js.map +1 -1
  30. package/src/core/rules/no-destructure.d.ts +3 -3
  31. package/src/core/rules/no-destructure.js +7 -7
  32. package/src/core/rules/no-destructure.js.map +1 -1
  33. package/src/core/rules/no-implicit-any.d.ts +3 -3
  34. package/src/core/rules/no-implicit-any.js +6 -6
  35. package/src/core/rules/no-implicit-any.js.map +1 -1
  36. package/src/core/rules/no-js-files.d.ts +3 -3
  37. package/src/core/rules/no-js-files.js +6 -6
  38. package/src/core/rules/no-js-files.js.map +1 -1
  39. package/src/core/rules/no-process-exit-outside-main.d.ts +3 -3
  40. package/src/core/rules/no-process-exit-outside-main.js +7 -7
  41. package/src/core/rules/no-process-exit-outside-main.js.map +1 -1
  42. package/src/core/rules/no-symbol-di-tokens.d.ts +3 -3
  43. package/src/core/rules/no-symbol-di-tokens.js +7 -7
  44. package/src/core/rules/no-symbol-di-tokens.js.map +1 -1
  45. package/src/core/rules/no-unmanaged-exceptions.d.ts +3 -3
  46. package/src/core/rules/no-unmanaged-exceptions.js +9 -9
  47. package/src/core/rules/no-unmanaged-exceptions.js.map +1 -1
  48. package/src/core/rules/require-return-type.d.ts +3 -3
  49. package/src/core/rules/require-return-type.js +6 -6
  50. package/src/core/rules/require-return-type.js.map +1 -1
  51. package/src/core/rules/throw-cause-required.d.ts +3 -3
  52. package/src/core/rules/throw-cause-required.js +9 -9
  53. package/src/core/rules/throw-cause-required.js.map +1 -1
  54. package/src/core/rules/validate-ts-in-src.d.ts +3 -3
  55. package/src/core/rules/validate-ts-in-src.js +7 -7
  56. package/src/core/rules/validate-ts-in-src.js.map +1 -1
  57. package/src/core/runner.d.ts +10 -19
  58. package/src/core/runner.js +24 -622
  59. package/src/core/runner.js.map +1 -1
  60. package/src/index.d.ts +2 -15
  61. package/src/index.js +4 -54
  62. package/src/index.js.map +1 -1
  63. package/openclaw.plugin.json +0 -15
  64. package/src/adapters/agent-adapters.d.ts +0 -13
  65. package/src/adapters/agent-adapters.js +0 -23
  66. package/src/adapters/agent-adapters.js.map +0 -1
  67. package/src/adapters/agent-payload.d.ts +0 -48
  68. package/src/adapters/agent-payload.js +0 -30
  69. package/src/adapters/agent-payload.js.map +0 -1
  70. package/src/adapters/agent-response.d.ts +0 -5
  71. package/src/adapters/agent-response.js +0 -86
  72. package/src/adapters/agent-response.js.map +0 -1
  73. package/src/adapters/claude-code-adapter.d.ts +0 -26
  74. package/src/adapters/claude-code-adapter.js +0 -69
  75. package/src/adapters/claude-code-adapter.js.map +0 -1
  76. package/src/adapters/codex-adapter.d.ts +0 -19
  77. package/src/adapters/codex-adapter.js +0 -48
  78. package/src/adapters/codex-adapter.js.map +0 -1
  79. package/src/adapters/codex-subagent-guard.d.ts +0 -45
  80. package/src/adapters/codex-subagent-guard.js +0 -88
  81. package/src/adapters/codex-subagent-guard.js.map +0 -1
  82. package/src/adapters/detect-ai.d.ts +0 -70
  83. package/src/adapters/detect-ai.js +0 -82
  84. package/src/adapters/detect-ai.js.map +0 -1
  85. package/src/adapters/guards-hook.d.ts +0 -3
  86. package/src/adapters/guards-hook.js +0 -30
  87. package/src/adapters/guards-hook.js.map +0 -1
  88. package/src/adapters/openclaw-plugin.d.ts +0 -14
  89. package/src/adapters/openclaw-plugin.js +0 -87
  90. package/src/adapters/openclaw-plugin.js.map +0 -1
  91. package/src/adapters/review-identity-stamper.d.ts +0 -20
  92. package/src/adapters/review-identity-stamper.js +0 -34
  93. package/src/adapters/review-identity-stamper.js.map +0 -1
  94. package/src/bin/codex-trust.d.ts +0 -105
  95. package/src/bin/codex-trust.js +0 -205
  96. package/src/bin/codex-trust.js.map +0 -1
  97. package/src/bin/dev-hook-install.d.ts +0 -1
  98. package/src/bin/dev-hook-install.js +0 -82
  99. package/src/bin/dev-hook-install.js.map +0 -1
  100. package/src/bin/dev-hook-uninstall.d.ts +0 -1
  101. package/src/bin/dev-hook-uninstall.js +0 -45
  102. package/src/bin/dev-hook-uninstall.js.map +0 -1
  103. package/src/bin/hook-registration.d.ts +0 -429
  104. package/src/bin/hook-registration.js +0 -661
  105. package/src/bin/hook-registration.js.map +0 -1
  106. package/src/bin/install-entry.d.ts +0 -19
  107. package/src/bin/install-entry.js +0 -128
  108. package/src/bin/install-entry.js.map +0 -1
  109. package/src/bin/l0-allowlist.d.ts +0 -49
  110. package/src/bin/l0-allowlist.js +0 -528
  111. package/src/bin/l0-allowlist.js.map +0 -1
  112. package/src/bin/l0-codex-read.d.ts +0 -21
  113. package/src/bin/l0-codex-read.js +0 -109
  114. package/src/bin/l0-codex-read.js.map +0 -1
  115. package/src/bin/l0-decide.d.ts +0 -50
  116. package/src/bin/l0-decide.js +0 -103
  117. package/src/bin/l0-decide.js.map +0 -1
  118. package/src/bin/l0-entry.d.ts +0 -103
  119. package/src/bin/l0-entry.js +0 -98
  120. package/src/bin/l0-entry.js.map +0 -1
  121. package/src/bin/l0-ignored-tools.d.ts +0 -38
  122. package/src/bin/l0-ignored-tools.js +0 -44
  123. package/src/bin/l0-ignored-tools.js.map +0 -1
  124. package/src/bin/managed-env.d.ts +0 -46
  125. package/src/bin/managed-env.js +0 -50
  126. package/src/bin/managed-env.js.map +0 -1
  127. package/src/bin/neighbour-hooks.d.ts +0 -42
  128. package/src/bin/neighbour-hooks.js +0 -177
  129. package/src/bin/neighbour-hooks.js.map +0 -1
  130. package/src/bin/reviewer-agent.d.ts +0 -19
  131. package/src/bin/reviewer-agent.js +0 -135
  132. package/src/bin/reviewer-agent.js.map +0 -1
  133. package/src/bin/settings-shape.d.ts +0 -37
  134. package/src/bin/settings-shape.js +0 -17
  135. package/src/bin/settings-shape.js.map +0 -1
  136. package/src/bin/setup-config.d.ts +0 -19
  137. package/src/bin/setup-config.js +0 -370
  138. package/src/bin/setup-config.js.map +0 -1
  139. package/src/bin/setup.d.ts +0 -78
  140. package/src/bin/setup.js +0 -400
  141. package/src/bin/setup.js.map +0 -1
  142. package/src/bin/shim-audit-log.d.ts +0 -119
  143. package/src/bin/shim-audit-log.js +0 -286
  144. package/src/bin/shim-audit-log.js.map +0 -1
  145. package/src/bin/shim-deny-reason.d.ts +0 -1
  146. package/src/bin/shim-deny-reason.js +0 -244
  147. package/src/bin/shim-deny-reason.js.map +0 -1
  148. package/src/bin/shim-drift-fix.d.ts +0 -1
  149. package/src/bin/shim-drift-fix.js +0 -72
  150. package/src/bin/shim-drift-fix.js.map +0 -1
  151. package/src/bin/shim-testkit.d.ts +0 -107
  152. package/src/bin/shim-testkit.js +0 -197
  153. package/src/bin/shim-testkit.js.map +0 -1
  154. package/src/bin/shim-version-drift.d.ts +0 -1
  155. package/src/bin/shim-version-drift.js +0 -164
  156. package/src/bin/shim-version-drift.js.map +0 -1
  157. package/src/bin/shim.d.ts +0 -16
  158. package/src/bin/shim.js +0 -636
  159. package/src/bin/shim.js.map +0 -1
  160. package/src/bin/upgrade-shim.d.ts +0 -18
  161. package/src/bin/upgrade-shim.js +0 -283
  162. package/src/bin/upgrade-shim.js.map +0 -1
  163. package/src/core/ai-type-context.d.ts +0 -36
  164. package/src/core/ai-type-context.js +0 -45
  165. package/src/core/ai-type-context.js.map +0 -1
  166. package/src/core/apply-patch-parse.d.ts +0 -36
  167. package/src/core/apply-patch-parse.js +0 -154
  168. package/src/core/apply-patch-parse.js.map +0 -1
  169. package/src/core/build-context.d.ts +0 -10
  170. package/src/core/build-context.js +0 -66
  171. package/src/core/build-context.js.map +0 -1
  172. package/src/core/command-scan.d.ts +0 -122
  173. package/src/core/command-scan.js +0 -282
  174. package/src/core/command-scan.js.map +0 -1
  175. package/src/core/custom-rule-adapter.d.ts +0 -22
  176. package/src/core/custom-rule-adapter.js +0 -50
  177. package/src/core/custom-rule-adapter.js.map +0 -1
  178. package/src/core/decision-log.d.ts +0 -190
  179. package/src/core/decision-log.js +0 -406
  180. package/src/core/decision-log.js.map +0 -1
  181. package/src/core/delete-scoped-rules.d.ts +0 -8
  182. package/src/core/delete-scoped-rules.js +0 -31
  183. package/src/core/delete-scoped-rules.js.map +0 -1
  184. package/src/core/disable-directives.d.ts +0 -8
  185. package/src/core/disable-directives.js +0 -80
  186. package/src/core/disable-directives.js.map +0 -1
  187. package/src/core/effective-tree.d.ts +0 -204
  188. package/src/core/effective-tree.js +0 -277
  189. package/src/core/effective-tree.js.map +0 -1
  190. package/src/core/excluded-path-escape.d.ts +0 -101
  191. package/src/core/excluded-path-escape.js +0 -236
  192. package/src/core/excluded-path-escape.js.map +0 -1
  193. package/src/core/excluded-paths.d.ts +0 -23
  194. package/src/core/excluded-paths.js +0 -54
  195. package/src/core/excluded-paths.js.map +0 -1
  196. package/src/core/fix-hint.d.ts +0 -40
  197. package/src/core/fix-hint.js +0 -53
  198. package/src/core/fix-hint.js.map +0 -1
  199. package/src/core/force-to-root.d.ts +0 -32
  200. package/src/core/force-to-root.js +0 -60
  201. package/src/core/force-to-root.js.map +0 -1
  202. package/src/core/guard-index-doc.d.ts +0 -63
  203. package/src/core/guard-index-doc.js +0 -172
  204. package/src/core/guard-index-doc.js.map +0 -1
  205. package/src/core/instruct-ai-writer.d.ts +0 -1
  206. package/src/core/instruct-ai-writer.js +0 -6
  207. package/src/core/instruct-ai-writer.js.map +0 -1
  208. package/src/core/l0-fault-codes.d.ts +0 -85
  209. package/src/core/l0-fault-codes.js +0 -121
  210. package/src/core/l0-fault-codes.js.map +0 -1
  211. package/src/core/l0-matrix.d.ts +0 -114
  212. package/src/core/l0-matrix.js +0 -416
  213. package/src/core/l0-matrix.js.map +0 -1
  214. package/src/core/l0-tooling-doc.d.ts +0 -45
  215. package/src/core/l0-tooling-doc.js +0 -258
  216. package/src/core/l0-tooling-doc.js.map +0 -1
  217. package/src/core/l1-doc.d.ts +0 -7
  218. package/src/core/l1-doc.js +0 -340
  219. package/src/core/l1-doc.js.map +0 -1
  220. package/src/core/l1-matrix-doc.d.ts +0 -31
  221. package/src/core/l1-matrix-doc.js +0 -111
  222. package/src/core/l1-matrix-doc.js.map +0 -1
  223. package/src/core/l1-rows.d.ts +0 -167
  224. package/src/core/l1-rows.js +0 -262
  225. package/src/core/l1-rows.js.map +0 -1
  226. package/src/core/l2-doc.d.ts +0 -7
  227. package/src/core/l2-doc.js +0 -385
  228. package/src/core/l2-doc.js.map +0 -1
  229. package/src/core/l2-matrix-doc.d.ts +0 -23
  230. package/src/core/l2-matrix-doc.js +0 -72
  231. package/src/core/l2-matrix-doc.js.map +0 -1
  232. package/src/core/l2-row.d.ts +0 -54
  233. package/src/core/l2-row.js +0 -75
  234. package/src/core/l2-row.js.map +0 -1
  235. package/src/core/l2-rows.d.ts +0 -56
  236. package/src/core/l2-rows.js +0 -272
  237. package/src/core/l2-rows.js.map +0 -1
  238. package/src/core/load-config.d.ts +0 -1
  239. package/src/core/load-config.js +0 -9
  240. package/src/core/load-config.js.map +0 -1
  241. package/src/core/log-stream.d.ts +0 -117
  242. package/src/core/log-stream.js +0 -156
  243. package/src/core/log-stream.js.map +0 -1
  244. package/src/core/log-streams.d.ts +0 -48
  245. package/src/core/log-streams.js +0 -55
  246. package/src/core/log-streams.js.map +0 -1
  247. package/src/core/log-target.d.ts +0 -21
  248. package/src/core/log-target.js +0 -29
  249. package/src/core/log-target.js.map +0 -1
  250. package/src/core/main-sync-log.d.ts +0 -16
  251. package/src/core/main-sync-log.js +0 -105
  252. package/src/core/main-sync-log.js.map +0 -1
  253. package/src/core/main-sync-refresh.d.ts +0 -39
  254. package/src/core/main-sync-refresh.js +0 -96
  255. package/src/core/main-sync-refresh.js.map +0 -1
  256. package/src/core/main-sync-timeout.d.ts +0 -32
  257. package/src/core/main-sync-timeout.js +0 -94
  258. package/src/core/main-sync-timeout.js.map +0 -1
  259. package/src/core/matrix-cures.d.ts +0 -12
  260. package/src/core/matrix-cures.js +0 -56
  261. package/src/core/matrix-cures.js.map +0 -1
  262. package/src/core/missing-directory.d.ts +0 -38
  263. package/src/core/missing-directory.js +0 -66
  264. package/src/core/missing-directory.js.map +0 -1
  265. package/src/core/read-only-inspection.d.ts +0 -34
  266. package/src/core/read-only-inspection.js +0 -88
  267. package/src/core/read-only-inspection.js.map +0 -1
  268. package/src/core/rejection-log.d.ts +0 -9
  269. package/src/core/rejection-log.js +0 -258
  270. package/src/core/rejection-log.js.map +0 -1
  271. package/src/core/report.d.ts +0 -21
  272. package/src/core/report.js +0 -73
  273. package/src/core/report.js.map +0 -1
  274. package/src/core/rule-base.d.ts +0 -39
  275. package/src/core/rule-base.js +0 -36
  276. package/src/core/rule-base.js.map +0 -1
  277. package/src/core/rules/branch-creation-guard.d.ts +0 -113
  278. package/src/core/rules/branch-creation-guard.js +0 -422
  279. package/src/core/rules/branch-creation-guard.js.map +0 -1
  280. package/src/core/rules/branch-switch-scan.d.ts +0 -43
  281. package/src/core/rules/branch-switch-scan.js +0 -132
  282. package/src/core/rules/branch-switch-scan.js.map +0 -1
  283. package/src/core/rules/build-output-pipe-guard.d.ts +0 -56
  284. package/src/core/rules/build-output-pipe-guard.js +0 -120
  285. package/src/core/rules/build-output-pipe-guard.js.map +0 -1
  286. package/src/core/rules/build-output-pipe-scan.d.ts +0 -47
  287. package/src/core/rules/build-output-pipe-scan.js +0 -84
  288. package/src/core/rules/build-output-pipe-scan.js.map +0 -1
  289. package/src/core/rules/cap-remedies.d.ts +0 -39
  290. package/src/core/rules/cap-remedies.js +0 -59
  291. package/src/core/rules/cap-remedies.js.map +0 -1
  292. package/src/core/rules/commit-message-substitution-guard.d.ts +0 -72
  293. package/src/core/rules/commit-message-substitution-guard.js +0 -134
  294. package/src/core/rules/commit-message-substitution-guard.js.map +0 -1
  295. package/src/core/rules/commit-message-substitution-scan.d.ts +0 -42
  296. package/src/core/rules/commit-message-substitution-scan.js +0 -145
  297. package/src/core/rules/commit-message-substitution-scan.js.map +0 -1
  298. package/src/core/rules/content-read-scan.d.ts +0 -76
  299. package/src/core/rules/content-read-scan.js +0 -176
  300. package/src/core/rules/content-read-scan.js.map +0 -1
  301. package/src/core/rules/cure-prefix-scan.d.ts +0 -64
  302. package/src/core/rules/cure-prefix-scan.js +0 -133
  303. package/src/core/rules/cure-prefix-scan.js.map +0 -1
  304. package/src/core/rules/feature-branch-guard.d.ts +0 -121
  305. package/src/core/rules/feature-branch-guard.js +0 -326
  306. package/src/core/rules/feature-branch-guard.js.map +0 -1
  307. package/src/core/rules/judged-tree.d.ts +0 -66
  308. package/src/core/rules/judged-tree.js +0 -97
  309. package/src/core/rules/judged-tree.js.map +0 -1
  310. package/src/core/rules/main-freshness.d.ts +0 -37
  311. package/src/core/rules/main-freshness.js +0 -61
  312. package/src/core/rules/main-freshness.js.map +0 -1
  313. package/src/core/rules/merge-in-progress-guard.d.ts +0 -17
  314. package/src/core/rules/merge-in-progress-guard.js +0 -122
  315. package/src/core/rules/merge-in-progress-guard.js.map +0 -1
  316. package/src/core/rules/merged-branch-bash-guard.d.ts +0 -62
  317. package/src/core/rules/merged-branch-bash-guard.js +0 -170
  318. package/src/core/rules/merged-branch-bash-guard.js.map +0 -1
  319. package/src/core/rules/merged-branch-message.d.ts +0 -59
  320. package/src/core/rules/merged-branch-message.js +0 -137
  321. package/src/core/rules/merged-branch-message.js.map +0 -1
  322. package/src/core/rules/pr-creation-or-push-guard.d.ts +0 -26
  323. package/src/core/rules/pr-creation-or-push-guard.js +0 -146
  324. package/src/core/rules/pr-creation-or-push-guard.js.map +0 -1
  325. package/src/core/rules/pr-merge-guard.d.ts +0 -36
  326. package/src/core/rules/pr-merge-guard.js +0 -86
  327. package/src/core/rules/pr-merge-guard.js.map +0 -1
  328. package/src/core/rules/read-stale-guard.d.ts +0 -136
  329. package/src/core/rules/read-stale-guard.js +0 -326
  330. package/src/core/rules/read-stale-guard.js.map +0 -1
  331. package/src/core/rules/recovery-allowlist.d.ts +0 -49
  332. package/src/core/rules/recovery-allowlist.js +0 -187
  333. package/src/core/rules/recovery-allowlist.js.map +0 -1
  334. package/src/core/rules/redirect-how-to-merge-main.d.ts +0 -16
  335. package/src/core/rules/redirect-how-to-merge-main.js +0 -157
  336. package/src/core/rules/redirect-how-to-merge-main.js.map +0 -1
  337. package/src/core/rules/shell-segment-scan.d.ts +0 -64
  338. package/src/core/rules/shell-segment-scan.js +0 -88
  339. package/src/core/rules/shell-segment-scan.js.map +0 -1
  340. package/src/core/rules/stale-main-bash-guard.d.ts +0 -198
  341. package/src/core/rules/stale-main-bash-guard.js +0 -361
  342. package/src/core/rules/stale-main-bash-guard.js.map +0 -1
  343. package/src/core/rules/stale-main-message.d.ts +0 -62
  344. package/src/core/rules/stale-main-message.js +0 -102
  345. package/src/core/rules/stale-main-message.js.map +0 -1
  346. package/src/core/rules/tree-recovery.d.ts +0 -92
  347. package/src/core/rules/tree-recovery.js +0 -165
  348. package/src/core/rules/tree-recovery.js.map +0 -1
  349. package/src/core/rules/wait-spin-guard.d.ts +0 -128
  350. package/src/core/rules/wait-spin-guard.js +0 -211
  351. package/src/core/rules/wait-spin-guard.js.map +0 -1
  352. package/src/core/rules/wait-spin-scan.d.ts +0 -118
  353. package/src/core/rules/wait-spin-scan.js +0 -203
  354. package/src/core/rules/wait-spin-scan.js.map +0 -1
  355. package/src/core/rules/whole-repo-build-guard.d.ts +0 -125
  356. package/src/core/rules/whole-repo-build-guard.js +0 -257
  357. package/src/core/rules/whole-repo-build-guard.js.map +0 -1
  358. package/src/core/rules/whole-repo-build-scan.d.ts +0 -28
  359. package/src/core/rules/whole-repo-build-scan.js +0 -198
  360. package/src/core/rules/whole-repo-build-scan.js.map +0 -1
  361. package/src/core/session-call-history.d.ts +0 -44
  362. package/src/core/session-call-history.js +0 -79
  363. package/src/core/session-call-history.js.map +0 -1
  364. package/src/core/shell-read-parity.d.ts +0 -56
  365. package/src/core/shell-read-parity.js +0 -155
  366. package/src/core/shell-read-parity.js.map +0 -1
  367. package/src/core/strip-ts-noise.d.ts +0 -1
  368. package/src/core/strip-ts-noise.js +0 -185
  369. package/src/core/strip-ts-noise.js.map +0 -1
  370. package/src/core/sync-main.d.ts +0 -46
  371. package/src/core/sync-main.js +0 -175
  372. package/src/core/sync-main.js.map +0 -1
  373. package/src/core/target-tree.d.ts +0 -84
  374. package/src/core/target-tree.js +0 -148
  375. package/src/core/target-tree.js.map +0 -1
  376. package/src/core/to-error.d.ts +0 -5
  377. package/src/core/to-error.js +0 -37
  378. package/src/core/to-error.js.map +0 -1
  379. package/src/core/types.d.ts +0 -152
  380. package/src/core/types.js +0 -200
  381. package/src/core/types.js.map +0 -1
  382. package/src/core/version-sync.d.ts +0 -219
  383. package/src/core/version-sync.js +0 -558
  384. package/src/core/version-sync.js.map +0 -1
  385. package/src/core/webpieces-versions.d.ts +0 -98
  386. package/src/core/webpieces-versions.js +0 -206
  387. package/src/core/webpieces-versions.js.map +0 -1
  388. package/templates/ai-hook.sh +0 -497
  389. package/templates/claude-settings-hook.json +0 -28
  390. package/templates/webpieces-reviewer.md +0 -60
@@ -1,45 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runDevHookUninstall = runDevHookUninstall;
4
- const fs_1 = require("fs");
5
- const os_1 = require("os");
6
- const path_1 = require("path");
7
- const rules_config_1 = require("@webpieces/rules-config");
8
- // NOTE: this is a dev-only tool, no longer a `wp-*` bin. Run it directly with node against the local
9
- // build: `node dist/packages/tooling/ai-hook-rules/src/bin/dev-hook-uninstall.js`.
10
- async function runDevHookUninstall() {
11
- const cwd = process.cwd();
12
- const homeDir = (0, os_1.homedir)();
13
- const backupPath = (0, path_1.join)(homeDir, '.webpieces', 'dev-hook-backup.json');
14
- const claudeSettingsPath = (0, path_1.join)(homeDir, '.claude', 'settings.json');
15
- if (!(0, fs_1.existsSync)(backupPath)) {
16
- console.error('[dev-hook-uninstall] No dev hook backup found — dev hook was not installed.');
17
- throw new rules_config_1.CliExitError(1, '');
18
- }
19
- const backup = JSON.parse((0, fs_1.readFileSync)(backupPath, 'utf8'));
20
- let settings = {};
21
- if ((0, fs_1.existsSync)(claudeSettingsPath)) {
22
- settings = JSON.parse((0, fs_1.readFileSync)(claudeSettingsPath, 'utf8'));
23
- }
24
- if (backup.previousHooks === null) {
25
- delete settings.hooks;
26
- }
27
- else {
28
- settings.hooks = backup.previousHooks;
29
- }
30
- (0, fs_1.writeFileSync)(claudeSettingsPath, JSON.stringify(settings, null, 4) + '\n');
31
- (0, fs_1.rmSync)(backupPath);
32
- // Remove the symlink created during install
33
- const overrideDir = (0, path_1.join)(cwd, 'dist', 'packages', 'tooling', 'node_modules', '@webpieces');
34
- const overrideLink = (0, path_1.join)(overrideDir, 'rules-config');
35
- if ((0, fs_1.existsSync)(overrideLink)) {
36
- (0, fs_1.rmSync)(overrideLink, { recursive: true });
37
- }
38
- if ((0, fs_1.existsSync)(overrideDir) && (0, fs_1.readdirSync)(overrideDir).length === 0) {
39
- (0, fs_1.rmSync)(overrideDir, { recursive: true });
40
- }
41
- console.log(' Dev hook removed. Previous hook configuration restored.');
42
- }
43
- if (require.main === module)
44
- (0, rules_config_1.runMain)(runDevHookUninstall);
45
- //# sourceMappingURL=dev-hook-uninstall.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"dev-hook-uninstall.js","sourceRoot":"","sources":["../../../../../../packages/tooling/ai-hook-rules/src/bin/dev-hook-uninstall.ts"],"names":[],"mappings":";;AAwBA,kDAsCC;AA9DD,2BAAkF;AAClF,2BAA6B;AAC7B,+BAA4B;AAC5B,0DAAgE;AAmBhE,qGAAqG;AACrG,mFAAmF;AAC5E,KAAK,UAAU,mBAAmB;IACrC,MAAM,GAAG,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IAC1B,MAAM,OAAO,GAAG,IAAA,YAAO,GAAE,CAAC;IAC1B,MAAM,UAAU,GAAG,IAAA,WAAI,EAAC,OAAO,EAAE,YAAY,EAAE,sBAAsB,CAAC,CAAC;IACvE,MAAM,kBAAkB,GAAG,IAAA,WAAI,EAAC,OAAO,EAAE,SAAS,EAAE,eAAe,CAAC,CAAC;IAErE,IAAI,CAAC,IAAA,eAAU,EAAC,UAAU,CAAC,EAAE,CAAC;QAC1B,OAAO,CAAC,KAAK,CAAC,6EAA6E,CAAC,CAAC;QAC7F,MAAM,IAAI,2BAAY,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,UAAU,EAAE,MAAM,CAAC,CAAkB,CAAC;IAE7E,IAAI,QAAQ,GAAmB,EAAE,CAAC;IAClC,IAAI,IAAA,eAAU,EAAC,kBAAkB,CAAC,EAAE,CAAC;QACjC,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,IAAA,iBAAY,EAAC,kBAAkB,EAAE,MAAM,CAAC,CAAmB,CAAC;IACtF,CAAC;IAED,IAAI,MAAM,CAAC,aAAa,KAAK,IAAI,EAAE,CAAC;QAChC,OAAO,QAAQ,CAAC,KAAK,CAAC;IAC1B,CAAC;SAAM,CAAC;QACJ,QAAQ,CAAC,KAAK,GAAG,MAAM,CAAC,aAAa,CAAC;IAC1C,CAAC;IAED,IAAA,kBAAa,EAAC,kBAAkB,EAAE,IAAI,CAAC,SAAS,CAAC,QAAQ,EAAE,IAAI,EAAE,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IAC5E,IAAA,WAAM,EAAC,UAAU,CAAC,CAAC;IAEnB,4CAA4C;IAC5C,MAAM,WAAW,GAAG,IAAA,WAAI,EAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,cAAc,EAAE,YAAY,CAAC,CAAC;IAC3F,MAAM,YAAY,GAAG,IAAA,WAAI,EAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IACvD,IAAI,IAAA,eAAU,EAAC,YAAY,CAAC,EAAE,CAAC;QAC3B,IAAA,WAAM,EAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC9C,CAAC;IACD,IAAI,IAAA,eAAU,EAAC,WAAW,CAAC,IAAI,IAAA,gBAAW,EAAC,WAAW,CAAC,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACnE,IAAA,WAAM,EAAC,WAAW,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC7C,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,2DAA2D,CAAC,CAAC;AAC7E,CAAC;AAED,IAAI,OAAO,CAAC,IAAI,KAAK,MAAM;IAAE,IAAA,sBAAO,EAAC,mBAAmB,CAAC,CAAC","sourcesContent":["import { existsSync, readFileSync, writeFileSync, rmSync, readdirSync } from 'fs';\nimport { homedir } from 'os';\nimport { join } from 'path';\nimport { runMain, CliExitError } from '@webpieces/rules-config';\n\ninterface HookEntry {\n matcher: string;\n hooks: Array<{ type: string; command: string }>;\n}\n\ninterface ClaudeSettings {\n hooks?: {\n PreToolUse?: HookEntry[];\n };\n // webpieces-disable no-any-unknown -- opaque settings bag; arbitrary keys allowed\n [key: string]: unknown;\n}\n\ninterface DevHookBackup {\n previousHooks: ClaudeSettings['hooks'] | null;\n}\n\n// NOTE: this is a dev-only tool, no longer a `wp-*` bin. Run it directly with node against the local\n// build: `node dist/packages/tooling/ai-hook-rules/src/bin/dev-hook-uninstall.js`.\nexport async function runDevHookUninstall(): Promise<void> {\n const cwd = process.cwd();\n const homeDir = homedir();\n const backupPath = join(homeDir, '.webpieces', 'dev-hook-backup.json');\n const claudeSettingsPath = join(homeDir, '.claude', 'settings.json');\n\n if (!existsSync(backupPath)) {\n console.error('[dev-hook-uninstall] No dev hook backup found — dev hook was not installed.');\n throw new CliExitError(1, '');\n }\n\n const backup = JSON.parse(readFileSync(backupPath, 'utf8')) as DevHookBackup;\n\n let settings: ClaudeSettings = {};\n if (existsSync(claudeSettingsPath)) {\n settings = JSON.parse(readFileSync(claudeSettingsPath, 'utf8')) as ClaudeSettings;\n }\n\n if (backup.previousHooks === null) {\n delete settings.hooks;\n } else {\n settings.hooks = backup.previousHooks;\n }\n\n writeFileSync(claudeSettingsPath, JSON.stringify(settings, null, 4) + '\\n');\n rmSync(backupPath);\n\n // Remove the symlink created during install\n const overrideDir = join(cwd, 'dist', 'packages', 'tooling', 'node_modules', '@webpieces');\n const overrideLink = join(overrideDir, 'rules-config');\n if (existsSync(overrideLink)) {\n rmSync(overrideLink, { recursive: true });\n }\n if (existsSync(overrideDir) && readdirSync(overrideDir).length === 0) {\n rmSync(overrideDir, { recursive: true });\n }\n\n console.log(' Dev hook removed. Previous hook configuration restored.');\n}\n\nif (require.main === module) runMain(runDevHookUninstall);\n"]}
@@ -1,429 +0,0 @@
1
- import { AiType } from '@webpieces/hook-runtime';
2
- import type { ClaudeSettings } from './settings-shape';
3
- /**
4
- * THE INSTALLED HOOK SURFACE — two hooks per harness, all ABSOLUTE, and the ONE place their spelling is
5
- * defined. See `HarnessRegistration` below, which is what makes "per harness" data rather than four
6
- * module constants that were only ever true of Claude Code.
7
- *
8
- * ─── ONE GOVERNOR: the MAIN tree judges every tree ─────────────────────────────────────────────────
9
- *
10
- * Claude Code — .claude/settings.json
11
- * H1 sh "$CLAUDE_PROJECT_DIR/.claude/webpieces/ai-hook.sh" wp-ai-guards-hook Write|…|Bash|Read
12
- * H2 sh "$CLAUDE_PROJECT_DIR/.claude/webpieces/ai-hook.sh" wp-ai-rules-hook Write|Edit|MultiEdit
13
- * Codex — .codex/hooks.json (the SAME `hooks.PreToolUse` JSON shape, measured)
14
- * H1 sh "$PWD/.claude/webpieces/ai-hook.sh" wp-ai-guards-hook Bash|apply_patch
15
- * H2 sh "$PWD/.claude/webpieces/ai-hook.sh" wp-ai-rules-hook apply_patch
16
- *
17
- * ONE shim file serves all four: `.claude/` there is a path, not a claim about who is calling.
18
- *
19
- * This REPLACES a three-hook form in which these two were RELATIVE (`sh ".claude/webpieces/ai-hook.sh"`)
20
- * and a third hook, L-1 `guarantee-root.sh`, existed solely to guarantee that relative path resolved.
21
- *
22
- * ─── Why the relative experiment was reversed ──────────────────────────────────────────────────────
23
- * Relative registration was adopted so each git tree would be governed by "its own release, binary and
24
- * pin". MEASURED 2026-08-10: it never delivered that. A linked worktree has NO `node_modules`, so
25
- * ai-hook.sh's upward walk executes the PRIMARY's binary — `readlink -f` resolved a worktree agent's bin
26
- * to `<primary>/node_modules/@webpieces/ai-hook-rules`. A worktree ran its own SCRIPT and its own
27
- * CONFIG; it never ran its own release. Governance was already the primary's, in every tree, the whole
28
- * time.
29
- *
30
- * The price of that fiction was an entire guard layer. A relative path only resolves at a tree root, and
31
- * a hook that cannot resolve exits 127 — per the hooks reference a NON-BLOCKING error, i.e. a SILENT
32
- * UNGUARDED ALLOW. So L-1 had to deny every `cd` into a project subdirectory. That denial produced the
33
- * force-to-root bug class, the reaped-worktree `cd` prescription, and a measured hard deadlock: L-1 told
34
- * a worktree-isolated agent to `cd` to the primary clone, which the harness refuses for an isolated
35
- * agent, leaving it unable to stay or to follow the cure.
36
- *
37
- * An absolute path resolves from ANY cwd. So the launch guarantee is structural, L-1 has no job left and
38
- * is deleted, and `cd` into a subdirectory is simply allowed. What used to be true only by policing the
39
- * shell is now true by construction.
40
- *
41
- * ─── What replaces the property that was lost ──────────────────────────────────────────────────────
42
- * Nothing is lost that was ever delivered — but the case relative registration WANTED to handle (a tree
43
- * that genuinely needs a different @webpieces) is now DETECTED instead of silently mis-governed:
44
- * `VersionSyncGuard` (L1 row 8) blocks when a worktree's pin disagrees with the main tree's, and
45
- * prescribes either aligning the pins (same git hash → same tracked pin → install in each tree that has
46
- * a node_modules) or using a separate CLONE, which — unlike a worktree — gets its own GOVERNANCE. Note
47
- * what that does NOT say: a worktree may perfectly well have its own node_modules, and usually does the
48
- * moment anything installs in it. What it may not have is a DIFFERENT @webpieces version.
49
- *
50
- * ─── Why the registration is a DRIFT SURFACE, not just an install step ─────────────────────────────
51
- * Nothing used to validate `.claude/settings.json` at all, so a settings file left on a superseded form
52
- * silently changed who governs. The installed surface is FOUR things (ai-hook.sh, the registration, the
53
- * managed `env` entry — see managed-env.ts — and the ANCHORING of the NEIGHBOUR hook commands the
54
- * consumer registers beside ours, see neighbour-hooks.ts), all four are compared against this release,
55
- * and `wp-upgrade-shim` repairs all four. A cure that fixes three of four is worse than no cure, because
56
- * it reports success.
57
- */
58
- /**
59
- * The RETIRED L-1 hook's committed path. Named here, in the one module that must still recognise it, and
60
- * matched ONLY by isManagedCommand() so repairRegistration() can delete the stale entry. There is no
61
- * guarantee-root.ts any more — this literal is all that remains of it, deliberately.
62
- *
63
- * It is a one-way RECOGNISER, not a shim: nothing emits it, `expectedEntries()` never returns it, and a
64
- * settings file carrying it is reported STALE. Its only job is to make the retired entry findable so it
65
- * can be REMOVED.
66
- */
67
- export declare const LEGACY_GUARANTEE_ROOT_MARKER = ".claude/webpieces/guarantee-root.sh";
68
- /**
69
- * When this recogniser may be deleted, as a value rather than a comment nobody re-reads.
70
- *
71
- * A removal-only migration is still dead weight once no consumer can be carrying the old shape. The
72
- * hazard of deleting it EARLY is severe and silent — repair would stop stripping the retired entry, and
73
- * a hook registered against a deleted file exits 127, which the Claude Code hooks reference defines as a
74
- * NON-BLOCKING error, i.e. every `cd` unjudged while the cure reports success. So it gets a stated date
75
- * and a test that fails once the date passes, instead of an intention.
76
- *
77
- * `legacy-marker-expiry.spec.ts` reads this and fails after it, which is the reminder.
78
- */
79
- export declare const LEGACY_MARKER_REMOVE_AFTER = "2026-12-01";
80
- /** One PreToolUse hook entry as webpieces registers it. Data-only → a class, per CLAUDE.md. */
81
- export declare class HookRegistrationEntry {
82
- readonly matcher: string;
83
- readonly command: string;
84
- constructor(matcher: string, command: string);
85
- sameAs(other: HookRegistrationEntry): boolean;
86
- }
87
- /**
88
- * THE SETTINGS-FILE SHAPE lives in `./settings-shape`, a LEAF module, and is imported from THERE by
89
- * everything that needs it — this module included. It is deliberately NOT re-exported here: a second
90
- * import path for one type is the "two spellings of one thing" shim the compatibility policy rejects,
91
- * and it would keep advertising `hook-registration` as a source of the shape, which is precisely the
92
- * edge that has to stay broken (`neighbour-hooks.ts` needs the shape, this module imports the repairs
93
- * FROM it, and `validate-no-file-import-cycles` counts even a type-only edge back as a cycle).
94
- */
95
- export declare const RULES_BIN = "wp-ai-rules-hook";
96
- export declare const GUARDS_BIN = "wp-ai-guards-hook";
97
- /**
98
- * ONE HARNESS'S registration surface — where its hooks live, what they match, and how they name the
99
- * shim. Data-only → a class, per CLAUDE.md.
100
- *
101
- * ─── Why this exists ──────────────────────────────────────────────────────────────────────────────
102
- * The matchers and the shim command used to be four module constants written for Claude Code alone.
103
- * Applied to Codex they are wrong in both halves, and the way they are wrong is SILENT:
104
- *
105
- * - MATCHER. Codex's file-editing tool is `apply_patch` (MEASURED, codex-cli 0.151.0). A matcher of
106
- * `Write|Edit|MultiEdit` matches it never, so every file rule is unreachable while the settings file
107
- * looks perfectly installed. Its shell tool IS called `Bash` — Codex reuses Claude's name — which is
108
- * the trap: half the matcher works, so the hooks appear to be running.
109
- * - ANCHOR. `$CLAUDE_PROJECT_DIR` does not exist in a Codex hook's environment (measured: 46 vars, no
110
- * such key), so the command expands to `sh "/.claude/webpieces/ai-hook.sh"`, which dies — and per the
111
- * hooks protocol a non-2 non-zero exit is a NON-BLOCKING error, i.e. a silent unguarded allow.
112
- *
113
- * Both halves of that were live in real repos, written by a Codex Desktop sync that transliterated the
114
- * Claude setup. Making the registration per-harness DATA is what stops a future harness inheriting a
115
- * matcher that was never true for it.
116
- *
117
- * ─── ONE SHIM, both harnesses ─────────────────────────────────────────────────────────────────────
118
- * `SHIM_MARKER` is shared deliberately: `.claude/webpieces/ai-hook.sh` is the single fail-closed entry
119
- * point, and moving or duplicating it would double the L0 allowlist regexes, the drift surfaces and the
120
- * cures. The `.claude/` prefix is a path, not a claim about which agent is calling.
121
- */
122
- export declare class HarnessRegistration {
123
- readonly aiType: AiType;
124
- /** How the installer and the drift report name this harness to a human. */
125
- readonly label: string;
126
- /** Which tool names the RULES hook (code-style, file-scoped) must see. */
127
- readonly rulesMatcher: string;
128
- /**
129
- * Which tool names the GUARDS hook must see. Wider than the rules matcher by the shell tool and,
130
- * for Claude Code, by `Read` — Read carries no guard, but the guards hook owns the
131
- * per-invocation audit log, so matching it records every file the AI opens (log-and-allow fast
132
- * path in hook-core.ts; a Read is never blocked). Codex has no Read tool at all: a read arrives
133
- * as `Bash` running a pager, which the shell matcher already covers and read-parity synthesizes.
134
- */
135
- readonly guardsMatcher: string;
136
- /** The settings files this harness's hooks can be installed into, relative to the repo root. */
137
- readonly settingsFiles: readonly string[];
138
- /**
139
- * THE PREFIX THE SHIM PATH IS ANCHORED ON, and the reason each harness needs its own.
140
- *
141
- * **BYTE-STABILITY IS A HARD CONSTRAINT ON THE CODEX VALUE.** Codex trusts a hook entry
142
- * TOFU — `~/.codex/config.toml` records a `trusted_hash` per entry — so ANY change to these bytes
143
- * invalidates that trust and re-prompts the human, whose third option is `Continue without
144
- * trusting (hooks won't run)`: one keystroke to a silently unguarded session. Changing this
145
- * string is therefore never a cosmetic edit. The hash is NOT reproducible from outside Codex
146
- * (16 encodings tried against a file we authored), so the installer can never repair trust for
147
- * itself — see ./codex-trust.ts, which REPORTS and never writes.
148
- */
149
- readonly shimAnchor: string;
150
- /**
151
- * True when this harness's settings file also carries the managed `env` block. Claude Code's
152
- * settings `env` is inherited by every subagent, which is what makes it the right home for the
153
- * Bash-cwd pin (see managed-env.ts). Codex has no equivalent surface — and needs none: its cwd
154
- * is MEASURED not to drift at all (`cd x && pwd` prints x, the next call is back at the repo
155
- * root, for the coordinator and for subagents alike).
156
- */
157
- readonly managesEnv: boolean;
158
- /** What `managedSurfaceDrift()` calls this harness's registration when it has moved. */
159
- readonly registrationSurface: string;
160
- constructor(aiType: AiType,
161
- /** How the installer and the drift report name this harness to a human. */
162
- label: string,
163
- /** Which tool names the RULES hook (code-style, file-scoped) must see. */
164
- rulesMatcher: string,
165
- /**
166
- * Which tool names the GUARDS hook must see. Wider than the rules matcher by the shell tool and,
167
- * for Claude Code, by `Read` — Read carries no guard, but the guards hook owns the
168
- * per-invocation audit log, so matching it records every file the AI opens (log-and-allow fast
169
- * path in hook-core.ts; a Read is never blocked). Codex has no Read tool at all: a read arrives
170
- * as `Bash` running a pager, which the shell matcher already covers and read-parity synthesizes.
171
- */
172
- guardsMatcher: string,
173
- /** The settings files this harness's hooks can be installed into, relative to the repo root. */
174
- settingsFiles: readonly string[],
175
- /**
176
- * THE PREFIX THE SHIM PATH IS ANCHORED ON, and the reason each harness needs its own.
177
- *
178
- * **BYTE-STABILITY IS A HARD CONSTRAINT ON THE CODEX VALUE.** Codex trusts a hook entry
179
- * TOFU — `~/.codex/config.toml` records a `trusted_hash` per entry — so ANY change to these bytes
180
- * invalidates that trust and re-prompts the human, whose third option is `Continue without
181
- * trusting (hooks won't run)`: one keystroke to a silently unguarded session. Changing this
182
- * string is therefore never a cosmetic edit. The hash is NOT reproducible from outside Codex
183
- * (16 encodings tried against a file we authored), so the installer can never repair trust for
184
- * itself — see ./codex-trust.ts, which REPORTS and never writes.
185
- */
186
- shimAnchor: string,
187
- /**
188
- * True when this harness's settings file also carries the managed `env` block. Claude Code's
189
- * settings `env` is inherited by every subagent, which is what makes it the right home for the
190
- * Bash-cwd pin (see managed-env.ts). Codex has no equivalent surface — and needs none: its cwd
191
- * is MEASURED not to drift at all (`cd x && pwd` prints x, the next call is back at the repo
192
- * root, for the coordinator and for subagents alike).
193
- */
194
- managesEnv: boolean,
195
- /** What `managedSurfaceDrift()` calls this harness's registration when it has moved. */
196
- registrationSurface: string);
197
- /** Which matcher one guard bin registers under. */
198
- matcherFor(bin: string): string;
199
- /**
200
- * The guard-hook command — `sh "<anchor>/.claude/webpieces/ai-hook.sh" <bin>`.
201
- *
202
- * ABSOLUTE, in both harnesses. Claude's anchor replaced a RELATIVE spelling and that reversal is
203
- * documented at length in this file's header: relative resolves only at a tree root, a hook that
204
- * cannot resolve exits 127, and per the hooks reference that is a NON-BLOCKING error — a silent
205
- * unguarded allow. It also cost an entire guard layer (L-1) whose only job was to police the `cd`
206
- * that made the relative path resolvable.
207
- *
208
- * Invoked via `sh <file>` rather than executed directly so a missing executable bit on the
209
- * checked-in shim (fresh clone, a filesystem that drops the bit, git core.fileMode quirks) can never
210
- * break the hook with a raw `Permission denied` on every tool call. Quoted to survive spaces.
211
- */
212
- shimCommand(bin: string): string;
213
- /** The registration entry for one guard bin under this harness. */
214
- entryFor(bin: string): HookRegistrationEntry;
215
- /** This harness's settings files under one repo root, absolute. */
216
- settingsPaths(projectRoot: string): readonly string[];
217
- /**
218
- * What `managedSurfaceDrift()` calls this harness's NEIGHBOUR hook commands — the entries a CONSUMER
219
- * repo registers in the same file — when one of them still carries a repo-RELATIVE entry path.
220
- *
221
- * DERIVED rather than a constructor field, unlike `registrationSurface` beside it, because there is
222
- * nothing here a harness could sensibly disagree about: it is the same file, said a second way. A
223
- * constructor param would be a second place to keep in step for no decision.
224
- */
225
- get neighbourSurface(): string;
226
- }
227
- export declare const CLAUDE_REGISTRATION: HarnessRegistration;
228
- /**
229
- * Codex's registration, every value of it MEASURED against codex-cli 0.151.0 rather than assumed.
230
- *
231
- * `$PWD` is the anchor because there is no project-dir variable to use and none is needed: the payload
232
- * `cwd` and the hook process's own `PWD` are both the repo root on EVERY call — for the coordinator and
233
- * for subagents — and a `cd` inside one command never survives into the next. That was measured, not
234
- * hoped for, and it is the same effect Claude Code gets from the managed
235
- * `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR` env entry. See `shimAnchor` for why these exact bytes are
236
- * not free to change.
237
- */
238
- export declare const CODEX_REGISTRATION: HarnessRegistration;
239
- /**
240
- * Every harness webpieces arms, in installer order.
241
- *
242
- * The drift check, the repair and the installer all iterate THIS, so a harness cannot be armed by the
243
- * installer and then left unvalidated — which is exactly the state `.codex/hooks.json` was in before it
244
- * was a managed surface: written by something else, silently wrong, and invisible to every check.
245
- */
246
- export declare const HARNESS_REGISTRATIONS: readonly HarnessRegistration[];
247
- /**
248
- * True when this PreToolUse command is one webpieces owns — in ANY spelling it has ever shipped.
249
- *
250
- * THE SINGLE MOST IMPORTANT LINE IN THIS RELEASE. `LEGACY_GUARANTEE_ROOT_MARKER` is matched here and
251
- * NOWHERE else: it is how `repairRegistration()` finds and REMOVES the retired H1 entry from a settings
252
- * file written by an older release. Drop it and the repair silently leaves a live L-1 hook registered
253
- * against a file this release deletes — exit 127, which the Claude Code hooks reference defines as a
254
- * NON-BLOCKING error, so every `cd` goes unjudged while `wp-upgrade-shim` reports success and no drift
255
- * check can name it. Removal-only, never emitted: it appears in no `expectedEntries()` result, so it is
256
- * a one-way migration and not a second accepted spelling.
257
- */
258
- export declare function isManagedCommand(command: string): boolean;
259
- /** Every webpieces-managed entry of one settings file, flattened to matcher + command pairs. */
260
- export declare function managedEntries(settings: ClaudeSettings): readonly HookRegistrationEntry[];
261
- /**
262
- * Which guard bins this settings file registers, in installer order. A file registering NEITHER is not
263
- * a project (relative) install and is therefore never judged — a global/absolute install names the bin
264
- * path directly and carries no shim marker at all.
265
- */
266
- export declare function registeredBins(settings: ClaudeSettings): readonly string[];
267
- /**
268
- * The exact set of entries THIS RELEASE expects in a settings file that registers `bins`.
269
- *
270
- * ONE entry per registered bin, and nothing else. There used to be a third, `guarantee-root.sh`, added
271
- * whenever the GUARDS bin was present; it is retired, and a settings file still carrying it is STALE —
272
- * `repairRegistration()` removes it via isManagedCommand()'s legacy marker.
273
- */
274
- export declare function expectedEntries(harness: HarnessRegistration, bins: readonly string[]): readonly HookRegistrationEntry[];
275
- /**
276
- * True when a settings file registers webpieces hooks in a shape this release does not expect: a
277
- * RELATIVE shim command, a leftover guarantee-root entry, a stray duplicate, or a wrong matcher.
278
- *
279
- * Compared as a SET, not a sequence: Claude Code runs all matching hooks in parallel, so array order
280
- * carries no meaning and reordering must not read as drift.
281
- */
282
- export declare function registrationStale(harness: HarnessRegistration, settings: ClaudeSettings): boolean;
283
- /** Drop every webpieces-managed PreToolUse command; returns true if anything was removed. */
284
- export declare function dropManagedEntries(settings: ClaudeSettings): boolean;
285
- /** Append one PreToolUse entry. */
286
- export declare function addHookEntry(settings: ClaudeSettings, entry: HookRegistrationEntry): void;
287
- /**
288
- * True when a settings file that registers webpieces hooks is missing the managed `env` entry, or
289
- * carries any value other than the one required one.
290
- *
291
- * Gated on `registeredBins()` for the SAME reason `registrationStale()` is: a settings file that
292
- * registers no webpieces hooks is not a project install and is never judged — a global install names
293
- * the bin path directly and carries no shim marker at all, so there is nothing here to keep in step.
294
- *
295
- * NOTE what this entry is for NOW. It was originally justified by keeping the then-RELATIVE hook path
296
- * resolvable; that job is retired, because both hooks are absolute and resolve from any cwd. It is kept
297
- * for VERDICT STABILITY — a guard's answer must depend on the command, not on where an earlier `cd` left
298
- * the shell — and because settings `env` is inherited, every subagent shares that cwd and therefore that
299
- * verdict. See managed-env.ts, which states this at length.
300
- */
301
- export declare function envStale(settings: ClaudeSettings): boolean;
302
- /**
303
- * Set the managed `env` entry IN PLACE, whatever was there before. Returns true when it changed.
304
- *
305
- * A user-set `"0"` is BROUGHT TO `"1"`, not honoured: this is a managed surface, and "webpieces sets it
306
- * unless you disagreed" would be a second, invisible spelling of the decision. Turning it off means
307
- * uninstalling the hooks, exactly as it does for every other managed thing.
308
- *
309
- * UNGATED on purpose — the installer calls it for the file it is writing hooks into, and the gate lives
310
- * at the caller (repairRegistration / applyHook), so a file with no webpieces hooks is never touched.
311
- */
312
- export declare function applyManagedEnv(settings: ClaudeSettings): boolean;
313
- /**
314
- * Bring one settings object to the two-hook ABSOLUTE form AND the managed `env` entry IN PLACE. Returns
315
- * true when it changed anything.
316
- *
317
- * REMOVE-then-ADD for the hooks, never add-beside: two spellings of one registration is exactly the
318
- * compatibility shim the backwards-compat reviewer rejects, and leaving a RELATIVE entry beside the
319
- * absolute one would run two shims per call — the
320
- * straddle this whole change exists to delete.
321
- *
322
- * THE TWO REPAIRS ARE EVALUATED INDEPENDENTLY, and that is load-bearing rather than tidy: this used to
323
- * early-return on `!registrationStale(settings)`, so a repo whose hooks are already current but whose
324
- * `env` entry is missing — the state EVERY existing consumer is in the moment this release lands — would
325
- * have been reported as drifted by fault S and then left unrepaired by its own prescribed cure. A cure
326
- * that skips half the surface is the failure mode `upgrade-shim.ts`'s header exists to prevent.
327
- */
328
- export declare function repairRegistration(harness: HarnessRegistration, settings: ClaudeSettings): boolean;
329
- export declare function readSettings(settingsPath: string): ClaudeSettings;
330
- export declare function writeSettings(settingsPath: string, settings: ClaudeSettings): void;
331
- /**
332
- * True when any settings file ONE HARNESS owns under `root` carries a NEIGHBOUR hook — one the consumer
333
- * repo wrote — whose entry path is repo-RELATIVE and would therefore fail to resolve from any cwd but
334
- * the root. See neighbour-hooks.ts for the measured failure and why webpieces owns the repair.
335
- *
336
- * Judged ONLY where the file registers webpieces hooks, exactly like `registrationStaleAt` below: a
337
- * settings file with no webpieces hooks in it is not a webpieces install, and webpieces rewriting
338
- * somebody's unrelated hook lines there would be editing a file it was never given.
339
- */
340
- export declare function neighbourHooksStaleAt(harness: HarnessRegistration, root: string | null): boolean;
341
- /**
342
- * True when any settings file ONE HARNESS owns under `root` carries a stale registration.
343
- *
344
- * Per harness, not per repo, so the drift report can NAME which one moved — `.claude/settings.json` and
345
- * `.codex/hooks.json` have different cures, and a fault that says only "the registration is stale" sends
346
- * the reader to the wrong file half the time.
347
- *
348
- * A file that does not exist, or exists and registers no webpieces hooks, is never judged (see
349
- * `registrationStale`). That is what keeps a repo which has never armed Codex from suddenly faulting on
350
- * a `.codex/hooks.json` it does not have.
351
- */
352
- export declare function registrationStaleAt(harness: HarnessRegistration, root: string | null): boolean;
353
- /**
354
- * True when either Claude project settings file under `root` is missing the managed `env` entry.
355
- *
356
- * CLAUDE-ONLY by construction, and stated as such rather than looped over the harnesses: `env` is a
357
- * Claude Code settings surface, Codex has no equivalent, and Codex's cwd is measured not to drift, which
358
- * is the whole thing the entry is for. See HarnessRegistration.managesEnv.
359
- */
360
- export declare function envStaleAt(root: string | null): boolean;
361
- /**
362
- * WHAT was rewritten in ONE settings file. Data-only → a class, per CLAUDE.md.
363
- *
364
- * Two independent flags rather than one path, because the cure has to be able to SAY which repair it
365
- * made: "rewrote the hook registration" printed for a file whose registration was already current and
366
- * whose `env` entry was the only thing missing is a cure lying about its own work.
367
- */
368
- export declare class SettingsRepair {
369
- readonly settingsPath: string;
370
- readonly registration: boolean;
371
- readonly env: boolean;
372
- /**
373
- * The NEW spelling of every NEIGHBOUR hook command this repair anchored — the consumer's own
374
- * entries, which webpieces rewrites but does not author.
375
- *
376
- * The commands themselves rather than a count or a flag, because this is the one repair that
377
- * edits lines webpieces did not write: the cure has to be able to show the consumer exactly what
378
- * it changed in their file, or it is a silent edit to somebody else's hooks.
379
- */
380
- readonly anchoredNeighbours: readonly string[];
381
- constructor(settingsPath: string, registration: boolean, env: boolean,
382
- /**
383
- * The NEW spelling of every NEIGHBOUR hook command this repair anchored — the consumer's own
384
- * entries, which webpieces rewrites but does not author.
385
- *
386
- * The commands themselves rather than a count or a flag, because this is the one repair that
387
- * edits lines webpieces did not write: the cure has to be able to show the consumer exactly what
388
- * it changed in their file, or it is a silent edit to somebody else's hooks.
389
- */
390
- anchoredNeighbours: readonly string[]);
391
- }
392
- /**
393
- * Rewrite every stale settings file under `root`, for EVERY harness; returns what changed, per file.
394
- *
395
- * Existing files only — this never CREATES a registration. Arming a harness is the installer's decision
396
- * (`wp-install-ai-hooks`); this is the cure for one that has already been armed and has drifted, so a
397
- * repo that has never armed Codex is left exactly as it was.
398
- */
399
- export declare function repairRegistrationAt(root: string): readonly SettingsRepair[];
400
- /**
401
- * The names the drift check reports, so a deny can say WHICH surface moved.
402
- *
403
- * There were four, then three, and there are now FOUR again — but the fourth is not the one that was
404
- * deleted. `GUARANTEE_ROOT_SURFACE` went with L-1 itself: an absolutely-registered shim resolves from
405
- * any cwd, so there is no launch guarantee left to police and no second .sh file to keep byte-locked. A
406
- * settings file still carrying the retired H1 entry is not its own surface — it is ordinary REGISTRATION
407
- * drift, which `registrationStaleAt()` reports and `repairRegistration()` fixes by removing it.
408
- *
409
- * The new fourth is `.codex/hooks.json`, and it is here because of what happened while it was NOT a
410
- * managed surface: something else wrote it, with a matcher that matched no Codex file tool and a shim
411
- * path anchored on a variable Codex does not set, and no check in this package could see it. A file the
412
- * guards depend on and nothing validates is the exact shape of that incident.
413
- *
414
- * Each harness's registration surface is its own name, from HarnessRegistration.registrationSurface, so
415
- * the deny sends the reader to the file that actually moved.
416
- */
417
- export declare const SHIM_SURFACE = ".claude/webpieces/ai-hook.sh";
418
- export declare const REGISTRATION_SURFACE: string;
419
- export declare const CODEX_REGISTRATION_SURFACE: string;
420
- export declare const ENV_SURFACE = ".claude/settings.json env.CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR";
421
- export declare const REVIEWER_AGENT_SURFACE = ".claude/agents/webpieces-reviewer.md";
422
- /**
423
- * WHICH of the managed surfaces disagree with this release — the input to fault S.
424
- *
425
- * All of them are checked against the SAME root, resolved from the RUNNING MODULE (governingShimRoot),
426
- * never from cwd and never from `$CLAUDE_PROJECT_DIR`: the files we compare and the renderers we
427
- * compare them TO must come from one install, or the check straddles two trees and can never converge.
428
- */
429
- export declare function managedSurfaceDrift(root: string | null): readonly string[];