@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,1233 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+
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
+ ]);
24
+ const disclaimer = 'A zero score means only that these known fingerprints were not detected; zero findings is not evidence of good design.';
25
+ const brandRules = new Set(['default-font-only', 'purple-blue-gradient', 'rounded-2xl-repetition',
26
+ 'uniform-shadow', 'centered-hero-two-ctas', 'gradient-text-treatment', 'rounded-accent-rail']);
27
+
28
+ function help() {
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}`;
30
+ }
31
+ function partsOf(file) { return file.split(/[\\/]/); }
32
+ function isInstalledPixelcraftSkill(file) {
33
+ const parts = partsOf(file);
34
+ return parts.some((part, i) => skillHosts.has(part) && parts[i + 1] === 'skills' && parts[i + 2]?.startsWith('pixelcraft'));
35
+ }
36
+ function isInsidePixelcraftSkill(file) {
37
+ const parts = partsOf(file);
38
+ return parts.some((part, i) => part === 'skills' && parts[i + 1]?.startsWith('pixelcraft'));
39
+ }
40
+ function walk(dir, out = []) {
41
+ for (const entry of fs.readdirSync(dir, { withFileTypes: true })) {
42
+ if (skip.has(entry.name)) continue;
43
+ const file = path.join(dir, entry.name);
44
+ if (isInstalledPixelcraftSkill(file)) continue;
45
+ if ((entry.name === 'fixtures' || entry.name === 'examples') && isInsidePixelcraftSkill(file)) continue;
46
+ if (entry.isDirectory()) walk(file, out);
47
+ else if (exts.has(path.extname(entry.name))) out.push(file);
48
+ }
49
+ return out;
50
+ }
51
+ function lineOf(text, index) { return text.slice(0, index).split(/\r?\n/).length; }
52
+
53
+ function maskCssComments(text) {
54
+ const chars = text.split('');
55
+ let quote = '';
56
+ for (let i = 0; i < text.length; i += 1) {
57
+ const c = text[i];
58
+ if (quote) {
59
+ if (c === '\\') i += 1;
60
+ else if (c === quote) quote = '';
61
+ } else if (c === '"' || c === "'") quote = c;
62
+ else if (c === '/' && text[i + 1] === '*') {
63
+ chars[i] = chars[i + 1] = ' ';
64
+ i += 2;
65
+ for (; i < text.length; i += 1) {
66
+ if (text[i] === '*' && text[i + 1] === '/') {
67
+ chars[i] = chars[i + 1] = ' ';
68
+ i += 1;
69
+ break;
70
+ }
71
+ if (text[i] !== '\n' && text[i] !== '\r') chars[i] = ' ';
72
+ }
73
+ }
74
+ }
75
+ return chars.join('');
76
+ }
77
+
78
+ function blankRange(chars, start, end) {
79
+ for (let i = start; i <= end && i < chars.length; i += 1) {
80
+ if (chars[i] !== '\n' && chars[i] !== '\r') chars[i] = ' ';
81
+ }
82
+ }
83
+
84
+ function findBraceEnd(text, open) {
85
+ let depth = 1, quote = '';
86
+ for (let i = open + 1; i < text.length; i += 1) {
87
+ const c = text[i];
88
+ if (quote) {
89
+ if (c === '\\') i += 1;
90
+ else if (c === quote) quote = '';
91
+ } else if (c === '"' || c === "'") quote = c;
92
+ else if (c === '{') depth += 1;
93
+ else if (c === '}') {
94
+ depth -= 1;
95
+ if (depth === 0) return i;
96
+ }
97
+ }
98
+ return -1;
99
+ }
100
+
101
+ function extractNestedBlocks(body) {
102
+ const declarationChars = body.split('');
103
+ const nested = [];
104
+ let chunkStart = 0, depth = 0, quote = '';
105
+ for (let i = 0; i < body.length; i += 1) {
106
+ const c = body[i];
107
+ if (quote) {
108
+ if (c === '\\') i += 1;
109
+ else if (c === quote) quote = '';
110
+ } else if (c === '"' || c === "'") quote = c;
111
+ else if (c === '(' || c === '[') depth += 1;
112
+ else if (c === ')' || c === ']') depth = Math.max(0, depth - 1);
113
+ else if (c === ';' && depth === 0) chunkStart = i + 1;
114
+ else if (c === '{' && depth === 0) {
115
+ const end = findBraceEnd(body, i);
116
+ if (end < 0) break;
117
+ const rawPrelude = body.slice(chunkStart, i);
118
+ const prelude = rawPrelude.trim();
119
+ if (prelude) {
120
+ nested.push({
121
+ prelude,
122
+ body: body.slice(i + 1, end),
123
+ selectorIndex: chunkStart + rawPrelude.length - rawPrelude.trimStart().length,
124
+ bodyIndex: i + 1
125
+ });
126
+ }
127
+ blankRange(declarationChars, chunkStart, end);
128
+ chunkStart = end + 1;
129
+ i = end;
130
+ }
131
+ }
132
+ return { declarationText: declarationChars.join(''), nested };
133
+ }
134
+
135
+ function skipComment(text, i) {
136
+ const end = text.indexOf('*/', i + 2);
137
+ return end < 0 ? text.length : end + 2;
138
+ }
139
+
140
+ function styleSegments(text) {
141
+ const lower = text.toLowerCase();
142
+ const out = [];
143
+ let pos = 0;
144
+ while (pos < text.length) {
145
+ const open = lower.indexOf('<style', pos);
146
+ if (open < 0) break;
147
+ const tagEnd = lower.indexOf('>', open);
148
+ if (tagEnd < 0) break;
149
+ const close = lower.indexOf('</style', tagEnd + 1);
150
+ if (close < 0) break;
151
+ out.push({ text: text.slice(tagEnd + 1, close), offset: tagEnd + 1 });
152
+ pos = close + 8;
153
+ }
154
+ return out;
155
+ }
156
+
157
+ function cssSegments(file, text) {
158
+ const ext = path.extname(file);
159
+ if (cssExts.has(ext)) return [{ text, offset: 0 }];
160
+ if (markupExts.has(ext)) return styleSegments(text);
161
+ return [];
162
+ }
163
+
164
+ function splitSelectorList(selector) {
165
+ const out = [];
166
+ let start = 0, depth = 0, quote = '';
167
+ for (let i = 0; i < selector.length; i += 1) {
168
+ const c = selector[i];
169
+ if (quote) {
170
+ if (c === '\\') i += 1;
171
+ else if (c === quote) quote = '';
172
+ } else if (c === '"' || c === "'") quote = c;
173
+ else if (c === '(' || c === '[') depth += 1;
174
+ else if (c === ')' || c === ']') depth = Math.max(0, depth - 1);
175
+ else if (c === ',' && depth === 0) {
176
+ out.push(selector.slice(start, i).trim());
177
+ start = i + 1;
178
+ }
179
+ }
180
+ out.push(selector.slice(start).trim());
181
+ return out.filter(Boolean);
182
+ }
183
+
184
+ function stripNotContents(selector) {
185
+ let out = '';
186
+ for (let i = 0; i < selector.length; i += 1) {
187
+ if (selector.slice(i, i + 5).toLowerCase() === ':not(') {
188
+ let depth = 1, quote = '';
189
+ i += 5;
190
+ for (; i < selector.length && depth; i += 1) {
191
+ const c = selector[i];
192
+ if (quote) {
193
+ if (c === '\\') i += 1;
194
+ else if (c === quote) quote = '';
195
+ } else if (c === '"' || c === "'") quote = c;
196
+ else if (c === '(') depth += 1;
197
+ else if (c === ')') depth -= 1;
198
+ }
199
+ i -= 1;
200
+ } else out += selector[i];
201
+ }
202
+ return out;
203
+ }
204
+
205
+ function selectorFocusState(selector) {
206
+ const stripped = stripNotContents(selector);
207
+ return {
208
+ positive: /:focus-visible(?![-_a-z0-9])/i.test(stripped) || /:focus(?![-_a-z0-9])/i.test(stripped),
209
+ excludesFocusVisible: /:not\(\s*:focus-visible\s*\)/i.test(selector)
210
+ };
211
+ }
212
+
213
+ function selectorContexts(selectorText, inherited) {
214
+ const contexts = [];
215
+ const parents = inherited.length ? inherited : [{ positive: false, excludesFocusVisible: false }];
216
+ for (const parent of parents) {
217
+ for (const selector of splitSelectorList(selectorText)) {
218
+ const own = selectorFocusState(selector);
219
+ const sameElement = selector.includes('&');
220
+ const positive = own.positive || (sameElement && parent.positive);
221
+ const excludesFocusVisible = own.excludesFocusVisible || (sameElement && parent.excludesFocusVisible);
222
+ contexts.push({ positive, excludesFocusVisible, relevant: positive && !excludesFocusVisible });
223
+ }
224
+ }
225
+ return contexts;
226
+ }
227
+
228
+ function declarations(body) {
229
+ const out = [];
230
+ let start = 0, depth = 0, quote = '';
231
+ for (let i = 0; i <= body.length; i += 1) {
232
+ const c = body[i] || ';';
233
+ if (c === '/' && body[i + 1] === '*') { i = skipComment(body, i) - 1; continue; }
234
+ if (quote) {
235
+ if (c === '\\') i += 1;
236
+ else if (c === quote) quote = '';
237
+ } else if (c === '"' || c === "'") quote = c;
238
+ else if (c === '(') depth += 1;
239
+ else if (c === ')') depth = Math.max(0, depth - 1);
240
+ else if (c === ';' && depth === 0) {
241
+ const raw = body.slice(start, i);
242
+ const colon = raw.indexOf(':');
243
+ if (colon > 0) out.push({ prop: raw.slice(0, colon).trim().toLowerCase(), value: raw.slice(colon + 1).trim().toLowerCase(), offset: start + colon + 1 });
244
+ start = i + 1;
245
+ }
246
+ }
247
+ return out;
248
+ }
249
+
250
+ const visibleOutlineStyles = new Set(['auto', 'dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset']);
251
+ const invisibleOutlineStyles = new Set(['none', 'hidden']);
252
+ const visibleBorderStyles = new Set(['dotted', 'dashed', 'solid', 'double', 'groove', 'ridge', 'inset', 'outset']);
253
+ const textDecorationLines = new Set(['underline', 'overline', 'line-through', 'blink', 'spelling-error', 'grammar-error']);
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(' '));
255
+
256
+ function cleanValue(value) {
257
+ return value.replace(/\s*!important\s*$/, '').trim();
258
+ }
259
+
260
+ function splitValueTokens(value) {
261
+ const out = [];
262
+ let start = 0, depth = 0, quote = '';
263
+ const push = (end) => {
264
+ const token = value.slice(start, end).trim();
265
+ if (token) out.push(token);
266
+ };
267
+ for (let i = 0; i < value.length; i += 1) {
268
+ const c = value[i];
269
+ if (quote) {
270
+ if (c === '\\') i += 1;
271
+ else if (c === quote) quote = '';
272
+ } else if (c === '"' || c === "'") quote = c;
273
+ else if (c === '(') depth += 1;
274
+ else if (c === ')') depth = Math.max(0, depth - 1);
275
+ else if (/\s/.test(c) && depth === 0) {
276
+ push(i);
277
+ start = i + 1;
278
+ }
279
+ }
280
+ push(value.length);
281
+ return out;
282
+ }
283
+
284
+ function isZeroWidth(token) {
285
+ return /^-?0(?:\.0+)?(?:[a-z%]+)?$/.test(token);
286
+ }
287
+
288
+ function isNonzeroNumericWidth(token) {
289
+ const match = /^(-?(?:\d+|\d*\.\d+))(?:[a-z%]+)?$/.exec(token);
290
+ return match !== null && Number(match[1]) !== 0;
291
+ }
292
+
293
+ function isVisibleWidth(token) {
294
+ return token === 'thin' || token === 'medium' || token === 'thick' || isNonzeroNumericWidth(token);
295
+ }
296
+
297
+ function isColorToken(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);
300
+ }
301
+
302
+ function outlineTokenKind(token) {
303
+ if (invisibleOutlineStyles.has(token)) return 'invisible-style';
304
+ if (visibleOutlineStyles.has(token)) return 'visible-style';
305
+ if (isZeroWidth(token)) return 'zero-width';
306
+ if (isVisibleWidth(token)) return 'width';
307
+ if (isColorToken(token)) return 'color';
308
+ return 'unknown';
309
+ }
310
+
311
+ function hasUnresolvedTokens(value) {
312
+ return splitValueTokens(cleanValue(value)).some((token) => outlineTokenKind(token) === 'unknown');
313
+ }
314
+
315
+ function parseOutlineShorthand(value) {
316
+ const parsed = { style: 'none', width: 'medium', removes: false, unknown: false };
317
+ for (const token of splitValueTokens(cleanValue(value))) {
318
+ const kind = outlineTokenKind(token);
319
+ if (kind === 'unknown') parsed.unknown = true;
320
+ else if (kind === 'invisible-style') {
321
+ parsed.style = token;
322
+ parsed.removes = true;
323
+ } else if (kind === 'visible-style') parsed.style = token;
324
+ else if (kind === 'zero-width') {
325
+ parsed.width = token;
326
+ parsed.removes = true;
327
+ } else if (kind === 'width') parsed.width = token;
328
+ }
329
+ if (parsed.unknown) parsed.removes = false;
330
+ return parsed;
331
+ }
332
+
333
+ function analyzeOutline(decls) {
334
+ let style = 'none', width = 'medium', removal = null;
335
+ let styleUnknown = false, widthUnknown = false;
336
+ for (const decl of decls) {
337
+ const value = cleanValue(decl.value);
338
+ if (decl.prop === 'outline') {
339
+ const parsed = parseOutlineShorthand(value);
340
+ if (parsed.unknown) {
341
+ styleUnknown = true;
342
+ widthUnknown = true;
343
+ style = 'none';
344
+ width = 'medium';
345
+ } else {
346
+ style = parsed.style;
347
+ width = parsed.width;
348
+ styleUnknown = false;
349
+ widthUnknown = false;
350
+ }
351
+ if (parsed.removes && !removal) removal = decl;
352
+ } else if (decl.prop === 'outline-style') {
353
+ style = value;
354
+ styleUnknown = hasUnresolvedTokens(value);
355
+ if (!styleUnknown && invisibleOutlineStyles.has(value) && !removal) removal = decl;
356
+ } else if (decl.prop === 'outline-width') {
357
+ width = value;
358
+ widthUnknown = hasUnresolvedTokens(value);
359
+ if (!widthUnknown && isZeroWidth(value) && !removal) removal = decl;
360
+ }
361
+ }
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 };
367
+ }
368
+
369
+ function borderShorthandProp(prop) {
370
+ return prop === 'border' || /^border-(?:top|right|bottom|left|inline|block)(?:-(?:start|end))?$/.test(prop);
371
+ }
372
+
373
+ function borderColorProp(prop) {
374
+ return prop === 'border-color' || /^border-(?:top|right|bottom|left|inline|block)(?:-(?:start|end))?-color$/.test(prop);
375
+ }
376
+
377
+ function visibleBorder(value) {
378
+ let styled = false, zero = false, invisible = false;
379
+ for (const token of splitValueTokens(cleanValue(value))) {
380
+ if (isZeroWidth(token)) zero = true;
381
+ else if (visibleBorderStyles.has(token)) styled = true;
382
+ else if (token === 'none' || token === 'hidden') invisible = true;
383
+ }
384
+ return styled && !zero && !invisible;
385
+ }
386
+
387
+ function visibleTextDecoration(value) {
388
+ return splitValueTokens(cleanValue(value)).some((token) => textDecorationLines.has(token));
389
+ }
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
+
433
+ function visibleReplacement(decls, outline) {
434
+ if (outline.visible) return true;
435
+ let visibleBorderStyle = false, positiveBorderWidth = false;
436
+ for (const { prop, value } of decls) {
437
+ const tokens = splitValueTokens(cleanValue(value));
438
+ if (prop === 'border-style' && tokens.some((token) => visibleBorderStyles.has(token))) visibleBorderStyle = true;
439
+ if (prop === 'border-width' && tokens.some((token) => isVisibleWidth(token))) positiveBorderWidth = true;
440
+ }
441
+ if (visibleBorderStyle && positiveBorderWidth) return true;
442
+ return decls.some(({ prop, value }) => {
443
+ const clean = cleanValue(value);
444
+ if (prop === 'box-shadow') return visibleBoxShadow(clean);
445
+ if (borderShorthandProp(prop)) return visibleBorder(clean);
446
+ if (borderColorProp(prop)) return clean !== 'none' && clean !== 'transparent';
447
+ if (prop === 'text-decoration' || prop === 'text-decoration-line') return visibleTextDecoration(clean);
448
+ return false;
449
+ });
450
+ }
451
+
452
+ function scanRuleList(text, baseOffset, sourceText, visit, inherited) {
453
+ let i = 0;
454
+ while (i < text.length) {
455
+ while (i < text.length && /\s/.test(text[i])) i += 1;
456
+ if (i >= text.length) break;
457
+ const start = i;
458
+ let quote = '', depth = 0, terminator = '';
459
+ for (; i < text.length; i += 1) {
460
+ const c = text[i];
461
+ if (quote) {
462
+ if (c === '\\') i += 1;
463
+ else if (c === quote) quote = '';
464
+ } else if (c === '"' || c === "'") quote = c;
465
+ else if (c === '(' || c === '[') depth += 1;
466
+ else if (c === ')' || c === ']') depth = Math.max(0, depth - 1);
467
+ else if ((c === '{' || c === ';') && depth === 0) {
468
+ terminator = c;
469
+ break;
470
+ }
471
+ }
472
+ if (terminator === ';') {
473
+ i += 1;
474
+ continue;
475
+ }
476
+ if (terminator !== '{') break;
477
+ const rawPrelude = text.slice(start, i);
478
+ const end = findBraceEnd(text, i);
479
+ if (end < 0) break;
480
+ scanRule({
481
+ prelude: rawPrelude.trim(),
482
+ body: text.slice(i + 1, end),
483
+ selectorIndex: baseOffset + start + rawPrelude.length - rawPrelude.trimStart().length,
484
+ bodyIndex: baseOffset + i + 1
485
+ }, sourceText, visit, inherited);
486
+ i = end + 1;
487
+ }
488
+ }
489
+
490
+ function scanRule(rule, sourceText, visit, inherited) {
491
+ const parts = extractNestedBlocks(rule.body);
492
+ let childInherited = inherited;
493
+ if (rule.prelude && !rule.prelude.startsWith('@')) {
494
+ const contexts = selectorContexts(rule.prelude, inherited);
495
+ visit(rule.prelude, declarations(parts.declarationText), {
496
+ selectorIndex: rule.selectorIndex,
497
+ bodyIndex: rule.bodyIndex,
498
+ sourceText
499
+ }, contexts);
500
+ childInherited = contexts;
501
+ }
502
+ for (const nested of parts.nested) {
503
+ scanRule({
504
+ prelude: nested.prelude,
505
+ body: nested.body,
506
+ selectorIndex: rule.bodyIndex + nested.selectorIndex,
507
+ bodyIndex: rule.bodyIndex + nested.bodyIndex
508
+ }, sourceText, visit, childInherited);
509
+ }
510
+ }
511
+
512
+ function scanRules(segment, baseOffset, sourceText, visit) {
513
+ scanRuleList(segment.text, baseOffset, sourceText, visit, [{ positive: false, excludesFocusVisible: false }]);
514
+ }
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
+
967
+ function scanFile(file, root) {
968
+ const text = fs.readFileSync(file, 'utf8');
969
+ const ext = path.extname(file);
970
+ const masked = maskSourceComments(text, ext);
971
+ const lines = text.split(/\r?\n/);
972
+ const maskedLines = masked.split(/\r?\n/);
973
+ const findings = [];
974
+ const seenRules = new Set();
975
+ const add = (rule, severity, weight, line, match, fix) => {
976
+ const key = `${rule}:${line}`;
977
+ if (seenRules.has(key)) return;
978
+ seenRules.add(key);
979
+ findings.push({ rule, severity, weight, file: path.relative(root, file), line, match: match.trim().slice(0, 160), fix });
980
+ };
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
+
988
+ // Focus scan is heuristic; live keyboard testing remains authoritative.
989
+ let cssMotionMatch = null;
990
+ for (const segment of cssSegments(file, text)) {
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
+ }
996
+ scanRules(maskedSegment, segment.offset, maskedSegment.text, (selectorText, decls, location, contexts) => {
997
+ const lastFirst = [...decls].reverse();
998
+ const declaration = (property) => lastFirst.find((decl) => property.test(decl.prop));
999
+ const clip = declaration(/^(?:-webkit-)?background-clip$/);
1000
+ const background = declaration(/^background(?:-image)?$/);
1001
+ const color = declaration(/^(?:color|-webkit-text-fill-color)$/);
1002
+ if (clip && cleanValue(clip.value) === 'text' && background && /gradient\(/i.test(background.value)
1003
+ && color && cleanValue(color.value) === 'transparent') {
1004
+ add('gradient-text-treatment','P3',1,lineOf(text,location.bodyIndex + clip.offset),selectorText,
1005
+ 'Check that decorative gradient text fits the direction and remains legible.');
1006
+ }
1007
+ const rail = declaration(/^border-(?:left|right|inline-start|inline-end)$/);
1008
+ const radius = declaration(/^border-radius$/);
1009
+ const railTokens = rail ? splitValueTokens(cleanValue(rail.value)) : [];
1010
+ if (radius && /^\d*\.?\d+(?:px|em|rem|%)(?:\s|$)/.test(cleanValue(radius.value))
1011
+ && Number.parseFloat(radius.value) > 0 && rail && visibleBorder(rail.value)
1012
+ && railTokens.some((token) => /^\d+(?:\.\d+)?px$/.test(token) && Number.parseFloat(token) >= 4)
1013
+ && /\.(?:\w+-)?(?:card|tile|panel)\b/i.test(selectorText)) {
1014
+ add('rounded-accent-rail','P3',1,lineOf(text,location.bodyIndex + rail.offset),selectorText,
1015
+ 'Check whether the thick edge communicates a status or is repeated decoration.');
1016
+ }
1017
+ const outline = analyzeOutline(decls);
1018
+ if (!outline.removal || visibleReplacement(decls, outline)) return;
1019
+ for (const context of contexts) {
1020
+ if (!context.relevant) continue;
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.');
1022
+ }
1023
+ });
1024
+ }
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
+
1086
+ lines.forEach((line, i) => {
1087
+ const n = i + 1;
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
+ }
1113
+ });
1114
+
1115
+ const rounded = (masked.match(/rounded-2xl/g) || []).length;
1116
+ if (rounded < 3) for (const f of findings.filter((f) => f.rule === 'rounded-2xl-repetition')) f.drop = true;
1117
+ const shadows = (masked.match(/shadow-(lg|xl|2xl)/g) || []).length;
1118
+ if (shadows < 3) for (const f of findings.filter((f) => f.rule === 'uniform-shadow')) f.drop = true;
1119
+
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);
1122
+ if (paste) add('paste-blocked','P0',5,lineOf(text,paste.index),paste[0],'Never block paste; it harms password managers, accessibility, and recovery.');
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.');
1159
+ return findings.filter((f) => !f.drop);
1160
+ }
1161
+
1162
+ function applyWaivers(findings, file) {
1163
+ const items = JSON.parse(fs.readFileSync(file, 'utf8'));
1164
+ if (!Array.isArray(items)) throw new Error('waivers must be an array of {rule, file, line, reason}');
1165
+ const byFinding = new Map();
1166
+ for (const item of items) {
1167
+ if (!item || !brandRules.has(item.rule) || typeof item.file !== 'string' || !item.file.trim()
1168
+ || !Number.isInteger(item.line) || item.line < 1 || typeof item.reason !== 'string' || !item.reason.trim()) {
1169
+ throw new Error('waivers require an advisory brand rule, exact file and line, and a nonempty reason');
1170
+ }
1171
+ const key = JSON.stringify([item.rule, item.file.replace(/\\/g, '/'), item.line]);
1172
+ if (byFinding.has(key)) throw new Error(`duplicate waiver: ${key}`);
1173
+ byFinding.set(key, item);
1174
+ }
1175
+ const waived = [];
1176
+ const active = findings.filter((finding) => {
1177
+ const key = JSON.stringify([finding.rule, finding.file.replace(/\\/g, '/'), finding.line]);
1178
+ const item = byFinding.get(key);
1179
+ if (!item) return true;
1180
+ waived.push({ ...finding, label: 'waived', reason: item.reason.trim() });
1181
+ byFinding.delete(key);
1182
+ return false;
1183
+ });
1184
+ return { active, waived, unusedWaivers: Array.from(byFinding.values()) };
1185
+ }
1186
+
1187
+ const severityRank = { P0: 0, P1: 1, P2: 2, P3: 3 };
1188
+ const failOnThreshold = { p0: 0, p1: 1, p2: 2, any: 3 };
1189
+
1190
+ try {
1191
+ const args = process.argv.slice(2);
1192
+ if (args.includes('--help') || args.includes('-h')) { console.log(help()); process.exit(0); }
1193
+ const json = args.includes('--json');
1194
+ let dir, waivers, failOn;
1195
+ for (let index = 0; index < args.length; index += 1) {
1196
+ const argument = args[index];
1197
+ if (argument === '--json') continue;
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();
1201
+ else if (!dir && !argument.startsWith('-')) dir = argument;
1202
+ else throw new Error(`unexpected argument: ${argument}`);
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
+ }
1207
+ if (!dir || !fs.existsSync(dir)) throw new Error('provide an existing file or directory to scan');
1208
+ const input = path.resolve(dir);
1209
+ const stat = fs.statSync(input);
1210
+ const root = stat.isDirectory() ? input : path.dirname(input);
1211
+ const files = stat.isDirectory() ? walk(input) : [input];
1212
+ const detected = files.flatMap((file) => scanFile(file, root));
1213
+ const { active: findings, ...waiverReport } = waivers ? applyWaivers(detected, waivers) : { active: detected };
1214
+ const score = findings.reduce((sum, f) => sum + f.weight, 0);
1215
+ const output = { score, disclaimer, findings, ...waiverReport };
1216
+ if (json) console.log(JSON.stringify(output, null, 2));
1217
+ else {
1218
+ console.log(`slop-scan score: ${score}`);
1219
+ for (const f of findings) console.log(`${f.severity} ${f.file}:${f.line} ${f.rule} (+${f.weight}) — ${f.match}\n fix: ${f.fix}`);
1220
+ for (const f of waiverReport.waived ?? []) console.log(`waived ${f.file}:${f.line} ${f.rule} — ${f.reason}`);
1221
+ for (const f of waiverReport.unusedWaivers ?? []) console.log(`unused waiver ${f.file}:${f.line} ${f.rule}`);
1222
+ console.log(`disclaimer: ${disclaimer}`);
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
+ }
1230
+ } catch (error) {
1231
+ console.error(`slop-scan: ${error.message}`);
1232
+ process.exit(1);
1233
+ }