@thanhnguyxn/pixelcraft 0.0.0-stage → 0.2.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 (455) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/.antigravity-plugin/plugin.json +32 -0
  3. package/.claude-plugin/marketplace.json +20 -0
  4. package/.claude-plugin/plugin.json +22 -0
  5. package/.codex-plugin/plugin.json +45 -0
  6. package/.cursor-plugin/marketplace.json +17 -0
  7. package/.cursor-plugin/plugin.json +27 -0
  8. package/.devin-plugin/plugin.json +21 -0
  9. package/.github/plugin/marketplace.json +34 -0
  10. package/CHANGELOG.md +159 -0
  11. package/GEMINI.md +1 -0
  12. package/LICENSE +21 -0
  13. package/README.md +264 -2
  14. package/SECURITY.md +28 -0
  15. package/assets/README.md +28 -0
  16. package/assets/pixelcraft-logo-128.png +0 -0
  17. package/assets/pixelcraft-logo-256.png +0 -0
  18. package/assets/pixelcraft-logo-512.png +0 -0
  19. package/bin/pixelcraft.mjs +852 -0
  20. package/docs/ARCHITECTURE.md +105 -0
  21. package/docs/DESIGN-RATIONALE.md +191 -0
  22. package/docs/INSTALL.md +221 -0
  23. package/evals/README.md +37 -0
  24. package/evals/fixtures/3d-web-engineering.json +69 -0
  25. package/evals/fixtures/README.md +36 -0
  26. package/evals/fixtures/acceptance-checklist-rule03-gate.json +43 -0
  27. package/evals/fixtures/ai-ui-libraries.json +53 -0
  28. package/evals/fixtures/audio-visual-accessibility.json +69 -0
  29. package/evals/fixtures/auth-and-checkout-ui.json +53 -0
  30. package/evals/fixtures/brandkit-identity-governance.json +48 -0
  31. package/evals/fixtures/build-and-architecture.json +53 -0
  32. package/evals/fixtures/canvas-and-node-editors.json +53 -0
  33. package/evals/fixtures/chat-ai-exfiltration-ime-hitl-gate.json +43 -0
  34. package/evals/fixtures/completion-gate-scan-until-clean.json +44 -0
  35. package/evals/fixtures/component-systems.json +53 -0
  36. package/evals/fixtures/component-testing.json +53 -0
  37. package/evals/fixtures/constrained-voice-and-tv.json +43 -0
  38. package/evals/fixtures/creative-code-rendering.json +69 -0
  39. package/evals/fixtures/creative-reference-evidence.json +67 -0
  40. package/evals/fixtures/data-app-python-marimo.json +49 -0
  41. package/evals/fixtures/desktop-cpp-juce-audio.json +49 -0
  42. package/evals/fixtures/desktop-csharp-avalonia.json +49 -0
  43. package/evals/fixtures/desktop-native-workspace.json +48 -0
  44. package/evals/fixtures/desktop-python-anti-tkinter.json +49 -0
  45. package/evals/fixtures/direction-prototype-complexity.json +29 -0
  46. package/evals/fixtures/document-prepress-pdfx4-tounicode.json +43 -0
  47. package/evals/fixtures/document-rust-typst-invoice.json +49 -0
  48. package/evals/fixtures/document-typst-and-print-css.json +43 -0
  49. package/evals/fixtures/email-mjml-dark-mode.json +49 -0
  50. package/evals/fixtures/email-outlook-and-plaintext.json +43 -0
  51. package/evals/fixtures/enterprise-data-ui.json +53 -0
  52. package/evals/fixtures/extended-tui-toolkits.json +53 -0
  53. package/evals/fixtures/extensions-mv3-and-vscode.json +43 -0
  54. package/evals/fixtures/file-upload-media-ui.json +53 -0
  55. package/evals/fixtures/finish-gate-anti-slop.json +30 -0
  56. package/evals/fixtures/forms-accessibility-negative.json +29 -0
  57. package/evals/fixtures/forms-validation.json +53 -0
  58. package/evals/fixtures/game-go-ebitengine.json +49 -0
  59. package/evals/fixtures/game-godot-gdscript.json +49 -0
  60. package/evals/fixtures/game-ui-hud-and-engines.json +43 -0
  61. package/evals/fixtures/handoff-fidelity-tolerance.json +29 -0
  62. package/evals/fixtures/i18n-engineering.json +53 -0
  63. package/evals/fixtures/local-first-sync.json +53 -0
  64. package/evals/fixtures/lynxjs.json +53 -0
  65. package/evals/fixtures/maizzle-email.json +53 -0
  66. package/evals/fixtures/maps-geospatial.json +53 -0
  67. package/evals/fixtures/media-og-and-video-export.json +43 -0
  68. package/evals/fixtures/media-players.json +53 -0
  69. package/evals/fixtures/mobile-compose-16kb-foldable-store-gate.json +44 -0
  70. package/evals/fixtures/mobile-elixir-liveview-native.json +49 -0
  71. package/evals/fixtures/mobile-flutter-dynamic-type.json +49 -0
  72. package/evals/fixtures/mobile-harmonyos-arkui.json +49 -0
  73. package/evals/fixtures/mobile-jetpack-compose.json +49 -0
  74. package/evals/fixtures/mobile-swiftui-ios.json +49 -0
  75. package/evals/fixtures/motion-engineering.json +69 -0
  76. package/evals/fixtures/pdfjs-and-pptx.json +53 -0
  77. package/evals/fixtures/plan-brownfield-evidence.json +28 -0
  78. package/evals/fixtures/plan-discovery-interview.json +31 -0
  79. package/evals/fixtures/plan-grill-me-brainstorm-gate.json +49 -0
  80. package/evals/fixtures/reactive-data-apps.json +53 -0
  81. package/evals/fixtures/review-evidence-audit.json +43 -0
  82. package/evals/fixtures/rich-text-and-code-editors.json +53 -0
  83. package/evals/fixtures/scrollytelling-resilience.json +70 -0
  84. package/evals/fixtures/spatial-xr-comfort-and-platforms.json +43 -0
  85. package/evals/fixtures/state-architecture.json +53 -0
  86. package/evals/fixtures/styling-ecosystem.json +53 -0
  87. package/evals/fixtures/token-tooling.json +53 -0
  88. package/evals/fixtures/tui-go-bubbletea.json +49 -0
  89. package/evals/fixtures/tui-rust-ratatui-grapheme-paste-teardown.json +44 -0
  90. package/evals/fixtures/tui-rust-ratatui.json +49 -0
  91. package/evals/fixtures/ux-state-matrix-and-i18n.json +43 -0
  92. package/evals/fixtures/visual-qa-task-evidence.json +29 -0
  93. package/evals/fixtures/web-3d-engines.json +53 -0
  94. package/evals/fixtures/web-php-laravel-filament.json +49 -0
  95. package/evals/fixtures/web-ruby-viewcomponent-phlex.json +49 -0
  96. package/evals/fixtures/workflow-checkpoints.json +30 -0
  97. package/evals/pixelcraft-accessibility.md +74 -0
  98. package/evals/pixelcraft-brandkit.md +58 -0
  99. package/evals/pixelcraft-chat-ui.md +55 -0
  100. package/evals/pixelcraft-constrained.md +55 -0
  101. package/evals/pixelcraft-craft.md +76 -0
  102. package/evals/pixelcraft-data-apps.md +55 -0
  103. package/evals/pixelcraft-dataviz.md +59 -0
  104. package/evals/pixelcraft-desktop.md +55 -0
  105. package/evals/pixelcraft-direction.md +77 -0
  106. package/evals/pixelcraft-document.md +55 -0
  107. package/evals/pixelcraft-email.md +55 -0
  108. package/evals/pixelcraft-extensions.md +55 -0
  109. package/evals/pixelcraft-game-ui.md +59 -0
  110. package/evals/pixelcraft-handoff.md +57 -0
  111. package/evals/pixelcraft-media.md +55 -0
  112. package/evals/pixelcraft-mobile.md +59 -0
  113. package/evals/pixelcraft-patterns.md +73 -0
  114. package/evals/pixelcraft-plan.md +127 -0
  115. package/evals/pixelcraft-review.md +63 -0
  116. package/evals/pixelcraft-spatial.md +55 -0
  117. package/evals/pixelcraft-tokens.md +57 -0
  118. package/evals/pixelcraft-tui.md +55 -0
  119. package/evals/pixelcraft-ux.md +59 -0
  120. package/evals/pixelcraft-visual-qa.md +86 -0
  121. package/evals/pixelcraft-web.md +89 -0
  122. package/evals/pixelcraft.md +70 -0
  123. package/gemini-extension.json +6 -0
  124. package/install.ps1 +341 -0
  125. package/install.sh +512 -0
  126. package/package.json +91 -4
  127. package/plugin.json +29 -0
  128. package/scripts/build-adapters.mjs +288 -0
  129. package/scripts/build-release-archives.mjs +61 -0
  130. package/scripts/build-skill-zips.mjs +94 -0
  131. package/scripts/run-evals.mjs +397 -0
  132. package/scripts/sync-docs.mjs +381 -0
  133. package/scripts/test-build-adapters.mjs +61 -0
  134. package/scripts/test-cross-platform-qa.mjs +359 -0
  135. package/scripts/test-distribution.mjs +203 -0
  136. package/scripts/test-export-tokens.mjs +361 -0
  137. package/scripts/test-finish-gate.mjs +271 -0
  138. package/scripts/test-installers.mjs +216 -0
  139. package/scripts/test-release-archives.mjs +42 -0
  140. package/scripts/test-shoot.mjs +87 -0
  141. package/scripts/test-slop-scan.mjs +416 -0
  142. package/scripts/test-style-inventory.mjs +234 -0
  143. package/scripts/test-sync-docs.mjs +140 -0
  144. package/scripts/test-validate-skills.mjs +195 -0
  145. package/scripts/validate-skills.mjs +658 -0
  146. package/skills/pixelcraft/SKILL.md +155 -0
  147. package/skills/pixelcraft/references/design-brief.md +75 -0
  148. package/skills/pixelcraft/references/floor.md +90 -0
  149. package/skills/pixelcraft/references/report-template.md +49 -0
  150. package/skills/pixelcraft/references/stack-detection.md +226 -0
  151. package/skills/pixelcraft/references/surface-acceptance.md +52 -0
  152. package/skills/pixelcraft/references/workflow-checkpoints.md +71 -0
  153. package/skills/pixelcraft-accessibility/SKILL.md +54 -0
  154. package/skills/pixelcraft-accessibility/references/apg-patterns.md +64 -0
  155. package/skills/pixelcraft-accessibility/references/motion-canvas.md +57 -0
  156. package/skills/pixelcraft-accessibility/references/platforms.md +86 -0
  157. package/skills/pixelcraft-accessibility/references/verification.md +64 -0
  158. package/skills/pixelcraft-accessibility/references/wcag22-checks.md +99 -0
  159. package/skills/pixelcraft-brandkit/SKILL.md +127 -0
  160. package/skills/pixelcraft-brandkit/references/asset-pipeline.md +165 -0
  161. package/skills/pixelcraft-brandkit/references/brand-governance.md +82 -0
  162. package/skills/pixelcraft-brandkit/references/layouts.md +88 -0
  163. package/skills/pixelcraft-brandkit/references/logo-concepting.md +83 -0
  164. package/skills/pixelcraft-brandkit/references/logo-methods.md +97 -0
  165. package/skills/pixelcraft-brandkit/references/pixel-art-logos.md +82 -0
  166. package/skills/pixelcraft-brandkit/references/prompt-template.md +87 -0
  167. package/skills/pixelcraft-brandkit/references/qa-checklist.md +93 -0
  168. package/skills/pixelcraft-brandkit/references/visual-modes.md +123 -0
  169. package/skills/pixelcraft-chat-ui/SKILL.md +57 -0
  170. package/skills/pixelcraft-chat-ui/references/agentic-workspace.md +66 -0
  171. package/skills/pixelcraft-chat-ui/references/ai-ui-libraries.md +259 -0
  172. package/skills/pixelcraft-chat-ui/references/conversation-design.md +84 -0
  173. package/skills/pixelcraft-chat-ui/references/mobile-business-platforms.md +77 -0
  174. package/skills/pixelcraft-chat-ui/references/slack-discord.md +80 -0
  175. package/skills/pixelcraft-constrained/SKILL.md +52 -0
  176. package/skills/pixelcraft-constrained/references/specialized-hardware.md +90 -0
  177. package/skills/pixelcraft-constrained/references/tv-wearables.md +134 -0
  178. package/skills/pixelcraft-constrained/references/voice-ui.md +104 -0
  179. package/skills/pixelcraft-craft/SKILL.md +58 -0
  180. package/skills/pixelcraft-craft/references/color.md +125 -0
  181. package/skills/pixelcraft-craft/references/imagery-icons.md +37 -0
  182. package/skills/pixelcraft-craft/references/layout-quality.md +65 -0
  183. package/skills/pixelcraft-craft/references/layout.md +73 -0
  184. package/skills/pixelcraft-craft/references/motion.md +163 -0
  185. package/skills/pixelcraft-craft/references/typography.md +110 -0
  186. package/skills/pixelcraft-data-apps/SKILL.md +86 -0
  187. package/skills/pixelcraft-data-apps/references/ai-and-internal-data-apps.md +147 -0
  188. package/skills/pixelcraft-data-apps/references/dash.md +109 -0
  189. package/skills/pixelcraft-data-apps/references/evidence.md +90 -0
  190. package/skills/pixelcraft-data-apps/references/gradio.md +103 -0
  191. package/skills/pixelcraft-data-apps/references/julia-genie.md +89 -0
  192. package/skills/pixelcraft-data-apps/references/jupyter-widgets.md +91 -0
  193. package/skills/pixelcraft-data-apps/references/nicegui.md +102 -0
  194. package/skills/pixelcraft-data-apps/references/observable-framework.md +105 -0
  195. package/skills/pixelcraft-data-apps/references/panel.md +99 -0
  196. package/skills/pixelcraft-data-apps/references/r-shiny.md +124 -0
  197. package/skills/pixelcraft-data-apps/references/reactive-data-apps.md +186 -0
  198. package/skills/pixelcraft-data-apps/references/reflex.md +116 -0
  199. package/skills/pixelcraft-data-apps/references/shiny.md +110 -0
  200. package/skills/pixelcraft-data-apps/references/streamlit.md +113 -0
  201. package/skills/pixelcraft-dataviz/SKILL.md +60 -0
  202. package/skills/pixelcraft-dataviz/references/chart-choice.md +55 -0
  203. package/skills/pixelcraft-dataviz/references/color-accessibility.md +112 -0
  204. package/skills/pixelcraft-dataviz/references/encoding-tables-dashboards.md +107 -0
  205. package/skills/pixelcraft-dataviz/references/libraries.md +176 -0
  206. package/skills/pixelcraft-dataviz/references/maps-geospatial.md +159 -0
  207. package/skills/pixelcraft-dataviz/references/realtime-graphs-maps-scale.md +92 -0
  208. package/skills/pixelcraft-desktop/SKILL.md +93 -0
  209. package/skills/pixelcraft-desktop/references/appkit.md +92 -0
  210. package/skills/pixelcraft-desktop/references/avalonia.md +95 -0
  211. package/skills/pixelcraft-desktop/references/cpp-gui.md +129 -0
  212. package/skills/pixelcraft-desktop/references/electron.md +96 -0
  213. package/skills/pixelcraft-desktop/references/go-gui.md +83 -0
  214. package/skills/pixelcraft-desktop/references/gtk.md +97 -0
  215. package/skills/pixelcraft-desktop/references/javafx-swing.md +81 -0
  216. package/skills/pixelcraft-desktop/references/qt-pyside-qml.md +88 -0
  217. package/skills/pixelcraft-desktop/references/rust-gui.md +83 -0
  218. package/skills/pixelcraft-desktop/references/tauri.md +110 -0
  219. package/skills/pixelcraft-desktop/references/uno-platform.md +71 -0
  220. package/skills/pixelcraft-desktop/references/winui-wpf.md +98 -0
  221. package/skills/pixelcraft-desktop/references/working-context.md +84 -0
  222. package/skills/pixelcraft-direction/SKILL.md +120 -0
  223. package/skills/pixelcraft-direction/references/composition-library.md +84 -0
  224. package/skills/pixelcraft-direction/references/creative-brainstorming.md +72 -0
  225. package/skills/pixelcraft-direction/references/direction-card.md +64 -0
  226. package/skills/pixelcraft-direction/references/direction-scoring.md +76 -0
  227. package/skills/pixelcraft-direction/references/motion-identity.md +67 -0
  228. package/skills/pixelcraft-direction/references/movements.md +71 -0
  229. package/skills/pixelcraft-direction/references/reference-analysis.md +37 -0
  230. package/skills/pixelcraft-direction/references/repetition-history.md +75 -0
  231. package/skills/pixelcraft-direction/references/slop-fingerprints.md +83 -0
  232. package/skills/pixelcraft-direction/references/wildcards.md +47 -0
  233. package/skills/pixelcraft-document/SKILL.md +58 -0
  234. package/skills/pixelcraft-document/references/archetypes.md +106 -0
  235. package/skills/pixelcraft-document/references/pdf-tools.md +314 -0
  236. package/skills/pixelcraft-document/references/pdfjs-and-pptx.md +114 -0
  237. package/skills/pixelcraft-document/references/print-css.md +187 -0
  238. package/skills/pixelcraft-document/references/slides.md +198 -0
  239. package/skills/pixelcraft-email/SKILL.md +80 -0
  240. package/skills/pixelcraft-email/references/client-quirks.md +113 -0
  241. package/skills/pixelcraft-email/references/html-tables.md +114 -0
  242. package/skills/pixelcraft-email/references/maizzle.md +54 -0
  243. package/skills/pixelcraft-email/references/mjml.md +54 -0
  244. package/skills/pixelcraft-email/references/react-email.md +95 -0
  245. package/skills/pixelcraft-extensions/SKILL.md +56 -0
  246. package/skills/pixelcraft-extensions/references/browser-extensions.md +105 -0
  247. package/skills/pixelcraft-extensions/references/figma-office.md +106 -0
  248. package/skills/pixelcraft-extensions/references/ide-and-saas-plugins.md +125 -0
  249. package/skills/pixelcraft-extensions/references/raycast.md +98 -0
  250. package/skills/pixelcraft-extensions/references/vscode-webviews.md +100 -0
  251. package/skills/pixelcraft-game-ui/SKILL.md +80 -0
  252. package/skills/pixelcraft-game-ui/references/bevy.md +90 -0
  253. package/skills/pixelcraft-game-ui/references/godot.md +130 -0
  254. package/skills/pixelcraft-game-ui/references/hud-principles.md +67 -0
  255. package/skills/pixelcraft-game-ui/references/love2d.md +77 -0
  256. package/skills/pixelcraft-game-ui/references/monogame.md +68 -0
  257. package/skills/pixelcraft-game-ui/references/unity-ugui.md +109 -0
  258. package/skills/pixelcraft-game-ui/references/unity-ui-toolkit.md +107 -0
  259. package/skills/pixelcraft-game-ui/references/unreal-umg.md +80 -0
  260. package/skills/pixelcraft-game-ui/references/web-and-middleware-game-ui.md +122 -0
  261. package/skills/pixelcraft-handoff/SKILL.md +50 -0
  262. package/skills/pixelcraft-handoff/references/design-translation.md +134 -0
  263. package/skills/pixelcraft-handoff/references/fidelity-tolerance.md +78 -0
  264. package/skills/pixelcraft-handoff/references/motion-handoff.md +54 -0
  265. package/skills/pixelcraft-media/SKILL.md +49 -0
  266. package/skills/pixelcraft-media/references/banners-video.md +130 -0
  267. package/skills/pixelcraft-media/references/og-generation.md +154 -0
  268. package/skills/pixelcraft-media/references/social-cards.md +71 -0
  269. package/skills/pixelcraft-mobile/SKILL.md +86 -0
  270. package/skills/pixelcraft-mobile/references/dotnet-maui.md +91 -0
  271. package/skills/pixelcraft-mobile/references/flet.md +80 -0
  272. package/skills/pixelcraft-mobile/references/flutter.md +113 -0
  273. package/skills/pixelcraft-mobile/references/harmonyos-and-emerging-mobile.md +121 -0
  274. package/skills/pixelcraft-mobile/references/ionic-capacitor.md +87 -0
  275. package/skills/pixelcraft-mobile/references/jetpack-compose.md +129 -0
  276. package/skills/pixelcraft-mobile/references/kivy.md +82 -0
  277. package/skills/pixelcraft-mobile/references/kotlin-multiplatform.md +86 -0
  278. package/skills/pixelcraft-mobile/references/lynxjs.md +110 -0
  279. package/skills/pixelcraft-mobile/references/nativescript-and-skip.md +91 -0
  280. package/skills/pixelcraft-mobile/references/react-native-expo.md +106 -0
  281. package/skills/pixelcraft-mobile/references/swiftui.md +200 -0
  282. package/skills/pixelcraft-mobile/references/tactile-interactions.md +55 -0
  283. package/skills/pixelcraft-mobile/references/task-state-composition.md +85 -0
  284. package/skills/pixelcraft-mobile/references/uikit.md +92 -0
  285. package/skills/pixelcraft-patterns/SKILL.md +75 -0
  286. package/skills/pixelcraft-patterns/references/accessibility-resilience.md +29 -0
  287. package/skills/pixelcraft-patterns/references/ai-and-offline-patterns.md +54 -0
  288. package/skills/pixelcraft-patterns/references/auth-onboarding.md +44 -0
  289. package/skills/pixelcraft-patterns/references/billing-paywalls.md +40 -0
  290. package/skills/pixelcraft-patterns/references/command-workspace.md +56 -0
  291. package/skills/pixelcraft-patterns/references/commerce.md +47 -0
  292. package/skills/pixelcraft-patterns/references/communication.md +45 -0
  293. package/skills/pixelcraft-patterns/references/creative-tools.md +42 -0
  294. package/skills/pixelcraft-patterns/references/creative-web-composition.md +38 -0
  295. package/skills/pixelcraft-patterns/references/dashboard-admin.md +35 -0
  296. package/skills/pixelcraft-patterns/references/history-diff-undo.md +50 -0
  297. package/skills/pixelcraft-patterns/references/marketing.md +44 -0
  298. package/skills/pixelcraft-patterns/references/multi-tenant-rbac.md +47 -0
  299. package/skills/pixelcraft-patterns/references/narrative-systems.md +42 -0
  300. package/skills/pixelcraft-patterns/references/notifications-activity.md +57 -0
  301. package/skills/pixelcraft-patterns/references/pattern-selection.md +80 -0
  302. package/skills/pixelcraft-patterns/references/scheduling-kanban.md +47 -0
  303. package/skills/pixelcraft-patterns/references/scroll-implementation.md +37 -0
  304. package/skills/pixelcraft-patterns/references/search-filtering.md +42 -0
  305. package/skills/pixelcraft-patterns/references/settings.md +51 -0
  306. package/skills/pixelcraft-patterns/references/tables-crud.md +43 -0
  307. package/skills/pixelcraft-plan/SKILL.md +103 -0
  308. package/skills/pixelcraft-plan/references/design-input.md +69 -0
  309. package/skills/pixelcraft-plan/references/discovery-interview.md +110 -0
  310. package/skills/pixelcraft-plan/references/grill-me-protocol.md +63 -0
  311. package/skills/pixelcraft-plan/references/plan-template.md +134 -0
  312. package/skills/pixelcraft-plan/references/repo-discovery.md +49 -0
  313. package/skills/pixelcraft-plan/references/stack-freshness.md +67 -0
  314. package/skills/pixelcraft-plan/references/stack-selection.md +98 -0
  315. package/skills/pixelcraft-review/SKILL.md +86 -0
  316. package/skills/pixelcraft-review/references/audit-report.md +69 -0
  317. package/skills/pixelcraft-review/references/critique-protocol.md +89 -0
  318. package/skills/pixelcraft-review/references/heuristics.md +63 -0
  319. package/skills/pixelcraft-review/references/personas.md +53 -0
  320. package/skills/pixelcraft-review/references/polish.md +78 -0
  321. package/skills/pixelcraft-review/scripts/check-acceptance.mjs +619 -0
  322. package/skills/pixelcraft-review/scripts/fixtures/brand-critique-waivers.json +14 -0
  323. package/skills/pixelcraft-review/scripts/fixtures/brand-critique.css +18 -0
  324. package/skills/pixelcraft-review/scripts/fixtures/clean.html +43 -0
  325. package/skills/pixelcraft-review/scripts/fixtures/focus-after-block.css +4 -0
  326. package/skills/pixelcraft-review/scripts/fixtures/focus-at-rules.css +17 -0
  327. package/skills/pixelcraft-review/scripts/fixtures/focus-comments.css +10 -0
  328. package/skills/pixelcraft-review/scripts/fixtures/focus-html-quote-leak.html +12 -0
  329. package/skills/pixelcraft-review/scripts/fixtures/focus-invalid-replacements.css +27 -0
  330. package/skills/pixelcraft-review/scripts/fixtures/focus-longhand-removal.css +34 -0
  331. package/skills/pixelcraft-review/scripts/fixtures/focus-nested-rules.css +19 -0
  332. package/skills/pixelcraft-review/scripts/fixtures/focus-not-visible-skip.css +8 -0
  333. package/skills/pixelcraft-review/scripts/fixtures/focus-outline-shorthands.css +11 -0
  334. package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-and-border.css +15 -0
  335. package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-last-wins.css +19 -0
  336. package/skills/pixelcraft-review/scripts/fixtures/focus-valid-replacements-extended.css +29 -0
  337. package/skills/pixelcraft-review/scripts/fixtures/focus-visible-no-replacement.css +3 -0
  338. package/skills/pixelcraft-review/scripts/fixtures/focus-visible-valid-replacements.css +9 -0
  339. package/skills/pixelcraft-review/scripts/fixtures/slop.html +28 -0
  340. package/skills/pixelcraft-review/scripts/slop-scan.mjs +1233 -0
  341. package/skills/pixelcraft-spatial/SKILL.md +51 -0
  342. package/skills/pixelcraft-spatial/references/comfort-accessibility.md +39 -0
  343. package/skills/pixelcraft-spatial/references/platforms.md +147 -0
  344. package/skills/pixelcraft-tokens/SKILL.md +60 -0
  345. package/skills/pixelcraft-tokens/assets/tokens.example.json +71 -0
  346. package/skills/pixelcraft-tokens/assets/tokens.modes.example.json +47 -0
  347. package/skills/pixelcraft-tokens/references/adoption.md +55 -0
  348. package/skills/pixelcraft-tokens/references/format.md +84 -0
  349. package/skills/pixelcraft-tokens/references/governance.md +80 -0
  350. package/skills/pixelcraft-tokens/references/state-tokens.md +62 -0
  351. package/skills/pixelcraft-tokens/references/theme-presets.md +122 -0
  352. package/skills/pixelcraft-tokens/references/token-tooling.md +119 -0
  353. package/skills/pixelcraft-tokens/scripts/export-tokens.mjs +847 -0
  354. package/skills/pixelcraft-tui/SKILL.md +76 -0
  355. package/skills/pixelcraft-tui/references/bubbletea-lipgloss.md +79 -0
  356. package/skills/pixelcraft-tui/references/extended-tui-toolkits.md +127 -0
  357. package/skills/pixelcraft-tui/references/ink.md +109 -0
  358. package/skills/pixelcraft-tui/references/ratatui.md +102 -0
  359. package/skills/pixelcraft-tui/references/rich.md +82 -0
  360. package/skills/pixelcraft-tui/references/terminal-protocols.md +80 -0
  361. package/skills/pixelcraft-tui/references/textual.md +108 -0
  362. package/skills/pixelcraft-ux/SKILL.md +56 -0
  363. package/skills/pixelcraft-ux/references/cognitive-walkthrough.md +70 -0
  364. package/skills/pixelcraft-ux/references/feedback-performance.md +50 -0
  365. package/skills/pixelcraft-ux/references/flows-ia.md +44 -0
  366. package/skills/pixelcraft-ux/references/forms.md +151 -0
  367. package/skills/pixelcraft-ux/references/i18n.md +221 -0
  368. package/skills/pixelcraft-ux/references/laws.md +39 -0
  369. package/skills/pixelcraft-ux/references/locale-test-matrix.md +60 -0
  370. package/skills/pixelcraft-ux/references/state-matrix.md +53 -0
  371. package/skills/pixelcraft-ux/references/usability-testing.md +84 -0
  372. package/skills/pixelcraft-ux/references/ux-writing.md +44 -0
  373. package/skills/pixelcraft-visual-qa/SKILL.md +96 -0
  374. package/skills/pixelcraft-visual-qa/references/baseline-governance.md +70 -0
  375. package/skills/pixelcraft-visual-qa/references/capture-desktop-game.md +59 -0
  376. package/skills/pixelcraft-visual-qa/references/capture-document.md +70 -0
  377. package/skills/pixelcraft-visual-qa/references/capture-email.md +38 -0
  378. package/skills/pixelcraft-visual-qa/references/capture-mobile.md +50 -0
  379. package/skills/pixelcraft-visual-qa/references/capture-terminal.md +35 -0
  380. package/skills/pixelcraft-visual-qa/references/critique-rubric.md +71 -0
  381. package/skills/pixelcraft-visual-qa/references/finish-gate.md +35 -0
  382. package/skills/pixelcraft-visual-qa/references/measured-craft.md +30 -0
  383. package/skills/pixelcraft-visual-qa/references/motion-capture.md +63 -0
  384. package/skills/pixelcraft-visual-qa/references/performance-budgets.md +78 -0
  385. package/skills/pixelcraft-visual-qa/references/realtime-graphics.md +55 -0
  386. package/skills/pixelcraft-visual-qa/references/task-verification.md +81 -0
  387. package/skills/pixelcraft-visual-qa/scripts/check-contrast.mjs +442 -0
  388. package/skills/pixelcraft-visual-qa/scripts/check-email.mjs +397 -0
  389. package/skills/pixelcraft-visual-qa/scripts/check-pdf.mjs +189 -0
  390. package/skills/pixelcraft-visual-qa/scripts/check-tui.mjs +321 -0
  391. package/skills/pixelcraft-visual-qa/scripts/finish-gate.mjs +174 -0
  392. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-aria-modal.html +19 -0
  393. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-audit.html +34 -0
  394. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-modal.html +17 -0
  395. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-deferred.js +1 -0
  396. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-edge.html +52 -0
  397. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.html +80 -0
  398. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.js +8 -0
  399. package/skills/pixelcraft-visual-qa/scripts/shoot.mjs +668 -0
  400. package/skills/pixelcraft-visual-qa/scripts/style-inventory.mjs +1226 -0
  401. package/skills/pixelcraft-web/SKILL.md +132 -0
  402. package/skills/pixelcraft-web/references/accessibility-performance.md +42 -0
  403. package/skills/pixelcraft-web/references/adaptive-layout.md +69 -0
  404. package/skills/pixelcraft-web/references/angular.md +108 -0
  405. package/skills/pixelcraft-web/references/assets-pipeline.md +67 -0
  406. package/skills/pixelcraft-web/references/astro.md +113 -0
  407. package/skills/pixelcraft-web/references/audio-reactive.md +61 -0
  408. package/skills/pixelcraft-web/references/auth-and-checkout-ui.md +115 -0
  409. package/skills/pixelcraft-web/references/build-and-architecture.md +215 -0
  410. package/skills/pixelcraft-web/references/canvas-and-node-editors.md +157 -0
  411. package/skills/pixelcraft-web/references/clojurescript.md +88 -0
  412. package/skills/pixelcraft-web/references/component-systems.md +102 -0
  413. package/skills/pixelcraft-web/references/component-testing.md +170 -0
  414. package/skills/pixelcraft-web/references/creative-effects.md +59 -0
  415. package/skills/pixelcraft-web/references/creative-runtime.md +34 -0
  416. package/skills/pixelcraft-web/references/elm.md +53 -0
  417. package/skills/pixelcraft-web/references/enterprise-data-ui.md +138 -0
  418. package/skills/pixelcraft-web/references/file-upload-media-ui.md +82 -0
  419. package/skills/pixelcraft-web/references/forms-validation.md +123 -0
  420. package/skills/pixelcraft-web/references/fsharp-fable.md +54 -0
  421. package/skills/pixelcraft-web/references/gsap.md +102 -0
  422. package/skills/pixelcraft-web/references/html-css.md +220 -0
  423. package/skills/pixelcraft-web/references/htmx-alpine.md +103 -0
  424. package/skills/pixelcraft-web/references/i18n-engineering.md +106 -0
  425. package/skills/pixelcraft-web/references/interaction-and-search-primitives.md +196 -0
  426. package/skills/pixelcraft-web/references/java-web.md +61 -0
  427. package/skills/pixelcraft-web/references/kotlin-web.md +57 -0
  428. package/skills/pixelcraft-web/references/leptos-yew.md +97 -0
  429. package/skills/pixelcraft-web/references/lit-web-components.md +63 -0
  430. package/skills/pixelcraft-web/references/local-first-sync.md +105 -0
  431. package/skills/pixelcraft-web/references/media-players.md +104 -0
  432. package/skills/pixelcraft-web/references/motion-react.md +96 -0
  433. package/skills/pixelcraft-web/references/motion-recipes.md +82 -0
  434. package/skills/pixelcraft-web/references/preact-fresh-hono.md +111 -0
  435. package/skills/pixelcraft-web/references/pwa.md +230 -0
  436. package/skills/pixelcraft-web/references/qwik.md +94 -0
  437. package/skills/pixelcraft-web/references/r3f-integration.md +69 -0
  438. package/skills/pixelcraft-web/references/react-next.md +168 -0
  439. package/skills/pixelcraft-web/references/rendering-choice.md +63 -0
  440. package/skills/pixelcraft-web/references/rendering-performance.md +80 -0
  441. package/skills/pixelcraft-web/references/rich-text-and-code-editors.md +220 -0
  442. package/skills/pixelcraft-web/references/rive-lottie.md +73 -0
  443. package/skills/pixelcraft-web/references/scala-laminar.md +53 -0
  444. package/skills/pixelcraft-web/references/scene-architecture.md +132 -0
  445. package/skills/pixelcraft-web/references/server-rendered.md +114 -0
  446. package/skills/pixelcraft-web/references/shader-workflow.md +77 -0
  447. package/skills/pixelcraft-web/references/smooth-scroll.md +58 -0
  448. package/skills/pixelcraft-web/references/solid.md +111 -0
  449. package/skills/pixelcraft-web/references/state-architecture.md +107 -0
  450. package/skills/pixelcraft-web/references/styling-ecosystem.md +273 -0
  451. package/skills/pixelcraft-web/references/svelte.md +111 -0
  452. package/skills/pixelcraft-web/references/tailwind.md +99 -0
  453. package/skills/pixelcraft-web/references/video-media.md +69 -0
  454. package/skills/pixelcraft-web/references/vue-nuxt.md +86 -0
  455. package/skills/pixelcraft-web/references/web-3d-engines.md +97 -0
@@ -0,0 +1,397 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+
5
+ const GMAIL_CLIP_BYTES = 102 * 1024;
6
+
7
+ function help() {
8
+ return `Usage: node check-email.mjs <email.html> [--plaintext FILE] [--headers FILE] [--json]
9
+
10
+ Static cross-client HTML email verification script. Checks Gmail 102 KB clip limit,
11
+ Outlook Word-engine unsafe CSS (flex, grid, position: fixed, CSS custom properties),
12
+ <img> missing alt, image-only links/CTAs with empty alt="", under-padded preheader spacers,
13
+ layout <table> missing role="presentation", missing <title> / lang, optional plaintext
14
+ companion parity, and optional RFC 8058 One-Click List-Unsubscribe headers.
15
+
16
+ Options:
17
+ --plaintext FILE Verify companion plaintext email exists, is non-empty, and has parity
18
+ --headers FILE Verify promotional bulk headers (List-Unsubscribe + RFC 8058 One-Click POST)
19
+ --json Print machine-readable JSON output
20
+ --help Show this help`;
21
+ }
22
+
23
+ function lineOf(text, index) {
24
+ return text.slice(0, index).split(/\r?\n/).length;
25
+ }
26
+
27
+ function stripNonMsoComments(html) {
28
+ return html.replace(/<!--(?!\s*\[if\b)[\s\S]*?-->/gi, (m) => m.replace(/[^\r\n]/g, ' '));
29
+ }
30
+
31
+ function stripCssComments(css) {
32
+ return css.replace(/\/\*[\s\S]*?\*\//g, (m) => m.replace(/[^\r\n]/g, ' '));
33
+ }
34
+
35
+ const ENTITY_MAP = {
36
+ nbsp: ' ',
37
+ amp: '&',
38
+ lt: '<',
39
+ gt: '>',
40
+ quot: '"',
41
+ '#39': "'",
42
+ };
43
+
44
+ function visibleText(html) {
45
+ const lower = html.toLowerCase();
46
+ let out = '';
47
+ let i = 0;
48
+ let skipRawTag = '';
49
+
50
+ while (i < html.length) {
51
+ if (skipRawTag) {
52
+ const closeNeedle = `</${skipRawTag}`;
53
+ const closeIdx = lower.indexOf(closeNeedle, i);
54
+ if (closeIdx === -1) break;
55
+ const closeEnd = html.indexOf('>', closeIdx + closeNeedle.length);
56
+ if (closeEnd === -1) break;
57
+ i = closeEnd + 1;
58
+ skipRawTag = '';
59
+ out += ' ';
60
+ continue;
61
+ }
62
+
63
+ if (html.startsWith('<!--', i)) {
64
+ const endComment = html.indexOf('-->', i + 4);
65
+ i = endComment === -1 ? html.length : endComment + 3;
66
+ out += ' ';
67
+ continue;
68
+ }
69
+
70
+ if (html[i] === '<') {
71
+ const tagEnd = html.indexOf('>', i + 1);
72
+ if (tagEnd === -1) break;
73
+ const tagBody = lower.slice(i + 1, tagEnd).trim();
74
+ if (/^style(?:\s|\/|$)/.test(tagBody) && !tagBody.endsWith('/')) {
75
+ skipRawTag = 'style';
76
+ } else if (/^script(?:\s|\/|$)/.test(tagBody) && !tagBody.endsWith('/')) {
77
+ skipRawTag = 'script';
78
+ }
79
+ i = tagEnd + 1;
80
+ out += ' ';
81
+ continue;
82
+ }
83
+
84
+ out += html[i];
85
+ i += 1;
86
+ }
87
+
88
+ return out
89
+ .replace(/&(nbsp|amp|lt|gt|quot|#39);/gi, (_, key) => ENTITY_MAP[key.toLowerCase()] ?? ' ')
90
+ .replace(/\s+/g, ' ')
91
+ .trim();
92
+ }
93
+
94
+ function parseCli(args) {
95
+ const out = { help: false, json: false, plaintext: '', headers: '', input: '' };
96
+ for (let i = 0; i < args.length; i += 1) {
97
+ const arg = args[i];
98
+ if (arg === '--help' || arg === '-h') out.help = true;
99
+ else if (arg === '--json') out.json = true;
100
+ else if (arg === '--plaintext') {
101
+ if (!args[i + 1]) throw new Error('--plaintext requires a file path');
102
+ out.plaintext = args[++i];
103
+ } else if (arg.startsWith('--plaintext=')) out.plaintext = arg.slice('--plaintext='.length);
104
+ else if (arg === '--headers') {
105
+ if (!args[i + 1]) throw new Error('--headers requires a file path');
106
+ out.headers = args[++i];
107
+ } else if (arg.startsWith('--headers=')) out.headers = arg.slice('--headers='.length);
108
+ else if (arg.startsWith('-')) throw new Error(`unknown option: ${arg}`);
109
+ else if (!out.input) out.input = arg;
110
+ else throw new Error(`unexpected argument: ${arg}`);
111
+ }
112
+ return out;
113
+ }
114
+
115
+ function inspectHeaders(rawHeaders) {
116
+ const issues = [];
117
+ const trimmed = (rawHeaders || '').trim();
118
+ let listUnsub = '';
119
+ let listUnsubPost = '';
120
+ if (trimmed.startsWith('{')) {
121
+ const obj = JSON.parse(trimmed);
122
+ for (const [k, v] of Object.entries(obj)) {
123
+ const lower = k.toLowerCase();
124
+ if (lower === 'list-unsubscribe') listUnsub = String(v || '');
125
+ else if (lower === 'list-unsubscribe-post') listUnsubPost = String(v || '');
126
+ }
127
+ } else {
128
+ const unfolded = trimmed.replace(/\r?\n[ \t]+/g, ' ');
129
+ for (const line of unfolded.split(/\r?\n/)) {
130
+ const m = /^([A-Za-z0-9-]+)\s*:\s*(.*)$/.exec(line);
131
+ if (!m) continue;
132
+ const lower = m[1].toLowerCase();
133
+ if (lower === 'list-unsubscribe') listUnsub = m[2].trim();
134
+ else if (lower === 'list-unsubscribe-post') listUnsubPost = m[2].trim();
135
+ }
136
+ }
137
+ if (!/https:\/\/[^\s>]+/i.test(listUnsub)) {
138
+ issues.push({
139
+ rule: 'missing-list-unsubscribe',
140
+ severity: 'P1',
141
+ line: 1,
142
+ message: 'Bulk/promotional headers lack a List-Unsubscribe header containing an https:// endpoint.',
143
+ fix: 'Add List-Unsubscribe: <https://example.com/unsubscribe?...> alongside optional mailto: fallback.',
144
+ });
145
+ }
146
+ if (!/\bList-Unsubscribe\s*=\s*One-Click\b/i.test(listUnsubPost)) {
147
+ issues.push({
148
+ rule: 'missing-one-click-unsubscribe',
149
+ severity: 'P1',
150
+ line: 1,
151
+ message: 'Missing RFC 8058 List-Unsubscribe-Post: List-Unsubscribe=One-Click header required by Gmail, Yahoo, and Outlook.com bulk sender rules.',
152
+ fix: 'Emit List-Unsubscribe-Post: List-Unsubscribe=One-Click and process unsubscribes within 48 hours without login walls.',
153
+ });
154
+ }
155
+ return issues;
156
+ }
157
+
158
+ function inspectEmail(html, plaintextContent, plaintextProvided, headersContent = '', headersProvided = false) {
159
+ const findings = [];
160
+ const add = (rule, severity, line, message, fix) => {
161
+ findings.push({ rule, severity, line, message, fix });
162
+ };
163
+
164
+ const byteSize = Buffer.byteLength(html, 'utf8');
165
+ if (byteSize > GMAIL_CLIP_BYTES) {
166
+ add('gmail-clip-risk', 'P1', 1,
167
+ `HTML byte size is ${byteSize} bytes (${(byteSize / 1024).toFixed(1)} KB), exceeding Gmail's 102 KB (${GMAIL_CLIP_BYTES} bytes) clipping threshold.`,
168
+ 'Trim verbose inline markup, remove unused CSS rules, and shorten repeated attributes to stay under 102 KB.');
169
+ }
170
+
171
+ const cleaned = stripNonMsoComments(html);
172
+
173
+ if (!/<html\b[^>]*\blang\s*=\s*["'][^"']+["']/i.test(cleaned)) {
174
+ add('missing-lang', 'P1', 1, 'Missing lang attribute on <html> element.',
175
+ 'Add lang="en" (or the message language code) to the root <html> element for screen readers.');
176
+ }
177
+ if (!/<title\b[^>]*>[\s\S]*?\S[\s\S]*?<\/title\s*>/i.test(cleaned)) {
178
+ add('missing-title', 'P2', 1, 'Missing non-empty <title> element.',
179
+ 'Include a concise <title> matching the email subject for accessibility and browser-view tabs.');
180
+ }
181
+
182
+ // Outlook-unsafe CSS in <style> blocks and inline style attributes
183
+ const unsafeCssRules = [
184
+ { pattern: /\bdisplay\s*:\s*(?:inline-)?flex\b/gi, name: 'display: flex' },
185
+ { pattern: /\bdisplay\s*:\s*(?:inline-)?grid\b/gi, name: 'display: grid' },
186
+ { pattern: /\bposition\s*:\s*fixed\b/gi, name: 'position: fixed' },
187
+ { pattern: /\bvar\(\s*--[a-zA-Z0-9_-]+/g, name: 'CSS custom property var(--...)' },
188
+ ];
189
+
190
+ const cssChunks = [];
191
+ const styleTagRe = /<style\b[^>]*>([\s\S]*?)<\/style\s*>/gi;
192
+ let m;
193
+ while ((m = styleTagRe.exec(cleaned))) {
194
+ const bodyStart = m.index + m[0].indexOf('>') + 1;
195
+ const styleBytes = Buffer.byteLength(m[1], 'utf8');
196
+ if (styleBytes > 16 * 1024) {
197
+ add('style-block-too-large', 'P1', lineOf(html, m.index),
198
+ `<style> block is ${styleBytes} bytes (${(styleBytes / 1024).toFixed(1)} KB), exceeding the 16 KB safe ceiling before Gmail strips the entire stylesheet.`,
199
+ 'Inline core layout/typography styles and keep embedded <style> media-query overrides compact (<= 8-16 KB).');
200
+ }
201
+ const strippedStyle = stripCssComments(m[1]);
202
+ const modernMatch = /@(?:layer|property)\b/i.exec(strippedStyle);
203
+ if (modernMatch) {
204
+ add('gmail-unsafe-modern-css', 'P1', lineOf(html, bodyStart + modernMatch.index),
205
+ `Unsupported modern at-rule '${modernMatch[0]}' inside <style>; Gmail's CSS parser drops the entire <style> block on unsupported syntax.`,
206
+ 'Compile away @layer, @property, and CSS nesting into flat CSS2/media-query rules before sending.');
207
+ }
208
+ cssChunks.push({ text: strippedStyle, offset: bodyStart });
209
+ }
210
+ const inlineStyleRe = /\bstyle\s*=\s*(?:"([^"]*)"|'([^']*)')/gi;
211
+ while ((m = inlineStyleRe.exec(cleaned))) {
212
+ const val = m[1] ?? m[2] ?? '';
213
+ const offset = m.index + m[0].indexOf(val);
214
+ cssChunks.push({ text: stripCssComments(val), offset });
215
+ }
216
+
217
+ const seenCss = new Set();
218
+ for (const chunk of cssChunks) {
219
+ for (const rule of unsafeCssRules) {
220
+ rule.pattern.lastIndex = 0;
221
+ let match;
222
+ while ((match = rule.pattern.exec(chunk.text))) {
223
+ const line = lineOf(html, chunk.offset + match.index);
224
+ const key = `${rule.name}:${line}`;
225
+ if (seenCss.has(key)) continue;
226
+ seenCss.add(key);
227
+ add('outlook-unsafe-css', 'P1', line,
228
+ `Outlook-unsafe CSS detected: ${rule.name} (${match[0].trim()}).`,
229
+ 'Use table-based layout and resolved hex colors instead of flex/grid/fixed/var(--) for Outlook Word engine compatibility.');
230
+ }
231
+ }
232
+ }
233
+
234
+ // Unreplaced personalization merge tags in visible body (e.g. {{name}}, <%= user %>)
235
+ const visible = visibleText(html);
236
+ const mergeMatch = /\{\{\s*[a-zA-Z_][a-zA-Z0-9_.-]*\s*\}\}|<%=\s*[^%]+\s*%>/.exec(visible);
237
+ if (mergeMatch) {
238
+ const rawIdx = cleaned.indexOf(mergeMatch[0]);
239
+ add('unfilled-merge-tag', 'P1', rawIdx >= 0 ? lineOf(html, rawIdx) : 1,
240
+ `Unresolved personalization placeholder '${mergeMatch[0]}' detected in rendered email copy.`,
241
+ 'Render merge tags with safe fallback defaults (e.g. "Hello there" when first_name is missing) before inspecting final output.');
242
+ }
243
+
244
+ // <img> missing alt
245
+ const imgRe = /<img\b[^>]*>/gi;
246
+ while ((m = imgRe.exec(cleaned))) {
247
+ if (!/\balt\s*=/i.test(m[0])) {
248
+ add('img-missing-alt', 'P0', lineOf(html, m.index),
249
+ `<img> missing alt attribute: ${m[0].slice(0, 100)}`,
250
+ 'Add meaningful alt text or alt="" for purely decorative images so blocked-image clients degrade cleanly.');
251
+ }
252
+ }
253
+
254
+ // Image-only <a> link/CTA with empty alt="" and no accessible label
255
+ const anchorRe = /<a\b([^>]*)>([\s\S]*?)<\/a\s*>/gi;
256
+ while ((m = anchorRe.exec(cleaned))) {
257
+ const aAttrs = m[1] || '';
258
+ const aInner = m[2] || '';
259
+ if (/\baria-label(?:ledby)?\s*=\s*["'][^"']+["']/i.test(aAttrs)) continue;
260
+ if (!/<img\b/i.test(aInner)) continue;
261
+ const textOnly = visibleText(aInner);
262
+ if (textOnly.length > 0) continue;
263
+ const imgs = [...aInner.matchAll(/<img\b[^>]*>/gi)].map((x) => x[0]);
264
+ const hasNonEmptyAlt = imgs.some((tag) => {
265
+ const altMatch = /\balt\s*=\s*(?:"([^"]*)"|'([^']*)')/i.exec(tag);
266
+ return Boolean(altMatch && (altMatch[1] ?? altMatch[2] ?? '').trim());
267
+ });
268
+ const allHaveAltAttr = imgs.every((tag) => /\balt\s*=/i.test(tag));
269
+ if (allHaveAltAttr && !hasNonEmptyAlt) {
270
+ add('image-only-link-empty-alt', 'P0', lineOf(html, m.index),
271
+ 'Image-only <a> link/CTA uses empty alt="" with no text or aria-label, leaving blocked-image clients and screen readers with an unlabeled link.',
272
+ 'Replace image-only buttons with a bulletproof HTML/VML text CTA, or provide descriptive alt text on the linked <img>.');
273
+ }
274
+ }
275
+
276
+ // Under-padded hidden preheader spacer (e.g., 3-5 repeats instead of 50+ repeats)
277
+ const spacerTokens = cleaned.match(/(?:&#847;|&#x0*34f;|&zwnj;|&#8204;|\u034f|\u200c)/gi) || [];
278
+ if (spacerTokens.length > 0 && spacerTokens.length < 20) {
279
+ const firstSpacerIdx = cleaned.search(/(?:&#847;|&#x0*34f;|&zwnj;|&#8204;|\u034f|\u200c)/i);
280
+ add('short-preheader-spacer', 'P2', lineOf(html, Math.max(0, firstSpacerIdx)),
281
+ `Hidden preheader spacer contains only ${spacerTokens.length} zero-width token(s); inbox previews (~120-140 chars) may still leak body chrome like "View in browser".`,
282
+ 'Repeat the &#847;&zwnj;&nbsp; spacer sequence at least 50-90 times after preheader copy.');
283
+ }
284
+
285
+ // Layout <table> missing role="presentation" (exclude semantic data tables containing <th> or <caption>)
286
+ const tableRe = /<table\b([^>]*)>/gi;
287
+ while ((m = tableRe.exec(cleaned))) {
288
+ const attrs = m[1] || '';
289
+ if (/\brole\s*=\s*["']\s*(?:presentation|none)\s*["']/i.test(attrs)) continue;
290
+ const closeIdx = cleaned.indexOf('</table>', m.index);
291
+ const slice = closeIdx > m.index ? cleaned.slice(m.index, closeIdx) : cleaned.slice(m.index, m.index + 500);
292
+ if (/<th\b|<caption\b|\baria-label(?:ledby)?\s*=/i.test(slice)) continue;
293
+ add('layout-table-missing-role', 'P1', lineOf(html, m.index),
294
+ 'Layout <table> is missing role="presentation" (or role="none").',
295
+ 'Add role="presentation" to layout tables so screen readers do not announce grid coordinates.');
296
+ }
297
+
298
+ // Optional plaintext companion check
299
+ let plaintextStatus = 'not-checked';
300
+ if (plaintextProvided) {
301
+ const trimmed = (plaintextContent || '').trim();
302
+ if (!trimmed) {
303
+ plaintextStatus = 'fail';
304
+ add('plaintext-empty', 'P0', 1, 'Plaintext companion file is empty.',
305
+ 'Provide a complete multipart/alternative text/plain version with key copy and URLs.');
306
+ } else {
307
+ const htmlText = visibleText(html);
308
+ const htmlUrls = [...new Set((cleaned.match(/https?:\/\/[^\s"'<>]+/gi) || []))];
309
+ const textHasUrl = /https?:\/\/\S+/i.test(trimmed);
310
+ if (htmlText.length >= 40 && trimmed.length < Math.min(20, htmlText.length * 0.15)) {
311
+ plaintextStatus = 'fail';
312
+ add('plaintext-parity-gap', 'P1', 1,
313
+ `Plaintext companion (${trimmed.length} chars) is disproportionately sparse compared to HTML body (${htmlText.length} chars).`,
314
+ 'Ensure the plaintext alternative carries the full message, key details, and actionable links.');
315
+ } else if (htmlUrls.length > 0 && !textHasUrl) {
316
+ plaintextStatus = 'fail';
317
+ add('plaintext-parity-gap', 'P1', 1,
318
+ `HTML contains ${htmlUrls.length} URL(s) but plaintext companion contains no URLs.`,
319
+ 'Include explicit destination URLs in the plaintext alternative.');
320
+ } else {
321
+ plaintextStatus = 'pass';
322
+ }
323
+ }
324
+ }
325
+
326
+ // Optional RFC 8058 One-Click List-Unsubscribe header check
327
+ let headersStatus = 'not-checked';
328
+ if (headersProvided) {
329
+ const headerIssues = inspectHeaders(headersContent);
330
+ for (const issue of headerIssues) {
331
+ add(issue.rule, issue.severity, issue.line, issue.message, issue.fix);
332
+ }
333
+ headersStatus = headerIssues.length === 0 ? 'pass' : 'fail';
334
+ }
335
+
336
+ return {
337
+ byteSize,
338
+ limitBytes: GMAIL_CLIP_BYTES,
339
+ withinGmailLimit: byteSize <= GMAIL_CLIP_BYTES,
340
+ plaintextStatus,
341
+ headersStatus,
342
+ findings,
343
+ };
344
+ }
345
+
346
+ function main() {
347
+ const cli = parseCli(process.argv.slice(2));
348
+ if (cli.help) {
349
+ console.log(help());
350
+ return;
351
+ }
352
+ if (!cli.input) throw new Error('provide an HTML email file; see --help');
353
+ const htmlPath = path.resolve(cli.input);
354
+ if (!fs.existsSync(htmlPath)) throw new Error(`email file not found: ${cli.input}`);
355
+ const html = fs.readFileSync(htmlPath, 'utf8');
356
+
357
+ let plaintextContent = '';
358
+ if (cli.plaintext) {
359
+ const ptPath = path.resolve(cli.plaintext);
360
+ if (!fs.existsSync(ptPath)) throw new Error(`plaintext file not found: ${cli.plaintext}`);
361
+ plaintextContent = fs.readFileSync(ptPath, 'utf8');
362
+ }
363
+
364
+ let headersContent = '';
365
+ if (cli.headers) {
366
+ const hdrPath = path.resolve(cli.headers);
367
+ if (!fs.existsSync(hdrPath)) throw new Error(`headers file not found: ${cli.headers}`);
368
+ headersContent = fs.readFileSync(hdrPath, 'utf8');
369
+ }
370
+
371
+ const result = inspectEmail(html, plaintextContent, Boolean(cli.plaintext), headersContent, Boolean(cli.headers));
372
+ const report = {
373
+ file: cli.input,
374
+ label: 'static',
375
+ note: 'Static HTML/CSS email analysis; actual rendering across Gmail, Outlook, and Apple Mail dark mode still requires rendered client testing.',
376
+ ...result,
377
+ pass: result.findings.length === 0,
378
+ };
379
+
380
+ if (cli.json) {
381
+ console.log(JSON.stringify(report, null, 2));
382
+ } else {
383
+ console.log(`check-email [${report.label}]: ${report.pass ? 'PASS' : 'FAIL'} (${report.byteSize}/${report.limitBytes} bytes, plaintext: ${report.plaintextStatus}, headers: ${report.headersStatus})`);
384
+ for (const f of report.findings) {
385
+ console.log(` ${f.severity} line ${f.line} ${f.rule} — ${f.message}\n fix: ${f.fix}`);
386
+ }
387
+ console.log(`note: ${report.note}`);
388
+ }
389
+ if (!report.pass) process.exitCode = 1;
390
+ }
391
+
392
+ try {
393
+ main();
394
+ } catch (error) {
395
+ console.error(`check-email: ${error.message}`);
396
+ process.exit(1);
397
+ }
@@ -0,0 +1,189 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+
5
+ function help() {
6
+ return `Usage: node check-pdf.mjs <file.pdf> [--prepress] [--json]
7
+
8
+ Zero-dependency static binary PDF inspector. Verifies the %PDF- header, file size,
9
+ page count heuristic (/Type /Page), PDF/UA structure markers (/StructTreeRoot,
10
+ /MarkInfo, /Lang, /Title), font embedding (/FontFile, /FontFile2, /FontFile3),
11
+ subset/CID text extraction maps (/ToUnicode CMap), and optional commercial prepress
12
+ PDF/X markers (/TrimBox, /BleedBox, /OutputIntents).
13
+ Always reports honest "static" evidence labeling.
14
+
15
+ Options:
16
+ --prepress Enforce commercial print prepress gates (/TrimBox, /BleedBox, /OutputIntents, /ToUnicode)
17
+ --json Print machine-readable JSON output
18
+ --help Show this help`;
19
+ }
20
+
21
+ function parseCli(args) {
22
+ const out = { help: false, json: false, prepress: false, input: '' };
23
+ for (let i = 0; i < args.length; i += 1) {
24
+ const arg = args[i];
25
+ if (arg === '--help' || arg === '-h') out.help = true;
26
+ else if (arg === '--json') out.json = true;
27
+ else if (arg === '--prepress') out.prepress = true;
28
+ else if (arg.startsWith('-')) throw new Error(`unknown option: ${arg}`);
29
+ else if (!out.input) out.input = arg;
30
+ else throw new Error(`unexpected argument: ${arg}`);
31
+ }
32
+ return out;
33
+ }
34
+
35
+ function inspectPdf(buffer, { prepress = false } = {}) {
36
+ const findings = [];
37
+ const add = (rule, severity, message, fix) => {
38
+ findings.push({ rule, severity, message, fix });
39
+ };
40
+
41
+ const fileSizeBytes = buffer.length;
42
+ const raw = buffer.toString('latin1');
43
+ const headerMatch = /^%PDF-(\d+\.\d+)/.exec(raw);
44
+ const validHeader = Boolean(headerMatch);
45
+ const pdfVersion = headerMatch ? headerMatch[1] : null;
46
+ const hasEof = /%%EOF\b/.test(raw);
47
+
48
+ if (!validHeader) {
49
+ add('invalid-pdf-header', 'P0', 'File does not start with a valid %PDF-<major>.<minor> header.',
50
+ 'Ensure the export produced a valid binary PDF document.');
51
+ }
52
+ if (validHeader && !hasEof) {
53
+ add('truncated-pdf', 'P1', 'Missing %%EOF trailer marker; PDF may be truncated.',
54
+ 'Re-export the PDF and verify the writer flushed cleanly.');
55
+ }
56
+
57
+ const pageObjects = (raw.match(/\/Type\s*\/Page\b(?!s)/g) || []).length;
58
+ const countMatches = [...raw.matchAll(/\/Type\s*\/Pages\b[\s\S]{0,200}?\/Count\s+(\d+)/g)]
59
+ .map((m) => Number(m[1]))
60
+ .filter((n) => Number.isFinite(n));
61
+ const pagesTreeCount = countMatches.length ? Math.max(...countMatches) : 0;
62
+ const pageCount = pageObjects > 0 ? pageObjects : pagesTreeCount;
63
+
64
+ if (validHeader && pageCount === 0) {
65
+ add('no-pages-detected', 'P1', 'No /Type /Page objects detected in PDF.',
66
+ 'Verify the PDF generator emitted at least one page.');
67
+ }
68
+
69
+ const structTreeRoot = /\/StructTreeRoot\b/.test(raw);
70
+ const markInfo = /\/MarkInfo\b/.test(raw);
71
+ const lang = /\/Lang\s*(?:\([^)]+\)|<[0-9a-fA-F]+>)/.test(raw);
72
+ const title = /\/Title\s*(?:\([^)]+\)|<[0-9a-fA-F]+>)|<dc:title\b/i.test(raw);
73
+ const fontFileCount = (raw.match(/\/FontFile(?:2|3)?\b/g) || []).length;
74
+ const embeddedFonts = fontFileCount > 0;
75
+ const toUnicodeCMap = /\/ToUnicode\b/.test(raw);
76
+ const cidOrSubsetFonts = /\/Subtype\s*\/Type0\b|\/Encoding\s*\/Identity-[HV]\b|\/BaseFont\s*\/[A-Z]{6}\+/.test(raw);
77
+ const trimBox = /\/TrimBox\b/.test(raw);
78
+ const bleedBox = /\/BleedBox\b/.test(raw);
79
+ const outputIntents = /\/OutputIntents\b|\/GTS_PDFX\b/.test(raw);
80
+ const compressedObjectStreams = /\/ObjStm\b/.test(raw);
81
+
82
+ if (validHeader) {
83
+ if (!structTreeRoot) {
84
+ add('missing-struct-tree', 'P1', 'Missing /StructTreeRoot (tagged PDF structure tree for PDF/UA accessibility).',
85
+ 'Enable tagged PDF output (e.g. Typst PDF/UA, WeasyPrint/Chromium tagged PDF, or LaTeX tagpdf) so reading order and headings are exposed to assistive technology.');
86
+ }
87
+ if (!markInfo) {
88
+ add('missing-mark-info', 'P2', 'Missing /MarkInfo dictionary indicating tagged PDF conformance.',
89
+ 'Emit /MarkInfo << /Marked true >> in the PDF catalog.');
90
+ }
91
+ if (!lang) {
92
+ add('missing-pdf-lang', 'P1', 'Missing document language /Lang metadata.',
93
+ 'Set document language metadata (e.g. Typst #set text(lang: "en"), HTML <html lang="en">, or PDF catalog /Lang).');
94
+ }
95
+ if (!title) {
96
+ add('missing-pdf-title', 'P2', 'Missing document /Title metadata.',
97
+ 'Set document title metadata so PDF viewers and screen readers announce a clear title.');
98
+ }
99
+ if (!embeddedFonts) {
100
+ add('unembedded-fonts', 'P1', 'No embedded font stream markers (/FontFile, /FontFile2, /FontFile3) detected.',
101
+ 'Subset and embed all fonts in the PDF so typography does not silently substitute on other machines.');
102
+ } else if ((cidOrSubsetFonts || prepress) && !toUnicodeCMap && !compressedObjectStreams) {
103
+ add('missing-tounicode-cmap', 'P1', 'Embedded subset/CID font detected without a /ToUnicode CMap stream; copying text (especially diacritics, ligatures, or CJK) or running ATS/search extraction may yield tofu (□) or garbled bytes.',
104
+ 'Configure the PDF exporter to emit /ToUnicode CMap tables for all subsetted fonts and verify with pdffonts (uni=yes).');
105
+ }
106
+
107
+ if (prepress && !compressedObjectStreams) {
108
+ if (!trimBox) {
109
+ add('missing-trim-box', 'P1', 'Missing /TrimBox page geometry required for commercial print trimming.',
110
+ 'Define finished trim dimensions (/TrimBox) in your PDF/X prepress export.');
111
+ }
112
+ if (!bleedBox) {
113
+ add('missing-bleed-box', 'P1', 'Missing /BleedBox (typically 3mm / 0.125in beyond TrimBox) required for edge-to-edge commercial printing.',
114
+ 'Export with 3mm (0.125in) bleed (/BleedBox) on all sides so guillotine trim variance never leaves white slivers.');
115
+ }
116
+ if (!outputIntents) {
117
+ add('missing-output-intent', 'P1', 'Missing /OutputIntents calibrated CMYK profile dictionary for PDF/X prepress.',
118
+ 'Embed a target CMYK ICC OutputIntent (e.g. Coated FOGRA39 / GRACoL, PDF/X-4) and keep body black text on 100% K.');
119
+ }
120
+ }
121
+ }
122
+
123
+ return {
124
+ validHeader,
125
+ pdfVersion,
126
+ hasEof,
127
+ fileSizeBytes,
128
+ pageCount,
129
+ prepressChecked: prepress,
130
+ markers: {
131
+ structTreeRoot,
132
+ markInfo,
133
+ lang,
134
+ title,
135
+ embeddedFonts,
136
+ embeddedFontStreams: fontFileCount,
137
+ toUnicodeCMap,
138
+ trimBox,
139
+ bleedBox,
140
+ outputIntents,
141
+ compressedObjectStreams,
142
+ },
143
+ findings,
144
+ };
145
+ }
146
+
147
+ function main() {
148
+ const cli = parseCli(process.argv.slice(2));
149
+ if (cli.help) {
150
+ console.log(help());
151
+ return;
152
+ }
153
+ if (!cli.input) throw new Error('provide a PDF file to inspect; see --help');
154
+ const file = path.resolve(cli.input);
155
+ if (!fs.existsSync(file)) throw new Error(`PDF file not found: ${cli.input}`);
156
+ const buffer = fs.readFileSync(file);
157
+ const result = inspectPdf(buffer, { prepress: cli.prepress });
158
+
159
+ const note = result.markers.compressedObjectStreams
160
+ ? 'Static binary PDF inspection only; /ObjStm compressed object streams are present and may hide uncompressed markers. Verify visual pagination and accessibility tags with a rendered PDF viewer/rasterizer.'
161
+ : 'Static binary PDF inspection only; verify visual pagination, margins, grayscale legibility, clipping, and reading order by rasterizing pages (e.g. pdftoppm) and inspecting rendered output.';
162
+
163
+ const report = {
164
+ file: cli.input,
165
+ label: 'static',
166
+ note,
167
+ ...result,
168
+ pass: result.findings.length === 0,
169
+ };
170
+
171
+ if (cli.json) {
172
+ console.log(JSON.stringify(report, null, 2));
173
+ } else {
174
+ console.log(`check-pdf [${report.label}]: ${report.pass ? 'PASS' : 'FAIL'} (PDF ${report.pdfVersion || 'invalid'}, ${report.fileSizeBytes} bytes, ~${report.pageCount} page(s)${cli.prepress ? ', prepress' : ''})`);
175
+ console.log(` markers: StructTreeRoot=${report.markers.structTreeRoot} MarkInfo=${report.markers.markInfo} Lang=${report.markers.lang} Title=${report.markers.title} EmbeddedFonts=${report.markers.embeddedFonts} ToUnicode=${report.markers.toUnicodeCMap} TrimBox=${report.markers.trimBox} BleedBox=${report.markers.bleedBox} OutputIntents=${report.markers.outputIntents}`);
176
+ for (const f of report.findings) {
177
+ console.log(` ${f.severity} ${f.rule} — ${f.message}\n fix: ${f.fix}`);
178
+ }
179
+ console.log(`note: ${report.note}`);
180
+ }
181
+ if (!report.pass) process.exitCode = 1;
182
+ }
183
+
184
+ try {
185
+ main();
186
+ } catch (error) {
187
+ console.error(`check-pdf: ${error.message}`);
188
+ process.exit(1);
189
+ }