@qijenchen/design-system 0.1.0-beta.92 → 0.1.0-beta.95

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 (493) hide show
  1. package/AGENTS.md +6 -208
  2. package/CLAUDE.md +2 -23
  3. package/dist/components/DataTable/data-table-filter-value-picker.js +4 -0
  4. package/dist/components/DataTable/data-table-filter-value-picker.js.map +1 -1
  5. package/dist/components/DataTable/filter-tree.js +6 -0
  6. package/dist/components/DataTable/filter-tree.js.map +1 -1
  7. package/dist/patterns/element-anatomy/item-anatomy.js +1 -1
  8. package/ds-canonical/adapters/claude/agents/README.md +58 -0
  9. package/ds-canonical/adapters/claude/agents/canonical-reviewer.md +14 -0
  10. package/ds-canonical/adapters/claude-root-instructions.md +24 -0
  11. package/ds-canonical/adapters/claude-settings-base.json +172 -0
  12. package/ds-canonical/commands/README.md +8 -13
  13. package/ds-canonical/commands/gov-status.md +5 -75
  14. package/ds-canonical/fork/AGENTS.md +116 -213
  15. package/ds-canonical/fork/CLAUDE.md +54 -0
  16. package/ds-canonical/fork/codex/agents/skills/bug-fix-rhythm/SKILL.md +207 -0
  17. package/ds-canonical/fork/codex/agents/skills/code-quality-audit/SKILL.md +71 -0
  18. package/ds-canonical/fork/codex/agents/skills/delivery-handoff/SKILL.md +244 -0
  19. package/ds-canonical/fork/codex/agents/skills/delivery-handoff/references/flow-diagram.md +180 -0
  20. package/ds-canonical/fork/codex/agents/skills/delivery-handoff/references/handoff-template.md +177 -0
  21. package/ds-canonical/fork/codex/agents/skills/delivery-handoff/references/inventory-checklist.md +196 -0
  22. package/ds-canonical/fork/codex/agents/skills/independent-review/SKILL.md +29 -19
  23. package/ds-canonical/fork/codex/agents/skills/independent-review/agents/openai.yaml +4 -0
  24. package/ds-canonical/fork/codex/agents/skills/independent-review/references/evidence-contract.md +24 -0
  25. package/ds-canonical/fork/codex/agents/skills/performance-audit/SKILL.md +114 -0
  26. package/ds-canonical/fork/codex/agents/skills/product-ui-audit/SKILL.md +244 -0
  27. package/ds-canonical/fork/codex/agents/skills/product-ui-audit/references/audit-checks.md +250 -0
  28. package/ds-canonical/fork/codex/agents/skills/product-ui-audit/references/common-misuses.md +329 -0
  29. package/ds-canonical/fork/codex/agents/skills/product-ui-audit/references/report-template.md +163 -0
  30. package/ds-canonical/fork/codex/agents/skills/propose-options/SKILL.md +190 -0
  31. package/ds-canonical/fork/codex/agents/skills/prototype/SKILL.md +246 -0
  32. package/ds-canonical/fork/codex/agents/skills/prototype/references/audit-checks.md +39 -0
  33. package/ds-canonical/fork/codex/agents/skills/prototype/references/benchmark-sources.md +94 -0
  34. package/ds-canonical/fork/codex/agents/skills/prototype/references/checkpoints.md +200 -0
  35. package/ds-canonical/fork/codex/agents/skills/prototype/references/evaluation-matrix.md +142 -0
  36. package/ds-canonical/fork/codex/agents/skills/prototype/references/ooux-template.md +198 -0
  37. package/ds-canonical/fork/codex/agents/skills/prototype/references/proposal-template.md +230 -0
  38. package/ds-canonical/fork/codex/agents/skills/scan-similar-bugs/SKILL.md +212 -0
  39. package/ds-canonical/fork/codex/agents/skills/ux-audit/SKILL.md +135 -0
  40. package/ds-canonical/fork/codex/agents/skills/visual-audit/SKILL.md +259 -0
  41. package/ds-canonical/fork/codex/agents/skills/visual-audit/output/.gitkeep +0 -0
  42. package/ds-canonical/fork/codex/agents/skills/visual-audit/references/audit-architecture.md +101 -0
  43. package/ds-canonical/fork/codex/agents/skills/visual-audit/references/visual-checklist.md +297 -0
  44. package/ds-canonical/fork/codex/agents/skills/visual-audit/references/world-class-benchmarks.md +198 -0
  45. package/ds-canonical/fork/codex/hooks.json +44 -3
  46. package/ds-canonical/fork/common/closed-tool-execution.mjs +1001 -0
  47. package/ds-canonical/fork/common/instruction.md +116 -0
  48. package/ds-canonical/fork/consumer/governance-check.mjs +3059 -0
  49. package/ds-canonical/fork/consumer/lib/closed-tool-execution.mjs +1001 -0
  50. package/ds-canonical/fork/consumer/lock.json +189 -0
  51. package/ds-canonical/fork/consumer/lock.schema.json +338 -0
  52. package/ds-canonical/fork/consumer/managed-files/0235cf6b3fd402a3717881dc205b5bf77aed7632e7d7d6f1811a40e3033bd816.blob +145 -0
  53. package/ds-canonical/fork/consumer/managed-files/145aab4b4fc470fc9ba7679b4a1d87d4f6a6d604940bd40f8d675c8af696498f.blob +47 -0
  54. package/ds-canonical/fork/consumer/managed-files/189e551431181e4a88783c02130d2787b801ef731c86e35bcde89a7313aa020e.blob +149 -0
  55. package/ds-canonical/fork/consumer/managed-files/24ad71c8613ddcf6fd23818cb3bb477a1fb6d83af4550b0bad43099813088686.blob +28 -0
  56. package/ds-canonical/fork/consumer/managed-files/2d1ef5617a5ce3c39ad9aae1c42af7d199f9270c0a0ccb490b63d62dbc6913db.blob +1001 -0
  57. package/ds-canonical/fork/consumer/managed-files/3625e02235cf166a50649a4d704cfb68fead69d0e168c481df013ebae9f6be25.blob +1412 -0
  58. package/ds-canonical/fork/consumer/managed-files/3ddedc67b464bdfe3dde9803a2d917920c96d633678b802eee638a44cd47366a.blob +8 -0
  59. package/ds-canonical/fork/consumer/managed-files/423729840acdd43c812f17c245b871716c6b60f76e4d3e94864d0e34a815bf8d.blob +348 -0
  60. package/ds-canonical/fork/consumer/managed-files/46f10bc55cdfdf834d0749eebff42ea0bb8576f361b36d2b6ba1851354c50150.blob +464 -0
  61. package/ds-canonical/fork/consumer/managed-files/475fba657eaeb8abd88f60635f3eadab27a9d0d3114ba4fffc65f43a2a0fe6e2.blob +124 -0
  62. package/ds-canonical/fork/consumer/managed-files/61c6aca6d7f04bedbf556eaa9d3043681fe48cbe0e93a8ccb1d69a7c5e23fdcf.blob +113 -0
  63. package/ds-canonical/fork/consumer/managed-files/63061e05969667005020166ea2ae7df3c96663f7a928e7dd3eebc1471022df56.blob +2398 -0
  64. package/ds-canonical/fork/consumer/managed-files/65410b66e8799a560e07b71779c186fed2a0ef50575ac44745df7a0938a9c2b4.blob +317 -0
  65. package/ds-canonical/fork/consumer/managed-files/6929a3c8bb4d69c507720b4754aeb339c6cbb8ff655e0a381d76606d64695e38.blob +393 -0
  66. package/ds-canonical/fork/consumer/managed-files/6b746628ac11fcccbe277ef6fea94cc2a7b90ea2822e83536eae80d5ee4b3fa5.blob +167 -0
  67. package/ds-canonical/fork/consumer/managed-files/76d485470d30ff014afacf7ce643763de9f4f956d9fc8128dbc1814774cf2e63.blob +671 -0
  68. package/ds-canonical/fork/consumer/managed-files/77e06f62670dfee01e9b5e8b0f8dad085ce711d75538c1fb0679d9818acaca82.blob +424 -0
  69. package/ds-canonical/fork/consumer/managed-files/7937321877e5c34c27dae36c0d507d21cd42fa3f46a8f11a284b8b4a52b6faa4.blob +84 -0
  70. package/ds-canonical/fork/consumer/managed-files/794bb911ba8ebef58ab0d44a55b9968a19d2c62bcfb310b1ee3a84166f087f21.blob +880 -0
  71. package/ds-canonical/fork/consumer/managed-files/7b17835d0ceb17cdcdcaf930540a3e5d0943a34a747ac43c12ca8cd485c11581.blob +44 -0
  72. package/ds-canonical/fork/consumer/managed-files/7eb6cc60abfdabaf6617c336058fad1454ccde08889295767bfd9b7fd153cc6e.blob +778 -0
  73. package/ds-canonical/fork/consumer/managed-files/81037efa5b3b9f4a875704005fb268acdc9233bb901f44902e4e37e1da92b8e3.blob +46 -0
  74. package/ds-canonical/fork/consumer/managed-files/884721550b56308812b20917adac7a12f36fdb4ecda6b02460a7f5a219c0c966.blob +78 -0
  75. package/ds-canonical/fork/consumer/managed-files/91f414b9462ddc1e4be1d4c6ca4ac7a7340a6eec9e98ee109cbc049d3b354b6a.blob +36 -0
  76. package/ds-canonical/fork/consumer/managed-files/92e4828cdcb96ff0d01daa16f6885f24045a8e72820665650f2a1890dc3a446c.blob +121 -0
  77. package/ds-canonical/fork/consumer/managed-files/93a89f16f6717d1e4e4e27ec20ef916e3355c7aa890ca74cd9b12db30d8a899f.blob +43 -0
  78. package/ds-canonical/fork/consumer/managed-files/974521d6b8fe796ea4c58b3c78b0c2b8a1be262b97100d77aaf4cc9c7724bcab.blob +45 -0
  79. package/ds-canonical/fork/consumer/managed-files/9791c85388d2e2e2bd564e2550fadc3351c4c960a47ce838098afcba7544eb90.blob +959 -0
  80. package/ds-canonical/fork/consumer/managed-files/a448d2222133335c30e6fda5116e26a40db3283a19d62ccc0663c30d272262a7.blob +174 -0
  81. package/ds-canonical/fork/consumer/managed-files/ab072e7f2eca51f0e18a5e18c4b333260ee5d219a12cc6df5bb2d683f0b2734d.blob +2636 -0
  82. package/ds-canonical/fork/consumer/managed-files/bc44cabad181f766611dab6a8f52d81100afadd50ac59799015e8ba7bf46d9eb.blob +596 -0
  83. package/ds-canonical/fork/consumer/managed-files/c4aa767f11714467de0038a2149cf78074baddc17fc6a9e074b6aed7544c6f3c.blob +80 -0
  84. package/ds-canonical/fork/consumer/managed-files/c893e9b734b162f4c631fef871128c16a9ab565f796a0e76d7f320f821f220f5.blob +41 -0
  85. package/ds-canonical/fork/consumer/managed-files/cd9c61f8ff24fb9bcc3663e346e2cfa419cfb84e02aae18d3dc66dd192681696.blob +9 -0
  86. package/ds-canonical/fork/consumer/managed-files/da2ad2737315d25a5300905ddefd62f1695056a8a1af155c5b34170ad9923bce.blob +38 -0
  87. package/ds-canonical/fork/consumer/managed-files/e1b11160d6c4043002d2cbff6d9a4ae551698a96137773c4244dadfac152fcb0.blob +222 -0
  88. package/ds-canonical/fork/consumer/managed-files/e26057408661597aac4a57cdf7e30e2f9d0afb1b9a2dbbb692c3805cd9028ca5.blob +250 -0
  89. package/ds-canonical/fork/consumer/managed-files/e68ae1915965d8e17d4b2441c00c2b97fe062ea308ae8535c9eebb2fc16fa245.blob +20 -0
  90. package/ds-canonical/fork/consumer/managed-files/e71c65f45c6af7ce12b6b3c0d8028f185da5b719e2050c9b2a6b243d41ae4878.blob +182 -0
  91. package/ds-canonical/fork/consumer/managed-files/e813096d69c49812e40e00be9ac8fa14d77f0ec1f97ab4c45cb096b3bedd35de.blob +3 -0
  92. package/ds-canonical/fork/consumer/managed-files/e930ebca6fd8eeb30802aac0930efae7bcc44cc0996f24de07c11ca6a081fedf.blob +277 -0
  93. package/ds-canonical/fork/consumer/managed-files/ea94e914d5c8acb84ad7660e5bda0f01b6ccc8cf96b0f6b1ce048f8938d0f5b5.blob +47 -0
  94. package/ds-canonical/fork/consumer/managed-files/f4db6e616d5229aa7e700c6a3ace022cb9d90baae74e38ca65fce617f18e0d9b.blob +110 -0
  95. package/ds-canonical/fork/consumer/managed-files/faa128c26102415dc5345e68698efbbd28a395c35ee278dceae044cf430692b2.blob +11 -0
  96. package/ds-canonical/fork/governance.lock +1552 -103
  97. package/ds-canonical/fork/hooks/_log-fire.sh +109 -12
  98. package/ds-canonical/fork/hooks/block_prototype_imports.py +148 -29
  99. package/ds-canonical/fork/hooks/check_chrome_header_avatar_canonical.sh +23 -12
  100. package/ds-canonical/fork/hooks/check_consumer_app_invariants.sh +116 -65
  101. package/ds-canonical/fork/hooks/check_consumer_code_quality.sh +140 -0
  102. package/ds-canonical/fork/hooks/check_ds_anchor_preflight.sh +84 -30
  103. package/ds-canonical/fork/hooks/check_dynamic_tailwind_class.sh +16 -6
  104. package/ds-canonical/fork/hooks/check_escape_marker_abuse.sh +65 -21
  105. package/ds-canonical/fork/hooks/check_field_family_invariants.sh +90 -24
  106. package/ds-canonical/fork/hooks/check_fork_product_quality.sh +8 -6
  107. package/ds-canonical/fork/hooks/check_item_list_gap.sh +4 -2
  108. package/ds-canonical/fork/hooks/check_layout_space_magic_numbers.sh +31 -13
  109. package/ds-canonical/fork/hooks/check_opacity_token_usage.sh +220 -95
  110. package/ds-canonical/fork/hooks/check_pattern_invariants.sh +73 -14
  111. package/ds-canonical/fork/hooks/check_sidebar_menu_button_implicit_wrap.sh +23 -12
  112. package/ds-canonical/fork/hooks/check_story_determinism.sh +1 -1
  113. package/ds-canonical/fork/hooks/check_story_invariants.sh +342 -61
  114. package/ds-canonical/fork/hooks/check_tabs_content_chrome_body_double_gap.sh +52 -23
  115. package/ds-canonical/fork/hooks/check_tailwind_wildcard_in_docs.sh +20 -13
  116. package/ds-canonical/fork/hooks/inject_deploy_url_after_push.sh +105 -22
  117. package/ds-canonical/fork/hooks/lib/_hook_integrity.sh +158 -0
  118. package/ds-canonical/fork/hooks/lib/_provider_paths.sh +162 -0
  119. package/ds-canonical/fork/launchers/approval-evidence.mjs +1131 -0
  120. package/ds-canonical/fork/launchers/authority-decision-evidence.mjs +413 -0
  121. package/ds-canonical/fork/launchers/canonical-order.mjs +8 -0
  122. package/ds-canonical/fork/launchers/fork-governance-dispatcher.sh +139 -29
  123. package/ds-canonical/fork/launchers/format-provider-hook-output.mjs +25 -0
  124. package/ds-canonical/fork/launchers/independent-review.mjs +490 -0
  125. package/ds-canonical/fork/launchers/inject_fork_governance_preamble.sh +88 -43
  126. package/ds-canonical/fork/launchers/normalize-provider-event.mjs +355 -0
  127. package/ds-canonical/fork/launchers/product-hook-dispatch-runtime.mjs +1067 -0
  128. package/ds-canonical/fork/launchers/provider-hook-normalization.mjs +1646 -0
  129. package/ds-canonical/fork/launchers/provider-hook-output-transport.mjs +525 -0
  130. package/ds-canonical/fork/launchers/settings-hooks.json +30 -53
  131. package/ds-canonical/fork/manifest.json +1881 -23
  132. package/ds-canonical/fork/providers/claude/hook-config.json +333 -0
  133. package/ds-canonical/fork/providers/claude/instruction.md +54 -0
  134. package/ds-canonical/fork/providers/claude/skills/bug-fix-rhythm/SKILL.md +207 -0
  135. package/ds-canonical/fork/providers/claude/skills/code-quality-audit/SKILL.md +71 -0
  136. package/ds-canonical/fork/providers/claude/skills/delivery-handoff/SKILL.md +244 -0
  137. package/ds-canonical/fork/providers/claude/skills/delivery-handoff/references/flow-diagram.md +180 -0
  138. package/ds-canonical/fork/providers/claude/skills/delivery-handoff/references/handoff-template.md +177 -0
  139. package/ds-canonical/fork/providers/claude/skills/delivery-handoff/references/inventory-checklist.md +196 -0
  140. package/ds-canonical/fork/providers/claude/skills/independent-review/SKILL.md +43 -0
  141. package/ds-canonical/fork/providers/claude/skills/independent-review/agents/openai.yaml +4 -0
  142. package/ds-canonical/fork/providers/claude/skills/independent-review/references/evidence-contract.md +24 -0
  143. package/ds-canonical/fork/providers/claude/skills/performance-audit/SKILL.md +114 -0
  144. package/ds-canonical/fork/providers/claude/skills/product-ui-audit/SKILL.md +244 -0
  145. package/ds-canonical/fork/providers/claude/skills/product-ui-audit/references/audit-checks.md +250 -0
  146. package/ds-canonical/fork/providers/claude/skills/product-ui-audit/references/common-misuses.md +329 -0
  147. package/ds-canonical/fork/providers/claude/skills/product-ui-audit/references/report-template.md +163 -0
  148. package/ds-canonical/fork/providers/claude/skills/propose-options/SKILL.md +190 -0
  149. package/ds-canonical/fork/providers/claude/skills/prototype/SKILL.md +246 -0
  150. package/ds-canonical/fork/providers/claude/skills/prototype/references/audit-checks.md +39 -0
  151. package/ds-canonical/fork/providers/claude/skills/prototype/references/benchmark-sources.md +94 -0
  152. package/ds-canonical/fork/providers/claude/skills/prototype/references/checkpoints.md +200 -0
  153. package/ds-canonical/fork/providers/claude/skills/prototype/references/evaluation-matrix.md +142 -0
  154. package/ds-canonical/fork/providers/claude/skills/prototype/references/ooux-template.md +198 -0
  155. package/ds-canonical/fork/providers/claude/skills/prototype/references/proposal-template.md +230 -0
  156. package/ds-canonical/fork/providers/claude/skills/scan-similar-bugs/SKILL.md +212 -0
  157. package/ds-canonical/fork/providers/claude/skills/ux-audit/SKILL.md +135 -0
  158. package/ds-canonical/fork/providers/claude/skills/visual-audit/SKILL.md +259 -0
  159. package/ds-canonical/fork/providers/claude/skills/visual-audit/output/.gitkeep +0 -0
  160. package/ds-canonical/fork/providers/claude/skills/visual-audit/references/audit-architecture.md +101 -0
  161. package/ds-canonical/fork/providers/claude/skills/visual-audit/references/visual-checklist.md +297 -0
  162. package/ds-canonical/fork/providers/claude/skills/visual-audit/references/world-class-benchmarks.md +198 -0
  163. package/ds-canonical/fork/providers/codex/hook-config.json +57 -0
  164. package/ds-canonical/fork/providers/codex/skills/bug-fix-rhythm/SKILL.md +207 -0
  165. package/ds-canonical/fork/providers/codex/skills/code-quality-audit/SKILL.md +71 -0
  166. package/ds-canonical/fork/providers/codex/skills/delivery-handoff/SKILL.md +244 -0
  167. package/ds-canonical/fork/providers/codex/skills/delivery-handoff/references/flow-diagram.md +180 -0
  168. package/ds-canonical/fork/providers/codex/skills/delivery-handoff/references/handoff-template.md +177 -0
  169. package/ds-canonical/fork/providers/codex/skills/delivery-handoff/references/inventory-checklist.md +196 -0
  170. package/ds-canonical/fork/providers/codex/skills/independent-review/SKILL.md +43 -0
  171. package/ds-canonical/fork/providers/codex/skills/independent-review/agents/openai.yaml +4 -0
  172. package/ds-canonical/fork/providers/codex/skills/independent-review/references/evidence-contract.md +24 -0
  173. package/ds-canonical/fork/providers/codex/skills/performance-audit/SKILL.md +114 -0
  174. package/ds-canonical/fork/providers/codex/skills/product-ui-audit/SKILL.md +244 -0
  175. package/ds-canonical/fork/providers/codex/skills/product-ui-audit/references/audit-checks.md +250 -0
  176. package/ds-canonical/fork/providers/codex/skills/product-ui-audit/references/common-misuses.md +329 -0
  177. package/ds-canonical/fork/providers/codex/skills/product-ui-audit/references/report-template.md +163 -0
  178. package/ds-canonical/fork/providers/codex/skills/propose-options/SKILL.md +190 -0
  179. package/ds-canonical/fork/providers/codex/skills/prototype/SKILL.md +246 -0
  180. package/ds-canonical/fork/providers/codex/skills/prototype/references/audit-checks.md +39 -0
  181. package/ds-canonical/fork/providers/codex/skills/prototype/references/benchmark-sources.md +94 -0
  182. package/ds-canonical/fork/providers/codex/skills/prototype/references/checkpoints.md +200 -0
  183. package/ds-canonical/fork/providers/codex/skills/prototype/references/evaluation-matrix.md +142 -0
  184. package/ds-canonical/fork/providers/codex/skills/prototype/references/ooux-template.md +198 -0
  185. package/ds-canonical/fork/providers/codex/skills/prototype/references/proposal-template.md +230 -0
  186. package/ds-canonical/fork/providers/codex/skills/scan-similar-bugs/SKILL.md +212 -0
  187. package/ds-canonical/fork/providers/codex/skills/ux-audit/SKILL.md +135 -0
  188. package/ds-canonical/fork/providers/codex/skills/visual-audit/SKILL.md +259 -0
  189. package/ds-canonical/fork/providers/codex/skills/visual-audit/output/.gitkeep +0 -0
  190. package/ds-canonical/fork/providers/codex/skills/visual-audit/references/audit-architecture.md +101 -0
  191. package/ds-canonical/fork/providers/codex/skills/visual-audit/references/visual-checklist.md +297 -0
  192. package/ds-canonical/fork/providers/codex/skills/visual-audit/references/world-class-benchmarks.md +198 -0
  193. package/ds-canonical/fork/references/story-baseline-registry.json +117 -0
  194. package/ds-canonical/fork/references/story-baseline-registry.schema.json +145 -0
  195. package/ds-canonical/fork/references/utility-registry.json +377 -0
  196. package/ds-canonical/fork/references/utility-registry.schema.json +373 -0
  197. package/ds-canonical/fork/review/canonical-order.mjs +8 -0
  198. package/ds-canonical/fork/review/provider-review-binding.mjs +2377 -0
  199. package/ds-canonical/fork/skills/bug-fix-rhythm/SKILL.md +19 -12
  200. package/ds-canonical/fork/skills/code-quality-audit/SKILL.md +19 -15
  201. package/ds-canonical/fork/skills/delivery-handoff/SKILL.md +17 -11
  202. package/ds-canonical/fork/skills/independent-review/SKILL.md +37 -0
  203. package/ds-canonical/fork/skills/independent-review/agents/openai.yaml +4 -0
  204. package/ds-canonical/fork/skills/independent-review/references/evidence-contract.md +24 -0
  205. package/ds-canonical/fork/skills/performance-audit/SKILL.md +11 -8
  206. package/ds-canonical/fork/skills/product-ui-audit/SKILL.md +31 -21
  207. package/ds-canonical/fork/skills/product-ui-audit/references/audit-checks.md +9 -5
  208. package/ds-canonical/fork/skills/product-ui-audit/references/report-template.md +30 -26
  209. package/ds-canonical/fork/skills/propose-options/SKILL.md +6 -4
  210. package/ds-canonical/fork/skills/prototype/SKILL.md +21 -21
  211. package/ds-canonical/fork/skills/prototype/references/audit-checks.md +7 -6
  212. package/ds-canonical/fork/skills/prototype/references/checkpoints.md +26 -17
  213. package/ds-canonical/fork/skills/prototype/references/evaluation-matrix.md +2 -1
  214. package/ds-canonical/fork/skills/prototype/references/ooux-template.md +1 -1
  215. package/ds-canonical/fork/skills/prototype/references/proposal-template.md +6 -5
  216. package/ds-canonical/fork/skills/scan-similar-bugs/SKILL.md +28 -27
  217. package/ds-canonical/fork/skills/ux-audit/SKILL.md +8 -5
  218. package/ds-canonical/fork/skills/visual-audit/SKILL.md +37 -43
  219. package/ds-canonical/fork/skills/visual-audit/references/audit-architecture.md +15 -15
  220. package/ds-canonical/fork/skills/visual-audit/references/visual-checklist.md +6 -6
  221. package/ds-canonical/fork/skills/visual-audit/references/world-class-benchmarks.md +2 -2
  222. package/ds-canonical/hooks/README.md +37 -23
  223. package/ds-canonical/hooks/_log-fire.sh +109 -12
  224. package/ds-canonical/hooks/auto_regen_ds_barrel.sh +52 -20
  225. package/ds-canonical/hooks/block_prototype_imports.py +148 -29
  226. package/ds-canonical/hooks/check_audit_post_report_validator.sh +76 -66
  227. package/ds-canonical/hooks/check_audit_sample_escape.sh +4 -4
  228. package/ds-canonical/hooks/check_benchmark_citation.sh +3 -3
  229. package/ds-canonical/hooks/check_canonical_propagation.sh +81 -22
  230. package/ds-canonical/hooks/check_chrome_header_avatar_canonical.sh +22 -11
  231. package/ds-canonical/hooks/check_codex_brief_invariants.sh +100 -56
  232. package/ds-canonical/hooks/check_codex_collab_5step.sh +31 -25
  233. package/ds-canonical/hooks/check_consumer_app_invariants.sh +116 -65
  234. package/ds-canonical/hooks/check_consumer_code_quality.sh +140 -0
  235. package/ds-canonical/hooks/check_datatable_invariants.sh +103 -25
  236. package/ds-canonical/hooks/check_dim_count_drift.sh +5 -4
  237. package/ds-canonical/hooks/check_ds_anchor_preflight.sh +83 -29
  238. package/ds-canonical/hooks/check_dynamic_tailwind_class.sh +16 -6
  239. package/ds-canonical/hooks/check_escape_marker_abuse.sh +65 -21
  240. package/ds-canonical/hooks/check_field_controls_contracts.sh +10 -8
  241. package/ds-canonical/hooks/check_field_family_invariants.sh +90 -24
  242. package/ds-canonical/hooks/check_file_size_budget.sh +32 -14
  243. package/ds-canonical/hooks/check_full_story_visual_interaction_sweep.sh +60 -21
  244. package/ds-canonical/hooks/check_item_list_gap.sh +4 -2
  245. package/ds-canonical/hooks/check_layout_space_magic_numbers.sh +31 -13
  246. package/ds-canonical/hooks/check_main_branch_workbench.sh +27 -68
  247. package/ds-canonical/hooks/check_naming_and_abstraction.sh +20 -9
  248. package/ds-canonical/hooks/check_opacity_token_usage.sh +220 -95
  249. package/ds-canonical/hooks/check_orphan_ds_css.sh +48 -18
  250. package/ds-canonical/hooks/check_overlay_open_focus_escape_probe.sh +29 -11
  251. package/ds-canonical/hooks/check_pattern_invariants.sh +73 -14
  252. package/ds-canonical/hooks/check_peoplepicker_ssot_drift.sh +4 -4
  253. package/ds-canonical/hooks/check_pixel_quantified_audit.sh +3 -2
  254. package/ds-canonical/hooks/check_plugin_fork_health.sh +151 -41
  255. package/ds-canonical/hooks/check_post_main_ssot_propagate.sh +5 -109
  256. package/ds-canonical/hooks/check_propose_discipline.sh +116 -29
  257. package/ds-canonical/hooks/check_propose_pre_grep_verify.sh +6 -4
  258. package/ds-canonical/hooks/check_propose_without_benchmark.sh +10 -6
  259. package/ds-canonical/hooks/check_select_all_canonical.sh +1 -1
  260. package/ds-canonical/hooks/check_sidebar_menu_button_implicit_wrap.sh +22 -11
  261. package/ds-canonical/hooks/check_solo_workflow.sh +117 -186
  262. package/ds-canonical/hooks/check_spec_class_drift.sh +33 -19
  263. package/ds-canonical/hooks/check_ssot_header_declaration.sh +6 -5
  264. package/ds-canonical/hooks/check_story_determinism.sh +1 -1
  265. package/ds-canonical/hooks/check_story_invariants.sh +526 -213
  266. package/ds-canonical/hooks/check_storybook_addon_packaging.sh +65 -15
  267. package/ds-canonical/hooks/check_substantive_edit_approval_preflight.sh +137 -67
  268. package/ds-canonical/hooks/check_tabs_content_chrome_body_double_gap.sh +52 -23
  269. package/ds-canonical/hooks/check_tailwind_wildcard_in_docs.sh +20 -13
  270. package/ds-canonical/hooks/check_wrapper_primitive_schema_drift.sh +15 -12
  271. package/ds-canonical/hooks/chrome_header_dispatcher.sh +75 -26
  272. package/ds-canonical/hooks/enforce_home_charter.sh +29 -8
  273. package/ds-canonical/hooks/governance_control_plane.sh +15 -0
  274. package/ds-canonical/hooks/inject_deploy_url_after_push.sh +105 -22
  275. package/ds-canonical/hooks/inject_pending_self_audit.sh +27 -24
  276. package/ds-canonical/hooks/lib/_app_shell_primary_header_consistency.sh +77 -29
  277. package/ds-canonical/hooks/lib/_approval_re.sh +5 -6
  278. package/ds-canonical/hooks/lib/_chrome_header_handcraft.sh +66 -20
  279. package/ds-canonical/hooks/lib/_code_quality.sh +9 -9
  280. package/ds-canonical/hooks/lib/_cva_default_sync.sh +11 -13
  281. package/ds-canonical/hooks/lib/_governance_coverage_check.sh +48 -21
  282. package/ds-canonical/hooks/lib/_hardcoded_strings.sh +13 -10
  283. package/ds-canonical/hooks/lib/_header_with_tabs_border.sh +68 -48
  284. package/ds-canonical/hooks/lib/_hook_integrity.sh +158 -0
  285. package/ds-canonical/hooks/lib/_layout_space_canonical.sh +5 -5
  286. package/ds-canonical/hooks/lib/_overlay_handcraft.sh +21 -23
  287. package/ds-canonical/hooks/lib/_person_data_richness.sh +5 -5
  288. package/ds-canonical/hooks/lib/_provider_paths.sh +162 -0
  289. package/ds-canonical/hooks/lib/_story_compile_drift.sh +5 -5
  290. package/ds-canonical/hooks/lib/_tab_lg_chrome_header_equal.sh +247 -27
  291. package/ds-canonical/hooks/lib/_token_hygiene.sh +39 -22
  292. package/ds-canonical/hooks/lib/approval-evidence.mjs +1131 -0
  293. package/ds-canonical/hooks/lib/audit-report-validator.mjs +118 -0
  294. package/ds-canonical/hooks/lib/provider-marker-regex.mjs +23 -0
  295. package/ds-canonical/hooks/lib/tsx-governance-analysis.mjs +410 -0
  296. package/ds-canonical/hooks/log_governance_fires.sh +45 -13
  297. package/ds-canonical/hooks/log_skill_invokes.sh +8 -7
  298. package/ds-canonical/hooks/post_edit_dispatcher.sh +106 -28
  299. package/ds-canonical/hooks/registrations.json +488 -0
  300. package/ds-canonical/hooks/registrations.schema.json +58 -0
  301. package/ds-canonical/hooks/retired/2026-06-11-prune-merge/check_propose_plain_chinese.sh +1 -1
  302. package/ds-canonical/hooks/retired/check_governance_compliance.sh +1 -1
  303. package/ds-canonical/hooks/session_start_governance_check.sh +109 -78
  304. package/ds-canonical/hooks/stop_audit_content_quality.sh +20 -0
  305. package/ds-canonical/hooks/stop_extract_canonical_rules.sh +20 -0
  306. package/ds-canonical/hooks/stop_passive_logging.sh +133 -59
  307. package/ds-canonical/hooks/stop_self_audit.sh +349 -210
  308. package/ds-canonical/hooks/tests/fixtures/transcripts/claude-transcript-jsonl-v1.jsonl +3 -0
  309. package/ds-canonical/hooks/tests/fixtures/transcripts/claude-transcript-jsonl-v2.jsonl +3 -0
  310. package/ds-canonical/hooks/tests/registration-output-contracts.mjs +151 -0
  311. package/ds-canonical/hooks/tests/run-all.sh +35 -5
  312. package/ds-canonical/hooks/tests/test_auto_regen_ds_barrel.sh +48 -4
  313. package/ds-canonical/hooks/tests/test_block_prototype_imports.sh +157 -9
  314. package/ds-canonical/hooks/tests/test_check_app_shell_primary_header_consistency.sh +265 -127
  315. package/ds-canonical/hooks/tests/test_check_audit_post_report_validator.sh +119 -12
  316. package/ds-canonical/hooks/tests/test_check_audit_sample_escape.sh +0 -0
  317. package/ds-canonical/hooks/tests/test_check_benchmark_citation.sh +0 -0
  318. package/ds-canonical/hooks/tests/test_check_canonical_propagation.sh +56 -5
  319. package/ds-canonical/hooks/tests/test_check_chrome_header_avatar_canonical.sh +6 -6
  320. package/ds-canonical/hooks/tests/test_check_chrome_header_handcraft.sh +193 -100
  321. package/ds-canonical/hooks/tests/test_check_codex_brief_invariants.sh +143 -17
  322. package/ds-canonical/hooks/tests/test_check_codex_collab_5step.sh +49 -5
  323. package/ds-canonical/hooks/tests/test_check_consumer_app_invariants.sh +128 -0
  324. package/ds-canonical/hooks/tests/test_check_consumer_app_story_title.sh +2 -2
  325. package/ds-canonical/hooks/tests/test_check_consumer_code_quality.sh +64 -0
  326. package/ds-canonical/hooks/tests/test_check_consumer_ds_primitive_misuse.sh +2 -2
  327. package/ds-canonical/hooks/tests/test_check_consumer_no_ds_catalog.sh +2 -2
  328. package/ds-canonical/hooks/tests/test_check_consumer_story_baseline.sh +2 -2
  329. package/ds-canonical/hooks/tests/test_check_data_table_size_num_to_meta_width.sh +26 -8
  330. package/ds-canonical/hooks/tests/test_check_datatable_invariants.sh +126 -12
  331. package/ds-canonical/hooks/tests/test_check_dim_count_drift.sh +13 -8
  332. package/ds-canonical/hooks/tests/test_check_ds_anchor_preflight.sh +53 -7
  333. package/ds-canonical/hooks/tests/test_check_dynamic_tailwind_class.sh +3 -3
  334. package/ds-canonical/hooks/tests/test_check_escape_marker_abuse.sh +17 -7
  335. package/ds-canonical/hooks/tests/test_check_field_family_invariants.sh +72 -16
  336. package/ds-canonical/hooks/tests/test_check_file_size_budget.sh +67 -5
  337. package/ds-canonical/hooks/tests/test_check_fork_user_plugin_install.sh +107 -4
  338. package/ds-canonical/hooks/tests/test_check_full_story_visual_interaction_sweep.sh +25 -15
  339. package/ds-canonical/hooks/tests/test_check_header_with_tabs_border.sh +177 -67
  340. package/ds-canonical/hooks/tests/test_check_item_list_gap.sh +7 -7
  341. package/ds-canonical/hooks/tests/test_check_layout_space_magic_numbers.sh +2 -2
  342. package/ds-canonical/hooks/tests/test_check_main_branch_workbench.sh +45 -110
  343. package/ds-canonical/hooks/tests/test_check_naming_and_abstraction.sh +19 -2
  344. package/ds-canonical/hooks/tests/test_check_opacity_token_usage.sh +114 -8
  345. package/ds-canonical/hooks/tests/test_check_orphan_ds_css.sh +38 -22
  346. package/ds-canonical/hooks/tests/test_check_overlay_open_focus_escape_probe.sh +2 -2
  347. package/ds-canonical/hooks/tests/test_check_pattern_invariants.sh +68 -6
  348. package/ds-canonical/hooks/tests/test_check_plugin_fork_health.sh +53 -0
  349. package/ds-canonical/hooks/tests/test_check_post_main_ssot_propagate.sh +37 -0
  350. package/ds-canonical/hooks/tests/test_check_propose_cite_required.sh +2 -2
  351. package/ds-canonical/hooks/tests/test_check_propose_discipline.sh +59 -0
  352. package/ds-canonical/hooks/tests/test_check_propose_plain_chinese.sh +7 -5
  353. package/ds-canonical/hooks/tests/test_check_propose_pre_grep_verify.sh +5 -5
  354. package/ds-canonical/hooks/tests/test_check_propose_without_benchmark.sh +45 -0
  355. package/ds-canonical/hooks/tests/test_check_sidebar_menu_button_implicit_wrap.sh +5 -5
  356. package/ds-canonical/hooks/tests/test_check_solo_workflow.sh +183 -105
  357. package/ds-canonical/hooks/tests/test_check_spec_class_drift.sh +35 -7
  358. package/ds-canonical/hooks/tests/{test_check_story_anatomy.sh.broken → test_check_story_anatomy.sh} +73 -4
  359. package/ds-canonical/hooks/tests/{test_check_story_category.sh.broken → test_check_story_category.sh} +82 -2
  360. package/ds-canonical/hooks/tests/test_check_story_determinism.sh +39 -0
  361. package/ds-canonical/hooks/tests/test_check_story_invariants.sh +559 -43
  362. package/ds-canonical/hooks/tests/{test_check_story_name_jargon.sh.broken → test_check_story_name_jargon.sh} +22 -1
  363. package/ds-canonical/hooks/tests/test_check_storybook_addon_packaging.sh +79 -0
  364. package/ds-canonical/hooks/tests/test_check_storybook_addon_preset_cjs.sh +2 -2
  365. package/ds-canonical/hooks/tests/test_check_substantive_edit_approval_preflight.sh +546 -28
  366. package/ds-canonical/hooks/tests/test_check_tab_lg_chrome_header_equal.sh +180 -98
  367. package/ds-canonical/hooks/tests/test_check_tabs_content_chrome_body_double_gap.sh +3 -3
  368. package/ds-canonical/hooks/tests/test_check_tailwind_wildcard_in_docs.sh +2 -2
  369. package/ds-canonical/hooks/tests/test_check_token_hygiene.sh +63 -15
  370. package/ds-canonical/hooks/tests/test_check_wrapper_primitive_schema_drift.sh +12 -6
  371. package/ds-canonical/hooks/tests/test_chrome_header_dispatcher.sh +125 -0
  372. package/ds-canonical/hooks/tests/test_enforce_home_charter.sh +57 -3
  373. package/ds-canonical/hooks/tests/test_governance_control_plane.sh +66 -0
  374. package/ds-canonical/hooks/tests/test_governance_coverage_check.sh +88 -0
  375. package/ds-canonical/hooks/tests/test_hook_integrity_classification.sh +217 -0
  376. package/ds-canonical/hooks/tests/test_inject_deploy_url_after_push.sh +85 -2
  377. package/ds-canonical/hooks/tests/test_inject_pending_self_audit.sh +116 -11
  378. package/ds-canonical/hooks/tests/test_log_governance_fires.sh +117 -1
  379. package/ds-canonical/hooks/tests/test_log_skill_invokes.sh +74 -5
  380. package/ds-canonical/hooks/tests/test_post_edit_dispatcher.sh +234 -77
  381. package/ds-canonical/hooks/tests/test_provider_peer_symmetry.sh +76 -0
  382. package/ds-canonical/hooks/tests/test_registration_output_contracts.sh +20 -0
  383. package/ds-canonical/hooks/tests/test_session_start_governance_check.sh +130 -18
  384. package/ds-canonical/hooks/tests/test_stop_audit_content_quality.sh +75 -0
  385. package/ds-canonical/hooks/tests/test_stop_capture_metrics.sh +101 -23
  386. package/ds-canonical/hooks/tests/test_stop_extract_canonical_rules.sh +75 -0
  387. package/ds-canonical/hooks/tests/{test_stop_governance_drift_check.sh.broken → test_stop_governance_drift_check.sh} +22 -12
  388. package/ds-canonical/hooks/tests/test_stop_passive_logging.sh +102 -1
  389. package/ds-canonical/hooks/tests/test_stop_repository_command_context.sh +38 -0
  390. package/ds-canonical/hooks/tests/test_stop_self_audit.sh +363 -9
  391. package/ds-canonical/references/README.md +8 -8
  392. package/ds-canonical/references/audit-coverage-vs-24-checklist.md +4 -4
  393. package/ds-canonical/references/build-ui-canonicals.md +3 -3
  394. package/ds-canonical/references/certified-surfaces.md +46 -15
  395. package/ds-canonical/references/cva-patterns.md +2 -2
  396. package/ds-canonical/references/failure-class-registry.json +3 -2
  397. package/ds-canonical/references/governance-audit-coverage.md +8 -8
  398. package/ds-canonical/references/naming-conventions.md +1 -1
  399. package/ds-canonical/references/preflight-gate-baseline.json +210 -3
  400. package/ds-canonical/references/principle-dim-map.json +15 -9
  401. package/ds-canonical/references/props-naming.md +1 -1
  402. package/ds-canonical/references/scenario-definition.md +33 -30
  403. package/ds-canonical/references/spec-rules.md +1 -1
  404. package/ds-canonical/references/ssot-consultation.md +3 -3
  405. package/ds-canonical/references/ssot-index.md +1 -1
  406. package/ds-canonical/references/story-baseline-registry.json +9 -6
  407. package/ds-canonical/references/story-baseline-registry.schema.json +145 -0
  408. package/ds-canonical/references/structural-token-retention.md +1 -1
  409. package/ds-canonical/references/tailwind-gotchas.md +2 -2
  410. package/ds-canonical/references/ui-dev-rules.md +1 -1
  411. package/ds-canonical/rules/README.md +14 -9
  412. package/ds-canonical/rules/meta-patterns.md +13 -13
  413. package/ds-canonical/rules/self-verify.md +12 -7
  414. package/ds-canonical/rules/spec-rules.md +1 -1
  415. package/ds-canonical/rules/ui-development.md +5 -5
  416. package/ds-canonical/skills/README.md +27 -15
  417. package/ds-canonical/skills/bug-fix-rhythm/SKILL.md +14 -7
  418. package/ds-canonical/skills/canonical-reviewer/SKILL.md +29 -0
  419. package/ds-canonical/skills/code-quality-audit/SKILL.md +11 -7
  420. package/ds-canonical/skills/codex-collab/SKILL.md +19 -238
  421. package/ds-canonical/skills/codex-collab/references/brief-template.md +37 -47
  422. package/ds-canonical/skills/codex-collab/references/transport.md +38 -57
  423. package/ds-canonical/skills/codify-corrections/SKILL.md +32 -31
  424. package/ds-canonical/skills/codify-principle/SKILL.md +33 -32
  425. package/ds-canonical/skills/component-quality-gate/SKILL.md +13 -13
  426. package/ds-canonical/skills/component-quality-gate/references/checklist.md +7 -7
  427. package/ds-canonical/skills/deep-audit-cross-codex/SKILL.md +28 -229
  428. package/ds-canonical/skills/deep-audit-cross-codex/references/phase-a-workflow.md +36 -131
  429. package/ds-canonical/skills/deep-audit-cross-codex/references/phase-b-codex-brief.md +33 -187
  430. package/ds-canonical/skills/deep-audit-cross-codex/references/skill-relationships-antipatterns-benchmarks.md +22 -24
  431. package/ds-canonical/skills/deep-audit-cross-codex/references/triage-rubric.md +15 -79
  432. package/ds-canonical/skills/deep-audit-cross-codex/references/upstream-directives-r-mapping.md +24 -23
  433. package/ds-canonical/skills/delivery-handoff/SKILL.md +14 -8
  434. package/ds-canonical/skills/design-system-audit/SKILL.md +63 -62
  435. package/ds-canonical/skills/design-system-audit/references/audit-prompts.md +86 -77
  436. package/ds-canonical/skills/design-system-audit/references/checkpoints.md +59 -50
  437. package/ds-canonical/skills/design-system-audit/references/historical-bugs.md +8 -8
  438. package/ds-canonical/skills/design-system-audit/references/principle-audit-protocol.md +37 -32
  439. package/ds-canonical/skills/design-system-audit/references/rule-placement.md +39 -38
  440. package/ds-canonical/skills/ensure-canonical/SKILL.md +36 -34
  441. package/ds-canonical/skills/governance-health/SKILL.md +26 -22
  442. package/ds-canonical/skills/governance-status/SKILL.md +30 -0
  443. package/ds-canonical/skills/independent-review/SKILL.md +37 -0
  444. package/ds-canonical/skills/independent-review/agents/openai.yaml +4 -0
  445. package/ds-canonical/skills/independent-review/references/evidence-contract.md +24 -0
  446. package/ds-canonical/skills/knowledge-prune/SKILL.md +45 -52
  447. package/ds-canonical/skills/knowledge-prune/references/phase-z-cross-repo-ssot-propagation.md +10 -7
  448. package/ds-canonical/skills/knowledge-prune/references/prune-dimensions-d5-d10.md +6 -6
  449. package/ds-canonical/skills/new-component/SKILL.md +18 -12
  450. package/ds-canonical/skills/new-component/references/new-component-checklist.md +7 -6
  451. package/ds-canonical/skills/performance-audit/SKILL.md +13 -10
  452. package/ds-canonical/skills/product-ui-audit/SKILL.md +27 -17
  453. package/ds-canonical/skills/product-ui-audit/references/audit-checks.md +7 -4
  454. package/ds-canonical/skills/product-ui-audit/references/report-template.md +30 -26
  455. package/ds-canonical/skills/propose-options/SKILL.md +1 -1
  456. package/ds-canonical/skills/prototype/SKILL.md +19 -21
  457. package/ds-canonical/skills/prototype/references/audit-checks.md +6 -5
  458. package/ds-canonical/skills/prototype/references/checkpoints.md +26 -17
  459. package/ds-canonical/skills/prototype/references/ooux-template.md +1 -1
  460. package/ds-canonical/skills/prototype/references/proposal-template.md +4 -4
  461. package/ds-canonical/skills/scan-similar-bugs/SKILL.md +22 -21
  462. package/ds-canonical/skills/story-auto-compile-migrate/SKILL.md +21 -20
  463. package/ds-canonical/skills/story-writing/SKILL.md +12 -12
  464. package/ds-canonical/skills/story-writing/references/anatomy-standard.md +1 -1
  465. package/ds-canonical/skills/story-writing/references/category-templates.md +5 -5
  466. package/ds-canonical/skills/ux-audit/SKILL.md +12 -9
  467. package/ds-canonical/skills/visual-audit/SKILL.md +41 -47
  468. package/ds-canonical/skills/visual-audit/references/audit-architecture.md +7 -7
  469. package/ds-canonical/skills/visual-audit/references/visual-checklist.md +12 -12
  470. package/ds-canonical/skills/visual-audit/references/world-class-benchmarks.md +3 -3
  471. package/ds-canonical/templates/_README.md +6 -7
  472. package/ds-canonical/templates/consumer-governance.md +78 -0
  473. package/ds-canonical/templates/dashboard-app.tsx +3 -1
  474. package/ds-canonical/templates/product-launchers/fork-governance-dispatcher.sh +154 -0
  475. package/ds-canonical/templates/product-launchers/format-provider-hook-output.mjs +25 -0
  476. package/ds-canonical/templates/product-launchers/independent-review.mjs +490 -0
  477. package/ds-canonical/templates/product-launchers/inject_fork_governance_preamble.sh +99 -0
  478. package/ds-canonical/templates/product-launchers/normalize-provider-event.mjs +355 -0
  479. package/ds-canonical/templates/product-launchers/product-hook-dispatch-runtime.mjs +1067 -0
  480. package/ds-canonical/templates/product-provider-wiring.json +80 -0
  481. package/ds-canonical/templates/product-provider-wiring.schema.json +151 -0
  482. package/llms-full.txt +6 -6
  483. package/llms.txt +2 -2
  484. package/package.json +15 -4
  485. package/src/tokens/utility-registry.json +119 -4
  486. package/src/tokens/utility-registry.schema.json +373 -0
  487. package/tools/README.md +9 -0
  488. package/tools/codemods/cli.mjs +93 -0
  489. package/tools/codemods/index.mjs +582 -0
  490. package/tools/shared/safe-filesystem.mjs +371 -0
  491. package/tools/visual-baseline/cli.mjs +97 -0
  492. package/tools/visual-baseline/index.mjs +522 -0
  493. /package/dist/{react-day-picker.css → index.css} +0 -0
@@ -4,7 +4,7 @@
4
4
  # breaking caller code that legitimately reads unset vars (e.g. ${VIOLATIONS}
5
5
  # accumulator pattern). Caller hooks set their own flags as standalone scripts.
6
6
  #
7
- # Shared helper: log per-hook fire to .claude/logs/hook-fires-per-hook.jsonl
7
+ # Shared helper: resolve a provider-neutral runtime state directory and log per-hook fire there.
8
8
  #
9
9
  # Why: enables /knowledge-prune D2 dead-hook detection(6 月 0 fire → retire 提名)。
10
10
  # 各 hook 在 top-of-file source 本檔 + 呼叫 `log_hook_fire`。
@@ -14,17 +14,115 @@
14
14
  #
15
15
  # 規則:silent on failure,不 block hook 執行。
16
16
 
17
- log_hook_fire() {
18
- local hook_name="${1:-$(basename "${BASH_SOURCE[1]:-$0}")}"
19
- # Resolve project root from this helper's location(stable; cwd may be anywhere
20
- # depending on how Claude Code invokes the hook)to avoid stray .claude/ trees.
17
+ _governance_safe_runtime_path() {
18
+ python3 - "$1" "$2" <<'PY'
19
+ import os
20
+ import sys
21
+
22
+ root_input = os.path.abspath(sys.argv[1])
23
+ target_input = os.path.abspath(sys.argv[2])
24
+
25
+ # macOS exposes /var and /tmp through system symlink aliases while Git reports
26
+ # their physical /private/... spelling. Compare physical paths so two names
27
+ # for the same Git-owned directory are not mistaken for an escape.
28
+ root = os.path.realpath(root_input)
29
+ target = os.path.realpath(target_input)
30
+ try:
31
+ if os.path.commonpath([root, target]) != root:
32
+ raise ValueError('escape')
33
+ except ValueError:
34
+ raise SystemExit(2)
35
+
36
+ # Permit only aliases that are ancestors of the Git-owned root(e.g. macOS
37
+ # /var -> /private/var). A symlink at, or anywhere below, the runtime root is
38
+ # attacker-controlled runtime state and must fail closed even when it points
39
+ # back inside the repository.
40
+ cursor = os.path.sep
41
+ for segment in target_input.split(os.sep)[1:]:
42
+ cursor = os.path.join(cursor, segment)
43
+ if not os.path.lexists(cursor) or not os.path.islink(cursor):
44
+ continue
45
+ resolved = os.path.realpath(cursor)
46
+ try:
47
+ inside_runtime = os.path.commonpath([root, resolved]) == root
48
+ except ValueError:
49
+ inside_runtime = False
50
+ if inside_runtime:
51
+ raise SystemExit(2)
52
+ print(target)
53
+ PY
54
+ }
55
+
56
+ governance_runtime_state_dir() {
57
+ # Telemetry is never implicit. CI, direct hook probes, and ordinary provider sessions are
58
+ # byte-for-byte read-only unless their trusted adapter/caller explicitly opts in.
59
+ [ "${GOVERNANCE_TELEMETRY_OPT_IN:-0}" = "1" ] || return 1
60
+ [ "${GOVERNANCE_READ_ONLY:-0}" != "1" ] || return 1
61
+ # Resolve the repository root without assuming a provider discovery path. Canonical hooks run
62
+ # below ds-canonical/, while generated Claude views run below .claude/; suffix stripping alone
63
+ # would write runtime telemetry into the immutable canonical source tree.
21
64
  local _self_dir
22
65
  _self_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
23
- local _resolved_root="${_self_dir%/.claude/hooks}"
24
- local log_dir="${CLAUDE_PROJECT_DIR:-$_resolved_root}/.claude/logs"
25
- local log_file="$log_dir/hook-fires-per-hook.jsonl"
66
+ local _resolved_root="${GOVERNANCE_PROJECT_DIR:-}"
67
+ if [ -z "$_resolved_root" ]; then
68
+ _resolved_root="$(git -C "$_self_dir" rev-parse --show-toplevel 2>/dev/null || true)"
69
+ fi
70
+ [ -n "$_resolved_root" ] && [ -d "$_resolved_root" ] || return 1
26
71
 
27
- mkdir -p "$log_dir" 2>/dev/null || return 0
72
+ local _git_dir _runtime_parent _allowed_root _runtime_root _state_dir
73
+ _git_dir="$(git -C "$_resolved_root" rev-parse --absolute-git-dir 2>/dev/null || true)"
74
+ # Runtime evidence is meaningful only when owned by a concrete Git repository.
75
+ # A no-Git temp fallback would silently create a second authority and is forbidden.
76
+ [ -n "$_git_dir" ] || return 1
77
+ _runtime_parent="$(cd "$_git_dir" 2>/dev/null && pwd -P)" || return 1
78
+ _allowed_root="$_runtime_parent/governance-runtime"
79
+ _runtime_root="${GOVERNANCE_RUNTIME_ROOT:-$_allowed_root}"
80
+ _runtime_root="$(_governance_safe_runtime_path "$_runtime_parent" "$_runtime_root" 2>/dev/null)" || return 1
81
+ [ "$_runtime_root" = "$_allowed_root" ] || return 1
82
+ _state_dir="${GOVERNANCE_STATE_DIR:-$_runtime_root}"
83
+ _state_dir="$(_governance_safe_runtime_path "$_runtime_root" "$_state_dir" 2>/dev/null)" || return 1
84
+ printf '%s\n' "$_state_dir"
85
+ }
86
+
87
+ governance_prepare_runtime_state_dir() {
88
+ local _state_dir _revalidated
89
+ _state_dir="$(governance_runtime_state_dir 2>/dev/null)" || return 1
90
+ mkdir -p -- "$_state_dir" 2>/dev/null || return 1
91
+ # Revalidate after creation so an existing or concurrently substituted
92
+ # symlink never becomes an accepted runtime directory.
93
+ _revalidated="$(governance_runtime_state_dir 2>/dev/null)" || return 1
94
+ [ "$_state_dir" = "$_revalidated" ] || return 1
95
+ [ -d "$_state_dir" ] && [ ! -L "$_state_dir" ] || return 1
96
+ printf '%s\n' "$_state_dir"
97
+ }
98
+
99
+ governance_runtime_file_path() {
100
+ local _name="${1:-}" _state_dir="${2:-}" _candidate
101
+ case "$_name" in ""|.|..) return 1 ;; esac
102
+ printf '%s' "$_name" | grep -qE '^[A-Za-z0-9.][A-Za-z0-9._-]*$' || return 1
103
+ [ -n "$_state_dir" ] || _state_dir="$(governance_runtime_state_dir 2>/dev/null)" || return 1
104
+ _candidate="$(_governance_safe_runtime_path "$_state_dir" "$_state_dir/$_name" 2>/dev/null)" || return 1
105
+ # Reject pre-existing aliases, devices, FIFOs, sockets, and hard-linked files.
106
+ # Telemetry must never mutate another inode through a poisoned filename.
107
+ python3 - "$_candidate" <<'PY' >/dev/null 2>&1 || return 1
108
+ import os
109
+ import stat
110
+ import sys
111
+
112
+ path = sys.argv[1]
113
+ if os.path.lexists(path):
114
+ info = os.lstat(path)
115
+ if not stat.S_ISREG(info.st_mode) or info.st_nlink != 1:
116
+ raise SystemExit(2)
117
+ PY
118
+ printf '%s\n' "$_candidate"
119
+ }
120
+
121
+ log_hook_fire() {
122
+ local hook_name="${1:-$(basename "${BASH_SOURCE[1]:-$0}")}"
123
+ local log_dir log_file archive_file
124
+ log_dir="$(governance_prepare_runtime_state_dir 2>/dev/null)" || return 0
125
+ log_file="$(governance_runtime_file_path hook-fires-per-hook.jsonl "$log_dir" 2>/dev/null)" || return 0
28
126
 
29
127
  # Rotate if > 1 MB
30
128
  if [ -f "$log_file" ]; then
@@ -33,7 +131,8 @@ log_hook_fire() {
33
131
  if [ -n "$size" ] && [ "$size" -gt 1048576 ]; then
34
132
  # 2026-06-11 fix(prune D2 抓 data-loss):原 mv 同月二次 rotation 直接覆寫 archive
35
133
  # (實證 .202605 只存 5/31 六小時,5/31–6/10 數萬筆 fire 史遺失)→ append 後清空,不覆寫
36
- cat "$log_file" >> "${log_file}.$(date +%Y%m)" 2>/dev/null && : > "$log_file" || true
134
+ archive_file="$(governance_runtime_file_path "hook-fires-per-hook.jsonl.$(date +%Y%m)" "$log_dir" 2>/dev/null)" || return 0
135
+ cat "$log_file" >> "$archive_file" 2>/dev/null && : > "$log_file" || true
37
136
  fi
38
137
  fi
39
138
 
@@ -42,5 +141,3 @@ log_hook_fire() {
42
141
  "$hook_name" \
43
142
  >> "$log_file" 2>/dev/null || true
44
143
  }
45
-
46
-
@@ -1,39 +1,148 @@
1
1
  #!/usr/bin/env python3
2
2
  import json
3
+ import hashlib
3
4
  import os
4
5
  import re
6
+ import subprocess
5
7
  import sys
8
+ import tempfile
6
9
  import time
7
10
 
8
- # Per-hook fire logging(enables /knowledge-prune D2 dead-hook detection)
9
- # Resolve project root from this script's location(stable; cwd may be anywhere
10
- # depending on how Claude Code invokes the hook)to avoid stray .claude/ trees.
11
+ def integrity_failure(message):
12
+ print(f"GOVERNANCE_INTEGRITY: {message}", file=sys.stderr)
13
+ raise SystemExit(70)
14
+
15
+
16
+ def resolve_project_root():
17
+ configured = os.environ.get('GOVERNANCE_PROJECT_DIR')
18
+ if configured and os.path.isdir(configured):
19
+ return os.path.realpath(os.path.abspath(configured))
20
+ try:
21
+ return subprocess.check_output(
22
+ ['git', '-C', os.path.dirname(os.path.abspath(__file__)), 'rev-parse', '--show-toplevel'],
23
+ text=True,
24
+ stderr=subprocess.DEVNULL,
25
+ ).strip()
26
+ except Exception:
27
+ # The caller classifies this as an integrity fault before path-scoped enforcement runs.
28
+ return ''
29
+
30
+ PROJECT_ROOT = resolve_project_root()
31
+
32
+ def governance_runtime_state_dir():
33
+ """Return the trusted provider-neutral state directory, or None.
34
+
35
+ Telemetry is opt-in and may only live below the repository's governance
36
+ runtime root. This mirrors _log-fire.sh without assuming a Claude or Codex
37
+ discovery directory.
38
+ """
39
+ if os.environ.get('GOVERNANCE_TELEMETRY_OPT_IN', '0') != '1':
40
+ return None
41
+ if os.environ.get('GOVERNANCE_READ_ONLY', '0') == '1':
42
+ return None
43
+ if not PROJECT_ROOT or not os.path.isdir(PROJECT_ROOT):
44
+ return None
45
+
46
+ try:
47
+ git_dir = subprocess.check_output(
48
+ ['git', '-C', PROJECT_ROOT, 'rev-parse', '--absolute-git-dir'],
49
+ text=True,
50
+ stderr=subprocess.DEVNULL,
51
+ ).strip()
52
+ except Exception:
53
+ root_hash = hashlib.sha256(PROJECT_ROOT.encode()).hexdigest()[:16]
54
+ runtime_parent = os.path.realpath(
55
+ os.path.abspath(os.environ.get('TMPDIR') or tempfile.gettempdir())
56
+ )
57
+ allowed_root = os.path.join(runtime_parent, 'governance-runtime', root_hash)
58
+ else:
59
+ runtime_parent = os.path.realpath(os.path.abspath(git_dir))
60
+ allowed_root = os.path.join(runtime_parent, 'governance-runtime')
61
+
62
+ def safe_runtime_path(root, candidate):
63
+ root = os.path.abspath(root)
64
+ target = os.path.abspath(candidate)
65
+ try:
66
+ if os.path.commonpath([root, target]) != root:
67
+ return None
68
+ except ValueError:
69
+ return None
70
+ cursor = root
71
+ if os.path.lexists(cursor) and os.path.islink(cursor):
72
+ return None
73
+ relative = os.path.relpath(target, root)
74
+ if relative != '.':
75
+ for segment in relative.split(os.sep):
76
+ cursor = os.path.join(cursor, segment)
77
+ if not os.path.lexists(cursor):
78
+ break
79
+ if os.path.islink(cursor):
80
+ return None
81
+ return target
82
+
83
+ runtime_root = safe_runtime_path(
84
+ runtime_parent,
85
+ os.environ.get('GOVERNANCE_RUNTIME_ROOT', allowed_root),
86
+ )
87
+ if runtime_root != allowed_root:
88
+ return None
89
+
90
+ state_dir = safe_runtime_path(
91
+ runtime_root,
92
+ os.environ.get('GOVERNANCE_STATE_DIR', runtime_root),
93
+ )
94
+ if state_dir is None:
95
+ return None
96
+ return state_dir
97
+
98
+
99
+ # Per-hook fire logging (enables provider-neutral dead-hook detection). It is
100
+ # disabled by default and never recreates a provider discovery directory.
11
101
  try:
12
- _project_root = os.environ.get('CLAUDE_PROJECT_DIR') or os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
13
- _log_dir = os.path.join(_project_root, '.claude', 'logs')
102
+ _log_dir = governance_runtime_state_dir()
103
+ if not _log_dir:
104
+ raise RuntimeError('governance telemetry is disabled or untrusted')
14
105
  os.makedirs(_log_dir, exist_ok=True)
15
106
  with open(os.path.join(_log_dir, 'hook-fires-per-hook.jsonl'), 'a') as _f:
16
107
  _f.write(json.dumps({'ts': time.strftime('%Y-%m-%dT%H:%M:%SZ', time.gmtime()), 'hook': os.path.basename(__file__)}) + '\n')
17
108
  except Exception:
18
109
  pass
19
110
 
20
- EXPLORATION_PREFIX = "src/explorations/"
21
- SRC_PREFIX = "src/"
22
-
23
- # Project root for absolute→relative path normalization(real Edit/Write events
24
- # carry absolute file_path;prefix 比對必先轉 project-root 相對,否則 hook 永不 fire)。
25
- PROJECT_ROOT = os.environ.get('CLAUDE_PROJECT_DIR') or os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
111
+ # Project root for absolute→relative path normalization (real Edit/Write events carry absolute
112
+ # file_path; prefix matching must use the same explicit/git-resolved root as enforcement).
26
113
 
27
114
  def to_project_relative(path):
28
- if os.path.isabs(path):
29
- return os.path.relpath(path, PROJECT_ROOT)
115
+ if os.path.isabs(path) and PROJECT_ROOT:
116
+ return os.path.relpath(os.path.realpath(path), PROJECT_ROOT)
30
117
  return path
31
118
 
32
119
  def load_event():
33
120
  try:
34
- return json.load(sys.stdin)
35
- except Exception:
36
- return None
121
+ event = json.load(sys.stdin)
122
+ except Exception as error:
123
+ integrity_failure(f"prototype import hook input could not be parsed:{error.__class__.__name__}")
124
+ if not isinstance(event, dict):
125
+ integrity_failure("prototype import hook input must be an object")
126
+ if "tool_name" in event and not isinstance(event["tool_name"], str):
127
+ integrity_failure("prototype import hook tool_name must be a string")
128
+ tool_input = event.get("tool_input", {})
129
+ if not isinstance(tool_input, dict):
130
+ integrity_failure("prototype import hook tool_input must be an object")
131
+ for key in ("file_path",):
132
+ if key in tool_input and not isinstance(tool_input[key], str):
133
+ integrity_failure(f"prototype import hook {key} must be a string")
134
+ for key in ("edits", "files"):
135
+ values = tool_input.get(key)
136
+ if values is None:
137
+ continue
138
+ if not isinstance(values, list):
139
+ integrity_failure(f"prototype import hook {key} must be an array")
140
+ for item in values:
141
+ if not isinstance(item, dict):
142
+ integrity_failure(f"prototype import hook {key} entries must be objects")
143
+ if "file_path" in item and not isinstance(item["file_path"], str):
144
+ integrity_failure(f"prototype import hook {key}.file_path must be a string")
145
+ return event
37
146
 
38
147
  def collect_file_paths(tool_input):
39
148
  paths = []
@@ -64,13 +173,19 @@ def collect_file_paths(tool_input):
64
173
  return list(dict.fromkeys(paths))
65
174
 
66
175
  def should_check(path):
67
- if not path.startswith(SRC_PREFIX):
176
+ normalized = path.replace("\\", "/").removeprefix("./")
177
+ if normalized.startswith("../") or normalized.startswith("/"):
68
178
  return False
69
- if path.startswith(EXPLORATION_PREFIX):
179
+ if normalized.startswith("src/"):
180
+ source_relative = normalized[len("src/"):]
181
+ else:
182
+ match = re.match(r"^apps/[^/]+/src/(.+)$", normalized)
183
+ if not match:
184
+ return False
185
+ source_relative = match.group(1)
186
+ if source_relative.startswith("explorations/"):
70
187
  return False
71
- if not (path.endswith(".ts") or path.endswith(".tsx")):
72
- return False
73
- return True
188
+ return normalized.endswith((".ts", ".tsx"))
74
189
 
75
190
  def contains_exploration_import(content):
76
191
  patterns = [
@@ -83,8 +198,8 @@ def contains_exploration_import(content):
83
198
 
84
199
  def main():
85
200
  event = load_event()
86
- if not event:
87
- sys.exit(0)
201
+ if not PROJECT_ROOT or not os.path.isdir(PROJECT_ROOT):
202
+ integrity_failure("prototype import hook project root could not be resolved")
88
203
 
89
204
  tool_input = event.get("tool_input", {})
90
205
  touched_paths = collect_file_paths(tool_input)
@@ -96,14 +211,18 @@ def main():
96
211
  if not should_check(rel_path):
97
212
  continue
98
213
  abs_path = path if os.path.isabs(path) else os.path.join(PROJECT_ROOT, path)
99
- if not os.path.exists(abs_path):
100
- continue
214
+ if not os.path.lexists(abs_path):
215
+ integrity_failure(f"prototype import target is missing:{rel_path}")
216
+ if os.path.islink(abs_path) or not os.path.isfile(abs_path):
217
+ integrity_failure(f"prototype import target is unsafe:{rel_path}")
101
218
 
102
219
  try:
103
220
  with open(abs_path, "r", encoding="utf-8") as f:
104
221
  content = f.read()
105
- except Exception:
106
- continue
222
+ except Exception as error:
223
+ integrity_failure(
224
+ f"prototype import target could not be read:{rel_path}:{error.__class__.__name__}"
225
+ )
107
226
 
108
227
  if contains_exploration_import(content):
109
228
  offenders.append(rel_path)
@@ -113,10 +232,10 @@ def main():
113
232
  "Blocked: 正式程式碼不得 import src/explorations/ 內的檔案。"
114
233
  ]
115
234
  lines.extend(f"- {p}" for p in offenders)
116
- print("\n".join(lines))
235
+ print("\n".join(lines), file=sys.stderr)
117
236
  sys.exit(2)
118
237
 
119
238
  sys.exit(0)
120
239
 
121
240
  if __name__ == "__main__":
122
- main()
241
+ main()
@@ -17,13 +17,22 @@
17
17
  # 對應 audit dim 預留 — TBD 升 audit dim 65
18
18
 
19
19
  source "$(dirname "$0")/_log-fire.sh" 2>/dev/null && log_hook_fire
20
+ source "$(dirname "$0")/lib/_hook_integrity.sh" 2>/dev/null || {
21
+ printf 'GOVERNANCE_INTEGRITY: hook integrity helper unavailable\n' >&2
22
+ exit 70
23
+ }
20
24
 
21
25
  set -uo pipefail
22
- INPUT=$(cat 2>/dev/null || echo "{}")
23
- TOOL=$(echo "$INPUT" | jq -r '.tool_name // ""' 2>/dev/null)
24
- FILE_PATH=$(echo "$INPUT" | jq -r '.tool_input.file_path // ""' 2>/dev/null)
25
- EVENT=$(echo "$INPUT" | jq -r '.hook_event_name // ""' 2>/dev/null)
26
- NEW=$(echo "$INPUT" | jq -r '.tool_input.content // .tool_input.new_string // ""' 2>/dev/null)
26
+ governance_hook_load_input
27
+ governance_hook_require_commands python3
28
+ TOOL=$(printf '%s' "$INPUT" | jq -r '.tool_name // ""' 2>/dev/null) \
29
+ || governance_hook_integrity_fail 'chrome-header tool extraction failed'
30
+ FILE_PATH=$(printf '%s' "$INPUT" | jq -r '.tool_input.file_path // ""' 2>/dev/null) \
31
+ || governance_hook_integrity_fail 'chrome-header path extraction failed'
32
+ EVENT=$(printf '%s' "$INPUT" | jq -r '.hook_event_name // ""' 2>/dev/null) \
33
+ || governance_hook_integrity_fail 'chrome-header event extraction failed'
34
+ NEW=$(printf '%s' "$INPUT" | jq -r '.tool_input.content // .tool_input.new_string // ""' 2>/dev/null) \
35
+ || governance_hook_integrity_fail 'chrome-header content extraction failed'
27
36
 
28
37
  [ "$EVENT" != "PreToolUse" ] && exit 0
29
38
  case "$TOOL" in Edit|Write|MultiEdit) ;; *) exit 0 ;; esac
@@ -49,19 +58,21 @@ for block in blocks:
49
58
  if re.search(r"<ItemAvatar\b", block):
50
59
  print("DRIFT")
51
60
  sys.exit(0)
52
- ' 2>/dev/null)
61
+ ' 2>/dev/null) || governance_hook_integrity_fail 'chrome-header parser failed'
53
62
 
54
63
  [ "$HAS_DRIFT" != "DRIFT" ] && exit 0
55
64
 
56
65
  # Override env var
57
- if [ "${CLAUDE_BYPASS_CHROME_HEADER_AVATAR:-0}" = "1" ]; then
58
- mkdir -p "$(dirname "$0")/../logs" 2>/dev/null
59
- printf '{"ts":"%s","event":"chrome-header-avatar-bypass","file":"%s"}\n' \
60
- "$(date -u +%Y-%m-%dT%H:%M:%SZ)" "$FILE_PATH" >> "$(dirname "$0")/../logs/governance-bypass.jsonl" 2>/dev/null
66
+ if [ "${GOVERNANCE_BYPASS_CHROME_HEADER_AVATAR:-0}" = "1" ]; then
67
+ if STATE_DIR="$(governance_runtime_state_dir 2>/dev/null)"; then
68
+ mkdir -p "$STATE_DIR" 2>/dev/null
69
+ jq -nc --arg ts "$(date -u +%Y-%m-%dT%H:%M:%SZ)" --arg file "$FILE_PATH" \
70
+ '{ts:$ts,event:"chrome-header-avatar-bypass",file:$file}' >> "$STATE_DIR/governance-bypass.jsonl" 2>/dev/null || true
71
+ fi
61
72
  exit 0
62
73
  fi
63
74
 
64
- REL=${FILE_PATH#"$CLAUDE_PROJECT_DIR"/}
75
+ REL=${FILE_PATH#"$GOVERNANCE_PROJECT_DIR"/}
65
76
 
66
77
  cat >&2 <<EOF
67
78
  🚨 Chrome header avatar canonical violation(per user 2026-05-27 抓 + codex collab cite battle):
@@ -87,7 +98,7 @@ Canonical citation:
87
98
 
88
99
  注意:SidebarFooter 內 ItemAvatar OK(footer 是 SidebarMenu row context)。本 hook 只攔 SidebarHeader。
89
100
 
90
- Bypass(極罕見):CLAUDE_BYPASS_CHROME_HEADER_AVATAR=1 env var(audit-logged)。
101
+ Bypass(極罕見):GOVERNANCE_BYPASS_CHROME_HEADER_AVATAR=1 env var(audit-logged)。
91
102
  EOF
92
103
  # 2026-05-31:exit 0 → exit 2(folded-hook-audit:原宣稱 BLOCKER 但 exit 0 = 假 enforcement;
93
104
  # chrome-header avatar 是 SSOT canonical [feedback_ssot_mechanical_p0_not_p1 = 必 P0 BLOCK],