@thanhnguyxn/pixelcraft 0.0.0-stage → 0.1.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 (297) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/.claude-plugin/marketplace.json +20 -0
  3. package/.claude-plugin/plugin.json +11 -0
  4. package/LICENSE +21 -0
  5. package/README.md +407 -2
  6. package/assets/README.md +28 -0
  7. package/assets/pixelcraft-logo-512.png +0 -0
  8. package/bin/pixelcraft.mjs +444 -0
  9. package/docs/ARCHITECTURE.md +102 -0
  10. package/docs/DESIGN-RATIONALE.md +143 -0
  11. package/evals/README.md +27 -0
  12. package/evals/fixtures/README.md +36 -0
  13. package/evals/fixtures/direction-prototype-complexity.json +29 -0
  14. package/evals/fixtures/finish-gate-anti-slop.json +30 -0
  15. package/evals/fixtures/forms-accessibility-negative.json +29 -0
  16. package/evals/fixtures/handoff-fidelity-tolerance.json +29 -0
  17. package/evals/fixtures/plan-brownfield-evidence.json +28 -0
  18. package/evals/fixtures/visual-qa-task-evidence.json +29 -0
  19. package/evals/fixtures/workflow-checkpoints.json +30 -0
  20. package/evals/pixelcraft-accessibility.md +57 -0
  21. package/evals/pixelcraft-brandkit.md +58 -0
  22. package/evals/pixelcraft-chat-ui.md +55 -0
  23. package/evals/pixelcraft-constrained.md +55 -0
  24. package/evals/pixelcraft-craft.md +60 -0
  25. package/evals/pixelcraft-data-apps.md +55 -0
  26. package/evals/pixelcraft-dataviz.md +59 -0
  27. package/evals/pixelcraft-desktop.md +55 -0
  28. package/evals/pixelcraft-direction.md +60 -0
  29. package/evals/pixelcraft-document.md +55 -0
  30. package/evals/pixelcraft-email.md +55 -0
  31. package/evals/pixelcraft-extensions.md +55 -0
  32. package/evals/pixelcraft-game-ui.md +59 -0
  33. package/evals/pixelcraft-handoff.md +57 -0
  34. package/evals/pixelcraft-media.md +55 -0
  35. package/evals/pixelcraft-mobile.md +59 -0
  36. package/evals/pixelcraft-patterns.md +57 -0
  37. package/evals/pixelcraft-plan.md +65 -0
  38. package/evals/pixelcraft-review.md +63 -0
  39. package/evals/pixelcraft-spatial.md +55 -0
  40. package/evals/pixelcraft-tokens.md +57 -0
  41. package/evals/pixelcraft-tui.md +55 -0
  42. package/evals/pixelcraft-ux.md +59 -0
  43. package/evals/pixelcraft-visual-qa.md +80 -0
  44. package/evals/pixelcraft-web.md +71 -0
  45. package/evals/pixelcraft.md +70 -0
  46. package/gemini-extension.json +5 -0
  47. package/install.ps1 +295 -0
  48. package/install.sh +437 -0
  49. package/package.json +63 -4
  50. package/plugin.json +24 -0
  51. package/scripts/build-adapters.mjs +290 -0
  52. package/scripts/build-release-archives.mjs +61 -0
  53. package/scripts/build-skill-zips.mjs +94 -0
  54. package/scripts/test-build-adapters.mjs +48 -0
  55. package/scripts/test-distribution.mjs +124 -0
  56. package/scripts/test-export-tokens.mjs +105 -0
  57. package/scripts/test-finish-gate.mjs +148 -0
  58. package/scripts/test-installers.mjs +67 -0
  59. package/scripts/test-release-archives.mjs +42 -0
  60. package/scripts/test-shoot.mjs +65 -0
  61. package/scripts/test-slop-scan.mjs +29 -0
  62. package/scripts/test-style-inventory.mjs +211 -0
  63. package/scripts/test-validate-skills.mjs +117 -0
  64. package/scripts/validate-skills.mjs +512 -0
  65. package/skills/pixelcraft/SKILL.md +135 -0
  66. package/skills/pixelcraft/references/design-brief.md +75 -0
  67. package/skills/pixelcraft/references/floor.md +73 -0
  68. package/skills/pixelcraft/references/report-template.md +35 -0
  69. package/skills/pixelcraft/references/stack-detection.md +155 -0
  70. package/skills/pixelcraft/references/surface-acceptance.md +40 -0
  71. package/skills/pixelcraft/references/workflow-checkpoints.md +29 -0
  72. package/skills/pixelcraft-accessibility/SKILL.md +33 -0
  73. package/skills/pixelcraft-accessibility/references/apg-patterns.md +51 -0
  74. package/skills/pixelcraft-accessibility/references/platforms.md +58 -0
  75. package/skills/pixelcraft-accessibility/references/verification.md +59 -0
  76. package/skills/pixelcraft-accessibility/references/wcag22-checks.md +66 -0
  77. package/skills/pixelcraft-brandkit/SKILL.md +115 -0
  78. package/skills/pixelcraft-brandkit/references/asset-pipeline.md +125 -0
  79. package/skills/pixelcraft-brandkit/references/brand-governance.md +80 -0
  80. package/skills/pixelcraft-brandkit/references/layouts.md +88 -0
  81. package/skills/pixelcraft-brandkit/references/logo-concepting.md +83 -0
  82. package/skills/pixelcraft-brandkit/references/logo-methods.md +98 -0
  83. package/skills/pixelcraft-brandkit/references/pixel-art-logos.md +82 -0
  84. package/skills/pixelcraft-brandkit/references/prompt-template.md +85 -0
  85. package/skills/pixelcraft-brandkit/references/qa-checklist.md +88 -0
  86. package/skills/pixelcraft-brandkit/references/visual-modes.md +123 -0
  87. package/skills/pixelcraft-chat-ui/SKILL.md +53 -0
  88. package/skills/pixelcraft-chat-ui/references/conversation-design.md +78 -0
  89. package/skills/pixelcraft-chat-ui/references/mobile-business-platforms.md +87 -0
  90. package/skills/pixelcraft-chat-ui/references/slack-discord.md +96 -0
  91. package/skills/pixelcraft-constrained/SKILL.md +51 -0
  92. package/skills/pixelcraft-constrained/references/specialized-hardware.md +66 -0
  93. package/skills/pixelcraft-constrained/references/tv-wearables.md +84 -0
  94. package/skills/pixelcraft-constrained/references/voice-ui.md +63 -0
  95. package/skills/pixelcraft-craft/SKILL.md +44 -0
  96. package/skills/pixelcraft-craft/references/color.md +69 -0
  97. package/skills/pixelcraft-craft/references/imagery-icons.md +37 -0
  98. package/skills/pixelcraft-craft/references/layout-quality.md +65 -0
  99. package/skills/pixelcraft-craft/references/layout.md +41 -0
  100. package/skills/pixelcraft-craft/references/motion.md +76 -0
  101. package/skills/pixelcraft-craft/references/typography.md +71 -0
  102. package/skills/pixelcraft-data-apps/SKILL.md +67 -0
  103. package/skills/pixelcraft-data-apps/references/dash.md +53 -0
  104. package/skills/pixelcraft-data-apps/references/evidence.md +75 -0
  105. package/skills/pixelcraft-data-apps/references/gradio.md +65 -0
  106. package/skills/pixelcraft-data-apps/references/julia-genie.md +54 -0
  107. package/skills/pixelcraft-data-apps/references/jupyter-widgets.md +53 -0
  108. package/skills/pixelcraft-data-apps/references/nicegui.md +63 -0
  109. package/skills/pixelcraft-data-apps/references/observable-framework.md +67 -0
  110. package/skills/pixelcraft-data-apps/references/panel.md +53 -0
  111. package/skills/pixelcraft-data-apps/references/r-shiny.md +54 -0
  112. package/skills/pixelcraft-data-apps/references/reflex.md +62 -0
  113. package/skills/pixelcraft-data-apps/references/shiny.md +53 -0
  114. package/skills/pixelcraft-data-apps/references/streamlit.md +65 -0
  115. package/skills/pixelcraft-dataviz/SKILL.md +63 -0
  116. package/skills/pixelcraft-dataviz/references/chart-choice.md +55 -0
  117. package/skills/pixelcraft-dataviz/references/color-accessibility.md +112 -0
  118. package/skills/pixelcraft-dataviz/references/encoding-tables-dashboards.md +97 -0
  119. package/skills/pixelcraft-dataviz/references/libraries.md +57 -0
  120. package/skills/pixelcraft-dataviz/references/realtime-graphs-maps-scale.md +99 -0
  121. package/skills/pixelcraft-desktop/SKILL.md +71 -0
  122. package/skills/pixelcraft-desktop/references/appkit.md +58 -0
  123. package/skills/pixelcraft-desktop/references/avalonia.md +59 -0
  124. package/skills/pixelcraft-desktop/references/cpp-gui.md +52 -0
  125. package/skills/pixelcraft-desktop/references/electron.md +54 -0
  126. package/skills/pixelcraft-desktop/references/go-gui.md +54 -0
  127. package/skills/pixelcraft-desktop/references/gtk.md +54 -0
  128. package/skills/pixelcraft-desktop/references/javafx-swing.md +52 -0
  129. package/skills/pixelcraft-desktop/references/qt-pyside-qml.md +61 -0
  130. package/skills/pixelcraft-desktop/references/rust-gui.md +65 -0
  131. package/skills/pixelcraft-desktop/references/tauri.md +54 -0
  132. package/skills/pixelcraft-desktop/references/uno-platform.md +52 -0
  133. package/skills/pixelcraft-desktop/references/winui-wpf.md +58 -0
  134. package/skills/pixelcraft-desktop/references/working-context.md +5 -0
  135. package/skills/pixelcraft-direction/SKILL.md +154 -0
  136. package/skills/pixelcraft-direction/references/composition-library.md +84 -0
  137. package/skills/pixelcraft-direction/references/direction-card.md +54 -0
  138. package/skills/pixelcraft-direction/references/direction-scoring.md +72 -0
  139. package/skills/pixelcraft-direction/references/movements.md +68 -0
  140. package/skills/pixelcraft-direction/references/repetition-history.md +75 -0
  141. package/skills/pixelcraft-direction/references/slop-fingerprints.md +58 -0
  142. package/skills/pixelcraft-direction/references/wildcards.md +47 -0
  143. package/skills/pixelcraft-document/SKILL.md +54 -0
  144. package/skills/pixelcraft-document/references/archetypes.md +83 -0
  145. package/skills/pixelcraft-document/references/pdf-tools.md +154 -0
  146. package/skills/pixelcraft-document/references/print-css.md +134 -0
  147. package/skills/pixelcraft-document/references/slides.md +102 -0
  148. package/skills/pixelcraft-email/SKILL.md +58 -0
  149. package/skills/pixelcraft-email/references/client-quirks.md +45 -0
  150. package/skills/pixelcraft-email/references/html-tables.md +53 -0
  151. package/skills/pixelcraft-email/references/mjml.md +52 -0
  152. package/skills/pixelcraft-email/references/react-email.md +53 -0
  153. package/skills/pixelcraft-extensions/SKILL.md +51 -0
  154. package/skills/pixelcraft-extensions/references/browser-extensions.md +31 -0
  155. package/skills/pixelcraft-extensions/references/figma-office.md +23 -0
  156. package/skills/pixelcraft-extensions/references/raycast.md +19 -0
  157. package/skills/pixelcraft-extensions/references/vscode-webviews.md +26 -0
  158. package/skills/pixelcraft-game-ui/SKILL.md +61 -0
  159. package/skills/pixelcraft-game-ui/references/bevy.md +52 -0
  160. package/skills/pixelcraft-game-ui/references/godot.md +57 -0
  161. package/skills/pixelcraft-game-ui/references/hud-principles.md +38 -0
  162. package/skills/pixelcraft-game-ui/references/love2d.md +51 -0
  163. package/skills/pixelcraft-game-ui/references/monogame.md +52 -0
  164. package/skills/pixelcraft-game-ui/references/unity-ui-toolkit.md +65 -0
  165. package/skills/pixelcraft-game-ui/references/unreal-umg.md +53 -0
  166. package/skills/pixelcraft-handoff/SKILL.md +49 -0
  167. package/skills/pixelcraft-handoff/references/design-translation.md +104 -0
  168. package/skills/pixelcraft-handoff/references/fidelity-tolerance.md +78 -0
  169. package/skills/pixelcraft-media/SKILL.md +52 -0
  170. package/skills/pixelcraft-media/references/banners-video.md +112 -0
  171. package/skills/pixelcraft-media/references/og-generation.md +107 -0
  172. package/skills/pixelcraft-media/references/social-cards.md +72 -0
  173. package/skills/pixelcraft-mobile/SKILL.md +69 -0
  174. package/skills/pixelcraft-mobile/references/dotnet-maui.md +63 -0
  175. package/skills/pixelcraft-mobile/references/flet.md +53 -0
  176. package/skills/pixelcraft-mobile/references/flutter.md +69 -0
  177. package/skills/pixelcraft-mobile/references/ionic-capacitor.md +65 -0
  178. package/skills/pixelcraft-mobile/references/jetpack-compose.md +61 -0
  179. package/skills/pixelcraft-mobile/references/kivy.md +59 -0
  180. package/skills/pixelcraft-mobile/references/kotlin-multiplatform.md +60 -0
  181. package/skills/pixelcraft-mobile/references/react-native-expo.md +71 -0
  182. package/skills/pixelcraft-mobile/references/swiftui.md +70 -0
  183. package/skills/pixelcraft-mobile/references/task-state-composition.md +5 -0
  184. package/skills/pixelcraft-mobile/references/uikit.md +58 -0
  185. package/skills/pixelcraft-patterns/SKILL.md +58 -0
  186. package/skills/pixelcraft-patterns/references/auth-onboarding.md +25 -0
  187. package/skills/pixelcraft-patterns/references/commerce.md +28 -0
  188. package/skills/pixelcraft-patterns/references/communication.md +26 -0
  189. package/skills/pixelcraft-patterns/references/creative-tools.md +29 -0
  190. package/skills/pixelcraft-patterns/references/dashboard-admin.md +31 -0
  191. package/skills/pixelcraft-patterns/references/marketing.md +32 -0
  192. package/skills/pixelcraft-patterns/references/pattern-selection.md +74 -0
  193. package/skills/pixelcraft-patterns/references/search-filtering.md +42 -0
  194. package/skills/pixelcraft-patterns/references/settings.md +23 -0
  195. package/skills/pixelcraft-patterns/references/tables-crud.md +43 -0
  196. package/skills/pixelcraft-plan/SKILL.md +67 -0
  197. package/skills/pixelcraft-plan/references/design-input.md +69 -0
  198. package/skills/pixelcraft-plan/references/plan-template.md +99 -0
  199. package/skills/pixelcraft-plan/references/repo-discovery.md +42 -0
  200. package/skills/pixelcraft-plan/references/stack-freshness.md +50 -0
  201. package/skills/pixelcraft-plan/references/stack-selection.md +42 -0
  202. package/skills/pixelcraft-review/SKILL.md +64 -0
  203. package/skills/pixelcraft-review/references/audit-report.md +50 -0
  204. package/skills/pixelcraft-review/references/critique-protocol.md +89 -0
  205. package/skills/pixelcraft-review/references/heuristics.md +18 -0
  206. package/skills/pixelcraft-review/references/personas.md +26 -0
  207. package/skills/pixelcraft-review/references/polish.md +38 -0
  208. package/skills/pixelcraft-review/scripts/fixtures/brand-critique-waivers.json +14 -0
  209. package/skills/pixelcraft-review/scripts/fixtures/brand-critique.css +18 -0
  210. package/skills/pixelcraft-review/scripts/fixtures/clean.html +43 -0
  211. package/skills/pixelcraft-review/scripts/fixtures/focus-after-block.css +4 -0
  212. package/skills/pixelcraft-review/scripts/fixtures/focus-at-rules.css +17 -0
  213. package/skills/pixelcraft-review/scripts/fixtures/focus-comments.css +10 -0
  214. package/skills/pixelcraft-review/scripts/fixtures/focus-html-quote-leak.html +12 -0
  215. package/skills/pixelcraft-review/scripts/fixtures/focus-invalid-replacements.css +27 -0
  216. package/skills/pixelcraft-review/scripts/fixtures/focus-nested-rules.css +19 -0
  217. package/skills/pixelcraft-review/scripts/fixtures/focus-not-visible-skip.css +8 -0
  218. package/skills/pixelcraft-review/scripts/fixtures/focus-outline-shorthands.css +11 -0
  219. package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-and-border.css +15 -0
  220. package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-last-wins.css +19 -0
  221. package/skills/pixelcraft-review/scripts/fixtures/focus-valid-replacements-extended.css +29 -0
  222. package/skills/pixelcraft-review/scripts/fixtures/focus-visible-no-replacement.css +3 -0
  223. package/skills/pixelcraft-review/scripts/fixtures/focus-visible-valid-replacements.css +9 -0
  224. package/skills/pixelcraft-review/scripts/fixtures/slop.html +28 -0
  225. package/skills/pixelcraft-review/scripts/slop-scan.mjs +586 -0
  226. package/skills/pixelcraft-spatial/SKILL.md +52 -0
  227. package/skills/pixelcraft-spatial/references/comfort-accessibility.md +98 -0
  228. package/skills/pixelcraft-spatial/references/platforms.md +77 -0
  229. package/skills/pixelcraft-tokens/SKILL.md +56 -0
  230. package/skills/pixelcraft-tokens/assets/tokens.example.json +71 -0
  231. package/skills/pixelcraft-tokens/assets/tokens.modes.example.json +47 -0
  232. package/skills/pixelcraft-tokens/references/adoption.md +55 -0
  233. package/skills/pixelcraft-tokens/references/format.md +54 -0
  234. package/skills/pixelcraft-tokens/references/governance.md +80 -0
  235. package/skills/pixelcraft-tokens/references/state-tokens.md +62 -0
  236. package/skills/pixelcraft-tokens/references/theme-presets.md +94 -0
  237. package/skills/pixelcraft-tokens/scripts/export-tokens.mjs +285 -0
  238. package/skills/pixelcraft-tui/SKILL.md +60 -0
  239. package/skills/pixelcraft-tui/references/bubbletea-lipgloss.md +60 -0
  240. package/skills/pixelcraft-tui/references/ink.md +60 -0
  241. package/skills/pixelcraft-tui/references/ratatui.md +62 -0
  242. package/skills/pixelcraft-tui/references/rich.md +62 -0
  243. package/skills/pixelcraft-tui/references/textual.md +67 -0
  244. package/skills/pixelcraft-ux/SKILL.md +46 -0
  245. package/skills/pixelcraft-ux/references/cognitive-walkthrough.md +70 -0
  246. package/skills/pixelcraft-ux/references/feedback-performance.md +30 -0
  247. package/skills/pixelcraft-ux/references/flows-ia.md +44 -0
  248. package/skills/pixelcraft-ux/references/forms.md +97 -0
  249. package/skills/pixelcraft-ux/references/i18n.md +183 -0
  250. package/skills/pixelcraft-ux/references/laws.md +18 -0
  251. package/skills/pixelcraft-ux/references/locale-test-matrix.md +60 -0
  252. package/skills/pixelcraft-ux/references/state-matrix.md +39 -0
  253. package/skills/pixelcraft-ux/references/usability-testing.md +84 -0
  254. package/skills/pixelcraft-ux/references/ux-writing.md +43 -0
  255. package/skills/pixelcraft-visual-qa/SKILL.md +82 -0
  256. package/skills/pixelcraft-visual-qa/references/baseline-governance.md +70 -0
  257. package/skills/pixelcraft-visual-qa/references/capture-desktop-game.md +38 -0
  258. package/skills/pixelcraft-visual-qa/references/capture-email.md +34 -0
  259. package/skills/pixelcraft-visual-qa/references/capture-mobile.md +35 -0
  260. package/skills/pixelcraft-visual-qa/references/capture-terminal.md +31 -0
  261. package/skills/pixelcraft-visual-qa/references/critique-rubric.md +71 -0
  262. package/skills/pixelcraft-visual-qa/references/finish-gate.md +35 -0
  263. package/skills/pixelcraft-visual-qa/references/measured-craft.md +30 -0
  264. package/skills/pixelcraft-visual-qa/references/performance-budgets.md +65 -0
  265. package/skills/pixelcraft-visual-qa/references/task-verification.md +81 -0
  266. package/skills/pixelcraft-visual-qa/scripts/finish-gate.mjs +135 -0
  267. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-aria-modal.html +19 -0
  268. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-audit.html +34 -0
  269. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-modal.html +17 -0
  270. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-deferred.js +1 -0
  271. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-edge.html +52 -0
  272. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.html +80 -0
  273. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.js +8 -0
  274. package/skills/pixelcraft-visual-qa/scripts/shoot.mjs +513 -0
  275. package/skills/pixelcraft-visual-qa/scripts/style-inventory.mjs +1154 -0
  276. package/skills/pixelcraft-web/SKILL.md +76 -0
  277. package/skills/pixelcraft-web/references/adaptive-layout.md +25 -0
  278. package/skills/pixelcraft-web/references/angular.md +61 -0
  279. package/skills/pixelcraft-web/references/astro.md +62 -0
  280. package/skills/pixelcraft-web/references/clojurescript.md +53 -0
  281. package/skills/pixelcraft-web/references/elm.md +53 -0
  282. package/skills/pixelcraft-web/references/fsharp-fable.md +53 -0
  283. package/skills/pixelcraft-web/references/html-css.md +88 -0
  284. package/skills/pixelcraft-web/references/htmx-alpine.md +53 -0
  285. package/skills/pixelcraft-web/references/java-web.md +52 -0
  286. package/skills/pixelcraft-web/references/kotlin-web.md +53 -0
  287. package/skills/pixelcraft-web/references/leptos-yew.md +54 -0
  288. package/skills/pixelcraft-web/references/lit-web-components.md +61 -0
  289. package/skills/pixelcraft-web/references/pwa.md +225 -0
  290. package/skills/pixelcraft-web/references/qwik.md +54 -0
  291. package/skills/pixelcraft-web/references/react-next.md +69 -0
  292. package/skills/pixelcraft-web/references/scala-laminar.md +53 -0
  293. package/skills/pixelcraft-web/references/server-rendered.md +71 -0
  294. package/skills/pixelcraft-web/references/solid.md +60 -0
  295. package/skills/pixelcraft-web/references/svelte.md +61 -0
  296. package/skills/pixelcraft-web/references/tailwind.md +73 -0
  297. package/skills/pixelcraft-web/references/vue-nuxt.md +62 -0
@@ -0,0 +1,105 @@
1
+ #!/usr/bin/env node
2
+ import assert from 'node:assert/strict';
3
+ import { spawnSync } from 'node:child_process';
4
+ import fs from 'node:fs';
5
+ import os from 'node:os';
6
+ import path from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
8
+
9
+ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
10
+ const exporter = path.join(root, 'skills/pixelcraft-tokens/scripts/export-tokens.mjs');
11
+ const tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'pixelcraft-export-tokens-'));
12
+
13
+ function run(args, cwd = root) {
14
+ return spawnSync(process.execPath, [exporter, ...args], { encoding: 'utf8', cwd });
15
+ }
16
+
17
+ try {
18
+ const fixture = path.join(tmp, 'tokens.json');
19
+ fs.writeFileSync(fixture, JSON.stringify({
20
+ color: {
21
+ $type: 'color',
22
+ surface: { $value: { colorSpace: 'srgb', components: [1, 1, 1], alpha: 1 } }
23
+ },
24
+ semantic: {
25
+ background: {
26
+ $value: '{color.surface}',
27
+ $extensions: {
28
+ pixelcraft: {
29
+ modes: {
30
+ dark: { $value: { colorSpace: 'srgb', components: [0, 0, 0], alpha: 1 } }
31
+ }
32
+ }
33
+ }
34
+ }
35
+ }
36
+ }, null, 2));
37
+
38
+ const dark = run([fixture, '--format', 'css', '--mode', 'dark']);
39
+ assert.equal(dark.status, 0, dark.stderr);
40
+ assert.match(dark.stdout, /--semantic-background: #000000;/);
41
+ assert.doesNotMatch(dark.stdout, /colorSpace/);
42
+ console.log('ok 1 - mode override inherits the original alias target type');
43
+
44
+ const missingValueCases = [
45
+ [['--format'], /--format requires a value/],
46
+ [['--format='], /--format requires a value/],
47
+ [['--format', '--out-dir', 'x'], /--format requires a value/],
48
+ [['--out-dir'], /--out-dir requires a value/],
49
+ [['--out-dir='], /--out-dir requires a value/],
50
+ [['--mode'], /--mode requires a value/],
51
+ [['--mode='], /--mode requires a value/]
52
+ ];
53
+ for (const [optionArgs, message] of missingValueCases) {
54
+ const missing = run([fixture, ...optionArgs]);
55
+ assert.notEqual(missing.status, 0, `${optionArgs.join(' ')} unexpectedly succeeded`);
56
+ assert.match(missing.stderr, message);
57
+ }
58
+ console.log('ok 2 - missing option values are rejected');
59
+
60
+ const dashOutDir = run([fixture, '--format', 'css', '--mode', 'dark', '--out-dir', '-generated'], tmp);
61
+ assert.equal(dashOutDir.status, 0, dashOutDir.stderr);
62
+ assert.ok(fs.existsSync(path.join(tmp, '-generated', 'tokens.dark.css')), 'dash-prefixed output directory was not used');
63
+ assert.match(dashOutDir.stdout, /wrote -generated[\\/]tokens\.dark\.css/);
64
+ console.log('ok 3 - dash-prefixed option values are accepted');
65
+
66
+ const stringColors = path.join(tmp, 'string-colors.json');
67
+ fs.writeFileSync(stringColors, JSON.stringify({
68
+ color: {
69
+ $type: 'color',
70
+ whiteShort: { $value: '#fff' },
71
+ accentAlpha: { $value: '#ff000080' }
72
+ }
73
+ }, null, 2));
74
+
75
+ const swiftHex = run([stringColors, '--format', 'swift']);
76
+ assert.equal(swiftHex.status, 0, swiftHex.stderr);
77
+ assert.match(swiftHex.stdout, /colorWhiteShort = Color\(red: 1\.0000, green: 1\.0000, blue: 1\.0000, opacity: 1\)/);
78
+ assert.match(swiftHex.stdout, /colorAccentAlpha = Color\(red: 1\.0000, green: 0\.0000, blue: 0\.0000, opacity: 0\.501961\)/);
79
+
80
+ const kotlinHex = run([stringColors, '--format', 'kotlin']);
81
+ assert.equal(kotlinHex.status, 0, kotlinHex.stderr);
82
+ assert.match(kotlinHex.stdout, /val colorWhiteShort = Color\(0xffffffff\)/);
83
+ assert.match(kotlinHex.stdout, /val colorAccentAlpha = Color\(0x80ff0000\)/);
84
+
85
+ const dartHex = run([stringColors, '--format', 'dart']);
86
+ assert.equal(dartHex.status, 0, dartHex.stderr);
87
+ assert.match(dartHex.stdout, /static const Color colorWhiteShort = Color\(0xffffffff\);/);
88
+ assert.match(dartHex.stdout, /static const Color colorAccentAlpha = Color\(0x80ff0000\);/);
89
+ console.log('ok 4 - string hex colors (#rgb/#rrggbbaa) export accurately to Swift, Kotlin, and Dart');
90
+
91
+ const namedColor = path.join(tmp, 'named-color.json');
92
+ fs.writeFileSync(namedColor, JSON.stringify({ color: { $type: 'color', bad: { $value: 'red' } } }));
93
+ const cssNamed = run([namedColor, '--format', 'css']);
94
+ assert.equal(cssNamed.status, 0, cssNamed.stderr);
95
+ for (const nativeFmt of ['swift', 'kotlin', 'dart']) {
96
+ const failed = run([namedColor, '--format', nativeFmt]);
97
+ assert.notEqual(failed.status, 0, `${nativeFmt} should reject non-hex string color`);
98
+ assert.match(failed.stderr, /non-hex string 'red'/);
99
+ }
100
+ console.log('ok 5 - non-hex string colors fail loudly on Swift, Kotlin, and Dart instead of emitting corrupt colors');
101
+
102
+ console.log('token exporter tests passed');
103
+ } finally {
104
+ fs.rmSync(tmp, { recursive: true, force: true });
105
+ }
@@ -0,0 +1,148 @@
1
+ import assert from 'node:assert/strict';
2
+ import fs from 'node:fs';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { spawnSync } from 'node:child_process';
6
+ import { fileURLToPath } from 'node:url';
7
+ import { evaluateEvidence } from '../skills/pixelcraft-visual-qa/scripts/finish-gate.mjs';
8
+
9
+ if (process.argv.includes('--help')) {
10
+ console.log('Usage: node scripts/test-finish-gate.mjs');
11
+ process.exit(0);
12
+ }
13
+
14
+ const evidence = { result: 'pass', label: 'rendered', method: 'local sandbox', expected: 'expected value', observed: 'actual value', artifact: 'evidence.txt' };
15
+ const excluded = { applies: false, reason: 'Interface has no animation or alternative theme' };
16
+ const manifest = {
17
+ schemaVersion: 1, surface: 'responsive-web', target: '/search', revision: 'abc', task: 'Search products', fixture: 'local sandbox',
18
+ applicability: { error: true, empty: true, loading: true, theme: excluded, 'reduced-motion': excluded, 'reflow-320': true },
19
+ layoutMatrix: {
20
+ 'layout-landscape': { width: 844, height: 390 },
21
+ 'layout-short-height': { width: 1280, height: 480 },
22
+ },
23
+ checks: {
24
+ outcome: { ...evidence, assertion: 'Results refresh to one matching item' },
25
+ input: { ...evidence, modality: 'keyboard', focus: 'Tab visibly focuses search, then submit' },
26
+ ...Object.fromEntries([390, 768, 1440].map((width) => [`width-${width}`, { ...evidence, width }])),
27
+ 'layout-landscape': { ...evidence, width: 844, height: 390 },
28
+ 'layout-short-height': { ...evidence, width: 1280, height: 480, artifact: 'before.txt' },
29
+ 'reflow-320': { ...evidence, width: 320 }, error: evidence, empty: evidence, loading: evidence,
30
+ },
31
+ rounds: [],
32
+ };
33
+ const hasArtifact = (value) => ['evidence.txt', 'before.txt'].includes(value);
34
+ assert.equal(evaluateEvidence(manifest, hasArtifact).status, 'PASS');
35
+ const missing = { ...manifest, checks: { ...manifest.checks, outcome: evidence, input: { ...manifest.checks.input, label: 'static' }, 'reflow-320': { ...evidence, width: 390 }, loading: { result: 'not-checked', reason: 'Sandbox offline' } } };
36
+ const unchecked = evaluateEvidence(missing, hasArtifact);
37
+ assert.equal(unchecked.status, 'NOT CHECKED');
38
+ assert.deepEqual(Object.keys(unchecked.notChecked), ['outcome', 'input', 'loading', 'reflow-320']);
39
+ assert.equal(unchecked.notChecked.loading, 'Sandbox offline');
40
+ assert.equal(evaluateEvidence({ ...manifest, applicability: {} }, hasArtifact).status, 'NOT CHECKED');
41
+ assert.equal(evaluateEvidence({ ...manifest, checks: { ...manifest.checks, error: { ...evidence, artifact: 'missing' } } }, hasArtifact).status, 'NOT CHECKED');
42
+ assert.equal(evaluateEvidence({ ...manifest, surface: 'other', layoutMatrix: undefined, checks: { outcome: manifest.checks.outcome, layout: evidence, input: { ...evidence, focus: 'controller focus ring' }, error: evidence, empty: evidence, loading: evidence } }, hasArtifact).status, 'PASS');
43
+ console.log('ok 1 - finish gate requires task, focus, responsive and applicable state evidence');
44
+
45
+ const failed = { ...manifest, checks: { ...manifest.checks, 'critical-overflow': { ...evidence, result: 'fail' } } };
46
+ const round = { failure: 'critical-overflow', reproduction: 'Submit clipped at 390', change: 'Reflow actions', rerun: 'Still clipped on longer locale', before: 'before.txt', after: 'evidence.txt' };
47
+ assert.equal(evaluateEvidence({ ...failed, rounds: [round, round] }, hasArtifact).status, 'FAIL');
48
+ const open = evaluateEvidence({ ...failed, rounds: [round, round, round] }, hasArtifact);
49
+ assert.equal(open.status, 'OPEN');
50
+ assert.equal(open.failures['critical-overflow'].artifact, 'evidence.txt');
51
+ assert.throws(() => evaluateEvidence({ ...failed, rounds: [round, round, round, round] }, hasArtifact), /at most three/);
52
+ const omittedRerun = evaluateEvidence({ ...manifest, rounds: [round, round, round] }, hasArtifact);
53
+ assert.equal(omittedRerun.status, 'NOT CHECKED');
54
+ assert.ok(omittedRerun.notChecked['critical-overflow']);
55
+ const repaired = { ...manifest, checks: { ...manifest.checks, 'critical-overflow': evidence }, rounds: [round, round, round] };
56
+ assert.equal(evaluateEvidence(repaired, hasArtifact).status, 'PASS');
57
+ const skippedRerun = evaluateEvidence({ ...manifest, rounds: [{ ...round, failure: 'theme' }] }, hasArtifact);
58
+ assert.equal(skippedRerun.status, 'NOT CHECKED');
59
+ assert.ok(skippedRerun.notChecked.theme);
60
+ assert.ok(!Object.hasOwn(skippedRerun.notApplicable, 'theme'));
61
+ assert.throws(() => evaluateEvidence({ ...failed, rounds: [{ ...round, after: 'before.txt' }] }, hasArtifact), /distinct before\/after/);
62
+ console.log('ok 2 - gate keeps confirmed failures open after three rounds and requires rerun evidence');
63
+
64
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'pixelcraft-gate-test-'));
65
+ try {
66
+ const file = path.join(dir, 'manifest.json');
67
+ const cli = fileURLToPath(new URL('../skills/pixelcraft-visual-qa/scripts/finish-gate.mjs', import.meta.url));
68
+ const run = (input) => {
69
+ fs.writeFileSync(file, JSON.stringify(input));
70
+ return spawnSync(process.execPath, [cli, file], { encoding: 'utf8' });
71
+ };
72
+ fs.writeFileSync(path.join(dir, 'evidence.txt'), 'sandbox trace');
73
+ fs.writeFileSync(path.join(dir, 'before.txt'), 'prior sandbox trace');
74
+ const good = run(manifest);
75
+ assert.equal(good.status, 0, good.stderr);
76
+ assert.equal(JSON.parse(good.stdout).status, 'PASS');
77
+ const bad = run({ ...failed, rounds: [round, round, round] });
78
+ assert.equal(bad.status, 1, bad.stderr);
79
+ assert.equal(JSON.parse(bad.stdout).status, 'OPEN');
80
+ const external = run({ ...manifest, checks: { ...manifest.checks, error: { ...evidence, artifact: cli } } });
81
+ assert.equal(external.status, 2, external.stderr);
82
+ assert.equal(JSON.parse(external.stdout).status, 'NOT CHECKED');
83
+ } finally {
84
+ fs.rmSync(dir, { recursive: true, force: true });
85
+ }
86
+ console.log('ok 3 - gate exits nonzero for open or unchecked scope and rejects external artifacts');
87
+
88
+ const widthDefect = { ...evidence, result: 'fail', width: 390 };
89
+ const scopedRound = { ...round, failure: 'width-390-submit' };
90
+ const scopedDefect = { ...manifest, rounds: [scopedRound, scopedRound, scopedRound],
91
+ checks: { ...manifest.checks, 'width-390-submit': widthDefect } };
92
+ const scopedOpen = evaluateEvidence(scopedDefect, hasArtifact);
93
+ assert.equal(scopedOpen.status, 'OPEN');
94
+ assert.equal(scopedOpen.failures['width-390-submit'].artifact, 'evidence.txt');
95
+ const wrongWidth = evaluateEvidence({ ...scopedDefect,
96
+ checks: { ...scopedDefect.checks, 'width-390-submit': { ...widthDefect, width: 768 } } }, hasArtifact);
97
+ assert.equal(wrongWidth.status, 'NOT CHECKED');
98
+ assert.ok(wrongWidth.notChecked['width-390-submit']);
99
+ console.log('ok 4 - width-scoped defect IDs require the viewport encoded in their prefix');
100
+
101
+ const malformedWidth = evaluateEvidence({ ...manifest, checks: { ...manifest.checks,
102
+ 'width-390px-submit': { ...evidence, width: 768 } } }, hasArtifact);
103
+ assert.equal(malformedWidth.status, 'NOT CHECKED');
104
+ assert.ok(malformedWidth.notChecked['width-390px-submit']);
105
+ console.log('ok 5 - malformed width IDs cannot bypass viewport validation');
106
+
107
+ const adaptive = { ...manifest, layoutMatrix: { ...manifest.layoutMatrix, 'layout-ultrawide': { width: 2560, height: 1080 } } };
108
+ const omittedMatrix = evaluateEvidence({ ...manifest, layoutMatrix: undefined }, hasArtifact);
109
+ assert.equal(omittedMatrix.status, 'NOT CHECKED');
110
+ assert.deepEqual(Object.keys(omittedMatrix.notChecked), ['layout-landscape', 'layout-short-height']);
111
+ const uncheckedClass = evaluateEvidence(adaptive, hasArtifact);
112
+ assert.equal(uncheckedClass.status, 'NOT CHECKED');
113
+ assert.ok(uncheckedClass.notChecked['layout-ultrawide']);
114
+ const wrongHeight = evaluateEvidence({ ...manifest, checks: {
115
+ ...manifest.checks, 'layout-short-height': { ...manifest.checks['layout-short-height'], height: 900 },
116
+ } }, hasArtifact);
117
+ assert.equal(wrongHeight.status, 'NOT CHECKED');
118
+ assert.ok(wrongHeight.notChecked['layout-short-height']);
119
+ const excludedClass = evaluateEvidence({ ...adaptive, layoutMatrix: {
120
+ ...adaptive.layoutMatrix, 'layout-ultrawide': { applies: false, reason: 'This product is limited to the embedded host window' },
121
+ } }, hasArtifact);
122
+ assert.equal(excludedClass.status, 'PASS');
123
+ assert.ok(excludedClass.notApplicable['layout-ultrawide']);
124
+ console.log('ok 6 - responsive evidence requires landscape, short height, and every declared layout at matching dimensions');
125
+
126
+ const desktop = { ...manifest.checks['width-1440'], height: 900 };
127
+ const desktopAsShort = evaluateEvidence({
128
+ ...manifest,
129
+ layoutMatrix: { ...manifest.layoutMatrix, 'layout-short-height': { width: 1440, height: 900 } },
130
+ checks: { ...manifest.checks, 'width-1440': desktop, 'layout-short-height': desktop },
131
+ }, hasArtifact);
132
+ assert.equal(desktopAsShort.status, 'NOT CHECKED');
133
+ assert.match(desktopAsShort.notChecked['layout-short-height'], /below 600 CSS px/);
134
+ for (const [height, status] of [[600, 'NOT CHECKED'], [599, 'PASS']]) {
135
+ const atBoundary = evaluateEvidence({
136
+ ...manifest,
137
+ layoutMatrix: { ...manifest.layoutMatrix, 'layout-short-height': { width: 1440, height } },
138
+ checks: { ...manifest.checks, 'layout-short-height': { ...manifest.checks['layout-short-height'], width: 1440, height } },
139
+ }, hasArtifact);
140
+ assert.equal(atBoundary.status, status);
141
+ }
142
+ const reusesDesktopArtifact = evaluateEvidence({
143
+ ...manifest,
144
+ checks: { ...manifest.checks, 'layout-short-height': { ...manifest.checks['layout-short-height'], artifact: './evidence.txt' } },
145
+ }, (artifact) => hasArtifact(artifact.replace(/^\.\//, '')));
146
+ assert.equal(reusesDesktopArtifact.status, 'NOT CHECKED');
147
+ assert.match(reusesDesktopArtifact.notChecked['layout-short-height'], /separate artifact/);
148
+ console.log('ok 7 - regular desktop evidence cannot satisfy the short-height check');
@@ -0,0 +1,67 @@
1
+ import assert from 'node:assert/strict';
2
+ import { spawnSync } from 'node:child_process';
3
+ import fs from 'node:fs';
4
+ import os from 'node:os';
5
+ import path from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+
8
+ if (process.argv.includes('--help')) {
9
+ console.log('Usage: node scripts/test-installers.mjs [--shell|--powershell]');
10
+ process.exit(0);
11
+ }
12
+
13
+ const root = fileURLToPath(new URL('..', import.meta.url));
14
+ const destination = fs.mkdtempSync(path.join(os.tmpdir(), 'pixelcraft-installers-'));
15
+ const run = (command, args, cwd = destination) => {
16
+ const result = spawnSync(command, args, { cwd, encoding: 'utf8', timeout: 30000 });
17
+ assert.equal(result.status, 0, result.error?.message ?? result.stderr);
18
+ return result.stdout;
19
+ };
20
+ const assertGuidance = (command, args, flag) => {
21
+ assert.doesNotMatch(run(command, args), /context7/i);
22
+ const output = run(command, [...args, flag]);
23
+ assert.match(output, /dry-run: .*pixelcraft-plan/);
24
+ assert.match(output, /https:\/\/github\.com\/upstash\/context7#readme/);
25
+ assert.deepEqual(fs.readdirSync(destination), []);
26
+ };
27
+ const harnesses = 'kiro,cline,roo,droid,antigravity,goose,amp,zed';
28
+ const assertHarnessPaths = (output) => {
29
+ const portableOutput = output.replaceAll('\\', '/');
30
+ for (const prefix of ['.kiro/skills', '.cline/skills', '.roo/skills', '.factory/skills', '.agents/skills']) {
31
+ assert.ok(portableOutput.includes(`/${prefix}/pixelcraft-plan`), prefix);
32
+ }
33
+ assert.ok(portableOutput.includes('/.kiro/steering/pixelcraft.md'));
34
+ assert.equal(portableOutput.split('/.agents/skills/pixelcraft-plan').length, 2);
35
+ assert.deepEqual(fs.readdirSync(destination), []);
36
+ };
37
+
38
+ try {
39
+ assertGuidance(process.execPath, [path.join(root, 'bin/pixelcraft.mjs'), 'add', 'pixelcraft-plan', '--agent', 'agents', '--dry-run'], '--docs-mcp');
40
+ console.log('ok - Node installer only prints MCP guidance on opt-in and dry-run leaves the workspace unchanged');
41
+ assertHarnessPaths(run(process.execPath, [path.join(root, 'bin/pixelcraft.mjs'), 'add', 'pixelcraft-plan', '--agent', harnesses, '--dry-run']));
42
+ console.log('ok - Node installer maps native harnesses and deduplicates shared project skills');
43
+ if (process.argv.includes('--shell')) {
44
+ const archive = `${destination}.tar.gz`;
45
+ try {
46
+ run('git', ['archive', '--format=tar.gz', `--output=${archive}`, '--prefix=Pixelcraft-test/', 'HEAD', 'skills'], root);
47
+ assertGuidance('bash', [path.join(root, 'install.sh'), '--archive', archive, '--skills', 'pixelcraft-plan', '--dry-run'], '--docs-mcp');
48
+ assertHarnessPaths(run('bash', [path.join(root, 'install.sh'), '--archive', archive, '--skills', 'pixelcraft-plan', '--agent', harnesses, '--dry-run']));
49
+ console.log('ok - Bash installer accepts a local archive and opt-in guidance without writing');
50
+ } finally {
51
+ fs.rmSync(archive, { force: true });
52
+ }
53
+ }
54
+ if (process.argv.includes('--powershell')) {
55
+ const archive = `${destination}.zip`;
56
+ try {
57
+ run('git', ['archive', '--format=zip', `--output=${archive}`, '--prefix=Pixelcraft-test/', 'HEAD', 'skills'], root);
58
+ assertGuidance('pwsh', ['-NoProfile', '-File', path.join(root, 'install.ps1'), '-Archive', archive, '-Skill', 'pixelcraft-plan', '-DryRun'], '-DocsMcp');
59
+ assertHarnessPaths(run('pwsh', ['-NoProfile', '-File', path.join(root, 'install.ps1'), '-Archive', archive, '-Skill', 'pixelcraft-plan', '-Agent', harnesses, '-DryRun']));
60
+ console.log('ok - PowerShell installer accepts a local archive and opt-in guidance without writing');
61
+ } finally {
62
+ fs.rmSync(archive, { force: true });
63
+ }
64
+ }
65
+ } finally {
66
+ fs.rmSync(destination, { recursive: true, force: true });
67
+ }
@@ -0,0 +1,42 @@
1
+ import assert from 'node:assert/strict';
2
+ import { execFileSync } from 'node:child_process';
3
+ import { createHash } from 'node:crypto';
4
+ import fs from 'node:fs';
5
+ import os from 'node:os';
6
+ import path from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
8
+
9
+ if (process.argv.includes('--help')) {
10
+ console.log('Usage: node scripts/test-release-archives.mjs');
11
+ process.exit(0);
12
+ }
13
+
14
+ const script = fileURLToPath(new URL('./build-release-archives.mjs', import.meta.url));
15
+ const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'pixelcraft-release-test-'));
16
+ const names = ['pixelcraft-skills.zip', 'pixelcraft-skills.tar.gz'];
17
+
18
+ function build(output, tz, umask) {
19
+ const previous = process.umask(umask);
20
+ try {
21
+ execFileSync(process.execPath, [script, output], { env: { ...process.env, TZ: tz } });
22
+ } finally {
23
+ process.umask(previous);
24
+ }
25
+ return names.map((name) => createHash('sha256').update(fs.readFileSync(path.join(output, name))).digest('hex'));
26
+ }
27
+
28
+ try {
29
+ const first = path.join(scratch, 'first');
30
+ const second = path.join(scratch, 'second');
31
+ const expected = build(first, 'Pacific/Honolulu', 0o022);
32
+ Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 2100);
33
+ assert.deepEqual(build(second, 'Asia/Tokyo', 0o077), expected);
34
+ for (const [command, args] of [['unzip', ['-Z1', path.join(first, names[0])]], ['tar', ['-tzf', path.join(first, names[1])]]]) {
35
+ const entries = execFileSync(command, args, { encoding: 'utf8' }).split('\n');
36
+ assert.ok(entries.includes('skills/pixelcraft/SKILL.md'));
37
+ assert.ok(entries.includes('adapters/manifest.json'));
38
+ }
39
+ console.log('ok - both release archives have identical SHA-256 checksums across independent builds');
40
+ } finally {
41
+ fs.rmSync(scratch, { recursive: true, force: true });
42
+ }
@@ -0,0 +1,65 @@
1
+ import assert from 'node:assert/strict';
2
+ import fs from 'node:fs';
3
+ import os from 'node:os';
4
+ import path from 'node:path';
5
+ import { spawnSync } from 'node:child_process';
6
+ import { fileURLToPath } from 'node:url';
7
+
8
+ if (process.argv.includes('--help')) {
9
+ console.log('Usage: node scripts/test-shoot.mjs');
10
+ process.exit(0);
11
+ }
12
+
13
+ const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'pixelcraft-shoot-test-'));
14
+ try {
15
+ const local = (file) => fileURLToPath(new URL(`../skills/pixelcraft-visual-qa/scripts/${file}`, import.meta.url));
16
+ const run = (fixture, ...options) => spawnSync(process.execPath, [
17
+ local('shoot.mjs'), local(`fixtures/${fixture}`), '--out', dir, '--project',
18
+ process.env.PIXELCRAFT_TEST_PLAYWRIGHT_PROJECT ?? process.cwd(), '--breakpoints=390x844,768x1024',
19
+ '--light-only', '--no-reduced-motion', '--wait-ms=100', ...options,
20
+ ], { encoding: 'utf8', timeout: 30000 });
21
+ const result = run('shoot-audit.html', '--keyboard');
22
+ if (result.status === 2 && /Playwright is not installed/.test(result.stderr) && !process.env.PIXELCRAFT_TEST_PLAYWRIGHT_PROJECT) {
23
+ console.log('SKIP - Playwright not installed; set PIXELCRAFT_TEST_PLAYWRIGHT_PROJECT to verify browser diagnostics');
24
+ } else {
25
+ assert.equal(result.status, 0, `${result.error ?? ''}\n${result.stdout}\n${result.stderr}`);
26
+ const [narrow, wide] = JSON.parse(fs.readFileSync(path.join(dir, 'report.json'), 'utf8')).captures;
27
+ const has = (capture, type, id) => capture.findings.some((item) => item.type === type && (!id || item.element?.endsWith(`#${id}`)));
28
+ for (const [type, bad, good] of [
29
+ ['broken-image', 'broken', 'valid'],
30
+ ['content-hidden-at-rest', 'hidden-essential', 'closed'],
31
+ ['text-occlusion', 'occluded', 'not-occluded'],
32
+ ['low-contrast-text', 'low-contrast', 'readable'],
33
+ ['keyboard-focus-not-detected', 'focusless', 'focus-ring'],
34
+ ]) {
35
+ assert.ok(has(wide, type, bad), `expected ${type} for ${bad}: ${JSON.stringify(wide.findings)}`);
36
+ assert.ok(!has(wide, type, good), `unexpected ${type} for ${good}`);
37
+ }
38
+ assert.ok(!has(wide, 'broken-image', 'hidden-image'));
39
+ assert.ok(!has(wide, 'content-hidden-at-rest', 'closed-dialog'));
40
+ assert.ok(has(narrow, 'horizontal-overflow'));
41
+ assert.ok(!has(wide, 'horizontal-overflow'));
42
+ assert.deepEqual(wide.keyboard.slice(0, 2), [
43
+ { element: 'button#focusless', indicator: 'not-detected' },
44
+ { element: 'button#focus-ring', indicator: 'style-change' },
45
+ ]);
46
+ console.log('ok 1 - actual browser distinguishes broken images, hidden content, occlusion, overflow, contrast and focus controls');
47
+ const modal = run('shoot-modal.html', '--breakpoints=768x1024');
48
+ assert.equal(modal.status, 0, `${modal.error ?? ''}\n${modal.stdout}\n${modal.stderr}`);
49
+ const [dialog] = JSON.parse(fs.readFileSync(path.join(dir, 'report.json'), 'utf8')).captures;
50
+ assert.ok(has(dialog, 'text-occlusion', 'occluded-modal'), 'expected occlusion inside a visible modal');
51
+ assert.ok(!has(dialog, 'text-occlusion', 'readable-modal'));
52
+ assert.ok(!has(dialog, 'text-occlusion', 'behind-modal'));
53
+ console.log('ok 2 - visible modal detects internal occlusion without flagging its intentional background coverage');
54
+ const ariaModal = run('shoot-aria-modal.html');
55
+ assert.equal(ariaModal.status, 0, `${ariaModal.error ?? ''}\n${ariaModal.stdout}\n${ariaModal.stderr}`);
56
+ const [hiddenAriaDialog, ariaDialog] = JSON.parse(fs.readFileSync(path.join(dir, 'report.json'), 'utf8')).captures;
57
+ assert.ok(has(hiddenAriaDialog, 'text-occlusion', 'behind-aria-modal'), 'fixed overlay is a defect when the sibling modal is hidden');
58
+ assert.ok(has(ariaDialog, 'text-occlusion', 'occluded-aria-modal'));
59
+ assert.ok(!has(ariaDialog, 'text-occlusion', 'readable-aria-modal'));
60
+ assert.ok(!has(ariaDialog, 'text-occlusion', 'behind-aria-modal'), 'sibling backdrop intentionally covers background text');
61
+ console.log('ok 3 - open ARIA modal distinguishes sibling backdrop from internal occlusion');
62
+ }
63
+ } finally {
64
+ fs.rmSync(dir, { recursive: true, force: true });
65
+ }
@@ -0,0 +1,29 @@
1
+ import assert from 'node:assert/strict';
2
+ import { spawnSync } from 'node:child_process';
3
+ import { fileURLToPath } from 'node:url';
4
+
5
+ if (process.argv.includes('--help')) {
6
+ console.log('Usage: node scripts/test-slop-scan.mjs');
7
+ process.exit(0);
8
+ }
9
+
10
+ const base = new URL('../skills/pixelcraft-review/scripts/', import.meta.url);
11
+ const local = (relative) => fileURLToPath(new URL(relative, base));
12
+ const run = (file, ...args) => {
13
+ const result = spawnSync(process.execPath, [local('slop-scan.mjs'), local(`fixtures/${file}`), '--json', ...args], { encoding: 'utf8' });
14
+ assert.equal(result.status, 0, result.stderr);
15
+ return JSON.parse(result.stdout);
16
+ };
17
+ assert.equal(run('slop.html').score, 40);
18
+ assert.equal(run('clean.html').score, 0);
19
+ const { findings } = run('brand-critique.css');
20
+ assert.deepEqual(findings.map(({ rule, line }) => [rule, line]), [
21
+ ['gradient-text-treatment', 3], ['rounded-accent-rail', 8],
22
+ ]);
23
+ console.log('ok 1 - advisory rules flag decorative forms, not plain styles, and preserve prior scores');
24
+ const waived = run('brand-critique.css', '--waivers', local('fixtures/brand-critique-waivers.json'));
25
+ assert.deepEqual(waived.findings.map(({ rule }) => rule), ['rounded-accent-rail']);
26
+ assert.equal(waived.waived[0].label, 'waived');
27
+ assert.match(waived.waived[0].reason, /approved wordmark/i);
28
+ assert.equal(waived.unusedWaivers[0].line, 17);
29
+ console.log('ok 2 - scoped brand waiver preserves the evidence and reports stale waivers');