@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,852 @@
1
+ #!/usr/bin/env node
2
+ import { spawnSync } from 'node:child_process';
3
+ import fs from 'node:fs';
4
+ import os from 'node:os';
5
+ import path from 'node:path';
6
+ import readline from 'node:readline';
7
+ import { fileURLToPath } from 'node:url';
8
+
9
+ const repoRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
10
+ const skillsRoot = path.join(repoRoot, 'skills');
11
+ const canonicalAgents = ['claude', 'codex', 'agents', 'devin', 'cursor', 'gemini', 'copilot', 'windsurf', 'opencode', 'kiro', 'cline', 'roo', 'droid', 'antigravity'];
12
+ const validAgents = [...canonicalAgents, 'all'];
13
+ const agentAliases = {
14
+ 'claude-code': 'claude',
15
+ 'gemini-cli': 'gemini',
16
+ 'github-copilot': 'copilot',
17
+ 'open-code': 'opencode',
18
+ 'roo-code': 'roo',
19
+ factory: 'droid',
20
+ amp: 'agents',
21
+ zed: 'agents',
22
+ goose: 'agents',
23
+ };
24
+
25
+ function skillNames() {
26
+ return fs.readdirSync(skillsRoot, { withFileTypes: true })
27
+ .filter((entry) => entry.isDirectory() && fs.existsSync(path.join(skillsRoot, entry.name, 'SKILL.md')))
28
+ .map((entry) => entry.name)
29
+ .sort();
30
+ }
31
+
32
+ function canonicalAgent(name) {
33
+ const normalized = name.trim().toLowerCase();
34
+ return agentAliases[normalized] || normalized;
35
+ }
36
+
37
+ function expandAgents(input) {
38
+ const values = (Array.isArray(input) ? input : [input])
39
+ .flatMap((value) => String(value).split(/[\s,]+/))
40
+ .filter(Boolean)
41
+ .map(canonicalAgent);
42
+ if (values.length === 0) throw new Error('command requires --agent');
43
+ const unknown = values.filter((name) => !validAgents.includes(name));
44
+ if (unknown.length) throw new Error(`invalid agent '${unknown.join(', ')}'; expected one of ${validAgents.join(', ')}`);
45
+ if (values.includes('all')) return canonicalAgents;
46
+ return [...new Set(values)];
47
+ }
48
+
49
+ function targetsFor(agentInput, globalInstall) {
50
+ const home = os.homedir();
51
+ const project = {
52
+ claude: { root: '.claude/skills', type: 'skills' },
53
+ codex: { root: '.agents/skills', type: 'skills' },
54
+ agents: { root: '.agents/skills', type: 'skills' },
55
+ devin: { root: '.agents/skills', type: 'skills' },
56
+ cursor: { root: '.cursor/skills', type: 'skills' },
57
+ gemini: { root: '.gemini/skills', type: 'skills' },
58
+ copilot: { root: '.github/skills', type: 'skills' },
59
+ windsurf: { root: '.windsurf', type: 'windsurf' },
60
+ opencode: { root: '.opencode/skills', type: 'skills' },
61
+ kiro: { root: '.kiro', type: 'kiro' },
62
+ cline: { root: '.cline/skills', type: 'skills' },
63
+ roo: { root: '.roo/skills', type: 'skills' },
64
+ droid: { root: '.factory/skills', type: 'skills' },
65
+ antigravity: { root: '.agents/skills', type: 'skills' },
66
+ };
67
+ const globalMap = {
68
+ claude: { root: path.join(home, '.claude/skills'), type: 'skills' },
69
+ codex: { root: path.join(home, '.agents/skills'), type: 'skills' },
70
+ agents: { root: path.join(home, '.agents/skills'), type: 'skills' },
71
+ devin: { root: path.join(home, '.agents/skills'), type: 'skills' },
72
+ cursor: { root: path.join(home, '.cursor/skills'), type: 'skills' },
73
+ gemini: { root: path.join(home, '.gemini/skills'), type: 'skills' },
74
+ copilot: { root: path.join(home, '.copilot/skills'), type: 'skills' },
75
+ windsurf: { root: path.join(home, '.codeium/windsurf'), type: 'windsurf' },
76
+ opencode: { root: path.join(home, '.config/opencode/skills'), type: 'skills' },
77
+ kiro: { root: path.join(home, '.kiro'), type: 'kiro' },
78
+ cline: { root: path.join(home, '.cline/skills'), type: 'skills' },
79
+ roo: { root: path.join(home, '.roo/skills'), type: 'skills' },
80
+ droid: { root: path.join(home, '.factory/skills'), type: 'skills' },
81
+ antigravity: { root: path.join(home, '.gemini/config/skills'), type: 'skills' },
82
+ };
83
+ const map = globalInstall ? globalMap : project;
84
+ const seen = new Set();
85
+ const targets = [];
86
+ for (const agent of expandAgents(agentInput)) {
87
+ const spec = map[agent];
88
+ const key = `${spec.type}:${spec.root}`;
89
+ if (seen.has(key)) continue;
90
+ seen.add(key);
91
+ targets.push({ agent, type: spec.type, root: path.resolve(process.cwd(), spec.root), global: globalInstall });
92
+ }
93
+ return targets;
94
+ }
95
+
96
+ function help() {
97
+ return `Usage: pixelcraft [command] [options]
98
+
99
+ Install from npm: npm i -g @thanhnguyxn/pixelcraft
100
+ Run with no arguments to start the interactive install wizard.
101
+
102
+ Commands:
103
+ add <skill...|all> --agent <name|all> [--global] [--dry-run] [--force] [--docs-mcp]
104
+ Copy self-contained skill folders into one or more agent skills directories.
105
+ Repeat --agent or use comma-separated names for multiple targets.
106
+ remove <skill...|all> --agent <name|all> [--global] [--dry-run]
107
+ Safely remove installed Pixelcraft skill folders (refuses symlinks and non-Pixelcraft folders).
108
+ doctor [--agent <name|all>] [--global]
109
+ Verify Node.js version and inspect installed Pixelcraft skill directories for missing core skills or stale/incomplete installs.
110
+ init-router [--dir <path>] [--write <file>]
111
+ Detect repository tech stack from manifests and print (or upsert via --write) a managed Pixelcraft routing block for AGENTS.md/CLAUDE.md/GEMINI.md.
112
+ check <target> [--json] [--fail-on <p0|p1|p2|any>]
113
+ Run bundled verification scripts against <target> (slop-scan for UI source, check-contrast for DTCG token JSON, check-pdf for PDFs, with check-email hint for email markup).
114
+ list
115
+ List skills bundled in this package.
116
+ help, --help
117
+ Show this help.
118
+
119
+ Agents: ${validAgents.join(', ')}.
120
+ Aliases: ${Object.keys(agentAliases).join(', ')}.
121
+
122
+ Options:
123
+ --agent NAME Target host. Required for non-interactive add and remove.
124
+ --global Use the user-level skills directory instead of the current project.
125
+ --dry-run Print planned changes without modifying files.
126
+ --docs-mcp Print optional Context7 setup guidance without configuring any host.
127
+ --force Replace existing explicitly requested skill directories. Auto-added core skills install only when missing.
128
+ --dir PATH Repository directory to inspect for init-router (default: current directory).
129
+ --write FILE Upsert a managed Pixelcraft routing block into FILE for init-router.
130
+ --json Emit machine-readable JSON output from check.
131
+ --fail-on LEVEL Exit non-zero from check when findings meet p0|p1|p2|any.
132
+
133
+ Symlink safety: installation and removal refuse a symlinked target skills directory or skill
134
+ directory instead of modifying files outside the project.
135
+
136
+ Project locations: claude=.claude/skills; codex/agents/devin/antigravity=.agents/skills;
137
+ cursor=.cursor/skills; gemini=.gemini/skills; copilot=.github/skills;
138
+ windsurf=.windsurf/skills; opencode=.opencode/skills; kiro=.kiro/skills;
139
+ cline=.cline/skills; roo=.roo/skills; droid=.factory/skills. Windsurf and Kiro
140
+ get native skills and router files. Claude/Cursor/Copilot adapter commands and
141
+ rules are written alongside their skills. Universal .agents/skills remains
142
+ available through the agents target and as a compatibility path in several hosts.
143
+ Global locations: claude=~/.claude/skills; codex/agents/devin=~/.agents/skills;
144
+ cursor=~/.cursor/skills; gemini=~/.gemini/skills; copilot=~/.copilot/skills;
145
+ windsurf=~/.codeium/windsurf/skills plus memories/global_rules.md;
146
+ opencode=~/.config/opencode/skills; kiro=~/.kiro/skills; cline=~/.cline/skills;
147
+ roo=~/.roo/skills; droid=~/.factory/skills; antigravity=~/.gemini/config/skills.
148
+
149
+ Host behavior and global paths follow current public documentation where available.
150
+ They change quickly; verify current host documentation before depending on them in automation.`;
151
+ }
152
+
153
+ function parse(args) {
154
+ const positional = [];
155
+ const options = { global: false, dryRun: false, force: false, json: false, agents: [], dir: '', write: '', failOn: '' };
156
+ for (let index = 0; index < args.length; index += 1) {
157
+ const arg = args[index];
158
+ if (arg === '--global') options.global = true;
159
+ else if (arg === '--dry-run') options.dryRun = true;
160
+ else if (arg === '--docs-mcp') options.docsMcp = true;
161
+ else if (arg === '--force') options.force = true;
162
+ else if (arg === '--json') options.json = true;
163
+ else if (arg === '--agent') {
164
+ index += 1;
165
+ if (!args[index]) throw new Error('--agent requires a value');
166
+ options.agents.push(args[index]);
167
+ } else if (arg.startsWith('--agent=')) options.agents.push(arg.slice('--agent='.length));
168
+ else if (arg === '--dir') {
169
+ index += 1;
170
+ if (!args[index]) throw new Error('--dir requires a value');
171
+ options.dir = args[index];
172
+ } else if (arg.startsWith('--dir=')) options.dir = arg.slice('--dir='.length);
173
+ else if (arg === '--write') {
174
+ index += 1;
175
+ if (!args[index]) throw new Error('--write requires a value');
176
+ options.write = args[index];
177
+ } else if (arg.startsWith('--write=')) options.write = arg.slice('--write='.length);
178
+ else if (arg === '--fail-on') {
179
+ index += 1;
180
+ if (!args[index]) throw new Error('--fail-on requires a value');
181
+ options.failOn = args[index];
182
+ } else if (arg.startsWith('--fail-on=')) options.failOn = arg.slice('--fail-on='.length);
183
+ else if (arg === '--help' || arg === '-h') options.help = true;
184
+ else if (arg.startsWith('-')) throw new Error(`unknown option: ${arg}`);
185
+ else positional.push(arg);
186
+ }
187
+ return { positional, options };
188
+ }
189
+
190
+ function lstatIfExists(file) {
191
+ try {
192
+ return fs.lstatSync(file);
193
+ } catch (error) {
194
+ if (error.code === 'ENOENT') return null;
195
+ throw error;
196
+ }
197
+ }
198
+
199
+ function assertNotSymlink(file, label) {
200
+ if (lstatIfExists(file)?.isSymbolicLink()) throw new Error(`${label} is a symlink: ${file}; refusing to install through it`);
201
+ }
202
+
203
+ function assertInstallPathSafe(target, boundary, label) {
204
+ const base = path.resolve(boundary);
205
+ const destination = path.resolve(target);
206
+ const relative = path.relative(base, destination);
207
+ if (relative.startsWith('..') || path.isAbsolute(relative)) throw new Error(`${label} is outside the install scope: ${target}`);
208
+ assertNotSymlink(base, label);
209
+ let current = base;
210
+ if (relative) {
211
+ for (const part of relative.split(path.sep).filter(Boolean)) {
212
+ current = path.join(current, part);
213
+ assertNotSymlink(current, label);
214
+ }
215
+ }
216
+ }
217
+
218
+ function copySkill(name, destinationRoot, dryRun, { force = false, auto = false, boundary = process.cwd() } = {}) {
219
+ const source = path.join(skillsRoot, name);
220
+ const destination = path.join(destinationRoot, name);
221
+ assertNotSymlink(source, 'source skill directory');
222
+ assertInstallPathSafe(destinationRoot, boundary, 'target skills path component');
223
+ const destinationStat = lstatIfExists(destination);
224
+ const exists = destinationStat !== null;
225
+ if (auto && exists) {
226
+ const kind = destinationStat.isSymbolicLink() ? 'existing symlink' : 'existing install';
227
+ console.log(`${dryRun ? 'dry-run: ' : ''}skipped auto-added ${kind}: ${name} -> ${destination}`);
228
+ return;
229
+ }
230
+ if (destinationStat?.isSymbolicLink()) throw new Error(`installed skill directory is a symlink: ${destination}; refusing to install through it`);
231
+ if (dryRun) {
232
+ if (exists && !force) console.log(`dry-run: skipped existing ${name} -> ${destination} (use --force to replace)`);
233
+ else console.log(`dry-run: ${name} -> ${destination}`);
234
+ return;
235
+ }
236
+ fs.mkdirSync(destinationRoot, { recursive: true });
237
+ assertInstallPathSafe(destinationRoot, boundary, 'target skills path component');
238
+ if (exists && !force) {
239
+ console.log(`skipped existing: ${name} -> ${destination} (use --force to replace)`);
240
+ return;
241
+ }
242
+ fs.rmSync(destination, { recursive: true, force: true });
243
+ fs.cpSync(source, destination, { recursive: true });
244
+ console.log(`installed: ${name} -> ${destination}`);
245
+ }
246
+
247
+ function selectSkills(positional, available) {
248
+ const requested = positional.includes('all') ? available : positional;
249
+ const unknown = requested.filter((name) => !available.includes(name));
250
+ if (unknown.length) throw new Error(`unknown skill(s): ${unknown.join(', ')}; available: ${available.join(', ')}`);
251
+
252
+ let selected = requested.map((name) => ({ name, auto: false }));
253
+ if (!positional.includes('all')) {
254
+ const required = ['pixelcraft', 'pixelcraft-plan'].filter((name) => available.includes(name));
255
+ const injected = required.filter((name) => !requested.includes(name));
256
+ if (injected.length) {
257
+ selected = [...injected.map((name) => ({ name, auto: true })), ...selected];
258
+ console.log(`note: including required core skill(s): ${injected.join(', ')}`);
259
+ }
260
+ }
261
+ return selected;
262
+ }
263
+
264
+ const adapterActions = [
265
+ ['pixelcraft', 'pixelcraft', 'Run the Pixelcraft orchestrator for UI design/build work'],
266
+ ['pixelcraft-plan', 'pixelcraft-plan', 'Run Pixelcraft step-zero planning before UI work'],
267
+ ['pixelcraft-review', 'pixelcraft-review', 'Audit or critique UI with Pixelcraft evidence rules'],
268
+ ['pixelcraft-visual-qa', 'pixelcraft-visual-qa', 'Capture and inspect rendered UI evidence'],
269
+ ['pixelcraft-direction', 'pixelcraft-direction', 'Generate divergent visual directions'],
270
+ ];
271
+
272
+ function adapterIntro(skillsPath) {
273
+ return `Use Pixelcraft for any request to design, build, redesign, review, audit, polish, or visually verify a user interface. Start with \`pixelcraft-plan\` before implementation, use the \`pixelcraft\` orchestrator for routing, choose the matching platform/pattern skills, and finish with \`pixelcraft-review\` plus \`pixelcraft-visual-qa\` when rendered verification is possible.\n\nDo not inline skill bodies here. Read the matching self-contained skill under \`${skillsPath}\`:\n\n${skillNames().map((name) => `- \`${name}\` — \`${skillsPath}/${name}/SKILL.md\``).join('\n')}\n`;
274
+ }
275
+
276
+ function commandText(skill, task) {
277
+ return `---\ndescription: ${task}\n---\n\n${task}. Read and follow the self-contained \`${skill}\` skill available in this workspace or user installation. Preserve the user's brief, existing design system, platform conventions, accessibility requirements, and evidence labels.\n`;
278
+ }
279
+
280
+ function workflowText(skill, task) {
281
+ return `# ${task}\n\n1. Read the self-contained \`${skill}\` skill from the installed Pixelcraft distribution or source checkout.\n2. Follow its workflow, including referenced files when they match the task.\n3. Preserve user requirements, project conventions, accessibility, and evidence labels.\n4. Report rendered/static/not-checked/waived verification honestly.\n`;
282
+ }
283
+
284
+ const managedStart = '<!-- pixelcraft:start -->';
285
+ const managedEnd = '<!-- pixelcraft:end -->';
286
+
287
+ function managedUpsert(existing, content) {
288
+ const block = `${managedStart}\n${content.trimEnd()}\n${managedEnd}`;
289
+ const pattern = new RegExp(`${managedStart}[\\s\\S]*?${managedEnd}`);
290
+ if (pattern.test(existing)) return existing.replace(pattern, block);
291
+ if (existing.includes(managedStart)) throw new Error(`managed Pixelcraft block is missing its end marker: fix the file before installing`);
292
+ return existing ? `${existing.trimEnd()}\n\n${block}\n` : `${block}\n`;
293
+ }
294
+
295
+ function assertAdapterPathSafe(file, boundary) {
296
+ assertInstallPathSafe(file, boundary, 'adapter path component');
297
+ }
298
+
299
+ function writeAdapterFile(file, content, dryRun, force, boundary = process.cwd(), managed = false) {
300
+ assertAdapterPathSafe(file, boundary);
301
+ const exists = lstatIfExists(file) !== null;
302
+ if (dryRun) {
303
+ console.log(`dry-run: ${managed ? 'managed adapter' : exists && !force ? 'skipped existing adapter' : 'adapter'} ${file}${!managed && exists && !force ? ' (use --force to replace)' : ''}`);
304
+ return;
305
+ }
306
+ if (!managed && exists && !force) {
307
+ console.log(`skipped existing adapter: ${file} (use --force to replace)`);
308
+ return;
309
+ }
310
+ fs.mkdirSync(path.dirname(file), { recursive: true });
311
+ assertAdapterPathSafe(file, boundary);
312
+ const output = managed ? managedUpsert(exists ? fs.readFileSync(file, 'utf8') : '', content) : content;
313
+ fs.writeFileSync(file, output);
314
+ console.log(`installed adapter: ${file}`);
315
+ }
316
+
317
+ function writeAgentAdapters(target, dryRun, force, selected) {
318
+ const base = target.type === 'skills' ? path.dirname(target.root) : target.root;
319
+ const displayRoot = target.global ? target.root.replace(os.homedir(), '~') : path.relative(process.cwd(), target.root);
320
+ const boundary = target.global ? os.homedir() : process.cwd();
321
+ const file = (relative) => path.join(base, ...relative.split('/'));
322
+ const write = (relative, content, managed = false) => writeAdapterFile(file(relative), content, dryRun, force, boundary, managed);
323
+ if (target.agent === 'claude') {
324
+ for (const [command, skill, task] of adapterActions.slice(0, 4)) write(`commands/${command}.md`, commandText(skill, task));
325
+ } else if (target.agent === 'cursor') {
326
+ write('rules/pixelcraft.mdc', `---\ndescription: Route UI design and review through Pixelcraft\nalwaysApply: true\n---\n\n# Pixelcraft router\n\n${adapterIntro(displayRoot)}`);
327
+ } else if (target.agent === 'copilot') {
328
+ write('copilot-instructions.md', `# Pixelcraft router\n\n${adapterIntro(displayRoot)}`, true);
329
+ write('instructions/pixelcraft.instructions.md', `---\napplyTo: "**/*.{html,css,scss,less,pcss,js,jsx,ts,tsx,vue,svelte,astro,mdx,razor,heex,erb,templ,twig,mjml,typ,tex,qmd,py,rb,php,cs,java,kt,swift,dart,rs,go,zig,lua,ex,exs,clj,cljs,elm,fs,scala,cpp,h,glsl,wgsl,qml,xaml,axaml,fxml,blp,slint,ets,uxml,uss,gd,tscn,tcss,qss,r,jl}"\n---\n\nWhen editing interface or user-facing behavior, follow \`copilot-instructions.md\` and read the matching Pixelcraft skill before implementation or review.\n`);
330
+ for (const [command, skill, task] of adapterActions.slice(1)) write(`prompts/${command}.prompt.md`, commandText(skill, task));
331
+ } else if (target.type === 'windsurf' || target.type === 'kiro') {
332
+ const supportRoot = path.join(base, 'skills');
333
+ assertAdapterPathSafe(path.join(supportRoot, 'probe'), boundary);
334
+ for (const entry of selected) copySkill(entry.name, supportRoot, dryRun, { force: force && !entry.auto, auto: entry.auto, boundary });
335
+ const displaySupport = target.global ? supportRoot.replace(os.homedir(), '~') : path.relative(process.cwd(), supportRoot);
336
+ if (target.type === 'windsurf') {
337
+ write(target.global ? 'memories/global_rules.md' : 'rules/pixelcraft.md', `# Pixelcraft router\n\n${adapterIntro(displaySupport)}`, target.global);
338
+ for (const [command, skill, task] of adapterActions.slice(1)) write(`workflows/${command}.md`, workflowText(skill, task));
339
+ } else {
340
+ write('steering/pixelcraft.md', `# Pixelcraft steering\n\n${adapterIntro(displaySupport)}`);
341
+ }
342
+ }
343
+ }
344
+
345
+ function skillsDirForTarget(target) {
346
+ return target.type === 'skills' ? target.root : path.join(target.root, 'skills');
347
+ }
348
+
349
+ function runAdd({ positional, options }) {
350
+ if (positional.length === 0) throw new Error('add requires at least one skill name or all');
351
+ const available = skillNames();
352
+ const selected = selectSkills(positional, available);
353
+ const targets = targetsFor(options.agents, options.global);
354
+ for (const target of targets) {
355
+ if (target.type === 'skills') {
356
+ for (const entry of selected) {
357
+ copySkill(entry.name, target.root, options.dryRun, { force: options.force && !entry.auto, auto: entry.auto, boundary: target.global ? os.homedir() : process.cwd() });
358
+ }
359
+ }
360
+ writeAgentAdapters(target, options.dryRun, options.force, selected);
361
+ }
362
+ if (options.docsMcp) {
363
+ console.log(`Optional docs MCP for ${expandAgents(options.agents).join(', ')}: follow the Context7 instructions for your host at https://github.com/upstash/context7#readme. Pixelcraft does not configure MCP or request credentials. If unavailable or unsupported, use versioned official docs and the package registry.`);
364
+ }
365
+ }
366
+
367
+ function runRemove({ positional, options }) {
368
+ if (positional.length === 0) throw new Error('remove requires at least one skill name or all');
369
+ if (options.agents.length === 0) throw new Error('remove requires --agent');
370
+ const removeAll = positional.includes('all');
371
+ const available = new Set(skillNames());
372
+ if (!removeAll) {
373
+ for (const name of positional) {
374
+ if (!/^pixelcraft(?:-[a-z0-9]+)*$/.test(name)) {
375
+ throw new Error(`refusing to remove non-Pixelcraft skill name '${name}'`);
376
+ }
377
+ }
378
+ }
379
+ const targets = targetsFor(options.agents, options.global);
380
+ for (const target of targets) {
381
+ const dir = skillsDirForTarget(target);
382
+ const boundary = target.global ? os.homedir() : process.cwd();
383
+ assertInstallPathSafe(dir, boundary, 'target skills path component');
384
+ const dirStat = lstatIfExists(dir);
385
+ if (!dirStat) {
386
+ console.log(`${options.dryRun ? 'dry-run: ' : ''}no skills directory at ${dir}`);
387
+ continue;
388
+ }
389
+ if (!dirStat.isDirectory()) throw new Error(`target skills path is not a directory: ${dir}`);
390
+
391
+ let names;
392
+ if (removeAll) {
393
+ names = fs.readdirSync(dir).filter((entry) => /^pixelcraft(?:-[a-z0-9]+)*$/.test(entry)).sort();
394
+ if (names.length === 0) {
395
+ console.log(`${options.dryRun ? 'dry-run: ' : ''}no Pixelcraft skills installed in ${dir}`);
396
+ continue;
397
+ }
398
+ } else {
399
+ names = [...new Set(positional)];
400
+ }
401
+
402
+ for (const name of names) {
403
+ const dest = path.join(dir, name);
404
+ const stat = lstatIfExists(dest);
405
+ if (!stat) {
406
+ console.log(`${options.dryRun ? 'dry-run: ' : ''}not installed: ${name} (${dir})`);
407
+ continue;
408
+ }
409
+ if (stat.isSymbolicLink()) {
410
+ throw new Error(`installed skill directory is a symlink: ${dest}; refusing to remove`);
411
+ }
412
+ if (!stat.isDirectory()) {
413
+ throw new Error(`refusing to remove non-directory path: ${dest}`);
414
+ }
415
+ if (!available.has(name) && !fs.existsSync(path.join(dest, 'SKILL.md'))) {
416
+ throw new Error(`refusing to remove folder without SKILL.md: ${dest}`);
417
+ }
418
+ if (options.dryRun) {
419
+ console.log(`dry-run: remove ${name} <- ${dest}`);
420
+ } else {
421
+ fs.rmSync(dest, { recursive: true, force: true });
422
+ console.log(`removed: ${name} <- ${dest}`);
423
+ }
424
+ }
425
+ }
426
+ }
427
+
428
+ function runDoctor({ options }) {
429
+ const available = skillNames();
430
+ const availableSet = new Set(available);
431
+ const nodeMajor = Number(process.versions.node.split('.')[0]);
432
+ const issues = [];
433
+ console.log(`Pixelcraft doctor`);
434
+ console.log(`Node.js: v${process.versions.node} (${nodeMajor >= 18 ? 'ok' : 'FAIL: requires >= 18'})`);
435
+ console.log(`Bundled skills: ${available.length}`);
436
+ if (nodeMajor < 18) issues.push(`Node.js >= 18 is required (found v${process.versions.node})`);
437
+
438
+ const targets = targetsFor(options.agents.length ? options.agents : ['all'], options.global);
439
+ const seenDirs = new Set();
440
+ let installedRoots = 0;
441
+
442
+ for (const target of targets) {
443
+ const dir = skillsDirForTarget(target);
444
+ if (seenDirs.has(dir)) continue;
445
+ seenDirs.add(dir);
446
+ const stat = lstatIfExists(dir);
447
+ if (!stat) continue;
448
+ if (stat.isSymbolicLink()) {
449
+ issues.push(`${dir}: skills directory is a symlink`);
450
+ console.log(` WARN ${dir}: symlinked skills directory`);
451
+ continue;
452
+ }
453
+ if (!stat.isDirectory()) continue;
454
+
455
+ const installed = fs.readdirSync(dir).filter((name) => name.startsWith('pixelcraft')).sort();
456
+ if (installed.length === 0) continue;
457
+ installedRoots += 1;
458
+
459
+ const rootIssues = [];
460
+ for (const core of ['pixelcraft', 'pixelcraft-plan']) {
461
+ if (availableSet.has(core) && !installed.includes(core)) {
462
+ rootIssues.push(`missing required core skill '${core}'`);
463
+ }
464
+ }
465
+ for (const name of installed) {
466
+ const full = path.join(dir, name);
467
+ const entryStat = lstatIfExists(full);
468
+ if (entryStat?.isSymbolicLink()) {
469
+ rootIssues.push(`'${name}' is a symlink`);
470
+ continue;
471
+ }
472
+ if (!entryStat?.isDirectory() || !fs.existsSync(path.join(full, 'SKILL.md'))) {
473
+ rootIssues.push(`'${name}' is incomplete (missing SKILL.md)`);
474
+ continue;
475
+ }
476
+ if (!availableSet.has(name)) {
477
+ rootIssues.push(`'${name}' is not in the bundled Pixelcraft skill set (stale or unknown)`);
478
+ continue;
479
+ }
480
+ const bundledRefs = path.join(skillsRoot, name, 'references');
481
+ if (fs.existsSync(bundledRefs)) {
482
+ const expectedRefs = fs.readdirSync(bundledRefs).filter((f) => f.endsWith('.md'));
483
+ const installedRefsDir = path.join(full, 'references');
484
+ const missingRefs = expectedRefs.filter((f) => !fs.existsSync(path.join(installedRefsDir, f)));
485
+ if (missingRefs.length) {
486
+ rootIssues.push(`'${name}' is stale/incomplete (missing ${missingRefs.length} reference file(s): ${missingRefs.slice(0, 3).join(', ')})`);
487
+ }
488
+ }
489
+ }
490
+
491
+ const display = target.global ? dir.replace(os.homedir(), '~') : path.relative(process.cwd(), dir) || '.';
492
+ if (rootIssues.length === 0) {
493
+ console.log(` OK ${display}: ${installed.length} skill(s) installed and healthy`);
494
+ } else {
495
+ console.log(` FAIL ${display}: ${installed.length} skill(s), ${rootIssues.length} issue(s)`);
496
+ for (const msg of rootIssues) {
497
+ console.log(` - ${msg}`);
498
+ issues.push(`${display}: ${msg}`);
499
+ }
500
+ }
501
+ }
502
+
503
+ if (installedRoots === 0) {
504
+ console.log(`No Pixelcraft installations found in ${options.global ? 'global' : 'project'} agent directories.`);
505
+ }
506
+ if (issues.length > 0) {
507
+ process.exitCode = 1;
508
+ }
509
+ }
510
+
511
+ function readTextSafe(file) {
512
+ try {
513
+ return fs.readFileSync(file, 'utf8');
514
+ } catch {
515
+ return '';
516
+ }
517
+ }
518
+
519
+ function detectRepoStack(dir) {
520
+ const detected = [];
521
+ const skills = new Set(['pixelcraft-plan', 'pixelcraft']);
522
+ const entries = fs.readdirSync(dir, { withFileTypes: true });
523
+ const names = new Set(entries.map((e) => e.name));
524
+ const filesByExt = (ext) => entries.filter((e) => e.isFile() && e.name.toLowerCase().endsWith(ext)).map((e) => e.name);
525
+ const hasDirExt = (ext) => entries.some((e) => e.isDirectory() && e.name.toLowerCase().endsWith(ext));
526
+
527
+ if (names.has('Cargo.toml')) {
528
+ const cargo = readTextSafe(path.join(dir, 'Cargo.toml'));
529
+ const tags = [];
530
+ if (/\b(?:ratatui|crossterm)\b/i.test(cargo)) { tags.push('Rust TUI'); skills.add('pixelcraft-tui'); }
531
+ if (/\b(?:gpui|egui|eframe|iced|slint|tauri|gtk4)\b/i.test(cargo)) { tags.push('Rust Desktop'); skills.add('pixelcraft-desktop'); }
532
+ if (/\bbevy\b/i.test(cargo)) { tags.push('Bevy'); skills.add('pixelcraft-game-ui'); }
533
+ if (/\b(?:leptos|yew|dioxus)\b/i.test(cargo)) { tags.push('Rust Web'); skills.add('pixelcraft-web'); }
534
+ detected.push(`Cargo.toml (${tags.length ? tags.join(', ') : 'Rust'})`);
535
+ }
536
+ if (names.has('Package.swift') || hasDirExt('.xcodeproj') || hasDirExt('.xcworkspace')) {
537
+ detected.push('Swift / Apple manifest (SwiftUI / UIKit / AppKit)');
538
+ skills.add('pixelcraft-mobile');
539
+ skills.add('pixelcraft-desktop');
540
+ }
541
+ if (names.has('build.gradle') || names.has('build.gradle.kts')) {
542
+ const gradle = readTextSafe(path.join(dir, names.has('build.gradle.kts') ? 'build.gradle.kts' : 'build.gradle'));
543
+ detected.push(`Gradle (${/compose|android/i.test(gradle) ? 'Android / Jetpack Compose' : 'JVM / Kotlin'})`);
544
+ if (/compose|android/i.test(gradle)) skills.add('pixelcraft-mobile');
545
+ else skills.add('pixelcraft-desktop');
546
+ }
547
+ if (names.has('pubspec.yaml')) {
548
+ detected.push('pubspec.yaml (Flutter / Dart)');
549
+ skills.add('pixelcraft-mobile');
550
+ }
551
+ if (names.has('go.mod')) {
552
+ const gomod = readTextSafe(path.join(dir, 'go.mod'));
553
+ const tags = [];
554
+ if (/bubbletea|lipgloss/i.test(gomod)) { tags.push('Bubble Tea / Lip Gloss'); skills.add('pixelcraft-tui'); }
555
+ if (/ebiten/i.test(gomod)) { tags.push('Ebitengine'); skills.add('pixelcraft-game-ui'); }
556
+ if (/fyne|wails|gioui/i.test(gomod)) { tags.push('Go Desktop'); skills.add('pixelcraft-desktop'); }
557
+ if (/templ/i.test(gomod)) { tags.push('templ Web'); skills.add('pixelcraft-web'); }
558
+ detected.push(`go.mod (${tags.length ? tags.join(', ') : 'Go'})`);
559
+ }
560
+ if (names.has('pyproject.toml') || names.has('requirements.txt')) {
561
+ const py = `${readTextSafe(path.join(dir, 'pyproject.toml'))}\n${readTextSafe(path.join(dir, 'requirements.txt'))}`;
562
+ const tags = [];
563
+ if (/\b(?:textual|rich)\b/i.test(py)) { tags.push('Textual/Rich'); skills.add('pixelcraft-tui'); }
564
+ if (/\b(?:streamlit|gradio|marimo|dash|panel|nicegui|reflex|shiny)\b/i.test(py)) { tags.push('Python Data App'); skills.add('pixelcraft-data-apps'); }
565
+ if (/\b(?:pyside6|pyqt6|pyside2|pyqt5|pygobject)\b/i.test(py)) { tags.push('Python Desktop'); skills.add('pixelcraft-desktop'); }
566
+ if (/\b(?:flet|kivy)\b/i.test(py)) { tags.push('Python Mobile'); skills.add('pixelcraft-mobile'); }
567
+ if (/\b(?:django|fastapi|flask)\b/i.test(py)) { tags.push('Python Web'); skills.add('pixelcraft-web'); }
568
+ detected.push(`Python manifest (${tags.length ? tags.join(', ') : 'Python'})`);
569
+ }
570
+ if (names.has('composer.json')) {
571
+ detected.push('composer.json (PHP / Laravel / Symfony)');
572
+ skills.add('pixelcraft-web');
573
+ }
574
+ if (names.has('Gemfile')) {
575
+ detected.push('Gemfile (Ruby / Rails)');
576
+ skills.add('pixelcraft-web');
577
+ }
578
+ if (names.has('mix.exs')) {
579
+ const mix = readTextSafe(path.join(dir, 'mix.exs'));
580
+ detected.push('mix.exs (Elixir / Phoenix)');
581
+ skills.add('pixelcraft-web');
582
+ if (/live_view_native/i.test(mix)) skills.add('pixelcraft-mobile');
583
+ }
584
+ const csprojs = filesByExt('.csproj');
585
+ if (csprojs.length) {
586
+ const combined = csprojs.map((f) => readTextSafe(path.join(dir, f))).join('\n');
587
+ const tags = [];
588
+ if (/Avalonia|UseWPF|UseWinUI|Microsoft\.WindowsAppSDK/i.test(combined)) { tags.push('.NET Desktop'); skills.add('pixelcraft-desktop'); }
589
+ if (/UseMaui|Microsoft\.Maui/i.test(combined)) { tags.push('.NET MAUI'); skills.add('pixelcraft-mobile'); }
590
+ if (/MonoGame/i.test(combined)) { tags.push('MonoGame'); skills.add('pixelcraft-game-ui'); }
591
+ if (/Blazor|Microsoft\.NET\.Sdk\.Web|Razor/i.test(combined)) { tags.push('Blazor/Razor'); skills.add('pixelcraft-web'); }
592
+ detected.push(`${csprojs[0]} (${tags.length ? tags.join(', ') : 'C# / .NET'})`);
593
+ }
594
+ if (names.has('package.json')) {
595
+ const pkgText = readTextSafe(path.join(dir, 'package.json'));
596
+ const tags = [];
597
+ if (/"(?:react|next|vue|nuxt|svelte|solid-js|@angular\/core|astro|@builder\.io\/qwik|htmx\.org|lit|preact|hono)"/i.test(pkgText)) {
598
+ tags.push('Web'); skills.add('pixelcraft-web');
599
+ }
600
+ if (/"(?:react-native|expo|@lynx-js\/|@ionic\/)"/i.test(pkgText)) {
601
+ tags.push('Mobile'); skills.add('pixelcraft-mobile');
602
+ }
603
+ if (/"(?:electron|@tauri-apps\/)"/i.test(pkgText)) {
604
+ tags.push('Desktop'); skills.add('pixelcraft-desktop');
605
+ }
606
+ if (/"ink"/i.test(pkgText)) { tags.push('Ink TUI'); skills.add('pixelcraft-tui'); }
607
+ if (/"(?:mjml|@react-email\/|maizzle)"/i.test(pkgText)) { tags.push('Email'); skills.add('pixelcraft-email'); }
608
+ if (/"(?:@raycast\/api|@types\/vscode)"/i.test(pkgText)) { tags.push('Extension'); skills.add('pixelcraft-extensions'); }
609
+ detected.push(`package.json (${tags.length ? tags.join(', ') : 'JS/TS'})`);
610
+ if (tags.length === 0) skills.add('pixelcraft-web');
611
+ }
612
+ if (names.has('project.godot')) {
613
+ detected.push('project.godot (Godot Engine)');
614
+ skills.add('pixelcraft-game-ui');
615
+ }
616
+ if (filesByExt('.typ').length > 0) {
617
+ detected.push('*.typ (Typst document)');
618
+ skills.add('pixelcraft-document');
619
+ }
620
+ if (filesByExt('.mjml').length > 0) {
621
+ detected.push('*.mjml (MJML email)');
622
+ skills.add('pixelcraft-email');
623
+ }
624
+
625
+ skills.add('pixelcraft-review');
626
+ skills.add('pixelcraft-visual-qa');
627
+ return { detected, skills: [...skills] };
628
+ }
629
+
630
+ function runInitRouter({ options }) {
631
+ const dir = path.resolve(process.cwd(), options.dir || '.');
632
+ if (!fs.existsSync(dir) || !fs.statSync(dir).isDirectory()) {
633
+ throw new Error(`--dir must point to an existing directory: ${dir}`);
634
+ }
635
+ const { detected, skills } = detectRepoStack(dir);
636
+ const stackSummary = detected.length
637
+ ? detected.map((item) => `- ${item}`).join('\n')
638
+ : '- No stack manifest detected at repository root (inspect subdirectories during `pixelcraft-plan`).';
639
+ const content = [
640
+ '## Pixelcraft UI routing',
641
+ '',
642
+ 'For any request to design, build, redesign, review, audit, or verify UI in this repository, follow the Pixelcraft loop:',
643
+ '1. Start with `pixelcraft-plan` (read repo conventions first) and `pixelcraft` for routing.',
644
+ '2. Respect authority order: explicit user brief > existing project design system/conventions > platform conventions & accessibility floor > Pixelcraft guidance > model taste.',
645
+ '3. Verify changes with `pixelcraft-review` and `pixelcraft-visual-qa` using explicit evidence labels (`rendered`, `static`, `model-judgment`, `not-checked`, `waived`).',
646
+ '',
647
+ 'Detected stack manifests:',
648
+ stackSummary,
649
+ '',
650
+ `Recommended skills: ${skills.map((s) => `\`${s}\``).join(', ')}.`,
651
+ ].join('\n');
652
+
653
+ if (options.write) {
654
+ const outFile = path.resolve(process.cwd(), options.write);
655
+ assertNotSymlink(outFile, 'router output file');
656
+ fs.mkdirSync(path.dirname(outFile), { recursive: true });
657
+ const existing = fs.existsSync(outFile) ? fs.readFileSync(outFile, 'utf8') : '';
658
+ const updated = managedUpsert(existing, content);
659
+ fs.writeFileSync(outFile, updated);
660
+ console.log(`updated router: ${outFile}`);
661
+ } else {
662
+ console.log(`${managedStart}\n${content}\n${managedEnd}`);
663
+ }
664
+ }
665
+
666
+ function runCheck({ positional, options }) {
667
+ if (positional.length !== 1) throw new Error('check requires exactly one target file or directory');
668
+ const target = path.resolve(process.cwd(), positional[0]);
669
+ if (!fs.existsSync(target)) throw new Error(`target not found: ${positional[0]}`);
670
+ const stat = fs.statSync(target);
671
+ const ext = stat.isFile() ? path.extname(target).toLowerCase() : '';
672
+
673
+ const qaDir = path.join(skillsRoot, 'pixelcraft-visual-qa/scripts');
674
+ const reviewDir = path.join(skillsRoot, 'pixelcraft-review/scripts');
675
+
676
+ const dispatch = (scriptPath, scriptArgs) => {
677
+ const res = spawnSync(process.execPath, [scriptPath, ...scriptArgs], { encoding: 'utf8' });
678
+ if (res.stdout) process.stdout.write(res.stdout);
679
+ if (res.stderr) process.stderr.write(res.stderr);
680
+ process.exitCode = res.status ?? 1;
681
+ };
682
+
683
+ if (ext === '.pdf') {
684
+ const args = [target];
685
+ if (options.json) args.push('--json');
686
+ dispatch(path.join(qaDir, 'check-pdf.mjs'), args);
687
+ return;
688
+ }
689
+
690
+ if (ext === '.json') {
691
+ const raw = readTextSafe(target);
692
+ if (/"\$(?:value|type)"/.test(raw)) {
693
+ const args = [target];
694
+ if (options.json) args.push('--json');
695
+ dispatch(path.join(qaDir, 'check-contrast.mjs'), args);
696
+ return;
697
+ }
698
+ throw new Error(`${positional[0]} is JSON but does not look like a DTCG tokens file (missing "$value" or "$type")`);
699
+ }
700
+
701
+ const args = [target];
702
+ if (options.json) args.push('--json');
703
+ if (options.failOn) args.push('--fail-on', options.failOn);
704
+ dispatch(path.join(reviewDir, 'slop-scan.mjs'), args);
705
+
706
+ if (stat.isFile()) {
707
+ const isMjml = ext === '.mjml';
708
+ const isEmailHtml = ext === '.html' && (
709
+ /email|newsletter|receipt|digest|mail/i.test(path.basename(target))
710
+ || /<mjml\b|urn:schemas-microsoft-com:vml|mso-/i.test(readTextSafe(target))
711
+ );
712
+ if (isMjml || isEmailHtml) {
713
+ const hint = `note: for email-specific checks (102 KB Gmail clip, Outlook CSS, plaintext parity), also run: node skills/pixelcraft-visual-qa/scripts/check-email.mjs ${positional[0]}`;
714
+ if (options.json) console.error(hint);
715
+ else console.log(hint);
716
+ }
717
+ }
718
+ }
719
+
720
+ function numberedSelection(answer, names) {
721
+ const tokens = answer.split(/[\s,]+/).filter(Boolean);
722
+ if (tokens.length === 0) throw new Error('empty selection');
723
+ return [...new Set(tokens.map((token) => {
724
+ if (/^\d+$/.test(token)) {
725
+ const index = Number(token) - 1;
726
+ if (!names[index]) throw new Error(`selection ${token} is outside the numbered list`);
727
+ return names[index];
728
+ }
729
+ return token.toLowerCase();
730
+ }))];
731
+ }
732
+
733
+ function createPrompter() {
734
+ const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
735
+ const eof = Symbol('eof');
736
+ const lines = [];
737
+ const waiters = [];
738
+ rl.on('line', (line) => {
739
+ if (waiters.length) waiters.shift()(line);
740
+ else lines.push(line);
741
+ });
742
+ rl.on('close', () => {
743
+ while (waiters.length) waiters.shift()(eof);
744
+ });
745
+ return {
746
+ async question(text) {
747
+ process.stdout.write(text);
748
+ if (lines.length) return lines.shift();
749
+ const answer = await new Promise((resolve) => waiters.push(resolve));
750
+ if (answer === eof) throw new Error('input ended before the wizard completed');
751
+ return answer;
752
+ },
753
+ close() {
754
+ rl.close();
755
+ },
756
+ };
757
+ }
758
+
759
+ async function wizard() {
760
+ const available = skillNames();
761
+ const prompter = createPrompter();
762
+ try {
763
+ console.log('Pixelcraft interactive installer\n');
764
+ console.log('Agents:');
765
+ canonicalAgents.forEach((name, index) => console.log(` ${index + 1}) ${name}`));
766
+ console.log(` ${canonicalAgents.length + 1}) all`);
767
+ const ask = async (question, fallback) => {
768
+ const answer = (await prompter.question(question)).trim();
769
+ return answer || fallback;
770
+ };
771
+
772
+ const agentAnswer = await ask(`Choose agent(s) by number/name, comma-separated [1]: `, '1');
773
+ const agents = numberedSelection(agentAnswer, [...canonicalAgents, 'all']);
774
+
775
+ const allAnswer = (await ask('Install all skills? [Y/n]: ', 'y')).toLowerCase();
776
+ let positional = ['all'];
777
+ if (allAnswer.startsWith('n')) {
778
+ console.log('Skills:');
779
+ available.forEach((name, index) => console.log(` ${index + 1}) ${name}`));
780
+ const skillAnswer = await ask('Choose skills by number/name, comma-separated [1]: ', '1');
781
+ positional = numberedSelection(skillAnswer, available);
782
+ }
783
+
784
+ const scope = (await ask('Scope: project or global? [project]: ', 'project')).toLowerCase();
785
+ if (scope !== 'project' && scope !== 'global') throw new Error(`scope must be project or global, got '${scope}'`);
786
+ const docsMcp = /^(y|yes)$/i.test(await ask('Show optional Context7 docs MCP setup guidance? [y/N]: ', 'n'));
787
+ console.log(`\nReady to install ${positional.join(', ')} for ${agents.join(', ')} in ${scope} scope.`);
788
+ const confirm = (await ask('Continue? [Y/n]: ', 'y')).toLowerCase();
789
+ if (confirm.startsWith('n')) throw new Error('installation cancelled');
790
+
791
+ return {
792
+ positional,
793
+ options: { global: scope === 'global', dryRun: false, force: false, agents, docsMcp },
794
+ };
795
+ } finally {
796
+ prompter.close();
797
+ }
798
+ }
799
+
800
+ async function main() {
801
+ const args = process.argv.slice(2);
802
+ if (args.includes('--help') || args.includes('-h') || args[0] === 'help') {
803
+ console.log(help());
804
+ return;
805
+ }
806
+ if (args.length === 0) {
807
+ if (!process.stdin.isTTY) {
808
+ console.log(help());
809
+ return;
810
+ }
811
+ runAdd(await wizard());
812
+ return;
813
+ }
814
+
815
+ const [command, ...rest] = args;
816
+ if (command === 'list') {
817
+ for (const name of skillNames()) console.log(name);
818
+ return;
819
+ }
820
+ if (command === 'add') {
821
+ const { positional, options } = parse(rest);
822
+ if (options.agents.length === 0) throw new Error('add requires --agent');
823
+ runAdd({ positional, options });
824
+ return;
825
+ }
826
+ if (command === 'remove') {
827
+ const { positional, options } = parse(rest);
828
+ runRemove({ positional, options });
829
+ return;
830
+ }
831
+ if (command === 'doctor') {
832
+ const { options } = parse(rest);
833
+ runDoctor({ options });
834
+ return;
835
+ }
836
+ if (command === 'init-router') {
837
+ const { options } = parse(rest);
838
+ runInitRouter({ options });
839
+ return;
840
+ }
841
+ if (command === 'check') {
842
+ const { positional, options } = parse(rest);
843
+ runCheck({ positional, options });
844
+ return;
845
+ }
846
+ throw new Error(`unknown command: ${command}; run pixelcraft --help`);
847
+ }
848
+
849
+ main().catch((error) => {
850
+ console.error(`pixelcraft: ${error.message}`);
851
+ process.exit(1);
852
+ });