@qijenchen/design-system 0.1.0-beta.10 → 0.1.0-beta.13

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 (307) hide show
  1. package/CLAUDE.md +201 -0
  2. package/README.md +7 -15
  3. package/cli-init.mjs +90 -0
  4. package/ds-canonical/commands/README.md +26 -0
  5. package/ds-canonical/commands/gov-status.md +79 -0
  6. package/ds-canonical/hooks/README.md +145 -0
  7. package/ds-canonical/hooks/_log-fire.sh +44 -0
  8. package/ds-canonical/hooks/block_prototype_imports.py +111 -0
  9. package/ds-canonical/hooks/check_app_shell_primary_header_consistency.sh +68 -0
  10. package/ds-canonical/hooks/check_audit_post_report_validator.sh +88 -0
  11. package/ds-canonical/hooks/check_audit_sample_escape.sh +73 -0
  12. package/ds-canonical/hooks/check_benchmark_citation.sh +106 -0
  13. package/ds-canonical/hooks/check_canonical_propagation.sh +189 -0
  14. package/ds-canonical/hooks/check_chrome_header_handcraft.sh +70 -0
  15. package/ds-canonical/hooks/check_codex_brief_invariants.sh +83 -0
  16. package/ds-canonical/hooks/check_codex_collab_5step.sh +108 -0
  17. package/ds-canonical/hooks/check_datatable_invariants.sh +117 -0
  18. package/ds-canonical/hooks/check_dim_count_drift.sh +72 -0
  19. package/ds-canonical/hooks/check_field_controls_contracts.sh +110 -0
  20. package/ds-canonical/hooks/check_field_family_invariants.sh +205 -0
  21. package/ds-canonical/hooks/check_file_size_budget.sh +60 -0
  22. package/ds-canonical/hooks/check_header_with_tabs_border.sh +87 -0
  23. package/ds-canonical/hooks/check_main_branch_workbench.sh +93 -0
  24. package/ds-canonical/hooks/check_naming_and_abstraction.sh +165 -0
  25. package/ds-canonical/hooks/check_opacity_token_usage.sh +149 -0
  26. package/ds-canonical/hooks/check_pattern_invariants.sh +194 -0
  27. package/ds-canonical/hooks/check_peoplepicker_ssot_drift.sh +56 -0
  28. package/ds-canonical/hooks/check_pixel_quantified_audit.sh +53 -0
  29. package/ds-canonical/hooks/check_propose_plain_chinese.sh +74 -0
  30. package/ds-canonical/hooks/check_propose_pre_grep_verify.sh +70 -0
  31. package/ds-canonical/hooks/check_select_all_canonical.sh +58 -0
  32. package/ds-canonical/hooks/check_solo_workflow.sh +258 -0
  33. package/ds-canonical/hooks/check_spec_class_drift.sh +88 -0
  34. package/ds-canonical/hooks/check_story_invariants.sh +612 -0
  35. package/ds-canonical/hooks/check_substantive_edit_approval_preflight.sh +105 -0
  36. package/ds-canonical/hooks/check_tab_lg_chrome_header_equal.sh +66 -0
  37. package/ds-canonical/hooks/check_wrapper_primitive_schema_drift.sh +104 -0
  38. package/ds-canonical/hooks/enforce_home_charter.sh +44 -0
  39. package/ds-canonical/hooks/inject_pending_self_audit.sh +204 -0
  40. package/ds-canonical/hooks/lib/_approval_re.sh +33 -0
  41. package/ds-canonical/hooks/lib/_code_quality.sh +73 -0
  42. package/ds-canonical/hooks/lib/_cva_default_sync.sh +69 -0
  43. package/ds-canonical/hooks/lib/_governance_coverage_check.sh +49 -0
  44. package/ds-canonical/hooks/lib/_hardcoded_strings.sh +163 -0
  45. package/ds-canonical/hooks/lib/_layout_space_canonical.sh +56 -0
  46. package/ds-canonical/hooks/lib/_overlay_handcraft.sh +141 -0
  47. package/ds-canonical/hooks/lib/_person_data_richness.sh +42 -0
  48. package/ds-canonical/hooks/lib/_story_compile_drift.sh +48 -0
  49. package/ds-canonical/hooks/lib/_token_hygiene.sh +95 -0
  50. package/ds-canonical/hooks/log_governance_fires.sh +50 -0
  51. package/ds-canonical/hooks/log_skill_invokes.sh +41 -0
  52. package/ds-canonical/hooks/post_edit_dispatcher.sh +62 -0
  53. package/ds-canonical/hooks/retired/check_anatomy_section_numbering.sh +106 -0
  54. package/ds-canonical/hooks/retired/check_avatar_hovercard.sh +90 -0
  55. package/ds-canonical/hooks/retired/check_button_icon_literal.sh.retired-2026-04-28 +38 -0
  56. package/ds-canonical/hooks/retired/check_container_breathing.sh +142 -0
  57. package/ds-canonical/hooks/retired/check_governance_compliance.sh +61 -0
  58. package/ds-canonical/hooks/retired/check_icon_only_padding_formula.sh +104 -0
  59. package/ds-canonical/hooks/retired/check_item_content_primitive.sh +150 -0
  60. package/ds-canonical/hooks/retired/check_item_list_gap.sh +153 -0
  61. package/ds-canonical/hooks/retired/check_sideoffset_canonical.sh +65 -0
  62. package/ds-canonical/hooks/retired/check_spec_iteration_tag.sh +87 -0
  63. package/ds-canonical/hooks/retired/check_ssot_consultation.sh +88 -0
  64. package/ds-canonical/hooks/retired/check_sync_update.sh +20 -0
  65. package/ds-canonical/hooks/retired/check_third_party_dom_verified.sh +95 -0
  66. package/ds-canonical/hooks/retired/enforce_home_charter.sh +125 -0
  67. package/ds-canonical/hooks/retired/post_edit_canonical_interrogate.sh +109 -0
  68. package/ds-canonical/hooks/retired/pre_edit_spec_check.sh +68 -0
  69. package/ds-canonical/hooks/retired/pre_new_component_spec.sh +39 -0
  70. package/ds-canonical/hooks/retired/pre_write_subsumption_check.sh +112 -0
  71. package/ds-canonical/hooks/retired/stop_meta_self_audit.sh.retired-2026-05-13 +76 -0
  72. package/ds-canonical/hooks/retired/tests/test_check_anatomy_section_numbering.sh +14 -0
  73. package/ds-canonical/hooks/retired/tests/test_check_avatar_hovercard.sh +15 -0
  74. package/ds-canonical/hooks/retired/tests/test_check_container_breathing.sh +15 -0
  75. package/ds-canonical/hooks/retired/tests/test_check_governance_compliance.sh +15 -0
  76. package/ds-canonical/hooks/retired/tests/test_check_icon_only_padding_formula.sh +79 -0
  77. package/ds-canonical/hooks/retired/tests/test_check_item_content_primitive.sh +15 -0
  78. package/ds-canonical/hooks/retired/tests/test_check_item_list_gap.sh +163 -0
  79. package/ds-canonical/hooks/retired/tests/test_check_sideoffset_canonical.sh +15 -0
  80. package/ds-canonical/hooks/retired/tests/test_check_spec_iteration_tag.sh +15 -0
  81. package/ds-canonical/hooks/retired/tests/test_check_ssot_consultation.sh +15 -0
  82. package/ds-canonical/hooks/retired/tests/test_check_sync_update.sh +14 -0
  83. package/ds-canonical/hooks/retired/tests/test_check_third_party_dom_verified.sh +15 -0
  84. package/ds-canonical/hooks/retired/tests/test_enforce_home_charter.sh +15 -0
  85. package/ds-canonical/hooks/retired/tests/test_pre_edit_spec_check.sh +15 -0
  86. package/ds-canonical/hooks/retired/tests/test_pre_new_component_spec.sh +15 -0
  87. package/ds-canonical/hooks/retired/tests/test_pre_write_subsumption_check.sh +63 -0
  88. package/ds-canonical/hooks/session_start_governance_check.sh +263 -0
  89. package/ds-canonical/hooks/stop_passive_logging.sh +322 -0
  90. package/ds-canonical/hooks/stop_self_audit.sh +450 -0
  91. package/ds-canonical/hooks/tests/KNOWN-BROKEN.md +15 -0
  92. package/ds-canonical/hooks/tests/run-all.sh +76 -0
  93. package/ds-canonical/hooks/tests/test_block_prototype_imports.sh +143 -0
  94. package/ds-canonical/hooks/tests/test_check_app_shell_primary_header_consistency.sh +140 -0
  95. package/ds-canonical/hooks/tests/test_check_audit_post_report_validator.sh +115 -0
  96. package/ds-canonical/hooks/tests/test_check_audit_sample_escape.sh +93 -0
  97. package/ds-canonical/hooks/tests/test_check_benchmark_citation.sh +115 -0
  98. package/ds-canonical/hooks/tests/test_check_canonical_propagation.sh +133 -0
  99. package/ds-canonical/hooks/tests/test_check_chrome_header_handcraft.sh +123 -0
  100. package/ds-canonical/hooks/tests/test_check_code_quality.sh +15 -0
  101. package/ds-canonical/hooks/tests/test_check_codex_collab_5step.sh +96 -0
  102. package/ds-canonical/hooks/tests/test_check_cva_default_sync.sh +15 -0
  103. package/ds-canonical/hooks/tests/test_check_datatable_invariants.sh +122 -0
  104. package/ds-canonical/hooks/tests/test_check_dim_count_drift.sh +98 -0
  105. package/ds-canonical/hooks/tests/test_check_field_controls_contracts.sh +126 -0
  106. package/ds-canonical/hooks/tests/test_check_field_family_invariants.sh +194 -0
  107. package/ds-canonical/hooks/tests/test_check_file_size_budget.sh +32 -0
  108. package/ds-canonical/hooks/tests/test_check_hardcoded_strings.sh +14 -0
  109. package/ds-canonical/hooks/tests/test_check_header_with_tabs_border.sh +110 -0
  110. package/ds-canonical/hooks/tests/test_check_layout_space_canonical.sh +73 -0
  111. package/ds-canonical/hooks/tests/test_check_main_branch_workbench.sh +147 -0
  112. package/ds-canonical/hooks/tests/test_check_naming_and_abstraction.sh +136 -0
  113. package/ds-canonical/hooks/tests/test_check_opacity_token_usage.sh +110 -0
  114. package/ds-canonical/hooks/tests/test_check_overlay_handcraft.sh +126 -0
  115. package/ds-canonical/hooks/tests/test_check_pattern_invariants.sh +148 -0
  116. package/ds-canonical/hooks/tests/test_check_peoplepicker_ssot_drift.sh +108 -0
  117. package/ds-canonical/hooks/tests/test_check_person_data_richness.sh +58 -0
  118. package/ds-canonical/hooks/tests/test_check_pixel_quantified_audit.sh +142 -0
  119. package/ds-canonical/hooks/tests/test_check_propose_plain_chinese.sh +126 -0
  120. package/ds-canonical/hooks/tests/test_check_propose_pre_grep_verify.sh +117 -0
  121. package/ds-canonical/hooks/tests/test_check_select_all_canonical.sh +125 -0
  122. package/ds-canonical/hooks/tests/test_check_solo_workflow.sh +201 -0
  123. package/ds-canonical/hooks/tests/test_check_spec_class_drift.sh +135 -0
  124. package/ds-canonical/hooks/tests/test_check_story_anatomy.sh.broken +197 -0
  125. package/ds-canonical/hooks/tests/test_check_story_category.sh.broken +187 -0
  126. package/ds-canonical/hooks/tests/test_check_story_compile_drift.sh +15 -0
  127. package/ds-canonical/hooks/tests/test_check_story_invariants.sh +209 -0
  128. package/ds-canonical/hooks/tests/test_check_story_name_jargon.sh.broken +53 -0
  129. package/ds-canonical/hooks/tests/test_check_story_slot_split.sh +156 -0
  130. package/ds-canonical/hooks/tests/test_check_substantive_edit_approval_preflight.sh +176 -0
  131. package/ds-canonical/hooks/tests/test_check_tab_lg_chrome_header_equal.sh +138 -0
  132. package/ds-canonical/hooks/tests/test_check_token_hygiene.sh +21 -0
  133. package/ds-canonical/hooks/tests/test_check_wrapper_primitive_schema_drift.sh +169 -0
  134. package/ds-canonical/hooks/tests/test_enforce_home_charter.sh +77 -0
  135. package/ds-canonical/hooks/tests/test_inject_pending_self_audit.sh +125 -0
  136. package/ds-canonical/hooks/tests/test_log_governance_fires.sh +10 -0
  137. package/ds-canonical/hooks/tests/test_log_skill_invokes.sh +7 -0
  138. package/ds-canonical/hooks/tests/test_post_edit_dispatcher.sh +108 -0
  139. package/ds-canonical/hooks/tests/test_session_start_governance_check.sh +143 -0
  140. package/ds-canonical/hooks/tests/test_stop_capture_metrics.sh +95 -0
  141. package/ds-canonical/hooks/tests/test_stop_governance_drift_check.sh.broken +125 -0
  142. package/ds-canonical/hooks/tests/test_stop_harvest_corrections.sh +10 -0
  143. package/ds-canonical/hooks/tests/test_stop_passive_logging.sh +100 -0
  144. package/ds-canonical/hooks/tests/test_stop_self_audit.sh +76 -0
  145. package/ds-canonical/hooks/tests/test_stop_tsc_sanity.sh +10 -0
  146. package/ds-canonical/references/README.md +43 -0
  147. package/ds-canonical/references/audit-coverage-vs-24-checklist.md +74 -0
  148. package/ds-canonical/references/build-ui-canonicals.md +69 -0
  149. package/ds-canonical/references/cva-patterns.md +41 -0
  150. package/ds-canonical/references/drag-canonical.md +331 -0
  151. package/ds-canonical/references/item-anatomy-recipe.md +225 -0
  152. package/ds-canonical/references/naming-conventions.md +56 -0
  153. package/ds-canonical/references/principle-dim-map.json +515 -0
  154. package/ds-canonical/references/props-naming.md +45 -0
  155. package/ds-canonical/references/spec-rules.md +58 -0
  156. package/ds-canonical/references/ssot-consultation.md +63 -0
  157. package/ds-canonical/references/ssot-index.md +40 -0
  158. package/ds-canonical/references/story-baseline-registry.json +79 -0
  159. package/ds-canonical/references/structural-token-retention.md +42 -0
  160. package/ds-canonical/references/tailwind-gotchas.md +87 -0
  161. package/ds-canonical/references/ui-dev-rules.md +60 -0
  162. package/ds-canonical/rules/README.md +34 -0
  163. package/ds-canonical/rules/meta-patterns.md +87 -0
  164. package/ds-canonical/rules/self-verify.md +53 -0
  165. package/ds-canonical/rules/spec-rules.md +25 -0
  166. package/ds-canonical/rules/story-rules.md +56 -0
  167. package/ds-canonical/rules/ui-development.md +87 -0
  168. package/ds-canonical/skills/README.md +88 -0
  169. package/ds-canonical/skills/bug-fix-rhythm/SKILL.md +181 -0
  170. package/ds-canonical/skills/code-quality-audit/SKILL.md +63 -0
  171. package/ds-canonical/skills/codex-collab/SKILL.md +249 -0
  172. package/ds-canonical/skills/codex-collab/references/brief-template.md +48 -0
  173. package/ds-canonical/skills/codex-collab/references/transport.md +58 -0
  174. package/ds-canonical/skills/codify-corrections/SKILL.md +184 -0
  175. package/ds-canonical/skills/codify-principle/SKILL.md +151 -0
  176. package/ds-canonical/skills/component-quality-gate/SKILL.md +102 -0
  177. package/ds-canonical/skills/component-quality-gate/references/checklist.md +79 -0
  178. package/ds-canonical/skills/deep-audit-cross-codex/SKILL.md +247 -0
  179. package/ds-canonical/skills/deep-audit-cross-codex/references/phase-a-workflow.md +123 -0
  180. package/ds-canonical/skills/deep-audit-cross-codex/references/phase-b-codex-brief.md +165 -0
  181. package/ds-canonical/skills/deep-audit-cross-codex/references/triage-rubric.md +91 -0
  182. package/ds-canonical/skills/delivery-handoff/SKILL.md +229 -0
  183. package/ds-canonical/skills/delivery-handoff/references/flow-diagram.md +180 -0
  184. package/ds-canonical/skills/delivery-handoff/references/handoff-template.md +177 -0
  185. package/ds-canonical/skills/delivery-handoff/references/inventory-checklist.md +196 -0
  186. package/ds-canonical/skills/design-system-audit/SKILL.md +343 -0
  187. package/ds-canonical/skills/design-system-audit/references/audit-prompts.md +1260 -0
  188. package/ds-canonical/skills/design-system-audit/references/checkpoints.md +240 -0
  189. package/ds-canonical/skills/design-system-audit/references/historical-bugs.md +240 -0
  190. package/ds-canonical/skills/design-system-audit/references/principle-audit-protocol.md +364 -0
  191. package/ds-canonical/skills/design-system-audit/references/rule-placement.md +175 -0
  192. package/ds-canonical/skills/design-system-audit/references/spec-template.md +66 -0
  193. package/ds-canonical/skills/ensure-canonical/SKILL.md +196 -0
  194. package/ds-canonical/skills/governance-health/SKILL.md +146 -0
  195. package/ds-canonical/skills/knowledge-prune/SKILL.md +303 -0
  196. package/ds-canonical/skills/new-component/SKILL.md +170 -0
  197. package/ds-canonical/skills/new-component/references/new-component-checklist.md +85 -0
  198. package/ds-canonical/skills/performance-audit/SKILL.md +107 -0
  199. package/ds-canonical/skills/product-ui-audit/SKILL.md +230 -0
  200. package/ds-canonical/skills/product-ui-audit/references/audit-checks.md +246 -0
  201. package/ds-canonical/skills/product-ui-audit/references/common-misuses.md +329 -0
  202. package/ds-canonical/skills/product-ui-audit/references/report-template.md +159 -0
  203. package/ds-canonical/skills/propose-options/SKILL.md +177 -0
  204. package/ds-canonical/skills/prototype/SKILL.md +244 -0
  205. package/ds-canonical/skills/prototype/references/audit-checks.md +37 -0
  206. package/ds-canonical/skills/prototype/references/benchmark-sources.md +94 -0
  207. package/ds-canonical/skills/prototype/references/checkpoints.md +191 -0
  208. package/ds-canonical/skills/prototype/references/evaluation-matrix.md +141 -0
  209. package/ds-canonical/skills/prototype/references/ooux-template.md +198 -0
  210. package/ds-canonical/skills/prototype/references/proposal-template.md +229 -0
  211. package/ds-canonical/skills/scan-similar-bugs/SKILL.md +198 -0
  212. package/ds-canonical/skills/story-auto-compile-migrate/SKILL.md +159 -0
  213. package/ds-canonical/skills/story-writing/SKILL.md +122 -0
  214. package/ds-canonical/skills/story-writing/references/anatomy-standard.md +217 -0
  215. package/ds-canonical/skills/story-writing/references/category-templates.md +174 -0
  216. package/ds-canonical/skills/story-writing/references/example-selection.md +70 -0
  217. package/ds-canonical/skills/story-writing/references/self-check.md +20 -0
  218. package/ds-canonical/skills/ux-audit/SKILL.md +130 -0
  219. package/ds-canonical/skills/visual-audit/SKILL.md +245 -0
  220. package/ds-canonical/skills/visual-audit/output/.gitkeep +0 -0
  221. package/ds-canonical/skills/visual-audit/references/audit-architecture.md +100 -0
  222. package/ds-canonical/skills/visual-audit/references/visual-checklist.md +297 -0
  223. package/ds-canonical/skills/visual-audit/references/world-class-benchmarks.md +198 -0
  224. package/package.json +9 -5
  225. package/src/components/Accordion/accordion.spec.md +114 -0
  226. package/src/components/Alert/alert.spec.md +197 -0
  227. package/src/components/AppShell/app-shell.spec.md +331 -0
  228. package/src/components/AspectRatio/aspect-ratio.spec.md +134 -0
  229. package/src/components/Avatar/avatar.spec.md +329 -0
  230. package/src/components/Badge/badge.spec.md +380 -0
  231. package/src/components/Breadcrumb/breadcrumb.spec.md +257 -0
  232. package/src/components/BulkActionBar/bulk-action-bar.spec.md +210 -0
  233. package/src/components/Button/button.spec.md +460 -0
  234. package/src/components/Calendar/calendar.spec.md +242 -0
  235. package/src/components/Carousel/carousel.spec.md +253 -0
  236. package/src/components/Chart/chart.spec.md +155 -0
  237. package/src/components/Checkbox/checkbox.spec.md +344 -0
  238. package/src/components/Chip/chip.spec.md +237 -0
  239. package/src/components/CircularProgress/circular-progress.spec.md +268 -0
  240. package/src/components/Coachmark/coachmark.spec.md +230 -0
  241. package/src/components/Combobox/combobox.spec.md +180 -0
  242. package/src/components/Command/command.spec.md +171 -0
  243. package/src/components/DataTable/data-table.spec.md +525 -0
  244. package/src/components/DateGrid/date-grid.spec.md +215 -0
  245. package/src/components/DatePicker/date-picker.spec.md +334 -0
  246. package/src/components/DescriptionList/description-list.spec.md +214 -0
  247. package/src/components/Dialog/dialog.spec.md +202 -0
  248. package/src/components/DropdownMenu/dropdown-menu.spec.md +250 -0
  249. package/src/components/Empty/empty.spec.md +214 -0
  250. package/src/components/Field/field-controls.spec.md +338 -0
  251. package/src/components/Field/field.spec.md +438 -0
  252. package/src/components/Field/form-validation.spec.md +152 -0
  253. package/src/components/FieldControlGroup/field-control-group.spec.md +176 -0
  254. package/src/components/FileItem/file-item.spec.md +467 -0
  255. package/src/components/FileUpload/file-upload.spec.md +123 -0
  256. package/src/components/FileViewer/file-viewer.spec.md +373 -0
  257. package/src/components/HoverCard/hover-card.spec.md +157 -0
  258. package/src/components/Input/input.spec.md +193 -0
  259. package/src/components/LinkInput/link-input.spec.md +130 -0
  260. package/src/components/Menu/menu-item.spec.md +290 -0
  261. package/src/components/NameCard/name-card.spec.md +171 -0
  262. package/src/components/Notice/notice.spec.md +149 -0
  263. package/src/components/NumberInput/number-input.spec.md +126 -0
  264. package/src/components/OverflowIndicator/overflow-indicator.spec.md +120 -0
  265. package/src/components/PeoplePicker/people-picker.spec.md +263 -0
  266. package/src/components/Popover/popover.spec.md +198 -0
  267. package/src/components/ProgressBar/progress-bar.spec.md +232 -0
  268. package/src/components/RadioGroup/radio-group.spec.md +141 -0
  269. package/src/components/Rating/rating.spec.md +208 -0
  270. package/src/components/ScrollArea/scroll-area.spec.md +145 -0
  271. package/src/components/SegmentedControl/segmented-control.spec.md +295 -0
  272. package/src/components/Select/select.spec.md +299 -0
  273. package/src/components/SelectMenu/select-menu.spec.md +220 -0
  274. package/src/components/SelectionControl/selection-item.spec.md +128 -0
  275. package/src/components/Separator/separator.spec.md +109 -0
  276. package/src/components/Sheet/sheet.spec.md +148 -0
  277. package/src/components/Sidebar/sidebar.spec.md +713 -0
  278. package/src/components/Skeleton/skeleton.spec.md +104 -0
  279. package/src/components/Slider/slider.spec.md +353 -0
  280. package/src/components/Steps/steps.spec.md +465 -0
  281. package/src/components/Switch/switch.spec.md +215 -0
  282. package/src/components/Tabs/tabs.spec.md +314 -0
  283. package/src/components/Tag/tag.spec.md +282 -0
  284. package/src/components/Textarea/textarea.spec.md +151 -0
  285. package/src/components/TimePicker/time-picker.spec.md +279 -0
  286. package/src/components/Toast/toast.spec.md +177 -0
  287. package/src/components/Tooltip/tooltip.spec.md +139 -0
  288. package/src/components/TreeView/tree-view.spec.md +374 -0
  289. package/src/patterns/action-bar/action-bar.spec.md +458 -0
  290. package/src/patterns/element-anatomy/element-anatomy.spec.md +215 -0
  291. package/src/patterns/element-anatomy/inline-action.spec.md +315 -0
  292. package/src/patterns/element-anatomy/item-anatomy.spec.md +1042 -0
  293. package/src/patterns/header-canonical/header-canonical.spec.md +285 -0
  294. package/src/patterns/horizontal-overflow/horizontal-overflow.spec.md +191 -0
  295. package/src/patterns/overlay-surface/overlay-surface.spec.md +428 -0
  296. package/src/patterns/resize-handle/resize-handle.spec.md +109 -0
  297. package/src/tokens/color/color.spec.md +804 -0
  298. package/src/tokens/density/density.spec.md +127 -0
  299. package/src/tokens/elevation/elevation.spec.md +81 -0
  300. package/src/tokens/layoutSpace/layoutSpace.spec.md +314 -0
  301. package/src/tokens/motion/motion.spec.md +97 -0
  302. package/src/tokens/opacity/opacity.spec.md +78 -0
  303. package/src/tokens/orphan-tokens.spec.md +117 -0
  304. package/src/tokens/radius/radius.spec.md +123 -0
  305. package/src/tokens/typography/typography.spec.md +202 -0
  306. package/src/tokens/uiSize/uiSize.spec.md +438 -0
  307. package/src/styles/preset.css +0 -31
@@ -0,0 +1,240 @@
1
+ # Checkpoints — 什麼時候 MUST 停下來問
2
+
3
+ 這些是 skill 執行過程中**不可略過**的 user 決策點。past 執行失敗都因為我自行決定了該問的事。
4
+
5
+ ---
6
+
7
+ ## Checkpoint 1 — 稽核完畢後的 Triage(每次 run 都會觸發)
8
+
9
+ 稽核結果出來後,**先不修**,先把findings 分類呈現:
10
+
11
+ **格式範本**:
12
+ ```
13
+ 🔍 稽核結果彙整
14
+
15
+ P0(自動修,無 scope 爭議): N 項
16
+ - cva 三方漂移: X 處
17
+ - SSOT dead link: Y 處
18
+ - Tailwind v4 grep 違規: Z 處
19
+ - 硬寫 color 值: W 處
20
+
21
+ P1(批次修 + review): M 項
22
+ - Rule A 文字品質違規: A 處
23
+ - Story 人話範例違規: B 處
24
+ - shadcn passthrough 缺失: C 處
25
+ - Anatomy 缺 section: D 處
26
+ - a11y aria-label 缺失: E 處
27
+
28
+ P2(MUST ASK): K 項
29
+ 1. [findings 1 scope 爭議] — 選項 A / B / C
30
+ 2. [findings 2]
31
+
32
+ 建議順序:
33
+ 1. 先修 P0(獨立 commit)
34
+ 2. 再修 P1(每類一個 commit)
35
+ 3. P2 逐項討論再決定
36
+
37
+ 要從哪一項開始?
38
+ ```
39
+
40
+ **絕對不可**:
41
+ - ❌ 跳過 triage 直接開始修 P1/P2
42
+ - ❌ 把 P2 當 P1 mechanical 執行
43
+ - ❌ 僅報總數不提供 file:line 讓 user 掃
44
+
45
+ ---
46
+
47
+ ## Checkpoint 2 — 稽核發現 CLAUDE.md 沒覆蓋的 pattern
48
+
49
+ 若某個 audit 找到的違規不符合現有 CLAUDE.md 任何規則(= 新 pattern,非現有規則下的違反),必須 pause:
50
+
51
+ **觸發情境**:
52
+ - a11y audit 發現 7 個元件無 focus-visible,但 CLAUDE.md 沒明訂 focus ring 規則
53
+ - Token audit 發現一個新 color 硬寫模式反覆出現
54
+ - shadcn passthrough 發現 `displayName` 以外另一種 anti-pattern
55
+
56
+ **格式範本**:
57
+ ```
58
+ 🔔 Audit 發現 CLAUDE.md 未覆蓋的 pattern:
59
+
60
+ Pattern: [描述]
61
+ 頻率: 出現在 X 個元件
62
+ Root cause (推測): [判斷 why 發生]
63
+
64
+ 建議新增到 CLAUDE.md 的規則:
65
+ 「[draft]」
66
+
67
+ 放哪一節 (按「規則分層」判斷):
68
+ - 若跨元件 → `.claude/rules/ui-development.md` / `.claude/rules/spec-rules.md` / `.claude/rules/story-rules.md`
69
+ - 若技術陷阱 → # 失敗記憶索引 + 根原位置 section
70
+ - 若純風格 → # 命名與語言一致性
71
+
72
+ 你決定:
73
+ (a) 採用此 draft,我同步寫進 CLAUDE.md
74
+ (b) 修改措辭: ...
75
+ (c) 不新增,遇到再 case-by-case 處理
76
+ ```
77
+
78
+ **絕對不可**:
79
+ - ❌ 直接寫新規則進 CLAUDE.md
80
+ - ❌ 忽視 pattern 只修個別違規
81
+ - ❌ 半途改 mindset 條目(最高層級規則不可未經討論就加)
82
+
83
+ ---
84
+
85
+ ## Checkpoint 3 — 分類模糊(Internal vs Components / SSOT ownership)
86
+
87
+ 稽核可能發現邊界元件,classification 不明:
88
+
89
+ **觸發情境**:
90
+ - 新元件的 Storybook title 應該放 `Components/` 還是 `Internal/`?
91
+ - 兩個元件互相比較,誰 own 完整對照、誰寫 pointer?
92
+ - 某 token 該歸類為 primitive 還是 semantic?
93
+
94
+ **格式範本**:
95
+ ```
96
+ 🤔 Classification 需要決定:
97
+
98
+ 問題: [element / rule / token 是 A 還是 B?]
99
+
100
+ 判斷依據:
101
+ - CLAUDE.md「{判斷 test 的位置}」第 X 題: [...]
102
+ - 相似 precedent: [已分類的類似案例]
103
+
104
+ 兩個選項的 trade-off:
105
+ 選 A (...) → 優: [...] 缺: [...]
106
+ 選 B (...) → 優: [...] 缺: [...]
107
+
108
+ 我傾向 B 因為 [...], 但需要你確認。
109
+ ```
110
+
111
+ **絕對不可**:
112
+ - ❌ 憑感覺分類
113
+ - ❌ 用元件名稱 (HoverCard「看起來」公開) 分類
114
+ - ❌ 未查既有 precedent
115
+
116
+ ---
117
+
118
+ ## Checkpoint 4 — Cross-cutting refactor(影響 > 10 檔)
119
+
120
+ 若修復涉及大量檔案的 mechanical 改動:
121
+
122
+ **觸發情境**:
123
+ - Helper function extraction 影響 41 個 anatomy files
124
+ - Token rename 影響 71 個 utility 使用
125
+ - Spec schema 改動影響所有 spec file 結構
126
+
127
+ **格式範本**:
128
+ ```
129
+ ⚠️ 大範圍 refactor 提議:
130
+
131
+ 異動: [描述]
132
+ 影響範圍: X 個檔案
133
+ 風險:
134
+ - [風險 1]
135
+ - [風險 2]
136
+ 回復難度: [rebase 難度]
137
+
138
+ 執行方式:
139
+ (a) 一次 commit 全改(快但難 review)
140
+ (b) 分 N 個 commit 依 feature cluster 分批(慢但可 cherry-pick)
141
+ (c) 不做,留 tech debt,下次針對性處理
142
+
143
+ 我傾向 (b) / 分 [clusters] 執行。你同意嗎?
144
+ ```
145
+
146
+ **絕對不可**:
147
+ - ❌ 直接跑 mechanical find-replace 不 preview
148
+ - ❌ 一個 commit 塞 41 個 file
149
+ - ❌ 改完才告訴 user
150
+
151
+ ---
152
+
153
+ ## Checkpoint 5 — 環境 / 建置問題
154
+
155
+ 稽核過程若遇環境問題(node_modules 壞、storybook 啟動失敗、tsc 報不相關錯),**不要嘗試修環境**:
156
+
157
+ **格式範本**:
158
+ ```
159
+ ⚠️ 環境 / 建置問題(非本 audit 引入):
160
+
161
+ 現象: [描述]
162
+ 影響: 我無法 [verify X]
163
+ 是否本 audit 引入的? 確認不是 (理由: git log / file touch 證實)
164
+ 建議:
165
+ - 現在不碰環境,稽核照常進行
166
+ - 環境問題交給你 / 下個 session 處理
167
+ - 本 audit 的 tsc --noEmit 可以跑,用它當 correctness guard
168
+ ```
169
+
170
+ **絕對不可**:
171
+ - ❌ 重 install node_modules
172
+ - ❌ 改 vite / storybook 設定試圖修
173
+ - ❌ 編輯無關檔案「順便修」
174
+
175
+ ---
176
+
177
+ ## Checkpoint 6 — 發現 spec 與 code 衝突
178
+
179
+ 稽核若發現 spec.md 與 .tsx 描述的行為不同:
180
+
181
+ **格式範本**:
182
+ ```
183
+ ⚠️ Spec 與 Code 衝突:
184
+
185
+ 元件: X
186
+ Spec 說: [句子 + line N]
187
+ Code 實際: [行為 + line M]
188
+
189
+ 誰對?
190
+ - 若 Code 是 "後來 fix 的對的版本":Spec 過時,需要更新
191
+ - 若 Code 是 "bug 未修":Code 要改
192
+ - 若 Code 和 Spec 都錯:需討論正確做法
193
+
194
+ 我的判斷: [分析]
195
+ 等你確認哪個是 canonical 再動手。
196
+ ```
197
+
198
+ **絕對不可**:
199
+ - ❌ 默默選一個修
200
+ - ❌ 改 code 前未讀 git log 看是否刻意改動
201
+
202
+ ---
203
+
204
+ ## Checkpoint 7 — 「先不管」vs tech debt 語意區分(user directive)
205
+
206
+ User 不同用語表達「現在不做」,語意差別明顯,處理方式不同。**本 checkpoint 是 Skill 層 SSOT**(對話 protocol 屬 skill,非 CLAUDE.md 層):
207
+
208
+ ### 語意對照表
209
+
210
+ | User phrasing | 語意 | 處理 |
211
+ |--------------|-----|------|
212
+ | 「先不管」/「這個先跳過」/「不要追蹤」/「算了」 | **完全忽略,不進任何 tracking** | 不寫進 memory、不加進 失敗索引、不在下次 audit 提及。就當沒這件事。 |
213
+ | 「之後再處理」/「先記下來」/「下次做」 | **Park 為 tech debt** | 寫進 `memory/project_audit_progress.md` 「仍待未來處理」區,下次 audit 會 surface |
214
+ | 「做完」/「繼續」/「執行」/「馬不停蹄」 | **立刻處理** | 進 TaskList,執行完 mark completed |
215
+
216
+ ### 判斷法
217
+
218
+ 看 user 語氣傾向:
219
+ - **明確否決這件事不重要** → 完全移除 tracking
220
+ - **表達現在沒時間但該做** → tech debt
221
+ - **表達立刻做** → execute
222
+
223
+ ### 禁止混用
224
+
225
+ 將 user 的「先不管」當作 tech debt 記下來,下次 audit 又提 —— 違反 user 意圖,製造雜訊。
226
+
227
+ ### 範本
228
+
229
+ 當 user 在 Checkpoint 1 triage 或討論 P2 時表達「先不管」:
230
+
231
+ ```
232
+ ✓ 了解,先不管「{item}」。
233
+ 完全不寫進 memory tech debt / 失敗索引 / 下次 audit。
234
+ 當沒這件事。
235
+ ```
236
+
237
+ ### 歷史
238
+
239
+ 2026-04-18 session:user 對 icon micro tier(Tag dismiss X ratio)+ checkbox checkmark
240
+ 自繪說「先不管」。AI 最初差點寫進 memory tech debt,經 user 再次提醒「先不管就是完全不用理他」才移除。
@@ -0,0 +1,240 @@
1
+ # Bug Classes This Skill Prevents
2
+
3
+ Curated from the `# 失敗記憶索引` in CLAUDE.md plus audit runs. Each entry names the bug class, how it originally slipped in, and which audit catches it.
4
+
5
+ ---
6
+
7
+ ## Three-way drift — cva vs spec vs anatomy
8
+
9
+ **First seen**: SegmentedControl (2026-04-18) — cva `defaultVariants.size = 'md'` but spec.md + tsx docblock + anatomy all wrote `sm ★default`. Three-way disagreement persisted unnoticed.
10
+
11
+ **Caught by**: Audit 1 (cva defaultVariants drift).
12
+
13
+ **Recurrence**: Steps anatomy prop table drift (orientation), SegmentedControl anatomy prop table drift (size still `'sm'` in anatomy-only location). Both caught in 2026-04-18 run.
14
+
15
+ **Why it recurs**: When developer changes `cva()` defaults, the sync checklist across 4 locations (cva + spec prop table + tsx docblock + anatomy prop table + anatomy story H3) is easy to miss. Automation via grep `"★|預設|default"` across a component's folder before committing is the primary guard.
16
+
17
+ ---
18
+
19
+ ## Spec text pollution — visual / implementation details
20
+
21
+ **First seen**: Multiple specs across the audit — Badge with `16px 高、10px 字`, Chip with `display: flex; gap: 8px;`, NameCard with `bg-muted rounded-md px-3 py-2`, Tabs with `::after bottom: -1px`, Slider with「被 range 圍住的空心洞」物理比喻.
22
+
23
+ **Caught by**: Audit 2 (Rule A).
24
+
25
+ **Why it recurs**: When writing specs, authors feel compelled to be "precise" — but precise pixel / class specs belong in `.tsx` (source of truth for values) and `.anatomy.stories.tsx` (visual reference). Spec is for design principles (why / when). Visual metaphors belong in `.principles.stories.tsx` (visualization).
26
+
27
+ **Rule of thumb**: if removing the sentence from spec would leave the principle intact, the sentence is describing implementation — remove it.
28
+
29
+ ---
30
+
31
+ ## Story placeholders — `Option A / B / C` / variant names as labels
32
+
33
+ **First seen**: Button principles used `<Button variant="primary">Primary</Button>` as a label, Tag used `分類 A / B / C / D / E`, Steps used `Step 1/2/3/4` without business scenario.
34
+
35
+ **Caught by**: Audit 4 (Story human-language).
36
+
37
+ **Why it recurs**: When authoring stories, it's tempting to use variant names or letters because "it demonstrates all the variants." But Storybook's受眾 is any designer / PM / engineer opening it — they should grasp the scenario from the example alone, not from the label.
38
+
39
+ **Rule of thumb**: every story example must pass the 「人」test (遮標題光看元件懂情境) — if it fails, use a real business scenario (Jira / Stripe / Notion).
40
+
41
+ ---
42
+
43
+ ## SSOT pointer drift — heading renamed, pointer not updated
44
+
45
+ **First seen**: `opacity.spec.md` pointed to `color.spec.md「Disabled 策略」` but actual heading was「Disabled 狀態 / 兩種 disabled 策略」. Similar issues across 4 pointers (radio-group, item-layout, name-card).
46
+
47
+ **Caught by**: Audit 6 (SSOT pointer dead-link).
48
+
49
+ **Why it recurs**: Headings get renamed for clarity. Pointers using 「heading」 format hard-code the old name. Grep-audit across `\.spec\.md「[^」]+」` surfaces these.
50
+
51
+ **Prevention**: when renaming a spec heading, grep the project for the old heading name first — find reverse references, update them.
52
+
53
+ ---
54
+
55
+ ## Anatomy incomplete — missing sections (no color matrix / no state matrix)
56
+
57
+ **First seen**: Popover / Sheet / Command / PeoplePicker / NameCard have only 1-3 stories where 5 are required. Live color swatches missing in SegmentedControl / Switch / Tabs / Toast / Steps / Slider / Textarea / Field / TreeView (tokens as text only).
58
+
59
+ **Caught by**: Audit 5 (Anatomy completeness).
60
+
61
+ **Why it recurs**: When a component is simple (single variant, single size), authors feel the full 5-section template is overkill. But even simple components benefit from explicit "本元件無 size" / "本元件無 state" statements — the skeleton provides Figma-inspect-parity for designers.
62
+
63
+ ---
64
+
65
+ ## Density dual values in anatomy
66
+
67
+ **First seen**: Tabs / SegmentedControl / Sidebar anatomy size tables had `md density / lg density` columns showing `28→32px` dual values.
68
+
69
+ **Caught by**: Audit 5 (Figma-test).
70
+
71
+ **Why it recurs**: Authors want to be thorough. But CLAUDE.md explicitly forbids — anatomy reflects *current* density (re-rendered on density switch); dual columns are noise. Token name is enough.
72
+
73
+ ---
74
+
75
+ ## Internal vs Components misclassification
76
+
77
+ **First seen**: HoverCard originally under `Components/` (behavior primitive, no default visual) — should be `Internal/`.
78
+
79
+ **Caught by**: CLAUDE.md has a 3-question test; audits cross-check.
80
+
81
+ **Why it recurs**: Name bias — HoverCard *sounds* like a public component. Always go by behavior (has default visuals? rendered directly anywhere?) not name.
82
+
83
+ ---
84
+
85
+ ## Field-height family default inconsistency
86
+
87
+ **First seen**: Chip was listed in the default-md family but is actually fixed single-size (h-field-sm, Material 3 convention). Clean-up in 2026-04-18.
88
+
89
+ **Caught by**: Audit 1 + Audit 3 scope application.
90
+
91
+ **Why it recurs**: Authors see "component consumes field-height token" and assume it's in the sm/md/lg family. Single-size consumers (Chip, Breadcrumb?) need separate classification.
92
+
93
+ ---
94
+
95
+ ## Chart of audit → bug class(對齊 current 27-audit numbering,Groups A–K,in audit-prompts.md)
96
+
97
+ ### Group A — Correctness (P0)
98
+ | Audit | Primary bug class | Secondary |
99
+ |-------|-------------------|-----------|
100
+ | 1. cva defaultVariants 三方漂移 | Three-way default drift | Family classification |
101
+ | 2. SSOT dead link | Dead link pointers | Heading drift |
102
+ | 3. SSOT reciprocal | Missing reverse pointer | Cross-spec inconsistency |
103
+ | 4. Tailwind v4 / tailwind-merge grep | `[--foo]` silent fail | Unregistered utility strip |
104
+ | 5. Token 消費紀律 | Hardcoded hex / rgba | Raw pixel values |
105
+
106
+ ### Group B — Spec hygiene (P1)
107
+ | Audit | Primary bug class | Secondary |
108
+ |-------|-------------------|-----------|
109
+ | 6. Spec Rule A 文字品質 | Spec text pollution | Visual description leaks |
110
+ | 7. Spec Rule B 邊界案例 | Missing boundary coverage | Scope misapplication |
111
+ | 8. 7-維度 對標覆蓋 | Missing DS dimension | Thin spec |
112
+
113
+ ### Group C — Code conformance (P1)
114
+ | Audit | Primary bug class | Secondary |
115
+ |-------|-------------------|-----------|
116
+ | 9. shadcn passthrough 完整度 | Missing forwardRef / displayName | Missing ...props / cva export |
117
+ | 10. a11y 基本覆蓋 | Missing aria-label | Non-button onClick |
118
+
119
+ ### Group D — Story layer (P1)
120
+ | Audit | Primary bug class | Secondary |
121
+ |-------|-------------------|-----------|
122
+ | 11. Story 三層齊全 | Missing stories layer | Internal vs Components 誤分 |
123
+ | 12. Story 人話範例 | Placeholder / abstract labels | Extreme unrealistic |
124
+ | 13. Anatomy Figma-inspect 完整度 | Missing sections / dev-lang | Density dual / no swatches |
125
+
126
+ ### Group E — System-level (P1)
127
+ | Audit | Primary bug class | Secondary |
128
+ |-------|-------------------|-----------|
129
+ | 14. 命名一致性 | Folder/file case mismatch | H1 heading drift |
130
+ | 15. CLAUDE.md 自身一致性 | Internal contradictions | Dead internal references |
131
+
132
+ ### Group F — Architecture compliance (P1, session-learned)
133
+ | Audit | Primary bug class | Secondary |
134
+ |-------|-------------------|-----------|
135
+ | 16. Layout Family 宣告 | 元件缺 Family declaration | 系統遊離 |
136
+ | 17. Prop value 跨元件認知衝突 | 同 literal 不同語義 | 違反命名三重 test #3 |
137
+ | 18. shadcn compat alias 回流 | `npx shadcn add` 遺留 alias | 硬寫 Tailwind shadow |
138
+
139
+ ---
140
+
141
+ ## Meta-Pattern layered index (2026-04-21 rebuild)
142
+
143
+ After the 2026-04-21 governance rebuild, each historical bug maps to one of the 6 Meta-Patterns in CLAUDE.md `# Meta-Pattern 預警`. The index below is the canonical mapping; specific bug classes are kept below as historical context, but future bugs should be classified into a Meta-Pattern first.
144
+
145
+ ### M1 — 視覺決策前必消費 SSOT
146
+
147
+ - **FileViewer 初版**(2026-04-20 / AR26-38):dismiss 用 Button 不用 ItemInlineAction / header 硬寫 h-14 不用 `--chrome-header-height` / toolbar 按鈕 gap 沒對齊 `action-bar.spec.md` / Sheet 表單 gap 沒用 `--layout-space-tight`
148
+ - **Input `variant="bare"`**(2026-04-20):FileViewer ZoomInput 發明新 variant 未先 grep 既有 Input variant 值;事後 codify 進 Input spec 但 discovery pattern 有誤(不該先發明)
149
+ - **Row 硬刻 `<div><Icon/><span/><Button/></div>`**(反覆發生):應用 MenuItem + slot components
150
+ - **Loading overlay 手刻 `<div absolute inset-0 flex center>`**(反覆發生):應用 `<Empty icon={<CircularProgress/>}/>` 或 Input `loading` prop
151
+
152
+ ### M2 — 消費 3rd-party lib 必驗 rendered DOM
153
+
154
+ - **react-day-picker v9 `data-range-*` 不存在**(2026-04-21 / AR43):DateGrid 用 `[&[data-range-middle]]:bg-...` 靜默失效,正解走 classNames prop
155
+ - **react-zoom-pan-pinch fit-to-page 算錯**(2026-04-21 / AR 本輪):formula 混淆 `object-contain` 的 pre-scale 和 transform scale,導致 fit 反而縮小;正解移除 object-contain 用 natural size + onLoad 計算 fit scale
156
+ - **wheel step 10% 太粗**(2026-04-21 / AR 本輪):預設 0.1 非世界級(Figma ~3%、Preview ~5%),調到 0.03 + smoothStep 0.005
157
+ - **DateGrid today `[&>button]:relative` 破壞 absolute**(2026-04-21):button 已 `absolute inset-0.5` 是 positioning context,重加 relative 覆蓋掉 absolute → sizing 破壞
158
+
159
+ ### M3 — Portal 逃逸 subtree context
160
+
161
+ - **FileViewer DropdownMenu dark subtree 變亮**(2026-04-20 / AR26):Portal 到 document body,不繼承 FileViewer `data-theme="dark"` subtree,需顯式 forward + 強制 `bg-surface-raised` 等 dark token class
162
+
163
+ ### M4 — Group 元件必隔離 fieldCtx
164
+
165
+ - **Checkbox in CheckboxGroup 所有 label 抑制**(2026-04-21 / AR34):fieldCtx 在 CheckboxGroup 內傳染到每個 item,每個 Checkbox 以為自己在 Field 裡唯一 → label 被抑制;正解建 `CheckboxGroupContext` 隔離,`shouldSuppressLabel = insideField && !insideGroup`
166
+ - **Checkbox 共用 fieldCtx.id 點擊只 toggle 第一個**(2026-04-21 / AR34):同上 root cause,所有 item 的 `<label htmlFor={fieldCtx.id}>` 指向同一 id;正解 `insideGroup ? generatedId : fieldCtx?.id ?? generatedId`
167
+
168
+ ### M5 — State 疊加必 spec 聲明
169
+
170
+ - **DateGrid today + selected bar 色隱形**(2026-04-21):today bar 用 `bg-primary` 藍色,selected cell bg 也是藍色 → bar 隱形;正解 `[&[data-selected=true]>button]:after:bg-on-emphasis` 在 selected 時切白
171
+ - **DateGrid today bar 過於貼近 button 邊**(2026-04-21):`bottom-[2px]` 離 button 底太近,視覺「黏邊」;正解 `bottom-[5px]` 貼近數字行底
172
+
173
+ ### M6 — Stakeholder gate 強制進階稽核
174
+
175
+ - **FileViewer 初版多 round 反覆修 AR26-38**(2026-04-20):初版出給人看前沒跑進階稽核 / 沒截圖全 state 驗證 → 後續 user 發現 8+ 項問題分多輪修;若 merge 前過了 `/component-quality-gate` Phase 4.5 進階模式 + `/visual-audit` Layer A + Layer B,多數問題應當場攔下
176
+
177
+ ### 獨立技術陷阱(非 meta-pattern,保留 anchor)
178
+
179
+ - cva `defaultVariants.size` 三方漂移(SegmentedControl) → `/story-writing` Phase 4 + hook `check_cva_default_sync.sh`
180
+ - Row 硬寫 `py-2` 產生 gap(TreeView in SidebarGroup) → item-anatomy spec
181
+ - asChild pattern consumer 自查 avatar size → item-anatomy spec
182
+ - HoverCard 誤放 Components/(純行為 primitive 應 Internal/) → `# Story` 判斷 test
183
+ - Chip 誤列 field-height family(Material 3 固定 sm) → `tokens/uiSize/uiSize.spec.md`
184
+
185
+ ---
186
+
187
+ ## Meta-Pattern M1-M17 origins(2026-04-24 搬自 CLAUDE.md 3rd column)
188
+
189
+ Each Meta-Principle 起源於具體 bug 類型。CLAUDE.md M-row 第 3 欄壓到 ≤80 字,完整歷史在這。
190
+
191
+ ### M1 — 視覺決策前必消費 SSOT
192
+ 自發明 `variant="bare"` / Sheet 表單 gap 沒用 layout-space token / Header 高度沒用 `--chrome-header-height` / Row 沒用 item-anatomy / Toolbar 按鈕群 gap 不對齊 action-bar canonical。2026-04-22 dismiss Button/Inline Action 分界後走 item-anatomy「Predicate」SSOT。
193
+
194
+ ### M2 — 消費 3rd-party lib 必驗 rendered DOM
195
+ react-day-picker `data-range-*` attribute 不存在(我們 CSS selector 無效);react-zoom-pan-pinch fit-to-page 算錯(混淆 object-contain 跟 transform scale);wheel step 10% 太粗。任何 lib 升級可能 silent breakage。
196
+
197
+ ### M3 — Portal 逃逸 subtree context
198
+ DropdownMenu 在 dark subtree 變亮(theme 未 forward);density 規則:部分 overlay(Popover / Tooltip)刻意 lock `md` 非 inherit(density.spec.md 明訂);未來任何 Portal 元件都要檢視。
199
+
200
+ ### M4 — _Group 元件必隔離單 item 的 fieldCtx
201
+ Checkbox 在 CheckboxGroup 內所有 label 抑制(所有 item 共用 fieldCtx.id + hasFieldWrapper → label 重複被抑制 / 所有 item 共用 id 點擊只 toggle 第一個)。未來任何 `*Group` 類容易犯同樣模式。
202
+
203
+ ### M5 — 視覺 canonical 必 spec 聲明所有 state 疊加
204
+ DatePicker `today + selected`:藍 bar 疊在藍底隱形;`hover + disabled`:ring 仍顯示;`range + today`:指示器重疊。單一 state 有定義不夠,必聲明所有兩兩 / 三疊加。
205
+
206
+ ### M6 — Stakeholder-visible 產出強制進階稽核
207
+ 2026-04-20 FileViewer 初版不看 action-bar spec / button 間距錯 / dismiss 用 Button / header 沒 token / 視覺不整齊就上給人看;被 user 發現 AR26-38 共 8+ 項。若 merge 前過 /component-quality-gate Phase 4.5 進階模式 + /visual-audit 兩層,多數應當場攔下。
208
+
209
+ ### M7 — 新 protocol 必 cross-check 既有 Meta-Principle
210
+ 2026-04-21 `principle-audit-protocol.md` v1 寫完沒套 Phase 0 全掃到 D6b/D6c,被 user 抓到「這也是跟一致性有關」才補。AI 寫新東西時套用既有原則有盲點,寫完必反向檢視。
211
+
212
+ ### M8 — 訂 cross-component canonical 前必 world-class benchmark
213
+ 2026-04-22 item-anatomy Inline Action vs Button predicate 疊代 4 次(position-based → density 分界 → fixed-small → chrome corner exception),每次 user 拉回才補對照。若 M8 存在,第一次就該先 benchmark Material IconButton / Polaris Button plain / Atlassian IconButton / Ant Button type=text 的位置規則再訂 rule。
214
+
215
+ ### M9 — Predicate 寫完 present 前必 4 題自測
216
+ 2026-04-22 AI 列 Cat 1 IA 範例塞「DatePicker endAction」(含裝飾 Calendar,該走 decorative indicator)+「Chrome corner close」(該走 Cat 3 Button);FileItem rich 列 Button sm 違反同 session 訂的 ≤24 cap;DataTable 初版列 Inline Action(世界級全用 Button)。四個錯分每一個都 user 抓到才修。
217
+
218
+ ### M10 — Proactive exhaustive scan
219
+ 2026-04-22 dismiss canonical migration 只改 Dialog/Sheet/Popover/Alert/Notice/Coachmark,漏 FileViewer 2 處 + action-bar stories 4 處;同時 Dialog autoFocus tooltip 洩漏 / body 未用 ScrollArea / layoutSpace uiSize 耦合 / list-in-dialog padding 大 — AI 全程知道或該察覺但沒主動講,user 7 個問題一次炸出來。根因:AI「做完」標準太鬆(只改 explicit 要的事),缺 proactive self-scan。
220
+
221
+ ### M11 — User-perspective interactive state walk
222
+ 2026-04-22 ListBody 修完 user 連抓 5 波:hover bg 貼邊違反不貼邊 / focus ring click 觸發擾人 / notification 範例不現實(誰會進 modal 又跳別處)/ menu py-2 沒對齊 / layoutSpace md reset selector 缺。每個都是 user 視角一看就知,AI 沒跑 7 題 state walk 就 commit。
223
+
224
+ ### M12 — Binary strict rule 前必 benchmark + invariant test
225
+ 2026-04-22 hover bg 四次震盪:v1 寫「bg 不貼邊」→ user 糾 Image 22 inset 錯 / 23 flush 對 → v2 寫「必 flush」→ user 糾「flush 本來就合法,不一定要 flush」→ v3 又寫「bg 邊自由、content 有 spacing 即可」→ user 再糾 Image 24「content 貼 bg 邊」仍違規,Image 25「bg 比 content 寬」才對 → 真 invariant = content 必在 bg 內有 padding,bg 邊位置是 variance。
226
+
227
+ ### M13 — User 第 2 次提起 → 自動觸發截圖 verify
228
+ 2026-04-22 hover bg 震盪 4 次 + avatar-NameCard migration 拖延:user 說「我說所有」明示 DS-wide,但 AI 第一次只改 2 處 dialog stories,15+ 處放 tech debt 留到下次。user 第 2 次提起才完成。根因:AI「做完」標準太鬆(視 user 明示為「提醒」而非「canonical 聲明」)。
229
+
230
+ ### M14 — 對話結論 AUTO integrate pipeline
231
+ 2026-04-22 本 session 每個 canonical(chrome-header / dismiss 分家 / avatar hoverCard / popover 14px)都是 user 提醒才整合,AI 只做 code 改動但忘記 spec / CLAUDE.md / memory / hook 同步。根因:AI「做完」的標準只含 code,缺「整合多層」的 procedural rule。M14 若存在,每次 code change 後自動觸發 pipeline,不等 user 第 2 次問。
232
+
233
+ ### M15 — Product UI flow 必須 visual-audit coverable
234
+ 2026-04-22 Sheet / FileViewer 過去只有 trigger button stories,visual-audit 跑 `--scope=component:Sheet` 只截到 trigger 未 open state,被 user 點破「能抓到點擊打開的 modal 嗎?」才補 OpenSnapshot。若 M15 存在,新元件建立時就該有 OpenSnapshot。
235
+
236
+ ### M16 — Standalone card/pill 必同步訂 list gap
237
+ 2026-04-22 FileItem rich `border card` + compact `bg-secondary` 先前已訂 canonical,但 spec 只寫單 item 視覺沒寫連續 item gap,導致 file-upload.stories.tsx rich list 加 `border rounded-lg overflow-hidden` 強制邊框相黏、compact list 無 gap bg 塊連一大片。User 貼圖糾正才發現。世界級 benchmark:Polaris / Material M3 / Atlassian / Ant / Carbon / Apple HIG 6 家共識 — default flush row 0 gap + separator;standalone card stack 才需 gap。
238
+
239
+ ### M17 — SSOT 必可傳播(非僅 markdown)
240
+ 2026-04-23 user 指出「mt-0.5 canonical 只存 markdown 文字、13 consumer 各自 hard-code,今天雖 compliant 但明天改 2px → 4px 需手動 grep N 檔 = 假 SSOT」。本 session migrate token + primitive + mode prop 後,改 `--item-gap-label-desc` 一處全 DS 同步。真 SSOT 必是可執行 value(token / primitive / utility class)。世界級對照:Material dense prop / Carbon size enum / Ant size enum / Polaris token,6 家皆透過 token + primitive 組合。