quiver-cli 1.3.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (384) hide show
  1. package/README.md +197 -239
  2. package/dist/cli.js +3163 -2040
  3. package/package.json +10 -11
  4. package/template/.agents/AGENTS.md +0 -26
  5. package/template/.agents/commands/cp.md +0 -108
  6. package/template/.agents/commands/next-setup.md +0 -1064
  7. package/template/.agents/commands/review.md +0 -68
  8. package/template/.agents/commands/terraform-readme.md +0 -38
  9. package/template/.agents/config.json +0 -80
  10. package/template/.agents/plugins/opencode/rtk.ts +0 -34
  11. package/template/.agents/skills/agent-browser/SKILL.md +0 -51
  12. package/template/.agents/skills/apps/skybridge/SKILL.md +0 -50
  13. package/template/.agents/skills/code/cleanup/SKILL.md +0 -26
  14. package/template/.agents/skills/code/improve/SKILL.md +0 -122
  15. package/template/.agents/skills/code/improve/references/audit-playbook.md +0 -130
  16. package/template/.agents/skills/code/improve/references/closing-the-loop.md +0 -96
  17. package/template/.agents/skills/code/improve/references/plan-template.md +0 -197
  18. package/template/.agents/skills/code/vercel-react-best-practices/AGENTS.md +0 -3810
  19. package/template/.agents/skills/code/vercel-react-best-practices/README.md +0 -123
  20. package/template/.agents/skills/code/vercel-react-best-practices/SKILL.md +0 -149
  21. package/template/.agents/skills/code/vercel-react-best-practices/metadata.json +0 -15
  22. package/template/.agents/skills/code/vercel-react-best-practices/rules/_sections.md +0 -46
  23. package/template/.agents/skills/code/vercel-react-best-practices/rules/_template.md +0 -28
  24. package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-effect-event-deps.md +0 -56
  25. package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-event-handler-refs.md +0 -55
  26. package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-init-once.md +0 -42
  27. package/template/.agents/skills/code/vercel-react-best-practices/rules/advanced-use-latest.md +0 -39
  28. package/template/.agents/skills/code/vercel-react-best-practices/rules/async-api-routes.md +0 -38
  29. package/template/.agents/skills/code/vercel-react-best-practices/rules/async-cheap-condition-before-await.md +0 -37
  30. package/template/.agents/skills/code/vercel-react-best-practices/rules/async-defer-await.md +0 -82
  31. package/template/.agents/skills/code/vercel-react-best-practices/rules/async-dependencies.md +0 -51
  32. package/template/.agents/skills/code/vercel-react-best-practices/rules/async-parallel.md +0 -28
  33. package/template/.agents/skills/code/vercel-react-best-practices/rules/async-suspense-boundaries.md +0 -99
  34. package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-analyzable-paths.md +0 -63
  35. package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-barrel-imports.md +0 -60
  36. package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-conditional.md +0 -31
  37. package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-defer-third-party.md +0 -49
  38. package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-dynamic-imports.md +0 -35
  39. package/template/.agents/skills/code/vercel-react-best-practices/rules/bundle-preload.md +0 -50
  40. package/template/.agents/skills/code/vercel-react-best-practices/rules/client-event-listeners.md +0 -74
  41. package/template/.agents/skills/code/vercel-react-best-practices/rules/client-localstorage-schema.md +0 -71
  42. package/template/.agents/skills/code/vercel-react-best-practices/rules/client-passive-event-listeners.md +0 -48
  43. package/template/.agents/skills/code/vercel-react-best-practices/rules/client-swr-dedup.md +0 -56
  44. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-batch-dom-css.md +0 -107
  45. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-cache-function-results.md +0 -80
  46. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-cache-property-access.md +0 -28
  47. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-cache-storage.md +0 -70
  48. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-combine-iterations.md +0 -32
  49. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-early-exit.md +0 -50
  50. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-flatmap-filter.md +0 -60
  51. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-hoist-regexp.md +0 -45
  52. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-index-maps.md +0 -37
  53. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-length-check-first.md +0 -49
  54. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-min-max-loop.md +0 -82
  55. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-request-idle-callback.md +0 -105
  56. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-set-map-lookups.md +0 -24
  57. package/template/.agents/skills/code/vercel-react-best-practices/rules/js-tosorted-immutable.md +0 -57
  58. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-activity.md +0 -26
  59. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-animate-svg-wrapper.md +0 -47
  60. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-conditional-render.md +0 -40
  61. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-content-visibility.md +0 -38
  62. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-hoist-jsx.md +0 -46
  63. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-hydration-no-flicker.md +0 -82
  64. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-hydration-suppress-warning.md +0 -30
  65. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-resource-hints.md +0 -85
  66. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-script-defer-async.md +0 -68
  67. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-svg-precision.md +0 -28
  68. package/template/.agents/skills/code/vercel-react-best-practices/rules/rendering-usetransition-loading.md +0 -75
  69. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-defer-reads.md +0 -39
  70. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-dependencies.md +0 -45
  71. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-derived-state-no-effect.md +0 -40
  72. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-derived-state.md +0 -29
  73. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-functional-setstate.md +0 -74
  74. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-lazy-state-init.md +0 -58
  75. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-memo-with-default-value.md +0 -38
  76. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-memo.md +0 -44
  77. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-move-effect-to-event.md +0 -45
  78. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-no-inline-components.md +0 -82
  79. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-simple-expression-in-memo.md +0 -35
  80. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-split-combined-hooks.md +0 -64
  81. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-transitions.md +0 -40
  82. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-use-deferred-value.md +0 -59
  83. package/template/.agents/skills/code/vercel-react-best-practices/rules/rerender-use-ref-transient-values.md +0 -73
  84. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-after-nonblocking.md +0 -73
  85. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-auth-actions.md +0 -96
  86. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-cache-lru.md +0 -41
  87. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-cache-react.md +0 -76
  88. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-dedup-props.md +0 -65
  89. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-hoist-static-io.md +0 -149
  90. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-no-shared-module-state.md +0 -50
  91. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-parallel-fetching.md +0 -83
  92. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-parallel-nested-fetching.md +0 -34
  93. package/template/.agents/skills/code/vercel-react-best-practices/rules/server-serialization.md +0 -38
  94. package/template/.agents/skills/data/prisma-cli/SKILL.md +0 -247
  95. package/template/.agents/skills/data/prisma-cli/references/db-execute.md +0 -78
  96. package/template/.agents/skills/data/prisma-cli/references/db-pull.md +0 -185
  97. package/template/.agents/skills/data/prisma-cli/references/db-push.md +0 -148
  98. package/template/.agents/skills/data/prisma-cli/references/db-seed.md +0 -188
  99. package/template/.agents/skills/data/prisma-cli/references/debug.md +0 -46
  100. package/template/.agents/skills/data/prisma-cli/references/dev.md +0 -157
  101. package/template/.agents/skills/data/prisma-cli/references/format.md +0 -48
  102. package/template/.agents/skills/data/prisma-cli/references/generate.md +0 -173
  103. package/template/.agents/skills/data/prisma-cli/references/init.md +0 -136
  104. package/template/.agents/skills/data/prisma-cli/references/mcp.md +0 -38
  105. package/template/.agents/skills/data/prisma-cli/references/migrate-deploy.md +0 -127
  106. package/template/.agents/skills/data/prisma-cli/references/migrate-dev.md +0 -145
  107. package/template/.agents/skills/data/prisma-cli/references/migrate-diff.md +0 -89
  108. package/template/.agents/skills/data/prisma-cli/references/migrate-reset.md +0 -78
  109. package/template/.agents/skills/data/prisma-cli/references/migrate-resolve.md +0 -57
  110. package/template/.agents/skills/data/prisma-cli/references/migrate-status.md +0 -65
  111. package/template/.agents/skills/data/prisma-cli/references/studio.md +0 -137
  112. package/template/.agents/skills/data/prisma-cli/references/validate.md +0 -53
  113. package/template/.agents/skills/data/prisma-client-api/SKILL.md +0 -216
  114. package/template/.agents/skills/data/prisma-client-api/references/client-methods.md +0 -223
  115. package/template/.agents/skills/data/prisma-client-api/references/constructor.md +0 -208
  116. package/template/.agents/skills/data/prisma-client-api/references/filters.md +0 -256
  117. package/template/.agents/skills/data/prisma-client-api/references/model-queries.md +0 -281
  118. package/template/.agents/skills/data/prisma-client-api/references/query-options.md +0 -276
  119. package/template/.agents/skills/data/prisma-client-api/references/raw-queries.md +0 -194
  120. package/template/.agents/skills/data/prisma-client-api/references/relations.md +0 -308
  121. package/template/.agents/skills/data/prisma-client-api/references/transactions.md +0 -184
  122. package/template/.agents/skills/design/impeccable/SKILL.md +0 -84
  123. package/template/.agents/skills/design/impeccable/reference/adapt.md +0 -312
  124. package/template/.agents/skills/design/impeccable/reference/adapt.native.md +0 -58
  125. package/template/.agents/skills/design/impeccable/reference/android.md +0 -40
  126. package/template/.agents/skills/design/impeccable/reference/animate.md +0 -86
  127. package/template/.agents/skills/design/impeccable/reference/audit.md +0 -136
  128. package/template/.agents/skills/design/impeccable/reference/audit.native.md +0 -139
  129. package/template/.agents/skills/design/impeccable/reference/bolder.md +0 -31
  130. package/template/.agents/skills/design/impeccable/reference/clarify.md +0 -94
  131. package/template/.agents/skills/design/impeccable/reference/colorize.md +0 -86
  132. package/template/.agents/skills/design/impeccable/reference/craft-floor.md +0 -42
  133. package/template/.agents/skills/design/impeccable/reference/craft.md +0 -5
  134. package/template/.agents/skills/design/impeccable/reference/critique.md +0 -788
  135. package/template/.agents/skills/design/impeccable/reference/degraded/asset-producer.md +0 -90
  136. package/template/.agents/skills/design/impeccable/reference/degraded/documenter.md +0 -24
  137. package/template/.agents/skills/design/impeccable/reference/degraded/finish-reviewer.md +0 -37
  138. package/template/.agents/skills/design/impeccable/reference/degraded/manual-edit-applier.md +0 -92
  139. package/template/.agents/skills/design/impeccable/reference/delight.md +0 -70
  140. package/template/.agents/skills/design/impeccable/reference/distill.md +0 -111
  141. package/template/.agents/skills/design/impeccable/reference/doctor.md +0 -53
  142. package/template/.agents/skills/design/impeccable/reference/document.md +0 -416
  143. package/template/.agents/skills/design/impeccable/reference/extract.md +0 -69
  144. package/template/.agents/skills/design/impeccable/reference/harden.md +0 -336
  145. package/template/.agents/skills/design/impeccable/reference/hooks.md +0 -105
  146. package/template/.agents/skills/design/impeccable/reference/init.md +0 -125
  147. package/template/.agents/skills/design/impeccable/reference/ios.md +0 -45
  148. package/template/.agents/skills/design/impeccable/reference/layout.md +0 -84
  149. package/template/.agents/skills/design/impeccable/reference/live-setup.md +0 -102
  150. package/template/.agents/skills/design/impeccable/reference/live.md +0 -323
  151. package/template/.agents/skills/design/impeccable/reference/new-work.md +0 -105
  152. package/template/.agents/skills/design/impeccable/reference/onboard.md +0 -234
  153. package/template/.agents/skills/design/impeccable/reference/operate.md +0 -61
  154. package/template/.agents/skills/design/impeccable/reference/optimize.md +0 -258
  155. package/template/.agents/skills/design/impeccable/reference/overdrive.md +0 -127
  156. package/template/.agents/skills/design/impeccable/reference/polish.md +0 -97
  157. package/template/.agents/skills/design/impeccable/reference/quieter.md +0 -99
  158. package/template/.agents/skills/design/impeccable/reference/routing.md +0 -18
  159. package/template/.agents/skills/design/impeccable/reference/shape.md +0 -59
  160. package/template/.agents/skills/design/impeccable/reference/typeset.md +0 -80
  161. package/template/.agents/skills/design/impeccable/reference/visualize.md +0 -47
  162. package/template/.agents/skills/design/impeccable/scripts/command-metadata.json +0 -94
  163. package/template/.agents/skills/design/impeccable/scripts/concept-seed.mjs +0 -558
  164. package/template/.agents/skills/design/impeccable/scripts/context-signals.mjs +0 -334
  165. package/template/.agents/skills/design/impeccable/scripts/context.mjs +0 -1450
  166. package/template/.agents/skills/design/impeccable/scripts/critique-storage.mjs +0 -213
  167. package/template/.agents/skills/design/impeccable/scripts/detect-csp.mjs +0 -198
  168. package/template/.agents/skills/design/impeccable/scripts/detect.mjs +0 -21
  169. package/template/.agents/skills/design/impeccable/scripts/detector/browser/injected/index.mjs +0 -2023
  170. package/template/.agents/skills/design/impeccable/scripts/detector/cli/main.mjs +0 -438
  171. package/template/.agents/skills/design/impeccable/scripts/detector/design-system.mjs +0 -983
  172. package/template/.agents/skills/design/impeccable/scripts/detector/detect-antipatterns-browser.js +0 -8283
  173. package/template/.agents/skills/design/impeccable/scripts/detector/detect-antipatterns.mjs +0 -50
  174. package/template/.agents/skills/design/impeccable/scripts/detector/engines/browser/detect-url.mjs +0 -372
  175. package/template/.agents/skills/design/impeccable/scripts/detector/engines/regex/detect-text.mjs +0 -768
  176. package/template/.agents/skills/design/impeccable/scripts/detector/engines/static-html/css-cascade.mjs +0 -1186
  177. package/template/.agents/skills/design/impeccable/scripts/detector/engines/static-html/detect-html.mjs +0 -264
  178. package/template/.agents/skills/design/impeccable/scripts/detector/engines/visual/screenshot-contrast.mjs +0 -189
  179. package/template/.agents/skills/design/impeccable/scripts/detector/findings.mjs +0 -18
  180. package/template/.agents/skills/design/impeccable/scripts/detector/node/file-system.mjs +0 -212
  181. package/template/.agents/skills/design/impeccable/scripts/detector/profile/profiler.mjs +0 -166
  182. package/template/.agents/skills/design/impeccable/scripts/detector/registry/antipatterns.mjs +0 -617
  183. package/template/.agents/skills/design/impeccable/scripts/detector/rules/checks.mjs +0 -5580
  184. package/template/.agents/skills/design/impeccable/scripts/detector/shared/color.mjs +0 -124
  185. package/template/.agents/skills/design/impeccable/scripts/detector/shared/constants.mjs +0 -112
  186. package/template/.agents/skills/design/impeccable/scripts/detector/shared/fonts.mjs +0 -30
  187. package/template/.agents/skills/design/impeccable/scripts/detector/shared/inline-ignores.mjs +0 -148
  188. package/template/.agents/skills/design/impeccable/scripts/detector/shared/page.mjs +0 -7
  189. package/template/.agents/skills/design/impeccable/scripts/doctor.mjs +0 -336
  190. package/template/.agents/skills/design/impeccable/scripts/embed-prompt.mjs +0 -133
  191. package/template/.agents/skills/design/impeccable/scripts/generate-image.mjs +0 -240
  192. package/template/.agents/skills/design/impeccable/scripts/hook-admin.mjs +0 -741
  193. package/template/.agents/skills/design/impeccable/scripts/hook-before-edit.mjs +0 -516
  194. package/template/.agents/skills/design/impeccable/scripts/hook-lib.mjs +0 -2100
  195. package/template/.agents/skills/design/impeccable/scripts/hook.mjs +0 -78
  196. package/template/.agents/skills/design/impeccable/scripts/lib/artifact-schema.mjs +0 -93
  197. package/template/.agents/skills/design/impeccable/scripts/lib/composition-catalog.mjs +0 -200
  198. package/template/.agents/skills/design/impeccable/scripts/lib/concept-catalog.mjs +0 -357
  199. package/template/.agents/skills/design/impeccable/scripts/lib/design-parser.mjs +0 -842
  200. package/template/.agents/skills/design/impeccable/scripts/lib/impeccable-config.mjs +0 -658
  201. package/template/.agents/skills/design/impeccable/scripts/lib/impeccable-paths.mjs +0 -137
  202. package/template/.agents/skills/design/impeccable/scripts/lib/is-generated.mjs +0 -69
  203. package/template/.agents/skills/design/impeccable/scripts/lib/provider.mjs +0 -5
  204. package/template/.agents/skills/design/impeccable/scripts/lib/roll-selection.mjs +0 -362
  205. package/template/.agents/skills/design/impeccable/scripts/lib/staleness-deep.mjs +0 -457
  206. package/template/.agents/skills/design/impeccable/scripts/lib/staleness-notice.mjs +0 -169
  207. package/template/.agents/skills/design/impeccable/scripts/lib/staleness.mjs +0 -457
  208. package/template/.agents/skills/design/impeccable/scripts/lib/surface-briefs.mjs +0 -151
  209. package/template/.agents/skills/design/impeccable/scripts/lib/target-args.mjs +0 -42
  210. package/template/.agents/skills/design/impeccable/scripts/lib/target-slug.mjs +0 -33
  211. package/template/.agents/skills/design/impeccable/scripts/lib/template-extensions.mjs +0 -146
  212. package/template/.agents/skills/design/impeccable/scripts/live/accept-css.mjs +0 -617
  213. package/template/.agents/skills/design/impeccable/scripts/live/accept-verify.mjs +0 -60
  214. package/template/.agents/skills/design/impeccable/scripts/live/browser-script-parts.mjs +0 -55
  215. package/template/.agents/skills/design/impeccable/scripts/live/completion.mjs +0 -28
  216. package/template/.agents/skills/design/impeccable/scripts/live/event-validation.mjs +0 -199
  217. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/astro.mjs +0 -47
  218. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/detect-utils.mjs +0 -73
  219. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/index.mjs +0 -143
  220. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/journal.mjs +0 -197
  221. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/nextjs.mjs +0 -49
  222. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/nuxt.mjs +0 -161
  223. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/script-src.mjs +0 -17
  224. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/static-html.mjs +0 -26
  225. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/sveltekit.mjs +0 -71
  226. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/tag-strategy.mjs +0 -247
  227. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/tanstack-start.mjs +0 -70
  228. package/template/.agents/skills/design/impeccable/scripts/live/frameworks/vite-generic.mjs +0 -42
  229. package/template/.agents/skills/design/impeccable/scripts/live/generation-preflight.mjs +0 -149
  230. package/template/.agents/skills/design/impeccable/scripts/live/insert-ui.mjs +0 -458
  231. package/template/.agents/skills/design/impeccable/scripts/live/instructions.mjs +0 -142
  232. package/template/.agents/skills/design/impeccable/scripts/live/manual-apply.mjs +0 -939
  233. package/template/.agents/skills/design/impeccable/scripts/live/manual-edit-routes.mjs +0 -357
  234. package/template/.agents/skills/design/impeccable/scripts/live/manual-edits-buffer.mjs +0 -152
  235. package/template/.agents/skills/design/impeccable/scripts/live/poll-lanes.mjs +0 -14
  236. package/template/.agents/skills/design/impeccable/scripts/live/roots.mjs +0 -508
  237. package/template/.agents/skills/design/impeccable/scripts/live/session-store.mjs +0 -563
  238. package/template/.agents/skills/design/impeccable/scripts/live/source-lock.mjs +0 -105
  239. package/template/.agents/skills/design/impeccable/scripts/live/source-search.mjs +0 -105
  240. package/template/.agents/skills/design/impeccable/scripts/live/svelte-ast.mjs +0 -961
  241. package/template/.agents/skills/design/impeccable/scripts/live/svelte-component.mjs +0 -1342
  242. package/template/.agents/skills/design/impeccable/scripts/live/sveltekit-adapter.mjs +0 -316
  243. package/template/.agents/skills/design/impeccable/scripts/live/tanstack-adapter.mjs +0 -280
  244. package/template/.agents/skills/design/impeccable/scripts/live/ui-core.mjs +0 -180
  245. package/template/.agents/skills/design/impeccable/scripts/live/vocabulary.mjs +0 -171
  246. package/template/.agents/skills/design/impeccable/scripts/live-accept.mjs +0 -954
  247. package/template/.agents/skills/design/impeccable/scripts/live-browser-dom.js +0 -146
  248. package/template/.agents/skills/design/impeccable/scripts/live-browser-session.js +0 -123
  249. package/template/.agents/skills/design/impeccable/scripts/live-browser.js +0 -12512
  250. package/template/.agents/skills/design/impeccable/scripts/live-commit-manual-edits.mjs +0 -1244
  251. package/template/.agents/skills/design/impeccable/scripts/live-complete.mjs +0 -107
  252. package/template/.agents/skills/design/impeccable/scripts/live-copy-edit-agent.mjs +0 -683
  253. package/template/.agents/skills/design/impeccable/scripts/live-discard-manual-edits.mjs +0 -51
  254. package/template/.agents/skills/design/impeccable/scripts/live-inject.mjs +0 -503
  255. package/template/.agents/skills/design/impeccable/scripts/live-insert.mjs +0 -292
  256. package/template/.agents/skills/design/impeccable/scripts/live-manual-edit-evidence.mjs +0 -368
  257. package/template/.agents/skills/design/impeccable/scripts/live-poll.mjs +0 -429
  258. package/template/.agents/skills/design/impeccable/scripts/live-resume.mjs +0 -123
  259. package/template/.agents/skills/design/impeccable/scripts/live-server.mjs +0 -1661
  260. package/template/.agents/skills/design/impeccable/scripts/live-status.mjs +0 -71
  261. package/template/.agents/skills/design/impeccable/scripts/live-target.mjs +0 -30
  262. package/template/.agents/skills/design/impeccable/scripts/live-wrap.mjs +0 -927
  263. package/template/.agents/skills/design/impeccable/scripts/live.mjs +0 -359
  264. package/template/.agents/skills/design/impeccable/scripts/modern-screenshot.umd.js +0 -14
  265. package/template/.agents/skills/design/impeccable/scripts/palette.mjs +0 -628
  266. package/template/.agents/skills/design/impeccable/scripts/pin.mjs +0 -221
  267. package/template/.agents/skills/design/impeccable/scripts/serve-question.mjs +0 -932
  268. package/template/.agents/skills/design/impeccable/scripts/surface-brief.mjs +0 -74
  269. package/template/.agents/skills/design/shadcn/SKILL.md +0 -277
  270. package/template/.agents/skills/design/shadcn/agents/openai.yml +0 -5
  271. package/template/.agents/skills/design/shadcn/assets/shadcn-small.png +0 -0
  272. package/template/.agents/skills/design/shadcn/assets/shadcn.png +0 -0
  273. package/template/.agents/skills/design/shadcn/cli.md +0 -290
  274. package/template/.agents/skills/design/shadcn/customization.md +0 -209
  275. package/template/.agents/skills/design/shadcn/evals/evals.json +0 -77
  276. package/template/.agents/skills/design/shadcn/mcp.md +0 -105
  277. package/template/.agents/skills/design/shadcn/registry.md +0 -277
  278. package/template/.agents/skills/design/shadcn/rules/base-vs-radix.md +0 -306
  279. package/template/.agents/skills/design/shadcn/rules/chat.md +0 -224
  280. package/template/.agents/skills/design/shadcn/rules/composition.md +0 -213
  281. package/template/.agents/skills/design/shadcn/rules/forms.md +0 -192
  282. package/template/.agents/skills/design/shadcn/rules/icons.md +0 -101
  283. package/template/.agents/skills/design/shadcn/rules/styling.md +0 -185
  284. package/template/.agents/skills/find-skills/SKILL.md +0 -141
  285. package/template/.agents/skills/hono/SKILL.md +0 -579
  286. package/template/.agents/skills/integrations/langfuse/SKILL.md +0 -146
  287. package/template/.agents/skills/integrations/langfuse/references/ci-cd.md +0 -41
  288. package/template/.agents/skills/integrations/langfuse/references/cli.md +0 -60
  289. package/template/.agents/skills/integrations/langfuse/references/error-analysis.md +0 -88
  290. package/template/.agents/skills/integrations/langfuse/references/instrumentation.md +0 -121
  291. package/template/.agents/skills/integrations/langfuse/references/judge-calibration.md +0 -291
  292. package/template/.agents/skills/integrations/langfuse/references/prompt-engineering.md +0 -35
  293. package/template/.agents/skills/integrations/langfuse/references/prompt-migration.md +0 -79
  294. package/template/.agents/skills/integrations/langfuse/references/skill-feedback.md +0 -55
  295. package/template/.agents/skills/integrations/langfuse/references/trace-evaluator-upgrade.md +0 -76
  296. package/template/.agents/skills/integrations/langfuse/references/user-feedback.md +0 -92
  297. package/template/.agents/skills/integrations/langfuse/references/v4-project-migration.md +0 -73
  298. package/template/.agents/skills/integrations/posthog/SKILL.md +0 -102
  299. package/template/.agents/skills/integrations/posthog/references/error-tracking-alerts.md +0 -63
  300. package/template/.agents/skills/integrations/posthog/references/error-tracking-assigning-issues.md +0 -77
  301. package/template/.agents/skills/integrations/posthog/references/error-tracking-fingerprints.md +0 -57
  302. package/template/.agents/skills/integrations/posthog/references/error-tracking-monitoring.md +0 -140
  303. package/template/.agents/skills/integrations/posthog/references/error-tracking-nextjs.md +0 -490
  304. package/template/.agents/skills/integrations/posthog/references/error-tracking-source-maps.md +0 -45
  305. package/template/.agents/skills/integrations/posthog/references/feature-flags-best-practices.md +0 -139
  306. package/template/.agents/skills/integrations/posthog/references/feature-flags-react.md +0 -302
  307. package/template/.agents/skills/integrations/posthog/references/identify-users.md +0 -202
  308. package/template/.agents/skills/integrations/posthog/references/integration-example.md +0 -706
  309. package/template/.agents/skills/integrations/posthog/references/integration-nextjs.md +0 -385
  310. package/template/.agents/skills/integrations/posthog/references/integration-step-1-begin.md +0 -43
  311. package/template/.agents/skills/integrations/posthog/references/integration-step-2-edit.md +0 -37
  312. package/template/.agents/skills/integrations/posthog/references/integration-step-3-revise.md +0 -22
  313. package/template/.agents/skills/integrations/posthog/references/integration-step-4-conclude.md +0 -38
  314. package/template/.agents/skills/integrations/posthog/references/llm-analytics-anthropic.md +0 -200
  315. package/template/.agents/skills/integrations/posthog/references/llm-analytics-basics.md +0 -62
  316. package/template/.agents/skills/integrations/posthog/references/llm-analytics-costs.md +0 -197
  317. package/template/.agents/skills/integrations/posthog/references/llm-analytics-manual-capture.md +0 -397
  318. package/template/.agents/skills/integrations/posthog/references/llm-analytics-traces.md +0 -98
  319. package/template/.agents/skills/integrations/posthog/references/llm-analytics-vercel-ai.md +0 -120
  320. package/template/.agents/skills/repo/repo-ci/SKILL.md +0 -265
  321. package/template/.agents/skills/repo/repo-init-next-js/SKILL.md +0 -129
  322. package/template/.agents/skills/repo/repo-init-next-js/references/file-contents.md +0 -800
  323. package/template/.agents/skills/repo/repo-init-next-js/scripts/setup.sh +0 -47
  324. package/template/.agents/skills/repo/repo-init-node/SKILL.md +0 -196
  325. package/template/.agents/skills/skill-creator/LICENSE.txt +0 -202
  326. package/template/.agents/skills/skill-creator/SKILL.md +0 -485
  327. package/template/.agents/skills/skill-creator/agents/analyzer.md +0 -274
  328. package/template/.agents/skills/skill-creator/agents/comparator.md +0 -202
  329. package/template/.agents/skills/skill-creator/agents/grader.md +0 -223
  330. package/template/.agents/skills/skill-creator/assets/eval_review.html +0 -146
  331. package/template/.agents/skills/skill-creator/eval-viewer/generate_review.py +0 -471
  332. package/template/.agents/skills/skill-creator/eval-viewer/viewer.html +0 -1325
  333. package/template/.agents/skills/skill-creator/references/schemas.md +0 -430
  334. package/template/.agents/skills/skill-creator/scripts/__init__.py +0 -0
  335. package/template/.agents/skills/skill-creator/scripts/aggregate_benchmark.py +0 -401
  336. package/template/.agents/skills/skill-creator/scripts/generate_report.py +0 -326
  337. package/template/.agents/skills/skill-creator/scripts/improve_description.py +0 -247
  338. package/template/.agents/skills/skill-creator/scripts/package_skill.py +0 -136
  339. package/template/.agents/skills/skill-creator/scripts/quick_validate.py +0 -103
  340. package/template/.agents/skills/skill-creator/scripts/run_eval.py +0 -310
  341. package/template/.agents/skills/skill-creator/scripts/run_loop.py +0 -328
  342. package/template/.agents/skills/skill-creator/scripts/utils.py +0 -47
  343. package/template/.agents/skills/supabase/CHANGELOG.md +0 -71
  344. package/template/.agents/skills/supabase/SKILL.md +0 -145
  345. package/template/.agents/skills/supabase/assets/feedback-issue-template.md +0 -17
  346. package/template/.agents/skills/supabase/references/skill-feedback.md +0 -17
  347. package/template/.agents/skills/supabase-postgres-best-practices/CHANGELOG.md +0 -73
  348. package/template/.agents/skills/supabase-postgres-best-practices/SKILL.md +0 -64
  349. package/template/.agents/skills/supabase-postgres-best-practices/references/_contributing.md +0 -170
  350. package/template/.agents/skills/supabase-postgres-best-practices/references/_sections.md +0 -39
  351. package/template/.agents/skills/supabase-postgres-best-practices/references/_template.md +0 -34
  352. package/template/.agents/skills/supabase-postgres-best-practices/references/advanced-full-text-search.md +0 -55
  353. package/template/.agents/skills/supabase-postgres-best-practices/references/advanced-jsonb-indexing.md +0 -49
  354. package/template/.agents/skills/supabase-postgres-best-practices/references/conn-idle-timeout.md +0 -46
  355. package/template/.agents/skills/supabase-postgres-best-practices/references/conn-limits.md +0 -44
  356. package/template/.agents/skills/supabase-postgres-best-practices/references/conn-pooling.md +0 -41
  357. package/template/.agents/skills/supabase-postgres-best-practices/references/conn-prepared-statements.md +0 -46
  358. package/template/.agents/skills/supabase-postgres-best-practices/references/data-batch-inserts.md +0 -54
  359. package/template/.agents/skills/supabase-postgres-best-practices/references/data-n-plus-one.md +0 -53
  360. package/template/.agents/skills/supabase-postgres-best-practices/references/data-pagination.md +0 -50
  361. package/template/.agents/skills/supabase-postgres-best-practices/references/data-upsert.md +0 -50
  362. package/template/.agents/skills/supabase-postgres-best-practices/references/lock-advisory.md +0 -56
  363. package/template/.agents/skills/supabase-postgres-best-practices/references/lock-deadlock-prevention.md +0 -68
  364. package/template/.agents/skills/supabase-postgres-best-practices/references/lock-short-transactions.md +0 -50
  365. package/template/.agents/skills/supabase-postgres-best-practices/references/lock-skip-locked.md +0 -54
  366. package/template/.agents/skills/supabase-postgres-best-practices/references/monitor-explain-analyze.md +0 -45
  367. package/template/.agents/skills/supabase-postgres-best-practices/references/monitor-pg-stat-statements.md +0 -55
  368. package/template/.agents/skills/supabase-postgres-best-practices/references/monitor-vacuum-analyze.md +0 -55
  369. package/template/.agents/skills/supabase-postgres-best-practices/references/query-composite-indexes.md +0 -44
  370. package/template/.agents/skills/supabase-postgres-best-practices/references/query-covering-indexes.md +0 -40
  371. package/template/.agents/skills/supabase-postgres-best-practices/references/query-index-types.md +0 -48
  372. package/template/.agents/skills/supabase-postgres-best-practices/references/query-missing-indexes.md +0 -43
  373. package/template/.agents/skills/supabase-postgres-best-practices/references/query-partial-indexes.md +0 -45
  374. package/template/.agents/skills/supabase-postgres-best-practices/references/schema-constraints.md +0 -80
  375. package/template/.agents/skills/supabase-postgres-best-practices/references/schema-data-types.md +0 -46
  376. package/template/.agents/skills/supabase-postgres-best-practices/references/schema-foreign-key-indexes.md +0 -59
  377. package/template/.agents/skills/supabase-postgres-best-practices/references/schema-lowercase-identifiers.md +0 -55
  378. package/template/.agents/skills/supabase-postgres-best-practices/references/schema-partitioning.md +0 -55
  379. package/template/.agents/skills/supabase-postgres-best-practices/references/schema-primary-keys.md +0 -61
  380. package/template/.agents/skills/supabase-postgres-best-practices/references/security-privileges.md +0 -54
  381. package/template/.agents/skills/supabase-postgres-best-practices/references/security-rls-basics.md +0 -50
  382. package/template/.agents/skills/supabase-postgres-best-practices/references/security-rls-performance.md +0 -63
  383. package/template/.agents/skills/writing/humanizer/SKILL.md +0 -621
  384. package/template/.agents/upstreams.json +0 -116
@@ -1,983 +0,0 @@
1
- import fs from 'node:fs';
2
- import os from 'node:os';
3
- import path from 'node:path';
4
-
5
- import { finding } from './findings.mjs';
6
- import { GENERIC_FONTS } from './shared/constants.mjs';
7
- import { parseAnyColor, resolveLengthPx } from './rules/checks.mjs';
8
-
9
- const DESIGN_NAMES = ['DESIGN.md', 'Design.md', 'design.md'];
10
- const FALLBACK_DIRS = ['.agents/context', 'docs'];
11
- // Files/dirs whose presence marks a directory as a project root. Mirrors the
12
- // walk-up semantics of skill/scripts/context.mjs (`resolveProject`), which the
13
- // CLI can't import (separate tree). `.git` and `package.json` are the common
14
- // boundaries; `.impeccable` is our own project marker.
15
- const PROJECT_ROOT_MARKERS = ['.git', 'package.json', '.impeccable'];
16
- const COLOR_CHANNEL_TOLERANCE = 6;
17
- const RADIUS_TOLERANCE_PX = 0.5;
18
- const FONT_SIZE_TOLERANCE_PX = 0.5;
19
- const FONT_SIZE_LITERAL_RE = /^-?[\d.]+(?:px|rem)$/;
20
-
21
- const CSS_COLOR_RE = /#[0-9a-f]{3,8}\b|rgba?\([^)]+\)|oklch\([^)]+\)|hsla?\([^)]+\)/gi;
22
- const FONT_DECL_RE = /font-family\s*:\s*([^;}\n]+)/gi;
23
- const FONT_JS_RE = /fontFamily\s*[:=]\s*["'`]([^"'`]+)["'`]/g;
24
- const GOOGLE_FONT_RE = /fonts\.googleapis\.com\/css2?\?[^"'\s)<>]*/gi;
25
- const BORDER_RADIUS_RE = /border-radius\s*:\s*([^;}\n]+)/gi;
26
- const BORDER_RADIUS_JS_RE = /borderRadius\s*[:=]\s*["'`]([^"'`]+)["'`]/g;
27
- const FONT_SIZE_DECL_RE = /font-size\s*:\s*([^;}\n]+)/gi;
28
- const FONT_SIZE_JS_RE = /fontSize\s*[:=]\s*["'`]([^"'`]+)["'`]/g;
29
- const TAILWIND_FONT_SIZE_RE = /\btext-\[(-?[\d.]+(?:px|rem))\]/g;
30
- const STATIC_DESIGN_SKIP_TAGS = new Set(['head', 'title', 'meta', 'link', 'style', 'script', 'noscript', 'template', 'source']);
31
-
32
- function firstExisting(dir, names) {
33
- for (const name of names) {
34
- const abs = path.join(dir, name);
35
- if (fs.existsSync(abs)) return abs;
36
- }
37
- return null;
38
- }
39
-
40
- function resolveDesignMdPath(cwd = process.cwd()) {
41
- const root = firstExisting(cwd, DESIGN_NAMES);
42
- if (root) return { path: root, contextDir: cwd };
43
-
44
- for (const rel of FALLBACK_DIRS) {
45
- const dir = path.resolve(cwd, rel);
46
- const found = firstExisting(dir, DESIGN_NAMES);
47
- if (found) return { path: found, contextDir: dir };
48
- }
49
-
50
- return null;
51
- }
52
-
53
- function resolveDesignSidecarPath(cwd = process.cwd(), contextDir = cwd) {
54
- const candidates = [
55
- path.join(cwd, '.impeccable', 'design.json'),
56
- path.join(cwd, 'DESIGN.json'),
57
- path.join(contextDir, 'DESIGN.json'),
58
- ];
59
- return candidates.find((candidate, index) =>
60
- candidates.indexOf(candidate) === index && fs.existsSync(candidate)
61
- ) || null;
62
- }
63
-
64
- function parseFrontmatter(md) {
65
- const lines = String(md || '').split(/\r?\n/);
66
- if (lines[0]?.trim() !== '---') return null;
67
- let end = -1;
68
- for (let i = 1; i < lines.length; i++) {
69
- if (lines[i].trim() === '---') { end = i; break; }
70
- }
71
- if (end === -1) return null;
72
- try {
73
- return parseYamlSubset(lines.slice(1, end).join('\n'));
74
- } catch {
75
- return null;
76
- }
77
- }
78
-
79
- function parseYamlSubset(yaml) {
80
- const root = {};
81
- const stack = [{ indent: -1, obj: root }];
82
-
83
- for (const raw of String(yaml || '').split(/\r?\n/)) {
84
- if (!raw.trim() || /^\s*#/.test(raw)) continue;
85
- const indent = raw.match(/^\s*/)[0].length;
86
- const content = raw.slice(indent);
87
- const colonIdx = findTopLevelColon(content);
88
- if (colonIdx === -1) continue;
89
-
90
- while (stack.length > 1 && stack[stack.length - 1].indent >= indent) stack.pop();
91
-
92
- const key = unquoteYamlKey(content.slice(0, colonIdx).trim());
93
- const rest = stripInlineYamlComment(content.slice(colonIdx + 1).trim());
94
- const parent = stack[stack.length - 1].obj;
95
-
96
- if (rest === '') {
97
- const obj = {};
98
- parent[key] = obj;
99
- stack.push({ indent, obj });
100
- } else {
101
- parent[key] = parseScalar(rest);
102
- }
103
- }
104
-
105
- return root;
106
- }
107
-
108
- function findTopLevelColon(s) {
109
- let inQuote = null;
110
- for (let i = 0; i < s.length; i++) {
111
- const ch = s[i];
112
- if (inQuote) {
113
- if (ch === inQuote && s[i - 1] !== '\\') inQuote = null;
114
- } else if (ch === '"' || ch === "'") {
115
- inQuote = ch;
116
- } else if (ch === ':') {
117
- return i;
118
- }
119
- }
120
- return -1;
121
- }
122
-
123
- function unquoteYamlKey(key) {
124
- if ((key.startsWith('"') && key.endsWith('"')) || (key.startsWith("'") && key.endsWith("'"))) {
125
- return key.slice(1, -1);
126
- }
127
- return key;
128
- }
129
-
130
- function stripInlineYamlComment(s) {
131
- let inQuote = null;
132
- for (let i = 0; i < s.length; i++) {
133
- const ch = s[i];
134
- if (inQuote) {
135
- if (ch === inQuote && s[i - 1] !== '\\') inQuote = null;
136
- } else if (ch === '"' || ch === "'") {
137
- inQuote = ch;
138
- } else if (ch === '#' && i > 0 && /\s/.test(s[i - 1])) {
139
- return s.slice(0, i).trimEnd();
140
- }
141
- }
142
- return s;
143
- }
144
-
145
- function parseScalar(raw) {
146
- const s = raw.trim();
147
- if ((s.startsWith('"') && s.endsWith('"')) || (s.startsWith("'") && s.endsWith("'"))) {
148
- return s.slice(1, -1);
149
- }
150
- if (s === 'true') return true;
151
- if (s === 'false') return false;
152
- if (s === 'null' || s === '~') return null;
153
- if (/^-?\d+$/.test(s)) return Number(s);
154
- if (/^-?\d*\.\d+$/.test(s)) return Number(s);
155
- return s;
156
- }
157
-
158
- function safeReadJson(filePath) {
159
- if (!filePath) return null;
160
- try {
161
- return JSON.parse(fs.readFileSync(filePath, 'utf-8'));
162
- } catch {
163
- return null;
164
- }
165
- }
166
-
167
- function normalizeFontName(value) {
168
- return String(value || '')
169
- .trim()
170
- .replace(/\s*!important\s*$/i, '')
171
- .trim()
172
- .replace(/^["']|["']$/g, '')
173
- .replace(/\+/g, ' ')
174
- .replace(/\s+/g, ' ')
175
- .toLowerCase();
176
- }
177
-
178
- function splitFontStack(stack) {
179
- return String(stack || '')
180
- .replace(/\s*!important\s*$/i, '')
181
- .split(',')
182
- .map(normalizeFontName)
183
- .filter(Boolean);
184
- }
185
-
186
- function primaryFont(stack) {
187
- if (!stack || /var\(/i.test(stack) || !isLiteralFontStack(stack)) return '';
188
- return splitFontStack(stack).find(font => !GENERIC_FONTS.has(font)) || '';
189
- }
190
-
191
- function isLiteralFontStack(stack) {
192
- const text = String(stack || '');
193
- return !/[$`{}]|\s\+\s|\|\|/.test(text);
194
- }
195
-
196
- function cssColorLabel(raw) {
197
- return String(raw || '').trim().replace(/\s+/g, ' ');
198
- }
199
-
200
- function colorKey(color) {
201
- if (!color) return '';
202
- return `${color.r},${color.g},${color.b}`;
203
- }
204
-
205
- function colorsClose(a, b) {
206
- if (!a || !b) return false;
207
- return Math.max(
208
- Math.abs(a.r - b.r),
209
- Math.abs(a.g - b.g),
210
- Math.abs(a.b - b.b),
211
- ) <= COLOR_CHANNEL_TOLERANCE;
212
- }
213
-
214
- function hslToRgb(H, S, L, alpha = 1) {
215
- const h = (((H % 360) + 360) % 360) / 360;
216
- const s = Math.max(0, Math.min(1, S));
217
- const l = Math.max(0, Math.min(1, L));
218
- const hue2rgb = (p, q, t) => {
219
- if (t < 0) t += 1;
220
- if (t > 1) t -= 1;
221
- if (t < 1 / 6) return p + (q - p) * 6 * t;
222
- if (t < 1 / 2) return q;
223
- if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
224
- return p;
225
- };
226
- const q = l < 0.5 ? l * (1 + s) : l + s - l * s;
227
- const p = 2 * l - q;
228
- return {
229
- r: Math.round(hue2rgb(p, q, h + 1 / 3) * 255),
230
- g: Math.round(hue2rgb(p, q, h) * 255),
231
- b: Math.round(hue2rgb(p, q, h - 1 / 3) * 255),
232
- a: alpha,
233
- };
234
- }
235
-
236
- function parseDesignColor(value) {
237
- const text = String(value || '').trim();
238
- const parsed = parseAnyColor(text);
239
- if (parsed) return parsed;
240
- const hsl = text.match(/hsla?\(\s*([-\d.]+)(?:deg)?\s*,?\s*([\d.]+)%\s*,?\s*([\d.]+)%(?:\s*[,/]\s*([\d.]+))?\s*\)/i);
241
- if (hsl) {
242
- return hslToRgb(
243
- parseFloat(hsl[1]),
244
- parseFloat(hsl[2]) / 100,
245
- parseFloat(hsl[3]) / 100,
246
- hsl[4] !== undefined ? parseFloat(hsl[4]) : 1,
247
- );
248
- }
249
- return null;
250
- }
251
-
252
- function addDesignColor(out, value, label) {
253
- const parsed = parseDesignColor(value);
254
- if (!parsed) return;
255
- const key = colorKey(parsed);
256
- if (!out.allowedColorKeys.has(key)) {
257
- out.allowedColorKeys.set(key, { color: parsed, labels: [] });
258
- }
259
- out.allowedColorKeys.get(key).labels.push(label || cssColorLabel(value));
260
- }
261
-
262
- function addColorObject(out, colors, prefix = 'colors') {
263
- if (!colors || typeof colors !== 'object') return;
264
- for (const [name, value] of Object.entries(colors)) {
265
- if (typeof value === 'string') {
266
- addDesignColor(out, value, `${prefix}.${name}`);
267
- }
268
- }
269
- }
270
-
271
- function addSidecarColors(out, sidecar) {
272
- const colorMeta = sidecar?.extensions?.colorMeta;
273
- if (!colorMeta || typeof colorMeta !== 'object') return;
274
-
275
- for (const [name, meta] of Object.entries(colorMeta)) {
276
- if (!meta || typeof meta !== 'object') continue;
277
- if (typeof meta.canonical === 'string') addDesignColor(out, meta.canonical, `sidecar.${name}`);
278
- if (Array.isArray(meta.tonalRamp)) {
279
- for (const [index, value] of meta.tonalRamp.entries()) {
280
- if (typeof value === 'string') addDesignColor(out, value, `sidecar.${name}.tonalRamp[${index}]`);
281
- }
282
- }
283
- }
284
- }
285
-
286
- function addTypographyFonts(out, typography) {
287
- if (!typography || typeof typography !== 'object') return;
288
- for (const role of Object.values(typography)) {
289
- if (!role || typeof role !== 'object') continue;
290
- if (typeof role.fontFamily !== 'string') continue;
291
- for (const font of splitFontStack(role.fontFamily)) {
292
- if (!GENERIC_FONTS.has(font)) out.allowedFonts.add(font);
293
- }
294
- }
295
- }
296
-
297
- function addFontSizeStep(out, raw, { fluid = false } = {}) {
298
- const text = String(raw ?? '').trim().toLowerCase();
299
- if (!FONT_SIZE_LITERAL_RE.test(text)) return;
300
- const px = resolveLengthPx(text, 16);
301
- if (px == null || !Number.isFinite(px) || px <= 0) return;
302
- out.allowedFontSizes.push({ value: text, px, fluid });
303
- }
304
-
305
- // Split a fluid value into its three terms, or null when it is not a
306
- // well-formed clamp(). Used both to read DESIGN.md's fluid roles and to
307
- // validate fluid values in source, so the two stay symmetric.
308
- function parseClampArgs(raw) {
309
- const match = /^clamp\(\s*([\s\S]+)\s*\)$/i.exec(String(raw ?? '').trim());
310
- if (!match) return null;
311
- const args = splitTopLevelArgs(match[1]);
312
- return args.length === 3 ? args : null;
313
- }
314
-
315
- // A fluid role declares its two fixed endpoints and interpolates between them
316
- // with a viewport unit. Both endpoints are documented sizes, so they belong in
317
- // the allowlist; the middle term is viewport-relative and never a fixed step.
318
- // Endpoints are marked `fluid` because they do not *enumerate* a ramp: see
319
- // `hasFontSizes` below for why that distinction has to survive.
320
- function addClampEndpoints(out, raw) {
321
- const args = parseClampArgs(raw);
322
- if (!args) return false;
323
- addFontSizeStep(out, args[0], { fluid: true });
324
- addFontSizeStep(out, args[2], { fluid: true });
325
- return true;
326
- }
327
-
328
- function splitTopLevelArgs(s) {
329
- const args = [];
330
- let depth = 0;
331
- let current = '';
332
- for (const ch of String(s)) {
333
- if (ch === '(') depth++;
334
- else if (ch === ')') depth--;
335
- if (ch === ',' && depth === 0) {
336
- args.push(current.trim());
337
- current = '';
338
- continue;
339
- }
340
- current += ch;
341
- }
342
- if (current.trim()) args.push(current.trim());
343
- return args;
344
- }
345
-
346
- function addTypographySizes(out, typography) {
347
- if (!typography || typeof typography !== 'object') return;
348
-
349
- // `scale` is the enumerated ramp: a name -> size map, since the frontmatter
350
- // parser has no list support. It sits alongside the named roles.
351
- const scale = typography.scale;
352
- if (scale && typeof scale === 'object') {
353
- for (const value of Object.values(scale)) {
354
- if (typeof value !== 'string' && typeof value !== 'number') continue;
355
- addFontSizeStep(out, value);
356
- }
357
- }
358
-
359
- for (const [name, role] of Object.entries(typography)) {
360
- if (name === 'scale') continue;
361
- if (!role || typeof role !== 'object') continue;
362
- const raw = String(role.fontSize ?? '').trim().toLowerCase();
363
- if (addClampEndpoints(out, raw)) continue;
364
- addFontSizeStep(out, raw);
365
- }
366
- }
367
-
368
- function addRoundedScale(out, rounded) {
369
- if (!rounded || typeof rounded !== 'object') return;
370
- for (const [rawName, value] of Object.entries(rounded)) {
371
- const name = unquoteYamlKey(rawName).toLowerCase();
372
- addRoundedToken(out, name, value);
373
- }
374
- }
375
-
376
- function addRoundedToken(out, name, value) {
377
- if (typeof value !== 'string' && typeof value !== 'number') return;
378
- const raw = String(value).trim();
379
- if (!raw || /var\(/i.test(raw) || raw.includes('%')) return;
380
- const px = resolveLengthPx(raw, 16);
381
- if (px == null || !Number.isFinite(px)) return;
382
- out.allowedRadii.push({ name, value: raw, px });
383
- if (/(^|\.)(full|pill|round|rounded-full)$/.test(name)) out.hasPillRadius = true;
384
- }
385
-
386
- function addSidecarRadii(out, sidecar) {
387
- const roundedMeta = sidecar?.extensions?.roundedMeta;
388
- if (!roundedMeta || typeof roundedMeta !== 'object') return;
389
-
390
- for (const [rawName, meta] of Object.entries(roundedMeta)) {
391
- const name = unquoteYamlKey(rawName).toLowerCase();
392
- if (typeof meta === 'string' || typeof meta === 'number') {
393
- addRoundedToken(out, `sidecar.${name}`, meta);
394
- continue;
395
- }
396
- if (!meta || typeof meta !== 'object') continue;
397
- for (const key of ['canonical', 'value']) {
398
- if (typeof meta[key] === 'string' || typeof meta[key] === 'number') {
399
- addRoundedToken(out, `sidecar.${name}.${key}`, meta[key]);
400
- }
401
- }
402
- for (const key of ['values', 'aliases']) {
403
- if (!Array.isArray(meta[key])) continue;
404
- for (const [index, value] of meta[key].entries()) {
405
- addRoundedToken(out, `sidecar.${name}.${key}[${index}]`, value);
406
- }
407
- }
408
- if (/^(full|pill|round|rounded-full)$/.test(name) || /^(full|pill|round)$/i.test(String(meta.role || ''))) {
409
- out.hasPillRadius = true;
410
- }
411
- }
412
- }
413
-
414
- function normalizeDesignSystem(input = {}) {
415
- const frontmatter = input.frontmatter || {};
416
- const sidecar = input.sidecar || null;
417
- const out = {
418
- present: true,
419
- sourcePath: input.sourcePath || null,
420
- sidecarPath: input.sidecarPath || null,
421
- mdNewerThanJson: input.mdNewerThanJson === true,
422
- allowedFonts: new Set(),
423
- allowedColorKeys: new Map(),
424
- allowedRadii: [],
425
- allowedFontSizes: [],
426
- hasPillRadius: false,
427
- };
428
-
429
- addTypographyFonts(out, frontmatter.typography);
430
- addTypographySizes(out, frontmatter.typography);
431
- addColorObject(out, frontmatter.colors);
432
- addSidecarColors(out, sidecar);
433
- addRoundedScale(out, frontmatter.rounded);
434
- addSidecarRadii(out, sidecar);
435
-
436
- out.hasFonts = out.allowedFonts.size > 0;
437
- out.hasColors = out.allowedColorKeys.size > 0;
438
- out.hasRadii = out.allowedRadii.length > 0;
439
- // Gate on *enumerated* steps only. A fully fluid system declares clamp
440
- // endpoints but no discrete ramp, so treating those endpoints as the whole
441
- // allowlist would flag every intermediate size. Abstain instead.
442
- out.hasFontSizes = out.allowedFontSizes.some(entry => !entry.fluid);
443
- return out;
444
- }
445
-
446
- function loadDesignSystemForCwd(cwd = process.cwd()) {
447
- const md = resolveDesignMdPath(cwd);
448
- if (!md) return null;
449
-
450
- let frontmatter = null;
451
- let mdStat = null;
452
- try {
453
- mdStat = fs.statSync(md.path);
454
- frontmatter = parseFrontmatter(fs.readFileSync(md.path, 'utf-8'));
455
- } catch {
456
- return null;
457
- }
458
- if (!frontmatter || typeof frontmatter !== 'object') return null;
459
-
460
- const sidecarPath = resolveDesignSidecarPath(cwd, md.contextDir);
461
- const sidecar = safeReadJson(sidecarPath);
462
- let sidecarStat = null;
463
- try {
464
- if (sidecarPath) sidecarStat = fs.statSync(sidecarPath);
465
- } catch {
466
- sidecarStat = null;
467
- }
468
-
469
- return normalizeDesignSystem({
470
- frontmatter,
471
- sidecar,
472
- sourcePath: md.path,
473
- sidecarPath,
474
- mdNewerThanJson: !!(mdStat && sidecarStat && mdStat.mtimeMs > sidecarStat.mtimeMs + 1000),
475
- });
476
- }
477
-
478
- // Directory to begin the project-root walk from, given a scan target that may
479
- // be a file or a directory (and may not exist yet).
480
- function designSystemStartDir(targetPath, cwd = process.cwd()) {
481
- const abs = path.isAbsolute(targetPath) ? targetPath : path.resolve(cwd, targetPath);
482
- try {
483
- return fs.statSync(abs).isDirectory() ? abs : path.dirname(abs);
484
- } catch {
485
- // Nonexistent path: treat an extension-bearing leaf as a file.
486
- return path.extname(abs) ? path.dirname(abs) : abs;
487
- }
488
- }
489
-
490
- // Walk up from `startDir` to the directory that governs the target's design
491
- // system, mirroring skill/scripts/context.mjs's project-boundary semantics:
492
- //
493
- // - A directory carrying a DESIGN.md (directly or in a fallback dir) IS the
494
- // design root — that's where the rules live.
495
- // - A directory carrying a project marker (.git / package.json / .impeccable)
496
- // but no DESIGN.md is a project BOUNDARY: the walk stops with no design
497
- // system, so a sibling project never inherits a parent's or cwd's rules.
498
- // - Reaching the home directory / filesystem root with neither means no
499
- // design system at all — never process.cwd()'s.
500
- //
501
- // Returns { dir, hasDesign } for the stopping directory, or null when the walk
502
- // runs out. This is the fix for cross-project contamination.
503
- export function findDesignRoot(startDir) {
504
- let dir = path.resolve(startDir);
505
- const homeDir = path.resolve(os.homedir());
506
- while (true) {
507
- if (resolveDesignMdPath(dir)) return { dir, hasDesign: true };
508
- if (PROJECT_ROOT_MARKERS.some((marker) => fs.existsSync(path.join(dir, marker)))) {
509
- return { dir, hasDesign: false };
510
- }
511
- if (dir === homeDir) return null;
512
- const parent = path.dirname(dir);
513
- if (parent === dir) return null;
514
- dir = parent;
515
- }
516
- }
517
-
518
- // Resolve the design system that governs a specific scan target, by walking up
519
- // from the target's own location — never process.cwd(). Scanning project B's
520
- // files from inside project A applies B's DESIGN.md (or none), not A's.
521
- //
522
- // Pass a `cache` Map to memoize by resolved design root across a multi-file
523
- // scan; a target with no design root above it resolves to null.
524
- export function loadDesignSystemForTarget(targetPath, { cache, cwd = process.cwd() } = {}) {
525
- const startDir = designSystemStartDir(targetPath, cwd);
526
- const found = findDesignRoot(startDir);
527
- const key = found ? `root:${found.dir}` : '\0none';
528
- if (cache && cache.has(key)) return cache.get(key);
529
- const loaded = found?.hasDesign ? loadDesignSystemForCwd(found.dir) : null;
530
- if (cache) cache.set(key, loaded);
531
- return loaded;
532
- }
533
-
534
- function isAllowedFont(font, designSystem) {
535
- if (!font || GENERIC_FONTS.has(font)) return true;
536
- if (!designSystem?.hasFonts) return true;
537
- return designSystem.allowedFonts.has(font);
538
- }
539
-
540
- function isAllowedColorRaw(raw, designSystem) {
541
- if (!designSystem?.hasColors) return true;
542
- const text = String(raw || '').trim().toLowerCase();
543
- if (!text || text === 'transparent' || text === 'currentcolor' || text === 'inherit' || text === 'initial') return true;
544
- if (text.includes('var(')) return true;
545
- const parsed = parseDesignColor(text);
546
- if (!parsed) return true;
547
- if ((parsed.a ?? 1) <= 0.05) return true;
548
- for (const entry of designSystem.allowedColorKeys.values()) {
549
- if (colorsClose(parsed, entry.color)) return true;
550
- }
551
- return false;
552
- }
553
-
554
- function isAllowedRadiusRaw(raw, designSystem) {
555
- if (!designSystem?.hasRadii) return true;
556
- const text = String(raw || '').trim().toLowerCase();
557
- if (!text || text === '0' || text === 'none' || text === 'initial' || text === 'inherit') return true;
558
- if (text.includes('var(') || text.includes('%')) return true;
559
- const px = resolveLengthPx(text, 16);
560
- if (px == null || !Number.isFinite(px) || px <= RADIUS_TOLERANCE_PX) return true;
561
- if (designSystem.hasPillRadius && px >= 99) return true;
562
- return designSystem.allowedRadii.some(entry => Math.abs(entry.px - px) <= RADIUS_TOLERANCE_PX);
563
- }
564
-
565
- // One term of a font-size value. `unjudgeable` covers var(), calc(), percentages
566
- // and units the ramp cannot resolve (em is parent-relative, not root-relative);
567
- // those abstain rather than guess.
568
- function fontSizeStepStatus(raw, designSystem) {
569
- const text = String(raw || '').trim().toLowerCase();
570
- if (!FONT_SIZE_LITERAL_RE.test(text)) return 'unjudgeable';
571
- const px = resolveLengthPx(text, 16);
572
- if (px == null || !Number.isFinite(px) || px <= 0) return 'unjudgeable';
573
- return designSystem.allowedFontSizes.some(
574
- entry => Math.abs(entry.px - px) <= FONT_SIZE_TOLERANCE_PX,
575
- ) ? 'on-ramp' : 'off-ramp';
576
- }
577
-
578
- // The off-ramp endpoints of a fluid value, or null when `raw` is not a fluid
579
- // value at all. Only the min and max are judged: the viewport term interpolates
580
- // between them and is never a fixed step.
581
- //
582
- // Reading clamp endpoints as documented steps without also checking them in
583
- // usage would let `clamp(99rem, 1vw, 200rem)` through, which is how a fluid
584
- // declaration stayed invisible until someone measured computed styles.
585
- export function offRampClampEndpoints(raw, designSystem) {
586
- if (!designSystem?.hasFontSizes) return null;
587
- const args = parseClampArgs(String(raw || '').trim().replace(/\s*!important\s*$/i, ''));
588
- if (!args) return null;
589
- return [args[0], args[2]].filter(
590
- endpoint => fontSizeStepStatus(endpoint, designSystem) === 'off-ramp',
591
- );
592
- }
593
-
594
- function isAllowedFontSizeRaw(raw, designSystem) {
595
- if (!designSystem?.hasFontSizes) return true;
596
- const text = String(raw || '').trim().toLowerCase().replace(/\s*!important\s*$/, '');
597
- const offRampEndpoints = offRampClampEndpoints(text, designSystem);
598
- if (offRampEndpoints) return offRampEndpoints.length === 0;
599
- return fontSizeStepStatus(text, designSystem) !== 'off-ramp';
600
- }
601
-
602
- function lineLooksCommented(line) {
603
- const trimmed = String(line || '').trim();
604
- return trimmed.startsWith('//') || trimmed.startsWith('/*') || trimmed.startsWith('*') || trimmed.startsWith('<!--');
605
- }
606
-
607
- function isProbablyColorLiteral(line, match) {
608
- const raw = match?.[0] || '';
609
- const index = match.index ?? -1;
610
- if (index < 0) return false;
611
- if (isInsideCssAttributeSelector(line, index)) return false;
612
-
613
- const before = line.slice(0, index);
614
- const after = line.slice(index + raw.length);
615
-
616
- if (raw.startsWith('#')) {
617
- if (before.endsWith('&')) return false; // HTML numeric entity, e.g. &#8596;
618
-
619
- const prevNonSpace = before.match(/\S(?=\s*$)/)?.[0] || '';
620
- const nextNonSpace = after.match(/^\s*(\S)/)?.[1] || '';
621
- if (prevNonSpace === '>' && nextNonSpace === '<') return false; // plain text, e.g. PR #155
622
- }
623
-
624
- const styleContext = /(?:^|[{\s;"'`(,])(?:color|background(?:-color|-image)?|border(?:-(?:top|right|bottom|left))?(?:-color)?|outline(?:-color)?|box-shadow|text-shadow|fill|stroke)\s*:\s*[^;{}"'`]*/i.test(before);
625
- const cssFunctionContext = /(?:linear-gradient|radial-gradient|conic-gradient|color-mix)\([^)]*$/i.test(before);
626
- const jsColorKeyContext = /(?:^|[,{]\s*)(?:color|background|backgroundColor|borderColor|outlineColor|fill|stroke|boxShadow|textShadow)\s*[:=]\s*["'`]?[^"'`,}]*/i.test(before);
627
-
628
- return styleContext || cssFunctionContext || jsColorKeyContext;
629
- }
630
-
631
- function isInsideCssAttributeSelector(line, index) {
632
- if (index < 0) return false;
633
- const before = line.slice(0, index);
634
- const lastOpen = before.lastIndexOf('[');
635
- if (lastOpen === -1) return false;
636
- const lastClose = before.lastIndexOf(']');
637
- if (lastClose > lastOpen) return false;
638
- const after = line.slice(index);
639
- const close = after.indexOf(']');
640
- const block = after.indexOf('{');
641
- return close !== -1 && (block === -1 || close < block);
642
- }
643
-
644
- function makeDesignFinding(id, filePath, snippet, line = 0, extras = {}) {
645
- return { ...finding(id, filePath, snippet, line), ...extras };
646
- }
647
-
648
- function decodeGoogleFamily(value) {
649
- const family = String(value || '').split(':')[0].replace(/\+/g, ' ');
650
- try {
651
- return decodeURIComponent(family);
652
- } catch {
653
- return family;
654
- }
655
- }
656
-
657
- function checkFontStack(stack, filePath, line, designSystem, context) {
658
- const primary = primaryFont(stack);
659
- if (!primary || isAllowedFont(primary, designSystem)) return [];
660
- const display = primary.replace(/\b\w/g, ch => ch.toUpperCase());
661
- return [makeDesignFinding(
662
- 'design-system-font',
663
- filePath,
664
- `${context}: ${display} is not declared in DESIGN.md typography`,
665
- line,
666
- { ignoreValue: display },
667
- )];
668
- }
669
-
670
- function extractRadiusTokens(value) {
671
- return String(value || '')
672
- .replace(/\s*\/\s*/g, ' ')
673
- .split(/\s+/)
674
- .map(token => token.trim())
675
- .filter(Boolean);
676
- }
677
-
678
- function checkRadiusValue(value, filePath, line, designSystem, context) {
679
- const findings = [];
680
- for (const token of extractRadiusTokens(value)) {
681
- if (isAllowedRadiusRaw(token, designSystem)) continue;
682
- findings.push(makeDesignFinding(
683
- 'design-system-radius',
684
- filePath,
685
- `${context}: ${token} is outside the DESIGN.md rounded scale`,
686
- line,
687
- { ignoreValue: token },
688
- ));
689
- }
690
- return findings;
691
- }
692
-
693
- function checkFontSizeValue(value, filePath, line, designSystem, context) {
694
- const token = String(value || '').trim();
695
- if (isAllowedFontSizeRaw(token, designSystem)) return [];
696
-
697
- // Name the offending endpoint on a fluid value; the whole clamp() string is
698
- // not actionable on its own, and it makes a poor ignore-value.
699
- const offRampEndpoints = offRampClampEndpoints(token, designSystem) || [];
700
- if (offRampEndpoints.length > 0) {
701
- const plural = offRampEndpoints.length > 1 ? 's' : '';
702
- return [makeDesignFinding(
703
- 'design-system-font-size',
704
- filePath,
705
- `${context}: ${token} has fluid endpoint${plural} ${offRampEndpoints.join(' and ')} off the DESIGN.md type ramp`,
706
- line,
707
- { ignoreValue: offRampEndpoints[0] },
708
- )];
709
- }
710
-
711
- // The snippet shows the declaration as authored, but the ignoreValue has to
712
- // be what a `hooks ignore-value` waiver can match, so the priority marker is
713
- // stripped. Otherwise the same size needs two different waivers depending on
714
- // whether it carries !important. font-family already behaves this way.
715
- return [makeDesignFinding(
716
- 'design-system-font-size',
717
- filePath,
718
- `${context}: ${token} is off the DESIGN.md type ramp`,
719
- line,
720
- { ignoreValue: token.replace(/\s*!important\s*$/i, '').trim() },
721
- )];
722
- }
723
-
724
- function checkSourceDesignSystem(content, filePath, options = {}) {
725
- const designSystem = options.designSystem;
726
- if (!designSystem?.present) return [];
727
-
728
- const findings = [];
729
- const lines = String(content || '').split('\n');
730
- for (let i = 0; i < lines.length; i++) {
731
- const line = lines[i];
732
- const lineNum = i + 1;
733
- if (lineLooksCommented(line)) continue;
734
-
735
- if (designSystem.hasFonts) {
736
- for (const match of line.matchAll(FONT_DECL_RE)) {
737
- findings.push(...checkFontStack(match[1], filePath, lineNum, designSystem, 'font-family'));
738
- }
739
- for (const match of line.matchAll(FONT_JS_RE)) {
740
- findings.push(...checkFontStack(match[1], filePath, lineNum, designSystem, 'fontFamily'));
741
- }
742
- for (const match of line.matchAll(GOOGLE_FONT_RE)) {
743
- const url = match[0];
744
- for (const familyMatch of url.matchAll(/[?&]family=([^&]+)/g)) {
745
- const font = normalizeFontName(decodeGoogleFamily(familyMatch[1]));
746
- if (!font || isAllowedFont(font, designSystem)) continue;
747
- const display = decodeGoogleFamily(familyMatch[1]);
748
- findings.push(makeDesignFinding(
749
- 'design-system-font',
750
- filePath,
751
- `Google Fonts: ${display} is not declared in DESIGN.md typography`,
752
- lineNum,
753
- { ignoreValue: display },
754
- ));
755
- }
756
- }
757
- }
758
-
759
- if (designSystem.hasColors) {
760
- for (const match of line.matchAll(CSS_COLOR_RE)) {
761
- if (!isProbablyColorLiteral(line, match)) continue;
762
- const raw = cssColorLabel(match[0]);
763
- if (isAllowedColorRaw(raw, designSystem)) continue;
764
- findings.push(makeDesignFinding(
765
- 'design-system-color',
766
- filePath,
767
- `Undocumented color ${raw} is outside DESIGN.md colors`,
768
- lineNum,
769
- { ignoreValue: raw },
770
- ));
771
- }
772
- }
773
-
774
- if (designSystem.hasRadii) {
775
- for (const match of line.matchAll(BORDER_RADIUS_RE)) {
776
- findings.push(...checkRadiusValue(match[1], filePath, lineNum, designSystem, 'border-radius'));
777
- }
778
- for (const match of line.matchAll(BORDER_RADIUS_JS_RE)) {
779
- findings.push(...checkRadiusValue(match[1], filePath, lineNum, designSystem, 'borderRadius'));
780
- }
781
- }
782
-
783
- if (designSystem.hasFontSizes) {
784
- for (const match of line.matchAll(FONT_SIZE_DECL_RE)) {
785
- findings.push(...checkFontSizeValue(match[1], filePath, lineNum, designSystem, 'font-size'));
786
- }
787
- for (const match of line.matchAll(FONT_SIZE_JS_RE)) {
788
- findings.push(...checkFontSizeValue(match[1], filePath, lineNum, designSystem, 'fontSize'));
789
- }
790
- for (const match of line.matchAll(TAILWIND_FONT_SIZE_RE)) {
791
- findings.push(...checkFontSizeValue(match[1], filePath, lineNum, designSystem, 'text-[…] class'));
792
- }
793
- }
794
- }
795
-
796
- return dedupeDesignFindings(findings);
797
- }
798
-
799
- function hasDirectText(el) {
800
- return Array.from(el.childNodes || []).some(node => node.nodeType === 3 && node.textContent.trim().length > 0);
801
- }
802
-
803
- function sampleText(el) {
804
- const text = String(el.textContent || '').replace(/\s+/g, ' ').trim();
805
- return text ? ` "${text.slice(0, 40)}"` : '';
806
- }
807
-
808
- // Font-size design-system checks are source-scan-only (see checkSourceDesignSystem).
809
- // Computed font-size cascades and clamp() ramps resolve to off-ramp px in the browser.
810
- function collectStaticDesignSystemFindings(document, window, filePath, designSystem) {
811
- if (!designSystem?.present) return [];
812
- const findings = [];
813
- const seenFonts = new Set();
814
- const seenColors = new Set();
815
- const seenRadii = new Set();
816
-
817
- for (const el of document.querySelectorAll('*')) {
818
- if (shouldSkipStaticDesignElement(el, window)) continue;
819
- const tag = el.tagName?.toLowerCase?.() || 'unknown';
820
- const style = window.getComputedStyle(el);
821
-
822
- if (designSystem.hasFonts && hasDirectText(el)) {
823
- const font = primaryFont(style.fontFamily || '');
824
- if (font && !seenFonts.has(font) && !isAllowedFont(font, designSystem)) {
825
- seenFonts.add(font);
826
- findings.push(makeDesignFinding(
827
- 'design-system-font',
828
- filePath,
829
- `${tag}${sampleText(el)} uses ${font}; not declared in DESIGN.md typography`,
830
- 0,
831
- { ignoreValue: font },
832
- ));
833
- }
834
- }
835
-
836
- if (designSystem.hasColors) {
837
- const colorChecks = [];
838
- if (hasDirectText(el)) colorChecks.push(['text color', style.color]);
839
- if (!isTransparentCss(style.backgroundColor)) colorChecks.push(['background', style.backgroundColor]);
840
- for (const side of ['Top', 'Right', 'Bottom', 'Left']) {
841
- if ((parseFloat(style[`border${side}Width`]) || 0) > 0) {
842
- colorChecks.push([`border-${side.toLowerCase()}`, style[`border${side}Color`]]);
843
- }
844
- }
845
- if ((parseFloat(style.outlineWidth) || 0) > 0) colorChecks.push(['outline', style.outlineColor]);
846
-
847
- for (const [kind, raw] of colorChecks) {
848
- const label = cssColorLabel(raw);
849
- if (isAllowedColorRaw(label, designSystem)) continue;
850
- const key = `${kind}:${label}`;
851
- if (seenColors.has(key)) continue;
852
- seenColors.add(key);
853
- findings.push(makeDesignFinding(
854
- 'design-system-color',
855
- filePath,
856
- `${kind} ${label} on ${tag}${sampleText(el)} is outside DESIGN.md colors`,
857
- 0,
858
- { ignoreValue: label },
859
- ));
860
- }
861
- }
862
-
863
- if (designSystem.hasRadii) {
864
- const rawRadius = String(style.borderRadius || '').trim();
865
- if (!rawRadius) continue;
866
- for (const token of extractRadiusTokens(rawRadius)) {
867
- if (isAllowedRadiusRaw(token, designSystem)) continue;
868
- if (seenRadii.has(token)) continue;
869
- seenRadii.add(token);
870
- findings.push(makeDesignFinding(
871
- 'design-system-radius',
872
- filePath,
873
- `border-radius ${token} on ${tag}${sampleText(el)} is outside the DESIGN.md rounded scale`,
874
- 0,
875
- { ignoreValue: token },
876
- ));
877
- }
878
- }
879
- }
880
-
881
- return findings;
882
- }
883
-
884
- function shouldSkipStaticDesignElement(el, window) {
885
- const tag = el.tagName?.toLowerCase?.() || '';
886
- if (STATIC_DESIGN_SKIP_TAGS.has(tag)) return true;
887
-
888
- let current = el;
889
- while (current) {
890
- if (current.getAttribute?.('hidden') !== null || current.getAttribute?.('aria-hidden') === 'true') return true;
891
- const style = window.getComputedStyle(current);
892
- const display = String(style.display || '').toLowerCase();
893
- const visibility = String(style.visibility || '').toLowerCase();
894
- if (display === 'none' || visibility === 'hidden' || visibility === 'collapse') return true;
895
- current = current.parentElement;
896
- }
897
- return false;
898
- }
899
-
900
- function isTransparentCss(value) {
901
- const text = String(value || '').trim().toLowerCase();
902
- if (!text || text === 'transparent') return true;
903
- const parsed = parseDesignColor(text);
904
- return parsed ? (parsed.a ?? 1) <= 0.05 : false;
905
- }
906
-
907
- function canonicalDesignFindingKey(item) {
908
- if (!item?.antipattern?.startsWith?.('design-system-')) return null;
909
- const value = item.ignoreValue || item.value || '';
910
- if (item.antipattern === 'design-system-font') {
911
- const context = /google fonts/i.test(item.snippet || '') ? 'google-font' : 'font';
912
- const font = normalizeFontName(value);
913
- return font ? `${item.antipattern}:${context}:${font}` : null;
914
- }
915
- if (item.antipattern === 'design-system-color') {
916
- const parsed = parseDesignColor(value);
917
- if (parsed) return `${item.antipattern}:color:${colorKey(parsed)}`;
918
- const label = cssColorLabel(value).toLowerCase();
919
- return label ? `${item.antipattern}:color:${label}` : null;
920
- }
921
- if (item.antipattern === 'design-system-radius') {
922
- const px = resolveLengthPx(String(value || '').trim(), 16);
923
- if (px != null && Number.isFinite(px)) return `${item.antipattern}:radius:${Math.round(px * 100) / 100}`;
924
- const label = String(value || '').trim().toLowerCase();
925
- return label ? `${item.antipattern}:radius:${label}` : null;
926
- }
927
- if (item.antipattern === 'design-system-font-size') {
928
- const px = resolveLengthPx(String(value || '').trim(), 16);
929
- if (px != null && Number.isFinite(px)) return `${item.antipattern}:font-size:${Math.round(px * 100) / 100}`;
930
- const label = String(value || '').trim().toLowerCase();
931
- return label ? `${item.antipattern}:font-size:${label}` : null;
932
- }
933
- return null;
934
- }
935
-
936
- function mergeDesignSystemFindings(...groups) {
937
- const out = [];
938
- const seen = new Map();
939
- for (const group of groups) {
940
- for (const item of group || []) {
941
- const key = canonicalDesignFindingKey(item);
942
- if (key) {
943
- if (seen.has(key)) {
944
- const existing = out[seen.get(key)];
945
- if ((existing.line || 0) <= 0 && (item.line || 0) > 0) existing.line = item.line;
946
- continue;
947
- }
948
- seen.set(key, out.length);
949
- }
950
- out.push(item);
951
- }
952
- }
953
- return out;
954
- }
955
-
956
- function dedupeDesignFindings(findings) {
957
- const out = [];
958
- const seen = new Set();
959
- for (const item of findings) {
960
- const key = [
961
- item.antipattern,
962
- item.line || 0,
963
- normalizeFontName(item.ignoreValue || item.snippet || ''),
964
- ].join('\0');
965
- if (seen.has(key)) continue;
966
- seen.add(key);
967
- out.push(item);
968
- }
969
- return out;
970
- }
971
-
972
- export {
973
- parseFrontmatter,
974
- normalizeDesignSystem,
975
- loadDesignSystemForCwd,
976
- isAllowedFont,
977
- isAllowedColorRaw,
978
- isAllowedRadiusRaw,
979
- isAllowedFontSizeRaw,
980
- checkSourceDesignSystem,
981
- collectStaticDesignSystemFindings,
982
- mergeDesignSystemFindings,
983
- };