checkwright 0.22.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 (346) hide show
  1. package/README.md +687 -90
  2. package/lib/common/lock.sh +38 -9
  3. package/lib/common/profile.sh +33 -0
  4. package/lib/common/recipe.sh +49 -33
  5. package/lib/diff.sh +64 -0
  6. package/lib/doctor.sh +67 -42
  7. package/lib/init.sh +23 -31
  8. package/lib/uninstall.sh +212 -0
  9. package/lib/update.sh +34 -0
  10. package/package.json +2 -2
  11. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates +0 -0
  12. package/payload/artifact/x86_64-unknown-linux-gnu/checkwright-gates.sha256 +1 -1
  13. package/payload/canon-kit/README.md +1 -0
  14. package/payload/canon-kit/SPEC.md +410 -58
  15. package/payload/canon-kit/checks/check-amendment-queue.sh +1 -0
  16. package/payload/canon-kit/checks/check-comment-tier.gate +3 -0
  17. package/payload/canon-kit/checks/check-deprecation-task.gate +3 -0
  18. package/payload/canon-kit/checks/check-docs-cmd.gate +3 -0
  19. package/payload/canon-kit/checks/check-docs-link-convention.sh +1 -0
  20. package/payload/canon-kit/checks/check-install-claim.gate +3 -0
  21. package/payload/canon-kit/checks/check-knob-citation.gate +3 -0
  22. package/payload/canon-kit/checks/check-knob-default-coupling.sh +1 -0
  23. package/payload/canon-kit/checks/check-manifest-count.gate +3 -0
  24. package/payload/canon-kit/checks/check-manifest-temporal.gate +3 -0
  25. package/payload/canon-kit/checks/check-md-refs.gate +3 -0
  26. package/payload/canon-kit/checks/check-measured-claim.gate +3 -0
  27. package/payload/canon-kit/checks/check-payload-claim.gate +3 -0
  28. package/payload/canon-kit/checks/check-prose-enum.gate +3 -0
  29. package/payload/canon-kit/checks/check-prose-tells.sh +1 -0
  30. package/payload/canon-kit/checks/check-spec-derivable-section.gate +3 -0
  31. package/payload/canon-kit/checks/check-spec-dod-singleton.gate +3 -0
  32. package/payload/canon-kit/checks/check-spec-embedded-source.sh +1 -0
  33. package/payload/canon-kit/checks/check-spec-fence-balance.gate +3 -0
  34. package/payload/canon-kit/checks/check-spec-pointer.gate +3 -0
  35. package/payload/canon-kit/checks/check-surface-duplication.sh +1 -0
  36. package/payload/canon-kit/checks/check-todo-task-liveness.gate +3 -0
  37. package/payload/canon-kit/checks/check-tracking-claim.gate +3 -0
  38. package/payload/canon-kit/gate-tests/check-comment-tier/bad/.workflow/fixture-state.txt +4 -0
  39. package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.gate +4 -0
  40. package/payload/canon-kit/gate-tests/check-comment-tier/bad/bad.rs +5 -0
  41. package/payload/canon-kit/gate-tests/check-comment-tier/bad/expect.txt +4 -0
  42. package/payload/canon-kit/gate-tests/check-comment-tier/bad/templates/bad-tmpl.sh +4 -0
  43. package/payload/canon-kit/gate-tests/check-comment-tier/good/.workflow/fixture-state.txt +3 -0
  44. package/payload/canon-kit/gate-tests/check-comment-tier/good/expect.txt +1 -1
  45. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.gate +4 -0
  46. package/payload/canon-kit/gate-tests/check-comment-tier/good/good.rs +5 -0
  47. package/payload/canon-kit/gate-tests/check-comment-tier/good/templates/good-tmpl.sh +5 -0
  48. package/payload/canon-kit/gate-tests/check-comment-tier.test.sh +3 -2
  49. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/.workflow/fixture-state.txt +3 -0
  50. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/bad.gate +2 -0
  51. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/bad.rs +4 -0
  52. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/expect.txt +3 -0
  53. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/scripts/canon-config.sh +6 -5
  54. package/payload/canon-kit/gate-tests/check-deprecation-task/bad/templates/tmpl.sh +5 -0
  55. package/payload/canon-kit/gate-tests/check-deprecation-task/good/.workflow/fixture-state.txt +3 -0
  56. package/payload/canon-kit/gate-tests/check-deprecation-task/good/expect.txt +1 -1
  57. package/payload/canon-kit/gate-tests/check-deprecation-task/good/good.gate +2 -0
  58. package/payload/canon-kit/gate-tests/check-deprecation-task/good/good.rs +4 -0
  59. package/payload/canon-kit/gate-tests/check-deprecation-task/good/scripts/canon-config.sh +6 -5
  60. package/payload/canon-kit/gate-tests/check-deprecation-task/good/templates/tmpl.sh +5 -0
  61. package/payload/canon-kit/gate-tests/check-deprecation-task.test.sh +4 -3
  62. package/payload/canon-kit/gate-tests/check-knob-citation.test.sh +2 -2
  63. package/payload/canon-kit/gate-tests/check-manifest-count/good/SPEC.md +4 -0
  64. package/payload/canon-kit/gate-tests/check-manifest-count.test.sh +27 -5
  65. package/payload/canon-kit/gate-tests/check-md-refs.test.sh +61 -9
  66. package/payload/canon-kit/gate-tests/check-measured-claim/bad/SPEC.md +12 -0
  67. package/payload/canon-kit/gate-tests/check-measured-claim/bad/expect.txt +3 -0
  68. package/payload/canon-kit/gate-tests/check-measured-claim/bad/scripts/canon-config.sh +6 -0
  69. package/payload/canon-kit/gate-tests/check-measured-claim/good/SPEC.md +23 -0
  70. package/payload/canon-kit/gate-tests/check-measured-claim/good/expect.txt +1 -0
  71. package/payload/canon-kit/gate-tests/check-measured-claim/good/scripts/canon-config.sh +6 -0
  72. package/payload/canon-kit/gate-tests/check-measured-claim.test.sh +90 -0
  73. package/payload/canon-kit/gate-tests/check-prose-enum.test.sh +3 -3
  74. package/payload/canon-kit/gate-tests/check-spec-dod-singleton.test.sh +21 -7
  75. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/.workflow/fixture-state.txt +2 -0
  76. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/bad.gate +2 -0
  77. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/bad.rs +4 -0
  78. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/expect.txt +3 -0
  79. package/payload/canon-kit/gate-tests/check-spec-pointer/bad/templates/tmpl.sh +5 -0
  80. package/payload/canon-kit/gate-tests/check-spec-pointer/good/.workflow/fixture-state.txt +2 -0
  81. package/payload/canon-kit/gate-tests/check-spec-pointer/good/expect.txt +1 -1
  82. package/payload/canon-kit/gate-tests/check-spec-pointer/good/good.gate +2 -0
  83. package/payload/canon-kit/gate-tests/check-spec-pointer/good/good.rs +4 -0
  84. package/payload/canon-kit/gate-tests/check-spec-pointer/good/templates/tmpl.sh +5 -0
  85. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/.workflow/fixture-state.txt +3 -0
  86. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/bad.gate +2 -0
  87. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/bad.rs +4 -0
  88. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/expect.txt +3 -0
  89. package/payload/canon-kit/gate-tests/check-todo-task-liveness/bad/templates/tmpl.sh +5 -0
  90. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/.workflow/fixture-state.txt +3 -0
  91. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/expect.txt +1 -1
  92. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/good.gate +2 -0
  93. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/good.rs +4 -0
  94. package/payload/canon-kit/gate-tests/check-todo-task-liveness/good/templates/tmpl.sh +5 -0
  95. package/payload/canon-kit/gate-tests/check-tracking-claim.test.sh +1 -2
  96. package/payload/canon-kit/lib/spec.sh +91 -62
  97. package/payload/canon-kit/smoke/install.sh +1 -0
  98. package/payload/canon-kit/templates/SPEC-amendment.md +4 -1
  99. package/payload/context-kit/README.md +4 -1
  100. package/payload/context-kit/SPEC.md +143 -10
  101. package/payload/context-kit/bin/env-probe.sh +19 -6
  102. package/payload/context-kit/checks/check-brevity.sh +1 -0
  103. package/payload/context-kit/checks/check-footprint-fresh.sh +1 -0
  104. package/payload/context-kit/checks/check-memory-off.sh +1 -0
  105. package/payload/context-kit/checks/check-settings-paths.sh +94 -0
  106. package/payload/context-kit/checks/check-settings-pins.sh +1 -0
  107. package/payload/context-kit/gate-tests/check-settings-paths/bad/args +1 -0
  108. package/payload/context-kit/gate-tests/check-settings-paths/bad/expect.txt +3 -0
  109. package/payload/context-kit/gate-tests/check-settings-paths/bad/settings.json +12 -0
  110. package/payload/context-kit/gate-tests/check-settings-paths/bad/tools/real-tool.sh +4 -0
  111. package/payload/context-kit/gate-tests/check-settings-paths/good/args +1 -0
  112. package/payload/context-kit/gate-tests/check-settings-paths/good/expect.txt +1 -0
  113. package/payload/context-kit/gate-tests/check-settings-paths/good/settings.json +16 -0
  114. package/payload/context-kit/gate-tests/check-settings-paths/good/tools/real-tool.sh +4 -0
  115. package/payload/context-kit/index-tests/expected/toolfloor.txt +9 -0
  116. package/payload/context-kit/index-tests/toolfloor-cases.sh +20 -0
  117. package/payload/context-kit/lib/toolfloor.sh +15 -4
  118. package/payload/context-kit/smoke/agents-md.sh +12 -1
  119. package/payload/context-kit/smoke/install.sh +1 -0
  120. package/payload/delegation-kit/README.md +3 -3
  121. package/payload/delegation-kit/SPEC.md +116 -13
  122. package/payload/delegation-kit/checks/check-agent-tier-explicit.sh +1 -0
  123. package/payload/delegation-kit/checks/check-gate-tamper.sh +1 -0
  124. package/payload/delegation-kit/checks/check-rule-citation.sh +1 -0
  125. package/payload/delegation-kit/templates/agent-execution.md +38 -14
  126. package/payload/delegation-kit/templates/statusline-usage.sh +23 -1
  127. package/payload/doctrine-kit/DOCTRINE.md +86 -12
  128. package/payload/doctrine-kit/README.md +7 -3
  129. package/payload/doctrine-kit/SPEC.md +102 -9
  130. package/payload/doctrine-kit/bin/install-doctrine.sh +83 -13
  131. package/payload/doctrine-kit/checks/check-doctrine-registration.sh +41 -11
  132. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/bad/DOCTRINE.md +3 -0
  133. package/payload/doctrine-kit/gate-tests/check-doctrine-registration/good/DOCTRINE.md +3 -0
  134. package/payload/doctrine-kit/gate-tests/check-doctrine-registration.test.sh +82 -2
  135. package/payload/doctrine-kit/smoke/install.sh +90 -0
  136. package/payload/drift-kit/SPEC.md +13 -4
  137. package/payload/drift-kit/bin/kfric.sh +21 -2
  138. package/payload/drift-kit/smoke/install.sh +28 -0
  139. package/payload/evidence-kit/checks/check-battery-roster.sh +1 -0
  140. package/payload/evidence-kit/checks/check-evidence-baseline.sh +1 -0
  141. package/payload/evidence-kit/checks/check-evidence-manifest.sh +1 -0
  142. package/payload/evidence-kit/checks/check-producer-liveness.sh +1 -0
  143. package/payload/gate-sdk/README.md +13 -0
  144. package/payload/gate-sdk/SPEC.md +2611 -151
  145. package/payload/gate-sdk/bin/build-native.sh +38 -0
  146. package/payload/gate-sdk/bin/enforcement-map.sh +2 -1
  147. package/payload/gate-sdk/bin/gen-pre-commit.sh +23 -3
  148. package/payload/gate-sdk/bin/port-blockers.sh +445 -0
  149. package/payload/gate-sdk/bin/run-consumer-smoke.sh +8 -1
  150. package/payload/gate-sdk/bin/run-gate-tests.sh +26 -5
  151. package/payload/gate-sdk/bin/run-gates.sh +8 -2
  152. package/payload/gate-sdk/bin/upgrade-smoke.sh +52 -4
  153. package/payload/gate-sdk/checks/check-action-gh-repo.gate +1 -0
  154. package/payload/gate-sdk/checks/check-action-pinning.gate +1 -0
  155. package/payload/gate-sdk/checks/check-action-run-shell.sh +1 -0
  156. package/payload/gate-sdk/checks/check-assertion-strength.gate +3 -0
  157. package/payload/gate-sdk/checks/check-commit-msg.sh +1 -0
  158. package/payload/gate-sdk/checks/check-commit-subject.sh +1 -0
  159. package/payload/gate-sdk/checks/check-core-files.sh +1 -0
  160. package/payload/gate-sdk/checks/check-crate-arms.sh +61 -0
  161. package/payload/gate-sdk/checks/check-enforcement-fresh.sh +1 -0
  162. package/payload/gate-sdk/checks/check-exec-bit.sh +1 -0
  163. package/payload/gate-sdk/checks/check-gate-assertions.sh +31 -6
  164. package/payload/gate-sdk/checks/check-gate-binary-fresh.sh +2 -1
  165. package/payload/gate-sdk/checks/check-gate-exemption-tasks.sh +1 -0
  166. package/payload/gate-sdk/checks/check-gate-fail-closed.sh +1 -0
  167. package/payload/gate-sdk/checks/check-gate-fixture-coverage.sh +1 -0
  168. package/payload/gate-sdk/checks/check-gate-output.sh +33 -3
  169. package/payload/gate-sdk/checks/check-gate-substrate-parity.sh +36 -5
  170. package/payload/gate-sdk/checks/check-graph.sh +1 -0
  171. package/payload/gate-sdk/checks/check-hook-exec-bit.sh +1 -0
  172. package/payload/gate-sdk/checks/check-identity.sh +1 -0
  173. package/payload/gate-sdk/checks/check-install-disposition.sh +92 -0
  174. package/payload/gate-sdk/checks/check-kit-enum.sh +1 -0
  175. package/payload/gate-sdk/checks/check-kit-registration.gate +3 -0
  176. package/payload/gate-sdk/checks/check-readme-roster.sh +1 -0
  177. package/payload/gate-sdk/checks/check-reads-couples.sh +3 -2
  178. package/payload/gate-sdk/checks/check-root-tiering.sh +1 -0
  179. package/payload/gate-sdk/checks/check-shellcheck.sh +1 -0
  180. package/payload/gate-sdk/checks/check-smoke-entry-guard.gate +3 -0
  181. package/payload/gate-sdk/checks/check-template-copy-parity.sh +1 -0
  182. package/payload/gate-sdk/checks/check-template-registry-parity.gate +3 -0
  183. package/payload/gate-sdk/checks/check-test-hermetic.gate +3 -0
  184. package/payload/gate-sdk/checks/check-tree-terms.sh +1 -0
  185. package/payload/gate-sdk/checks/check-workflow-tiering.sh +2 -1
  186. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/crate/Cargo.toml +7 -0
  187. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/crate/src/lib.rs +12 -0
  188. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/expect.txt +5 -0
  189. package/payload/gate-sdk/gate-tests/check-crate-arms/bad/scripts/gate-sdk-config.sh +2 -0
  190. package/payload/gate-sdk/gate-tests/check-crate-arms/good/crate/Cargo.toml +7 -0
  191. package/payload/gate-sdk/gate-tests/check-crate-arms/good/crate/src/lib.rs +11 -0
  192. package/payload/gate-sdk/gate-tests/check-crate-arms/good/expect.txt +2 -0
  193. package/payload/gate-sdk/gate-tests/check-crate-arms/good/scripts/gate-sdk-config.sh +2 -0
  194. package/payload/gate-sdk/gate-tests/check-gate-assertions/good/expect.txt +1 -1
  195. package/payload/gate-sdk/gate-tests/check-gate-output/bad/check-native-sample.gate +3 -0
  196. package/payload/gate-sdk/gate-tests/check-gate-output/bad/expect.txt +3 -0
  197. package/payload/gate-sdk/gate-tests/check-gate-output/bad/gates.list +1 -0
  198. package/payload/gate-sdk/gate-tests/check-gate-output/bad/native/Cargo.toml +4 -0
  199. package/payload/gate-sdk/gate-tests/check-gate-output/bad/native/src/gates/native_sample.rs +7 -0
  200. package/payload/gate-sdk/gate-tests/check-gate-output/good/check-native-sample.gate +3 -0
  201. package/payload/gate-sdk/gate-tests/check-gate-output/good/expect.txt +1 -1
  202. package/payload/gate-sdk/gate-tests/check-gate-output/good/gates.list +1 -0
  203. package/payload/gate-sdk/gate-tests/check-gate-output/good/native/Cargo.toml +4 -0
  204. package/payload/gate-sdk/gate-tests/check-gate-output/good/native/src/gates/native_sample.rs +11 -0
  205. package/payload/gate-sdk/gate-tests/check-gate-output.test.sh +111 -0
  206. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity/good/expect.txt +1 -1
  207. package/payload/gate-sdk/gate-tests/check-gate-substrate-parity.test.sh +65 -4
  208. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-alpha.sh +6 -0
  209. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-delta.sh +5 -0
  210. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/checks/check-epsilon.sh +6 -0
  211. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/alpha-kit/smoke/install.sh +7 -0
  212. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/args +6 -0
  213. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/expect.txt +1 -0
  214. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/installer/lib/common/recipe.sh +9 -0
  215. package/payload/gate-sdk/gate-tests/check-install-disposition/bad/scripts/gate-sdk-config.sh +5 -0
  216. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-alpha.sh +6 -0
  217. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-beta.gate +3 -0
  218. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/checks/check-gamma.sh +6 -0
  219. package/payload/gate-sdk/gate-tests/check-install-disposition/good/alpha-kit/smoke/install.sh +8 -0
  220. package/payload/gate-sdk/gate-tests/check-install-disposition/good/args +6 -0
  221. package/payload/gate-sdk/gate-tests/check-install-disposition/good/expect.txt +1 -0
  222. package/payload/gate-sdk/gate-tests/check-install-disposition/good/installer/lib/common/recipe.sh +10 -0
  223. package/payload/gate-sdk/gate-tests/check-install-disposition/good/scripts/gate-sdk-config.sh +5 -0
  224. package/payload/gate-sdk/gate-tests/check-kit-registration.test.sh +6 -5
  225. package/payload/gate-sdk/gate-tests/check-test-hermetic-smoke.test.sh +2 -3
  226. package/payload/gate-sdk/gate-tests/lib-gate.test.sh +111 -1
  227. package/payload/gate-sdk/gate-tests/run-dispatch-streams.test.sh +73 -0
  228. package/payload/gate-sdk/lib/consumer-smoke.sh +24 -12
  229. package/payload/gate-sdk/lib/gate.sh +135 -11
  230. package/payload/gate-sdk/lib/inject.sh +25 -0
  231. package/payload/gate-sdk/lib/test-hermetic.sh +26 -0
  232. package/payload/gate-sdk/smoke/install.sh +42 -0
  233. package/payload/guard-kit/README.md +14 -11
  234. package/payload/guard-kit/SPEC.md +278 -62
  235. package/payload/guard-kit/bin/run-guard-tests.sh +1 -0
  236. package/payload/guard-kit/gate-tests/guard-read-path.test.sh +52 -0
  237. package/payload/guard-kit/guard-tests/cases.tsv +49 -7
  238. package/payload/guard-kit/lib/guard.sh +276 -54
  239. package/payload/guard-kit/templates/close-triage.md +5 -5
  240. package/payload/guard-kit/templates/settings-hooks.json +7 -1
  241. package/payload/lifecycle-kit/README.md +11 -1
  242. package/payload/lifecycle-kit/SPEC.md +441 -37
  243. package/payload/lifecycle-kit/bin/cite-survey.sh +81 -0
  244. package/payload/lifecycle-kit/bin/enter-stage.sh +126 -10
  245. package/payload/lifecycle-kit/bin/file-gap.sh +27 -10
  246. package/payload/lifecycle-kit/bin/file-survey.sh +21 -2
  247. package/payload/lifecycle-kit/checks/check-close-surfaces.sh +1 -0
  248. package/payload/lifecycle-kit/checks/check-gap-inbox-neutrality.gate +3 -0
  249. package/payload/lifecycle-kit/checks/check-lesson-disposition.gate +3 -0
  250. package/payload/lifecycle-kit/checks/check-lifecycle-registration.gate +3 -0
  251. package/payload/lifecycle-kit/checks/check-merge-attrs.gate +3 -0
  252. package/payload/lifecycle-kit/checks/check-scratch-citation.gate +3 -0
  253. package/payload/lifecycle-kit/checks/check-shim-restatement.gate +3 -0
  254. package/payload/lifecycle-kit/checks/check-skill-binding.gate +3 -0
  255. package/payload/lifecycle-kit/checks/check-stage-entry.sh +1 -0
  256. package/payload/lifecycle-kit/checks/check-stage-evidence.gate +3 -0
  257. package/payload/lifecycle-kit/checks/check-stage-skill-coverage.gate +3 -0
  258. package/payload/lifecycle-kit/checks/check-survey-record.gate +3 -0
  259. package/payload/lifecycle-kit/gate-tests/check-close-surfaces.test.sh +1 -2
  260. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/bad/args +2 -0
  261. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/bad/expect.txt +3 -0
  262. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/bad/gap-inbox.md +5 -0
  263. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/good/args +2 -0
  264. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/good/expect.txt +1 -0
  265. package/payload/lifecycle-kit/gate-tests/check-gap-inbox-neutrality/good/gap-inbox.md +4 -0
  266. package/payload/lifecycle-kit/gate-tests/check-lesson-disposition.test.sh +2 -3
  267. package/payload/lifecycle-kit/gate-tests/check-lifecycle-registration.test.sh +2 -3
  268. package/payload/lifecycle-kit/gate-tests/check-merge-attrs.test.sh +2 -3
  269. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/expect.txt +1 -0
  270. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/scripts/lifecycle-config.sh +4 -0
  271. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/bad/surfaces/queue.md +13 -0
  272. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/expect.txt +1 -0
  273. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/scripts/lifecycle-config.sh +4 -0
  274. package/payload/lifecycle-kit/gate-tests/check-scratch-citation/good/surfaces/queue.md +31 -0
  275. package/payload/lifecycle-kit/gate-tests/check-shim-restatement.test.sh +2 -3
  276. package/payload/lifecycle-kit/gate-tests/check-skill-binding.test.sh +2 -3
  277. package/payload/lifecycle-kit/gate-tests/check-stage-entry.test.sh +2 -3
  278. package/payload/lifecycle-kit/gate-tests/check-stage-evidence.test.sh +9 -5
  279. package/payload/lifecycle-kit/gate-tests/check-survey-record.test.sh +2 -3
  280. package/payload/lifecycle-kit/gate-tests/file-gap-recurrence.test.sh +54 -26
  281. package/payload/lifecycle-kit/gate-tests/rename-iteration.test.sh +142 -0
  282. package/payload/lifecycle-kit/gate-tests/workflow-state-guard.test.sh +100 -0
  283. package/payload/lifecycle-kit/lib/stages.sh +4 -0
  284. package/payload/lifecycle-kit/smoke/install.sh +67 -4
  285. package/payload/lifecycle-kit/templates/lead.md +36 -0
  286. package/payload/lifecycle-kit/templates/stages/close.md +30 -11
  287. package/payload/lifecycle-kit/templates/stages/scope.md +9 -4
  288. package/payload/lifecycle-kit/templates/stages/spec.md +5 -1
  289. package/payload/lifecycle-kit/templates/workflow-state-guard.sh +29 -0
  290. package/payload/queue-kit/README.md +3 -1
  291. package/payload/queue-kit/SPEC.md +123 -3
  292. package/payload/queue-kit/bin/queue-counts.sh +35 -0
  293. package/payload/queue-kit/checks/check-queue-entry-budget.gate +3 -0
  294. package/payload/queue-kit/checks/check-queue-hygiene.gate +3 -0
  295. package/payload/queue-kit/checks/check-queue-prose-precondition.sh +1 -0
  296. package/payload/queue-kit/checks/check-queue-sections.gate +3 -0
  297. package/payload/queue-kit/checks/check-queue-slug-liveness.gate +3 -0
  298. package/payload/queue-kit/checks/check-queue-wrap.gate +3 -0
  299. package/payload/queue-kit/checks/check-roadmap-fresh.sh +1 -0
  300. package/payload/queue-kit/checks/check-tag-lead-line.gate +3 -0
  301. package/payload/queue-kit/checks/check-task-conservation.gate +4 -0
  302. package/payload/queue-kit/checks/check-task-names.gate +3 -0
  303. package/payload/queue-kit/gate-tests/queue-counts.test.sh +116 -0
  304. package/payload/queue-kit/gate-tests/queue-lib-parity.test.sh +215 -0
  305. package/payload/queue-kit/lib/queue.sh +4 -19
  306. package/payload/site-kit/SPEC.md +23 -0
  307. package/payload/site-kit/checks/check-docs-cname-parity.sh +1 -0
  308. package/payload/site-kit/checks/check-docs-render-fidelity.sh +1 -0
  309. package/profiles.list +36 -8
  310. package/payload/canon-kit/checks/check-comment-tier.sh +0 -216
  311. package/payload/canon-kit/checks/check-deprecation-task.sh +0 -90
  312. package/payload/canon-kit/checks/check-docs-cmd.sh +0 -153
  313. package/payload/canon-kit/checks/check-install-claim.sh +0 -146
  314. package/payload/canon-kit/checks/check-knob-citation.sh +0 -117
  315. package/payload/canon-kit/checks/check-manifest-count.sh +0 -46
  316. package/payload/canon-kit/checks/check-manifest-temporal.sh +0 -83
  317. package/payload/canon-kit/checks/check-md-refs.sh +0 -128
  318. package/payload/canon-kit/checks/check-payload-claim.sh +0 -133
  319. package/payload/canon-kit/checks/check-prose-enum.sh +0 -115
  320. package/payload/canon-kit/checks/check-spec-derivable-section.sh +0 -69
  321. package/payload/canon-kit/checks/check-spec-dod-singleton.sh +0 -45
  322. package/payload/canon-kit/checks/check-spec-fence-balance.sh +0 -42
  323. package/payload/canon-kit/checks/check-spec-pointer.sh +0 -187
  324. package/payload/canon-kit/checks/check-todo-task-liveness.sh +0 -80
  325. package/payload/canon-kit/checks/check-tracking-claim.sh +0 -136
  326. package/payload/gate-sdk/checks/check-assertion-strength.sh +0 -134
  327. package/payload/gate-sdk/checks/check-kit-registration.sh +0 -68
  328. package/payload/gate-sdk/checks/check-smoke-entry-guard.sh +0 -53
  329. package/payload/gate-sdk/checks/check-template-registry-parity.sh +0 -81
  330. package/payload/gate-sdk/checks/check-test-hermetic.sh +0 -119
  331. package/payload/lifecycle-kit/checks/check-lesson-disposition.sh +0 -98
  332. package/payload/lifecycle-kit/checks/check-lifecycle-registration.sh +0 -54
  333. package/payload/lifecycle-kit/checks/check-merge-attrs.sh +0 -69
  334. package/payload/lifecycle-kit/checks/check-shim-restatement.sh +0 -97
  335. package/payload/lifecycle-kit/checks/check-skill-binding.sh +0 -59
  336. package/payload/lifecycle-kit/checks/check-stage-evidence.sh +0 -81
  337. package/payload/lifecycle-kit/checks/check-stage-skill-coverage.sh +0 -47
  338. package/payload/lifecycle-kit/checks/check-survey-record.sh +0 -102
  339. package/payload/queue-kit/checks/check-queue-entry-budget.sh +0 -106
  340. package/payload/queue-kit/checks/check-queue-hygiene.sh +0 -81
  341. package/payload/queue-kit/checks/check-queue-sections.sh +0 -44
  342. package/payload/queue-kit/checks/check-queue-slug-liveness.sh +0 -63
  343. package/payload/queue-kit/checks/check-queue-wrap.sh +0 -56
  344. package/payload/queue-kit/checks/check-tag-lead-line.sh +0 -70
  345. package/payload/queue-kit/checks/check-task-conservation.sh +0 -50
  346. package/payload/queue-kit/checks/check-task-names.sh +0 -128
@@ -62,16 +62,65 @@ The block is the always-loaded shape applied to the doctrine itself: a one-line
62
62
  digest of the methodology-maintenance rules plus a markdown link to the doctrine
63
63
  file. The engineering-craft register is not digested — it is load-triggered and
64
64
  reached through the link, so the always-loaded surface carries only what bears
65
- on every edit. The installer is the single source of the block text, so a manual
66
- insertion for a harness-less consumer copies what the tool would emit; the README
67
- documents that manual path. The installed digest names every methodology rule,
68
- so a fresh consumer is in per-rule lockstep out of the box (installer and gate
69
- agree on the `## Delivery doctrine` heading — that agreement is part of
65
+ on every edit. The installer is the single source of the block *text* — the
66
+ heading, the link paragraph, the bullet shape — so a manual insertion for a
67
+ harness-less consumer copies what the tool would emit; the README documents that
68
+ manual path. It is not the source of the block's *content*: the rule bullets are
69
+ derived from `DOCTRINE.md` (below), so the installed digest names every
70
+ methodology rule by construction rather than by an author remembering to, and a
71
+ fresh consumer is in per-rule lockstep out of the box (installer and gate agree
72
+ on the `## Delivery doctrine` heading — that agreement is part of
70
73
  check-doctrine-registration's contract). Trimming a rule the consumer does not
71
74
  keep resident stays legal, but rides a declared-trim marker rather than a silent
72
75
  deletion: the gate asserts name-lockstep modulo declared trims (§check-doctrine-registration
73
76
  assertion B).
74
77
 
78
+ **The digest is derived from the doctrine, one bullet per rule.** Each
79
+ methodology rule carries a `*Digest:* <one-line summary>` trailer, and the
80
+ installer emits that rule's bullet as `- **<name>** — <summary>`: the name read
81
+ exactly as §check-doctrine-registration assertion C reads it, the summary taken
82
+ from the trailer verbatim. The bullet roster is therefore the rule roster, and
83
+ the two cannot come to differ in count — the drift axis is removed rather than
84
+ watched, which is what Derivation-first asks for before Enforcement-first is
85
+ even consulted. A hand-maintained bullet list is what this replaces, and its
86
+ failure mode was not hypothetical: a rule that landed in `DOCTRINE.md` and in
87
+ this repo's own agent file never reached the installer's list, so every fresh
88
+ install vendored a digest one rule short while the consumer-side gate stayed
89
+ green — the skew is invisible from the tree that has both copies right.
90
+
91
+ *Why a trailer and not the rule's own prose.* The obvious cheaper design is to
92
+ extract the summary from the rule body's opening sentence and add no format at
93
+ all. It was measured rather than assumed, and it does not hold: of the twelve
94
+ bullets the digest shipped, **none** occurs as contiguous text anywhere in
95
+ `DOCTRINE.md`. The digest register is deliberately terser and more imperative
96
+ than the doctrine's statement register — the rule states the convention and its
97
+ scope, the bullet is what survives in a file read in full at every session start
98
+ — so extraction would either degrade the doctrine's own prose into digest
99
+ shorthand or invent a summary the author never wrote. The trailer is the
100
+ authoring surface that makes derivation honest: the summary is authored once,
101
+ beside the rule it summarizes, and read from there by everything that needs it.
102
+
103
+ **The derivation's refusals.** A rule carrying no `*Digest:*` trailer, or two,
104
+ leaves its bullet undecidable, and the installer exits 2 naming the rule rather
105
+ than emitting a digest silently short — the exact defect the derivation
106
+ replaced, so failing closed is the point rather than a courtesy. A missing
107
+ doctrine file and a methodology section that resolves to nothing are exit 2 on
108
+ the same ground: the digest cannot be certified against an unreadable rule set.
109
+ The derivation runs **once, at top level**, before the block is composed —
110
+ `digest()` is read through process substitution, where an exit would end only
111
+ the subshell and let the malformed doctrine through as a short digest, which is
112
+ the failure mode being guarded. §check-doctrine-registration assertion E is the
113
+ tree-side half of the same guard, so an untrailered rule reds at commit time
114
+ instead of waiting for a consumer install to discover it.
115
+
116
+ **What this asks of a consumer.** Nothing, for a consumer who re-vendors
117
+ `DOCTRINE.md` unchanged — the kit ships it, and its rules ship trailered. A
118
+ consumer who *appends a local rule* to their vendored copy now owes that rule a
119
+ `*Digest:*` trailer. That is a real obligation and worth stating rather than
120
+ claiming zero impact, but it replaces a larger one: assertion B already required
121
+ such a rule to be reflected in the digest, and the trailer is what makes its
122
+ bullet generate rather than have to be hand-written and kept in step.
123
+
75
124
  **The declared-trim round-trip.** A generated block that is unconditionally
76
125
  rewritten would revoke that right on the next run — and revoke it *silently*,
77
126
  because a trim the installer restores to a bullet leaves an agent file whose
@@ -123,11 +172,39 @@ reworded bullet, an added line — is reverted by design, and would red
123
172
  markers is the adopter's and is never read or written. Stating the bound is what
124
173
  makes the preserved case a contract rather than an accident.
125
174
 
175
+ **The removal mode.** `install-doctrine.sh --remove [agent-file]` is the insert
176
+ path reversed over the same marker pair, riding gate-sdk's `remove_marker_block`
177
+ exactly as the insert path rides its sibling — so the marker strings keep their
178
+ one writer and a caller reversing an installation needs no copy of them. It
179
+ harvests no trims and emits no digest: a removal has nothing to carry forward,
180
+ which is what makes it the reverse of the round-trip above rather than a second,
181
+ emptier pass through it — and, for the same reason, it reads no doctrine file
182
+ and so none of the derivation's refusals can arise on this path. An agent file
183
+ carrying **no block is not an error** —
184
+ the run says there was nothing to remove and exits 0, so a second `--remove` is
185
+ as quiet as the first and a caller that cannot know whether the block was ever
186
+ written there needs no way to ask. Its refusals are the two the insert path
187
+ holds before it reads any doctrine, unchanged and the only two on this path: a
188
+ missing agent file is exit 2, and a begin marker without its end is exit 2
189
+ rather than a guess at the block bounds. What it removes is the
190
+ reference block and nothing else — everything outside the markers is the
191
+ adopter's, on the same terms the honest bound above states for a rewrite.
192
+
126
193
  The round-trip's acceptor is `smoke/install.sh`, per the coverage tier
127
194
  gate-sdk/SPEC.md §lib/inject.sh sets for a sourced library with no gate surface:
128
195
  it declares a trim in the block the installer just emitted, re-runs the
129
196
  installer, and holds that the marker survived in the trimmed bullet's position,
130
- that the bullet is gone, and that the gate is green across the re-run.
197
+ that the bullet is gone, and that the gate is green across the re-run. The same
198
+ acceptor covers the removal mode on that tier and for that reason: it strips the
199
+ block, holds that a second `--remove` is an idempotent no-op, and reinstalls to
200
+ restore the baseline. It also drives the derivation's refusals, on the same tier
201
+ and for a further reason: a refusal is the installer's behavior rather than the
202
+ gate's, so no gate fixture can reach it. Pointed by the positional overrides at
203
+ a scratch doctrine whose second rule carries no `*Digest:*` trailer — and again
204
+ at one whose second rule carries two — it holds that the run exits 2, that the
205
+ message names the offending rule, and that the agent file is byte-unchanged.
206
+ That last assertion is the one worth having: an installer that refuses after
207
+ writing has failed closed in its exit status only.
131
208
 
132
209
  Positional overrides `install-doctrine.sh [agent-file [doctrine-file]]` let a
133
210
  smoke or a fixture point both paths at a scratch tree without touching consumer
@@ -135,10 +212,12 @@ config; unset, they fall to the knob defaults.
135
212
 
136
213
  ## check-doctrine-registration
137
214
 
138
- Invariant, in four assertions: the configured agent file (A) carries a markdown
215
+ Invariant, in five assertions: the configured agent file (A) carries a markdown
139
216
  link to the configured doctrine file and (B, C) holds its methodology-rule digest
140
- in per-rule lockstep with the doctrine, and the doctrine's craft register (D)
141
- tags every rule with exactly one stage-routing trailer. The digest is the surface the
217
+ in per-rule lockstep with the doctrine, and the doctrine's two registers tag
218
+ every rule with exactly one per-rule trailer — the craft register with a
219
+ stage-routing trailer (D), the methodology register with the digest trailer its
220
+ bullet is generated from (E). The digest is the surface the
142
221
  always-loaded-shape rule requires, and a re-vendored `DOCTRINE.md` that adds or
143
222
  renames a methodology-maintenance rule staling every consumer's digest *by
144
223
  construction* — on the exact path the kit advertises as its upgrade story — is
@@ -179,6 +258,20 @@ already couples the agent file and the doctrine file).
179
258
  unasserted — doctrine-kit does not depend on lifecycle-kit's stage config, and
180
259
  the emitter's empty-output posture already covers an unknown stage; the gate
181
260
  holds only that the trailer is present and well-formed.
261
+ - **Assertion E (digest-trailer coverage).** Every numbered rule under the
262
+ doctrine's `## Methodology-maintenance rules` section carries exactly one
263
+ `*Digest:*` trailer with a non-empty value. This is D's sibling one register
264
+ over, and the sentence D is argued from transposes exactly: a re-vendored
265
+ `DOCTRINE.md` that adds an untrailered methodology rule reddens here instead of
266
+ silently dropping out of the digest the installer derives (§install-doctrine).
267
+ Zero trailers and two are both findings, for the reason they are on D — a rule
268
+ with two has no decidable bullet, and picking one silently is exactly the guess
269
+ a gate exists to refuse. The value is graded only for emptiness: what makes a
270
+ one-line summary *good* is not machine-decidable, and a check that pretended
271
+ otherwise would be the noisy gate the Enforcement-first carve-out warns
272
+ against. D and E run one walk over a register's numbered rules, parameterized
273
+ by the trailer name and by how its value is graded, so the two registers cannot
274
+ drift apart in how a rule is read.
182
275
 
183
276
  Section resolution fails closed. The digest section is the agent-file heading
184
277
  named by `DOCTRINE_KIT_DIGEST_SECTION` (Layout and configuration); a configured
@@ -9,13 +9,93 @@ 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"
38
+
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; }
19
99
 
20
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
21
101
  digest() {
@@ -26,18 +106,8 @@ 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[@]}"
41
111
  }
42
112
 
43
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
@@ -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
@@ -91,6 +91,96 @@ if ! smoke_block | grep -qF -- "- **$SMOKE_TRIMMED**"; then
91
91
  exit 1
92
92
  fi
93
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
+
94
184
  cat >> scripts/gates.list <<'EOF'
95
185
  # doctrine-kit
96
186
  check-doctrine-registration