checkwright 0.23.0 → 0.24.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 (321) hide show
  1. package/README.md +172 -10
  2. package/lib/common/lock.sh +7 -0
  3. package/lib/common/recipe.sh +1 -1
  4. package/lib/diff.sh +2 -0
  5. package/lib/init.sh +40 -16
  6. package/lib/uninstall.sh +2 -0
  7. package/package.json +2 -2
  8. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
  9. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
  10. package/payload/canon-kit/SPEC.md +125 -13
  11. package/payload/canon-kit/checks/check-amendment-queue.gate +3 -0
  12. package/payload/canon-kit/checks/check-docs-link-convention.gate +3 -0
  13. package/payload/canon-kit/checks/check-knob-default-coupling.gate +3 -0
  14. package/payload/canon-kit/checks/check-prose-tells.gate +3 -0
  15. package/payload/canon-kit/checks/check-spec-embedded-source.gate +3 -0
  16. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/SPEC-orphan.md +6 -0
  17. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/TASK-QUEUE.md +7 -2
  18. package/payload/canon-kit/gate-tests/check-amendment-queue/bad/expect.txt +8 -0
  19. package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.sh +3 -0
  20. package/payload/canon-kit/gate-tests/check-comment-tier/bad/expect.txt +1 -0
  21. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +3 -0
  22. package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +4 -4
  23. package/payload/canon-kit/gate-tests/check-knob-default-coupling.test.sh +2 -2
  24. package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/SPEC-wire.md +18 -0
  25. package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/expect.txt +3 -1
  26. package/payload/canon-kit/gate-tests/check-spec-embedded-source/bad/widget.proto +13 -0
  27. package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/SPEC-wire.md +22 -0
  28. package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/SPEC.md +17 -0
  29. package/payload/canon-kit/gate-tests/check-spec-embedded-source/good/widget.proto +13 -0
  30. package/payload/canon-kit/smoke/install.sh +1 -1
  31. package/payload/context-kit/README.md +6 -4
  32. package/payload/context-kit/SPEC.md +239 -70
  33. package/payload/context-kit/bin/always-loaded.sh +5 -21
  34. package/payload/context-kit/bin/env-probe.sh +2 -17
  35. package/payload/context-kit/checks/check-brevity.gate +3 -0
  36. package/payload/context-kit/checks/check-footprint-fresh.gate +3 -0
  37. package/payload/context-kit/checks/check-memory-off.gate +3 -0
  38. package/payload/context-kit/checks/check-settings-paths.gate +3 -0
  39. package/payload/context-kit/checks/check-settings-pins.gate +3 -0
  40. package/payload/context-kit/gate-tests/check-brevity.test.sh +3 -2
  41. package/payload/context-kit/gate-tests/check-memory-off/bad/scripts/context-config.sh +4 -0
  42. package/payload/context-kit/gate-tests/check-memory-off/good/scripts/context-config.sh +4 -0
  43. package/payload/context-kit/gate-tests/check-memory-off.test.sh +18 -4
  44. package/payload/context-kit/gate-tests/check-settings-pins.test.sh +70 -0
  45. package/payload/context-kit/index-tests/expected/toolfloor.txt +5 -5
  46. package/payload/context-kit/index-tests/toolfloor-cases.sh +5 -5
  47. package/payload/context-kit/lib/context.sh +56 -0
  48. package/payload/context-kit/lib/toolfloor.sh +1 -1
  49. package/payload/context-kit/smoke/agents-md.sh +16 -4
  50. package/payload/context-kit/smoke/install.sh +3 -2
  51. package/payload/context-kit/templates/session-context.sh +5 -5
  52. package/payload/delegation-kit/SPEC.md +284 -9
  53. package/payload/delegation-kit/checks/check-agent-tier-explicit.gate +3 -0
  54. package/payload/delegation-kit/checks/check-gate-tamper.gate +3 -0
  55. package/payload/delegation-kit/checks/check-rule-citation.gate +3 -0
  56. package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/added-exemptions +5 -0
  57. package/payload/delegation-kit/gate-tests/check-gate-tamper/bad/expect.txt +2 -0
  58. package/payload/delegation-kit/gate-tests/check-gate-tamper.test.sh +108 -0
  59. package/payload/delegation-kit/smoke/install.sh +1 -1
  60. package/payload/delegation-kit/templates/agent-execution.md +71 -4
  61. package/payload/doctrine-kit/SPEC.md +1 -1
  62. package/payload/doctrine-kit/checks/check-doctrine-registration.gate +3 -0
  63. package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +2 -3
  64. package/payload/doctrine-kit/smoke/install.sh +17 -4
  65. package/payload/drift-kit/README.md +2 -2
  66. package/payload/drift-kit/SPEC.md +71 -7
  67. package/payload/drift-kit/bin/stage-economics.sh +1 -1
  68. package/payload/drift-kit/lib/drift.sh +43 -0
  69. package/payload/drift-kit/smoke/install.sh +21 -14
  70. package/payload/evidence-kit/README.md +3 -1
  71. package/payload/evidence-kit/SPEC.md +160 -19
  72. package/payload/evidence-kit/checks/check-battery-roster.gate +3 -0
  73. package/payload/evidence-kit/checks/check-evidence-baseline.gate +3 -0
  74. package/payload/evidence-kit/checks/check-evidence-manifest.gate +3 -0
  75. package/payload/evidence-kit/checks/check-producer-liveness.sh +42 -2
  76. package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +4 -3
  77. package/payload/evidence-kit/gate-tests/check-evidence-baseline.test.sh +8 -5
  78. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/WORKFLOW-STATE.txt +1 -1
  79. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/scripts/evidence-config.sh +9 -0
  80. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/WORKFLOW-STATE.txt +1 -1
  81. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/scripts/evidence-config.sh +9 -0
  82. package/payload/evidence-kit/gate-tests/check-evidence-manifest.test.sh +6 -4
  83. package/payload/evidence-kit/gate-tests/producer-lock.test.sh +42 -1
  84. package/payload/evidence-kit/lib/evidence.sh +2 -0
  85. package/payload/evidence-kit/smoke/install.sh +1 -1
  86. package/payload/gate-sdk/README.md +10 -7
  87. package/payload/gate-sdk/SPEC.md +3916 -265
  88. package/payload/gate-sdk/bin/install-hooks.sh +14 -2
  89. package/payload/gate-sdk/bin/port-blockers.sh +37 -9
  90. package/payload/gate-sdk/bin/run-gate-tests.sh +1 -2
  91. package/payload/gate-sdk/bin/run-gates.sh +22 -0
  92. package/payload/gate-sdk/bin/upgrade-smoke.sh +21 -16
  93. package/payload/gate-sdk/checks/check-action-run-shell.sh +1 -0
  94. package/payload/gate-sdk/checks/check-commit-msg.gate +3 -0
  95. package/payload/gate-sdk/checks/check-commit-subject.gate +3 -0
  96. package/payload/gate-sdk/checks/check-core-files.gate +3 -0
  97. package/payload/gate-sdk/checks/check-crate-arms.sh +1 -0
  98. package/payload/gate-sdk/checks/check-enforcement-fresh.gate +3 -0
  99. package/payload/gate-sdk/checks/check-exec-bit.gate +3 -0
  100. package/payload/gate-sdk/checks/check-gate-assertions.sh +1 -0
  101. package/payload/gate-sdk/checks/check-gate-binary-fresh.gate +3 -0
  102. package/payload/gate-sdk/checks/check-gate-exemption-tasks.gate +3 -0
  103. package/payload/gate-sdk/checks/check-gate-fail-closed.gate +3 -0
  104. package/payload/gate-sdk/checks/check-gate-fixture-coverage.gate +3 -0
  105. package/payload/gate-sdk/checks/check-gate-output.gate +3 -0
  106. package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +78 -14
  107. package/payload/gate-sdk/checks/check-graph.gate +3 -0
  108. package/payload/gate-sdk/checks/check-hook-exec-bit.gate +3 -0
  109. package/payload/gate-sdk/checks/check-identity.gate +3 -0
  110. package/payload/gate-sdk/checks/check-install-disposition.sh +1 -0
  111. package/payload/gate-sdk/checks/check-kit-enum.gate +3 -0
  112. package/payload/gate-sdk/checks/check-readme-roster.gate +3 -0
  113. package/payload/gate-sdk/checks/check-reads-couples.gate +3 -0
  114. package/payload/gate-sdk/checks/check-root-tiering.gate +3 -0
  115. package/payload/gate-sdk/checks/check-shellcheck.sh +1 -0
  116. package/payload/gate-sdk/checks/check-template-copy-parity.gate +3 -0
  117. package/payload/gate-sdk/checks/check-tree-terms.sh +1 -0
  118. package/payload/gate-sdk/checks/check-workflow-tiering.gate +3 -0
  119. package/payload/gate-sdk/gate-tests/check-commit-subject.test.sh +17 -12
  120. package/payload/gate-sdk/gate-tests/check-core-files.test.sh +4 -5
  121. package/payload/gate-sdk/gate-tests/check-exec-bit/bad/dump.txt +2 -1
  122. package/payload/gate-sdk/gate-tests/check-exec-bit/bad/expect.txt +2 -1
  123. package/payload/gate-sdk/gate-tests/check-exec-bit/good/dump.txt +3 -0
  124. package/payload/gate-sdk/gate-tests/check-exec-bit/good/expect.txt +1 -1
  125. package/payload/gate-sdk/gate-tests/check-exec-bit.test.sh +3 -4
  126. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +26 -4
  127. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/args +6 -1
  128. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +2 -0
  129. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/kitroot/checks/check-vendored-descriptor.gate +4 -0
  130. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/kitroot/checks/check-vendored.sh +14 -0
  131. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/scripts/check-descriptor.gate +4 -0
  132. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/scripts/check-held.sh +8 -0
  133. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/args +8 -1
  134. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +3 -0
  135. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/kitroot/checks/check-vendored-descriptor.gate +4 -0
  136. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/kitroot/checks/check-vendored.sh +14 -0
  137. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/scripts/check-descriptor.gate +4 -0
  138. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/scripts/check-held.sh +8 -0
  139. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks.test.sh +77 -0
  140. package/payload/gate-sdk/gate-tests/check-gate-output.test.sh +4 -5
  141. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +7 -0
  142. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-alpha.sh +1 -0
  143. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-bare.sh +4 -0
  144. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-both.sh +5 -0
  145. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-heldtwice.sh +5 -0
  146. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-orphan.gate +2 -0
  147. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-twice.sh +5 -0
  148. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +4 -0
  149. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +2 -1
  150. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-alpha.sh +1 -0
  151. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-held.sh +4 -0
  152. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +1 -0
  153. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +49 -4
  154. package/payload/gate-sdk/gate-tests/check-graph/bad/SPEC-example-gate.md +15 -5
  155. package/payload/gate-sdk/gate-tests/check-graph/bad/expect.txt +12 -0
  156. package/payload/gate-sdk/gate-tests/check-graph/good/SPEC-example-gate.md +27 -5
  157. package/payload/gate-sdk/gate-tests/check-graph/good/SPEC-second-gate.md +12 -0
  158. package/payload/gate-sdk/gate-tests/check-graph-cap.test.sh +5 -4
  159. package/payload/gate-sdk/gate-tests/check-graph-refs.test.sh +14 -12
  160. package/payload/gate-sdk/gate-tests/check-graph-theme.test.sh +43 -17
  161. package/payload/gate-sdk/gate-tests/check-graph-tree.test.sh +190 -0
  162. package/payload/gate-sdk/gate-tests/check-identity/bad/gh-hosts.yml +9 -0
  163. package/payload/gate-sdk/gate-tests/check-identity/bad/identity.conf +4 -2
  164. package/payload/gate-sdk/gate-tests/check-identity/bad/scripts/gate-sdk-config.sh +10 -0
  165. package/payload/gate-sdk/gate-tests/check-identity/good/gh-hosts.yml +11 -0
  166. package/payload/gate-sdk/gate-tests/check-identity/good/identity.conf +5 -1
  167. package/payload/gate-sdk/gate-tests/check-identity/good/scripts/gate-sdk-config.sh +10 -0
  168. package/payload/gate-sdk/gate-tests/check-identity.test.sh +114 -0
  169. package/payload/gate-sdk/gate-tests/check-kit-enum/bad/check-native-sample.gate +3 -0
  170. package/payload/gate-sdk/gate-tests/check-kit-enum/bad/gates.list +4 -1
  171. package/payload/gate-sdk/gate-tests/check-kit-enum/good/check-native-sample.gate +3 -0
  172. package/payload/gate-sdk/gate-tests/check-kit-enum/good/expect.txt +1 -1
  173. package/payload/gate-sdk/gate-tests/check-kit-enum/good/gates.list +5 -2
  174. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/args +3 -1
  175. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/delta-kit/README.md +15 -0
  176. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/delta-kit/checks/check-delta-one.gate +2 -0
  177. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/delta-kit/checks/check-delta-two.sh +3 -0
  178. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/expect.txt +3 -1
  179. package/payload/gate-sdk/gate-tests/check-readme-roster/bad/scripts/gate-sdk-config.sh +1 -1
  180. package/payload/gate-sdk/gate-tests/check-readme-roster/good/args +3 -1
  181. package/payload/gate-sdk/gate-tests/check-readme-roster/good/delta-kit/README.md +13 -0
  182. package/payload/gate-sdk/gate-tests/check-readme-roster/good/delta-kit/checks/check-delta-one.gate +2 -0
  183. package/payload/gate-sdk/gate-tests/check-readme-roster/good/epsilon-kit/README.md +14 -0
  184. package/payload/gate-sdk/gate-tests/check-readme-roster/good/epsilon-kit/checks/check-eps-one.sh +3 -0
  185. package/payload/gate-sdk/gate-tests/check-readme-roster/good/epsilon-kit/checks/check-eps-two.gate +2 -0
  186. package/payload/gate-sdk/gate-tests/check-readme-roster/good/scripts/gate-sdk-config.sh +1 -1
  187. package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +87 -89
  188. package/payload/gate-sdk/gate-tests/check-template-copy-parity/good/scripts/agent-budget-guard.sh +4 -0
  189. package/payload/gate-sdk/gate-tests/check-template-copy-parity.test.sh +56 -0
  190. package/payload/gate-sdk/gate-tests/declaration-lib-parity.test.sh +211 -0
  191. package/payload/gate-sdk/gate-tests/enforcement-map.test.sh +16 -15
  192. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +94 -1
  193. package/payload/gate-sdk/lib/gate.sh +232 -25
  194. package/payload/gate-sdk/smoke/install.sh +5 -1
  195. package/payload/guard-kit/SPEC.md +207 -28
  196. package/payload/guard-kit/bin/run-guard-tests.sh +6 -1
  197. package/payload/guard-kit/gate-tests/git-mutation-under-producer.test.sh +105 -0
  198. package/payload/guard-kit/guard-tests/cases.tsv +37 -9
  199. package/payload/guard-kit/lib/guard.sh +170 -6
  200. package/payload/lifecycle-kit/README.md +3 -2
  201. package/payload/lifecycle-kit/SPEC.md +507 -75
  202. package/payload/lifecycle-kit/bin/enter-stage.sh +72 -33
  203. package/payload/lifecycle-kit/bin/file-gap.sh +2 -2
  204. package/payload/lifecycle-kit/checks/check-close-surfaces.gate +3 -0
  205. package/payload/lifecycle-kit/checks/check-stage-entry.gate +3 -0
  206. package/payload/lifecycle-kit/gate-tests/boundary-scratch-wipe.test.sh +4 -4
  207. package/payload/lifecycle-kit/gate-tests/check-close-surfaces.test.sh +1 -1
  208. package/payload/lifecycle-kit/gate-tests/check-stage-entry/bad/.workflow/WORKFLOW-STATE.txt +3 -3
  209. package/payload/lifecycle-kit/gate-tests/check-stage-entry/good/.workflow/WORKFLOW-STATE.txt +3 -3
  210. package/payload/lifecycle-kit/gate-tests/check-stage-entry.test.sh +22 -22
  211. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/bad/.workflow/WORKFLOW-STATE.txt +2 -2
  212. package/payload/lifecycle-kit/gate-tests/check-stage-evidence/good/.workflow/WORKFLOW-STATE.txt +2 -2
  213. package/payload/lifecycle-kit/gate-tests/check-stage-evidence.test.sh +120 -10
  214. package/payload/lifecycle-kit/gate-tests/gap-inbox-route.test.sh +123 -0
  215. package/payload/lifecycle-kit/gate-tests/rename-iteration.test.sh +11 -11
  216. package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +16 -5
  217. package/payload/lifecycle-kit/lib/stages.sh +5 -0
  218. package/payload/lifecycle-kit/smoke/install.sh +29 -15
  219. package/payload/lifecycle-kit/templates/lead.md +24 -0
  220. package/payload/lifecycle-kit/templates/stages/align.md +20 -2
  221. package/payload/lifecycle-kit/templates/stages/build.md +3 -3
  222. package/payload/lifecycle-kit/templates/stages/close.md +20 -6
  223. package/payload/lifecycle-kit/templates/stages/scope.md +20 -1
  224. package/payload/lifecycle-kit/templates/stages/spec.md +1 -1
  225. package/payload/lifecycle-kit/templates/stages/validate.md +1 -1
  226. package/payload/lifecycle-kit/templates/workflow-state-guard.sh +1 -1
  227. package/payload/queue-kit/README.md +10 -10
  228. package/payload/queue-kit/SPEC.md +301 -84
  229. package/payload/queue-kit/bin/queue-counts.sh +1 -1
  230. package/payload/queue-kit/checks/check-queue-entry-budget.gate +1 -1
  231. package/payload/queue-kit/checks/check-queue-prose-precondition.gate +3 -0
  232. package/payload/queue-kit/checks/check-roadmap-fresh.gate +3 -0
  233. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/TASK-QUEUE.md +15 -0
  234. package/payload/queue-kit/gate-tests/check-queue-entry-budget/bad/expect.txt +2 -0
  235. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/TASK-QUEUE.md +7 -0
  236. package/payload/queue-kit/gate-tests/check-queue-entry-budget/good/expect.txt +4 -0
  237. package/payload/queue-kit/gate-tests/check-roadmap-fresh/bad/expect.txt +1 -1
  238. package/payload/queue-kit/gate-tests/queue-counts.test.sh +1 -1
  239. package/payload/queue-kit/gate-tests/queue-index.test.sh +55 -119
  240. package/payload/queue-kit/gate-tests/roadmap.test.sh +22 -12
  241. package/payload/queue-kit/lib/queue.sh +0 -49
  242. package/payload/queue-kit/smoke/install.sh +1 -1
  243. package/payload/site-kit/SPEC.md +29 -2
  244. package/payload/site-kit/checks/check-docs-cname-parity.gate +3 -0
  245. package/payload/site-kit/checks/check-docs-render-fidelity.sh +1 -0
  246. package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/args +5 -4
  247. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/args +6 -5
  248. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/checks/check-sample.gate +3 -0
  249. package/payload/site-kit/gate-tests/check-docs-cname-parity/good/expect.txt +1 -1
  250. package/payload/site-kit/smoke/install.sh +1 -1
  251. package/payload/canon-kit/checks/check-amendment-queue.sh +0 -117
  252. package/payload/canon-kit/checks/check-docs-link-convention.sh +0 -79
  253. package/payload/canon-kit/checks/check-knob-default-coupling.sh +0 -240
  254. package/payload/canon-kit/checks/check-prose-tells.sh +0 -208
  255. package/payload/canon-kit/checks/check-spec-embedded-source.sh +0 -134
  256. package/payload/context-kit/bin/footprint.sh +0 -144
  257. package/payload/context-kit/checks/check-brevity.sh +0 -124
  258. package/payload/context-kit/checks/check-footprint-fresh.sh +0 -39
  259. package/payload/context-kit/checks/check-memory-off.sh +0 -113
  260. package/payload/context-kit/checks/check-settings-paths.sh +0 -94
  261. package/payload/context-kit/checks/check-settings-pins.sh +0 -111
  262. package/payload/context-kit/gate-tests/check-memory-off/bad/args +0 -1
  263. package/payload/context-kit/gate-tests/check-memory-off/good/args +0 -1
  264. package/payload/delegation-kit/checks/check-agent-tier-explicit.sh +0 -62
  265. package/payload/delegation-kit/checks/check-gate-tamper.sh +0 -140
  266. package/payload/delegation-kit/checks/check-rule-citation.sh +0 -77
  267. package/payload/doctrine-kit/checks/check-doctrine-registration.sh +0 -246
  268. package/payload/drift-kit/bin/trajectory.sh +0 -242
  269. package/payload/evidence-kit/checks/check-battery-roster.sh +0 -87
  270. package/payload/evidence-kit/checks/check-evidence-baseline.sh +0 -104
  271. package/payload/evidence-kit/checks/check-evidence-manifest.sh +0 -105
  272. package/payload/evidence-kit/gate-tests/check-evidence-manifest/bad/args +0 -3
  273. package/payload/evidence-kit/gate-tests/check-evidence-manifest/good/args +0 -3
  274. package/payload/gate-sdk/bin/enforcement-map.sh +0 -273
  275. package/payload/gate-sdk/checks/check-commit-msg.sh +0 -51
  276. package/payload/gate-sdk/checks/check-commit-subject.sh +0 -44
  277. package/payload/gate-sdk/checks/check-core-files.sh +0 -76
  278. package/payload/gate-sdk/checks/check-enforcement-fresh.sh +0 -38
  279. package/payload/gate-sdk/checks/check-exec-bit.sh +0 -96
  280. package/payload/gate-sdk/checks/check-gate-binary-fresh.sh +0 -107
  281. package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +0 -106
  282. package/payload/gate-sdk/checks/check-gate-fail-closed.sh +0 -85
  283. package/payload/gate-sdk/checks/check-gate-fixture-coverage.sh +0 -93
  284. package/payload/gate-sdk/checks/check-gate-output.sh +0 -103
  285. package/payload/gate-sdk/checks/check-graph.sh +0 -632
  286. package/payload/gate-sdk/checks/check-hook-exec-bit.sh +0 -46
  287. package/payload/gate-sdk/checks/check-identity.sh +0 -135
  288. package/payload/gate-sdk/checks/check-kit-enum.sh +0 -95
  289. package/payload/gate-sdk/checks/check-readme-roster.sh +0 -108
  290. package/payload/gate-sdk/checks/check-reads-couples.sh +0 -200
  291. package/payload/gate-sdk/checks/check-root-tiering.sh +0 -67
  292. package/payload/gate-sdk/checks/check-template-copy-parity.sh +0 -127
  293. package/payload/gate-sdk/checks/check-workflow-tiering.sh +0 -85
  294. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/args +0 -1
  295. package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/args +0 -1
  296. package/payload/gate-sdk/gate-tests/check-identity/bad/args +0 -1
  297. package/payload/gate-sdk/gate-tests/check-identity/good/args +0 -1
  298. package/payload/lifecycle-kit/bin/close-surfaces.sh +0 -94
  299. package/payload/lifecycle-kit/checks/check-close-surfaces.sh +0 -64
  300. package/payload/lifecycle-kit/checks/check-stage-entry.sh +0 -198
  301. package/payload/queue-kit/bin/queue-index.sh +0 -182
  302. package/payload/queue-kit/bin/roadmap.sh +0 -76
  303. package/payload/queue-kit/checks/check-queue-prose-precondition.sh +0 -64
  304. package/payload/queue-kit/checks/check-roadmap-fresh.sh +0 -111
  305. package/payload/site-kit/checks/check-docs-cname-parity.sh +0 -81
  306. /package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/{gates → scripts}/check-sample.sh +0 -0
  307. /package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/{gates → scripts}/check-sample.sh +0 -0
  308. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/{check-gamma.sh → scripts/check-gamma.sh} +0 -0
  309. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/{gate-tests → scripts/gate-tests}/check-alpha/bad/.keep +0 -0
  310. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/{gate-tests → scripts/gate-tests}/check-alpha/good/.keep +0 -0
  311. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/bad/{gates.list → scripts/gates.list} +0 -0
  312. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/{check-beta.sh → scripts/check-beta.sh} +0 -0
  313. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/{gate-tests → scripts/gate-tests}/check-alpha/bad/.keep +0 -0
  314. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/{gate-tests → scripts/gate-tests}/check-alpha/good/.keep +0 -0
  315. /package/payload/gate-sdk/gate-tests/check-gate-fixture-coverage/good/{gates.list → scripts/gates.list} +0 -0
  316. /package/payload/site-kit/gate-tests/check-docs-cname-parity/bad/{site-config.sh → scripts/site-config.sh} +0 -0
  317. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{tree → docs}/CNAME +0 -0
  318. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{tree → docs}/index.md +0 -0
  319. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{tree/docs → docs}/posts/2026-01-01-legacy.md +0 -0
  320. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{tree/pkg → pkg}/gate-tests/fixture.md +0 -0
  321. /package/payload/site-kit/gate-tests/check-docs-cname-parity/good/{site-config.sh → scripts/site-config.sh} +0 -0
@@ -1,111 +0,0 @@
1
- #!/usr/bin/env bash
2
- # graph: couples=.claude/settings.json,scripts/settings-pins.conf dir=one valve=none tier=precommit
3
- # install: on-surface
4
- # spec: context-kit/SPEC.md §check-settings-pins — every pin in the pins file holds against the tracked harness settings file
5
- #
6
- # usage: check-settings-pins.sh [--fixture <dir>]
7
- # live: pins CONTEXT_KIT_SETTINGS_PINS against CONTEXT_KIT_SETTINGS_FILE;
8
- # --fixture <dir> reads <dir>/settings.json against <dir>/settings-pins.conf
9
- set -uo pipefail
10
-
11
- KIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
12
- SDK="${GATE_SDK_ROOT:-$KIT/../gate-sdk}"
13
- # shellcheck source=../../gate-sdk/lib/gate.sh
14
- source "$SDK/lib/gate.sh"
15
-
16
- _ck_cfg="${CONTEXT_KIT_CONFIG_FILE:-}"
17
- if [[ -n "$_ck_cfg" ]]; then
18
- [[ -f "$_ck_cfg" ]] || {
19
- echo "context-kit: CONTEXT_KIT_CONFIG_FILE not found: $_ck_cfg" >&2
20
- exit 2
21
- }
22
- # shellcheck source=/dev/null # consumer config path is resolved at runtime
23
- source "$_ck_cfg"
24
- else
25
- _ck_cfg="${GATE_SDK_GATES_DIR:-scripts}/context-config.sh"
26
- if [[ -f "$_ck_cfg" ]]; then
27
- # shellcheck source=/dev/null # consumer config path is resolved at runtime
28
- source "$_ck_cfg"
29
- fi
30
- fi
31
- unset _ck_cfg
32
-
33
- MODE=live
34
- FIXTURE_DIR=""
35
- while [[ $# -gt 0 ]]; do
36
- case "$1" in
37
- --fixture) MODE=fixture; FIXTURE_DIR="${2:-}"; shift 2 ;;
38
- -*) echo "check-settings-pins: unknown argument: $1" >&2; exit 2 ;;
39
- *) echo "check-settings-pins: unexpected argument: $1" >&2; exit 2 ;;
40
- esac
41
- done
42
-
43
- if [[ "$MODE" == fixture ]]; then
44
- [[ -d "$FIXTURE_DIR" ]] || { echo "check-settings-pins: fixture dir not found: $FIXTURE_DIR" >&2; exit 2; }
45
- SETTINGS_FILE="$FIXTURE_DIR/settings.json"
46
- PINS_FILE="$FIXTURE_DIR/settings-pins.conf"
47
- else
48
- : "${CONTEXT_KIT_SETTINGS_FILE:=.claude/settings.json}"
49
- : "${CONTEXT_KIT_SETTINGS_PINS:=${GATE_SDK_GATES_DIR:-scripts}/settings-pins.conf}"
50
- SETTINGS_FILE="$CONTEXT_KIT_SETTINGS_FILE"
51
- PINS_FILE="$CONTEXT_KIT_SETTINGS_PINS"
52
- fi
53
-
54
- # spec: context-kit/SPEC.md §check-settings-pins — absent pins file is the opt-in-off state, not a failure (the identity.conf precedent)
55
- if [[ ! -e "$PINS_FILE" ]]; then
56
- echo "SETTINGS-PINS: clean (no pins file at $PINS_FILE — optional consumer config absent)"
57
- exit 0
58
- fi
59
- [[ -r "$PINS_FILE" ]] || { echo "check-settings-pins: pins file not readable: $PINS_FILE" >&2; exit 2; }
60
-
61
- command -v jq >/dev/null 2>&1 || { echo "check-settings-pins: jq not found — cannot read $SETTINGS_FILE" >&2; exit 2; }
62
- [[ -r "$SETTINGS_FILE" ]] || { echo "check-settings-pins: settings file not readable: $SETTINGS_FILE" >&2; exit 2; }
63
- jq -e . "$SETTINGS_FILE" >/dev/null 2>&1 || { echo "check-settings-pins: $SETTINGS_FILE is not valid JSON" >&2; exit 2; }
64
-
65
- malformed=(); absent=(); mismatches=(); checked=0
66
- while IFS= read -r line; do
67
- path="${line%%=*}"; path="${path#"${path%%[![:space:]]*}"}"; path="${path%"${path##*[![:space:]]}"}"
68
- expected="${line#*=}"; expected="${expected#"${expected%%[![:space:]]*}"}"; expected="${expected%"${expected##*[![:space:]]}"}"
69
- if [[ "$line" != *=* || -z "$path" || -z "$expected" || "$path" != .* ]]; then
70
- malformed+=("$line")
71
- continue
72
- fi
73
- actual="$(jq -c "$path" "$SETTINGS_FILE" 2>/dev/null)"; st=$?
74
- if [[ "$st" -ne 0 ]]; then
75
- malformed+=("$line (jq could not evaluate path '$path')")
76
- continue
77
- fi
78
- checked=$((checked + 1))
79
- if [[ "$actual" == "$expected" ]]; then
80
- continue
81
- fi
82
- # spec: context-kit/SPEC.md §check-settings-pins — a pin naming an absent key is a desynced manifest (fail-closed), a present-but-wrong value is the legible violation
83
- if [[ "$actual" == "null" ]]; then
84
- absent+=("$path — pin expects $expected, but $SETTINGS_FILE has no such key")
85
- else
86
- mismatches+=("$path — pin expects $expected, settings has $actual")
87
- fi
88
- done < <(gates_list_members "$PINS_FILE")
89
-
90
- if [[ ${#malformed[@]} -gt 0 ]]; then
91
- echo "check-settings-pins: malformed pin(s) in $PINS_FILE (expected '<jq path> = <expected JSON>'):" >&2
92
- printf ' %s\n' "${malformed[@]}" >&2
93
- exit 2
94
- fi
95
- if [[ ${#absent[@]} -gt 0 ]]; then
96
- echo "check-settings-pins: pinned key absent from $SETTINGS_FILE — the manifest and settings have desynced:" >&2
97
- printf ' %s\n' "${absent[@]}" >&2
98
- echo " help: add the key to $SETTINGS_FILE, or drop the pin from $PINS_FILE if the key was retired" >&2
99
- exit 2
100
- fi
101
-
102
- if [[ ${#mismatches[@]} -gt 0 ]]; then
103
- echo "check-settings-pins: $SETTINGS_FILE does not match $PINS_FILE:"
104
- printf ' %s\n' "${mismatches[@]}"
105
- echo " help: restore each key in $SETTINGS_FILE to its pinned value, or — if the"
106
- echo " expectation itself moved — update the matching line in $PINS_FILE."
107
- exit 1
108
- fi
109
-
110
- echo "SETTINGS-PINS: clean ($checked pin(s) hold against $SETTINGS_FILE)"
111
- exit 0
@@ -1,62 +0,0 @@
1
- #!/usr/bin/env bash
2
- # graph: couples=.claude/agents/*.md dir=one valve=none tier=precommit
3
- # install: on-surface
4
- # spec: delegation-kit/SPEC.md §check-agent-tier-explicit — every agent definition under the scanned directory declares a `model:` field in its frontmatter (an explicit `inherit` passes; only omission reds)
5
- #
6
- # usage: check-agent-tier-explicit.sh [agent-dir]
7
- # defaults DELEGATION_KIT_AGENT_DIR; a fixture passes its own directory.
8
- set -uo pipefail
9
-
10
- KIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
11
- SDK="${GATE_SDK_ROOT:-$KIT/../gate-sdk}"
12
- # shellcheck source=../../gate-sdk/lib/gate.sh
13
- source "$SDK/lib/gate.sh"
14
- # shellcheck source=../lib/delegation.sh
15
- source "$KIT/lib/delegation.sh"
16
-
17
- DIR="${1:-$DELEGATION_KIT_AGENT_DIR}"; DIR="${DIR%/}"
18
-
19
- if [[ ! -d "$DIR" ]]; then
20
- echo "AGENT-TIER-EXPLICIT: clean (0 agent definition(s) under $DIR; no agent-definition directory)"
21
- exit 0
22
- fi
23
-
24
- listing="$(find "$DIR" -type f -name '*.md' | LC_ALL=C sort)"; st=$?
25
- fail_closed "$st" AGENT-TIER-EXPLICIT find
26
-
27
- files=()
28
- while IFS= read -r path; do
29
- [[ -n "$path" ]] || continue
30
- gate_path_pruned "$path" && continue
31
- files+=("$path")
32
- done <<< "$listing"
33
-
34
- if [[ ${#files[@]} -eq 0 ]]; then
35
- echo "AGENT-TIER-EXPLICIT: clean (0 agent definition(s) under $DIR; nothing to check)"
36
- exit 0
37
- fi
38
-
39
- bare="$(awk '
40
- FNR == 1 { if (fname != "" && !seen) print fname; fname = FILENAME; seen = 0; open = 0; shut = 0; ln = 0 }
41
- { ln++ }
42
- ln == 1 { if ($0 == "---") open = 1; else shut = 1; next }
43
- shut || !open { next }
44
- $0 == "---" { shut = 1; next }
45
- $0 ~ /^model:[[:space:]]*[^[:space:]]/ { seen = 1 }
46
- END { if (fname != "" && !seen) print fname }
47
- ' "${files[@]}")"; st=$?
48
- fail_closed "$st" AGENT-TIER-EXPLICIT awk
49
-
50
- if [[ -n "$bare" ]]; then
51
- echo "check-agent-tier-explicit: agent definition(s) whose frontmatter omits the model: field:"
52
- while IFS= read -r f; do
53
- [[ -n "$f" ]] && echo " $f: no 'model:' field in frontmatter"
54
- done <<< "$bare"
55
- echo " help: state the tier in the definition's frontmatter — an omitted model: is not a neutral"
56
- echo " default but the literal 'inherit' (the dispatcher's tier), so declare it even when"
57
- echo " the answer is to inherit; 'model: inherit' passes."
58
- exit 1
59
- fi
60
-
61
- echo "AGENT-TIER-EXPLICIT: clean (${#files[@]} agent definition(s) under $DIR, each declaring an explicit model:)"
62
- exit 0
@@ -1,140 +0,0 @@
1
- #!/usr/bin/env bash
2
- # graph: couples=kit:*.sh dir=one valve=none tier=precommit
3
- # install: zero-config
4
- # spec: delegation-kit/SPEC.md §Verify after every agent commit — a gate-weakening commit is blocked by shape (A gate edits stay meta-isolated; B a new path-exemption can't excuse a co-staged file)
5
- #
6
- # --fixture <dir> injects staged-files / added-exemptions lists; live mode reads git diff --cached.
7
- set -uo pipefail
8
-
9
- KIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
10
- # shellcheck source=../lib/delegation.sh
11
- source "$KIT/lib/delegation.sh"
12
-
13
- is_meta() {
14
- local p="$1" pre
15
- for pre in "${DELEGATION_KIT_META_PATHS[@]}"; do
16
- [[ "$p" == "$pre"* ]] && return 0
17
- done
18
- [[ "$p" == *.md && "$p" != */* ]] && return 0 # root-level *.md is always meta
19
- return 1
20
- }
21
-
22
- is_gate_file() {
23
- local p="$1" g
24
- for g in "${DELEGATION_KIT_GATE_FILES[@]}"; do
25
- # shellcheck disable=SC2053 # $g is a glob pattern by design here
26
- [[ "$p" == $g ]] && return 0
27
- done
28
- return 1
29
- }
30
-
31
- is_pathlike() {
32
- case "$1" in
33
- */* | *'*'* | *'?'* | *'['*) return 0 ;;
34
- *) return 1 ;;
35
- esac
36
- }
37
-
38
- extract_exemptions() {
39
- awk '
40
- /^[[:space:]]*#[[:space:]]*exception-list:/ { tag=1; next }
41
- tag==1 && /^[[:space:]]*[A-Za-z_][A-Za-z0-9_]*=\(/ {
42
- tag=0; inarr=1
43
- line=$0; sub(/#.*/,"",line)
44
- ob=gsub(/\(/,"",line); cb=gsub(/\)/,"",line)
45
- bal=ob-cb
46
- if (bal<=0) inarr=0
47
- next
48
- }
49
- inarr==1 {
50
- line=$0; sub(/#.*/,"",line)
51
- ob=gsub(/\(/,"",line); cb=gsub(/\)/,"",line)
52
- v=line; sub(/^[[:space:]]+/,"",v); sub(/[[:space:]].*$/,"",v)
53
- gsub(/\047/,"",v); gsub(/"/,"",v)
54
- if (v != "" && v !~ /^[)(]/) print v
55
- bal += ob - cb
56
- if (bal<=0) inarr=0
57
- }
58
- '
59
- }
60
-
61
- declare -a STAGED=() ADDED=()
62
-
63
- collect_live() {
64
- mapfile -t STAGED < <(git diff --cached --name-only 2>/dev/null)
65
- local f new old v
66
- declare -A added_set=()
67
- for f in "${STAGED[@]}"; do
68
- is_gate_file "$f" || continue
69
- new="$(git show ":$f" 2>/dev/null)" || new=""
70
- old="$(git show "HEAD:$f" 2>/dev/null)" || old=""
71
- declare -A old_set=()
72
- while IFS= read -r v; do [[ -n "$v" ]] && old_set["$v"]=1; done \
73
- < <(printf '%s\n' "$old" | extract_exemptions)
74
- while IFS= read -r v; do
75
- [[ -n "$v" && -z "${old_set[$v]:-}" ]] && added_set["$v"]=1
76
- done < <(printf '%s\n' "$new" | extract_exemptions)
77
- unset old_set
78
- done
79
- ADDED=("${!added_set[@]}")
80
- }
81
-
82
- collect_fixture() {
83
- local dir="$1"
84
- [[ -d "$dir" ]] || { echo "check-gate-tamper: fixture dir not found: $dir" >&2; exit 2; }
85
- [[ -f "$dir/staged-files" ]] &&
86
- mapfile -t STAGED < <(grep -vE '^[[:space:]]*(#|$)' "$dir/staged-files")
87
- [[ -f "$dir/added-exemptions" ]] &&
88
- mapfile -t ADDED < <(grep -vE '^[[:space:]]*(#|$)' "$dir/added-exemptions")
89
- }
90
-
91
- MODE=live
92
- FIXTURE_DIR=""
93
- while [[ $# -gt 0 ]]; do
94
- case "$1" in
95
- --fixture) MODE=fixture; FIXTURE_DIR="${2:-}"; shift 2 ;;
96
- *) echo "check-gate-tamper: unknown argument: $1" >&2; exit 2 ;;
97
- esac
98
- done
99
-
100
- if [[ "$MODE" == fixture ]]; then
101
- collect_fixture "$FIXTURE_DIR"
102
- else
103
- collect_live
104
- fi
105
-
106
- viol_a=()
107
- viol_b=()
108
-
109
- # assertion A: gate-edit-isolation
110
- gate_touched=0
111
- for f in "${STAGED[@]}"; do is_gate_file "$f" && { gate_touched=1; break; }; done
112
- if [[ "$gate_touched" -eq 1 ]]; then
113
- for f in "${STAGED[@]}"; do is_meta "$f" || viol_a+=("$f"); done
114
- fi
115
-
116
- # assertion B: no-self-serving-exemption
117
- for e in "${ADDED[@]}"; do
118
- is_pathlike "$e" || continue
119
- for f in "${STAGED[@]}"; do
120
- # shellcheck disable=SC2053 # $e is a glob pattern by design here
121
- [[ "$f" == $e ]] && viol_b+=("$e -> $f")
122
- done
123
- done
124
-
125
- if [[ ${#viol_a[@]} -gt 0 || ${#viol_b[@]} -gt 0 ]]; then
126
- if [[ ${#viol_a[@]} -gt 0 ]]; then
127
- echo "check-gate-tamper: gate edit not isolated — a commit touching a gate file (${DELEGATION_KIT_GATE_FILES[*]}) may touch only meta-layer paths; these co-staged paths are not:"
128
- printf ' %s\n' "${viol_a[@]}"
129
- echo " help: split the gate change into its own commit (meta-layer paths only: ${DELEGATION_KIT_META_PATHS[*]} and root *.md); land the product change in a separate commit"
130
- fi
131
- if [[ ${#viol_b[@]} -gt 0 ]]; then
132
- echo "check-gate-tamper: self-serving exemption — a newly added path/glob exemption matches a file staged in the same commit:"
133
- printf ' %s\n' "${viol_b[@]}"
134
- echo " help: an exemption must not excuse the very change it lands with; add the exemption in a separate commit, or drop the matched file from this commit"
135
- fi
136
- exit 1
137
- fi
138
-
139
- echo "GATE-TAMPER: clean (${#STAGED[@]} staged path(s); gate edits meta-isolated, no self-serving path-exemption)"
140
- exit 0
@@ -1,77 +0,0 @@
1
- #!/usr/bin/env bash
2
- # graph: couples=delegation-kit/SPEC.md,delegation-kit/templates/agent-execution.md dir=one valve=none tier=precommit
3
- # install: on-surface
4
- # spec: delegation-kit/SPEC.md §One template, a resident pointer — every `the template's **<name>** rule` citation in SPEC §The delegation model resolves to a template bullet's bold lead-in (forward direction only)
5
- #
6
- # usage: check-rule-citation.sh [spec-file [template-file]]
7
- # paths resolve relative to cwd (= repo root in a battery run); fixtures pass
8
- # their own spec + template as the two positional arguments.
9
- set -uo pipefail
10
-
11
- KIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
12
- SDK="${GATE_SDK_ROOT:-$KIT/../gate-sdk}"
13
- # shellcheck source=../../gate-sdk/lib/gate.sh
14
- source "$SDK/lib/gate.sh"
15
-
16
- SPEC_FILE="${1:-delegation-kit/SPEC.md}"
17
- TEMPLATE_FILE="${2:-delegation-kit/templates/agent-execution.md}"
18
- for f in "$SPEC_FILE" "$TEMPLATE_FILE"; do
19
- [[ -f "$f" ]] || { echo "check-rule-citation: not found: $f" >&2; exit 2; } # exit 2: fail-closed
20
- done
21
-
22
- tmpl_out="$(awk '
23
- /^- \*\*/ {
24
- line=$0; sub(/^- /,"",line)
25
- rest=substr(line,3)
26
- p=index(rest,"**")
27
- if (p>0) {
28
- name=substr(rest,1,p-1)
29
- sub(/\.$/,"",name)
30
- gsub(/`[^`]*`/,"",name)
31
- print name
32
- }
33
- }' "$TEMPLATE_FILE")"; st=$?
34
- fail_closed "$st" check-rule-citation awk
35
-
36
- declare -A LEADIN=()
37
- while IFS= read -r n; do [[ -n "$n" ]] && LEADIN["$n"]=1; done <<<"$tmpl_out"
38
-
39
- cite_out="$(awk '
40
- /^## The delegation model[[:space:]]*$/ { insec=1; next }
41
- /^## / { insec=0 }
42
- insec { sec = sec " " $0 }
43
- END {
44
- gsub(/`[^`]*`/, "", sec)
45
- n=length(sec); i=1
46
- while (i<=n) {
47
- op=index(substr(sec,i),"**"); if (op==0) break
48
- op=i+op-1; after=op+2
49
- cl=index(substr(sec,after),"**"); if (cl==0) break
50
- cl=after+cl-1
51
- name=substr(sec,after,cl-after)
52
- tail=substr(sec,cl+2)
53
- if (tail ~ /^[[:space:]]+(rule|bullet)([^[:alnum:]]|$)/) {
54
- c=name; sub(/\.$/,"",c); print c
55
- }
56
- i=cl+2
57
- }
58
- }' "$SPEC_FILE")"; st=$?
59
- fail_closed "$st" check-rule-citation awk
60
-
61
- unresolved=()
62
- cites=0
63
- while IFS= read -r c; do
64
- [[ -n "$c" ]] || continue
65
- cites=$((cites + 1))
66
- [[ -n "${LEADIN[$c]:-}" ]] || unresolved+=("$c")
67
- done <<<"$cite_out"
68
-
69
- if [[ ${#unresolved[@]} -gt 0 ]]; then
70
- echo "check-rule-citation: SPEC §The delegation model cites a rule that does not resolve to a template lead-in in $TEMPLATE_FILE:"
71
- printf ' **%s**\n' "${unresolved[@]}"
72
- echo " help: a citation names a template bullet's bold lead-in verbatim (minus its trailing period); fix the name or the renamed lead-in — delegation-kit/SPEC.md §One template, a resident pointer"
73
- exit 1
74
- fi
75
-
76
- echo "RULE-CITATION: clean ($cites citation(s) in SPEC §The delegation model each resolve to a template lead-in; ${#LEADIN[@]} lead-in(s) available)"
77
- exit 0
@@ -1,246 +0,0 @@
1
- #!/usr/bin/env bash
2
- # graph: couples=CLAUDE.md,doctrine-kit/DOCTRINE.md dir=one valve=none tier=precommit
3
- # install: zero-config
4
- # spec: doctrine-kit/SPEC.md §check-doctrine-registration — the always-loaded agent file links the doctrine file and holds its methodology-rule digest in per-rule lockstep with DOCTRINE.md, fail-closed when a scanned file or section is missing
5
- #
6
- # usage: check-doctrine-registration.sh [agent-file [doctrine-file]]
7
- # paths resolve relative to cwd (= repo root in a battery run); defaults come
8
- # from DOCTRINE_KIT_AGENT_FILE / DOCTRINE_KIT_DOCTRINE_FILE (doctrine-kit/lib/doctrine.sh).
9
- set -uo pipefail
10
-
11
- KIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
12
- SDK="${GATE_SDK_ROOT:-$KIT/../gate-sdk}"
13
- # shellcheck source=../../gate-sdk/lib/gate.sh
14
- source "$SDK/lib/gate.sh"
15
- # shellcheck source=../lib/doctrine.sh
16
- source "$KIT/lib/doctrine.sh"
17
-
18
- AGENT_FILE="${1:-$DOCTRINE_KIT_AGENT_FILE}"
19
- DOCTRINE_FILE="${2:-$DOCTRINE_KIT_DOCTRINE_FILE}"
20
- [[ -f "$AGENT_FILE" ]] \
21
- || { echo "check-doctrine-registration: agent file not found: $AGENT_FILE" >&2; exit 2; } # exit 2: fail-closed
22
-
23
- # spec: doctrine-kit/SPEC.md §check-doctrine-registration — the doctrine-side section headings are kit mechanism (the kit ships DOCTRINE.md), never config
24
- METH_SECTION="## Methodology-maintenance rules"
25
- CRAFT_SECTION="## Engineering-craft rules"
26
-
27
- grep -qF -- "]($DOCTRINE_FILE" "$AGENT_FILE"; st=$?
28
- if [[ "$st" -ne 0 ]]; then
29
- [[ "$st" -eq 1 ]] || fail_closed "$st" check-doctrine-registration grep
30
- echo "check-doctrine-registration: $AGENT_FILE carries no markdown link to the doctrine file:"
31
- echo " $DOCTRINE_FILE"
32
- echo " help: install the doctrine reference block into the always-loaded agent file —"
33
- echo " bash doctrine-kit/bin/install-doctrine.sh — so a session that loads it"
34
- echo " follows the link to the delivery doctrine. Override the paths with"
35
- echo " DOCTRINE_KIT_AGENT_FILE / DOCTRINE_KIT_DOCTRINE_FILE."
36
- exit 1
37
- fi
38
-
39
- [[ -f "$DOCTRINE_FILE" ]] \
40
- || { echo "check-doctrine-registration: doctrine file not found: $DOCTRINE_FILE" >&2; exit 2; } # exit 2: fail-closed
41
-
42
- read -r -d '' SECTION_WALK <<'AWK' || true
43
- function hlevel(line, n) {
44
- if (line !~ /^#+[[:space:]]/) return 0
45
- n = 0
46
- while (substr(line, n + 1, 1) == "#") n++
47
- return n
48
- }
49
- # Enter the governed section: heading line whose text starts with the knob.
50
- !insec {
51
- if (hlevel($0) > 0 && substr($0, 1, length(section)) == section) {
52
- insec = 1; seen = 1; start_lvl = hlevel($0)
53
- }
54
- next
55
- }
56
- # A heading at the same level or higher closes the section.
57
- insec && hlevel($0) > 0 && hlevel($0) <= start_lvl { insec = 0; next }
58
- insec {
59
- if (mode == "doctrine") {
60
- # Numbered rule lead-in: bold name, trailing in-bold period dropped.
61
- if ($0 ~ /^[0-9]+\.[[:space:]]+\*\*/) {
62
- name = $0
63
- sub(/^[0-9]+\.[[:space:]]+\*\*/, "", name)
64
- sub(/\*\*.*/, "", name)
65
- sub(/\.$/, "", name)
66
- print "R\t" name
67
- }
68
- } else {
69
- # Digest bullet lead-in.
70
- if ($0 ~ /^- \*\*/) {
71
- name = $0
72
- sub(/^- \*\*/, "", name)
73
- sub(/\*\*.*/, "", name)
74
- print "D\t" name
75
- # Declared trim: <!-- doctrine-digest-trim: <rule name> — <reason> -->
76
- } else if ($0 ~ /doctrine-digest-trim:/) {
77
- name = $0
78
- sub(/^.*doctrine-digest-trim:[[:space:]]*/, "", name)
79
- sub(/[[:space:]]*—.*$/, "", name)
80
- print "T\t" name
81
- }
82
- }
83
- next
84
- }
85
- END { if (!seen) print "@@NOSECTION" }
86
- AWK
87
-
88
- # spec: doctrine-kit/SPEC.md §check-doctrine-registration — assertions D and E share one walk over a register's numbered rules, counting a named per-rule trailer and grading its value: D is `Stages` over the craft register, E is `Digest` over the methodology register
89
- read -r -d '' TRAILER_WALK <<'AWK' || true
90
- function hlevel(line, n) {
91
- if (line !~ /^#+[[:space:]]/) return 0
92
- n = 0
93
- while (substr(line, n + 1, 1) == "#") n++
94
- return n
95
- }
96
- function flush() {
97
- if (have) print "C\t" cur_name "\t" tcount "\t" bad
98
- }
99
- BEGIN {
100
- mark = "^[[:space:]]*\\*" trailer ":\\*"
101
- strip = mark "[[:space:]]*"
102
- }
103
- !insec {
104
- if (hlevel($0) > 0 && substr($0, 1, length(section)) == section) {
105
- insec = 1; seen = 1; start_lvl = hlevel($0)
106
- }
107
- next
108
- }
109
- insec && hlevel($0) > 0 && hlevel($0) <= start_lvl { flush(); insec = 0; have = 0; next }
110
- insec {
111
- if ($0 ~ /^[0-9]+\.[[:space:]]+\*\*/) {
112
- flush()
113
- name = $0
114
- sub(/^[0-9]+\.[[:space:]]+\*\*/, "", name)
115
- sub(/\*\*.*/, "", name)
116
- sub(/\.$/, "", name)
117
- cur_name = name; have = 1; tcount = 0; bad = 0
118
- } else if ($0 ~ mark) {
119
- tcount++
120
- val = $0
121
- sub(strip, "", val)
122
- sub(/[[:space:]]+$/, "", val)
123
- if (grammar == "stages") {
124
- if (val != "—" && val !~ /^[a-z]+(,[[:space:]]+[a-z]+)*$/) bad = 1
125
- } else if (val == "") bad = 1
126
- }
127
- next
128
- }
129
- END { flush(); if (!seen) print "@@NOSECTION" }
130
- AWK
131
-
132
- doctrine_out="$(awk -v section="$METH_SECTION" -v mode=doctrine "$SECTION_WALK" "$DOCTRINE_FILE")"; st=$?
133
- fail_closed "$st" check-doctrine-registration awk
134
- if [[ "$doctrine_out" == "@@NOSECTION" ]]; then
135
- echo "check-doctrine-registration: no '$METH_SECTION' section in $DOCTRINE_FILE — cannot certify the digest against an unreadable rule set" >&2
136
- echo " help: the methodology-maintenance section heading is kit mechanism; restore it in the doctrine file" >&2
137
- exit 2 # exit 2: fail-closed
138
- fi
139
-
140
- digest_out="$(awk -v section="$DOCTRINE_KIT_DIGEST_SECTION" -v mode=digest "$SECTION_WALK" "$AGENT_FILE")"; st=$?
141
- fail_closed "$st" check-doctrine-registration awk
142
- if [[ "$digest_out" == "@@NOSECTION" ]]; then
143
- printf 'check-doctrine-registration: no heading matches %s in %s: %s\n' \
144
- DOCTRINE_KIT_DIGEST_SECTION "$AGENT_FILE" "'$DOCTRINE_KIT_DIGEST_SECTION'" >&2
145
- echo " help: a renamed or deleted digest section silently disarms this gate — repoint DOCTRINE_KIT_DIGEST_SECTION at the live heading, or restore the heading it names" >&2
146
- exit 2 # exit 2: fail-closed
147
- fi
148
-
149
- craft_out="$(awk -v section="$CRAFT_SECTION" -v trailer=Stages -v grammar=stages "$TRAILER_WALK" "$DOCTRINE_FILE")"; st=$?
150
- fail_closed "$st" check-doctrine-registration awk
151
- if [[ "$craft_out" == "@@NOSECTION" ]]; then
152
- echo "check-doctrine-registration: no '$CRAFT_SECTION' section in $DOCTRINE_FILE — cannot certify the stage-routing trailers against an unreadable rule set" >&2
153
- echo " help: the engineering-craft section heading is kit mechanism; restore it in the doctrine file" >&2
154
- exit 2 # exit 2: fail-closed
155
- fi
156
-
157
- craft_count=0
158
- craft_findings=()
159
- while IFS=$'\t' read -r kind name scount bad; do
160
- [[ "$kind" == C ]] || continue
161
- craft_count=$((craft_count + 1))
162
- if [[ "$scount" -ne 1 ]]; then
163
- craft_findings+=("craft rule carries $scount *Stages:* trailer(s), want exactly one: $name")
164
- elif [[ "$bad" == 1 ]]; then
165
- craft_findings+=("craft rule's *Stages:* value is malformed (want a comma list of lowercase stages, or —): $name")
166
- fi
167
- done <<< "$craft_out"
168
-
169
- # spec: doctrine-kit/SPEC.md §check-doctrine-registration — assertion E: every methodology rule carries exactly one non-empty *Digest:* trailer, the surface install-doctrine derives its bullet from
170
- meth_out="$(awk -v section="$METH_SECTION" -v trailer=Digest -v grammar=digest "$TRAILER_WALK" "$DOCTRINE_FILE")"; st=$?
171
- fail_closed "$st" check-doctrine-registration awk
172
-
173
- digest_findings=()
174
- while IFS=$'\t' read -r kind name dcount bad; do
175
- [[ "$kind" == C ]] || continue
176
- if [[ "$dcount" -ne 1 ]]; then
177
- digest_findings+=("methodology rule carries $dcount *Digest:* trailer(s), want exactly one: $name")
178
- elif [[ "$bad" == 1 ]]; then
179
- digest_findings+=("methodology rule's *Digest:* value is empty: $name")
180
- fi
181
- done <<< "$meth_out"
182
-
183
- declare -A in_digest in_trim in_doctrine
184
- digest_names=()
185
- trim_count=0
186
- while IFS=$'\t' read -r kind name; do
187
- [[ -n "$name" ]] || continue
188
- case "$kind" in
189
- D) digest_names+=("$name"); in_digest["$name"]=1 ;;
190
- T) in_trim["$name"]=1; trim_count=$((trim_count + 1)) ;;
191
- esac
192
- done <<< "$digest_out"
193
-
194
- rule_count=0
195
- missing=()
196
- while IFS=$'\t' read -r _kind name; do
197
- [[ -n "$name" ]] || continue
198
- rule_count=$((rule_count + 1))
199
- in_doctrine["$name"]=1
200
- if [[ -z "${in_digest[$name]:-}" && -z "${in_trim[$name]:-}" ]]; then
201
- missing+=("$name")
202
- fi
203
- done <<< "$doctrine_out"
204
-
205
- orphans=()
206
- for name in "${digest_names[@]+"${digest_names[@]}"}"; do
207
- [[ -z "${in_doctrine[$name]:-}" ]] && orphans+=("$name")
208
- done
209
-
210
- if [[ ${#missing[@]} -gt 0 || ${#orphans[@]} -gt 0 || ${#craft_findings[@]} -gt 0 || ${#digest_findings[@]} -gt 0 ]]; then
211
- if [[ ${#missing[@]} -gt 0 || ${#orphans[@]} -gt 0 ]]; then
212
- echo "check-doctrine-registration: the digest and the doctrine are out of lockstep in $AGENT_FILE:"
213
- for name in "${missing[@]+"${missing[@]}"}"; do
214
- echo " doctrine rule absent from the digest: $name"
215
- done
216
- for name in "${orphans[@]+"${orphans[@]}"}"; do
217
- echo " digest bullet owns no doctrine rule: $name"
218
- done
219
- echo " help: a re-vendored DOCTRINE.md changed the methodology-rule set — reconcile the"
220
- echo " '$DOCTRINE_KIT_DIGEST_SECTION' digest in $AGENT_FILE: add '- **<name>** — …' for"
221
- echo " each absent rule (or declare a trim '<!-- doctrine-digest-trim: <name> — <reason> -->'),"
222
- echo " and rename or remove any bullet that owns no rule."
223
- fi
224
- if [[ ${#craft_findings[@]} -gt 0 ]]; then
225
- echo "check-doctrine-registration: the stage-routing trailers are out of grammar in $DOCTRINE_FILE:"
226
- for f in "${craft_findings[@]}"; do
227
- echo " $f"
228
- done
229
- echo " help: every engineering-craft rule owns exactly one '*Stages:* <stage>[, <stage>…]'"
230
- echo " trailer ('*Stages:* —' for none) so a re-vendored DOCTRINE.md that adds an"
231
- echo " untagged craft rule reddens instead of silently dropping out of stage routing."
232
- fi
233
- if [[ ${#digest_findings[@]} -gt 0 ]]; then
234
- echo "check-doctrine-registration: the digest trailers are out of grammar in $DOCTRINE_FILE:"
235
- for f in "${digest_findings[@]}"; do
236
- echo " $f"
237
- done
238
- echo " help: every methodology rule owns exactly one non-empty '*Digest:* <one-line summary>'"
239
- echo " trailer — install-doctrine.sh derives that rule's digest bullet from it, so an"
240
- echo " untrailered rule would ship every consumer a digest one rule short."
241
- fi
242
- exit 1
243
- fi
244
-
245
- echo "DOCTRINE-REGISTRATION: clean ($AGENT_FILE links $DOCTRINE_FILE; $rule_count methodology rule(s) in per-rule digest lockstep, $trim_count declared trim(s), each carrying one *Digest:* trailer; $craft_count craft rule(s) each carry one *Stages:* trailer)"
246
- exit 0