checkwright 0.21.0 → 0.23.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 (489) hide show
  1. package/README.md +1013 -50
  2. package/lib/common/digest.sh +18 -0
  3. package/lib/common/lock.sh +40 -0
  4. package/lib/common/profile.sh +33 -0
  5. package/lib/common/recipe.sh +56 -43
  6. package/lib/diff.sh +64 -0
  7. package/lib/doctor.sh +81 -7
  8. package/lib/init.sh +167 -52
  9. package/lib/uninstall.sh +212 -0
  10. package/lib/update.sh +34 -0
  11. package/package.json +2 -2
  12. package/payload/artifact/targets.list +30 -0
  13. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
  14. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -0
  15. package/payload/canon-kit/README.md +2 -0
  16. package/payload/canon-kit/SPEC.md +666 -59
  17. package/payload/canon-kit/checks/check-amendment-queue.sh +1 -0
  18. package/payload/canon-kit/checks/check-comment-tier.gate +3 -0
  19. package/payload/canon-kit/checks/check-deprecation-task.gate +3 -0
  20. package/payload/canon-kit/checks/check-docs-cmd.gate +3 -0
  21. package/payload/canon-kit/checks/check-docs-link-convention.sh +12 -4
  22. package/payload/canon-kit/checks/check-install-claim.gate +3 -0
  23. package/payload/canon-kit/checks/check-knob-citation.gate +3 -0
  24. package/payload/canon-kit/checks/check-knob-default-coupling.sh +1 -0
  25. package/payload/canon-kit/checks/check-manifest-count.gate +3 -0
  26. package/payload/canon-kit/checks/check-manifest-temporal.gate +3 -0
  27. package/payload/canon-kit/checks/check-md-refs.gate +3 -0
  28. package/payload/canon-kit/checks/check-measured-claim.gate +3 -0
  29. package/payload/canon-kit/checks/check-payload-claim.gate +3 -0
  30. package/payload/canon-kit/checks/check-prose-enum.gate +3 -0
  31. package/payload/canon-kit/checks/check-prose-tells.sh +1 -0
  32. package/payload/canon-kit/checks/check-spec-derivable-section.gate +3 -0
  33. package/payload/canon-kit/checks/check-spec-dod-singleton.gate +3 -0
  34. package/payload/canon-kit/checks/check-spec-embedded-source.sh +1 -0
  35. package/payload/canon-kit/checks/check-spec-fence-balance.gate +3 -0
  36. package/payload/canon-kit/checks/check-spec-pointer.gate +3 -0
  37. package/payload/canon-kit/checks/check-surface-duplication.sh +1 -0
  38. package/payload/canon-kit/checks/check-todo-task-liveness.gate +3 -0
  39. package/payload/canon-kit/checks/check-tracking-claim.gate +3 -0
  40. package/payload/canon-kit/gate-tests/check-comment-tier/bad/.workflow/fixture-state.txt +4 -0
  41. package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.gate +4 -0
  42. package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.rs +5 -0
  43. package/payload/canon-kit/gate-tests/check-comment-tier/bad/expect.txt +4 -0
  44. package/payload/canon-kit/gate-tests/check-comment-tier/bad/templates/bad-tmpl.sh +4 -0
  45. package/payload/canon-kit/gate-tests/check-comment-tier/good/.workflow/fixture-state.txt +3 -0
  46. package/payload/canon-kit/gate-tests/check-comment-tier/good/expect.txt +1 -1
  47. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.gate +4 -0
  48. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.rs +5 -0
  49. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.sh +3 -0
  50. package/payload/canon-kit/gate-tests/check-comment-tier/good/templates/good-tmpl.sh +5 -0
  51. package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +29 -5
  52. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/.workflow/fixture-state.txt +3 -0
  53. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/bad.gate +2 -0
  54. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/bad.rs +4 -0
  55. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/expect.txt +3 -0
  56. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/scripts/canon-config.sh +6 -5
  57. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/templates/tmpl.sh +5 -0
  58. package/payload/canon-kit/gate-tests/check-deprecation-task/good/.workflow/fixture-state.txt +3 -0
  59. package/payload/canon-kit/gate-tests/check-deprecation-task/good/expect.txt +1 -1
  60. package/payload/canon-kit/gate-tests/check-deprecation-task/good/good.gate +2 -0
  61. package/payload/canon-kit/gate-tests/check-deprecation-task/good/good.rs +4 -0
  62. package/payload/canon-kit/gate-tests/check-deprecation-task/good/scripts/canon-config.sh +6 -5
  63. package/payload/canon-kit/gate-tests/check-deprecation-task/good/templates/tmpl.sh +5 -0
  64. package/payload/canon-kit/gate-tests/check-deprecation-task.test.sh +4 -3
  65. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/OUTSIDE.md +4 -0
  66. package/payload/canon-kit/gate-tests/check-docs-link-convention/bad/docs/index.md +3 -0
  67. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/OUTSIDE.md +4 -0
  68. package/payload/canon-kit/gate-tests/check-docs-link-convention/good/docs/methodology.md +8 -0
  69. package/payload/canon-kit/gate-tests/check-docs-link-convention.test.sh +94 -0
  70. package/payload/canon-kit/gate-tests/check-knob-citation.test.sh +2 -2
  71. package/payload/canon-kit/gate-tests/check-manifest-count/good/SPEC.md +4 -0
  72. package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +32 -8
  73. package/payload/canon-kit/gate-tests/check-md-refs.test.sh +61 -9
  74. package/payload/canon-kit/gate-tests/check-measured-claim/bad/SPEC.md +12 -0
  75. package/payload/canon-kit/gate-tests/check-measured-claim/bad/expect.txt +3 -0
  76. package/payload/canon-kit/gate-tests/check-measured-claim/bad/scripts/canon-config.sh +6 -0
  77. package/payload/canon-kit/gate-tests/check-measured-claim/good/SPEC.md +23 -0
  78. package/payload/canon-kit/gate-tests/check-measured-claim/good/expect.txt +1 -0
  79. package/payload/canon-kit/gate-tests/check-measured-claim/good/scripts/canon-config.sh +6 -0
  80. package/payload/canon-kit/gate-tests/check-measured-claim.test.sh +90 -0
  81. package/payload/canon-kit/gate-tests/check-payload-claim/bad/README.md +15 -0
  82. package/payload/canon-kit/gate-tests/check-payload-claim/bad/expect.txt +2 -0
  83. package/payload/canon-kit/gate-tests/check-payload-claim/bad/install.md +19 -0
  84. package/payload/canon-kit/gate-tests/check-payload-claim/bad/posts/note.md +6 -0
  85. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/canon-config.sh +8 -0
  86. package/payload/canon-kit/gate-tests/check-payload-claim/bad/scripts/payload-claims.sh +7 -0
  87. package/payload/canon-kit/gate-tests/check-payload-claim/good/README.md +15 -0
  88. package/payload/canon-kit/gate-tests/check-payload-claim/good/expect.txt +2 -0
  89. package/payload/canon-kit/gate-tests/check-payload-claim/good/install.md +20 -0
  90. package/payload/canon-kit/gate-tests/check-payload-claim/good/posts/note.md +6 -0
  91. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/canon-config.sh +8 -0
  92. package/payload/canon-kit/gate-tests/check-payload-claim/good/scripts/payload-claims.sh +7 -0
  93. package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +27 -4
  94. package/payload/canon-kit/gate-tests/check-spec-dod-singleton.test.sh +21 -7
  95. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/.workflow/fixture-state.txt +2 -0
  96. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/bad.gate +2 -0
  97. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/bad.rs +4 -0
  98. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +4 -0
  99. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/templates/tmpl.sh +5 -0
  100. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/widget.sh +1 -0
  101. package/payload/canon-kit/gate-tests/check-spec-pointer/good/.workflow/fixture-state.txt +2 -0
  102. package/payload/canon-kit/gate-tests/check-spec-pointer/good/expect.txt +1 -1
  103. package/payload/canon-kit/gate-tests/check-spec-pointer/good/good.gate +2 -0
  104. package/payload/canon-kit/gate-tests/check-spec-pointer/good/good.rs +4 -0
  105. package/payload/canon-kit/gate-tests/check-spec-pointer/good/templates/tmpl.sh +5 -0
  106. package/payload/canon-kit/gate-tests/check-spec-pointer/good/widget.sh +1 -0
  107. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/.workflow/fixture-state.txt +3 -0
  108. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/bad.gate +2 -0
  109. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/bad.rs +4 -0
  110. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/expect.txt +3 -0
  111. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/templates/tmpl.sh +5 -0
  112. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/.workflow/fixture-state.txt +3 -0
  113. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/expect.txt +1 -1
  114. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/good.gate +2 -0
  115. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/good.rs +4 -0
  116. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/templates/tmpl.sh +5 -0
  117. package/payload/canon-kit/gate-tests/check-tracking-claim.test.sh +1 -2
  118. package/payload/canon-kit/lib/spec.sh +109 -70
  119. package/payload/canon-kit/smoke/install.sh +21 -1
  120. package/payload/canon-kit/templates/SPEC-amendment.md +9 -2
  121. package/payload/context-kit/README.md +4 -1
  122. package/payload/context-kit/SPEC.md +166 -9
  123. package/payload/context-kit/bin/env-probe.sh +19 -6
  124. package/payload/context-kit/checks/check-brevity.sh +1 -0
  125. package/payload/context-kit/checks/check-footprint-fresh.sh +1 -0
  126. package/payload/context-kit/checks/check-memory-off.sh +1 -0
  127. package/payload/context-kit/checks/check-settings-paths.sh +94 -0
  128. package/payload/context-kit/checks/check-settings-pins.sh +1 -0
  129. package/payload/context-kit/gate-tests/check-settings-paths/bad/args +1 -0
  130. package/payload/context-kit/gate-tests/check-settings-paths/bad/expect.txt +3 -0
  131. package/payload/context-kit/gate-tests/check-settings-paths/bad/settings.json +12 -0
  132. package/payload/context-kit/gate-tests/check-settings-paths/bad/tools/real-tool.sh +4 -0
  133. package/payload/context-kit/gate-tests/check-settings-paths/good/args +1 -0
  134. package/payload/context-kit/gate-tests/check-settings-paths/good/expect.txt +1 -0
  135. package/payload/context-kit/gate-tests/check-settings-paths/good/settings.json +16 -0
  136. package/payload/context-kit/gate-tests/check-settings-paths/good/tools/real-tool.sh +4 -0
  137. package/payload/context-kit/index-tests/expected/toolfloor.txt +9 -0
  138. package/payload/context-kit/index-tests/toolfloor-cases.sh +20 -0
  139. package/payload/context-kit/lib/toolfloor.sh +15 -4
  140. package/payload/context-kit/smoke/agents-md.sh +12 -1
  141. package/payload/context-kit/smoke/install.sh +4 -1
  142. package/payload/delegation-kit/README.md +3 -3
  143. package/payload/delegation-kit/SPEC.md +499 -26
  144. package/payload/delegation-kit/bin/run-dispatch-guard-tests.sh +97 -0
  145. package/payload/delegation-kit/checks/check-agent-tier-explicit.sh +1 -0
  146. package/payload/delegation-kit/checks/check-gate-tamper.sh +2 -1
  147. package/payload/delegation-kit/checks/check-rule-citation.sh +1 -0
  148. package/payload/delegation-kit/lib/delegation.sh +1 -0
  149. package/payload/delegation-kit/smoke/install.sh +2 -1
  150. package/payload/delegation-kit/templates/agent-dispatch-guard.sh +61 -0
  151. package/payload/delegation-kit/templates/agent-execution.md +127 -12
  152. package/payload/delegation-kit/templates/delegation-config.sh +4 -0
  153. package/payload/delegation-kit/templates/dispatch-checklists.md +1 -1
  154. package/payload/delegation-kit/templates/statusline-usage.sh +23 -1
  155. package/payload/delegation-kit/usage-tests/dispatch-guard-cases.tsv +30 -0
  156. package/payload/doctrine-kit/DOCTRINE.md +112 -11
  157. package/payload/doctrine-kit/README.md +12 -3
  158. package/payload/doctrine-kit/SPEC.md +163 -11
  159. package/payload/doctrine-kit/bin/install-doctrine.sh +167 -17
  160. package/payload/doctrine-kit/checks/check-doctrine-registration.sh +41 -11
  161. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/DOCTRINE.md +3 -0
  162. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/DOCTRINE.md +3 -0
  163. package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +82 -2
  164. package/payload/doctrine-kit/smoke/install.sh +167 -1
  165. package/payload/drift-kit/README.md +3 -2
  166. package/payload/drift-kit/SPEC.md +264 -22
  167. package/payload/drift-kit/bin/kfric.sh +21 -2
  168. package/payload/drift-kit/bin/stage-economics.sh +157 -3
  169. package/payload/drift-kit/kpis/kpi-incident-recurrence.sh +42 -0
  170. package/payload/drift-kit/smoke/install.sh +183 -1
  171. package/payload/drift-kit/templates/economics.md +9 -0
  172. package/payload/drift-kit/templates/kpis.list +6 -1
  173. package/payload/evidence-kit/README.md +20 -6
  174. package/payload/evidence-kit/SPEC.md +355 -17
  175. package/payload/evidence-kit/bin/run-validate.sh +51 -9
  176. package/payload/evidence-kit/checks/check-battery-roster.sh +87 -0
  177. package/payload/evidence-kit/checks/check-evidence-baseline.sh +1 -0
  178. package/payload/evidence-kit/checks/check-evidence-manifest.sh +1 -0
  179. package/payload/evidence-kit/checks/check-producer-liveness.sh +35 -0
  180. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/args +1 -0
  181. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/expect.txt +1 -0
  182. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/runner.md +14 -0
  183. package/payload/evidence-kit/gate-tests/check-battery-roster/bad/scripts/evidence-config.sh +7 -0
  184. package/payload/evidence-kit/gate-tests/check-battery-roster/good/args +1 -0
  185. package/payload/evidence-kit/gate-tests/check-battery-roster/good/expect.txt +1 -0
  186. package/payload/evidence-kit/gate-tests/check-battery-roster/good/runner.md +14 -0
  187. package/payload/evidence-kit/gate-tests/check-battery-roster/good/scripts/evidence-config.sh +7 -0
  188. package/payload/evidence-kit/gate-tests/check-battery-roster.test.sh +68 -0
  189. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/args +1 -0
  190. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/expect.txt +1 -0
  191. package/payload/evidence-kit/gate-tests/check-producer-liveness/bad/run-validate.lock +1 -0
  192. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/args +1 -0
  193. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/expect.txt +2 -0
  194. package/payload/evidence-kit/gate-tests/check-producer-liveness/good/run-validate.lock +1 -0
  195. package/payload/evidence-kit/gate-tests/producer-lock.test.sh +109 -0
  196. package/payload/evidence-kit/lib/evidence.sh +18 -0
  197. package/payload/evidence-kit/smoke/install.sh +17 -3
  198. package/payload/gate-sdk/README.md +17 -1
  199. package/payload/gate-sdk/SPEC.md +4427 -92
  200. package/payload/gate-sdk/bin/build-native.sh +38 -0
  201. package/payload/gate-sdk/bin/enforcement-map.sh +2 -1
  202. package/payload/gate-sdk/bin/gen-pre-commit.sh +32 -2
  203. package/payload/gate-sdk/bin/port-blockers.sh +445 -0
  204. package/payload/gate-sdk/bin/run-consumer-smoke.sh +129 -2
  205. package/payload/gate-sdk/bin/run-gate-tests.sh +61 -9
  206. package/payload/gate-sdk/bin/run-gates.sh +37 -2
  207. package/payload/gate-sdk/bin/upgrade-smoke.sh +55 -7
  208. package/payload/gate-sdk/checks/check-action-gh-repo.gate +3 -0
  209. package/payload/gate-sdk/checks/check-action-pinning.gate +3 -0
  210. package/payload/gate-sdk/checks/check-action-run-shell.sh +4 -1
  211. package/payload/gate-sdk/checks/check-assertion-strength.gate +3 -0
  212. package/payload/gate-sdk/checks/check-commit-msg.sh +1 -0
  213. package/payload/gate-sdk/checks/check-commit-subject.sh +1 -0
  214. package/payload/gate-sdk/checks/check-core-files.sh +28 -4
  215. package/payload/gate-sdk/checks/check-crate-arms.sh +61 -0
  216. package/payload/gate-sdk/checks/check-enforcement-fresh.sh +1 -0
  217. package/payload/gate-sdk/checks/check-exec-bit.sh +21 -1
  218. package/payload/gate-sdk/checks/check-gate-assertions.sh +31 -6
  219. package/payload/gate-sdk/checks/check-gate-binary-fresh.sh +107 -0
  220. package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +7 -7
  221. package/payload/gate-sdk/checks/check-gate-fail-closed.sh +1 -0
  222. package/payload/gate-sdk/checks/check-gate-fixture-coverage.sh +1 -0
  223. package/payload/gate-sdk/checks/check-gate-output.sh +41 -3
  224. package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +333 -0
  225. package/payload/gate-sdk/checks/check-graph.sh +5 -5
  226. package/payload/gate-sdk/checks/check-hook-exec-bit.sh +1 -0
  227. package/payload/gate-sdk/checks/check-identity.sh +1 -0
  228. package/payload/gate-sdk/checks/check-install-disposition.sh +92 -0
  229. package/payload/gate-sdk/checks/check-kit-enum.sh +1 -0
  230. package/payload/gate-sdk/checks/check-kit-registration.gate +3 -0
  231. package/payload/gate-sdk/checks/check-readme-roster.sh +6 -0
  232. package/payload/gate-sdk/checks/check-reads-couples.sh +71 -21
  233. package/payload/gate-sdk/checks/check-root-tiering.sh +1 -0
  234. package/payload/gate-sdk/checks/check-shellcheck.sh +1 -0
  235. package/payload/gate-sdk/checks/check-smoke-entry-guard.gate +3 -0
  236. package/payload/gate-sdk/checks/check-template-copy-parity.sh +1 -0
  237. package/payload/gate-sdk/checks/check-template-registry-parity.gate +3 -0
  238. package/payload/gate-sdk/checks/check-test-hermetic.gate +3 -0
  239. package/payload/gate-sdk/checks/check-tree-terms.sh +1 -0
  240. package/payload/gate-sdk/checks/check-workflow-tiering.sh +2 -1
  241. package/payload/gate-sdk/gate-tests/check-action-run-shell.test.sh +16 -1
  242. package/payload/gate-sdk/gate-tests/check-core-files.test.sh +64 -0
  243. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/crate/Cargo.toml +7 -0
  244. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/crate/src/lib.rs +12 -0
  245. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/expect.txt +5 -0
  246. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/scripts/gate-sdk-config.sh +2 -0
  247. package/payload/gate-sdk/gate-tests/check-crate-arms/good/crate/Cargo.toml +7 -0
  248. package/payload/gate-sdk/gate-tests/check-crate-arms/good/crate/src/lib.rs +11 -0
  249. package/payload/gate-sdk/gate-tests/check-crate-arms/good/expect.txt +2 -0
  250. package/payload/gate-sdk/gate-tests/check-crate-arms/good/scripts/gate-sdk-config.sh +2 -0
  251. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/expect.txt +1 -1
  252. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/args +2 -0
  253. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/expect.txt +5 -0
  254. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/kitroot/checks/check-vendored.gate +2 -0
  255. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/check-ported.gate +2 -0
  256. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gate-sdk-config.sh +2 -0
  257. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/scripts/gates.list +4 -0
  258. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stamp.txt +1 -0
  259. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/bad/stub-bin +6 -0
  260. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/args +2 -0
  261. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/expect.txt +5 -0
  262. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/kitroot/checks/check-vendored.gate +2 -0
  263. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/check-ported.gate +2 -0
  264. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gate-sdk-config.sh +2 -0
  265. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/scripts/gates.list +4 -0
  266. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stamp.txt +1 -0
  267. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh/good/stub-bin +5 -0
  268. package/payload/gate-sdk/gate-tests/check-gate-binary-fresh.test.sh +81 -0
  269. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/TASK-QUEUE.md +3 -1
  270. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/expect.txt +3 -1
  271. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/bad/gates/check-sample.sh +3 -1
  272. package/payload/gate-sdk/gate-tests/check-gate-exemption-tasks/good/expect.txt +1 -0
  273. package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-native-sample.gate +3 -0
  274. package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-sample.sh +1 -0
  275. package/payload/gate-sdk/gate-tests/check-gate-output/bad/expect.txt +3 -0
  276. package/payload/gate-sdk/gate-tests/check-gate-output/bad/gates.list +1 -0
  277. package/payload/gate-sdk/gate-tests/check-gate-output/bad/native/Cargo.toml +4 -0
  278. package/payload/gate-sdk/gate-tests/check-gate-output/bad/native/src/gates/native_sample.rs +7 -0
  279. package/payload/gate-sdk/gate-tests/check-gate-output/good/check-native-sample.gate +3 -0
  280. package/payload/gate-sdk/gate-tests/check-gate-output/good/check-sample.sh +1 -0
  281. package/payload/gate-sdk/gate-tests/check-gate-output/good/expect.txt +1 -0
  282. package/payload/gate-sdk/gate-tests/check-gate-output/good/gates.list +1 -0
  283. package/payload/gate-sdk/gate-tests/check-gate-output/good/native/Cargo.toml +4 -0
  284. package/payload/gate-sdk/gate-tests/check-gate-output/good/native/src/gates/native_sample.rs +11 -0
  285. package/payload/gate-sdk/gate-tests/check-gate-output.test.sh +111 -0
  286. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/args +2 -0
  287. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/conservation.md +7 -0
  288. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/expect.txt +12 -0
  289. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/impl/gate.rs +2 -0
  290. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/kitroot/check-orphan.rs +3 -0
  291. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/publish.yml +15 -0
  292. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-alpha.sh +3 -0
  293. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.gate +1 -0
  294. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-dup.sh +3 -0
  295. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/check-orphan.gate +1 -0
  296. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gate-sdk-config.sh +6 -0
  297. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/scripts/gates.list +3 -0
  298. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/stub-bin +3 -0
  299. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/bad/targets.list +3 -0
  300. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/args +2 -0
  301. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/conservation.md +8 -0
  302. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +7 -0
  303. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/impl/gate.rs +2 -0
  304. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/kitroot/check-other.rs +3 -0
  305. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/publish.yml +15 -0
  306. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-alpha.sh +3 -0
  307. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/check-ported.gate +2 -0
  308. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gate-sdk-config.sh +6 -0
  309. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/scripts/gates.list +2 -0
  310. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/stub-bin +3 -0
  311. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/targets.list +2 -0
  312. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +184 -0
  313. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-alpha.sh +6 -0
  314. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-delta.sh +5 -0
  315. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-epsilon.sh +6 -0
  316. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/smoke/install.sh +7 -0
  317. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/args +6 -0
  318. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/expect.txt +1 -0
  319. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/installer/lib/common/recipe.sh +9 -0
  320. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/scripts/gate-sdk-config.sh +5 -0
  321. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-alpha.sh +6 -0
  322. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-beta.gate +3 -0
  323. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-gamma.sh +6 -0
  324. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/smoke/install.sh +8 -0
  325. package/payload/gate-sdk/gate-tests/check-install-disposition/good/args +6 -0
  326. package/payload/gate-sdk/gate-tests/check-install-disposition/good/expect.txt +1 -0
  327. package/payload/gate-sdk/gate-tests/check-install-disposition/good/installer/lib/common/recipe.sh +10 -0
  328. package/payload/gate-sdk/gate-tests/check-install-disposition/good/scripts/gate-sdk-config.sh +5 -0
  329. package/payload/gate-sdk/gate-tests/check-kit-registration.test.sh +6 -5
  330. package/payload/gate-sdk/gate-tests/check-reads-couples.test.sh +139 -0
  331. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/templates/widgets.list +4 -0
  332. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-one.sh +3 -0
  333. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/alpha-kit/widgets/widget-two.sh +3 -0
  334. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/args +4 -0
  335. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/expect.txt +1 -0
  336. package/payload/gate-sdk/gate-tests/check-template-registry-parity/bad/scripts/gate-sdk-config.sh +5 -0
  337. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/templates/widgets.list +4 -0
  338. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-one.sh +3 -0
  339. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/alpha-kit/widgets/widget-two.sh +3 -0
  340. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/args +8 -0
  341. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/rules.list +5 -0
  342. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/beta-kit/templates/table.tsv +4 -0
  343. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/expect.txt +1 -0
  344. package/payload/gate-sdk/gate-tests/check-template-registry-parity/good/scripts/gate-sdk-config.sh +5 -0
  345. package/payload/gate-sdk/gate-tests/check-test-hermetic-smoke.test.sh +2 -3
  346. package/payload/gate-sdk/gate-tests/lib-declaration.test.sh +4 -4
  347. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +151 -1
  348. package/payload/gate-sdk/gate-tests/run-dispatch-streams.test.sh +73 -0
  349. package/payload/gate-sdk/gate-tests/run-gate-tests.test.sh +144 -0
  350. package/payload/gate-sdk/lib/consumer-smoke.sh +41 -4
  351. package/payload/gate-sdk/lib/gate.sh +208 -9
  352. package/payload/gate-sdk/lib/inject.sh +46 -1
  353. package/payload/gate-sdk/lib/test-hermetic.sh +26 -0
  354. package/payload/gate-sdk/smoke/install.sh +61 -1
  355. package/payload/guard-kit/README.md +18 -14
  356. package/payload/guard-kit/SPEC.md +366 -72
  357. package/payload/guard-kit/bin/compare-settings-allow.sh +40 -7
  358. package/payload/guard-kit/bin/run-guard-tests.sh +1 -0
  359. package/payload/guard-kit/gate-tests/compare-settings-allow.test.sh +64 -0
  360. package/payload/guard-kit/gate-tests/guard-read-path.test.sh +52 -0
  361. package/payload/guard-kit/guard-tests/cases.tsv +49 -7
  362. package/payload/guard-kit/lib/guard.sh +277 -54
  363. package/payload/guard-kit/templates/close-triage.md +38 -10
  364. package/payload/guard-kit/templates/guard-config.sh +3 -0
  365. package/payload/guard-kit/templates/settings-hooks.json +7 -1
  366. package/payload/lifecycle-kit/README.md +12 -1
  367. package/payload/lifecycle-kit/SPEC.md +991 -41
  368. package/payload/lifecycle-kit/bin/cite-survey.sh +81 -0
  369. package/payload/lifecycle-kit/bin/enter-stage.sh +139 -13
  370. package/payload/lifecycle-kit/bin/file-gap.sh +60 -2
  371. package/payload/lifecycle-kit/bin/file-survey.sh +69 -0
  372. package/payload/lifecycle-kit/checks/check-close-surfaces.sh +1 -0
  373. package/payload/lifecycle-kit/checks/check-gap-inbox-neutrality.gate +3 -0
  374. package/payload/lifecycle-kit/checks/check-lesson-disposition.gate +3 -0
  375. package/payload/lifecycle-kit/checks/check-lifecycle-registration.gate +3 -0
  376. package/payload/lifecycle-kit/checks/check-merge-attrs.gate +3 -0
  377. package/payload/lifecycle-kit/checks/check-scratch-citation.gate +3 -0
  378. package/payload/lifecycle-kit/checks/check-shim-restatement.gate +3 -0
  379. package/payload/lifecycle-kit/checks/check-skill-binding.gate +3 -0
  380. package/payload/lifecycle-kit/checks/check-stage-entry.sh +1 -0
  381. package/payload/lifecycle-kit/checks/check-stage-evidence.gate +3 -0
  382. package/payload/lifecycle-kit/checks/check-stage-skill-coverage.gate +3 -0
  383. package/payload/lifecycle-kit/checks/check-survey-record.gate +3 -0
  384. package/payload/lifecycle-kit/gate-tests/check-close-surfaces.test.sh +1 -2
  385. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/bad/args +2 -0
  386. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/bad/expect.txt +3 -0
  387. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/bad/gap-inbox.md +5 -0
  388. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/good/args +2 -0
  389. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/good/expect.txt +1 -0
  390. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/good/gap-inbox.md +4 -0
  391. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition.test.sh +2 -3
  392. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration.test.sh +2 -3
  393. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/bad/.gitattributes +1 -0
  394. package/payload/lifecycle-kit/gate-tests/check-merge-attrs/good/.gitattributes +1 -0
  395. package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +3 -3
  396. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/expect.txt +1 -0
  397. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/scripts/lifecycle-config.sh +4 -0
  398. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/surfaces/queue.md +13 -0
  399. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/expect.txt +1 -0
  400. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/scripts/lifecycle-config.sh +4 -0
  401. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/surfaces/queue.md +31 -0
  402. package/payload/lifecycle-kit/gate-tests/check-shim-restatement.test.sh +2 -3
  403. package/payload/lifecycle-kit/gate-tests/check-skill-binding.test.sh +2 -3
  404. package/payload/lifecycle-kit/gate-tests/check-stage-entry.test.sh +2 -3
  405. package/payload/lifecycle-kit/gate-tests/check-stage-evidence.test.sh +9 -5
  406. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/args +2 -0
  407. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/expect.txt +4 -0
  408. package/payload/lifecycle-kit/gate-tests/check-survey-record/bad/record.md +18 -0
  409. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/args +2 -0
  410. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/expect.txt +1 -0
  411. package/payload/lifecycle-kit/gate-tests/check-survey-record/good/record.md +13 -0
  412. package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +83 -0
  413. package/payload/lifecycle-kit/gate-tests/file-gap-recurrence.test.sh +122 -0
  414. package/payload/lifecycle-kit/gate-tests/rename-iteration.test.sh +142 -0
  415. package/payload/lifecycle-kit/gate-tests/survey-record-entry.test.sh +102 -0
  416. package/payload/lifecycle-kit/gate-tests/workflow-state-guard.test.sh +100 -0
  417. package/payload/lifecycle-kit/lib/stages.sh +12 -2
  418. package/payload/lifecycle-kit/smoke/install.sh +83 -4
  419. package/payload/lifecycle-kit/templates/consult.md +73 -0
  420. package/payload/lifecycle-kit/templates/lead.md +139 -7
  421. package/payload/lifecycle-kit/templates/stages/align.md +12 -0
  422. package/payload/lifecycle-kit/templates/stages/build.md +8 -0
  423. package/payload/lifecycle-kit/templates/stages/close.md +45 -5
  424. package/payload/lifecycle-kit/templates/stages/scope.md +42 -3
  425. package/payload/lifecycle-kit/templates/stages/spec.md +13 -1
  426. package/payload/lifecycle-kit/templates/stages/validate.md +8 -0
  427. package/payload/lifecycle-kit/templates/workflow-state-guard.sh +29 -0
  428. package/payload/queue-kit/README.md +6 -1
  429. package/payload/queue-kit/SPEC.md +350 -6
  430. package/payload/queue-kit/bin/queue-counts.sh +35 -0
  431. package/payload/queue-kit/bin/queue-edges.sh +78 -0
  432. package/payload/queue-kit/checks/check-queue-entry-budget.gate +3 -0
  433. package/payload/queue-kit/checks/check-queue-hygiene.gate +3 -0
  434. package/payload/queue-kit/checks/check-queue-prose-precondition.sh +1 -0
  435. package/payload/queue-kit/checks/check-queue-sections.gate +3 -0
  436. package/payload/queue-kit/checks/check-queue-slug-liveness.gate +3 -0
  437. package/payload/queue-kit/checks/check-queue-wrap.gate +3 -0
  438. package/payload/queue-kit/checks/check-roadmap-fresh.sh +1 -0
  439. package/payload/queue-kit/checks/check-tag-lead-line.gate +3 -0
  440. package/payload/queue-kit/checks/check-task-conservation.gate +4 -0
  441. package/payload/queue-kit/checks/check-task-names.gate +3 -0
  442. package/payload/queue-kit/gate-tests/check-queue-hygiene/good/TASK-QUEUE.md +5 -0
  443. package/payload/queue-kit/gate-tests/queue-counts.test.sh +116 -0
  444. package/payload/queue-kit/gate-tests/queue-edges.test.sh +130 -0
  445. package/payload/queue-kit/gate-tests/queue-lib-parity.test.sh +215 -0
  446. package/payload/queue-kit/lib/queue.sh +4 -19
  447. package/payload/queue-kit/smoke/install.sh +4 -1
  448. package/payload/queue-kit/templates/TASK-QUEUE.md +3 -0
  449. package/payload/site-kit/SPEC.md +64 -27
  450. package/payload/site-kit/checks/check-docs-cname-parity.sh +1 -0
  451. package/payload/site-kit/checks/check-docs-render-fidelity.sh +1 -0
  452. package/payload/site-kit/smoke/install.sh +9 -1
  453. package/profiles.list +36 -8
  454. package/payload/canon-kit/checks/check-comment-tier.sh +0 -211
  455. package/payload/canon-kit/checks/check-deprecation-task.sh +0 -90
  456. package/payload/canon-kit/checks/check-docs-cmd.sh +0 -153
  457. package/payload/canon-kit/checks/check-install-claim.sh +0 -146
  458. package/payload/canon-kit/checks/check-knob-citation.sh +0 -117
  459. package/payload/canon-kit/checks/check-manifest-count.sh +0 -46
  460. package/payload/canon-kit/checks/check-manifest-temporal.sh +0 -83
  461. package/payload/canon-kit/checks/check-md-refs.sh +0 -128
  462. package/payload/canon-kit/checks/check-prose-enum.sh +0 -115
  463. package/payload/canon-kit/checks/check-spec-derivable-section.sh +0 -69
  464. package/payload/canon-kit/checks/check-spec-dod-singleton.sh +0 -45
  465. package/payload/canon-kit/checks/check-spec-fence-balance.sh +0 -42
  466. package/payload/canon-kit/checks/check-spec-pointer.sh +0 -180
  467. package/payload/canon-kit/checks/check-todo-task-liveness.sh +0 -80
  468. package/payload/canon-kit/checks/check-tracking-claim.sh +0 -136
  469. package/payload/gate-sdk/checks/check-action-gh-repo.sh +0 -321
  470. package/payload/gate-sdk/checks/check-action-pinning.sh +0 -55
  471. package/payload/gate-sdk/checks/check-assertion-strength.sh +0 -134
  472. package/payload/gate-sdk/checks/check-kit-registration.sh +0 -68
  473. package/payload/gate-sdk/checks/check-smoke-entry-guard.sh +0 -53
  474. package/payload/gate-sdk/checks/check-test-hermetic.sh +0 -119
  475. package/payload/lifecycle-kit/checks/check-lesson-disposition.sh +0 -98
  476. package/payload/lifecycle-kit/checks/check-lifecycle-registration.sh +0 -54
  477. package/payload/lifecycle-kit/checks/check-merge-attrs.sh +0 -69
  478. package/payload/lifecycle-kit/checks/check-shim-restatement.sh +0 -97
  479. package/payload/lifecycle-kit/checks/check-skill-binding.sh +0 -59
  480. package/payload/lifecycle-kit/checks/check-stage-evidence.sh +0 -81
  481. package/payload/lifecycle-kit/checks/check-stage-skill-coverage.sh +0 -47
  482. package/payload/queue-kit/checks/check-queue-entry-budget.sh +0 -104
  483. package/payload/queue-kit/checks/check-queue-hygiene.sh +0 -81
  484. package/payload/queue-kit/checks/check-queue-sections.sh +0 -44
  485. package/payload/queue-kit/checks/check-queue-slug-liveness.sh +0 -63
  486. package/payload/queue-kit/checks/check-queue-wrap.sh +0 -56
  487. package/payload/queue-kit/checks/check-tag-lead-line.sh +0 -70
  488. package/payload/queue-kit/checks/check-task-conservation.sh +0 -50
  489. package/payload/queue-kit/checks/check-task-names.sh +0 -128
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env bash
2
- # spec: doctrine-kit/SPEC.md §install-doctrine — idempotent insert/replace of the doctrine reference block between fixed markers in the always-loaded agent file
2
+ # spec: doctrine-kit/SPEC.md §install-doctrine — idempotent insert/replace of the doctrine reference block between fixed markers in the always-loaded agent file, carrying the consumer's declared trims across the rewrite
3
3
  set -euo pipefail
4
4
 
5
5
  KIT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
@@ -9,16 +9,96 @@ source "$KIT/lib/doctrine.sh"
9
9
  # shellcheck source=../../gate-sdk/lib/inject.sh
10
10
  source "$SDK/lib/inject.sh"
11
11
 
12
+ BEGIN="<!-- doctrine-kit:begin -->"
13
+ END="<!-- doctrine-kit:end -->"
14
+
15
+ # spec: doctrine-kit/SPEC.md §install-doctrine — --remove: the reverse of the insert path over the same marker pair, riding gate-sdk's remove_marker_block (gate-sdk/SPEC.md §lib/inject.sh). It harvests no trims and emits no digest — a removal has nothing to carry forward — and reports what it did on the same channel (stdout) the insert path reports on. A missing agent file stays exit 2, unchanged.
16
+ if [[ "${1:-}" == "--remove" ]]; then
17
+ shift
18
+ AGENT_FILE="${1:-$DOCTRINE_KIT_AGENT_FILE}"
19
+ [[ -f "$AGENT_FILE" ]] \
20
+ || { echo "install-doctrine: agent file not found: $AGENT_FILE — nothing to remove" >&2; exit 2; }
21
+
22
+ result="$(remove_marker_block "$AGENT_FILE" "$BEGIN" "$END")" || exit $?
23
+ if [[ "$result" == "removed" ]]; then
24
+ echo "install-doctrine: removed the doctrine reference block from $AGENT_FILE"
25
+ else
26
+ echo "install-doctrine: no doctrine reference block found in $AGENT_FILE — nothing to remove"
27
+ fi
28
+ exit 0
29
+ fi
30
+
12
31
  AGENT_FILE="${1:-$DOCTRINE_KIT_AGENT_FILE}"
13
32
  DOCTRINE_FILE="${2:-$DOCTRINE_KIT_DOCTRINE_FILE}"
14
33
  [[ -f "$AGENT_FILE" ]] \
15
34
  || { echo "install-doctrine: agent file not found: $AGENT_FILE — nothing to install into" >&2; exit 2; }
16
35
 
17
- BEGIN="<!-- doctrine-kit:begin -->"
18
- END="<!-- doctrine-kit:end -->"
36
+ # spec: doctrine-kit/SPEC.md §check-doctrine-registration — the doctrine-side section heading is kit mechanism (the kit ships DOCTRINE.md), never config
37
+ METH_SECTION="## Methodology-maintenance rules"
19
38
 
20
- # spec: doctrine-kit/SPEC.md §install-doctrine — the block is the always-loaded shape applied to the doctrine itself: a one-line-per-rule digest plus the markdown link to the doctrine file
21
- block() {
39
+ [[ -f "$DOCTRINE_FILE" ]] \
40
+ || { echo "install-doctrine: doctrine file not found: $DOCTRINE_FILE — nothing to derive the digest from" >&2; exit 2; }
41
+
42
+ # spec: doctrine-kit/SPEC.md §install-doctrine — the rule walk: name read exactly as check-doctrine-registration assertion C reads it, summary read from the rule's own *Digest:* trailer exactly as assertion E counts it
43
+ read -r -d '' DIGEST_WALK <<'AWK' || true
44
+ function hlevel(line, n) {
45
+ if (line !~ /^#+[[:space:]]/) return 0
46
+ n = 0
47
+ while (substr(line, n + 1, 1) == "#") n++
48
+ return n
49
+ }
50
+ function flush() {
51
+ if (have) print cur_name "\t" dcount "\t" summary
52
+ }
53
+ !insec {
54
+ if (hlevel($0) > 0 && substr($0, 1, length(section)) == section) {
55
+ insec = 1; seen = 1; start_lvl = hlevel($0)
56
+ }
57
+ next
58
+ }
59
+ insec && hlevel($0) > 0 && hlevel($0) <= start_lvl { flush(); insec = 0; have = 0; next }
60
+ insec {
61
+ if ($0 ~ /^[0-9]+\.[[:space:]]+\*\*/) {
62
+ flush()
63
+ name = $0
64
+ sub(/^[0-9]+\.[[:space:]]+\*\*/, "", name)
65
+ sub(/\*\*.*/, "", name)
66
+ sub(/\.$/, "", name)
67
+ cur_name = name; have = 1; dcount = 0; summary = ""
68
+ } else if ($0 ~ /^[[:space:]]*\*Digest:\*/) {
69
+ dcount++
70
+ val = $0
71
+ sub(/^[[:space:]]*\*Digest:\*[[:space:]]*/, "", val)
72
+ sub(/[[:space:]]+$/, "", val)
73
+ if (dcount == 1) summary = val
74
+ }
75
+ next
76
+ }
77
+ END { flush(); if (!seen) print "@@NOSECTION" }
78
+ AWK
79
+
80
+ # spec: doctrine-kit/SPEC.md §install-doctrine — derived once at top level, never inside digest(): digest() is read through process substitution, where an exit would end the subshell and let a malformed doctrine through as a silently short digest
81
+ WALK_OUT="$(awk -v section="$METH_SECTION" "$DIGEST_WALK" "$DOCTRINE_FILE")" \
82
+ || { echo "install-doctrine: awk failed reading $DOCTRINE_FILE" >&2; exit 2; }
83
+ if [[ "$WALK_OUT" == "@@NOSECTION" ]]; then
84
+ echo "install-doctrine: no '$METH_SECTION' section in $DOCTRINE_FILE — cannot derive the digest from an unreadable rule set" >&2
85
+ exit 2
86
+ fi
87
+
88
+ BULLETS=()
89
+ while IFS=$'\t' read -r rname dcount summary; do
90
+ [[ -n "$rname" ]] || continue
91
+ if [[ "$dcount" != 1 ]]; then
92
+ echo "install-doctrine: methodology rule '$rname' carries $dcount *Digest:* trailer(s) in $DOCTRINE_FILE, want exactly one — refusing to emit a digest missing or double-sourcing its bullet" >&2
93
+ exit 2
94
+ fi
95
+ BULLETS+=("- **$rname** — $summary")
96
+ done <<< "$WALK_OUT"
97
+ [[ ${#BULLETS[@]} -gt 0 ]] \
98
+ || { echo "install-doctrine: no methodology rules found under '$METH_SECTION' in $DOCTRINE_FILE — refusing to install an empty digest" >&2; exit 2; }
99
+
100
+ # spec: doctrine-kit/SPEC.md §install-doctrine — the untrimmed digest: the always-loaded shape applied to the doctrine itself, a one-line-per-rule digest plus the markdown link to the doctrine file
101
+ digest() {
22
102
  cat <<EOF
23
103
  ## Delivery doctrine
24
104
 
@@ -26,19 +106,89 @@ The cross-kit delivery rules live in [$DOCTRINE_FILE]($DOCTRINE_FILE) — re-ven
26
106
  to upgrade. The always-loaded maintenance rules, one line each; the doctrine adds
27
107
  an engineering-craft section behind the link:
28
108
 
29
- - **Content-tiering / SSOT** — one content tier per surface; point, never restate.
30
- - **Enforcement-first** — the fix and the gate that catches it land in one unit; removing the duplication outranks gating it.
31
- - **De-literalization** — prose cites names; code or the owning SPEC owns values.
32
- - **Derivation-first** — derive the derivable (a roster, a count), never maintain it; a needed copy is generated and freshness-gated.
33
- - **Always-loaded shape** — one line per rule here; the mechanism behind the pointer.
34
- - **Load-trigger residency** — resident only when no stage, skill, or tool loads it.
35
- - **Widest-true-tier placement** — the widest tier true for every reader of it.
36
- - **Oracle-first** — run the gate, never emulate it; a red run is the feedback channel.
37
- - **Spec-over-precedent** — the owner doc is ground truth; history answers what happened, never what is correct.
38
- - **Gap disposition** — a gap you defer is costed and filed, never flagged-and-skipped.
39
- - **Scope-gated intake** — a mid-session initiative is filed as a costed Deferred entry by default, never started; work enters only through scope.
40
109
  EOF
110
+ printf '%s\n' "${BULLETS[@]}"
111
+ }
112
+
113
+ # spec: doctrine-kit/SPEC.md §install-doctrine — a digest bullet's rule name, extracted exactly as check-doctrine-registration extracts it (assertion C), so the substitution keys on the same string the gate keys on
114
+ bullet_name() { # $1 = a digest line -> its bold lead-in name, non-zero when the line is not a rule bullet
115
+ local l="$1"
116
+ [[ "$l" == "- **"*"**"* ]] || return 1
117
+ l="${l#- \*\*}"
118
+ printf '%s\n' "${l%%\*\**}"
119
+ }
120
+
121
+ # spec: doctrine-kit/SPEC.md §install-doctrine — the declared-trim grammar read exactly as check-doctrine-registration reads it (assertion B), so installer and gate never disagree about which rule a marker names
122
+ harvest_trims() { # block content on stdin -> one '<rule name><TAB><marker line verbatim>' per declared trim, in declaration order
123
+ awk '
124
+ /doctrine-digest-trim:/ {
125
+ name = $0
126
+ sub(/^.*doctrine-digest-trim:[[:space:]]*/, "", name)
127
+ sub(/[[:space:]]*—.*$/, "", name)
128
+ print name "\t" $0
129
+ }
130
+ '
131
+ }
132
+
133
+ # spec: doctrine-kit/SPEC.md §install-doctrine — the round-trip's read half: the block as it stands is the only record of what the consumer declared, so it is harvested before the rewrite that would erase it
134
+ CURRENT="$(read_marker_block "$AGENT_FILE" "$BEGIN" "$END")" || exit $?
135
+
136
+ declare -A TRIM_LINE=()
137
+ TRIM_ORDER=()
138
+ DUPES=()
139
+ while IFS=$'\t' read -r tname tline; do
140
+ [[ -n "$tname" ]] || continue
141
+ if [[ -n "${TRIM_LINE[$tname]+set}" ]]; then
142
+ DUPES+=("$tname")
143
+ continue
144
+ fi
145
+ TRIM_LINE["$tname"]="$tline"
146
+ TRIM_ORDER+=("$tname")
147
+ done < <(printf '%s\n' "$CURRENT" | harvest_trims)
148
+
149
+ declare -A IS_RULE=()
150
+ while IFS= read -r dline; do
151
+ if rname="$(bullet_name "$dline")"; then IS_RULE["$rname"]=1; fi
152
+ done < <(digest)
153
+
154
+ ORPHANS=()
155
+ if [[ ${#TRIM_ORDER[@]} -gt 0 ]]; then
156
+ for tname in "${TRIM_ORDER[@]}"; do
157
+ [[ -n "${IS_RULE[$tname]:-}" ]] || ORPHANS+=("$tname")
158
+ done
159
+ fi
160
+
161
+ # spec: doctrine-kit/SPEC.md §install-doctrine — the emit: a trimmed rule's marker replaces its bullet in place, because a block carrying both would satisfy the gate while handing back the rule the consumer removed
162
+ block() {
163
+ local line name
164
+ while IFS= read -r line; do
165
+ if name="$(bullet_name "$line")" && [[ -n "${TRIM_LINE[$name]+set}" ]]; then
166
+ printf '%s\n' "${TRIM_LINE[$name]}"
167
+ continue
168
+ fi
169
+ printf '%s\n' "$line"
170
+ done < <(digest)
171
+ # spec: doctrine-kit/SPEC.md §install-doctrine — a trim naming no live rule has no bullet position to take, so it is carried at the digest's end rather than dropped
172
+ if [[ ${#ORPHANS[@]} -gt 0 ]]; then
173
+ for name in "${ORPHANS[@]}"; do printf '%s\n' "${TRIM_LINE[$name]}"; done
174
+ fi
41
175
  }
42
176
 
43
177
  action="$(block | inject_marker_block "$AGENT_FILE" "$BEGIN" "$END")" || exit $?
44
- echo "install-doctrine: $action the doctrine reference block in $AGENT_FILE (link → $DOCTRINE_FILE)"
178
+
179
+ # spec: doctrine-kit/SPEC.md §install-doctrine — findings go to stderr, the one channel init does not discard, so a reconciliation the consumer owes is never silent on the install path
180
+ if [[ ${#ORPHANS[@]} -gt 0 ]]; then
181
+ for tname in "${ORPHANS[@]}"; do
182
+ echo "install-doctrine: declared trim names '$tname', which no rule in the current doctrine digest matches — carried forward unchanged; adopt the renamed rule or drop the marker" >&2
183
+ done
184
+ fi
185
+ if [[ ${#DUPES[@]} -gt 0 ]]; then
186
+ for tname in "${DUPES[@]}"; do
187
+ echo "install-doctrine: duplicate declared trim for '$tname' — the first is carried, the duplicate dropped" >&2
188
+ done
189
+ fi
190
+
191
+ findings=""
192
+ if [[ ${#ORPHANS[@]} -gt 0 ]]; then findings="$findings, ${#ORPHANS[@]} unmatched"; fi
193
+ if [[ ${#DUPES[@]} -gt 0 ]]; then findings="$findings, ${#DUPES[@]} duplicate"; fi
194
+ echo "install-doctrine: $action the doctrine reference block in $AGENT_FILE (link → $DOCTRINE_FILE); ${#TRIM_ORDER[@]} declared trim(s) carried$findings"
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env bash
2
2
  # graph: couples=CLAUDE.md,doctrine-kit/DOCTRINE.md dir=one valve=none tier=precommit
3
+ # install: zero-config
3
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
4
5
  #
5
6
  # usage: check-doctrine-registration.sh [agent-file [doctrine-file]]
@@ -84,8 +85,8 @@ insec {
84
85
  END { if (!seen) print "@@NOSECTION" }
85
86
  AWK
86
87
 
87
- # spec: doctrine-kit/SPEC.md §check-doctrine-registration — assertion D: every craft rule carries exactly one *Stages:* trailer matching the grammar (comma list of lowercase stages, or —)
88
- read -r -d '' CRAFT_WALK <<'AWK' || true
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
89
90
  function hlevel(line, n) {
90
91
  if (line !~ /^#+[[:space:]]/) return 0
91
92
  n = 0
@@ -93,7 +94,11 @@ function hlevel(line, n) {
93
94
  return n
94
95
  }
95
96
  function flush() {
96
- if (have) print "C\t" cur_name "\t" scount "\t" bad
97
+ if (have) print "C\t" cur_name "\t" tcount "\t" bad
98
+ }
99
+ BEGIN {
100
+ mark = "^[[:space:]]*\\*" trailer ":\\*"
101
+ strip = mark "[[:space:]]*"
97
102
  }
98
103
  !insec {
99
104
  if (hlevel($0) > 0 && substr($0, 1, length(section)) == section) {
@@ -109,13 +114,15 @@ insec {
109
114
  sub(/^[0-9]+\.[[:space:]]+\*\*/, "", name)
110
115
  sub(/\*\*.*/, "", name)
111
116
  sub(/\.$/, "", name)
112
- cur_name = name; have = 1; scount = 0; bad = 0
113
- } else if ($0 ~ /^[[:space:]]*\*Stages:\*/) {
114
- scount++
117
+ cur_name = name; have = 1; tcount = 0; bad = 0
118
+ } else if ($0 ~ mark) {
119
+ tcount++
115
120
  val = $0
116
- sub(/^[[:space:]]*\*Stages:\*[[:space:]]*/, "", val)
121
+ sub(strip, "", val)
117
122
  sub(/[[:space:]]+$/, "", val)
118
- if (val != "—" && val !~ /^[a-z]+(,[[:space:]]+[a-z]+)*$/) bad = 1
123
+ if (grammar == "stages") {
124
+ if (val != "—" && val !~ /^[a-z]+(,[[:space:]]+[a-z]+)*$/) bad = 1
125
+ } else if (val == "") bad = 1
119
126
  }
120
127
  next
121
128
  }
@@ -139,7 +146,7 @@ if [[ "$digest_out" == "@@NOSECTION" ]]; then
139
146
  exit 2 # exit 2: fail-closed
140
147
  fi
141
148
 
142
- craft_out="$(awk -v section="$CRAFT_SECTION" "$CRAFT_WALK" "$DOCTRINE_FILE")"; st=$?
149
+ craft_out="$(awk -v section="$CRAFT_SECTION" -v trailer=Stages -v grammar=stages "$TRAILER_WALK" "$DOCTRINE_FILE")"; st=$?
143
150
  fail_closed "$st" check-doctrine-registration awk
144
151
  if [[ "$craft_out" == "@@NOSECTION" ]]; then
145
152
  echo "check-doctrine-registration: no '$CRAFT_SECTION' section in $DOCTRINE_FILE — cannot certify the stage-routing trailers against an unreadable rule set" >&2
@@ -159,6 +166,20 @@ while IFS=$'\t' read -r kind name scount bad; do
159
166
  fi
160
167
  done <<< "$craft_out"
161
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
+
162
183
  declare -A in_digest in_trim in_doctrine
163
184
  digest_names=()
164
185
  trim_count=0
@@ -186,7 +207,7 @@ for name in "${digest_names[@]+"${digest_names[@]}"}"; do
186
207
  [[ -z "${in_doctrine[$name]:-}" ]] && orphans+=("$name")
187
208
  done
188
209
 
189
- if [[ ${#missing[@]} -gt 0 || ${#orphans[@]} -gt 0 || ${#craft_findings[@]} -gt 0 ]]; then
210
+ if [[ ${#missing[@]} -gt 0 || ${#orphans[@]} -gt 0 || ${#craft_findings[@]} -gt 0 || ${#digest_findings[@]} -gt 0 ]]; then
190
211
  if [[ ${#missing[@]} -gt 0 || ${#orphans[@]} -gt 0 ]]; then
191
212
  echo "check-doctrine-registration: the digest and the doctrine are out of lockstep in $AGENT_FILE:"
192
213
  for name in "${missing[@]+"${missing[@]}"}"; do
@@ -209,8 +230,17 @@ if [[ ${#missing[@]} -gt 0 || ${#orphans[@]} -gt 0 || ${#craft_findings[@]} -gt
209
230
  echo " trailer ('*Stages:* —' for none) so a re-vendored DOCTRINE.md that adds an"
210
231
  echo " untagged craft rule reddens instead of silently dropping out of stage routing."
211
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
212
242
  exit 1
213
243
  fi
214
244
 
215
- echo "DOCTRINE-REGISTRATION: clean ($AGENT_FILE links $DOCTRINE_FILE; $rule_count methodology rule(s) in per-rule digest lockstep, $trim_count declared trim(s); $craft_count craft rule(s) each carry one *Stages:* trailer)"
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)"
216
246
  exit 0
@@ -3,8 +3,11 @@
3
3
  ## Methodology-maintenance rules
4
4
 
5
5
  1. **Content-tiering / SSOT.** One content tier per surface; point, never restate.
6
+ *Digest:* one content tier per surface; point, never restate.
6
7
  2. **Enforcement-first.** The fix and the gate land in one unit.
8
+ *Digest:* the fix and the gate land in one unit.
7
9
  3. **De-literalization.** Prose cites names; code owns values.
10
+ *Digest:* prose cites names; code owns values.
8
11
 
9
12
  ## Engineering-craft rules
10
13
 
@@ -3,8 +3,11 @@
3
3
  ## Methodology-maintenance rules
4
4
 
5
5
  1. **Content-tiering / SSOT.** One content tier per surface; point, never restate.
6
+ *Digest:* one content tier per surface; point, never restate.
6
7
  2. **Enforcement-first.** The fix and the gate land in one unit.
8
+ *Digest:* the fix and the gate land in one unit.
7
9
  3. **De-literalization.** Prose cites names; code owns values.
10
+ *Digest:* prose cites names; code owns values.
8
11
 
9
12
  ## Engineering-craft rules
10
13
 
@@ -5,7 +5,8 @@
5
5
  # harness admits one bad/ dir, so this drives the digest-extra-line case
6
6
  # (assertion C), the declared-trim case (assertion B satisfied by a trim marker),
7
7
  # the link-absent case (assertion A), the craft-trailer cases (assertion D:
8
- # untagged and malformed), and the four fail-closed exits.
8
+ # untagged and malformed), the digest-trailer cases (assertion E: untrailered,
9
+ # doubled and empty), and the four fail-closed exits.
9
10
  #
10
11
  # Run by run-gate-tests.sh (any <tests-dir>/*.test.sh; must exit 0).
11
12
  set -uo pipefail
@@ -39,8 +40,11 @@ write_doctrine() { # $1=dir
39
40
  ## Methodology-maintenance rules
40
41
 
41
42
  1. **Content-tiering / SSOT.** One content tier per surface.
43
+ *Digest:* one tier per surface.
42
44
  2. **Enforcement-first.** The fix and the gate land in one unit.
45
+ *Digest:* fix and gate in one unit.
43
46
  3. **De-literalization.** Prose cites names; code owns values.
47
+ *Digest:* prose cites names.
44
48
 
45
49
  ## Engineering-craft rules
46
50
 
@@ -160,8 +164,11 @@ cat >"$u/DOCTRINE.md" <<'EOF'
160
164
  ## Methodology-maintenance rules
161
165
 
162
166
  1. **Content-tiering / SSOT.** One content tier per surface.
167
+ *Digest:* one tier per surface.
163
168
  2. **Enforcement-first.** The fix and the gate land in one unit.
169
+ *Digest:* fix and gate in one unit.
164
170
  3. **De-literalization.** Prose cites names; code owns values.
171
+ *Digest:* prose cites names.
165
172
 
166
173
  ## Engineering-craft rules
167
174
 
@@ -177,8 +184,11 @@ cat >"$f/DOCTRINE.md" <<'EOF'
177
184
  ## Methodology-maintenance rules
178
185
 
179
186
  1. **Content-tiering / SSOT.** One content tier per surface.
187
+ *Digest:* one tier per surface.
180
188
  2. **Enforcement-first.** The fix and the gate land in one unit.
189
+ *Digest:* fix and gate in one unit.
181
190
  3. **De-literalization.** Prose cites names; code owns values.
191
+ *Digest:* prose cites names.
182
192
 
183
193
  ## Engineering-craft rules
184
194
 
@@ -195,14 +205,84 @@ cat >"$c/DOCTRINE.md" <<'EOF'
195
205
  ## Methodology-maintenance rules
196
206
 
197
207
  1. **Content-tiering / SSOT.** One content tier per surface.
208
+ *Digest:* one tier per surface.
198
209
  2. **Enforcement-first.** The fix and the gate land in one unit.
210
+ *Digest:* fix and gate in one unit.
199
211
  3. **De-literalization.** Prose cites names; code owns values.
212
+ *Digest:* prose cites names.
200
213
  EOF
201
214
  check_case "craft-section-missing-failclosed" "$c" 2 "Engineering-craft rules"
202
215
 
216
+ # --- meth-untrailered: a methodology rule with no *Digest:* trailer (assertion E) ---
217
+ # The defect this assertion exists for: the rule reaches the doctrine, the digest
218
+ # has nothing to generate its bullet from, and every fresh install ships one short.
219
+ n="$SANDBOX/untrailered"; mkdir -p "$n"; write_full_agent "$n"
220
+ cat >"$n/DOCTRINE.md" <<'EOF'
221
+ # DOCTRINE.md — fixture doctrine
222
+
223
+ ## Methodology-maintenance rules
224
+
225
+ 1. **Content-tiering / SSOT.** One content tier per surface.
226
+ *Digest:* one tier per surface.
227
+ 2. **Enforcement-first.** The fix and the gate land in one unit.
228
+ *Digest:* fix and gate in one unit.
229
+ 3. **De-literalization.** Untrailered — no *Digest:* line.
230
+
231
+ ## Engineering-craft rules
232
+
233
+ 4. **Rename is a full-surface sweep.** Behind the link — never digested.
234
+ *Stages:* build
235
+ EOF
236
+ check_case "meth-untrailered" "$n" 1 "carries 0 *Digest:* trailer(s)"
237
+
238
+ # --- meth-double-trailer: two *Digest:* trailers on one rule (assertion E) ---
239
+ # Two trailers is not a harmless duplicate: the installer would silently pick one
240
+ # and the rule's digest line would stop being decidable from the doctrine.
241
+ w="$SANDBOX/doubled"; mkdir -p "$w"; write_full_agent "$w"
242
+ cat >"$w/DOCTRINE.md" <<'EOF'
243
+ # DOCTRINE.md — fixture doctrine
244
+
245
+ ## Methodology-maintenance rules
246
+
247
+ 1. **Content-tiering / SSOT.** One content tier per surface.
248
+ *Digest:* one tier per surface.
249
+ 2. **Enforcement-first.** The fix and the gate land in one unit.
250
+ *Digest:* fix and gate in one unit.
251
+ 3. **De-literalization.** Two trailers, so the bullet is undecidable.
252
+ *Digest:* prose cites names.
253
+ *Digest:* code owns values.
254
+
255
+ ## Engineering-craft rules
256
+
257
+ 4. **Rename is a full-surface sweep.** Behind the link — never digested.
258
+ *Stages:* build
259
+ EOF
260
+ check_case "meth-double-trailer" "$w" 1 "carries 2 *Digest:* trailer(s)"
261
+
262
+ # --- meth-empty-trailer: a *Digest:* trailer with no summary (assertion E) ---
263
+ e="$SANDBOX/emptytrailer"; mkdir -p "$e"; write_full_agent "$e"
264
+ cat >"$e/DOCTRINE.md" <<'EOF'
265
+ # DOCTRINE.md — fixture doctrine
266
+
267
+ ## Methodology-maintenance rules
268
+
269
+ 1. **Content-tiering / SSOT.** One content tier per surface.
270
+ *Digest:* one tier per surface.
271
+ 2. **Enforcement-first.** The fix and the gate land in one unit.
272
+ *Digest:* fix and gate in one unit.
273
+ 3. **De-literalization.** Present but empty — a bullet with no summary.
274
+ *Digest:*
275
+
276
+ ## Engineering-craft rules
277
+
278
+ 4. **Rename is a full-surface sweep.** Behind the link — never digested.
279
+ *Stages:* build
280
+ EOF
281
+ check_case "meth-empty-trailer" "$e" 1 "*Digest:* value is empty"
282
+
203
283
  if [[ "$fails" -gt 0 ]]; then
204
284
  echo "check-doctrine-registration.test.sh: $fails case(s) failed"
205
285
  exit 1
206
286
  fi
207
- echo "check-doctrine-registration.test.sh: clean (extra-line + declared-trim + link-absent + craft-untagged + craft-malformed + 4 fail-closed, 9 cases)"
287
+ echo "check-doctrine-registration.test.sh: clean (extra-line + declared-trim + link-absent + craft-untagged + craft-malformed + meth-untrailered + meth-double-trailer + meth-empty-trailer + 4 fail-closed, 12 cases)"
208
288
  exit 0
@@ -15,10 +15,176 @@ EOF
15
15
  fi
16
16
  bash "$SMOKE_KIT_ROOT/bin/install-doctrine.sh" >/dev/null
17
17
 
18
+ # spec: doctrine-kit/SPEC.md §install-doctrine — every assertion below reads the doctrine block alone, never the whole agent file: a consumer with several kits installed carries several marker blocks in one CLAUDE.md, and a bullet outside this kit's span is not this kit's to reason about
19
+ SMOKE_BEGIN="<!-- doctrine-kit:begin -->"
20
+ SMOKE_END="<!-- doctrine-kit:end -->"
21
+ smoke_block() { awk -v b="$SMOKE_BEGIN" -v e="$SMOKE_END" '$0 == e { inb = 0 } inb; $0 == b { inb = 1 }' CLAUDE.md; }
22
+
23
+ # spec: doctrine-kit/SPEC.md §install-doctrine — the declared-trim round-trip's acceptor. inject.sh is a sourced library with no gate surface (gate-sdk/SPEC.md §lib/inject.sh), so its read half and this installer's preservation rule are exercised here: declare a trim in the block the installer just emitted, re-run the installer, and hold that the marker survived *in the trimmed bullet's position* with the bullet gone and the gate green
24
+ mapfile -t SMOKE_RULES < <(smoke_block | awk '/^- \*\*/ { sub(/^- \*\*/, ""); sub(/\*\*.*/, ""); print }')
25
+ if [[ ${#SMOKE_RULES[@]} -lt 2 ]]; then
26
+ echo "doctrine smoke: the installed digest has fewer than two rule bullets — nothing to trim against" >&2
27
+ exit 2
28
+ fi
29
+ SMOKE_TRIMMED="${SMOKE_RULES[0]}"
30
+ SMOKE_NEXT="- **${SMOKE_RULES[1]}**"
31
+ SMOKE_TRIM="<!-- doctrine-digest-trim: $SMOKE_TRIMMED — smoke: the declared-trim round-trip acceptor -->"
32
+
33
+ awk -v b="$SMOKE_BEGIN" -v e="$SMOKE_END" -v bullet="- **$SMOKE_TRIMMED**" -v trim="$SMOKE_TRIM" '
34
+ $0 == b { inb = 1 }
35
+ $0 == e { inb = 0 }
36
+ inb && index($0, bullet) == 1 { print trim; next }
37
+ { print }
38
+ ' CLAUDE.md > CLAUDE.md.smoke && mv CLAUDE.md.smoke CLAUDE.md
39
+
40
+ bash "$SMOKE_KIT_ROOT/bin/install-doctrine.sh" >/dev/null
41
+
42
+ if ! smoke_block | grep -qF -- "$SMOKE_TRIM"; then
43
+ echo "doctrine smoke: the re-run dropped the declared trim for '$SMOKE_TRIMMED' — init silently revokes a customization doctrine-kit's own gate grants" >&2
44
+ exit 1
45
+ fi
46
+ if smoke_block | grep -qF -- "- **$SMOKE_TRIMMED**"; then
47
+ echo "doctrine smoke: the re-run restored the bullet for '$SMOKE_TRIMMED' — a block carrying the trim *and* its bullet hands back the rule the consumer removed" >&2
48
+ exit 1
49
+ fi
50
+ if [[ "$(smoke_block | grep -A1 -F -- "$SMOKE_TRIM" | tail -n1)" != "$SMOKE_NEXT"* ]]; then
51
+ echo "doctrine smoke: the carried trim for '$SMOKE_TRIMMED' is not in the trimmed bullet's position (expected '$SMOKE_NEXT' beneath it)" >&2
52
+ exit 1
53
+ fi
54
+ bash "$SMOKE_KIT_ROOT/checks/check-doctrine-registration.sh" >/dev/null \
55
+ || { echo "doctrine smoke: check-doctrine-registration is not green across the trim round-trip" >&2; exit 1; }
56
+
57
+ # spec: doctrine-kit/SPEC.md §install-doctrine — the two reported findings, each carried *and* named. Both ride stderr, so this captures that channel and not stdout
58
+ SMOKE_ORPHAN="<!-- doctrine-digest-trim: Rule-that-left — smoke: renamed upstream -->"
59
+ SMOKE_DUP="<!-- doctrine-digest-trim: $SMOKE_TRIMMED — smoke: a second declaration for one rule -->"
60
+ awk -v e="$SMOKE_END" -v orphan="$SMOKE_ORPHAN" -v dup="$SMOKE_DUP" '
61
+ $0 == e { print orphan; print dup }
62
+ { print }
63
+ ' CLAUDE.md > CLAUDE.md.smoke && mv CLAUDE.md.smoke CLAUDE.md
64
+
65
+ SMOKE_ERR="$(bash "$SMOKE_KIT_ROOT/bin/install-doctrine.sh" 2>&1 >/dev/null)"
66
+ if ! smoke_block | grep -qF -- "$SMOKE_ORPHAN"; then
67
+ echo "doctrine smoke: the re-run dropped a trim naming no live rule — a rule renamed upstream must survive to the re-vendor moment, not vanish before the consumer can reconcile it" >&2
68
+ exit 1
69
+ fi
70
+ case "$SMOKE_ERR" in
71
+ *Rule-that-left*) : ;;
72
+ *) echo "doctrine smoke: a trim naming no live rule was carried but never reported (stderr was: $SMOKE_ERR)" >&2; exit 1 ;;
73
+ esac
74
+ if [[ "$(smoke_block | grep -cF -- "doctrine-digest-trim: $SMOKE_TRIMMED")" != "1" ]]; then
75
+ echo "doctrine smoke: the duplicate trim for '$SMOKE_TRIMMED' was not carried exactly once" >&2
76
+ exit 1
77
+ fi
78
+ case "$SMOKE_ERR" in
79
+ *duplicate*"$SMOKE_TRIMMED"*) : ;;
80
+ *) echo "doctrine smoke: the duplicate trim for '$SMOKE_TRIMMED' was collapsed silently (stderr was: $SMOKE_ERR)" >&2; exit 1 ;;
81
+ esac
82
+ # spec: doctrine-kit/SPEC.md §install-doctrine — carrying an unmatched trim forward is only safe if the gate tolerates one; a gate that red on it would hand the consumer a broken battery instead of a reconciliation
83
+ bash "$SMOKE_KIT_ROOT/checks/check-doctrine-registration.sh" >/dev/null \
84
+ || { echo "doctrine smoke: check-doctrine-registration reds on a carried-forward trim naming no live rule — carrying it forward would break the consumer's battery" >&2; exit 1; }
85
+
86
+ # spec: doctrine-kit/SPEC.md §install-doctrine — the other direction, and the reason the smoke's steady state is an untrimmed consumer: withdrawing the declarations restores the bullet where it was
87
+ grep -v -F -e "$SMOKE_TRIM" -e "$SMOKE_ORPHAN" -e "$SMOKE_DUP" CLAUDE.md > CLAUDE.md.smoke && mv CLAUDE.md.smoke CLAUDE.md
88
+ bash "$SMOKE_KIT_ROOT/bin/install-doctrine.sh" >/dev/null
89
+ if ! smoke_block | grep -qF -- "- **$SMOKE_TRIMMED**"; then
90
+ echo "doctrine smoke: withdrawing the trim for '$SMOKE_TRIMMED' did not restore its bullet" >&2
91
+ exit 1
92
+ fi
93
+
94
+ # spec: doctrine-kit/SPEC.md §install-doctrine — the --remove path's acceptor. remove_marker_block (gate-sdk/SPEC.md §lib/inject.sh) is a sourced library with no gate surface, so its removal half is exercised here through the one caller that drives it: --remove must strip the block entirely, a second --remove must be an idempotent no-op, and a reinstall afterward must restore the same steady-state block this script's own baseline expects
95
+ bash "$SMOKE_KIT_ROOT/bin/install-doctrine.sh" --remove >/dev/null
96
+ if smoke_block | grep -q .; then
97
+ echo "doctrine smoke: --remove left doctrine block content in the agent file" >&2
98
+ exit 1
99
+ fi
100
+ if grep -qF -- "$SMOKE_BEGIN" CLAUDE.md; then
101
+ echo "doctrine smoke: --remove left the begin marker in the agent file" >&2
102
+ exit 1
103
+ fi
104
+
105
+ SMOKE_REMOVED="$(cat CLAUDE.md)"
106
+ bash "$SMOKE_KIT_ROOT/bin/install-doctrine.sh" --remove >/dev/null
107
+ if [[ "$(cat CLAUDE.md)" != "$SMOKE_REMOVED" ]]; then
108
+ echo "doctrine smoke: a second --remove changed an already-clean agent file" >&2
109
+ exit 1
110
+ fi
111
+
112
+ bash "$SMOKE_KIT_ROOT/bin/install-doctrine.sh" >/dev/null
113
+ if ! smoke_block | grep -q .; then
114
+ echo "doctrine smoke: a reinstall after --remove did not restore the doctrine block" >&2
115
+ exit 1
116
+ fi
117
+ bash "$SMOKE_KIT_ROOT/checks/check-doctrine-registration.sh" >/dev/null \
118
+ || { echo "doctrine smoke: check-doctrine-registration is not green after the --remove/reinstall round trip" >&2; exit 1; }
119
+
120
+ # spec: doctrine-kit/SPEC.md §install-doctrine — the derivation's refusals. The digest is derived from DOCTRINE.md's *Digest:* trailers, so a rule carrying none (or two) leaves its bullet undecidable; the installer must refuse rather than emit a digest silently one rule short, which is the exact defect the derivation replaced. Driven through the positional overrides so the refusal is *run*, not inspected
121
+ mkdir -p .doctrine-refusal
122
+ cat > .doctrine-refusal/AGENT.md <<'EOF'
123
+ # CLAUDE.md — refusal fixture
124
+
125
+ <!-- doctrine-kit:begin -->
126
+ sentinel
127
+ <!-- doctrine-kit:end -->
128
+ EOF
129
+ SMOKE_SENTINEL="$(cat .doctrine-refusal/AGENT.md)"
130
+
131
+ smoke_refusal() { # $1=label $2=stderr substring; the scratch doctrine on stdin
132
+ local rc=0 err
133
+ cat > .doctrine-refusal/DOCTRINE.md
134
+ err="$(bash "$SMOKE_KIT_ROOT/bin/install-doctrine.sh" \
135
+ .doctrine-refusal/AGENT.md .doctrine-refusal/DOCTRINE.md 2>&1 >/dev/null)" || rc=$?
136
+ if [[ "$rc" -ne 2 ]]; then
137
+ echo "doctrine smoke: $1 — the installer exited $rc, want 2; a digest it cannot derive must fail closed, not ship short" >&2
138
+ exit 1
139
+ fi
140
+ case "$err" in
141
+ *"$2"*) : ;;
142
+ *) echo "doctrine smoke: $1 — the refusal never named the offending rule (stderr was: $err)" >&2; exit 1 ;;
143
+ esac
144
+ if [[ "$(cat .doctrine-refusal/AGENT.md)" != "$SMOKE_SENTINEL" ]]; then
145
+ echo "doctrine smoke: $1 — the installer refused but still wrote the agent file; a refusal must leave the block untouched" >&2
146
+ exit 1
147
+ fi
148
+ }
149
+
150
+ smoke_refusal "untrailered rule" "Untrailered" <<'EOF'
151
+ # DOCTRINE.md — refusal fixture
152
+
153
+ ## Methodology-maintenance rules
154
+
155
+ 1. **Kept.** Has a trailer.
156
+ *Digest:* kept.
157
+ 2. **Untrailered.** The rule that would ship a digest one bullet short.
158
+
159
+ ## Engineering-craft rules
160
+
161
+ 3. **Craft.** Behind the link.
162
+ *Stages:* build
163
+ EOF
164
+
165
+ smoke_refusal "doubled trailer" "Doubled" <<'EOF'
166
+ # DOCTRINE.md — refusal fixture
167
+
168
+ ## Methodology-maintenance rules
169
+
170
+ 1. **Kept.** Has a trailer.
171
+ *Digest:* kept.
172
+ 2. **Doubled.** Two trailers, so the bullet is undecidable.
173
+ *Digest:* first.
174
+ *Digest:* second.
175
+
176
+ ## Engineering-craft rules
177
+
178
+ 3. **Craft.** Behind the link.
179
+ *Stages:* build
180
+ EOF
181
+
182
+ rm -rf .doctrine-refusal
183
+
18
184
  cat >> scripts/gates.list <<'EOF'
19
185
  # doctrine-kit
20
186
  check-doctrine-registration
21
187
  EOF
22
188
 
23
189
  bash "$SDK/bin/gen-pre-commit.sh" --write >/dev/null
24
- bash "$SDK/checks/check-graph.sh" --emit > .workflow/CHECK-GRAPH.html
190
+ bash "$SDK/checks/check-graph.sh" --emit > scripts/CHECK-GRAPH.html