@thanhnguyxn/pixelcraft 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (376) hide show
  1. package/.agents/plugins/marketplace.json +1 -1
  2. package/.antigravity-plugin/plugin.json +32 -0
  3. package/.claude-plugin/marketplace.json +1 -1
  4. package/.claude-plugin/plugin.json +15 -4
  5. package/.codex-plugin/plugin.json +45 -0
  6. package/.cursor-plugin/marketplace.json +17 -0
  7. package/.cursor-plugin/plugin.json +27 -0
  8. package/.devin-plugin/plugin.json +21 -0
  9. package/.github/plugin/marketplace.json +34 -0
  10. package/CHANGELOG.md +159 -0
  11. package/GEMINI.md +1 -0
  12. package/README.md +185 -328
  13. package/SECURITY.md +28 -0
  14. package/assets/pixelcraft-logo-128.png +0 -0
  15. package/assets/pixelcraft-logo-256.png +0 -0
  16. package/bin/pixelcraft.mjs +431 -23
  17. package/docs/ARCHITECTURE.md +40 -37
  18. package/docs/DESIGN-RATIONALE.md +51 -3
  19. package/docs/INSTALL.md +221 -0
  20. package/evals/README.md +16 -6
  21. package/evals/fixtures/3d-web-engineering.json +69 -0
  22. package/evals/fixtures/acceptance-checklist-rule03-gate.json +43 -0
  23. package/evals/fixtures/ai-ui-libraries.json +53 -0
  24. package/evals/fixtures/audio-visual-accessibility.json +69 -0
  25. package/evals/fixtures/auth-and-checkout-ui.json +53 -0
  26. package/evals/fixtures/brandkit-identity-governance.json +48 -0
  27. package/evals/fixtures/build-and-architecture.json +53 -0
  28. package/evals/fixtures/canvas-and-node-editors.json +53 -0
  29. package/evals/fixtures/chat-ai-exfiltration-ime-hitl-gate.json +43 -0
  30. package/evals/fixtures/completion-gate-scan-until-clean.json +44 -0
  31. package/evals/fixtures/component-systems.json +53 -0
  32. package/evals/fixtures/component-testing.json +53 -0
  33. package/evals/fixtures/constrained-voice-and-tv.json +43 -0
  34. package/evals/fixtures/creative-code-rendering.json +69 -0
  35. package/evals/fixtures/creative-reference-evidence.json +67 -0
  36. package/evals/fixtures/data-app-python-marimo.json +49 -0
  37. package/evals/fixtures/desktop-cpp-juce-audio.json +49 -0
  38. package/evals/fixtures/desktop-csharp-avalonia.json +49 -0
  39. package/evals/fixtures/desktop-native-workspace.json +48 -0
  40. package/evals/fixtures/desktop-python-anti-tkinter.json +49 -0
  41. package/evals/fixtures/document-prepress-pdfx4-tounicode.json +43 -0
  42. package/evals/fixtures/document-rust-typst-invoice.json +49 -0
  43. package/evals/fixtures/document-typst-and-print-css.json +43 -0
  44. package/evals/fixtures/email-mjml-dark-mode.json +49 -0
  45. package/evals/fixtures/email-outlook-and-plaintext.json +43 -0
  46. package/evals/fixtures/enterprise-data-ui.json +53 -0
  47. package/evals/fixtures/extended-tui-toolkits.json +53 -0
  48. package/evals/fixtures/extensions-mv3-and-vscode.json +43 -0
  49. package/evals/fixtures/file-upload-media-ui.json +53 -0
  50. package/evals/fixtures/forms-validation.json +53 -0
  51. package/evals/fixtures/game-go-ebitengine.json +49 -0
  52. package/evals/fixtures/game-godot-gdscript.json +49 -0
  53. package/evals/fixtures/game-ui-hud-and-engines.json +43 -0
  54. package/evals/fixtures/i18n-engineering.json +53 -0
  55. package/evals/fixtures/local-first-sync.json +53 -0
  56. package/evals/fixtures/lynxjs.json +53 -0
  57. package/evals/fixtures/maizzle-email.json +53 -0
  58. package/evals/fixtures/maps-geospatial.json +53 -0
  59. package/evals/fixtures/media-og-and-video-export.json +43 -0
  60. package/evals/fixtures/media-players.json +53 -0
  61. package/evals/fixtures/mobile-compose-16kb-foldable-store-gate.json +44 -0
  62. package/evals/fixtures/mobile-elixir-liveview-native.json +49 -0
  63. package/evals/fixtures/mobile-flutter-dynamic-type.json +49 -0
  64. package/evals/fixtures/mobile-harmonyos-arkui.json +49 -0
  65. package/evals/fixtures/mobile-jetpack-compose.json +49 -0
  66. package/evals/fixtures/mobile-swiftui-ios.json +49 -0
  67. package/evals/fixtures/motion-engineering.json +69 -0
  68. package/evals/fixtures/pdfjs-and-pptx.json +53 -0
  69. package/evals/fixtures/plan-discovery-interview.json +31 -0
  70. package/evals/fixtures/plan-grill-me-brainstorm-gate.json +49 -0
  71. package/evals/fixtures/reactive-data-apps.json +53 -0
  72. package/evals/fixtures/review-evidence-audit.json +43 -0
  73. package/evals/fixtures/rich-text-and-code-editors.json +53 -0
  74. package/evals/fixtures/scrollytelling-resilience.json +70 -0
  75. package/evals/fixtures/spatial-xr-comfort-and-platforms.json +43 -0
  76. package/evals/fixtures/state-architecture.json +53 -0
  77. package/evals/fixtures/styling-ecosystem.json +53 -0
  78. package/evals/fixtures/token-tooling.json +53 -0
  79. package/evals/fixtures/tui-go-bubbletea.json +49 -0
  80. package/evals/fixtures/tui-rust-ratatui-grapheme-paste-teardown.json +44 -0
  81. package/evals/fixtures/tui-rust-ratatui.json +49 -0
  82. package/evals/fixtures/ux-state-matrix-and-i18n.json +43 -0
  83. package/evals/fixtures/web-3d-engines.json +53 -0
  84. package/evals/fixtures/web-php-laravel-filament.json +49 -0
  85. package/evals/fixtures/web-ruby-viewcomponent-phlex.json +49 -0
  86. package/evals/pixelcraft-accessibility.md +17 -0
  87. package/evals/pixelcraft-craft.md +16 -0
  88. package/evals/pixelcraft-dataviz.md +3 -3
  89. package/evals/pixelcraft-direction.md +17 -0
  90. package/evals/pixelcraft-game-ui.md +3 -3
  91. package/evals/pixelcraft-mobile.md +3 -3
  92. package/evals/pixelcraft-patterns.md +16 -0
  93. package/evals/pixelcraft-plan.md +65 -3
  94. package/evals/pixelcraft-review.md +3 -3
  95. package/evals/pixelcraft-visual-qa.md +11 -5
  96. package/evals/pixelcraft-web.md +21 -3
  97. package/evals/pixelcraft.md +4 -4
  98. package/gemini-extension.json +3 -2
  99. package/install.ps1 +57 -11
  100. package/install.sh +82 -7
  101. package/package.json +32 -4
  102. package/plugin.json +6 -1
  103. package/scripts/build-adapters.mjs +11 -13
  104. package/scripts/run-evals.mjs +397 -0
  105. package/scripts/sync-docs.mjs +381 -0
  106. package/scripts/test-build-adapters.mjs +14 -1
  107. package/scripts/test-cross-platform-qa.mjs +359 -0
  108. package/scripts/test-distribution.mjs +86 -7
  109. package/scripts/test-export-tokens.mjs +259 -3
  110. package/scripts/test-finish-gate.mjs +133 -10
  111. package/scripts/test-installers.mjs +155 -6
  112. package/scripts/test-shoot.mjs +23 -1
  113. package/scripts/test-slop-scan.mjs +390 -3
  114. package/scripts/test-style-inventory.mjs +23 -0
  115. package/scripts/test-sync-docs.mjs +140 -0
  116. package/scripts/test-validate-skills.mjs +82 -4
  117. package/scripts/validate-skills.mjs +149 -3
  118. package/skills/pixelcraft/SKILL.md +67 -47
  119. package/skills/pixelcraft/references/design-brief.md +2 -2
  120. package/skills/pixelcraft/references/floor.md +36 -19
  121. package/skills/pixelcraft/references/report-template.md +25 -11
  122. package/skills/pixelcraft/references/stack-detection.md +138 -67
  123. package/skills/pixelcraft/references/surface-acceptance.md +33 -21
  124. package/skills/pixelcraft/references/workflow-checkpoints.md +49 -7
  125. package/skills/pixelcraft-accessibility/SKILL.md +34 -13
  126. package/skills/pixelcraft-accessibility/references/apg-patterns.md +13 -0
  127. package/skills/pixelcraft-accessibility/references/motion-canvas.md +57 -0
  128. package/skills/pixelcraft-accessibility/references/platforms.md +34 -6
  129. package/skills/pixelcraft-accessibility/references/verification.md +15 -10
  130. package/skills/pixelcraft-accessibility/references/wcag22-checks.md +38 -5
  131. package/skills/pixelcraft-brandkit/SKILL.md +42 -30
  132. package/skills/pixelcraft-brandkit/references/asset-pipeline.md +90 -50
  133. package/skills/pixelcraft-brandkit/references/brand-governance.md +29 -27
  134. package/skills/pixelcraft-brandkit/references/logo-methods.md +33 -34
  135. package/skills/pixelcraft-brandkit/references/prompt-template.md +53 -51
  136. package/skills/pixelcraft-brandkit/references/qa-checklist.md +7 -2
  137. package/skills/pixelcraft-brandkit/references/visual-modes.md +16 -16
  138. package/skills/pixelcraft-chat-ui/SKILL.md +31 -27
  139. package/skills/pixelcraft-chat-ui/references/agentic-workspace.md +66 -0
  140. package/skills/pixelcraft-chat-ui/references/ai-ui-libraries.md +259 -0
  141. package/skills/pixelcraft-chat-ui/references/conversation-design.md +12 -6
  142. package/skills/pixelcraft-chat-ui/references/mobile-business-platforms.md +58 -68
  143. package/skills/pixelcraft-chat-ui/references/slack-discord.md +60 -76
  144. package/skills/pixelcraft-constrained/SKILL.md +21 -20
  145. package/skills/pixelcraft-constrained/references/specialized-hardware.md +69 -45
  146. package/skills/pixelcraft-constrained/references/tv-wearables.md +123 -73
  147. package/skills/pixelcraft-constrained/references/voice-ui.md +86 -45
  148. package/skills/pixelcraft-craft/SKILL.md +29 -15
  149. package/skills/pixelcraft-craft/references/color.md +62 -6
  150. package/skills/pixelcraft-craft/references/layout.md +32 -0
  151. package/skills/pixelcraft-craft/references/motion.md +99 -12
  152. package/skills/pixelcraft-craft/references/typography.md +48 -9
  153. package/skills/pixelcraft-data-apps/SKILL.md +50 -31
  154. package/skills/pixelcraft-data-apps/references/ai-and-internal-data-apps.md +147 -0
  155. package/skills/pixelcraft-data-apps/references/dash.md +87 -31
  156. package/skills/pixelcraft-data-apps/references/evidence.md +41 -26
  157. package/skills/pixelcraft-data-apps/references/gradio.md +65 -27
  158. package/skills/pixelcraft-data-apps/references/julia-genie.md +64 -29
  159. package/skills/pixelcraft-data-apps/references/jupyter-widgets.md +65 -27
  160. package/skills/pixelcraft-data-apps/references/nicegui.md +73 -34
  161. package/skills/pixelcraft-data-apps/references/observable-framework.md +65 -27
  162. package/skills/pixelcraft-data-apps/references/panel.md +69 -23
  163. package/skills/pixelcraft-data-apps/references/r-shiny.md +104 -34
  164. package/skills/pixelcraft-data-apps/references/reactive-data-apps.md +186 -0
  165. package/skills/pixelcraft-data-apps/references/reflex.md +85 -31
  166. package/skills/pixelcraft-data-apps/references/shiny.md +84 -27
  167. package/skills/pixelcraft-data-apps/references/streamlit.md +73 -25
  168. package/skills/pixelcraft-dataviz/SKILL.md +21 -24
  169. package/skills/pixelcraft-dataviz/references/color-accessibility.md +2 -2
  170. package/skills/pixelcraft-dataviz/references/encoding-tables-dashboards.md +35 -25
  171. package/skills/pixelcraft-dataviz/references/libraries.md +165 -46
  172. package/skills/pixelcraft-dataviz/references/maps-geospatial.md +159 -0
  173. package/skills/pixelcraft-dataviz/references/realtime-graphs-maps-scale.md +58 -65
  174. package/skills/pixelcraft-desktop/SKILL.md +61 -39
  175. package/skills/pixelcraft-desktop/references/appkit.md +60 -26
  176. package/skills/pixelcraft-desktop/references/avalonia.md +65 -29
  177. package/skills/pixelcraft-desktop/references/cpp-gui.md +104 -27
  178. package/skills/pixelcraft-desktop/references/electron.md +68 -26
  179. package/skills/pixelcraft-desktop/references/go-gui.md +59 -30
  180. package/skills/pixelcraft-desktop/references/gtk.md +74 -31
  181. package/skills/pixelcraft-desktop/references/javafx-swing.md +54 -25
  182. package/skills/pixelcraft-desktop/references/qt-pyside-qml.md +57 -30
  183. package/skills/pixelcraft-desktop/references/rust-gui.md +59 -41
  184. package/skills/pixelcraft-desktop/references/tauri.md +80 -24
  185. package/skills/pixelcraft-desktop/references/uno-platform.md +42 -23
  186. package/skills/pixelcraft-desktop/references/winui-wpf.md +66 -26
  187. package/skills/pixelcraft-desktop/references/working-context.md +82 -3
  188. package/skills/pixelcraft-direction/SKILL.md +48 -82
  189. package/skills/pixelcraft-direction/references/creative-brainstorming.md +72 -0
  190. package/skills/pixelcraft-direction/references/direction-card.md +11 -1
  191. package/skills/pixelcraft-direction/references/direction-scoring.md +5 -1
  192. package/skills/pixelcraft-direction/references/motion-identity.md +67 -0
  193. package/skills/pixelcraft-direction/references/movements.md +3 -0
  194. package/skills/pixelcraft-direction/references/reference-analysis.md +37 -0
  195. package/skills/pixelcraft-direction/references/slop-fingerprints.md +32 -7
  196. package/skills/pixelcraft-document/SKILL.md +27 -23
  197. package/skills/pixelcraft-document/references/archetypes.md +27 -4
  198. package/skills/pixelcraft-document/references/pdf-tools.md +241 -81
  199. package/skills/pixelcraft-document/references/pdfjs-and-pptx.md +114 -0
  200. package/skills/pixelcraft-document/references/print-css.md +96 -43
  201. package/skills/pixelcraft-document/references/slides.md +123 -27
  202. package/skills/pixelcraft-email/SKILL.md +42 -20
  203. package/skills/pixelcraft-email/references/client-quirks.md +101 -33
  204. package/skills/pixelcraft-email/references/html-tables.md +83 -22
  205. package/skills/pixelcraft-email/references/maizzle.md +54 -0
  206. package/skills/pixelcraft-email/references/mjml.md +13 -11
  207. package/skills/pixelcraft-email/references/react-email.md +76 -34
  208. package/skills/pixelcraft-extensions/SKILL.md +32 -27
  209. package/skills/pixelcraft-extensions/references/browser-extensions.md +91 -17
  210. package/skills/pixelcraft-extensions/references/figma-office.md +97 -14
  211. package/skills/pixelcraft-extensions/references/ide-and-saas-plugins.md +125 -0
  212. package/skills/pixelcraft-extensions/references/raycast.md +90 -11
  213. package/skills/pixelcraft-extensions/references/vscode-webviews.md +91 -17
  214. package/skills/pixelcraft-game-ui/SKILL.md +45 -26
  215. package/skills/pixelcraft-game-ui/references/bevy.md +69 -31
  216. package/skills/pixelcraft-game-ui/references/godot.md +100 -27
  217. package/skills/pixelcraft-game-ui/references/hud-principles.md +50 -21
  218. package/skills/pixelcraft-game-ui/references/love2d.md +53 -27
  219. package/skills/pixelcraft-game-ui/references/monogame.md +45 -29
  220. package/skills/pixelcraft-game-ui/references/unity-ugui.md +109 -0
  221. package/skills/pixelcraft-game-ui/references/unity-ui-toolkit.md +69 -27
  222. package/skills/pixelcraft-game-ui/references/unreal-umg.md +53 -26
  223. package/skills/pixelcraft-game-ui/references/web-and-middleware-game-ui.md +122 -0
  224. package/skills/pixelcraft-handoff/SKILL.md +14 -13
  225. package/skills/pixelcraft-handoff/references/design-translation.md +40 -10
  226. package/skills/pixelcraft-handoff/references/motion-handoff.md +54 -0
  227. package/skills/pixelcraft-media/SKILL.md +20 -23
  228. package/skills/pixelcraft-media/references/banners-video.md +83 -65
  229. package/skills/pixelcraft-media/references/og-generation.md +110 -63
  230. package/skills/pixelcraft-media/references/social-cards.md +57 -58
  231. package/skills/pixelcraft-mobile/SKILL.md +53 -36
  232. package/skills/pixelcraft-mobile/references/dotnet-maui.md +62 -34
  233. package/skills/pixelcraft-mobile/references/flet.md +53 -26
  234. package/skills/pixelcraft-mobile/references/flutter.md +76 -32
  235. package/skills/pixelcraft-mobile/references/harmonyos-and-emerging-mobile.md +121 -0
  236. package/skills/pixelcraft-mobile/references/ionic-capacitor.md +48 -26
  237. package/skills/pixelcraft-mobile/references/jetpack-compose.md +92 -24
  238. package/skills/pixelcraft-mobile/references/kivy.md +54 -31
  239. package/skills/pixelcraft-mobile/references/kotlin-multiplatform.md +53 -27
  240. package/skills/pixelcraft-mobile/references/lynxjs.md +110 -0
  241. package/skills/pixelcraft-mobile/references/nativescript-and-skip.md +91 -0
  242. package/skills/pixelcraft-mobile/references/react-native-expo.md +66 -31
  243. package/skills/pixelcraft-mobile/references/swiftui.md +158 -28
  244. package/skills/pixelcraft-mobile/references/tactile-interactions.md +55 -0
  245. package/skills/pixelcraft-mobile/references/task-state-composition.md +82 -2
  246. package/skills/pixelcraft-mobile/references/uikit.md +57 -23
  247. package/skills/pixelcraft-patterns/SKILL.md +30 -13
  248. package/skills/pixelcraft-patterns/references/accessibility-resilience.md +29 -0
  249. package/skills/pixelcraft-patterns/references/ai-and-offline-patterns.md +54 -0
  250. package/skills/pixelcraft-patterns/references/auth-onboarding.md +32 -13
  251. package/skills/pixelcraft-patterns/references/billing-paywalls.md +40 -0
  252. package/skills/pixelcraft-patterns/references/command-workspace.md +56 -0
  253. package/skills/pixelcraft-patterns/references/commerce.md +35 -16
  254. package/skills/pixelcraft-patterns/references/communication.md +34 -15
  255. package/skills/pixelcraft-patterns/references/creative-tools.md +30 -17
  256. package/skills/pixelcraft-patterns/references/creative-web-composition.md +38 -0
  257. package/skills/pixelcraft-patterns/references/dashboard-admin.md +22 -18
  258. package/skills/pixelcraft-patterns/references/history-diff-undo.md +50 -0
  259. package/skills/pixelcraft-patterns/references/marketing.md +31 -19
  260. package/skills/pixelcraft-patterns/references/multi-tenant-rbac.md +47 -0
  261. package/skills/pixelcraft-patterns/references/narrative-systems.md +42 -0
  262. package/skills/pixelcraft-patterns/references/notifications-activity.md +57 -0
  263. package/skills/pixelcraft-patterns/references/pattern-selection.md +8 -2
  264. package/skills/pixelcraft-patterns/references/scheduling-kanban.md +47 -0
  265. package/skills/pixelcraft-patterns/references/scroll-implementation.md +37 -0
  266. package/skills/pixelcraft-patterns/references/settings.md +40 -12
  267. package/skills/pixelcraft-plan/SKILL.md +54 -18
  268. package/skills/pixelcraft-plan/references/discovery-interview.md +110 -0
  269. package/skills/pixelcraft-plan/references/grill-me-protocol.md +63 -0
  270. package/skills/pixelcraft-plan/references/plan-template.md +44 -9
  271. package/skills/pixelcraft-plan/references/repo-discovery.md +16 -9
  272. package/skills/pixelcraft-plan/references/stack-freshness.md +22 -5
  273. package/skills/pixelcraft-plan/references/stack-selection.md +65 -9
  274. package/skills/pixelcraft-review/SKILL.md +41 -19
  275. package/skills/pixelcraft-review/references/audit-report.md +20 -1
  276. package/skills/pixelcraft-review/references/heuristics.md +63 -18
  277. package/skills/pixelcraft-review/references/personas.md +41 -14
  278. package/skills/pixelcraft-review/references/polish.md +66 -26
  279. package/skills/pixelcraft-review/scripts/check-acceptance.mjs +619 -0
  280. package/skills/pixelcraft-review/scripts/fixtures/focus-longhand-removal.css +34 -0
  281. package/skills/pixelcraft-review/scripts/slop-scan.mjs +679 -32
  282. package/skills/pixelcraft-spatial/SKILL.md +16 -17
  283. package/skills/pixelcraft-spatial/references/comfort-accessibility.md +25 -84
  284. package/skills/pixelcraft-spatial/references/platforms.md +123 -53
  285. package/skills/pixelcraft-tokens/SKILL.md +18 -14
  286. package/skills/pixelcraft-tokens/assets/tokens.example.json +1 -1
  287. package/skills/pixelcraft-tokens/assets/tokens.modes.example.json +1 -1
  288. package/skills/pixelcraft-tokens/references/format.md +39 -9
  289. package/skills/pixelcraft-tokens/references/governance.md +1 -1
  290. package/skills/pixelcraft-tokens/references/theme-presets.md +36 -8
  291. package/skills/pixelcraft-tokens/references/token-tooling.md +119 -0
  292. package/skills/pixelcraft-tokens/scripts/export-tokens.mjs +637 -75
  293. package/skills/pixelcraft-tui/SKILL.md +41 -25
  294. package/skills/pixelcraft-tui/references/bubbletea-lipgloss.md +49 -30
  295. package/skills/pixelcraft-tui/references/extended-tui-toolkits.md +127 -0
  296. package/skills/pixelcraft-tui/references/ink.md +77 -28
  297. package/skills/pixelcraft-tui/references/ratatui.md +70 -30
  298. package/skills/pixelcraft-tui/references/rich.md +53 -33
  299. package/skills/pixelcraft-tui/references/terminal-protocols.md +80 -0
  300. package/skills/pixelcraft-tui/references/textual.md +75 -34
  301. package/skills/pixelcraft-ux/SKILL.md +22 -12
  302. package/skills/pixelcraft-ux/references/feedback-performance.md +39 -19
  303. package/skills/pixelcraft-ux/references/forms.md +57 -3
  304. package/skills/pixelcraft-ux/references/i18n.md +50 -12
  305. package/skills/pixelcraft-ux/references/laws.md +35 -14
  306. package/skills/pixelcraft-ux/references/state-matrix.md +15 -1
  307. package/skills/pixelcraft-ux/references/ux-writing.md +1 -0
  308. package/skills/pixelcraft-visual-qa/SKILL.md +21 -7
  309. package/skills/pixelcraft-visual-qa/references/capture-desktop-game.md +28 -7
  310. package/skills/pixelcraft-visual-qa/references/capture-document.md +70 -0
  311. package/skills/pixelcraft-visual-qa/references/capture-email.md +13 -9
  312. package/skills/pixelcraft-visual-qa/references/capture-mobile.md +20 -5
  313. package/skills/pixelcraft-visual-qa/references/capture-terminal.md +6 -2
  314. package/skills/pixelcraft-visual-qa/references/motion-capture.md +63 -0
  315. package/skills/pixelcraft-visual-qa/references/performance-budgets.md +25 -12
  316. package/skills/pixelcraft-visual-qa/references/realtime-graphics.md +55 -0
  317. package/skills/pixelcraft-visual-qa/scripts/check-contrast.mjs +442 -0
  318. package/skills/pixelcraft-visual-qa/scripts/check-email.mjs +397 -0
  319. package/skills/pixelcraft-visual-qa/scripts/check-pdf.mjs +189 -0
  320. package/skills/pixelcraft-visual-qa/scripts/check-tui.mjs +321 -0
  321. package/skills/pixelcraft-visual-qa/scripts/finish-gate.mjs +50 -11
  322. package/skills/pixelcraft-visual-qa/scripts/shoot.mjs +214 -59
  323. package/skills/pixelcraft-visual-qa/scripts/style-inventory.mjs +121 -49
  324. package/skills/pixelcraft-web/SKILL.md +105 -49
  325. package/skills/pixelcraft-web/references/accessibility-performance.md +42 -0
  326. package/skills/pixelcraft-web/references/adaptive-layout.md +52 -8
  327. package/skills/pixelcraft-web/references/angular.md +63 -16
  328. package/skills/pixelcraft-web/references/assets-pipeline.md +67 -0
  329. package/skills/pixelcraft-web/references/astro.md +64 -13
  330. package/skills/pixelcraft-web/references/audio-reactive.md +61 -0
  331. package/skills/pixelcraft-web/references/auth-and-checkout-ui.md +115 -0
  332. package/skills/pixelcraft-web/references/build-and-architecture.md +215 -0
  333. package/skills/pixelcraft-web/references/canvas-and-node-editors.md +157 -0
  334. package/skills/pixelcraft-web/references/clojurescript.md +52 -17
  335. package/skills/pixelcraft-web/references/component-systems.md +102 -0
  336. package/skills/pixelcraft-web/references/component-testing.md +170 -0
  337. package/skills/pixelcraft-web/references/creative-effects.md +59 -0
  338. package/skills/pixelcraft-web/references/creative-runtime.md +34 -0
  339. package/skills/pixelcraft-web/references/enterprise-data-ui.md +138 -0
  340. package/skills/pixelcraft-web/references/file-upload-media-ui.md +82 -0
  341. package/skills/pixelcraft-web/references/forms-validation.md +123 -0
  342. package/skills/pixelcraft-web/references/fsharp-fable.md +3 -2
  343. package/skills/pixelcraft-web/references/gsap.md +102 -0
  344. package/skills/pixelcraft-web/references/html-css.md +144 -12
  345. package/skills/pixelcraft-web/references/htmx-alpine.md +68 -18
  346. package/skills/pixelcraft-web/references/i18n-engineering.md +106 -0
  347. package/skills/pixelcraft-web/references/interaction-and-search-primitives.md +196 -0
  348. package/skills/pixelcraft-web/references/java-web.md +27 -18
  349. package/skills/pixelcraft-web/references/kotlin-web.md +6 -2
  350. package/skills/pixelcraft-web/references/leptos-yew.md +62 -19
  351. package/skills/pixelcraft-web/references/lit-web-components.md +4 -2
  352. package/skills/pixelcraft-web/references/local-first-sync.md +105 -0
  353. package/skills/pixelcraft-web/references/media-players.md +104 -0
  354. package/skills/pixelcraft-web/references/motion-react.md +96 -0
  355. package/skills/pixelcraft-web/references/motion-recipes.md +82 -0
  356. package/skills/pixelcraft-web/references/preact-fresh-hono.md +111 -0
  357. package/skills/pixelcraft-web/references/pwa.md +6 -1
  358. package/skills/pixelcraft-web/references/qwik.md +51 -11
  359. package/skills/pixelcraft-web/references/r3f-integration.md +69 -0
  360. package/skills/pixelcraft-web/references/react-next.md +112 -13
  361. package/skills/pixelcraft-web/references/rendering-choice.md +63 -0
  362. package/skills/pixelcraft-web/references/rendering-performance.md +80 -0
  363. package/skills/pixelcraft-web/references/rich-text-and-code-editors.md +220 -0
  364. package/skills/pixelcraft-web/references/rive-lottie.md +73 -0
  365. package/skills/pixelcraft-web/references/scene-architecture.md +132 -0
  366. package/skills/pixelcraft-web/references/server-rendered.md +106 -63
  367. package/skills/pixelcraft-web/references/shader-workflow.md +77 -0
  368. package/skills/pixelcraft-web/references/smooth-scroll.md +58 -0
  369. package/skills/pixelcraft-web/references/solid.md +67 -16
  370. package/skills/pixelcraft-web/references/state-architecture.md +107 -0
  371. package/skills/pixelcraft-web/references/styling-ecosystem.md +273 -0
  372. package/skills/pixelcraft-web/references/svelte.md +61 -11
  373. package/skills/pixelcraft-web/references/tailwind.md +40 -14
  374. package/skills/pixelcraft-web/references/video-media.md +69 -0
  375. package/skills/pixelcraft-web/references/vue-nuxt.md +37 -13
  376. package/skills/pixelcraft-web/references/web-3d-engines.md +97 -0
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: pixelcraft-extensions
3
- description: Designs and verifies host-constrained extension and plugin interfaces. Use for browser extensions, Manifest V3 popups/options/side panels/content-script UI, Shadow DOM isolation, host-theme adaptation, permission UX, VS Code webviews and CSP, Raycast commands, Figma plugins/widgets, Office add-ins/task panes, embedded panels, and compact host-controlled UI where platform constraints shape layout, security, and visual design.
3
+ description: Designs and verifies host-constrained extension and plugin interfaces. Use for Chrome, Firefox, and Safari browser extensions (Manifest V3, WXT, Plasmo, CRXJS, Shadow DOM, side panels, DevTools), VS Code extensions (webviews, CSP, Custom Editors, Chat Participants, MCP), JetBrains/IntelliJ/Jewel plugins, Obsidian plugins, Raycast commands/AI tools, Figma plugins/widgets, Office add-ins (Unified Manifest, Fluent UI), Shopify App Bridge/Polaris, Atlassian Forge, and Notion/Linear integrations.
4
4
  license: MIT
5
5
  metadata:
6
6
  version: 0.1.0
@@ -8,44 +8,49 @@ metadata:
8
8
 
9
9
  # Pixelcraft extensions
10
10
 
11
- Extension UI is embedded trust-sensitive UI. Respect the host's security model, theme, chrome, input conventions, and limited space. Do not import a full product shell or branding takeover into a popup, panel, webview, or plugin iframe.
11
+ Extension UI is embedded trust-sensitive UI. Respect the host's security model, threading rules, theme tokens, chrome, input conventions, and constrained viewport. Do not import a full standalone product shell or branding takeover into a popup, panel, webview, task pane, or plugin iframe.
12
12
 
13
13
  ## Surface craft
14
14
 
15
- Use the host's smallest appropriate surface: command for a quick action, panel for recurring context, webview for needs the host cannot express. Preserve host tokens, zoom and keyboard conventions, show the object's context, and verify open/action/dismiss with focus restored. Do not import a site's navigation or modal system into the host.
15
+ Use the host's smallest appropriate native surface: command or QuickPick for a quick action, TreeView or side panel for recurring context, Custom Editor/widget for document-bound state, and Webview/iframe only for needs native primitives cannot express. Preserve host tokens, zoom, and keyboard conventions, show the active object's context, and verify open/action/dismiss with focus restored.
16
16
 
17
17
  ## References
18
18
 
19
- - Read [references/browser-extensions.md](references/browser-extensions.md) for MV3 popup/options/side panel/content-script UI, Shadow DOM, permissions, lifecycle, and browser constraints.
20
- - Read [references/vscode-webviews.md](references/vscode-webviews.md) for VS Code webview isolation, `asWebviewUri`, CSP/nonces, theme variables, message passing, and editor UX.
21
- - Read [references/raycast.md](references/raycast.md) for Raycast-native command UI, List/Grid/Detail/Form, ActionPanel, shortcuts, loading, and launcher constraints.
22
- - Read [references/figma-office.md](references/figma-office.md) for Figma plugin iframe UI and Office task-pane/add-in constraints.
19
+ - Read [references/browser-extensions.md](references/browser-extensions.md) when building Chrome, Firefox, or Safari Manifest V3 extensions (WXT, Plasmo, CRXJS, popups, side panels, DevTools, Shadow DOM `rem` isolation, MV3 storage/alarms/offscreen).
20
+ - Read [references/vscode-webviews.md](references/vscode-webviews.md) when building VS Code extensions (native surface selection, Custom Editors, Chat Participants/LM Tools/MCP, webview CSP/nonces, `asWebviewUri`, `--vscode-*` tokens, Workspace Trust, `vscode.dev`).
21
+ - Read [references/raycast.md](references/raycast.md) when building Raycast extensions (`List`/`Grid`/`Detail`/`Form`, `ActionPanel`, `@raycast/utils`, `MenuBarExtra`, AI Extensions/Tools, no-view commands, macOS/Windows parity).
22
+ - Read [references/figma-office.md](references/figma-office.md) when building Figma plugins (`themeColors`, `dynamic-page`, Dev Mode/Code Connect), Figma Widgets (`useSyncedState`), or Microsoft Office add-ins (Unified Manifest, `Office.onReady`, Fluent UI v9, `displayDialogAsync` OAuth).
23
+ - Read [references/ide-and-saas-plugins.md](references/ide-and-saas-plugins.md) when building JetBrains Platform plugins (Kotlin UI DSL v2, Jewel, JCEF, EDT threading), Obsidian plugins, Shopify embedded apps (App Bridge v4 + Polaris), Atlassian Forge (UI Kit 2 vs Custom UI), or Notion/Linear integrations.
23
24
 
24
25
  ## Platform translation rules
25
26
 
26
- 1. Identify the surface type first: transient popup, persistent panel, embedded content UI, full options page, command palette item, canvas plugin, or host task pane.
27
- 2. Use host-native controls/tokens before custom branding. Match theme changes live rather than capturing a static palette.
28
- 3. Design for the actual viewport: narrow popup/panel, resizable webview/task pane, content-script overlay with unpredictable host CSS, or command-rendered native controls.
29
- 4. Make permissions contextual and reversible. Explain why each host/data permission is needed and provide degraded behavior when denied.
30
- 5. Treat security boundaries as design constraints: CSP, sandboxing, isolated worlds, postMessage validation, no remote code execution, no broad scraping by default.
31
- 6. Keep state truthful across lifecycle interrupts: popup close, host navigation, reload/update, workspace switch, document change, account/permission expiry.
27
+ 1. Identify the surface type first: transient popup, persistent side panel, content-script Shadow DOM overlay, DevTools tab, native IDE tool window/editor, command palette/launcher, multiplayer canvas widget, or SaaS admin iframe.
28
+ 2. Prefer host-native controls and live theme tokens (`--vscode-*`, `--figma-color-*`, Obsidian `--background-primary`, Polaris/App Bridge, Fluent UI v9, Jewel) before custom styling.
29
+ 3. Design for the real viewport: 320 px popup/task pane, narrow sidebar, mobile Safari/Obsidian sheet, or hostile arbitrary web pages.
30
+ 4. Minimize permissions and request optional scopes contextually at point of need, with truthful denied/restricted-mode fallback states.
31
+ 5. Treat security and threading boundaries as UX constraints: CSP/nonces, isolated worlds, `postMessage` validation, OAuth dialog popups, session tokens, no remote code execution, and never blocking IDE UI threads.
32
+ 6. Persist state cleanly across lifecycle interrupts: popup close, MV3 service-worker sleep, webview hide/reload, workspace trust change, and document switches.
32
33
 
33
34
  ## Hard rules
34
35
 
35
- - Never inject visible content into arbitrary host pages before establishing origin/match scope and user intent.
36
- - Never use broad host permissions because narrower APIs are harder.
37
- - Never hardcode light colors or assume dark mode; read host theme variables/signals.
38
- - Never rely on remote scripts or CSP bypasses in webviews/popups.
39
- - Never use browser-extension popup lifetime as durable state storage.
40
- - Never fake native launcher/editor behavior with unconstrained web UI when the platform supplies a structured component model.
36
+ - **Chrome Web Store MV3 #1 Rejection Gate — Zero Remotely Hosted Code (`RHC`) & Safari packaging**: bundle 100% of executable JS/WASM inside the signed extension archive (zero remote `<script>`, `import("https://...")`, `eval()`, `new Function()`, or remote script strings); when Safari is in scope, package and verify the **Safari Web Extension macOS/iOS Xcode app-wrapper** (`xcrun safari-web-extension-converter`, native messaging/permission parity, and mobile Safari sheet sizing).
37
+ - **Ephemeral MV3 Service Workers & Webview `getState`/`setState` persistence**: persist MV3 state in `chrome.storage.session` / `chrome.storage.local` + `chrome.alarms` (never global RAM variables or `setInterval`), and serialize IDE/plugin **Webview state when hidden** (`acquireVsCodeApi().getState()` / `setState()` + `WebviewPanelSerializer`—avoiding `retainContextWhenHidden` RAM bloat unless strictly required).
38
+ - **Shadow DOM isolation & hostile-CSS host page testing**: wrap injected content-script UI in **Shadow DOM** (`all: initial` + `px`-normalized reset because `rem` resolves against the host's `<html>`!), **call `e.stopPropagation()` on `keydown`, `keyup`, and `keypress`** inside extension inputs (preserving `Escape` dismiss), and **test content scripts on hostile-CSS host pages** (aggressive `* { box-sizing: content-box !important }`, `z-index: 2147483647` overlays, `html { font-size: 62.5% }`, strict host CSPs, and dark/light mismatch).
39
+ - **Host startup (`< 50 ms`), `"*"` activation ban & remote/virtual workspaces**: **ban `"activationEvents": ["*"]`** in VS Code `package.json`, keep JetBrains/Obsidian startup off the UI/EDT thread, and declare/verify **remote & virtual workspace support** (**SSH Remote, GitHub Codespaces, Dev Containers, WSL, and `vscode.dev` `workspace.fs` URIs**—never assuming local POSIX `fs` paths).
40
+ - **Strict `OAuth 2.0 + PKCE (S256)` & OS `SecretStorage`**: authenticate public extension/plugin clients via **Authorization Code + PKCE (`S256`)** and store tokens in OS-encrypted **`context.secrets` (`SecretStorage`)** or `chrome.storage.session`—**never embed a `client_secret` inside distributed extension code**.
41
+ - **Mid-session host theme & locale hot-switching**: consume `--vscode-*`, `--figma-color-*`, Obsidian `--background-primary`, Polaris/App Bridge, Fluent UI v9, Raycast, and Jewel tokens across Light, Dark, and High-Contrast modes, and **hot-switch both host theme AND locale mid-session without requiring an extension reload or losing input state**.
42
+
43
+ ## Anti-lazy-default & anti-slop guard
44
+
45
+ - **Smallest native host primitive first**: never reach for a heavy Webview, JCEF browser, or custom iframe when a host-native command, QuickPick, status-bar item, TreeView, Raycast `List`/`Detail`/`Form`, Atlassian Forge UI Kit 2 component, or Polaris/Fluent primitive solves the workflow cleanly.
46
+ - **Reject standalone SaaS shell slop**: never cram a full marketing hero, multi-level marketing nav bar, or brand-takeover theme into a 320 px browser popup, IDE side panel, Office task pane, or Figma plugin frame.
41
47
 
42
48
  ## Pre-submit checklist
43
49
 
44
- - [ ] correct surface type and host integration point chosen;
45
- - [ ] permissions minimized, explained, versioned, and denied/error states designed;
46
- - [ ] host light/dark/high-contrast theme and density respected;
47
- - [ ] CSP/sandbox/origin/message validation constraints satisfied;
48
- - [ ] keyboard/shortcut/focus behavior matches the host;
49
- - [ ] resize/smallest width/height and panel collapse behavior verified;
50
- - [ ] lifecycle interruption/update/reload states tested;
51
- - [ ] screenshots or runtime inspection labeled by host/version/emulation status.
50
+ - [ ] smallest appropriate native host surface chosen before falling back to Webview/iframe;
51
+ - [ ] **MV3 Zero RHC verified** (zero remote `<script>`, `eval`, `new Function`), ephemeral worker state in `chrome.storage.*`/`chrome.alarms`, `activeTab`/optional permissions scoped, and **Safari Web Extension macOS/iOS app-wrapper packaging** verified when Safari is in scope;
52
+ - [ ] content-script UI isolated in **Shadow DOM** (`px`-safe reset + `keydown`/`keyup`/`keypress` `stopPropagation()`) and **tested against hostile-CSS host pages** (`html { font-size: 62.5% }`, max `z-index`, aggressive resets, strict CSP);
53
+ - [ ] VS Code `package.json` contains **zero `"activationEvents": ["*"]`** (`< 50 ms` lazy activation), **Webview state persists when hidden (`getState`/`setState`)**, **remote/virtual workspaces (SSH / Codespaces / WSL / `workspace.fs`)** work cleanly, and JetBrains/IDE work stays off the EDT;
54
+ - [ ] auth uses **`OAuth 2.0 + PKCE (S256)`** + **`context.secrets` / session tokens** with **zero embedded `client_secret`**;
55
+ - [ ] **mid-session host theme (Light/Dark/High-Contrast) & locale hot-switching** without reload, narrow `320 px` viewports, and focus restoration verified (`rendered` vs `static` vs `not-checked`);
56
+ - [ ] **Checklist-Until-Passing Stop-Gate (`<HARD-GATE>`):** walk every checklist item above + run `slop-scan.mjs --fail-on p2`, `check-contrast.mjs`, host extension/plugin tests, and `check-acceptance.mjs .pixelcraft/acceptance.json` (`pixelcraft-review`) in a `Fix → Re-verify` loop until passing (`0` `fail`/`pending` rows, `rendered` evidence on visual/perf/a11y per `Rule #0.3`).
@@ -1,31 +1,105 @@
1
1
  # Browser extensions (Manifest V3)
2
2
 
3
- Verified core integration points: `action.default_popup` for transient popup UI, `options_ui.page` for settings, `side_panel.default_path` plus the `sidePanel` permission for persistent panel UI, `background.service_worker` for event handling, and `content_scripts` matches/js/css or scripting injection for page context UI.
3
+ Choose the smallest Manifest V3 surface and build toolkit that matches your target browsers (**Chrome/Edge, Firefox, Safari**) rather than shipping ad hoc raw scripts with broken CSS or flaky service workers.
4
4
 
5
- ## Surface selection
5
+ ## Build toolkits and cross-browser matrix
6
6
 
7
- | Surface | Use | Constraints |
7
+ | Toolkit | Best fit | Key trade-off |
8
8
  |---|---|---|
9
- | popup | quick status/action | ephemeral, narrow, closes on focus loss; no durable state assumption |
10
- | side panel | persistent companion workflow | resizable/narrow; requires `sidePanel`; user controls side/pinning |
11
- | options page | deep configuration | full document but browser settings context; deep-link/dirty state matter |
12
- | content UI | contextual page augmentation | hostile/unknown CSS/layout; must not break host page |
9
+ | **WXT** | Modern Vite-based default for Chrome, Firefox, and Safari MV3 with auto-generated manifest, HMR, and `createShadowRootUi` | Opinionated `entrypoints/` directory layout |
10
+ | **Plasmo** | React/TypeScript extensions wanting built-in CSUI anchoring and storage hooks | Tighter React coupling; slower adoption of newer browser-specific APIs |
11
+ | **CRXJS** | Existing Vite + React/Vue/Svelte apps adding a Chrome MV3 build | Primarily Chromium-focused; Firefox/Safari need extra manifest config |
12
+ | **`webextension-polyfill`** | Vanilla/custom builds normalizing `browser.*` Promise APIs across Chrome, Firefox, and Safari | Manual manifest and Shadow DOM packaging |
13
13
 
14
- ## Content-script UI isolation
14
+ ## Surface selection and browser divergence
15
15
 
16
- Attach a host element and use Shadow DOM for UI where supported. Load styles into the shadow root rather than relying on page globals. Reset inheritance deliberately: color scheme, font, line-height, box-sizing, direction. Use semantic HTML inside the shadow root because isolation does not create accessibility automatically. Never let host CSS selectors or extension CSS leak unintentionally; test on dense, dark, RTL, zoomed, and highly customized pages.
16
+ | Surface | Use for | Cross-browser & UX constraints |
17
+ |---|---|---|
18
+ | **Popup** (`action.default_popup`) | Quick status or single-step action | Ephemeral, narrow (300–420 px), closes on blur; never rely on popup lifetime for durable writes |
19
+ | **Side Panel / Sidebar** | Persistent companion workflow | **Divergence**: Chrome/Edge use `side_panel.default_path` + `chrome.sidePanel.open()` (**must be called synchronously inside a user gesture**); Firefox uses `sidebar_action` (`browser.sidebarAction.open()`) |
20
+ | **Content-script UI** | Contextual on-page overlay | Host CSS is hostile; always isolate in **Shadow DOM** and never duplicate mounts on SPA navigations |
21
+ | **Options page** (`options_ui`) | Deep configuration | Full document; use explicit Save/Reset semantics and explain permission grants clearly |
22
+ | **DevTools Panel** (`devtools_page`) | Network/DOM/framework inspectors | Register via `chrome.devtools.panels.create(...)`, match `chrome.devtools.panels.themeName` (`'default' \| 'dark'`), and guard `inspectedWindow.eval` |
23
+
24
+ ## Content-script Shadow DOM isolation, the `rem` trap, and host shortcut shielding
25
+
26
+ Host pages frequently override root `html { font-size: 62.5%; }` (`10px`) AND attach global window/document `keydown` listeners for single-key shortcuts (GitHub `s` / `/`, YouTube `k` / `f` / `m`, Gmail `c` / `#`, Linear `c`). Because CSS **`rem` inside a Shadow DOM resolves against the host's `<html>`**, and **composed keyboard events bubble out of the Shadow DOM to `document`**, unshielded overlays both shrink by 37% and trigger chaos on the underlying page while the user types!
27
+
28
+ - Fix the `rem` trap by compiling Shadow DOM CSS to `px` (`postcss-rem-to-pixel`) and setting `:host { all: initial; color-scheme: light dark; font-family: system-ui, sans-serif; font-size: 14px; }`.
29
+ - **Stop keyboard propagation at the Shadow Root boundary**: call `e.stopPropagation()` on `keydown`, `keyup`, and `keypress` inside extension inputs/overlays (handling `Escape` locally to close and restore focus):
30
+
31
+ ```ts
32
+ // entrypoints/overlay.content.ts (WXT)
33
+ export default defineContentScript({
34
+ matches: ['https://*.example.com/*'],
35
+ cssInjectionMode: 'ui',
36
+ async main(ctx) {
37
+ const ui = await createShadowRootUi(ctx, {
38
+ name: 'pixelcraft-inspector',
39
+ position: 'inline',
40
+ anchor: 'body',
41
+ onMount(container) {
42
+ const root = document.createElement('section');
43
+ root.setAttribute('aria-label', 'Page inspector');
44
+ // Shield host-page single-key shortcuts (GitHub '/', YouTube 'k'/'f') when typing inside CSUI
45
+ for (const type of ['keydown', 'keyup', 'keypress'] as const) {
46
+ root.addEventListener(type, (e) => {
47
+ if (type === 'keydown' && (e as KeyboardEvent).key === 'Escape') {
48
+ root.remove();
49
+ }
50
+ e.stopPropagation();
51
+ });
52
+ }
53
+ const input = document.createElement('input');
54
+ input.placeholder = 'Filter elements…';
55
+ root.append(input);
56
+ container.append(root);
57
+ return root;
58
+ },
59
+ onRemove(root) {
60
+ root?.remove();
61
+ },
62
+ });
63
+ ui.mount();
64
+ },
65
+ });
66
+ ```
67
+
68
+ ## Chrome Web Store MV3 #1 Rejection Gate: Zero Remotely Hosted Code (`RHC`)
69
+
70
+ Chrome Web Store automated + human review immediately rejects any Manifest V3 submission that loads or executes code not present inside the signed `.zip` bundle:
71
+
72
+ - **Strictly banned**: `<script src="https://...">` (including Google Tag Manager, external Stripe/Firebase/Sentry CDN scripts, or remote UI bundles), dynamic `import("https://...")`, `eval()`, `new Function()`, string `setTimeout("...")`, or fetching JS/WASM payloads from an API to pass into `chrome.scripting.executeScript({ func })`.
73
+ - **Allowed**: bundling all SDKs locally at build time (`vite`/`wxt` Rollup bundle with `content_security_policy.extension_pages = "script-src 'self' 'wasm-unsafe-eval'; object-src 'self';"`), and fetching strictly declarative **JSON configuration / feature flags** validated against a local schema.
74
+
75
+ ## MV3 runtime, storage, PKCE OAuth, and Safari Web Extensions
76
+
77
+ - **Service-worker lifecycle**: MV3 service workers terminate after ~30 s idle. Register all top-level listeners synchronously on boot, replace `setTimeout`/`setInterval` with **`chrome.alarms`**, and keep ephemeral tokens in **`chrome.storage.session`**, durable device state in **`chrome.storage.local`**, and tiny synced prefs in **`chrome.storage.sync`** (`100 KB` total / `8 KB` per key).
78
+ - **OAuth 2.0 Authorization Code + PKCE (`S256`)**: extension bundles are inspectable public clients—**never embed a `client_secret`**. Generate a 32-byte cryptographic `code_verifier` + SHA-256 base64url `code_challenge`, launch `chrome.identity.launchWebAuthFlow({ url, interactive: true })`, exchange the authorization code with `code_verifier`, and hold short-lived access tokens in `chrome.storage.session`.
79
+ - **Offscreen documents (`chrome.offscreen`)**: create a single-purpose offscreen doc (`DOM_PARSER`, `CLIPBOARD`, `AUDIO_PLAYBACK`) only when needed and close it when idle.
80
+ - **`chrome.scripting` worlds (`ISOLATED` vs `MAIN`)**: keep UI and `chrome.*` calls in `ISOLATED`; inject into `MAIN` only for minimal read-only inspection via schema-validated `postMessage`.
81
+ - **Safari Web Extensions**: test both macOS and **iOS Safari** (`>= 44 pt` touch targets, bottom-sheet popups) and feature-detect `sidePanel` / `offscreen`.
17
82
 
18
83
  ## Permissions UX
19
84
 
20
- - Prefer `activeTab`/user invocation over broad `<all_urls>` host access when the task allows.
21
- - Explain optional permissions at the moment of need; provide visible denied/skipped behavior.
22
- - Version sensitive behavior in onboarding/release notes; trust erosion is a UX defect.
23
- - Site access controls differ by browser; test Chromium and Firefox/mobile support honestly rather than claiming parity.
85
+ Prefer `activeTab` and `optional_host_permissions` over blanket `<all_urls>`. Request optional permissions via `chrome.permissions.request()` synchronously inside the user gesture that needs them, explain why in plain language, and render a calm degraded state if denied.
86
+
87
+ ## Do/don't pairs
24
88
 
25
- ## State/lifecycle
89
+ | Do | Don't |
90
+ |---|---|
91
+ | Bundle 100% of JS locally (`script-src 'self'`) and fetch only validated JSON | Load `<script src="https://cdn...">`, `eval()`, `new Function()`, or remote JS strings (CWS #1 rejection) |
92
+ | Convert `rem` to `px` and call `e.stopPropagation()` on `keydown`/`keyup`/`keypress` in Shadow DOM | Let typing inside an extension input trigger YouTube `k`/`f` or GitHub `/` shortcuts, or shrink on `font-size: 62.5%` |
93
+ | Authenticate via **OAuth 2.0 + PKCE (`S256`)** + `chrome.storage.session` with zero `client_secret` | Ship hardcoded OAuth `client_secret` or API keys inside extension source bundles |
94
+ | Use `chrome.alarms` + `chrome.storage.{session,local}` and synchronous `chrome.sidePanel.open()` | Store state in global service-worker RAM or `await` before `chrome.sidePanel.open()` |
95
+ | Scope `activeTab` + `optional_host_permissions` and handle denial gracefully | Request `<all_urls>` on install for a single-domain utility |
26
96
 
27
- Popup closure is not logout/submission. Persist state through extension storage/message passing deliberately. Service workers are event-driven and can restart; no hidden dependence on in-memory timers/state. Tab navigation/reload/frame changes must not duplicate injected UI.
97
+ ## Verification commands
28
98
 
29
- ## Verification
99
+ ```sh
100
+ npx wxt build
101
+ npx wxt build -b firefox
102
+ npx playwright test
103
+ ```
30
104
 
31
- Test minimum popup width/height, side-panel resizing, zoom/text scaling, dark/light host theme, keyboard focus trap/escape, screen-reader names, content-script Shadow DOM isolation, denied permission, service-worker restart, extension update/reload, target-page navigation, CSP errors, and browser differences.
105
+ Inspect the built `.zip` / `manifest.json` for zero remote script URLs, `eval`, or `<all_urls>` (`static`), then load the unpacked extension in Chrome, Firefox, and Safari to verify Shadow DOM `rem` + `keydown` shortcut isolation on GitHub/YouTube, PKCE sign-in, service-worker sleep/wake, and denied permissions (`rendered`).
@@ -1,23 +1,106 @@
1
- # Figma plugins and Office add-ins
1
+ # Figma plugins/widgets and Office add-ins
2
2
 
3
3
  ## Figma plugins
4
4
 
5
- `figma.showUI(html, options)` creates an iframe-based modal/plugin UI. Relevant verified constraints: `visible` controls initial visibility, `width` defaults to 300 with a documented minimum around 70, and `figma.ui.resize(width, height)` can change dimensions later. Treat the iframe and sandbox/plugin controller as separate trusted boundaries; validate messages in both directions.
5
+ Figma plugins split execution between a **main sandbox thread** (accessing the Figma document API, no browser DOM) and an optional **UI iframe** (`null` origin, no cookies or `localStorage`).
6
6
 
7
- - Match Figma density, keyboard behavior, selection context, dark/light theme signals where exposed, and small-panel constraints.
8
- - Make object selection/state explicit: nothing selected, unsupported mixed selection, missing permission/component/document change.
9
- - Long operations need progress/cancellation because plugin execution is tied to document/user context.
10
- - Do not mutate the canvas without clear user intent; destructive/bulk operations need scope preview and undo expectations.
7
+ - **Theme adaptation**: Pass `{ themeColors: true }` to `figma.showUI(...)` and style with Figma's native CSS custom properties (`--figma-color-bg`, `--figma-color-bg-secondary`, `--figma-color-text`, `--figma-color-border`, `--figma-color-bg-brand`, `--figma-color-text-onbrand`) so the plugin adapts automatically to Figma light and dark themes.
8
+ - **Mandatory dynamic page access**: Declare `"documentAccess": "dynamic-page"` in `manifest.json` and use **async** page/node APIs (`await figma.getNodeByIdAsync(id)`, `await figma.loadAllPagesAsync()`, `await figma.currentPage.loadAsync()`) instead of deprecated sync APIs.
9
+ - **Network & storage boundaries**: Declare exact hosts in `manifest.json` `networkAccess.allowedDomains` (use `["none"]` if offline). Store persistent settings in `figma.clientStorage.getAsync/setAsync` rather than browser `localStorage` (which throws in the `null`-origin iframe). Validate every `postMessage` payload shape in both directions.
10
+ - **Dev Mode & Code Connect**: For inspect/code-generation workflows, add `"dev"` to `editorType`, branch on `figma.mode === 'inspect'` or `figma.codegen.on('generate', ...)`, and use `@figma/code-connect` when mapping design-system components directly to repository code.
11
11
 
12
- ## Office add-ins/task panes
12
+ ```ts
13
+ // Figma plugin main controller (code.ts) — dynamic-page async safe
14
+ figma.showUI(__html__, { width: 320, height: 420, themeColors: true });
13
15
 
14
- Office task panes are embedded web applications running beside host documents. Use host-appropriate Fluent/platform conventions, theme tokens, responsive narrow widths, keyboard/focus behavior, and documented authentication/SSO/consent flows. Respect document-centric state: selection changes, file switching, coauthoring, offline mode, permission expiry, and host/version differences across Windows/Mac/web/mobile.
16
+ figma.ui.onmessage = async (msg: unknown) => {
17
+ if (!msg || typeof msg !== 'object' || !('type' in msg)) return;
18
+ if (msg.type === 'inspect-selection') {
19
+ const selection = figma.currentPage.selection;
20
+ if (selection.length === 0) {
21
+ figma.ui.postMessage({ type: 'empty', reason: 'Select at least one layer.' });
22
+ return;
23
+ }
24
+ const items = await Promise.all(
25
+ selection.map(async (node) => ({ id: node.id, name: node.name, kind: node.type })),
26
+ );
27
+ figma.ui.postMessage({ type: 'selection', items });
28
+ }
29
+ };
30
+ ```
15
31
 
16
- - Validate Office runtime APIs before use; label host/version fallback honestly.
17
- - Never silently write into the document; preview insertion/range/format side effects.
18
- - Preserve task-pane state through resize/hide/show without pretending it is persistent storage.
19
- - Handle network, permission, expired token, unsupported host, and malformed document state as first-class UX.
32
+ ## Figma widgets (multiplayer canvas objects)
20
33
 
21
- ## Verification
34
+ Use a **Figma Widget** (`figma.widget`) when the UI belongs **directly on the FigJam or Figma canvas** shared synchronously across all collaborators (voting boards, status cards, sprint checklists, live embeds), rather than a single-user floating plugin modal:
22
35
 
23
- Test narrow/minimum width, resize, host dark/light theme, keyboard/screen reader, message spoofing/shape mismatch, permission denial, missing selection/document, long localized labels, offline/network interruption, update/reload lifecycle, and actual host versions rather than only browser-hosted UI.
36
+ - Build UI declaratively with `figma.widget` primitives (`AutoLayout`, `Text`, `Input`, `SVG`, `Frame`), store shared multiplayer state in **`useSyncedState`** and **`useSyncedMap`** (never module globals!), expose toolbar controls with **`usePropertyMenu`**, and wrap async work or temporary helper iframes in **`waitForTask(...)`**.
37
+
38
+ ```tsx
39
+ const { widget } = figma;
40
+ const { AutoLayout, Text, useSyncedState, usePropertyMenu } = widget;
41
+
42
+ function DecisionCard() {
43
+ const [status, setStatus] = useSyncedState<'Open' | 'Approved'>('status', 'Open');
44
+ const [votes, setVotes] = useSyncedState<number>('votes', 0);
45
+
46
+ usePropertyMenu(
47
+ [{ itemType: 'action', propertyName: 'toggle', tooltip: 'Toggle status' }],
48
+ ({ propertyName }) => {
49
+ if (propertyName === 'toggle') setStatus(status === 'Open' ? 'Approved' : 'Open');
50
+ },
51
+ );
52
+
53
+ return (
54
+ <AutoLayout direction="vertical" spacing={8} padding={16} cornerRadius={8} fill="#FFFFFF" stroke="#D4D4D8">
55
+ <Text fontSize={14} fontWeight={600}>Status: {status}</Text>
56
+ <AutoLayout padding={{ vertical: 6, horizontal: 10 }} cornerRadius={6} fill="#0074CA" onClick={() => setVotes(votes + 1)}>
57
+ <Text fill="#FFFFFF" fontSize={12}>Upvote ({votes})</Text>
58
+ </AutoLayout>
59
+ </AutoLayout>
60
+ );
61
+ }
62
+ widget.register(DecisionCard);
63
+ ```
64
+
65
+ ## Microsoft Office add-ins (Word, Excel, PowerPoint, Outlook)
66
+
67
+ - **Unified Manifest for Microsoft 365**: Prefer the **Unified Manifest (`manifest.json`)** for new M365 add-ins targeting Outlook, Teams, M365 Copilot, and supported Office hosts (use legacy XML manifest only where older desktop Office versions require it).
68
+ - **Host lifecycle & Requirement Sets**: Wrap initialization in `Office.onReady()`, always verify API support via `Office.context.requirements.isSetSupported('ExcelApi', '1.14')` before calling newer APIs, and batch reads/writes cleanly around `await context.sync()` (avoid calling `context.sync()` inside loops!).
69
+ - **Fluent UI v9 & host theme**: Use **`@fluentui/react-components`** (`FluentProvider`) adapted to `Office.context.officeTheme` (`bodyBackgroundColor`, `bodyForegroundColor`) inside narrow resizable task panes (320 px default width).
70
+ - **Mandatory OAuth dialog**: Never run third-party OAuth inside the task-pane iframe (blocked by `X-Frame-Options` and third-party cookie restrictions). Always launch **`Office.context.ui.displayDialogAsync(authUrl, { height: 60, width: 35 })`** and receive results via `DialogMessageReceived` (or use **Nested App Authentication (NAA)** for Microsoft Entra ID SSO).
71
+
72
+ ```ts
73
+ // Office Excel add-in: Office.onReady + Requirement Set guard + batched context.sync()
74
+ Office.onReady(async (info) => {
75
+ if (info.host !== Office.HostType.Excel) return;
76
+ if (!Office.context.requirements.isSetSupported('ExcelApi', '1.14')) {
77
+ renderUnsupportedHostNotice('Requires Excel API 1.14 or newer.');
78
+ return;
79
+ }
80
+ await Excel.run(async (context) => {
81
+ const range = context.workbook.getSelectedRange();
82
+ range.load(['address', 'values']);
83
+ await context.sync();
84
+ renderSelectionPreview(range.address, range.values);
85
+ });
86
+ });
87
+ ```
88
+
89
+ ## Do/don't pairs
90
+
91
+ | Do | Don't |
92
+ |---|---|
93
+ | `figma.showUI(__html__, { themeColors: true })` + `--figma-color-*` | Hardcode white plugin backgrounds that blind users in Figma dark mode |
94
+ | `"documentAccess": "dynamic-page"` + async `getNodeByIdAsync` | Call deprecated sync `figma.getNodeById` / `root.findAll` |
95
+ | `figma.clientStorage` in Figma plugins & `useSyncedState` in Widgets | Call `window.localStorage` inside a `null`-origin Figma plugin iframe |
96
+ | `Office.context.ui.displayDialogAsync` (or NAA) for Office OAuth | Redirect the Office task-pane iframe directly to an IdP login page |
97
+ | Check `isSetSupported(...)` and batch operations before `context.sync()` | Call `await context.sync()` inside a 500-row loop |
98
+
99
+ ## Verification commands
100
+
101
+ ```sh
102
+ npm run build
103
+ npx office-addin-manifest validate manifest.json
104
+ ```
105
+
106
+ Build and manifest validation are `static` evidence. Test Figma plugins/widgets inside real Figma Desktop + Browser (light/dark, empty selection, mixed selection, dynamic multi-page docs) and Office add-ins across Windows, macOS, and Office on the Web task panes (`rendered` evidence).
@@ -0,0 +1,125 @@
1
+ # IDE and SaaS platform plugins (JetBrains, Obsidian, Shopify, Atlassian Forge, Notion, Linear)
2
+
3
+ Use this reference when building embedded UI inside **JetBrains IDEs**, **Obsidian**, **Shopify Admin**, **Atlassian Jira/Confluence (Forge)**, **Notion**, or **Linear**. Each host enforces distinct threading, theming, sandboxing, and auth boundaries.
4
+
5
+ ## Host platform matrix
6
+
7
+ | Host | Primary UI layer | Escape hatch | Critical runtime constraint |
8
+ |---|---|---|---|
9
+ | **JetBrains Platform** | **Kotlin UI DSL v2** (Swing) or **Jewel** (Compose Desktop matching IntelliJ New UI) | **JCEF** (`JBCefBrowser` embedded Chromium) | **Never block the EDT** (Event Dispatch Thread); run I/O & PSI reads in coroutines/background actions |
10
+ | **Obsidian** | `ItemView`, `Modal`, `SuggestModal`, `PluginSettingTab`, **CodeMirror 6** extensions | Custom DOM inside view/leaf | **Mobile parity** (iOS/Android)—no Node `fs`/`child_process`; style strictly with Obsidian CSS vars |
11
+ | **Shopify Admin** | **App Bridge v4** + **Polaris Web Components** (`<ui-nav-menu>`, `<ui-save-bar>`, `<s-page>`) | Sandboxed embedded iframe | **Session Tokens (JWT)** via `shopify.idToken()`—never rely on third-party cookies |
12
+ | **Atlassian Forge** | **UI Kit 2 (`@forge/react`)** rendered natively in Jira/Confluence | **Custom UI** (sandboxed iframe + `@forge/bridge`) | Strict `manifest.yml` scopes & outbound egress allowlist; zero unapproved network calls |
13
+ | **Notion / Linear** | Native Link Previews / Attachments / OAuth workflows + external companion apps | Deep-linked web UI | Rate limits, explicit OAuth resource sharing, and idempotent webhook sync |
14
+
15
+ ## JetBrains Platform plugins (IntelliJ, PyCharm, WebStorm, Android Studio)
16
+
17
+ - Prefer **Kotlin UI DSL v2** (`com.intellij.ui.dsl.builder.panel`) for settings (`Configurable`) and dialogs, or **Jewel** (`org.jetbrains.jewel`) when building rich modern Compose-based tool windows that natively match IntelliJ's New UI light/dark/high-contrast themes. Reserve **JCEF (`JBCefBrowser`)** strictly for rich web content that native components cannot express (verify JCEF availability via `JBCefApp.isSupported()`).
18
+ - **EDT vs Coroutine threading**: Running disk I/O, HTTP calls, or heavy PSI/VFS scans on the Event Dispatch Thread freezes the entire IDE and triggers IntelliJ freeze reports. Run compute/network on coroutine dispatchers and switch back to `Dispatchers.EDT` solely to update UI models.
19
+
20
+ ```kotlin
21
+ // Kotlin UI DSL v2 settings panel (never perform blocking I/O on EDT)
22
+ import com.intellij.openapi.options.BoundConfigurable
23
+ import com.intellij.ui.dsl.builder.bindSelected
24
+ import com.intellij.ui.dsl.builder.bindText
25
+ import com.intellij.ui.dsl.builder.panel
26
+
27
+ class OpsPluginConfigurable(private val state: OpsPluginState) : BoundConfigurable("Ops Monitor") {
28
+ override fun createPanel() = panel {
29
+ group("Connection") {
30
+ row("Endpoint URL:") {
31
+ textField()
32
+ .bindText(state::endpointUrl)
33
+ .validationOnApply { if (!it.text.startsWith("https://")) error("Use an HTTPS endpoint.") else null }
34
+ }
35
+ row {
36
+ checkBox("Sync alerts automatically").bindSelected(state::autoSync)
37
+ }
38
+ }
39
+ }
40
+ }
41
+ ```
42
+
43
+ ## Obsidian plugins
44
+
45
+ - Use native Obsidian classes: **`ItemView`** (dockable sidebar/tab panes), **`Modal`** and **`SuggestModal<T>`** (keyboard-driven command pickers matching Quick Switcher), **`PluginSettingTab`** (`new Setting(containerEl)`), and **`registerEditorExtension(...)`** for live **CodeMirror 6** editor decorations/widgets.
46
+ - Always consume Obsidian CSS custom properties (`--background-primary`, `--background-secondary`, `--background-modifier-border`, `--text-normal`, `--text-muted`, `--interactive-accent`, `--text-on-accent`) so community themes and light/dark switching work without visual breakage.
47
+ - **Mobile parity**: Unless strictly desktop-only (`"isDesktopOnly": true` in `manifest.json`), avoid Node `fs`, `path`, `child_process`, or Electron APIs—use `this.app.vault`, `this.app.vault.adapter`, and Obsidian's built-in `requestUrl()` (which bypasses browser CORS safely on desktop and mobile).
48
+
49
+ ```ts
50
+ import { App, SuggestModal } from 'obsidian';
51
+
52
+ export class QuickNotePicker extends SuggestModal<{ path: string; title: string }> {
53
+ constructor(app: App, private readonly items: { path: string; title: string }[], private readonly onPick: (path: string) => void) {
54
+ super(app);
55
+ this.setPlaceholder('Jump to project note…');
56
+ }
57
+ getSuggestions(query: string) {
58
+ const q = query.toLowerCase();
59
+ return this.items.filter((i) => i.title.toLowerCase().includes(q));
60
+ }
61
+ renderSuggestion(item: { path: string; title: string }, el: HTMLElement) {
62
+ el.createEl('div', { text: item.title });
63
+ el.createEl('small', { text: item.path, cls: 'u-muted' });
64
+ }
65
+ onChooseSuggestion(item: { path: string; title: string }) {
66
+ this.onPick(item.path);
67
+ }
68
+ }
69
+ ```
70
+
71
+ ## Shopify Embedded Apps (App Bridge v4 + Polaris)
72
+
73
+ - Load **App Bridge v4** via `<meta name="shopify-api-key" content="..." />` and `<script src="https://cdn.shopify.com/shopifycloud/app-bridge.js"></script>` first in `<head>`.
74
+ - Adopt **Polaris Web Components** (`<s-page>`, `<s-section>`, `<s-button>`) alongside App Bridge native chrome elements (**`<ui-nav-menu>`**, **`<ui-save-bar>`**, **`<ui-title-bar>`**, **`<ui-modal>`**) so navigation, dirty-form save bars, and modals render seamlessly in Shopify Admin chrome across desktop and mobile.
75
+ - Authenticate every backend API call with **Session Tokens** (`const token = await shopify.idToken()` sent in `Authorization: Bearer <token>`)—never depend on third-party cookies inside the Admin iframe.
76
+
77
+ ```html
78
+ <ui-nav-menu>
79
+ <a href="/" rel="home">Overview</a>
80
+ <a href="/rules">Discount Rules</a>
81
+ </ui-nav-menu>
82
+
83
+ <ui-save-bar id="rule-save-bar">
84
+ <button variant="primary" id="save-btn">Save</button>
85
+ <button id="discard-btn">Discard</button>
86
+ </ui-save-bar>
87
+ ```
88
+
89
+ ## Atlassian Forge (Jira & Confluence)
90
+
91
+ - **Choose UI Kit 2 (`@forge/react`) first**: Components render directly in Atlassian's host React tree using the official Atlassian Design System (zero iframe loading flash, automatic dark/light theme parity, strict security).
92
+ - Drop to **Custom UI** (sandboxed static iframe + `@forge/bridge` `invoke()` / `view.theme.enable()`) only when you require custom canvas/SVG visuals or rich third-party editors; explicitly declare every external API domain in `manifest.yml` `permissions.external.fetch.backend` / `client` and keep resolvers idempotent.
93
+
94
+ ## Notion and Linear integrations
95
+
96
+ - **Notion**: Design around Link Previews (unfurl API), OAuth public integrations, and block/database sync. Handle the common empty state where a user installed the integration without sharing any pages/databases to it, respect API rate limits (~3 req/s average with `Retry-After` backoff), and surface sync errors clearly without overwriting user-edited blocks.
97
+ - **Linear**: Use Linear's GraphQL API, OAuth2 (`PKCE S256` for public desktop/IDE clients), Webhooks, and **Issue Attachments** (rich status cards linked to external PRs/incidents/deployments) rather than posting noisy duplicate comments on every webhook event. Handle workspace-scoped permissions and expired webhook/token states cleanly.
98
+ - **Credential storage across IDEs**: never ship an OAuth `client_secret` inside distributed JetBrains `.zip` or Obsidian community plugin bundles, and never write tokens to plaintext XML/JSON config files—store tokens in JetBrains **`PasswordSafe.instance`** or Obsidian `SecretStorage` / OS Keychain.
99
+
100
+ ## Do/don't pairs
101
+
102
+ | Do | Don't |
103
+ |---|---|
104
+ | Run JetBrains I/O & PSI reads in coroutines off the EDT and store tokens in `PasswordSafe` | Block the Swing/EDT thread or write OAuth tokens/client secrets into plaintext IDE XML |
105
+ | Style Obsidian views with `--background-primary` / `--interactive-accent` and `requestUrl()` | Hardcode hex colors or import Node `fs` in a mobile-enabled Obsidian plugin |
106
+ | Use Shopify App Bridge v4 `<ui-save-bar>` + `shopify.idToken()` Bearer JWTs | Rely on third-party session cookies inside the Shopify Admin iframe |
107
+ | Default to Atlassian Forge UI Kit 2 (`@forge/react`) before Custom UI | Spin up heavy Custom UI iframes for simple Jira issue panels |
108
+ | Authenticate IDE/desktop plugins via **OAuth 2.0 + PKCE (`S256`)** and surface Notion/Linear scopes cleanly | Embed `client_secret` in client bundles or spam Linear issue comment feeds on every poll |
109
+
110
+ ## Verification commands
111
+
112
+ ```sh
113
+ # JetBrains Plugin (Gradle)
114
+ ./gradlew verifyPlugin
115
+ ./gradlew runIde
116
+
117
+ # Obsidian Plugin
118
+ npm run build
119
+
120
+ # Atlassian Forge
121
+ forge lint
122
+ forge tunnel
123
+ ```
124
+
125
+ `verifyPlugin`, `forge lint`, and `npm run build` provide `static` evidence. Inspect live host rendering across light/dark/high-contrast themes, narrow tool windows or mobile panes, offline/permission-denied states, and real host sandboxes for `rendered` evidence.
@@ -1,19 +1,98 @@
1
1
  # Raycast extensions
2
2
 
3
- Raycast renders a React declaration into native launcher UI. The API is a design system, not arbitrary HTML/CSS: use `List`, `Grid`, `Detail`, `Form`, and `ActionPanel` rather than fighting the host.
3
+ Raycast compiles React declarations (`@raycast/api`) into **native launcher UI** (AppKit on macOS, native controls on Windows). Treat the API as a strict native design system—compose `List`, `Grid`, `Detail`, `Form`, `ActionPanel`, and `MenuBarExtra` rather than fighting the host with custom layout hacks.
4
4
 
5
- ## Idioms
5
+ ## Core components, `@raycast/utils`, and ActionPanel ergonomics
6
6
 
7
- - Render quickly; use `isLoading` on top-level components while data loads.
8
- - Choose List for dense repeated items, Grid for visual artifacts, Detail for inspection, Form for creation/input.
9
- - Put contextual operations in `ActionPanel` and group them in semantic sections. Primary/secondary action order matters because default keyboard shortcuts derive from it.
10
- - Keyboard-first means every essential operation has an action/shortcut; do not rely on hover or visual-only affordances.
11
- - Use accessories, icons, subtitles, keywords, filtering, sections, and empty views to communicate structure instead of custom layout.
7
+ - Prefer **`@raycast/utils`** hooks (`useCachedPromise`, `usePromise`, `useFetch`, `useForm`) so commands paint immediately from cache while revalidating, cancel stale async requests automatically, and format validation errors cleanly.
8
+ - Put the single highest-frequency action first inside `ActionPanel` (it automatically maps to `Enter`; the second action maps to `Cmd+Enter` / `Ctrl+Enter`), and group destructive actions in a bottom `ActionPanel.Section` with `Action.Style.Destructive` and `confirmAlert(...)`.
12
9
 
13
- ## UX constraints
10
+ ```tsx
11
+ import { Action, ActionPanel, Icon, List, Toast, confirmAlert, getPreferenceValues, showToast } from '@raycast/api';
12
+ import { useCachedPromise } from '@raycast/utils';
13
+ import { useState } from 'react';
14
14
 
15
- Launcher commands are brief and interruptible. Preserve query/filter state where expected, make errors retryable, use toast/alert appropriate to severity, and cache only with explicit staleness semantics. Authentication/preferences need clear setup and recovery; secrets belong in supported preference/storage mechanisms, not copied into plaintext UI.
15
+ interface Preferences {
16
+ apiToken: string; // declared with "type": "password" in package.json
17
+ }
16
18
 
17
- ## Verification
19
+ export default function SearchIssuesCommand() {
20
+ const { apiToken } = getPreferenceValues<Preferences>();
21
+ const [query, setQuery] = useState('');
18
22
 
19
- Test empty/loading/error/offline/permission states, long titles/subtitles, dynamic filtering, keyboard-only invocation of every action, shortcut conflicts, theme/icon readability, large result sets, cancellation of stale requests, and behavior when the command is repeatedly launched or the item selection changes during async work.
23
+ const { data = [], isLoading, error, revalidate } = useCachedPromise(
24
+ async (q: string) => fetchIssues(apiToken, q),
25
+ [query],
26
+ { keepPreviousData: true, onError: (err) => showToast({ style: Toast.Style.Failure, title: 'Search failed', message: err.message }) },
27
+ );
28
+
29
+ return (
30
+ <List isLoading={isLoading} onSearchTextChange={setQuery} searchBarPlaceholder="Filter issues…" throttle>
31
+ {error && <List.EmptyView icon={Icon.ExclamationMark} title="Could not load issues" description={error.message} />}
32
+ {!error && data.length === 0 && (
33
+ <List.EmptyView icon={Icon.MagnifyingGlass} title="No matching issues" description="Try another search term or clear filters." />
34
+ )}
35
+ {data.map((issue) => (
36
+ <List.Item
37
+ key={issue.id}
38
+ title={issue.title}
39
+ subtitle={issue.key}
40
+ accessories={[{ tag: issue.status }]}
41
+ actions={
42
+ <ActionPanel>
43
+ <Action.OpenInBrowser url={issue.url} />
44
+ <Action.CopyToClipboard title="Copy Issue Key" content={issue.key} />
45
+ <ActionPanel.Section>
46
+ <Action
47
+ title="Archive Issue"
48
+ icon={Icon.Trash}
49
+ style={Action.Style.Destructive}
50
+ onAction={async () => {
51
+ if (await confirmAlert({ title: `Archive ${issue.key}?` })) {
52
+ await archiveIssue(apiToken, issue.id);
53
+ revalidate();
54
+ }
55
+ }}
56
+ />
57
+ </ActionPanel.Section>
58
+ </ActionPanel>
59
+ }
60
+ />
61
+ ))}
62
+ </List>
63
+ );
64
+ }
65
+ ```
66
+
67
+ ## `MenuBarExtra`, no-view commands, storage, and AI Extensions/Tools
68
+
69
+ | Capability | API / manifest idiom | Concrete rule |
70
+ |---|---|---|
71
+ | **Menu bar item** | `<MenuBarExtra icon={...} title={...} isLoading={...}>` + `"interval": "5m"` | Keep refreshes lightweight and avoid launching noisy popups on background polls; show explicit error state inside the menu. |
72
+ | **No-view commands** | `"mode": "no-view"` in `package.json` | Perform instant single-shot tasks (toggle setting, copy formatted link) and close cleanly with `showHUD("Copied URL")` or `showToast(...)` on failure. |
73
+ | **Storage & secrets** | `getPreferenceValues()` (`"type": "password"`), `Cache`, `LocalStorage` | Store secrets only in password preferences or OAuth (`OAuth.PKCEClient`), use synchronous `Cache` for instant UI hydration, and async `LocalStorage` for durable per-device records. |
74
+ | **Raycast AI Extensions & Tools** | `AI.ask(...)`, `environment.canAccess(AI)`, `src/tools/*.ts` | Guard `AI.ask()` with `environment.canAccess(AI)` (Pro feature) and provide a graceful fallback. For **AI Tools** invoked by Raycast AI Chat / Quick AI, export a clear default function + `confirmation` callback for any mutating/external tool so users approve side effects before execution. |
75
+
76
+ ## Cross-platform parity (macOS and Windows)
77
+
78
+ Raycast runs on both **macOS and Windows**. Unless your extension genuinely depends on macOS-only frameworks (`osascript`, AppleScript, `~/Library`, Spotlight), keep paths cross-platform (`os.homedir()`, `path.join`), avoid hardcoding `Cmd` in copy text (Raycast maps shortcut labels automatically), and set `"platforms": ["macOS", "Windows"]` (or `["macOS"]` explicitly when Apple-only) in `package.json`.
79
+
80
+ ## Do/don't pairs
81
+
82
+ | Do | Don't |
83
+ |---|---|
84
+ | `useCachedPromise` + `throttle` on live search lists | Fire unthrottled fetches on every keystroke with blank flicker |
85
+ | Guard `AI.ask` with `environment.canAccess(AI)` and confirm mutating AI Tools | Crash non-Pro users or auto-delete records from an AI tool call |
86
+ | Store tokens in `password` preferences or `OAuth.PKCEClient` | Render API keys in plaintext `Form.TextField` or `Cache` |
87
+ | Declare `"platforms"` honestly and guard macOS-only shell commands | Invoke `osascript` unconditionally in a cross-platform extension |
88
+ | Group destructive actions at bottom of `ActionPanel` with `confirmAlert` | Put Delete as the first `Enter` action on a list row |
89
+
90
+ ## Verification commands
91
+
92
+ ```sh
93
+ npm run lint
94
+ npm run build
95
+ npm run dev
96
+ ```
97
+
98
+ `npm run lint` and `npm run build` provide `static` evidence (manifest schema, TypeScript, Raycast ESLint rules). Launch inside Raycast (`npm run dev`) to verify fast paint, empty/error states, keyboard-only `ActionPanel` flow, dark/light icon contrast, `MenuBarExtra` updates, and Windows/macOS parity (`rendered` evidence).