@thanhnguyxn/pixelcraft 0.1.0 → 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 (376) hide show
  1. package/.agents/plugins/marketplace.json +1 -1
  2. package/.antigravity-plugin/plugin.json +32 -0
  3. package/.claude-plugin/marketplace.json +1 -1
  4. package/.claude-plugin/plugin.json +15 -4
  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/README.md +185 -328
  13. package/SECURITY.md +28 -0
  14. package/assets/pixelcraft-logo-128.png +0 -0
  15. package/assets/pixelcraft-logo-256.png +0 -0
  16. package/bin/pixelcraft.mjs +431 -23
  17. package/docs/ARCHITECTURE.md +40 -37
  18. package/docs/DESIGN-RATIONALE.md +51 -3
  19. package/docs/INSTALL.md +221 -0
  20. package/evals/README.md +16 -6
  21. package/evals/fixtures/3d-web-engineering.json +69 -0
  22. package/evals/fixtures/acceptance-checklist-rule03-gate.json +43 -0
  23. package/evals/fixtures/ai-ui-libraries.json +53 -0
  24. package/evals/fixtures/audio-visual-accessibility.json +69 -0
  25. package/evals/fixtures/auth-and-checkout-ui.json +53 -0
  26. package/evals/fixtures/brandkit-identity-governance.json +48 -0
  27. package/evals/fixtures/build-and-architecture.json +53 -0
  28. package/evals/fixtures/canvas-and-node-editors.json +53 -0
  29. package/evals/fixtures/chat-ai-exfiltration-ime-hitl-gate.json +43 -0
  30. package/evals/fixtures/completion-gate-scan-until-clean.json +44 -0
  31. package/evals/fixtures/component-systems.json +53 -0
  32. package/evals/fixtures/component-testing.json +53 -0
  33. package/evals/fixtures/constrained-voice-and-tv.json +43 -0
  34. package/evals/fixtures/creative-code-rendering.json +69 -0
  35. package/evals/fixtures/creative-reference-evidence.json +67 -0
  36. package/evals/fixtures/data-app-python-marimo.json +49 -0
  37. package/evals/fixtures/desktop-cpp-juce-audio.json +49 -0
  38. package/evals/fixtures/desktop-csharp-avalonia.json +49 -0
  39. package/evals/fixtures/desktop-native-workspace.json +48 -0
  40. package/evals/fixtures/desktop-python-anti-tkinter.json +49 -0
  41. package/evals/fixtures/document-prepress-pdfx4-tounicode.json +43 -0
  42. package/evals/fixtures/document-rust-typst-invoice.json +49 -0
  43. package/evals/fixtures/document-typst-and-print-css.json +43 -0
  44. package/evals/fixtures/email-mjml-dark-mode.json +49 -0
  45. package/evals/fixtures/email-outlook-and-plaintext.json +43 -0
  46. package/evals/fixtures/enterprise-data-ui.json +53 -0
  47. package/evals/fixtures/extended-tui-toolkits.json +53 -0
  48. package/evals/fixtures/extensions-mv3-and-vscode.json +43 -0
  49. package/evals/fixtures/file-upload-media-ui.json +53 -0
  50. package/evals/fixtures/forms-validation.json +53 -0
  51. package/evals/fixtures/game-go-ebitengine.json +49 -0
  52. package/evals/fixtures/game-godot-gdscript.json +49 -0
  53. package/evals/fixtures/game-ui-hud-and-engines.json +43 -0
  54. package/evals/fixtures/i18n-engineering.json +53 -0
  55. package/evals/fixtures/local-first-sync.json +53 -0
  56. package/evals/fixtures/lynxjs.json +53 -0
  57. package/evals/fixtures/maizzle-email.json +53 -0
  58. package/evals/fixtures/maps-geospatial.json +53 -0
  59. package/evals/fixtures/media-og-and-video-export.json +43 -0
  60. package/evals/fixtures/media-players.json +53 -0
  61. package/evals/fixtures/mobile-compose-16kb-foldable-store-gate.json +44 -0
  62. package/evals/fixtures/mobile-elixir-liveview-native.json +49 -0
  63. package/evals/fixtures/mobile-flutter-dynamic-type.json +49 -0
  64. package/evals/fixtures/mobile-harmonyos-arkui.json +49 -0
  65. package/evals/fixtures/mobile-jetpack-compose.json +49 -0
  66. package/evals/fixtures/mobile-swiftui-ios.json +49 -0
  67. package/evals/fixtures/motion-engineering.json +69 -0
  68. package/evals/fixtures/pdfjs-and-pptx.json +53 -0
  69. package/evals/fixtures/plan-discovery-interview.json +31 -0
  70. package/evals/fixtures/plan-grill-me-brainstorm-gate.json +49 -0
  71. package/evals/fixtures/reactive-data-apps.json +53 -0
  72. package/evals/fixtures/review-evidence-audit.json +43 -0
  73. package/evals/fixtures/rich-text-and-code-editors.json +53 -0
  74. package/evals/fixtures/scrollytelling-resilience.json +70 -0
  75. package/evals/fixtures/spatial-xr-comfort-and-platforms.json +43 -0
  76. package/evals/fixtures/state-architecture.json +53 -0
  77. package/evals/fixtures/styling-ecosystem.json +53 -0
  78. package/evals/fixtures/token-tooling.json +53 -0
  79. package/evals/fixtures/tui-go-bubbletea.json +49 -0
  80. package/evals/fixtures/tui-rust-ratatui-grapheme-paste-teardown.json +44 -0
  81. package/evals/fixtures/tui-rust-ratatui.json +49 -0
  82. package/evals/fixtures/ux-state-matrix-and-i18n.json +43 -0
  83. package/evals/fixtures/web-3d-engines.json +53 -0
  84. package/evals/fixtures/web-php-laravel-filament.json +49 -0
  85. package/evals/fixtures/web-ruby-viewcomponent-phlex.json +49 -0
  86. package/evals/pixelcraft-accessibility.md +17 -0
  87. package/evals/pixelcraft-craft.md +16 -0
  88. package/evals/pixelcraft-dataviz.md +3 -3
  89. package/evals/pixelcraft-direction.md +17 -0
  90. package/evals/pixelcraft-game-ui.md +3 -3
  91. package/evals/pixelcraft-mobile.md +3 -3
  92. package/evals/pixelcraft-patterns.md +16 -0
  93. package/evals/pixelcraft-plan.md +65 -3
  94. package/evals/pixelcraft-review.md +3 -3
  95. package/evals/pixelcraft-visual-qa.md +11 -5
  96. package/evals/pixelcraft-web.md +21 -3
  97. package/evals/pixelcraft.md +4 -4
  98. package/gemini-extension.json +3 -2
  99. package/install.ps1 +57 -11
  100. package/install.sh +82 -7
  101. package/package.json +32 -4
  102. package/plugin.json +6 -1
  103. package/scripts/build-adapters.mjs +11 -13
  104. package/scripts/run-evals.mjs +397 -0
  105. package/scripts/sync-docs.mjs +381 -0
  106. package/scripts/test-build-adapters.mjs +14 -1
  107. package/scripts/test-cross-platform-qa.mjs +359 -0
  108. package/scripts/test-distribution.mjs +86 -7
  109. package/scripts/test-export-tokens.mjs +259 -3
  110. package/scripts/test-finish-gate.mjs +133 -10
  111. package/scripts/test-installers.mjs +155 -6
  112. package/scripts/test-shoot.mjs +23 -1
  113. package/scripts/test-slop-scan.mjs +390 -3
  114. package/scripts/test-style-inventory.mjs +23 -0
  115. package/scripts/test-sync-docs.mjs +140 -0
  116. package/scripts/test-validate-skills.mjs +82 -4
  117. package/scripts/validate-skills.mjs +149 -3
  118. package/skills/pixelcraft/SKILL.md +67 -47
  119. package/skills/pixelcraft/references/design-brief.md +2 -2
  120. package/skills/pixelcraft/references/floor.md +36 -19
  121. package/skills/pixelcraft/references/report-template.md +25 -11
  122. package/skills/pixelcraft/references/stack-detection.md +138 -67
  123. package/skills/pixelcraft/references/surface-acceptance.md +33 -21
  124. package/skills/pixelcraft/references/workflow-checkpoints.md +49 -7
  125. package/skills/pixelcraft-accessibility/SKILL.md +34 -13
  126. package/skills/pixelcraft-accessibility/references/apg-patterns.md +13 -0
  127. package/skills/pixelcraft-accessibility/references/motion-canvas.md +57 -0
  128. package/skills/pixelcraft-accessibility/references/platforms.md +34 -6
  129. package/skills/pixelcraft-accessibility/references/verification.md +15 -10
  130. package/skills/pixelcraft-accessibility/references/wcag22-checks.md +38 -5
  131. package/skills/pixelcraft-brandkit/SKILL.md +42 -30
  132. package/skills/pixelcraft-brandkit/references/asset-pipeline.md +90 -50
  133. package/skills/pixelcraft-brandkit/references/brand-governance.md +29 -27
  134. package/skills/pixelcraft-brandkit/references/logo-methods.md +33 -34
  135. package/skills/pixelcraft-brandkit/references/prompt-template.md +53 -51
  136. package/skills/pixelcraft-brandkit/references/qa-checklist.md +7 -2
  137. package/skills/pixelcraft-brandkit/references/visual-modes.md +16 -16
  138. package/skills/pixelcraft-chat-ui/SKILL.md +31 -27
  139. package/skills/pixelcraft-chat-ui/references/agentic-workspace.md +66 -0
  140. package/skills/pixelcraft-chat-ui/references/ai-ui-libraries.md +259 -0
  141. package/skills/pixelcraft-chat-ui/references/conversation-design.md +12 -6
  142. package/skills/pixelcraft-chat-ui/references/mobile-business-platforms.md +58 -68
  143. package/skills/pixelcraft-chat-ui/references/slack-discord.md +60 -76
  144. package/skills/pixelcraft-constrained/SKILL.md +21 -20
  145. package/skills/pixelcraft-constrained/references/specialized-hardware.md +69 -45
  146. package/skills/pixelcraft-constrained/references/tv-wearables.md +123 -73
  147. package/skills/pixelcraft-constrained/references/voice-ui.md +86 -45
  148. package/skills/pixelcraft-craft/SKILL.md +29 -15
  149. package/skills/pixelcraft-craft/references/color.md +62 -6
  150. package/skills/pixelcraft-craft/references/layout.md +32 -0
  151. package/skills/pixelcraft-craft/references/motion.md +99 -12
  152. package/skills/pixelcraft-craft/references/typography.md +48 -9
  153. package/skills/pixelcraft-data-apps/SKILL.md +50 -31
  154. package/skills/pixelcraft-data-apps/references/ai-and-internal-data-apps.md +147 -0
  155. package/skills/pixelcraft-data-apps/references/dash.md +87 -31
  156. package/skills/pixelcraft-data-apps/references/evidence.md +41 -26
  157. package/skills/pixelcraft-data-apps/references/gradio.md +65 -27
  158. package/skills/pixelcraft-data-apps/references/julia-genie.md +64 -29
  159. package/skills/pixelcraft-data-apps/references/jupyter-widgets.md +65 -27
  160. package/skills/pixelcraft-data-apps/references/nicegui.md +73 -34
  161. package/skills/pixelcraft-data-apps/references/observable-framework.md +65 -27
  162. package/skills/pixelcraft-data-apps/references/panel.md +69 -23
  163. package/skills/pixelcraft-data-apps/references/r-shiny.md +104 -34
  164. package/skills/pixelcraft-data-apps/references/reactive-data-apps.md +186 -0
  165. package/skills/pixelcraft-data-apps/references/reflex.md +85 -31
  166. package/skills/pixelcraft-data-apps/references/shiny.md +84 -27
  167. package/skills/pixelcraft-data-apps/references/streamlit.md +73 -25
  168. package/skills/pixelcraft-dataviz/SKILL.md +21 -24
  169. package/skills/pixelcraft-dataviz/references/color-accessibility.md +2 -2
  170. package/skills/pixelcraft-dataviz/references/encoding-tables-dashboards.md +35 -25
  171. package/skills/pixelcraft-dataviz/references/libraries.md +165 -46
  172. package/skills/pixelcraft-dataviz/references/maps-geospatial.md +159 -0
  173. package/skills/pixelcraft-dataviz/references/realtime-graphs-maps-scale.md +58 -65
  174. package/skills/pixelcraft-desktop/SKILL.md +61 -39
  175. package/skills/pixelcraft-desktop/references/appkit.md +60 -26
  176. package/skills/pixelcraft-desktop/references/avalonia.md +65 -29
  177. package/skills/pixelcraft-desktop/references/cpp-gui.md +104 -27
  178. package/skills/pixelcraft-desktop/references/electron.md +68 -26
  179. package/skills/pixelcraft-desktop/references/go-gui.md +59 -30
  180. package/skills/pixelcraft-desktop/references/gtk.md +74 -31
  181. package/skills/pixelcraft-desktop/references/javafx-swing.md +54 -25
  182. package/skills/pixelcraft-desktop/references/qt-pyside-qml.md +57 -30
  183. package/skills/pixelcraft-desktop/references/rust-gui.md +59 -41
  184. package/skills/pixelcraft-desktop/references/tauri.md +80 -24
  185. package/skills/pixelcraft-desktop/references/uno-platform.md +42 -23
  186. package/skills/pixelcraft-desktop/references/winui-wpf.md +66 -26
  187. package/skills/pixelcraft-desktop/references/working-context.md +82 -3
  188. package/skills/pixelcraft-direction/SKILL.md +48 -82
  189. package/skills/pixelcraft-direction/references/creative-brainstorming.md +72 -0
  190. package/skills/pixelcraft-direction/references/direction-card.md +11 -1
  191. package/skills/pixelcraft-direction/references/direction-scoring.md +5 -1
  192. package/skills/pixelcraft-direction/references/motion-identity.md +67 -0
  193. package/skills/pixelcraft-direction/references/movements.md +3 -0
  194. package/skills/pixelcraft-direction/references/reference-analysis.md +37 -0
  195. package/skills/pixelcraft-direction/references/slop-fingerprints.md +32 -7
  196. package/skills/pixelcraft-document/SKILL.md +27 -23
  197. package/skills/pixelcraft-document/references/archetypes.md +27 -4
  198. package/skills/pixelcraft-document/references/pdf-tools.md +241 -81
  199. package/skills/pixelcraft-document/references/pdfjs-and-pptx.md +114 -0
  200. package/skills/pixelcraft-document/references/print-css.md +96 -43
  201. package/skills/pixelcraft-document/references/slides.md +123 -27
  202. package/skills/pixelcraft-email/SKILL.md +42 -20
  203. package/skills/pixelcraft-email/references/client-quirks.md +101 -33
  204. package/skills/pixelcraft-email/references/html-tables.md +83 -22
  205. package/skills/pixelcraft-email/references/maizzle.md +54 -0
  206. package/skills/pixelcraft-email/references/mjml.md +13 -11
  207. package/skills/pixelcraft-email/references/react-email.md +76 -34
  208. package/skills/pixelcraft-extensions/SKILL.md +32 -27
  209. package/skills/pixelcraft-extensions/references/browser-extensions.md +91 -17
  210. package/skills/pixelcraft-extensions/references/figma-office.md +97 -14
  211. package/skills/pixelcraft-extensions/references/ide-and-saas-plugins.md +125 -0
  212. package/skills/pixelcraft-extensions/references/raycast.md +90 -11
  213. package/skills/pixelcraft-extensions/references/vscode-webviews.md +91 -17
  214. package/skills/pixelcraft-game-ui/SKILL.md +45 -26
  215. package/skills/pixelcraft-game-ui/references/bevy.md +69 -31
  216. package/skills/pixelcraft-game-ui/references/godot.md +100 -27
  217. package/skills/pixelcraft-game-ui/references/hud-principles.md +50 -21
  218. package/skills/pixelcraft-game-ui/references/love2d.md +53 -27
  219. package/skills/pixelcraft-game-ui/references/monogame.md +45 -29
  220. package/skills/pixelcraft-game-ui/references/unity-ugui.md +109 -0
  221. package/skills/pixelcraft-game-ui/references/unity-ui-toolkit.md +69 -27
  222. package/skills/pixelcraft-game-ui/references/unreal-umg.md +53 -26
  223. package/skills/pixelcraft-game-ui/references/web-and-middleware-game-ui.md +122 -0
  224. package/skills/pixelcraft-handoff/SKILL.md +14 -13
  225. package/skills/pixelcraft-handoff/references/design-translation.md +40 -10
  226. package/skills/pixelcraft-handoff/references/motion-handoff.md +54 -0
  227. package/skills/pixelcraft-media/SKILL.md +20 -23
  228. package/skills/pixelcraft-media/references/banners-video.md +83 -65
  229. package/skills/pixelcraft-media/references/og-generation.md +110 -63
  230. package/skills/pixelcraft-media/references/social-cards.md +57 -58
  231. package/skills/pixelcraft-mobile/SKILL.md +53 -36
  232. package/skills/pixelcraft-mobile/references/dotnet-maui.md +62 -34
  233. package/skills/pixelcraft-mobile/references/flet.md +53 -26
  234. package/skills/pixelcraft-mobile/references/flutter.md +76 -32
  235. package/skills/pixelcraft-mobile/references/harmonyos-and-emerging-mobile.md +121 -0
  236. package/skills/pixelcraft-mobile/references/ionic-capacitor.md +48 -26
  237. package/skills/pixelcraft-mobile/references/jetpack-compose.md +92 -24
  238. package/skills/pixelcraft-mobile/references/kivy.md +54 -31
  239. package/skills/pixelcraft-mobile/references/kotlin-multiplatform.md +53 -27
  240. package/skills/pixelcraft-mobile/references/lynxjs.md +110 -0
  241. package/skills/pixelcraft-mobile/references/nativescript-and-skip.md +91 -0
  242. package/skills/pixelcraft-mobile/references/react-native-expo.md +66 -31
  243. package/skills/pixelcraft-mobile/references/swiftui.md +158 -28
  244. package/skills/pixelcraft-mobile/references/tactile-interactions.md +55 -0
  245. package/skills/pixelcraft-mobile/references/task-state-composition.md +82 -2
  246. package/skills/pixelcraft-mobile/references/uikit.md +57 -23
  247. package/skills/pixelcraft-patterns/SKILL.md +30 -13
  248. package/skills/pixelcraft-patterns/references/accessibility-resilience.md +29 -0
  249. package/skills/pixelcraft-patterns/references/ai-and-offline-patterns.md +54 -0
  250. package/skills/pixelcraft-patterns/references/auth-onboarding.md +32 -13
  251. package/skills/pixelcraft-patterns/references/billing-paywalls.md +40 -0
  252. package/skills/pixelcraft-patterns/references/command-workspace.md +56 -0
  253. package/skills/pixelcraft-patterns/references/commerce.md +35 -16
  254. package/skills/pixelcraft-patterns/references/communication.md +34 -15
  255. package/skills/pixelcraft-patterns/references/creative-tools.md +30 -17
  256. package/skills/pixelcraft-patterns/references/creative-web-composition.md +38 -0
  257. package/skills/pixelcraft-patterns/references/dashboard-admin.md +22 -18
  258. package/skills/pixelcraft-patterns/references/history-diff-undo.md +50 -0
  259. package/skills/pixelcraft-patterns/references/marketing.md +31 -19
  260. package/skills/pixelcraft-patterns/references/multi-tenant-rbac.md +47 -0
  261. package/skills/pixelcraft-patterns/references/narrative-systems.md +42 -0
  262. package/skills/pixelcraft-patterns/references/notifications-activity.md +57 -0
  263. package/skills/pixelcraft-patterns/references/pattern-selection.md +8 -2
  264. package/skills/pixelcraft-patterns/references/scheduling-kanban.md +47 -0
  265. package/skills/pixelcraft-patterns/references/scroll-implementation.md +37 -0
  266. package/skills/pixelcraft-patterns/references/settings.md +40 -12
  267. package/skills/pixelcraft-plan/SKILL.md +54 -18
  268. package/skills/pixelcraft-plan/references/discovery-interview.md +110 -0
  269. package/skills/pixelcraft-plan/references/grill-me-protocol.md +63 -0
  270. package/skills/pixelcraft-plan/references/plan-template.md +44 -9
  271. package/skills/pixelcraft-plan/references/repo-discovery.md +16 -9
  272. package/skills/pixelcraft-plan/references/stack-freshness.md +22 -5
  273. package/skills/pixelcraft-plan/references/stack-selection.md +65 -9
  274. package/skills/pixelcraft-review/SKILL.md +41 -19
  275. package/skills/pixelcraft-review/references/audit-report.md +20 -1
  276. package/skills/pixelcraft-review/references/heuristics.md +63 -18
  277. package/skills/pixelcraft-review/references/personas.md +41 -14
  278. package/skills/pixelcraft-review/references/polish.md +66 -26
  279. package/skills/pixelcraft-review/scripts/check-acceptance.mjs +619 -0
  280. package/skills/pixelcraft-review/scripts/fixtures/focus-longhand-removal.css +34 -0
  281. package/skills/pixelcraft-review/scripts/slop-scan.mjs +679 -32
  282. package/skills/pixelcraft-spatial/SKILL.md +16 -17
  283. package/skills/pixelcraft-spatial/references/comfort-accessibility.md +25 -84
  284. package/skills/pixelcraft-spatial/references/platforms.md +123 -53
  285. package/skills/pixelcraft-tokens/SKILL.md +18 -14
  286. package/skills/pixelcraft-tokens/assets/tokens.example.json +1 -1
  287. package/skills/pixelcraft-tokens/assets/tokens.modes.example.json +1 -1
  288. package/skills/pixelcraft-tokens/references/format.md +39 -9
  289. package/skills/pixelcraft-tokens/references/governance.md +1 -1
  290. package/skills/pixelcraft-tokens/references/theme-presets.md +36 -8
  291. package/skills/pixelcraft-tokens/references/token-tooling.md +119 -0
  292. package/skills/pixelcraft-tokens/scripts/export-tokens.mjs +637 -75
  293. package/skills/pixelcraft-tui/SKILL.md +41 -25
  294. package/skills/pixelcraft-tui/references/bubbletea-lipgloss.md +49 -30
  295. package/skills/pixelcraft-tui/references/extended-tui-toolkits.md +127 -0
  296. package/skills/pixelcraft-tui/references/ink.md +77 -28
  297. package/skills/pixelcraft-tui/references/ratatui.md +70 -30
  298. package/skills/pixelcraft-tui/references/rich.md +53 -33
  299. package/skills/pixelcraft-tui/references/terminal-protocols.md +80 -0
  300. package/skills/pixelcraft-tui/references/textual.md +75 -34
  301. package/skills/pixelcraft-ux/SKILL.md +22 -12
  302. package/skills/pixelcraft-ux/references/feedback-performance.md +39 -19
  303. package/skills/pixelcraft-ux/references/forms.md +57 -3
  304. package/skills/pixelcraft-ux/references/i18n.md +50 -12
  305. package/skills/pixelcraft-ux/references/laws.md +35 -14
  306. package/skills/pixelcraft-ux/references/state-matrix.md +15 -1
  307. package/skills/pixelcraft-ux/references/ux-writing.md +1 -0
  308. package/skills/pixelcraft-visual-qa/SKILL.md +21 -7
  309. package/skills/pixelcraft-visual-qa/references/capture-desktop-game.md +28 -7
  310. package/skills/pixelcraft-visual-qa/references/capture-document.md +70 -0
  311. package/skills/pixelcraft-visual-qa/references/capture-email.md +13 -9
  312. package/skills/pixelcraft-visual-qa/references/capture-mobile.md +20 -5
  313. package/skills/pixelcraft-visual-qa/references/capture-terminal.md +6 -2
  314. package/skills/pixelcraft-visual-qa/references/motion-capture.md +63 -0
  315. package/skills/pixelcraft-visual-qa/references/performance-budgets.md +25 -12
  316. package/skills/pixelcraft-visual-qa/references/realtime-graphics.md +55 -0
  317. package/skills/pixelcraft-visual-qa/scripts/check-contrast.mjs +442 -0
  318. package/skills/pixelcraft-visual-qa/scripts/check-email.mjs +397 -0
  319. package/skills/pixelcraft-visual-qa/scripts/check-pdf.mjs +189 -0
  320. package/skills/pixelcraft-visual-qa/scripts/check-tui.mjs +321 -0
  321. package/skills/pixelcraft-visual-qa/scripts/finish-gate.mjs +50 -11
  322. package/skills/pixelcraft-visual-qa/scripts/shoot.mjs +214 -59
  323. package/skills/pixelcraft-visual-qa/scripts/style-inventory.mjs +121 -49
  324. package/skills/pixelcraft-web/SKILL.md +105 -49
  325. package/skills/pixelcraft-web/references/accessibility-performance.md +42 -0
  326. package/skills/pixelcraft-web/references/adaptive-layout.md +52 -8
  327. package/skills/pixelcraft-web/references/angular.md +63 -16
  328. package/skills/pixelcraft-web/references/assets-pipeline.md +67 -0
  329. package/skills/pixelcraft-web/references/astro.md +64 -13
  330. package/skills/pixelcraft-web/references/audio-reactive.md +61 -0
  331. package/skills/pixelcraft-web/references/auth-and-checkout-ui.md +115 -0
  332. package/skills/pixelcraft-web/references/build-and-architecture.md +215 -0
  333. package/skills/pixelcraft-web/references/canvas-and-node-editors.md +157 -0
  334. package/skills/pixelcraft-web/references/clojurescript.md +52 -17
  335. package/skills/pixelcraft-web/references/component-systems.md +102 -0
  336. package/skills/pixelcraft-web/references/component-testing.md +170 -0
  337. package/skills/pixelcraft-web/references/creative-effects.md +59 -0
  338. package/skills/pixelcraft-web/references/creative-runtime.md +34 -0
  339. package/skills/pixelcraft-web/references/enterprise-data-ui.md +138 -0
  340. package/skills/pixelcraft-web/references/file-upload-media-ui.md +82 -0
  341. package/skills/pixelcraft-web/references/forms-validation.md +123 -0
  342. package/skills/pixelcraft-web/references/fsharp-fable.md +3 -2
  343. package/skills/pixelcraft-web/references/gsap.md +102 -0
  344. package/skills/pixelcraft-web/references/html-css.md +144 -12
  345. package/skills/pixelcraft-web/references/htmx-alpine.md +68 -18
  346. package/skills/pixelcraft-web/references/i18n-engineering.md +106 -0
  347. package/skills/pixelcraft-web/references/interaction-and-search-primitives.md +196 -0
  348. package/skills/pixelcraft-web/references/java-web.md +27 -18
  349. package/skills/pixelcraft-web/references/kotlin-web.md +6 -2
  350. package/skills/pixelcraft-web/references/leptos-yew.md +62 -19
  351. package/skills/pixelcraft-web/references/lit-web-components.md +4 -2
  352. package/skills/pixelcraft-web/references/local-first-sync.md +105 -0
  353. package/skills/pixelcraft-web/references/media-players.md +104 -0
  354. package/skills/pixelcraft-web/references/motion-react.md +96 -0
  355. package/skills/pixelcraft-web/references/motion-recipes.md +82 -0
  356. package/skills/pixelcraft-web/references/preact-fresh-hono.md +111 -0
  357. package/skills/pixelcraft-web/references/pwa.md +6 -1
  358. package/skills/pixelcraft-web/references/qwik.md +51 -11
  359. package/skills/pixelcraft-web/references/r3f-integration.md +69 -0
  360. package/skills/pixelcraft-web/references/react-next.md +112 -13
  361. package/skills/pixelcraft-web/references/rendering-choice.md +63 -0
  362. package/skills/pixelcraft-web/references/rendering-performance.md +80 -0
  363. package/skills/pixelcraft-web/references/rich-text-and-code-editors.md +220 -0
  364. package/skills/pixelcraft-web/references/rive-lottie.md +73 -0
  365. package/skills/pixelcraft-web/references/scene-architecture.md +132 -0
  366. package/skills/pixelcraft-web/references/server-rendered.md +106 -63
  367. package/skills/pixelcraft-web/references/shader-workflow.md +77 -0
  368. package/skills/pixelcraft-web/references/smooth-scroll.md +58 -0
  369. package/skills/pixelcraft-web/references/solid.md +67 -16
  370. package/skills/pixelcraft-web/references/state-architecture.md +107 -0
  371. package/skills/pixelcraft-web/references/styling-ecosystem.md +273 -0
  372. package/skills/pixelcraft-web/references/svelte.md +61 -11
  373. package/skills/pixelcraft-web/references/tailwind.md +40 -14
  374. package/skills/pixelcraft-web/references/video-media.md +69 -0
  375. package/skills/pixelcraft-web/references/vue-nuxt.md +37 -13
  376. package/skills/pixelcraft-web/references/web-3d-engines.md +97 -0
@@ -2,17 +2,31 @@
2
2
  import fs from 'node:fs';
3
3
  import path from 'node:path';
4
4
 
5
- const exts = new Set(['.css','.scss','.html','.jsx','.tsx','.vue','.svelte','.dart','.swift','.kt','.py','.qss','.tcss','.js','.ts']);
6
- const cssExts = new Set(['.css','.scss','.qss','.tcss']);
7
- const markupExts = new Set(['.html','.vue','.svelte']);
8
- const skip = new Set(['node_modules','.git','dist','build','coverage']);
9
- const skillHosts = new Set(['.claude','.agents','.cursor','.gemini','.github','.copilot']);
5
+ const exts = new Set([
6
+ '.css', '.scss', '.pcss', '.less', '.html', '.jsx', '.tsx', '.vue', '.svelte', '.astro', '.mdx',
7
+ '.razor', '.heex', '.php', '.erb', '.templ', '.mjml', '.qml', '.xaml', '.uss', '.uxml',
8
+ '.dart', '.swift', '.kt', '.py', '.rs', '.slint', '.go', '.qss', '.tcss', '.js', '.ts',
9
+ '.gd', '.tscn', '.tres', '.typ', '.tex', '.cs', '.axaml', '.cpp', '.hpp', '.h', '.c',
10
+ '.lua', '.java', '.fxml', '.rb', '.ex', '.exs', '.zig', '.ets', '.blp', '.r', '.jl',
11
+ '.elm', '.cljs', '.fs', '.scala', '.twig',
12
+ ]);
13
+ const cssExts = new Set(['.css', '.scss', '.pcss', '.less', '.qss', '.tcss', '.uss']);
14
+ const markupExts = new Set(['.html', '.vue', '.svelte', '.astro']);
15
+ const skip = new Set([
16
+ 'node_modules', '.git', 'dist', 'build', 'coverage',
17
+ '.next', '.nuxt', '.svelte-kit', '.astro', '.output', 'target', '.venv', '__pycache__',
18
+ 'Pods', '.dart_tool', '.gradle', 'out', '.turbo', 'vendor',
19
+ ]);
20
+ const skillHosts = new Set([
21
+ '.claude', '.agents', '.cursor', '.gemini', '.github', '.copilot',
22
+ '.opencode', '.windsurf', '.kiro', '.cline', '.roo', '.factory',
23
+ ]);
10
24
  const disclaimer = 'A zero score means only that these known fingerprints were not detected; zero findings is not evidence of good design.';
11
25
  const brandRules = new Set(['default-font-only', 'purple-blue-gradient', 'rounded-2xl-repetition',
12
26
  'uniform-shadow', 'centered-hero-two-ctas', 'gradient-text-treatment', 'rounded-accent-rail']);
13
27
 
14
28
  function help() {
15
- return `Usage: node slop-scan.mjs <file-or-directory> [--json] [--waivers FILE]\n\nScan source files for recurring AI-slop fingerprints. Output includes file:line,\nseverity, score contribution, and a suggested fix. ${disclaimer}`;
29
+ return `Usage: node slop-scan.mjs <file-or-directory> [--json] [--waivers FILE] [--fail-on p0|p1|p2|any]\n\nScan source files for recurring AI-slop fingerprints and floor defects.\nOutput includes file:line, severity, score contribution, and a suggested fix.\nWhen --fail-on is passed, exits 1 if any active finding meets or exceeds that severity.\n${disclaimer}`;
16
30
  }
17
31
  function partsOf(file) { return file.split(/[\\/]/); }
18
32
  function isInstalledPixelcraftSkill(file) {
@@ -237,7 +251,7 @@ const visibleOutlineStyles = new Set(['auto', 'dotted', 'dashed', 'solid', 'doub
237
251
  const invisibleOutlineStyles = new Set(['none', 'hidden']);
238
252
  const visibleBorderStyles = new Set(['dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset']);
239
253
  const textDecorationLines = new Set(['underline', 'overline', 'line-through', 'blink', 'spelling-error', 'grammar-error']);
240
- const cssColorKeywords = new Set(('aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen transparent currentcolor').split(' '));
254
+ const cssColorKeywords = new Set(('aliceblue antiquewhite aqua aquamarine azure beige bisque black blanchedalmond blue blueviolet brown burlywood cadetblue chartreuse chocolate coral cornflowerblue cornsilk crimson cyan darkblue darkcyan darkgoldenrod darkgray darkgreen darkgrey darkkhaki darkmagenta darkolivegreen darkorange darkorchid darkred darksalmon darkseagreen darkslateblue darkslategray darkslategrey darkturquoise darkviolet deeppink deepskyblue dimgray dimgrey dodgerblue firebrick floralwhite forestgreen fuchsia gainsboro ghostwhite gold goldenrod gray green greenyellow grey honeydew hotpink indianred indigo ivory khaki lavender lavenderblush lawngreen lemonchiffon lightblue lightcoral lightcyan lightgoldenrodyellow lightgray lightgreen lightgrey lightpink lightsalmon lightseagreen lightskyblue lightslategray lightslategrey lightsteelblue lightyellow lime limegreen linen magenta maroon mediumaquamarine mediumblue mediumorchid mediumpurple mediumseagreen mediumslateblue mediumspringgreen mediumturquoise mediumvioletred midnightblue mintcream mistyrose moccasin navajowhite navy oldlace olive olivedrab orange orangered orchid palegoldenrod palegreen paleturquoise palevioletred papayawhip peachpuff peru pink plum powderblue purple rebeccapurple red rosybrown royalblue saddlebrown salmon sandybrown seagreen seashell sienna silver skyblue slateblue slategray slategrey snow springgreen steelblue tan teal thistle tomato turquoise violet wheat white whitesmoke yellow yellowgreen transparent currentcolor canvas canvastext linktext visitedtext activetext buttonface buttontext buttonborder field fieldtext highlight highlighttext selecteditem selecteditemtext mark marktext graytext accentcolor accentcolortext').split(' '));
241
255
 
242
256
  function cleanValue(value) {
243
257
  return value.replace(/\s*!important\s*$/, '').trim();
@@ -281,7 +295,8 @@ function isVisibleWidth(token) {
281
295
  }
282
296
 
283
297
  function isColorToken(token) {
284
- return token.startsWith('#') || cssColorKeywords.has(token) || /^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color|color-mix)\(/.test(token);
298
+ return token.startsWith('#') || cssColorKeywords.has(token)
299
+ || /^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color|color-mix|light-dark|contrast-color)\(/.test(token);
285
300
  }
286
301
 
287
302
  function outlineTokenKind(token) {
@@ -337,12 +352,18 @@ function analyzeOutline(decls) {
337
352
  } else if (decl.prop === 'outline-style') {
338
353
  style = value;
339
354
  styleUnknown = hasUnresolvedTokens(value);
355
+ if (!styleUnknown && invisibleOutlineStyles.has(value) && !removal) removal = decl;
340
356
  } else if (decl.prop === 'outline-width') {
341
357
  width = value;
342
358
  widthUnknown = hasUnresolvedTokens(value);
359
+ if (!widthUnknown && isZeroWidth(value) && !removal) removal = decl;
343
360
  }
344
361
  }
345
- return { removal, visible: styleUnknown || widthUnknown || (visibleOutlineStyles.has(style) && isVisibleWidth(width)) };
362
+ const styleHides = !styleUnknown && invisibleOutlineStyles.has(style);
363
+ const widthHides = !widthUnknown && isZeroWidth(width);
364
+ const visible = !styleHides && !widthHides
365
+ && (styleUnknown || widthUnknown || (visibleOutlineStyles.has(style) && isVisibleWidth(width)));
366
+ return { removal, visible };
346
367
  }
347
368
 
348
369
  function borderShorthandProp(prop) {
@@ -367,6 +388,48 @@ function visibleTextDecoration(value) {
367
388
  return splitValueTokens(cleanValue(value)).some((token) => textDecorationLines.has(token));
368
389
  }
369
390
 
391
+ function isTransparentColorToken(token) {
392
+ if (token === 'transparent') return true;
393
+ const hex4 = /^#[0-9a-f]{3}([0-9a-f])$/.exec(token);
394
+ if (hex4 && hex4[1] === '0') return true;
395
+ const hex8 = /^#[0-9a-f]{6}([0-9a-f]{2})$/.exec(token);
396
+ if (hex8 && hex8[1] === '00') return true;
397
+ const alphaComma = /^(?:rgba|hsla)\([^)]*,\s*([0-9.]+%?)\s*\)$/.exec(token);
398
+ if (alphaComma && Number.parseFloat(alphaComma[1]) === 0) return true;
399
+ const alphaSlash = /^(?:rgba?|hsla?|hwb|lab|lch|oklab|oklch|color)\([^)]*\/\s*([0-9.]+%?)\s*\)$/.exec(token);
400
+ if (alphaSlash && Number.parseFloat(alphaSlash[1]) === 0) return true;
401
+ return false;
402
+ }
403
+
404
+ function visibleBoxShadow(value) {
405
+ const clean = cleanValue(value);
406
+ if (!clean || clean === 'none') return false;
407
+ return splitSelectorList(clean).some((layer) => {
408
+ const tokens = splitValueTokens(layer);
409
+ if (!tokens.length || tokens.includes('none')) return false;
410
+ let hasUnknown = false;
411
+ let hasNonzeroLength = false;
412
+ let lengthCount = 0;
413
+ let hasTransparentColor = false;
414
+ for (const token of tokens) {
415
+ if (token === 'inset') continue;
416
+ if (isZeroWidth(token)) {
417
+ lengthCount += 1;
418
+ } else if (isNonzeroNumericWidth(token)) {
419
+ lengthCount += 1;
420
+ hasNonzeroLength = true;
421
+ } else if (isColorToken(token)) {
422
+ if (isTransparentColorToken(token)) hasTransparentColor = true;
423
+ } else {
424
+ hasUnknown = true;
425
+ }
426
+ }
427
+ if (hasTransparentColor) return false;
428
+ if (hasUnknown) return true;
429
+ return lengthCount > 0 && hasNonzeroLength;
430
+ });
431
+ }
432
+
370
433
  function visibleReplacement(decls, outline) {
371
434
  if (outline.visible) return true;
372
435
  let visibleBorderStyle = false, positiveBorderWidth = false;
@@ -378,7 +441,7 @@ function visibleReplacement(decls, outline) {
378
441
  if (visibleBorderStyle && positiveBorderWidth) return true;
379
442
  return decls.some(({ prop, value }) => {
380
443
  const clean = cleanValue(value);
381
- if (prop === 'box-shadow') return clean !== 'none';
444
+ if (prop === 'box-shadow') return visibleBoxShadow(clean);
382
445
  if (borderShorthandProp(prop)) return visibleBorder(clean);
383
446
  if (borderColorProp(prop)) return clean !== 'none' && clean !== 'transparent';
384
447
  if (prop === 'text-decoration' || prop === 'text-decoration-line') return visibleTextDecoration(clean);
@@ -450,9 +513,463 @@ function scanRules(segment, baseOffset, sourceText, visit) {
450
513
  scanRuleList(segment.text, baseOffset, sourceText, visit, [{ positive: false, excludesFocusVisible: false }]);
451
514
  }
452
515
 
516
+ const aiDefaultFonts = new Set(['inter', 'roboto', 'geist', 'arial']);
517
+ const defaultOnlyFontStack = new Set(['inter', 'roboto', 'geist', 'arial', 'sans-serif', 'system-ui']);
518
+ const slashCommentExts = new Set([
519
+ '.js', '.jsx', '.ts', '.tsx', '.scss', '.less', '.pcss', '.dart', '.swift', '.kt', '.rs', '.slint', '.go', '.qml', '.php',
520
+ '.cs', '.cpp', '.hpp', '.h', '.c', '.java', '.zig', '.ets', '.blp', '.fs', '.scala', '.typ',
521
+ ]);
522
+ const hashCommentExts = new Set(['.py', '.rb', '.gd', '.r', '.jl', '.ex', '.exs']);
523
+ const dashCommentExts = new Set(['.lua', '.elm']);
524
+ const semiCommentExts = new Set(['.cljs']);
525
+ const doubleQuoteOnlyExts = new Set(['.cljs', '.elm', '.rs', '.fs', '.jl']);
526
+ const twOutlineRemoveRe = /^(?:[a-z0-9-[\]()]+:)*focus(?:-visible)?:!?outline-(?:none|0)$/i;
527
+ const twFocusReplaceRe = /^(?:[a-z0-9-[\]()]+:)*focus(?:-visible)?:!?(?:ring(?!-(?:0(?=$|\/|-)|offset(?:$|-)|transparent(?=$|\/)))(?:$|-[a-z0-9[\]#%./()-]+)|outline(?:$|-(?!none$|0$|offset(?:$|-)|transparent$)[a-z0-9[\]#%./()-]+)|border(?:$|-(?!0$|none$|transparent$)[a-z0-9[\]#%./()-]+)|shadow(?:$|-(?!none$)[a-z0-9[\]#%./()-]+)|underline)$/i;
528
+ const twTransitionAllRe = /^(?:[a-z0-9-[\]()]+:)*!?transition-all$/i;
529
+ const twAnimateUtilityRe = /^(?:[a-z0-9-[\]()]+:)*!?animate-(?:bounce|pulse|ping|spin)$/i;
530
+
531
+ function isDefaultFontOnly(value) {
532
+ const cleaned = cleanValue(value).replace(/;.*$/, '').trim();
533
+ if (!cleaned) return false;
534
+ const families = splitSelectorList(cleaned)
535
+ .map((f) => f.trim().replace(/^['"]|['"]$/g, '').trim().toLowerCase())
536
+ .filter(Boolean);
537
+ if (!families.length) return false;
538
+ return families.some((f) => aiDefaultFonts.has(f)) && families.every((f) => defaultOnlyFontStack.has(f));
539
+ }
540
+
541
+ function maskSourceComments(text, ext) {
542
+ const chars = text.split('');
543
+ const allowSlash = slashCommentExts.has(ext);
544
+ const allowHash = hashCommentExts.has(ext);
545
+ const allowDash = dashCommentExts.has(ext);
546
+ const allowSemi = semiCommentExts.has(ext);
547
+ const allowHtml = !cssExts.has(ext);
548
+ const allowBlockSlash = cssExts.has(ext) || allowSlash || markupExts.has(ext)
549
+ || ['.mdx', '.razor', '.heex', '.erb', '.templ', '.mjml', '.twig'].includes(ext);
550
+ for (let i = 0; i < text.length; i += 1) {
551
+ if (allowBlockSlash && text[i] === '/' && text[i + 1] === '*') {
552
+ const end = text.indexOf('*/', i + 2);
553
+ const stop = end < 0 ? text.length - 1 : end + 1;
554
+ blankRange(chars, i, stop);
555
+ i = stop;
556
+ } else if (allowHtml && text.slice(i, i + 4) === '<!--') {
557
+ const end = text.indexOf('-->', i + 4);
558
+ const stop = end < 0 ? text.length - 1 : end + 2;
559
+ blankRange(chars, i, stop);
560
+ i = stop;
561
+ }
562
+ }
563
+ if (!allowSlash && !allowHash && !allowDash && !allowSemi) return chars.join('');
564
+ const doubleOnly = doubleQuoteOnlyExts.has(ext);
565
+ const outLines = chars.join('').split('\n').map((line) => {
566
+ let quote = '';
567
+ for (let i = 0; i < line.length; i += 1) {
568
+ const c = line[i];
569
+ if (quote) {
570
+ if (c === '\\') i += 1;
571
+ else if (c === quote) quote = '';
572
+ } else if (c === '"' || (!doubleOnly && (c === "'" || c === '`'))) {
573
+ quote = c;
574
+ } else if (allowSlash && c === '/' && line[i + 1] === '/' && (i === 0 || line[i - 1] !== ':')) {
575
+ return line.slice(0, i) + ' '.repeat(line.length - i);
576
+ } else if (allowHash && c === '#' && !/^#(?:[0-9a-fA-F]{3}|[0-9a-fA-F]{4}|[0-9a-fA-F]{6}|[0-9a-fA-F]{8})(?![0-9a-fA-F_])/.test(line.slice(i))) {
577
+ return line.slice(0, i) + ' '.repeat(line.length - i);
578
+ } else if (allowDash && c === '-' && line[i + 1] === '-') {
579
+ return line.slice(0, i) + ' '.repeat(line.length - i);
580
+ } else if (allowSemi && c === ';') {
581
+ return line.slice(0, i) + ' '.repeat(line.length - i);
582
+ }
583
+ }
584
+ return line;
585
+ });
586
+ return outLines.join('\n');
587
+ }
588
+
589
+ function findTagEnd(text, start) {
590
+ let quote = '', braceDepth = 0;
591
+ for (let i = start; i < text.length; i += 1) {
592
+ const c = text[i];
593
+ if (quote) {
594
+ if (c === '\\') i += 1;
595
+ else if (c === quote) quote = '';
596
+ } else if (c === '"' || c === "'" || c === '`') {
597
+ quote = c;
598
+ } else if (c === '{') {
599
+ braceDepth += 1;
600
+ } else if (c === '}' && braceDepth > 0) {
601
+ braceDepth -= 1;
602
+ } else if (c === '>' && braceDepth === 0) {
603
+ return i;
604
+ }
605
+ }
606
+ return -1;
607
+ }
608
+
609
+ function extractStringChunks(expr, baseOffset) {
610
+ const chunks = [];
611
+ for (let i = 0; i < expr.length; i += 1) {
612
+ const c = expr[i];
613
+ if (c === '"' || c === "'") {
614
+ const start = i + 1;
615
+ i += 1;
616
+ for (; i < expr.length; i += 1) {
617
+ if (expr[i] === '\\') i += 1;
618
+ else if (expr[i] === c) break;
619
+ }
620
+ chunks.push({ text: expr.slice(start, i), offset: baseOffset + start });
621
+ } else if (c === '`') {
622
+ let segStart = i + 1;
623
+ i += 1;
624
+ for (; i < expr.length; i += 1) {
625
+ if (expr[i] === '\\') { i += 1; continue; }
626
+ if (expr[i] === '`') {
627
+ chunks.push({ text: expr.slice(segStart, i), offset: baseOffset + segStart });
628
+ break;
629
+ }
630
+ if (expr[i] === '$' && expr[i + 1] === '{') {
631
+ chunks.push({ text: expr.slice(segStart, i), offset: baseOffset + segStart });
632
+ const end = findBraceEnd(expr, i + 1);
633
+ if (end < 0) break;
634
+ chunks.push(...extractStringChunks(expr.slice(i + 2, end), baseOffset + i + 2));
635
+ i = end;
636
+ segStart = end + 1;
637
+ }
638
+ }
639
+ }
640
+ }
641
+ return chunks;
642
+ }
643
+
644
+ function tokenizeClassChunks(chunks) {
645
+ const tokens = [];
646
+ for (const chunk of chunks) {
647
+ const re = /\S+/g;
648
+ let m;
649
+ while ((m = re.exec(chunk.text))) {
650
+ tokens.push({ value: m[0], offset: chunk.offset + m.index });
651
+ }
652
+ }
653
+ return tokens;
654
+ }
655
+
656
+ function extractClassBlocks(text) {
657
+ const blocks = [];
658
+ const re = /\b(?:class|className)\s*=\s*/g;
659
+ let m;
660
+ while ((m = re.exec(text))) {
661
+ const pos = m.index + m[0].length;
662
+ const ch = text[pos];
663
+ if (ch === '"' || ch === "'") {
664
+ let end = pos + 1;
665
+ for (; end < text.length; end += 1) {
666
+ if (text[end] === '\\') end += 1;
667
+ else if (text[end] === ch) break;
668
+ }
669
+ if (end < text.length) {
670
+ const content = text.slice(pos + 1, end);
671
+ blocks.push({ tokens: tokenizeClassChunks([{ text: content, offset: pos + 1 }]), offset: pos + 1, end });
672
+ re.lastIndex = end + 1;
673
+ }
674
+ } else if (ch === '{') {
675
+ const end = findBraceEnd(text, pos);
676
+ if (end > pos) {
677
+ const expr = text.slice(pos + 1, end);
678
+ blocks.push({ tokens: tokenizeClassChunks(extractStringChunks(expr, pos + 1)), offset: pos + 1, end });
679
+ re.lastIndex = end + 1;
680
+ }
681
+ }
682
+ }
683
+ return blocks;
684
+ }
685
+
686
+ function extractInlineStyleBlocks(text) {
687
+ const htmlStyles = [];
688
+ const jsxStyles = [];
689
+ const re = /\bstyle\s*=\s*/g;
690
+ let m;
691
+ while ((m = re.exec(text))) {
692
+ const pos = m.index + m[0].length;
693
+ const ch = text[pos];
694
+ if (ch === '"' || ch === "'") {
695
+ let end = pos + 1;
696
+ for (; end < text.length; end += 1) {
697
+ if (text[end] === '\\') end += 1;
698
+ else if (text[end] === ch) break;
699
+ }
700
+ if (end < text.length) {
701
+ htmlStyles.push({ body: text.slice(pos + 1, end), offset: pos + 1, attrStart: m.index });
702
+ re.lastIndex = end + 1;
703
+ }
704
+ } else if (ch === '{' && text.slice(pos + 1).trimStart().startsWith('{')) {
705
+ const outerEnd = findBraceEnd(text, pos);
706
+ if (outerEnd > pos) {
707
+ const innerOpen = text.indexOf('{', pos + 1);
708
+ const innerEnd = findBraceEnd(text, innerOpen);
709
+ if (innerEnd > innerOpen && innerEnd < outerEnd) {
710
+ jsxStyles.push({ body: text.slice(innerOpen + 1, innerEnd), offset: innerOpen + 1, attrStart: m.index });
711
+ }
712
+ re.lastIndex = outerEnd + 1;
713
+ }
714
+ }
715
+ }
716
+ return { htmlStyles, jsxStyles };
717
+ }
718
+
719
+ function enclosingTagHasFocusClass(text, attrStart) {
720
+ let open = attrStart;
721
+ while (open > 0 && text[open] !== '<') open -= 1;
722
+ if (text[open] !== '<') return false;
723
+ const end = findTagEnd(text, open + 1);
724
+ if (end < attrStart) return false;
725
+ const tagText = text.slice(open, end + 1);
726
+ return extractClassBlocks(tagText).some((block) => block.tokens.some((tok) => twFocusReplaceRe.test(tok.value)));
727
+ }
728
+
729
+ function jsxStyleDecls(body) {
730
+ const out = [];
731
+ const propMap = {
732
+ outline: 'outline',
733
+ outlinestyle: 'outline-style',
734
+ outlinewidth: 'outline-width',
735
+ boxshadow: 'box-shadow',
736
+ border: 'border',
737
+ bordercolor: 'border-color',
738
+ borderstyle: 'border-style',
739
+ borderwidth: 'border-width',
740
+ textdecoration: 'text-decoration',
741
+ textdecorationline: 'text-decoration-line',
742
+ transition: 'transition',
743
+ background: 'background',
744
+ backgroundimage: 'background-image',
745
+ backgroundclip: 'background-clip',
746
+ webkitbackgroundclip: '-webkit-background-clip',
747
+ color: 'color',
748
+ webkittextfillcolor: '-webkit-text-fill-color',
749
+ };
750
+ const re = /\b([a-zA-Z_$][a-zA-Z0-9_$]*)\s*:\s*(?:"([^"]*)"|'([^']*)'|(-?\d+(?:\.\d+)?))/g;
751
+ let m;
752
+ while ((m = re.exec(body))) {
753
+ const mapped = propMap[m[1].toLowerCase()];
754
+ if (!mapped) continue;
755
+ const rawVal = m[2] ?? m[3] ?? m[4] ?? '';
756
+ out.push({ prop: mapped, value: rawVal.trim().toLowerCase(), offset: m.index });
757
+ }
758
+ return out;
759
+ }
760
+
761
+ function scanPlaceholderLabels(text, add) {
762
+ const labeledIds = new Set();
763
+ const labelSpans = [];
764
+ const labelStack = [];
765
+ const inputs = [];
766
+ const tagRe = /<(\/?)(label|input|textarea)(?=[\s/>])/gi;
767
+ let m;
768
+ while ((m = tagRe.exec(text))) {
769
+ const isClose = m[1] === '/';
770
+ const name = m[2].toLowerCase();
771
+ const end = findTagEnd(text, m.index + m[0].length);
772
+ if (end < 0) continue;
773
+ const raw = text.slice(m.index, end + 1);
774
+ if (name === 'label') {
775
+ if (isClose) {
776
+ const openStart = labelStack.pop();
777
+ if (openStart !== undefined) labelSpans.push([openStart, end]);
778
+ } else {
779
+ const forMatch = /\b(?:for|htmlFor)\s*=\s*(?:"([^"]+)"|'([^']+)'|\{\s*["']([^"']+)["']\s*\})/i.exec(raw);
780
+ if (forMatch) labeledIds.add(forMatch[1] || forMatch[2] || forMatch[3]);
781
+ if (!/\/\s*>$/.test(raw)) labelStack.push(m.index);
782
+ }
783
+ } else if (!isClose) {
784
+ inputs.push({ start: m.index, end, raw });
785
+ }
786
+ tagRe.lastIndex = end + 1;
787
+ }
788
+ for (const tag of inputs) {
789
+ if (!/\bplaceholder\s*=/i.test(tag.raw)) continue;
790
+ if (/\btype\s*=\s*(?:["']hidden["']|\{\s*["']hidden["']\s*\})/i.test(tag.raw)) continue;
791
+ if (/\baria-label(?:ledby)?\s*=/i.test(tag.raw)) continue;
792
+ const idMatch = /\bid\s*=\s*(?:"([^"]+)"|'([^']+)'|\{\s*["']([^"']+)["']\s*\})/i.exec(tag.raw);
793
+ const id = idMatch ? (idMatch[1] || idMatch[2] || idMatch[3]) : null;
794
+ if (id && labeledIds.has(id)) continue;
795
+ if (labelSpans.some(([s, e]) => tag.start > s && tag.end < e)) continue;
796
+ add('placeholder-as-label', 'P1', 4, lineOf(text, tag.start), tag.raw.replace(/\s+/g, ' '),
797
+ 'Use a persistent programmatic label; placeholder is only a hint.');
798
+ }
799
+ }
800
+
801
+ function hasGenericCopy(line) {
802
+ if (/lorem ipsum/i.test(line)) return true;
803
+ const re = /(?<![a-zA-Z0-9_$.-])(?:get started|seamless|unlock|revolutionize|elevate|supercharge|cutting-edge|next-gen|effortless|empower|streamline|all-in-one|reimagine|unleash|ai-powered|game-changing|built for modern teams|delve)(?![a-zA-Z0-9_-])/gi;
804
+ let m;
805
+ while ((m = re.exec(line))) {
806
+ const before = line.slice(0, m.index);
807
+ const after = line.slice(m.index + m[0].length);
808
+ if (/\b(?:const|let|var|function|class|def|fn|func|import|export|from|type|interface|struct|enum)\s+$/.test(before)) continue;
809
+ if (/^\s*=(?!=)|^\(/.test(after)) continue;
810
+ return true;
811
+ }
812
+ return false;
813
+ }
814
+
815
+ function scanEmptyHandlers(masked, text, add) {
816
+ const emptyFnRe = /\bon[A-Z][a-zA-Z0-9]*\s*=\s*\{\s*(?:(?:\([^)]*\)|[a-zA-Z_$][a-zA-Z0-9_$]*)\s*=>\s*(?:\{\s*\}|undefined|null)|function\s*\([^)]*\)\s*\{\s*\})\s*\}/g;
817
+ let m;
818
+ while ((m = emptyFnRe.exec(masked))) {
819
+ add('empty-event-handler', 'P1', 4, lineOf(text, m.index), m[0].replace(/\s+/g, ' '),
820
+ 'Implement real handler logic or disable/remove the stub control.');
821
+ }
822
+ const preventOnlyRe = /\bon[A-Z][a-zA-Z0-9]*\s*=\s*\{\s*(?:(?:\([^)]*\)|[a-zA-Z_$][a-zA-Z0-9_$]*)\s*=>|function\s*\([^)]*\))\s*\{\s*(?:return\s+)?[a-zA-Z_$][a-zA-Z0-9_$]*\.preventDefault\(\s*\)\s*;?\s*\}\s*\}/g;
823
+ while ((m = preventOnlyRe.exec(masked))) {
824
+ add('empty-event-handler', 'P1', 4, lineOf(text, m.index), m[0].replace(/\s+/g, ' '),
825
+ 'Complete the submit/event handler instead of calling only preventDefault().');
826
+ }
827
+ const anchorRe = /<a(?=[\s/>])/gi;
828
+ while ((m = anchorRe.exec(masked))) {
829
+ const end = findTagEnd(masked, m.index + m[0].length);
830
+ if (end < 0) continue;
831
+ const raw = masked.slice(m.index, end + 1);
832
+ anchorRe.lastIndex = end + 1;
833
+ if (!/\bhref\s*=\s*(?:["']\s*#\s*["']|\{\s*["']\s*#\s*["']\s*\})/i.test(raw)) continue;
834
+ if (/\brole\s*=/i.test(raw)) continue;
835
+ if (/\b(?:onClick|onclick|@click|v-on:click|on:click|x-on:click|hx-get|hx-post|hx-put|hx-delete|hx-patch|phx-click|wire:click)\s*=/i.test(raw)) continue;
836
+ add('empty-event-handler', 'P1', 4, lineOf(text, m.index), raw.replace(/\s+/g, ' '),
837
+ 'Replace dead href="#" links with a real destination or a <button type="button"> handler.');
838
+ }
839
+ }
840
+
841
+ function scanTodoStubs(lines, ext, add) {
842
+ const slashOrHtmlTodoRe = /(?:(?:^|[^:])\/\/|\/\*|<!--)\s*(?:TODO|FIXME)\b/i;
843
+ const slashOrHtmlEllipsisRe = /(?:(?:^|[^:])\/\/|\/\*|<!--)\s*\.\.\.\s*(?:rest\s+of|more\b|remaining|add\s+more|implement|placeholder|omitted|other\b|similar\b|etc\b)/i;
844
+ const isHash = hashCommentExts.has(ext);
845
+ const isDash = dashCommentExts.has(ext);
846
+ const isSemi = semiCommentExts.has(ext);
847
+ const hashTodoRe = /(?:^|\s)#\s*(?:TODO|FIXME)\b/i;
848
+ const hashEllipsisRe = /(?:^|\s)#\s*\.\.\.\s*(?:rest\s+of|more\b|remaining|add\s+more|implement|placeholder|omitted|other\b|similar\b|etc\b)/i;
849
+ const dashTodoRe = /--\s*(?:TODO|FIXME)\b/i;
850
+ const dashEllipsisRe = /--\s*\.\.\.\s*(?:rest\s+of|more\b|remaining|add\s+more|implement|placeholder|omitted|other\b|similar\b|etc\b)/i;
851
+ const semiTodoRe = /;\s*(?:TODO|FIXME)\b/i;
852
+ const semiEllipsisRe = /;\s*\.\.\.\s*(?:rest\s+of|more\b|remaining|add\s+more|implement|placeholder|omitted|other\b|similar\b|etc\b)/i;
853
+
854
+ lines.forEach((line, i) => {
855
+ const matched = slashOrHtmlTodoRe.test(line)
856
+ || slashOrHtmlEllipsisRe.test(line)
857
+ || (isHash && (hashTodoRe.test(line) || hashEllipsisRe.test(line)))
858
+ || (isDash && (dashTodoRe.test(line) || dashEllipsisRe.test(line)))
859
+ || (isSemi && (semiTodoRe.test(line) || semiEllipsisRe.test(line)));
860
+ if (matched) {
861
+ add('todo-stub-in-ui', 'P1', 4, i + 1, line,
862
+ 'Finish the implementation or remove unfinished TODO/FIXME/ellipsis stub comments before shipping.');
863
+ }
864
+ });
865
+ }
866
+
867
+ function hasMv3ExtensionManifest(file) {
868
+ let dir = path.dirname(file);
869
+ for (let depth = 0; depth < 3; depth += 1) {
870
+ const manifestPath = path.join(dir, 'manifest.json');
871
+ if (fs.existsSync(manifestPath)) {
872
+ try {
873
+ const raw = fs.readFileSync(manifestPath, 'utf8');
874
+ if (/"manifest_version"\s*:\s*3\b/.test(raw)) return true;
875
+ } catch {}
876
+ }
877
+ const parent = path.dirname(dir);
878
+ if (parent === dir) break;
879
+ dir = parent;
880
+ }
881
+ return false;
882
+ }
883
+
884
+ function stripAllowedImportantBlocks(cssText) {
885
+ const chars = cssText.split('');
886
+ const mediaRe = /@media\b([^{]*)\{/gi;
887
+ let m;
888
+ while ((m = mediaRe.exec(cssText))) {
889
+ const query = m[1] || '';
890
+ if (!/\b(?:prefers-reduced-motion|print|forced-colors|prefers-contrast)\b/i.test(query)) continue;
891
+ const openIdx = m.index + m[0].length - 1;
892
+ const closeIdx = findBraceEnd(cssText, openIdx);
893
+ if (closeIdx > openIdx) {
894
+ blankRange(chars, m.index, closeIdx);
895
+ mediaRe.lastIndex = closeIdx + 1;
896
+ }
897
+ }
898
+ return chars.join('').replace(/\[hidden\]\s*\{\s*display\s*:\s*none\s*!important\s*;?\s*\}/gi, (s) => s.replace(/[^\r\n]/g, ' '));
899
+ }
900
+
901
+ function scanImportantSprawl(file, text, add) {
902
+ const matches = [];
903
+ for (const seg of cssSegments(file, text)) {
904
+ const cleaned = stripAllowedImportantBlocks(maskCssComments(seg.text));
905
+ const re = /!important\b/gi;
906
+ let m;
907
+ while ((m = re.exec(cleaned))) {
908
+ matches.push(seg.offset + m.index);
909
+ }
910
+ }
911
+ if (matches.length >= 4) {
912
+ add('important-override-sprawl', 'P2', 2, lineOf(text, matches[0]),
913
+ `${matches.length} !important declarations outside @media print / reduced-motion / forced-colors`,
914
+ 'Resolve specificity cleanly with CSS @layer, semantic tokens, or component state variants instead of !important overrides.');
915
+ }
916
+ }
917
+
918
+ function scanImeEnterGuard(masked, text, ext, add) {
919
+ const webScriptExts = new Set(['.js', '.jsx', '.ts', '.tsx', '.vue', '.svelte', '.astro', '.html']);
920
+ if (!webScriptExts.has(ext)) return;
921
+ if (/\bisComposing\b|\bkeyCode\s*(?:===?|!==?)\s*229\b|\bcompositionstart\b/.test(masked)) return;
922
+
923
+ // 1. Multiline/chat composer Enter-without-Shift submit pattern missing IME composition check
924
+ const shiftEnterRe = /(?:\.key\s*===\s*['"]Enter['"]\s*&&\s*![a-zA-Z0-9_$.]+\.shiftKey|![a-zA-Z0-9_$.]+\.shiftKey\s*&&\s*[a-zA-Z0-9_$.]+\.key\s*===\s*['"]Enter['"])/g;
925
+ let m = shiftEnterRe.exec(masked);
926
+ if (m) {
927
+ add('ime-enter-without-composing', 'P1', 4, lineOf(text, m.index), m[0].replace(/\s+/g, ' '),
928
+ 'Guard Enter-to-submit handlers with `if (e.isComposing || e.keyCode === 229) return;` so CJK/Vietnamese Telex IME candidate confirmation does not submit prematurely.');
929
+ return;
930
+ }
931
+
932
+ // 2. <input> or <textarea> inline keydown Enter submit without isComposing check
933
+ const fieldRe = /<(?:input|textarea)(?=[\s/>])/gi;
934
+ while ((m = fieldRe.exec(masked))) {
935
+ const end = findTagEnd(masked, m.index + m[0].length);
936
+ if (end < 0) continue;
937
+ const raw = masked.slice(m.index, end + 1);
938
+ fieldRe.lastIndex = end + 1;
939
+ if (/\bonKeyDown\s*=\s*\{[\s\S]*?\.key\s*===\s*['"]Enter['"][\s\S]*?\}/i.test(raw)
940
+ || /(?:@keydown|v-on:keydown|on:keydown)\.enter(?![a-zA-Z0-9_-])\s*=/i.test(raw)) {
941
+ add('ime-enter-without-composing', 'P1', 4, lineOf(text, m.index), raw.replace(/\s+/g, ' '),
942
+ 'Check `event.isComposing || event.keyCode === 229` before submitting on Enter so IME composition commit never fires premature submission.');
943
+ return;
944
+ }
945
+ }
946
+ }
947
+
948
+ function scanMv3RemoteCode(file, masked, text, ext, add) {
949
+ const extCandidateExts = new Set(['.html', '.js', '.jsx', '.ts', '.tsx', '.vue', '.svelte']);
950
+ if (!extCandidateExts.has(ext)) return;
951
+ const hasExtApi = /\b(?:chrome|browser)\.(?:runtime|storage|tabs|scripting|action|sidePanel|alarms|permissions|webNavigation)\b|\bdefine(?:Background|ContentScript)\s*\(/.test(masked);
952
+ if (!hasExtApi && !hasMv3ExtensionManifest(file)) return;
953
+
954
+ const remoteScriptTag = /<script\b[^>]*\bsrc\s*=\s*["'](?:https?:)?\/\/[^"']+["'][^>]*>/i.exec(masked);
955
+ if (remoteScriptTag) {
956
+ add('mv3-remote-script', 'P0', 5, lineOf(text, remoteScriptTag.index), remoteScriptTag[0].replace(/\s+/g, ' '),
957
+ 'Bundle all executable scripts inside the extension package; Chrome Web Store Manifest V3 strictly rejects Remotely Hosted Code.');
958
+ return;
959
+ }
960
+ const remoteDynamicImport = /\bimport\s*\(\s*["'`]https?:\/\/[^"'`]+["'`]\s*\)/.exec(masked);
961
+ if (remoteDynamicImport) {
962
+ add('mv3-remote-script', 'P0', 5, lineOf(text, remoteDynamicImport.index), remoteDynamicImport[0].replace(/\s+/g, ' '),
963
+ 'Do not dynamically import remote https:// modules in a Manifest V3 extension; bundle dependencies locally at build time.');
964
+ }
965
+ }
966
+
453
967
  function scanFile(file, root) {
454
968
  const text = fs.readFileSync(file, 'utf8');
969
+ const ext = path.extname(file);
970
+ const masked = maskSourceComments(text, ext);
455
971
  const lines = text.split(/\r?\n/);
972
+ const maskedLines = masked.split(/\r?\n/);
456
973
  const findings = [];
457
974
  const seenRules = new Set();
458
975
  const add = (rule, severity, weight, line, match, fix) => {
@@ -462,9 +979,20 @@ function scanFile(file, root) {
462
979
  findings.push({ rule, severity, weight, file: path.relative(root, file), line, match: match.trim().slice(0, 160), fix });
463
980
  };
464
981
 
982
+ // Pre-comment-mask anti-laziness check for unfinished TODO/FIXME/ellipsis stubs.
983
+ scanTodoStubs(lines, ext, add);
984
+ scanImportantSprawl(file, text, add);
985
+ scanImeEnterGuard(masked, text, ext, add);
986
+ scanMv3RemoteCode(file, masked, text, ext, add);
987
+
465
988
  // Focus scan is heuristic; live keyboard testing remains authoritative.
989
+ let cssMotionMatch = null;
466
990
  for (const segment of cssSegments(file, text)) {
467
991
  const maskedSegment = { text: maskCssComments(segment.text), offset: segment.offset };
992
+ if (!cssMotionMatch) {
993
+ const m = /@keyframes\b|(?<![a-zA-Z0-9_-])(?:animation(?:-name)?|transition(?:-property)?)\s*:\s*(?!none\b)/i.exec(maskedSegment.text);
994
+ if (m) cssMotionMatch = { index: segment.offset + m.index, text: m[0].replace(/:\s*$/, '') };
995
+ }
468
996
  scanRules(maskedSegment, segment.offset, maskedSegment.text, (selectorText, decls, location, contexts) => {
469
997
  const lastFirst = [...decls].reverse();
470
998
  const declaration = (property) => lastFirst.find((decl) => property.test(decl.prop));
@@ -490,39 +1018,144 @@ function scanFile(file, root) {
490
1018
  if (!outline.removal || visibleReplacement(decls, outline)) return;
491
1019
  for (const context of contexts) {
492
1020
  if (!context.relevant) continue;
493
- add('outline-removed','P0',5,lineOf(text,location.bodyIndex + outline.removal.offset),`outline: ${outline.removal.value}`,'Restore a visible keyboard focus indicator.');
1021
+ add('outline-removed','P0',5,lineOf(text,location.bodyIndex + outline.removal.offset),`${outline.removal.prop}: ${outline.removal.value}`,'Restore a visible keyboard focus indicator.');
494
1022
  }
495
1023
  });
496
1024
  }
497
1025
 
1026
+ let twMotionMatch = null;
1027
+ if (!cssExts.has(ext)) {
1028
+ for (const block of extractClassBlocks(masked)) {
1029
+ const removal = block.tokens.find((tok) => twOutlineRemoveRe.test(tok.value));
1030
+ if (removal && !block.tokens.some((tok) => twFocusReplaceRe.test(tok.value))) {
1031
+ add('outline-removed', 'P0', 5, lineOf(text, removal.offset), removal.value, 'Restore a visible keyboard focus indicator.');
1032
+ }
1033
+ for (const tok of block.tokens) {
1034
+ if (twTransitionAllRe.test(tok.value)) {
1035
+ add('transition-all', 'P2', 2, lineOf(text, tok.offset), tok.value, 'Animate only intentional properties with semantic durations/easing.');
1036
+ }
1037
+ if (!twMotionMatch && twAnimateUtilityRe.test(tok.value)) {
1038
+ twMotionMatch = { index: tok.offset, text: tok.value };
1039
+ }
1040
+ }
1041
+ const clipTok = block.tokens.find((tok) => /^(?:[a-z0-9-[\]()]+:)*bg-clip-text$/i.test(tok.value));
1042
+ const transparentTok = block.tokens.find((tok) => /^(?:[a-z0-9-[\]()]+:)*text-transparent$/i.test(tok.value));
1043
+ const gradTok = block.tokens.find((tok) => /^(?:[a-z0-9-[\]()]+:)*bg-(?:gradient|linear)-to-/i.test(tok.value));
1044
+ if (clipTok && transparentTok && gradTok) {
1045
+ add('gradient-text-treatment', 'P3', 1, lineOf(text, clipTok.offset), `${gradTok.value} ${clipTok.value} ${transparentTok.value}`,
1046
+ 'Check that decorative gradient text fits the direction and remains legible.');
1047
+ }
1048
+ }
1049
+
1050
+ const { htmlStyles, jsxStyles } = extractInlineStyleBlocks(masked);
1051
+ const inspectInlineDecls = (decls, baseOffset, attrStart) => {
1052
+ const lastFirst = [...decls].reverse();
1053
+ const declaration = (property) => lastFirst.find((decl) => property.test(decl.prop));
1054
+ const clip = declaration(/^(?:-webkit-)?background-clip$/);
1055
+ const background = declaration(/^background(?:-image)?$/);
1056
+ const color = declaration(/^(?:color|-webkit-text-fill-color)$/);
1057
+ if (clip && cleanValue(clip.value) === 'text' && background && /gradient\(/i.test(background.value)
1058
+ && color && cleanValue(color.value) === 'transparent') {
1059
+ add('gradient-text-treatment', 'P3', 1, lineOf(text, baseOffset + clip.offset), 'inline style gradient text',
1060
+ 'Check that decorative gradient text fits the direction and remains legible.');
1061
+ }
1062
+ const trans = declaration(/^transition$/);
1063
+ if (trans && /^all\b/.test(cleanValue(trans.value))) {
1064
+ add('transition-all', 'P2', 2, lineOf(text, baseOffset + trans.offset), `transition: ${trans.value}`,
1065
+ 'Animate only intentional properties with semantic durations/easing.');
1066
+ }
1067
+ const outline = analyzeOutline(decls);
1068
+ if (outline.removal && !visibleReplacement(decls, outline) && !enclosingTagHasFocusClass(masked, attrStart)) {
1069
+ add('outline-removed', 'P0', 5, lineOf(text, baseOffset + outline.removal.offset),
1070
+ `${outline.removal.prop}: ${outline.removal.value}`, 'Restore a visible keyboard focus indicator.');
1071
+ }
1072
+ };
1073
+ for (const styleBlock of htmlStyles) {
1074
+ inspectInlineDecls(declarations(styleBlock.body), styleBlock.offset, styleBlock.attrStart);
1075
+ }
1076
+ for (const styleBlock of jsxStyles) {
1077
+ inspectInlineDecls(jsxStyleDecls(styleBlock.body), styleBlock.offset, styleBlock.attrStart);
1078
+ }
1079
+
1080
+ scanPlaceholderLabels(masked, add);
1081
+ scanEmptyHandlers(masked, text, add);
1082
+ }
1083
+
1084
+ const hasThrottledRepaint = ext === '.rs' && /\brequest_repaint_after\b/.test(masked);
1085
+
498
1086
  lines.forEach((line, i) => {
499
1087
  const n = i + 1;
500
- if (/font-family\s*:\s*['"]?(Inter|Roboto|Geist|Arial)['"]?\s*;?/i.test(line)) add('default-font-only','P2',2,n,line,'Choose type by voice/platform and provide deliberate fallbacks.');
501
- if (/transition\s*:\s*all\b/.test(line)) add('transition-all','P2',2,n,line,'Animate only intentional properties with semantic durations/easing.');
502
- if (/<(input|textarea)\b[^>]*placeholder=/i.test(line) && !/aria-label|aria-labelledby/i.test(line)) add('placeholder-as-label','P1',4,n,line,'Use a persistent programmatic label; placeholder is only a hint.');
503
- if (/(user-scalable\s*=\s*["']?no|maximum-scale\s*=\s*["']?1(?:\.0)?\b)/i.test(line)) add('zoom-disabled','P0',5,n,line,'Do not disable pinch zoom or text scaling.');
504
- if (/\p{Extended_Pictographic}/u.test(line) && /icon|button|nav|<span/i.test(line)) add('emoji-as-icon','P2',2,n,line,'Use a coherent icon system or text instead of structural emoji.');
505
- if (/\b(get started|seamless|unlock|revolutionize|elevate)\b/i.test(line) || /lorem ipsum/i.test(line)) add('generic-copy','P2',2,n,line,'Replace template copy with concrete user/domain language.');
506
- if (/rounded-2xl/.test(line)) add('rounded-2xl-repetition','P3',1,n,line,'Use semantic radius variation rather than uniform rounded-2xl.');
507
- if (/shadow-(lg|xl|2xl)/.test(line)) add('uniform-shadow','P3',1,n,line,'Use elevation/shadow only where material semantics require it.');
1088
+ const maskedLine = maskedLines[i] ?? line;
1089
+ const fontMatch = /font-family\s*:\s*([^;}\n]+)/i.exec(maskedLine) || /fontFamily\s*:\s*['"]([^'"]+)['"]/.exec(maskedLine);
1090
+ if (fontMatch && isDefaultFontOnly(fontMatch[1])) add('default-font-only','P2',2,n,line,'Choose type by voice/platform and provide deliberate fallbacks.');
1091
+ if (/transition\s*:\s*['"]?all\b/.test(maskedLine)) add('transition-all','P2',2,n,line,'Animate only intentional properties with semantic durations/easing.');
1092
+ if (/(user-scalable\s*=\s*["']?no|maximum-scale\s*=\s*["']?1(?:\.0)?\b)/i.test(maskedLine)) add('zoom-disabled','P0',5,n,line,'Do not disable pinch zoom or text scaling.');
1093
+ if (/\btabindex\s*=\s*(?:["']\s*[1-9]\d*\s*["']|\{\s*[1-9]\d*\s*\})/i.test(maskedLine)) add('positive-tabindex','P1',3,n,line,'Use natural DOM order or tabindex="0" / "-1" instead of positive tabindex values.');
1094
+ if (/\p{Extended_Pictographic}/u.test(maskedLine) && /icon|button|nav|<span/i.test(maskedLine)) add('emoji-as-icon','P2',2,n,line,'Use a coherent icon system or text instead of structural emoji.');
1095
+ if (!cssExts.has(ext) && hasGenericCopy(maskedLine)) add('generic-copy','P2',2,n,line,'Replace template copy with concrete user/domain language.');
1096
+ if (/rounded-2xl/.test(maskedLine)) add('rounded-2xl-repetition','P3',1,n,line,'Use semantic radius variation rather than uniform rounded-2xl.');
1097
+ if (/shadow-(lg|xl|2xl)/.test(maskedLine)) add('uniform-shadow','P3',1,n,line,'Use elevation/shadow only where material semantics require it.');
1098
+ if (/\bdocument\.execCommand\s*\(/.test(maskedLine)) {
1099
+ add('lazy-diy-antipattern', 'P2', 2, n, line, 'Replace deprecated document.execCommand() with a maintained rich-text editor or explicit selection/clipboard API.');
1100
+ }
1101
+ if (ext === '.py' && /\b(?:import\s+tkinter\b|from\s+tkinter\s+import\b)/.test(maskedLine)) {
1102
+ add('lazy-diy-antipattern', 'P2', 2, n, line, 'Avoid defaulting to Tkinter for polished desktop UI; prefer PySide6/Qt, GTK4, or a modern native toolkit unless Tkinter is an explicit constraint.');
1103
+ }
1104
+ if (ext === '.kt' && /\bfontSize\s*=\s*\d+(?:\.\d+)?\.dp\b/.test(maskedLine)) {
1105
+ add('compose-dp-font-size', 'P1', 4, n, line, 'Use .sp instead of .dp for Compose fontSize so Android system font scaling applies.');
1106
+ }
1107
+ if (ext === '.dart' && /\b(?:TextScaler\.noScaling|textScaleFactor\s*:\s*1(?:\.0)?)\b/.test(maskedLine)) {
1108
+ add('flutter-text-scaling-locked', 'P0', 5, n, line, 'Do not lock Flutter text scaling; preserve MediaQuery textScaler for accessibility.');
1109
+ }
1110
+ if (ext === '.rs' && !hasThrottledRepaint && /\.request_repaint\s*\(\s*\)/.test(maskedLine)) {
1111
+ add('egui-unconditional-repaint', 'P2', 2, n, line, 'Use request_repaint_after(...) or event-driven updates instead of unconditional request_repaint() to avoid pegging CPU/GPU.');
1112
+ }
508
1113
  });
509
1114
 
510
- const rounded = (text.match(/rounded-2xl/g) || []).length;
1115
+ const rounded = (masked.match(/rounded-2xl/g) || []).length;
511
1116
  if (rounded < 3) for (const f of findings.filter((f) => f.rule === 'rounded-2xl-repetition')) f.drop = true;
512
- const shadows = (text.match(/shadow-(lg|xl|2xl)/g) || []).length;
1117
+ const shadows = (masked.match(/shadow-(lg|xl|2xl)/g) || []).length;
513
1118
  if (shadows < 3) for (const f of findings.filter((f) => f.rule === 'uniform-shadow')) f.drop = true;
514
1119
 
515
- if (/gradient/i.test(text) && /(purple|violet|indigo|blue|#[0-9a-f]{3,8})/i.test(text) && /(purple|violet|indigo)/i.test(text) && /(blue|cyan)/i.test(text)) add('purple-blue-gradient','P2',2,lineOf(text,/gradient/i.exec(text)?.index || 0),'gradient definition','Use a color posture derived from subject/material rather than the default AI gradient.');
516
- const paste = /paste[\s\S]{0,160}preventDefault|preventDefault[\s\S]{0,160}paste/i.exec(text);
1120
+ if (/gradient/i.test(masked) && /(purple|violet|indigo|blue|#[0-9a-f]{3,8})/i.test(masked) && /(purple|violet|indigo)/i.test(masked) && /(blue|cyan)/i.test(masked)) add('purple-blue-gradient','P2',2,lineOf(text,/gradient/i.exec(masked)?.index || 0),'gradient definition','Use a color posture derived from subject/material rather than the default AI gradient.');
1121
+ const paste = /paste[\s\S]{0,160}preventDefault|preventDefault[\s\S]{0,160}paste/i.exec(masked);
517
1122
  if (paste) add('paste-blocked','P0',5,lineOf(text,paste.index),paste[0],'Never block paste; it harms password managers, accessibility, and recovery.');
518
- const motion = /@keyframes|\banimation\b|\btransition\b/.exec(text);
519
- if (motion && !/prefers-reduced-motion|reduceMotion|accessibilityReduceMotion/i.test(text)) add('missing-reduced-motion','P1',4,lineOf(text,motion.index),motion[0],'Provide a reduced-motion path when animation or transitions exist.');
520
- const hexes = [...text.matchAll(/#[0-9a-fA-F]{3,8}\b/g)];
521
- const tokenRefs = (text.match(/var\(|token|theme\.|Color\.|semantic/gi) || []).length;
522
- if (hexes.length >= 6 && hexes.length > tokenRefs * 2) add('hardcoded-color-literals','P2',2,lineOf(text,hexes[0].index),`${hexes.length} hardcoded color literals`,'Move recurring colors into semantic tokens and verify contrast roles.');
523
- const heroIndex = text.search(/hero|text-center|items-center|justify-center|mx-auto/i);
524
- const ctaCount = (text.match(/<button|<a\b|get started|learn more/gi) || []).length;
525
- if (heroIndex >= 0 && ctaCount >= 2 && /(hero|text-center)/i.test(text)) add('centered-hero-two-ctas','P3',1,lineOf(text,heroIndex),'centered hero with repeated calls to action','Question the centered hero/two-CTA template; choose composition from the user decision.');
1123
+ let motion = cssMotionMatch || twMotionMatch;
1124
+ if (!motion && !cssExts.has(ext)) {
1125
+ const inlineMotion = /@keyframes\b|(?<![a-zA-Z0-9_-])(?:animation(?:-name)?|transition(?:-property)?)\s*:\s*(?!none\b|['"]none['"]|string\b|boolean\b|number\b)/i.exec(masked);
1126
+ if (inlineMotion) motion = { index: inlineMotion.index, text: inlineMotion[0].replace(/:\s*$/, '') };
1127
+ }
1128
+ if (!motion && !cssExts.has(ext)) {
1129
+ const jsMotion = /\bgsap\.(?:to|from|fromTo)\s*\(|\bwhileInView\s*=|<motion\.[a-zA-Z0-9_]+/.exec(masked);
1130
+ if (jsMotion) motion = { index: jsMotion.index, text: jsMotion[0] };
1131
+ }
1132
+ if (!motion && ext === '.swift') {
1133
+ const swiftMotion = /\.animation\s*\(|\bwithAnimation\b/.exec(masked);
1134
+ if (swiftMotion) motion = { index: swiftMotion.index, text: swiftMotion[0] };
1135
+ }
1136
+ if (!motion && ext === '.kt') {
1137
+ const ktMotion = /\banimate(?:Float|Color|Dp)AsState\s*\(/.exec(masked);
1138
+ if (ktMotion) motion = { index: ktMotion.index, text: ktMotion[0] };
1139
+ }
1140
+ if (!motion && ext === '.dart') {
1141
+ const dartMotion = /\bAnimationController\s*\(/.exec(masked);
1142
+ if (dartMotion) motion = { index: dartMotion.index, text: dartMotion[0] };
1143
+ }
1144
+ if (motion && !/prefers-reduced-motion|reduceMotion|accessibilityReduceMotion|motion-reduce:|useReducedMotion|disableAnimations|ANIMATOR_DURATION_SCALE/i.test(masked)) {
1145
+ add('missing-reduced-motion','P1',4,lineOf(text,motion.index),motion.text,'Provide a reduced-motion path when animation or transitions exist.');
1146
+ }
1147
+ const colorLiterals = [
1148
+ ...masked.matchAll(/#[0-9a-fA-F]{3,8}\b|\bColor\(\s*0x[0-9a-fA-F]{6,8}\s*\)|\bColor32::from_rgb(?:a_(?:unmultiplied|premultiplied))?\s*\(|\bColor\.FromA?Rgb\s*\(/g),
1149
+ ];
1150
+ const tokenRefs = (
1151
+ masked.match(/var\(|token|theme\.|Theme\.of\b|MaterialTheme\.colorScheme|Color\(\s*["']|Color\.accentColor\b|semantic/gi) || []
1152
+ ).length;
1153
+ if (colorLiterals.length >= 6 && colorLiterals.length > tokenRefs * 2) {
1154
+ add('hardcoded-color-literals', 'P2', 2, lineOf(text, colorLiterals[0].index), `${colorLiterals.length} hardcoded color literals`, 'Move recurring colors into semantic tokens and verify contrast roles.');
1155
+ }
1156
+ const heroIndex = masked.search(/hero|text-center|items-center|justify-center|mx-auto/i);
1157
+ const ctaCount = (masked.match(/<button|<a\b|get started|learn more/gi) || []).length;
1158
+ if (heroIndex >= 0 && ctaCount >= 2 && /(hero|text-center)/i.test(masked)) add('centered-hero-two-ctas','P3',1,lineOf(text,heroIndex),'centered hero with repeated calls to action','Question the centered hero/two-CTA template; choose composition from the user decision.');
526
1159
  return findings.filter((f) => !f.drop);
527
1160
  }
528
1161
 
@@ -551,18 +1184,26 @@ function applyWaivers(findings, file) {
551
1184
  return { active, waived, unusedWaivers: Array.from(byFinding.values()) };
552
1185
  }
553
1186
 
1187
+ const severityRank = { P0: 0, P1: 1, P2: 2, P3: 3 };
1188
+ const failOnThreshold = { p0: 0, p1: 1, p2: 2, any: 3 };
1189
+
554
1190
  try {
555
1191
  const args = process.argv.slice(2);
556
1192
  if (args.includes('--help') || args.includes('-h')) { console.log(help()); process.exit(0); }
557
1193
  const json = args.includes('--json');
558
- let dir, waivers;
1194
+ let dir, waivers, failOn;
559
1195
  for (let index = 0; index < args.length; index += 1) {
560
1196
  const argument = args[index];
561
1197
  if (argument === '--json') continue;
562
1198
  if (argument === '--waivers' && !waivers && args[index + 1] && !args[index + 1].startsWith('-')) waivers = args[++index];
1199
+ else if (argument === '--fail-on' && !failOn && args[index + 1] && !args[index + 1].startsWith('-')) failOn = args[++index].toLowerCase();
1200
+ else if (argument.startsWith('--fail-on=') && !failOn) failOn = argument.slice('--fail-on='.length).toLowerCase();
563
1201
  else if (!dir && !argument.startsWith('-')) dir = argument;
564
1202
  else throw new Error(`unexpected argument: ${argument}`);
565
1203
  }
1204
+ if (failOn !== undefined && !Object.hasOwn(failOnThreshold, failOn)) {
1205
+ throw new Error(`invalid --fail-on value '${failOn}'; expected one of p0, p1, p2, any`);
1206
+ }
566
1207
  if (!dir || !fs.existsSync(dir)) throw new Error('provide an existing file or directory to scan');
567
1208
  const input = path.resolve(dir);
568
1209
  const stat = fs.statSync(input);
@@ -580,6 +1221,12 @@ try {
580
1221
  for (const f of waiverReport.unusedWaivers ?? []) console.log(`unused waiver ${f.file}:${f.line} ${f.rule}`);
581
1222
  console.log(`disclaimer: ${disclaimer}`);
582
1223
  }
1224
+ if (failOn !== undefined) {
1225
+ const threshold = failOnThreshold[failOn];
1226
+ if (findings.some((f) => (severityRank[f.severity] ?? 3) <= threshold)) {
1227
+ process.exitCode = 1;
1228
+ }
1229
+ }
583
1230
  } catch (error) {
584
1231
  console.error(`slop-scan: ${error.message}`);
585
1232
  process.exit(1);