@luci-dev/skills 0.0.0-stage → 0.5.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 (389) hide show
  1. package/dist/benchmark.d.ts +48 -0
  2. package/dist/benchmark.d.ts.map +1 -0
  3. package/dist/benchmark.js +84 -0
  4. package/dist/benchmark.js.map +1 -0
  5. package/dist/discovery.d.ts +105 -0
  6. package/dist/discovery.d.ts.map +1 -0
  7. package/dist/discovery.js +271 -0
  8. package/dist/discovery.js.map +1 -0
  9. package/dist/drafts.d.ts +20 -0
  10. package/dist/drafts.d.ts.map +1 -0
  11. package/dist/drafts.js +57 -0
  12. package/dist/drafts.js.map +1 -0
  13. package/dist/github.d.ts +49 -0
  14. package/dist/github.d.ts.map +1 -0
  15. package/dist/github.js +93 -0
  16. package/dist/github.js.map +1 -0
  17. package/dist/import.d.ts +80 -0
  18. package/dist/import.d.ts.map +1 -0
  19. package/dist/import.js +286 -0
  20. package/dist/import.js.map +1 -0
  21. package/dist/index.d.ts +17 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +17 -0
  24. package/dist/index.js.map +1 -0
  25. package/dist/licenses.d.ts +30 -0
  26. package/dist/licenses.d.ts.map +1 -0
  27. package/dist/licenses.js +116 -0
  28. package/dist/licenses.js.map +1 -0
  29. package/dist/linter.d.ts +35 -0
  30. package/dist/linter.d.ts.map +1 -0
  31. package/dist/linter.js +262 -0
  32. package/dist/linter.js.map +1 -0
  33. package/dist/lss.d.ts +74 -0
  34. package/dist/lss.d.ts.map +1 -0
  35. package/dist/lss.js +273 -0
  36. package/dist/lss.js.map +1 -0
  37. package/dist/orchestrator.d.ts +164 -0
  38. package/dist/orchestrator.d.ts.map +1 -0
  39. package/dist/orchestrator.js +370 -0
  40. package/dist/orchestrator.js.map +1 -0
  41. package/dist/packs.d.ts +50 -0
  42. package/dist/packs.d.ts.map +1 -0
  43. package/dist/packs.js +166 -0
  44. package/dist/packs.js.map +1 -0
  45. package/dist/preferences.d.ts +18 -0
  46. package/dist/preferences.d.ts.map +1 -0
  47. package/dist/preferences.js +57 -0
  48. package/dist/preferences.js.map +1 -0
  49. package/dist/project.d.ts +45 -0
  50. package/dist/project.d.ts.map +1 -0
  51. package/dist/project.js +183 -0
  52. package/dist/project.js.map +1 -0
  53. package/dist/rankability.d.ts +51 -0
  54. package/dist/rankability.d.ts.map +1 -0
  55. package/dist/rankability.js +217 -0
  56. package/dist/rankability.js.map +1 -0
  57. package/dist/registry.d.ts +82 -0
  58. package/dist/registry.d.ts.map +1 -0
  59. package/dist/registry.js +300 -0
  60. package/dist/registry.js.map +1 -0
  61. package/dist/trust.d.ts +13 -0
  62. package/dist/trust.d.ts.map +1 -0
  63. package/dist/trust.js +41 -0
  64. package/dist/trust.js.map +1 -0
  65. package/dist/types.d.ts +44 -0
  66. package/dist/types.d.ts.map +1 -0
  67. package/dist/types.js +2 -0
  68. package/dist/types.js.map +1 -0
  69. package/library/3d/threejs/LICENSE.txt +21 -0
  70. package/library/3d/threejs/NOTICE.md +7 -0
  71. package/library/3d/threejs/SKILL.md +102 -0
  72. package/library/3d/threejs/luci.json +39 -0
  73. package/library/accessibility/accessibility-baseline/SKILL.md +51 -0
  74. package/library/accessibility/accessibility-baseline/luci.json +33 -0
  75. package/library/accessibility/fixing-accessibility/NOTICE.md +6 -0
  76. package/library/accessibility/fixing-accessibility/SKILL.md +141 -0
  77. package/library/accessibility/fixing-accessibility/luci.json +36 -0
  78. package/library/animation-motion/animation-systems/LICENSE.txt +21 -0
  79. package/library/animation-motion/animation-systems/NOTICE.md +7 -0
  80. package/library/animation-motion/animation-systems/SKILL.md +192 -0
  81. package/library/animation-motion/animation-systems/luci.json +32 -0
  82. package/library/animation-motion/animejs/SKILL.md +64 -0
  83. package/library/animation-motion/animejs/luci.json +12 -0
  84. package/library/animation-motion/motion-dev/SKILL.md +69 -0
  85. package/library/animation-motion/motion-dev/luci.json +13 -0
  86. package/library/animation-motion/react-view-transitions/AGENTS.md +1380 -0
  87. package/library/animation-motion/react-view-transitions/NOTICE.md +6 -0
  88. package/library/animation-motion/react-view-transitions/README.md +44 -0
  89. package/library/animation-motion/react-view-transitions/SKILL.md +334 -0
  90. package/library/animation-motion/react-view-transitions/luci.json +40 -0
  91. package/library/animation-motion/react-view-transitions/metadata.json +12 -0
  92. package/library/animation-motion/react-view-transitions/references/css-recipes.md +312 -0
  93. package/library/animation-motion/react-view-transitions/references/implementation.md +170 -0
  94. package/library/animation-motion/react-view-transitions/references/nextjs.md +233 -0
  95. package/library/animation-motion/react-view-transitions/references/patterns.md +274 -0
  96. package/library/animation-motion/react-view-transitions/references/troubleshooting.md +47 -0
  97. package/library/code-quality/code-review/NOTICE.md +6 -0
  98. package/library/code-quality/code-review/SKILL.md +94 -0
  99. package/library/code-quality/code-review/agents/openai.yaml +3 -0
  100. package/library/code-quality/code-review/luci.json +33 -0
  101. package/library/components/company-logos/LICENSE.txt +21 -0
  102. package/library/components/company-logos/NOTICE.md +7 -0
  103. package/library/components/company-logos/SKILL.md +27 -0
  104. package/library/components/company-logos/luci.json +38 -0
  105. package/library/components/container-lines/LICENSE.txt +21 -0
  106. package/library/components/container-lines/NOTICE.md +7 -0
  107. package/library/components/container-lines/SKILL.md +124 -0
  108. package/library/components/container-lines/luci.json +48 -0
  109. package/library/design-systems/build-design-system/NOTICE.md +6 -0
  110. package/library/design-systems/build-design-system/SKILL.md +78 -0
  111. package/library/design-systems/build-design-system/luci.json +29 -0
  112. package/library/design-systems/build-design-system/references/components.md +46 -0
  113. package/library/design-systems/build-design-system/references/glossary.md +77 -0
  114. package/library/design-systems/build-design-system/references/taste.md +37 -0
  115. package/library/design-systems/build-design-system/references/tokens.md +59 -0
  116. package/library/design-systems/build-design-system/references/traps.md +128 -0
  117. package/library/design-systems/build-design-system/scripts/capture-guard.mjs +470 -0
  118. package/library/design-systems/build-design-system/scripts/capture.mjs +355 -0
  119. package/library/design-systems/build-design-system/scripts/check-system.mjs +1883 -0
  120. package/library/design-systems/build-design-system/scripts/find-chromium.mjs +137 -0
  121. package/library/design-systems/build-design-system/scripts/oklch.mjs +221 -0
  122. package/library/design-systems/build-design-system/scripts/pixdiff.mjs +186 -0
  123. package/library/design-systems/component-docs/NOTICE.md +6 -0
  124. package/library/design-systems/component-docs/SKILL.md +50 -0
  125. package/library/design-systems/component-docs/luci.json +30 -0
  126. package/library/design-systems/component-docs/references/doc-format.md +85 -0
  127. package/library/design-systems/create-design-md/NOTICE.md +6 -0
  128. package/library/design-systems/create-design-md/SKILL.md +259 -0
  129. package/library/design-systems/create-design-md/luci.json +38 -0
  130. package/library/design-systems/design-system-boss/NOTICE.md +6 -0
  131. package/library/design-systems/design-system-boss/SKILL.md +58 -0
  132. package/library/design-systems/design-system-boss/luci.json +29 -0
  133. package/library/design-systems/design-system-boss/playbooks/build.md +10 -0
  134. package/library/design-systems/design-system-boss/playbooks/component.md +9 -0
  135. package/library/design-systems/design-system-boss/playbooks/migrate.md +11 -0
  136. package/library/design-systems/design-system-boss/playbooks/review.md +9 -0
  137. package/library/design-systems/migrate-design-system/NOTICE.md +6 -0
  138. package/library/design-systems/migrate-design-system/SKILL.md +62 -0
  139. package/library/design-systems/migrate-design-system/luci.json +33 -0
  140. package/library/design-systems/migrate-design-system/references/correct.md +37 -0
  141. package/library/design-systems/migrate-design-system/references/lessons.md +69 -0
  142. package/library/design-systems/migrate-design-system/references/parity.md +44 -0
  143. package/library/design-systems/migrate-design-system/references/running-many-agents.md +52 -0
  144. package/library/design-systems/migrate-design-system/scripts/bodies-check.mjs +215 -0
  145. package/library/design-systems/migrate-design-system/scripts/land.mjs +433 -0
  146. package/library/design-systems/migrate-design-system/scripts/legacy.mjs +283 -0
  147. package/library/design-systems/migrate-design-system/scripts/parity.mjs +173 -0
  148. package/library/design-systems/token-mapping/NOTICE.md +6 -0
  149. package/library/design-systems/token-mapping/SKILL.md +46 -0
  150. package/library/design-systems/token-mapping/luci.json +25 -0
  151. package/library/design-systems/token-mapping/references/mapping-rules.md +54 -0
  152. package/library/design-systems/ui-review/NOTICE.md +6 -0
  153. package/library/design-systems/ui-review/SKILL.md +53 -0
  154. package/library/design-systems/ui-review/luci.json +29 -0
  155. package/library/design-systems/ui-review/references/criteria.md +49 -0
  156. package/library/frontend/composition-patterns/AGENTS.md +946 -0
  157. package/library/frontend/composition-patterns/NOTICE.md +6 -0
  158. package/library/frontend/composition-patterns/README.md +60 -0
  159. package/library/frontend/composition-patterns/SKILL.md +86 -0
  160. package/library/frontend/composition-patterns/luci.json +33 -0
  161. package/library/frontend/composition-patterns/metadata.json +11 -0
  162. package/library/frontend/composition-patterns/rules/_sections.md +29 -0
  163. package/library/frontend/composition-patterns/rules/_template.md +24 -0
  164. package/library/frontend/composition-patterns/rules/architecture-avoid-boolean-props.md +100 -0
  165. package/library/frontend/composition-patterns/rules/architecture-compound-components.md +112 -0
  166. package/library/frontend/composition-patterns/rules/patterns-children-over-render-props.md +87 -0
  167. package/library/frontend/composition-patterns/rules/patterns-explicit-variants.md +100 -0
  168. package/library/frontend/composition-patterns/rules/react19-no-forwardref.md +42 -0
  169. package/library/frontend/composition-patterns/rules/state-context-interface.md +191 -0
  170. package/library/frontend/composition-patterns/rules/state-decouple-implementation.md +113 -0
  171. package/library/frontend/composition-patterns/rules/state-lift-state.md +125 -0
  172. package/library/frontend/design-mobile-apps/NOTICE.md +6 -0
  173. package/library/frontend/design-mobile-apps/SKILL.md +121 -0
  174. package/library/frontend/design-mobile-apps/designing.md +56 -0
  175. package/library/frontend/design-mobile-apps/endpoints.md +362 -0
  176. package/library/frontend/design-mobile-apps/implementing.md +213 -0
  177. package/library/frontend/design-mobile-apps/luci.json +31 -0
  178. package/library/frontend/design-mobile-apps/styling/nativewind.md +57 -0
  179. package/library/frontend/design-mobile-apps/styling/stylesheet.md +28 -0
  180. package/library/frontend/design-mobile-apps/styling/uniwind.md +38 -0
  181. package/library/frontend/frontend-design/LICENSE.txt +202 -0
  182. package/library/frontend/frontend-design/NOTICE.md +6 -0
  183. package/library/frontend/frontend-design/SKILL.md +81 -0
  184. package/library/frontend/frontend-design/luci.json +43 -0
  185. package/library/frontend/react-native-skills/AGENTS.md +2897 -0
  186. package/library/frontend/react-native-skills/NOTICE.md +6 -0
  187. package/library/frontend/react-native-skills/README.md +165 -0
  188. package/library/frontend/react-native-skills/SKILL.md +119 -0
  189. package/library/frontend/react-native-skills/luci.json +33 -0
  190. package/library/frontend/react-native-skills/metadata.json +16 -0
  191. package/library/frontend/react-native-skills/rules/_sections.md +86 -0
  192. package/library/frontend/react-native-skills/rules/_template.md +28 -0
  193. package/library/frontend/react-native-skills/rules/animation-derived-value.md +53 -0
  194. package/library/frontend/react-native-skills/rules/animation-gesture-detector-press.md +95 -0
  195. package/library/frontend/react-native-skills/rules/animation-gpu-properties.md +65 -0
  196. package/library/frontend/react-native-skills/rules/design-system-compound-components.md +66 -0
  197. package/library/frontend/react-native-skills/rules/fonts-config-plugin.md +71 -0
  198. package/library/frontend/react-native-skills/rules/imports-design-system-folder.md +68 -0
  199. package/library/frontend/react-native-skills/rules/js-hoist-intl.md +61 -0
  200. package/library/frontend/react-native-skills/rules/list-performance-callbacks.md +44 -0
  201. package/library/frontend/react-native-skills/rules/list-performance-function-references.md +132 -0
  202. package/library/frontend/react-native-skills/rules/list-performance-images.md +53 -0
  203. package/library/frontend/react-native-skills/rules/list-performance-inline-objects.md +97 -0
  204. package/library/frontend/react-native-skills/rules/list-performance-item-expensive.md +94 -0
  205. package/library/frontend/react-native-skills/rules/list-performance-item-memo.md +82 -0
  206. package/library/frontend/react-native-skills/rules/list-performance-item-types.md +104 -0
  207. package/library/frontend/react-native-skills/rules/list-performance-virtualize.md +67 -0
  208. package/library/frontend/react-native-skills/rules/monorepo-native-deps-in-app.md +46 -0
  209. package/library/frontend/react-native-skills/rules/monorepo-single-dependency-versions.md +63 -0
  210. package/library/frontend/react-native-skills/rules/navigation-native-navigators.md +188 -0
  211. package/library/frontend/react-native-skills/rules/react-compiler-destructure-functions.md +50 -0
  212. package/library/frontend/react-native-skills/rules/react-compiler-reanimated-shared-values.md +48 -0
  213. package/library/frontend/react-native-skills/rules/react-state-dispatcher.md +91 -0
  214. package/library/frontend/react-native-skills/rules/react-state-fallback.md +56 -0
  215. package/library/frontend/react-native-skills/rules/react-state-minimize.md +65 -0
  216. package/library/frontend/react-native-skills/rules/rendering-no-falsy-and.md +74 -0
  217. package/library/frontend/react-native-skills/rules/rendering-text-in-text-component.md +36 -0
  218. package/library/frontend/react-native-skills/rules/scroll-position-no-state.md +82 -0
  219. package/library/frontend/react-native-skills/rules/state-ground-truth.md +80 -0
  220. package/library/frontend/react-native-skills/rules/ui-expo-image.md +66 -0
  221. package/library/frontend/react-native-skills/rules/ui-image-gallery.md +104 -0
  222. package/library/frontend/react-native-skills/rules/ui-measure-views.md +78 -0
  223. package/library/frontend/react-native-skills/rules/ui-menus.md +174 -0
  224. package/library/frontend/react-native-skills/rules/ui-native-modals.md +77 -0
  225. package/library/frontend/react-native-skills/rules/ui-pressable.md +61 -0
  226. package/library/frontend/react-native-skills/rules/ui-safe-area-scroll.md +65 -0
  227. package/library/frontend/react-native-skills/rules/ui-scrollview-content-inset.md +45 -0
  228. package/library/frontend/react-native-skills/rules/ui-styling.md +87 -0
  229. package/library/frontend/tailwindcss/LICENSE.txt +21 -0
  230. package/library/frontend/tailwindcss/NOTICE.md +7 -0
  231. package/library/frontend/tailwindcss/SKILL.md +83 -0
  232. package/library/frontend/tailwindcss/luci.json +39 -0
  233. package/library/frontend-frameworks/react-best-practices/NOTICE.md +6 -0
  234. package/library/frontend-frameworks/react-best-practices/SKILL.md +151 -0
  235. package/library/frontend-frameworks/react-best-practices/luci.json +39 -0
  236. package/library/general/algorithmic-art/LICENSE.txt +202 -0
  237. package/library/general/algorithmic-art/NOTICE.md +6 -0
  238. package/library/general/algorithmic-art/SKILL.md +409 -0
  239. package/library/general/algorithmic-art/luci.json +27 -0
  240. package/library/general/algorithmic-art/templates/generator_template.js +223 -0
  241. package/library/general/algorithmic-art/templates/viewer.html +599 -0
  242. package/library/general/canvas-design/LICENSE.txt +202 -0
  243. package/library/general/canvas-design/NOTICE.md +6 -0
  244. package/library/general/canvas-design/SKILL.md +134 -0
  245. package/library/general/canvas-design/canvas-fonts/ArsenalSC-OFL.txt +93 -0
  246. package/library/general/canvas-design/canvas-fonts/BigShoulders-OFL.txt +93 -0
  247. package/library/general/canvas-design/canvas-fonts/Boldonse-OFL.txt +93 -0
  248. package/library/general/canvas-design/canvas-fonts/BricolageGrotesque-OFL.txt +93 -0
  249. package/library/general/canvas-design/canvas-fonts/CrimsonPro-OFL.txt +93 -0
  250. package/library/general/canvas-design/canvas-fonts/DMMono-OFL.txt +93 -0
  251. package/library/general/canvas-design/canvas-fonts/EricaOne-OFL.txt +94 -0
  252. package/library/general/canvas-design/canvas-fonts/GeistMono-OFL.txt +93 -0
  253. package/library/general/canvas-design/canvas-fonts/Gloock-OFL.txt +93 -0
  254. package/library/general/canvas-design/canvas-fonts/IBMPlexMono-OFL.txt +93 -0
  255. package/library/general/canvas-design/canvas-fonts/InstrumentSans-OFL.txt +93 -0
  256. package/library/general/canvas-design/canvas-fonts/Italiana-OFL.txt +93 -0
  257. package/library/general/canvas-design/canvas-fonts/JetBrainsMono-OFL.txt +93 -0
  258. package/library/general/canvas-design/canvas-fonts/Jura-OFL.txt +93 -0
  259. package/library/general/canvas-design/canvas-fonts/LibreBaskerville-OFL.txt +93 -0
  260. package/library/general/canvas-design/canvas-fonts/Lora-OFL.txt +93 -0
  261. package/library/general/canvas-design/canvas-fonts/NationalPark-OFL.txt +93 -0
  262. package/library/general/canvas-design/canvas-fonts/NothingYouCouldDo-OFL.txt +93 -0
  263. package/library/general/canvas-design/canvas-fonts/Outfit-OFL.txt +93 -0
  264. package/library/general/canvas-design/canvas-fonts/PixelifySans-OFL.txt +93 -0
  265. package/library/general/canvas-design/canvas-fonts/PoiretOne-OFL.txt +93 -0
  266. package/library/general/canvas-design/canvas-fonts/RedHatMono-OFL.txt +93 -0
  267. package/library/general/canvas-design/canvas-fonts/Silkscreen-OFL.txt +93 -0
  268. package/library/general/canvas-design/canvas-fonts/SmoochSans-OFL.txt +93 -0
  269. package/library/general/canvas-design/canvas-fonts/Tektur-OFL.txt +93 -0
  270. package/library/general/canvas-design/canvas-fonts/WorkSans-OFL.txt +93 -0
  271. package/library/general/canvas-design/canvas-fonts/YoungSerif-OFL.txt +93 -0
  272. package/library/general/canvas-design/luci.json +29 -0
  273. package/library/index.json +2507 -0
  274. package/library/interaction/animation-on-scroll/LICENSE.txt +21 -0
  275. package/library/interaction/animation-on-scroll/NOTICE.md +7 -0
  276. package/library/interaction/animation-on-scroll/SKILL.md +115 -0
  277. package/library/interaction/animation-on-scroll/luci.json +38 -0
  278. package/library/micro-interactions/masked-reveal/LICENSE.txt +21 -0
  279. package/library/micro-interactions/masked-reveal/NOTICE.md +7 -0
  280. package/library/micro-interactions/masked-reveal/SKILL.md +187 -0
  281. package/library/micro-interactions/masked-reveal/luci.json +63 -0
  282. package/library/micro-interactions/micro-interaction/NOTICE.md +6 -0
  283. package/library/micro-interactions/micro-interaction/SKILL.md +177 -0
  284. package/library/micro-interactions/micro-interaction/luci.json +52 -0
  285. package/library/micro-interactions/micro-interaction/references/css-recipes.md +142 -0
  286. package/library/micro-interactions/micro-interaction/references/framer-motion-recipes.md +187 -0
  287. package/library/micro-interactions/micro-interaction/scripts/README.md +42 -0
  288. package/library/micro-interactions/micro-interaction/scripts/contact-sheet.sh +17 -0
  289. package/library/micro-interactions/micro-interaction/scripts/seek-shot.sh +21 -0
  290. package/library/performance/fixing-motion-performance/NOTICE.md +6 -0
  291. package/library/performance/fixing-motion-performance/SKILL.md +156 -0
  292. package/library/performance/fixing-motion-performance/luci.json +30 -0
  293. package/library/seo/fixing-metadata/NOTICE.md +6 -0
  294. package/library/seo/fixing-metadata/SKILL.md +111 -0
  295. package/library/seo/fixing-metadata/luci.json +36 -0
  296. package/library/shadcn-ui/migrate-radix-to-base/NOTICE.md +6 -0
  297. package/library/shadcn-ui/migrate-radix-to-base/SKILL.md +178 -0
  298. package/library/shadcn-ui/migrate-radix-to-base/class-mapping.md +62 -0
  299. package/library/shadcn-ui/migrate-radix-to-base/consumer-props.md +58 -0
  300. package/library/shadcn-ui/migrate-radix-to-base/disclosure.md +353 -0
  301. package/library/shadcn-ui/migrate-radix-to-base/display-misc.md +410 -0
  302. package/library/shadcn-ui/migrate-radix-to-base/form-controls.md +390 -0
  303. package/library/shadcn-ui/migrate-radix-to-base/luci.json +33 -0
  304. package/library/shadcn-ui/migrate-radix-to-base/menus.md +409 -0
  305. package/library/shadcn-ui/migrate-radix-to-base/overlays.md +459 -0
  306. package/library/shadcn-ui/migrate-radix-to-base/universal-patterns.md +286 -0
  307. package/library/shadcn-ui/migrate-radix-to-base/wrapper-shapes.md +110 -0
  308. package/library/shadcn-ui/shadcn/NOTICE.md +6 -0
  309. package/library/shadcn-ui/shadcn/SKILL.md +187 -0
  310. package/library/shadcn-ui/shadcn/agents/openai.yml +5 -0
  311. package/library/shadcn-ui/shadcn/assets/shadcn-small.png +0 -0
  312. package/library/shadcn-ui/shadcn/assets/shadcn.png +0 -0
  313. package/library/shadcn-ui/shadcn/assets/showcase/color-pair.tsx +126 -0
  314. package/library/shadcn-ui/shadcn/assets/showcase/preview-states.css +14 -0
  315. package/library/shadcn-ui/shadcn/assets/showcase/state-matrix.tsx +72 -0
  316. package/library/shadcn-ui/shadcn/cli.md +290 -0
  317. package/library/shadcn-ui/shadcn/customization.md +211 -0
  318. package/library/shadcn-ui/shadcn/design-system-page.md +268 -0
  319. package/library/shadcn-ui/shadcn/design-system.md +386 -0
  320. package/library/shadcn-ui/shadcn/evals/evals.json +126 -0
  321. package/library/shadcn-ui/shadcn/luci.json +34 -0
  322. package/library/shadcn-ui/shadcn/mcp.md +105 -0
  323. package/library/shadcn-ui/shadcn/references/updating-components.md +91 -0
  324. package/library/shadcn-ui/shadcn/references/workflow.md +31 -0
  325. package/library/shadcn-ui/shadcn/registry.md +277 -0
  326. package/library/shadcn-ui/shadcn/rules/base-vs-radix.md +306 -0
  327. package/library/shadcn-ui/shadcn/rules/chat.md +507 -0
  328. package/library/shadcn-ui/shadcn/rules/composition.md +213 -0
  329. package/library/shadcn-ui/shadcn/rules/forms.md +192 -0
  330. package/library/shadcn-ui/shadcn/rules/icons.md +101 -0
  331. package/library/shadcn-ui/shadcn/rules/styling.md +185 -0
  332. package/library/shadcn-ui/shadcn/scripts/showcase-coverage.mjs +53 -0
  333. package/library/systems/baseline-ui/NOTICE.md +6 -0
  334. package/library/systems/baseline-ui/SKILL.md +90 -0
  335. package/library/systems/baseline-ui/luci.json +35 -0
  336. package/library/testing/tdd/NOTICE.md +6 -0
  337. package/library/testing/tdd/SKILL.md +43 -0
  338. package/library/testing/tdd/agents/openai.yaml +3 -0
  339. package/library/testing/tdd/luci.json +29 -0
  340. package/library/testing/tdd/mocking.md +59 -0
  341. package/library/testing/tdd/tests.md +77 -0
  342. package/library/testing/webapp-testing/LICENSE.txt +202 -0
  343. package/library/testing/webapp-testing/NOTICE.md +6 -0
  344. package/library/testing/webapp-testing/SKILL.md +100 -0
  345. package/library/testing/webapp-testing/examples/console_logging.py +35 -0
  346. package/library/testing/webapp-testing/examples/element_discovery.py +40 -0
  347. package/library/testing/webapp-testing/examples/static_html_automation.py +33 -0
  348. package/library/testing/webapp-testing/luci.json +33 -0
  349. package/library/testing/webapp-testing/scripts/with_server.py +106 -0
  350. package/library/ui-ux/improve-ui/NOTICE.md +6 -0
  351. package/library/ui-ux/improve-ui/SKILL.md +127 -0
  352. package/library/ui-ux/improve-ui/agents/openai.yaml +13 -0
  353. package/library/ui-ux/improve-ui/luci.json +47 -0
  354. package/library/ui-ux/improve-ui/references/plan-template.md +55 -0
  355. package/library/ui-ux/landing-page/LICENSE.txt +21 -0
  356. package/library/ui-ux/landing-page/NOTICE.md +7 -0
  357. package/library/ui-ux/landing-page/SKILL.md +213 -0
  358. package/library/ui-ux/landing-page/luci.json +47 -0
  359. package/library/ui-ux/pricing-page/LICENSE.txt +21 -0
  360. package/library/ui-ux/pricing-page/NOTICE.md +7 -0
  361. package/library/ui-ux/pricing-page/SKILL.md +217 -0
  362. package/library/ui-ux/pricing-page/luci.json +47 -0
  363. package/library/ui-ux/prototype/LOGIC.md +67 -0
  364. package/library/ui-ux/prototype/NOTICE.md +6 -0
  365. package/library/ui-ux/prototype/SKILL.md +31 -0
  366. package/library/ui-ux/prototype/UI.md +112 -0
  367. package/library/ui-ux/prototype/agents/openai.yaml +3 -0
  368. package/library/ui-ux/prototype/luci.json +33 -0
  369. package/library/ui-ux/theme-factory/LICENSE.txt +202 -0
  370. package/library/ui-ux/theme-factory/NOTICE.md +6 -0
  371. package/library/ui-ux/theme-factory/SKILL.md +62 -0
  372. package/library/ui-ux/theme-factory/luci.json +35 -0
  373. package/library/ui-ux/theme-factory/themes/arctic-frost.md +19 -0
  374. package/library/ui-ux/theme-factory/themes/botanical-garden.md +19 -0
  375. package/library/ui-ux/theme-factory/themes/desert-rose.md +19 -0
  376. package/library/ui-ux/theme-factory/themes/forest-canopy.md +19 -0
  377. package/library/ui-ux/theme-factory/themes/golden-hour.md +19 -0
  378. package/library/ui-ux/theme-factory/themes/midnight-galaxy.md +19 -0
  379. package/library/ui-ux/theme-factory/themes/modern-minimalist.md +19 -0
  380. package/library/ui-ux/theme-factory/themes/ocean-depths.md +19 -0
  381. package/library/ui-ux/theme-factory/themes/sunset-boulevard.md +19 -0
  382. package/library/ui-ux/theme-factory/themes/tech-innovation.md +19 -0
  383. package/package.json +21 -3
  384. package/packs/design-system-build.json +10 -0
  385. package/packs/design-system.json +16 -0
  386. package/packs/marketing.json +11 -0
  387. package/packs/motion.json +12 -0
  388. package/packs/ui.json +13 -0
  389. package/README.md +0 -3
@@ -0,0 +1,355 @@
1
+ #!/usr/bin/env node
2
+ // capture.mjs: screenshots of every route, width, theme and state, behind capture-guard. Node 18+, Playwright 1.49+.
3
+ // Run `node capture.mjs --help` for usage.
4
+ import { createServer } from "node:http";
5
+ import { spawn, spawnSync } from "node:child_process";
6
+ import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs";
7
+ import { tmpdir } from "node:os";
8
+ import { dirname, join, resolve } from "node:path";
9
+ import { fileURLToPath, pathToFileURL } from "node:url";
10
+ import { launchChromium, repoRoot } from "./find-chromium.mjs";
11
+ import { installGuard, isLocalHost, prove } from "./capture-guard.mjs";
12
+
13
+ const SELF = fileURLToPath(import.meta.url);
14
+
15
+ const HELP = `capture.mjs: screenshots and accessibility trees for every route, width and theme, with every write blocked
16
+
17
+ Usage
18
+ node capture.mjs --base <url> --kind before|after --out <folder> (--routes <r>... | --surfaces <tsv>)
19
+ (--writes <file> | --no-backend) [options]
20
+ node capture.mjs --base <url> --status (--routes <r>... | --surfaces <tsv>)
21
+ node capture.mjs --self-test | --help
22
+
23
+ Example, with the app served on port 3000:
24
+ node capture.mjs --base http://localhost:3000 --kind before --out .design-system/captures \\
25
+ --surfaces .design-system/surfaces.tsv --writes .design-system/writes.txt
26
+
27
+ Routes
28
+ --routes <r>... each a path (/settings/profile) or surface=path (profile=/settings/profile), separated by
29
+ spaces or commas. The surface name defaults to the path as a slug: / is home. Load state only
30
+ --surfaces <tsv> a TSV with a header row holding surface and route (or path or url), and optionally states
31
+ (comma separated) and status (the HTTP code the route should answer, 200 when blank).
32
+ It is the only way to capture states
33
+ --expect-status <s=code>... a surface or route that should answer another code, such as notfound=404
34
+
35
+ Files, in --out
36
+ <surface>-<kind>-<width>.png the page as it loads, first theme
37
+ <surface>-<kind>-<width>-<theme>.png the other themes
38
+ <surface>.<state>-<kind>-<width>.png a listed state other than the load state
39
+ ...same name with .aria.yml the accessibility tree (roles, names, states). Diff before and after
40
+ ...same name with .<audit>.json what each --eval script returned
41
+ guard.log one JSON line per network decision, with the body of every write
42
+ bodies.json with --run: the request bodies of every write, for bodies-check
43
+
44
+ The guard (capture-guard.mjs) is installed on the browser context before the first navigation. It aborts every
45
+ non-local host, every PUT, PATCH and DELETE, and every POST not listed as a read. Service workers are blocked so
46
+ no request goes around it. A WebSocket is not guarded: an app that writes over one is not safe to capture live.
47
+ A capture needs one of these two, so no run starts before its writes are proven blocked:
48
+ --writes <file> lines of "METHOD URL", every write the app sends, copied from its network log ("METHOD URL
49
+ BODY" for GraphQL). capture runs capture-guard prove on them first and exits 2 before
50
+ opening a browser if any one would get through
51
+ --no-backend the app sends no writes (a static site, or every call answered by --guard-fixtures). The
52
+ guard still aborts every write, and a write seen anyway is printed as a WARN line
53
+ --read-procedures <a,b> exact POST procedure names, or GraphQL operation names, that are reads and may continue
54
+ --procedure-style <s> rpc-post (default) or rest
55
+ --graphql <path>... a path that serves GraphQL, beyond any ending in /graphql or /gql
56
+ --guard-fixtures <json> {"<procedure>": {"status": 200, "body": {...}}}, answered in the browser
57
+ --app-origin <url>... origins that serve the app. Default: any local host
58
+ --allow-host <host>... a non-local host the page may reach. A non-local --base is refused unless named here
59
+
60
+ Request bodies, for bodies-check.mjs in migrate-design-system
61
+ --run <RUN_ID> write bodies.json in --out: {"run", "rows": [{url, proc, body, capturedAt}]}, one row per
62
+ write the page sent, blocked or not. A GraphQL row's proc is graphql/<operation name>
63
+ --bodies <file> write it here instead, such as <evidence>/bodies.before.json
64
+
65
+ Options
66
+ --root <dir> the app's repo root, where Playwright is looked for first. Default: the git root of --out
67
+ --widths 390,1280 viewport widths: the narrowest and widest the app supports
68
+ --height 900 viewport height. 320 at --widths 390 shows overlays that run past a short screen
69
+ --themes light,dark the first is the default theme. Default: light
70
+ --theme-via <how> media (prefers-color-scheme, default), class (toggles .dark on <html>) or storage:<key>
71
+ (sets localStorage <key> before load). media is what a dark OS does
72
+ --states <file.mjs> a module whose default export maps a state name, or surface.state, to async (page) => {}
73
+ that reaches it. A listed state with no function is not captured, which fails the run
74
+ --eval <file.js>... in-page audit scripts. What each returns is written as JSON beside the screenshot
75
+ --full full-page screenshots (default: the viewport)
76
+ --mobile isMobile and hasTouch on, for a review of a phone
77
+ --storage-state <f> a Playwright storage state the person provides, to reach signed-in screens. Never a real
78
+ account's session
79
+ --no-aria skip the accessibility trees
80
+ --status only request every route and print its HTTP status. Exit 1 unless each answers as expected.
81
+ Redirects are not followed: a 3xx is reported with its Location and fails unless
82
+ --expect-status or the status column names that code
83
+
84
+ It requests every route first and exits 1 if any answers other than expected, after capturing the rest. The
85
+ clock is fixed, Math.random is seeded, reduced motion is on, lazy images load eagerly, and it waits for fonts
86
+ and, on a React app, for handlers to attach.
87
+ Exit 0 every planned capture written, 1 a route or capture failed or any capture is missing (each is listed),
88
+ 2 bad input, a write that would get through, or no browser.`;
89
+
90
+ const die = (m) => { console.error(`capture: ${m}`); process.exit(2); };
91
+ const slug = (p) => p.replace(/[?#].*$/, "").replace(/^\/+|\/+$/g, "").replace(/[^A-Za-z0-9]+/g, "-").replace(/^-|-$/g, "").toLowerCase() || "home";
92
+
93
+ async function main(argv) {
94
+ if (!argv.length || argv.includes("--help") || argv.includes("-h")) { console.log(HELP); process.exit(argv.length ? 0 : 2); }
95
+ if (argv.includes("--self-test")) process.exit(await selfTest());
96
+ const KNOWN = new Set(["--height", "--root", "--base", "--kind", "--out", "--routes", "--surfaces", "--widths", "--themes", "--theme-via", "--states", "--full", "--status", "--no-aria", "--expect-status", "--mobile", "--storage-state", "--eval", "--writes", "--read-procedures", "--procedure-style", "--guard-fixtures", "--app-origin", "--allow-host", "--no-backend", "--run", "--bodies", "--graphql"]);
97
+ const bad = argv.filter((a) => a.startsWith("--") && !KNOWN.has(a));
98
+ if (bad.length) die(`unknown ${bad.join(", ")}. See --help`);
99
+ const val = (f, d) => { const i = argv.indexOf(f); return i >= 0 && argv[i + 1] && !argv[i + 1].startsWith("--") ? argv[i + 1] : d; };
100
+ const list = (f) => { const i = argv.indexOf(f); if (i < 0) return null; const out = []; for (let k = i + 1; k < argv.length && !argv[k].startsWith("--"); k++) out.push(argv[k]); return out; };
101
+
102
+ const base = val("--base"); if (!base || !/^https?:\/\//.test(base)) die("--base <http://host:port> is required");
103
+ const statusOnly = argv.includes("--status");
104
+ const kind = val("--kind");
105
+ const out = val("--out") && resolve(val("--out"));
106
+ if (!statusOnly) {
107
+ if (!/^(before|after)$/.test(kind || "")) die("--kind before or --kind after is required");
108
+ if (!out) die("--out <folder> is required");
109
+ if (!val("--writes") && !argv.includes("--no-backend")) die("give --writes <file> (every write the app sends, proven blocked before the browser opens) or --no-backend (the app sends none). See --help");
110
+ if (val("--writes") && argv.includes("--no-backend")) die("give --writes or --no-backend, not both");
111
+ }
112
+ const runId = val("--run");
113
+ if (runId && !/^[\w.-]+$/.test(runId)) die("--run takes an id of letters, digits, dot, dash or underscore");
114
+ if (val("--bodies") && !runId) die("--bodies needs --run <RUN_ID>, the id the run log records");
115
+ if (runId && statusOnly) die("--run writes request bodies from a capture, so it does not go with --status");
116
+ const widths = val("--widths", "390,1280").split(",").map(Number);
117
+ if (widths.some((w) => !w)) die("--widths takes numbers, such as 390,1280");
118
+ const height = Number(val("--height", "900"));
119
+ if (!height) die("--height takes a number, such as 320");
120
+ const themes = val("--themes", "light").split(",");
121
+ const via = val("--theme-via", "media");
122
+ if (!/^(media|class|storage:.+)$/.test(via)) die("--theme-via is media, class or storage:<key>");
123
+ const aria = !argv.includes("--no-aria");
124
+ const storageState = val("--storage-state") && resolve(val("--storage-state"));
125
+ if (storageState && !existsSync(storageState)) die(`no storage state at ${storageState}`);
126
+ const audits = (list("--eval") || []).flatMap((f) => f.split(",")).filter(Boolean).map((f) => {
127
+ const p = resolve(f); if (!existsSync(p)) die(`--eval: no file at ${p}`);
128
+ const n = p.split("/").pop().replace(/\.(m?js)$/, ""); if (n === "aria") die("--eval: a script named aria would overwrite the .aria files. Rename it");
129
+ return { name: n, src: readFileSync(p, "utf8") };
130
+ });
131
+
132
+ let surfaces = [];
133
+ const routeArgs = (list("--routes") || []).flatMap((r) => r.split(",")).map((r) => r.trim()).filter(Boolean);
134
+ if (argv.includes("--routes") && !routeArgs.length) die("--routes needs one or more paths, such as --routes /,/settings/profile");
135
+ if (routeArgs.length && val("--surfaces")) die("give --routes or --surfaces, not both");
136
+ if (routeArgs.length && val("--states")) die("--states needs --surfaces, whose states column lists each surface's states");
137
+ if (routeArgs.length) surfaces = routeArgs.map((r) => { const m = /^([\w-]+)=(\/.*)$/.exec(r); return m ? { surface: m[1], route: m[2], states: [] } : { surface: slug(r), route: r.startsWith("/") ? r : `/${r}`, states: [] }; });
138
+ else if (val("--surfaces")) {
139
+ const p = resolve(val("--surfaces")); if (!existsSync(p)) die(`no file at ${p}`);
140
+ const rows = readFileSync(p, "utf8").split("\n").filter((l) => l.trim() && !l.startsWith("#")).map((l) => l.split("\t"));
141
+ const head = rows.shift().map((h) => h.trim().toLowerCase());
142
+ const col = (...n) => head.findIndex((h) => n.includes(h));
143
+ const cs = col("surface"), cr = col("route", "path", "url"), ct = col("states"), cx = col("status", "expect");
144
+ if (cs < 0 || cr < 0) die(`${p} needs a header row with surface and route columns`);
145
+ surfaces = rows.map((r) => ({ surface: r[cs].trim(), route: r[cr].trim(), states: ct >= 0 ? (r[ct] || "").split(",").map((s) => s.trim()).filter((s) => s && s !== "-" && s !== "default") : [], expect: cx >= 0 && /^\d{3}$/.test((r[cx] || "").trim()) ? Number(r[cx].trim()) : 200 }));
146
+ } else die("give --routes or --surfaces");
147
+ for (const e of list("--expect-status") || []) {
148
+ const m = /^(.+)=(\d{3})$/.exec(e); if (!m) die(`--expect-status takes surface=code, such as notfound=404, not ${e}`);
149
+ const hit = surfaces.filter((s) => s.surface === m[1] || s.route === m[1]); if (!hit.length) die(`--expect-status: no surface or route ${m[1]}`);
150
+ for (const s of hit) s.expect = Number(m[2]);
151
+ }
152
+ for (const s of surfaces) s.expect ??= 200;
153
+ if (surfaces.some((s) => s.surface.includes("."))) die("a surface name may not contain a dot; the dot separates surface and state");
154
+
155
+ // The guard's options, and the dry run that must come back clean before any browser opens.
156
+ const host = new URL(base).hostname;
157
+ const allowHosts = list("--allow-host") || [];
158
+ // A non-local base once opened the guard to that host for every request. Only an explicit --allow-host does now.
159
+ if (!isLocalHost(host) && !allowHosts.map((h) => h.toLowerCase()).includes(host.toLowerCase())) die(`--base ${host} is not a local host. Capture a local build, or name the host with --allow-host ${host} if every write to it is proven blocked`);
160
+ const guardOpts = {
161
+ procedureStyle: val("--procedure-style", "rpc-post"),
162
+ readProcedures: (val("--read-procedures") || "").split(",").filter(Boolean),
163
+ appOrigins: list("--app-origin") || [],
164
+ allowHosts,
165
+ graphqlPaths: list("--graphql") || [],
166
+ fixtures: val("--guard-fixtures") ? JSON.parse(readFileSync(resolve(val("--guard-fixtures")), "utf8")) : undefined,
167
+ };
168
+ if (!["rpc-post", "rest"].includes(guardOpts.procedureStyle)) die("--procedure-style is rpc-post or rest");
169
+ let proved = "--no-backend, so no dry run of the app's writes";
170
+ if (val("--writes")) {
171
+ const p = resolve(val("--writes")); if (!existsSync(p)) die(`no writes file at ${p}`);
172
+ const lines = readFileSync(p, "utf8").split("\n").filter((l) => l.trim() && !l.startsWith("#"));
173
+ const leaks = prove(lines, guardOpts);
174
+ for (const l of leaks) console.log(`LEAK\t${l.method} ${l.url}\t${l.reason}`);
175
+ if (leaks.length) die(`${leaks.length} of ${lines.length} writes in ${p} would reach the backend. Fix the guard options; nothing was captured`);
176
+ proved = `every one of ${lines.length} writes in --writes blocked`;
177
+ }
178
+
179
+ // 1. Every route answers as expected. A type check passes a server/client break that only a request shows.
180
+ const statuses = [];
181
+ // Redirects are not followed, so a route that bounces to /login reads as the 3xx it is.
182
+ for (const s of surfaces) {
183
+ let code, where = "";
184
+ try {
185
+ const res = await fetch(new URL(s.route, base), { redirect: "manual" });
186
+ code = res.status;
187
+ if (code >= 300 && code < 400) where = ` -> ${res.headers.get("location") || "(no Location)"}`;
188
+ } catch (e) { code = `no answer (${e.cause?.code || e.message})`; }
189
+ statuses.push([s, code]);
190
+ console.log(`${code === s.expect ? code : "FAIL"}\t${s.route}\t${code}${where}${s.expect !== 200 ? ` (expected ${s.expect})` : ""}`);
191
+ }
192
+ const off = statuses.filter(([s, c]) => c !== s.expect);
193
+ if (statusOnly) { console.log(`${statuses.length} route(s), ${off.length} not as expected`); process.exit(off.length ? 1 : 0); }
194
+ mkdirSync(out, { recursive: true });
195
+
196
+ const FREEZE = `(() => { let s = 42; Math.random = () => { s = (s * 16807) % 2147483647; return (s - 1) / 2147483646; }; })();`;
197
+ const HYDRATED = `new Promise((ok) => { const t0 = Date.now(); const tick = () => { const el = document.querySelector("button, a[href], input, select, textarea, [role=button]"); const ready = !el || Object.keys(el).some((k) => k.startsWith("__reactProps") || k.startsWith("__reactFiber")) || !document.querySelector("#__next, [data-reactroot], script[src*='_next']"); if (ready || Date.now() - t0 > 5000) ok(ready); else setTimeout(tick, 50); }; tick(); })`;
198
+ const SETTLE = `(async () => { for (const i of document.querySelectorAll("img[loading=lazy]")) i.loading = "eager"; await Promise.all([...document.images].map((i) => i.complete ? 0 : new Promise((r) => { i.onload = i.onerror = r; setTimeout(r, 3000); }))); await document.fonts.ready; document.getAnimations().forEach((a) => { try { a.finish(); } catch {} }); return true; })()`;
199
+ const themeClass = (t) => `document.documentElement.classList.toggle("dark", ${JSON.stringify(t)} === "dark"); document.documentElement.style.colorScheme = ${JSON.stringify(t)};`;
200
+ if (via !== "media" && themes.length > 1) console.error(`capture: --theme-via ${via} sets the theme by hand. It proves the tokens, not that a dark OS reaches them`);
201
+ const name = (s, state, w, t) => `${s.surface}${state ? `.${state}` : ""}-${kind}-${w}${t === themes[0] ? "" : `-${t}`}`;
202
+ const written = [], missed = [];
203
+ let evals = 0, trees = 0, blocked = 0;
204
+
205
+ const launched = await launchChromium({}, { root: repoRoot(val("--root"), out) });
206
+ if (launched.error) die(launched.error);
207
+ const browser = launched.browser;
208
+ console.error(`capture: ${launched.from}, ${launched.how}`);
209
+ let steps = {};
210
+ if (val("--states")) { const m = await import(pathToFileURL(resolve(val("--states"))).href); steps = m.default || m; }
211
+ const logFile = join(out, "guard.log");
212
+ writeFileSync(logFile, "");
213
+ for (const [s, code] of statuses) {
214
+ if (code !== s.expect) { missed.push(`${s.surface}: HTTP ${code}`); continue; }
215
+ for (const t of themes) for (const w of widths) for (const state of ["", ...s.states]) {
216
+ const step = state ? steps[`${s.surface}.${state}`] || steps[state] : null;
217
+ if (state && typeof step !== "function") { missed.push(`${s.surface}.${state}: no function for it in --states`); continue; }
218
+ const ctx = await browser.newContext({ viewport: { width: w, height }, colorScheme: via === "media" ? (t === "dark" ? "dark" : "light") : "light", reducedMotion: "reduce", serviceWorkers: "block", ...(argv.includes("--mobile") ? { isMobile: true, hasTouch: true } : {}), ...(storageState ? { storageState } : {}) });
219
+ const guard = installGuard(ctx, { ...guardOpts, logFile });
220
+ await guard.ready;
221
+ const page = await ctx.newPage();
222
+ try {
223
+ await page.clock.install({ time: new Date("2026-01-01T09:00:00Z") });
224
+ await page.addInitScript(FREEZE);
225
+ if (via.startsWith("storage:")) await page.addInitScript(([k, v]) => { try { localStorage.setItem(k, v); } catch {} }, [via.slice(8), t]);
226
+ await page.goto(new URL(s.route, base).href, { waitUntil: "load" });
227
+ if (via === "class") await page.evaluate(themeClass(t));
228
+ await page.evaluate(HYDRATED);
229
+ if (step) await step(page);
230
+ await page.evaluate(SETTLE);
231
+ const file = join(out, `${name(s, state, w, t)}.png`);
232
+ await page.screenshot({ path: file, fullPage: argv.includes("--full"), animations: "disabled" });
233
+ // A blank or failed render compresses to almost nothing. It is not a baseline.
234
+ if (readFileSync(file).length < 700) { rmSync(file); throw new Error("blank render, a capture under 700 bytes was deleted"); }
235
+ if (aria) {
236
+ try { writeFileSync(file.replace(/\.png$/, ".aria.yml"), (await page.locator("body").ariaSnapshot()) + "\n"); trees++; }
237
+ catch (e) { missed.push(`${name(s, state, w, t)}: aria tree failed (needs Playwright 1.49+): ${String(e.message).split("\n")[0]}`); }
238
+ }
239
+ for (const a of audits) {
240
+ try { const r = await page.evaluate(a.src); if (r === undefined || r === null) throw new Error("returned nothing"); writeFileSync(file.replace(/\.png$/, `.${a.name}.json`), JSON.stringify(r, null, 1)); evals++; }
241
+ catch (e) { missed.push(`${name(s, state, w, t)}: eval ${a.name} failed: ${String(e.message).split("\n")[0]}`); }
242
+ }
243
+ written.push(file);
244
+ } catch (e) { missed.push(`${name(s, state, w, t)}: ${String(e.message).split("\n")[0]}`); }
245
+ await guard.releaseAll();
246
+ blocked += guard.log.filter((l) => l.action === "abort").length;
247
+ await ctx.close();
248
+ }
249
+ }
250
+ await browser.close();
251
+
252
+ const log = readFileSync(logFile, "utf8").split("\n").filter(Boolean).map((l) => JSON.parse(l));
253
+ const writes = log.filter((l) => !["GET", "HEAD", "OPTIONS"].includes(String(l.method).toUpperCase()) && l.action !== "error" && !/released|aborted at release/.test(l.reason || ""));
254
+ const unproven = writes.filter((w) => w.action === "abort" || w.action === "hold");
255
+ if (argv.includes("--no-backend") && unproven.length) console.log(`WARN\tthe app sent ${unproven.length} write request(s) though --no-backend was given, each blocked. List them in --writes: ${[...new Set(unproven.map((w) => `${w.method} ${w.proc}`))].join(", ")}`);
256
+ if (runId) {
257
+ const file = val("--bodies") ? resolve(val("--bodies")) : join(out, "bodies.json");
258
+ mkdirSync(dirname(file), { recursive: true });
259
+ writeFileSync(file, JSON.stringify({ run: runId, rows: writes.map((w) => ({ url: w.url, proc: w.proc, body: w.body ?? "", capturedAt: w.t, method: w.method, action: w.action })) }, null, 1) + "\n");
260
+ console.log(`bodies: ${writes.length} write request(s) from run ${runId} in ${file}${writes.length ? "" : ". None was sent, so the changed path was not exercised"}`);
261
+ }
262
+ const planned = surfaces.reduce((n, s) => n + (1 + s.states.length) * widths.length * themes.length, 0);
263
+ for (const m of missed) console.log(`not captured\t${m}`);
264
+ console.log(`capture: ${written.length} of ${planned} planned file(s) in ${out}, ${missed.length} not captured, ${off.length} route(s) not as expected, ${blocked} request(s) blocked (guard.log)`);
265
+ console.log(`Coverage: ${written.length} of ${planned} captures (${surfaces.length} surface(s), widths ${widths.join(",")}, themes ${themes.join(",")} via ${via}), ${aria ? `${trees} accessibility tree(s)` : "no accessibility trees (--no-aria)"}${audits.length ? `, ${evals} audit result(s)` : ""}, ${proved}. Not captured: hover, focus and pressed states, motion in flight, states the surfaces file does not list, routes not listed`);
266
+ // Any capture short of the plan fails the run, so a missing state is never read as a baseline.
267
+ process.exit(off.length || missed.length || written.length < planned ? 1 : 0);
268
+ }
269
+
270
+ // ---------------------------------------------------------------- self-test
271
+ // A local app whose page fires a write on load. The capture must save the page and the write must never arrive.
272
+ async function selfTest() {
273
+ let fails = 0;
274
+ const t = (name, ok, detail = "") => { console.log(`${ok ? "ok " : "FAIL"} ${name}${ok ? "" : `: ${detail}`}`); if (!ok) fails++; };
275
+ const hits = [];
276
+ const page = `<!doctype html><html><body><h1>Items</h1><button>Save</button><script>
277
+ fetch("/rpc/items/update", { method: "POST", body: '{"id":1,"count":2}' }).catch(() => {});
278
+ fetch("/rpc/items/list", { method: "POST", body: "{}" }).catch(() => {});
279
+ fetch("/api/ping").catch(() => {});
280
+ </script></body></html>`;
281
+ const server = createServer((req, res) => {
282
+ hits.push(`${req.method} ${req.url}`);
283
+ if (req.url === "/") { res.writeHead(200, { "content-type": "text/html" }); res.end(page); }
284
+ else if (req.url === "/gone") { res.writeHead(404); res.end(); }
285
+ else if (req.url === "/private") { res.writeHead(302, { location: "/login" }); res.end(); }
286
+ else if (req.url === "/login") { res.writeHead(200, { "content-type": "text/html" }); res.end("<!doctype html><html><body><h1>Log in</h1></body></html>"); }
287
+ else if (req.url === "/blank") { res.writeHead(200, { "content-type": "text/html" }); res.end("<!doctype html><html><body></body></html>"); }
288
+ else { res.writeHead(200, { "content-type": "application/json" }); res.end("{}"); }
289
+ });
290
+ await new Promise((r) => server.listen(0, "127.0.0.1", r));
291
+ const base = `http://127.0.0.1:${server.address().port}`;
292
+ const dir = mkdtempSync(join(tmpdir(), "capture-"));
293
+ // The child is async and the server lives in this process, so run it without blocking the event loop.
294
+ const run = (...a) => new Promise((ok) => {
295
+ const p = spawn(process.execPath, [SELF, ...a], { cwd: dir });
296
+ let out = "";
297
+ p.stdout.on("data", (d) => (out += d)); p.stderr.on("data", (d) => (out += d));
298
+ p.on("close", (code) => ok({ code, out }));
299
+ });
300
+ try {
301
+ let r = await run("--base", base, "--status", "--routes", "/", "/gone");
302
+ t("--status exits 1 on a route that answers 404", r.code === 1 && /FAIL\t\/gone\t404/.test(r.out), r.out);
303
+ r = await run("--base", base, "--status", "--routes", "/", "gone=/gone", "--expect-status", "gone=404");
304
+ t("--expect-status accepts the expected code", r.code === 0, r.out);
305
+ // Redirects were once followed, so a route that bounced to /login read as 200.
306
+ r = await run("--base", base, "--status", "--routes", "/private");
307
+ t("--status reports a redirect as not OK, with its Location", r.code === 1 && /FAIL\t\/private\t302 -> \/login/.test(r.out), r.out);
308
+ r = await run("--base", base, "--status", "--routes", "private=/private", "--expect-status", "private=302");
309
+ t("--status accepts a redirect it was told to expect", r.code === 0, r.out);
310
+ // A non-local base once opened the guard to that host.
311
+ r = await run("--base", "http://app.example.com", "--status", "--routes", "/");
312
+ t("a non-local --base is refused without --allow-host", r.code === 2 && /not a local host/.test(r.out), r.out);
313
+ // A capture once started with no proof that the app's writes were blocked.
314
+ const before0 = hits.length;
315
+ r = await run("--base", base, "--kind", "before", "--out", join(dir, "noproof"), "--routes", "/");
316
+ t("a capture with neither --writes nor --no-backend is refused before any request", r.code === 2 && /--writes <file>.*--no-backend/.test(r.out) && hits.length === before0, r.out);
317
+ writeFileSync(join(dir, "writes.txt"), `POST ${base}/rpc/items/update\nPOST ${base}/rpc/items/list\n`);
318
+ const before = hits.length;
319
+ r = await run("--base", base, "--kind", "before", "--out", join(dir, "leak"), "--routes", "/", "--writes", join(dir, "writes.txt"), "--read-procedures", "items/update");
320
+ t("a write the guard would let through stops the run before any request", r.code === 2 && /LEAK\tPOST/.test(r.out) && hits.length === before, r.out);
321
+ const pw = spawnSync(process.execPath, [join(SELF, "..", "find-chromium.mjs"), "--root", dir], { encoding: "utf8" });
322
+ if (pw.status !== 0) {
323
+ console.log(`self-test: the browser checks did not run, because no Playwright and Chromium were found:\n${(pw.stderr || pw.stdout).trim()}`);
324
+ return 2;
325
+ }
326
+ hits.length = 0;
327
+ writeFileSync(join(dir, "writes.txt"), `POST ${base}/rpc/items/update\nPUT ${base}/api/items/1\n`);
328
+ r = await run("--base", base, "--kind", "before", "--out", join(dir, "shots"), "--routes", "/", "--widths", "390", "--writes", join(dir, "writes.txt"), "--read-procedures", "items/list", "--run", "RUN-T", "--bodies", join(dir, "evidence/bodies.before.json"));
329
+ t("a clean dry run is reported", /every one of 2 writes in --writes blocked/.test(r.out), r.out);
330
+ t("the capture exits 0", r.code === 0, r.out);
331
+ t("the screenshot and the accessibility tree are written", existsSync(join(dir, "shots/home-before-390.png")) && /button "Save"/.test(existsSync(join(dir, "shots/home-before-390.aria.yml")) ? readFileSync(join(dir, "shots/home-before-390.aria.yml"), "utf8") : ""), r.out);
332
+ t("the write never reached the server", !hits.some((h) => h.startsWith("POST /rpc/items/update")), hits.join(", "));
333
+ t("the listed read and the GET did reach it", hits.includes("POST /rpc/items/list") && hits.includes("GET /api/ping"), hits.join(", "));
334
+ const log = existsSync(join(dir, "shots/guard.log")) ? readFileSync(join(dir, "shots/guard.log"), "utf8").trim().split("\n").map((l) => JSON.parse(l)) : [];
335
+ t("guard.log records the write as aborted, with its body", log.some((l) => l.action === "abort" && /items\/update/.test(l.url) && l.body === '{"id":1,"count":2}'), JSON.stringify(log));
336
+ // Nothing once wrote request bodies, so request-body equality could not be shown with these tools.
337
+ const bodies = existsSync(join(dir, "evidence/bodies.before.json")) ? JSON.parse(readFileSync(join(dir, "evidence/bodies.before.json"), "utf8")) : {};
338
+ t("--run writes the blocked write's body in the shape bodies-check reads", bodies.run === "RUN-T" && bodies.rows?.some((x) => x.proc === "items/update" && x.body === '{"id":1,"count":2}' && x.url.startsWith(base) && !Number.isNaN(Date.parse(x.capturedAt))), JSON.stringify(bodies));
339
+ r = await run("--base", base, "--kind", "before", "--out", join(dir, "nb"), "--routes", "/", "--widths", "390", "--no-backend");
340
+ t("--no-backend still blocks the write and warns about it", r.code === 0 && /WARN\tthe app sent \d+ write/.test(r.out) && !hits.some((h) => h.startsWith("POST /rpc/items/update")), r.out);
341
+ r = await run("--base", base, "--kind", "before", "--out", join(dir, "blank"), "--routes", "/blank", "--widths", "16", "--height", "16", "--no-backend");
342
+ t("a blank render is not kept as a capture", r.code === 1 && /blank render/.test(r.out) && !existsSync(join(dir, "blank/blank-before-16.png")), r.out);
343
+ // A capture short of its plan once exited 0, so a missing state looked like a full baseline.
344
+ writeFileSync(join(dir, "surfaces.tsv"), "surface\troute\tstates\nhome\t/\topen\n");
345
+ r = await run("--base", base, "--kind", "before", "--out", join(dir, "short"), "--surfaces", join(dir, "surfaces.tsv"), "--widths", "390", "--no-backend");
346
+ t("a capture with a planned state missing exits 1 and names it", r.code === 1 && /1 of 2 planned/.test(r.out) && /not captured\thome\.open/.test(r.out), r.out);
347
+ } finally {
348
+ server.close();
349
+ rmSync(dir, { recursive: true, force: true });
350
+ }
351
+ console.log(fails ? `${fails} failed` : "all as expected");
352
+ return fails ? 1 : 0;
353
+ }
354
+
355
+ await main(process.argv.slice(2));