@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,76 @@
1
+ ---
2
+ name: pixelcraft-tui
3
+ description: Translates Pixelcraft direction, tokens, UX, and floor requirements into terminal user interfaces across Textual, Rich, Ink, Bubble Tea v2/Lip Gloss, Ratatui, Terminal.Gui, Spectre.Console, prompt_toolkit, OpenTUI, FTXUI, and Clack/CLI prompts. Use for keyboard-first CLI apps, dashboards, installers, logs, forms, character-grid layout, Kitty/Sixel/OSC 8/DEC 2026 terminal protocols, NO_COLOR fallback, resizing, snapshots, accessibility, and state feedback.
4
+ license: MIT
5
+ metadata:
6
+ version: 0.1.0
7
+ ---
8
+
9
+ # Pixelcraft TUI
10
+
11
+ Use this skill when the rendering surface is a terminal character grid. Terminal constraints are design constraints, not an excuse for unstructured text output.
12
+
13
+ ## Surface craft
14
+
15
+ Give repeated keyboard work stable regions: list or prompt, result, status and a short reversible help layer. Preserve task progress through terminal resize; keep a text marker when terminal colors or Unicode are limited. Check the smallest supported columns/rows after switching panes, with no mouse and in a low-capability terminal.
16
+
17
+ ## Detection signals
18
+
19
+ Python `textual`/`rich`/`prompt_toolkit`/`questionary`, Node/Bun `ink`/`@inkjs/ui`/`@opentui/*`/`@clack/prompts`/`@inquirer/prompts`, Go `bubbletea`/`lipgloss`/`huh`/`tcell`/`tview`, Rust `ratatui`/`crossterm`/`cliclack`/`inquire`/`dialoguer`, .NET `Terminal.Gui`/`Spectre.Console`, C++ `ftxui`/`notcurses`, alternate-screen/raw-mode setup, keybinding tables, snapshot tests, and terminal capability handling.
20
+
21
+ ## Translate direction to terminal idioms
22
+
23
+ 1. Treat cells/rows/columns as the layout system. Establish alignment, scanlines, density, focus, and rhythm explicitly.
24
+ 2. Map tokens to semantic styles supported by the framework; do not assume truecolor, Unicode width, mouse support, or persistent screen size.
25
+ 3. Keyboard-first means every task has discoverable keys, focus/order, escape/cancel behavior, help, and no hidden mouse-only path.
26
+ 4. Use color as enhancement; meaning must survive 16-color, monochrome, low contrast, `TERM=dumb`, and `NO_COLOR` environments.
27
+ 5. Unicode box glyphs/braille/sparklines/graphics protocols need fallback glyphs or plain-text degradation because terminal and `tmux` support varies.
28
+ 6. Design resize behavior: minimum dimensions (`80×24`), truncation/wrapping, pane priority, scrollback vs alternate screen, and terminal reflow.
29
+
30
+ ## Platform-wide rules
31
+
32
+ - **Startup latency & flicker-free live resize**: hit **`< 200 ms` cold startup latency** (measured with `hyperfine` or `time`) for compact CLIs/TUIs, and verify **flicker-free live resize** across **`80×24`** (minimum floor) and **`120×36`** (standard workspace) using DEC Mode `2026` synchronized output where supported.
33
+ - **Grapheme-cluster width (`UAX #29`) & `--ascii` fallback**: **never** measure column width with `.length`, `.len()`, or UTF-16 code units! Compute **`UAX #29` grapheme-cluster + East Asian Width** (`unicode-width` + `unicode-segmentation` in Rust, `uniseg`/`go-runewidth` in Go, `Intl.Segmenter` + `string-width` in Node, `wcwidth`/`rich.cells` in Python) so **CJK (`2` cols), ZWJ Emoji (`👨‍👩‍👧‍👦` = `2` cols), `VS16` (`⚠️` = `2` cols), and Vietnamese combining diacritics (`0` extra cols)** never corrupt box borders; degrade to `--ascii` / `+--+` glyphs when `TERM=dumb` or locale is non-UTF-8.
34
+ - **`DECSET 2004` Bracketed Paste & `OSC 52` clipboard**: enable Bracketed Paste (`\x1b[?2004h` … `\x1b[?2004l`) on interactive inputs so multi-line pastes never fire each newline as an accidental `Enter` confirmation; support **`OSC 52`** escape sequences for copying over remote SSH/`tmux` sessions alongside local OS clipboards.
35
+ - **Stream hygiene, `SIGPIPE`, color tiers & `--plain` screen-reader mode**: send interactive TUI chrome, spinners, and progress bars to `stderr` (or alternate screen only when `isatty(stdout)`); write machine-parseable output (`--json`, `--plain`) strictly to `stdout`; handle **`SIGPIPE` / `EPIPE` / `BrokenPipeError`** (`| head -n 5` / `| jq`) silently without stack traces; and verify **`16-color` (dark + light ANSI)**, **`256-color`**, **`NO_COLOR=1`**, `TERM=dumb`, `CI=true`, and a **`--plain` screen-reader non-animated mode** (linear line-by-line output with zero cursor-rewriting spinners).
36
+ - **6-step panic & signal terminal restoration**: on normal exit, `SIGINT`, `SIGTERM`, `SIGHUP`, and uncaught panics/exceptions, execute all 6 teardown steps in order: **(1)** leave alternate screen `?1049l`, **(2)** disable mouse tracking `?1000l/?1002l/?1003l/?1006l`, **(3)** disable bracketed paste `?2004l`, **(4)** disable synchronized output `?2026l` (and clear `OSC 9;4` progress), **(5)** pop Kitty keyboard flags `\x1b[<u`, **(6)** show cursor `?25h` & exit raw mode.
37
+ - **CLI distribution, `SHA-256` signatures & uninstall contract**: ship `--help`, `--version`, semantic exit codes (**`0`** ok, **`1`** runtime error, **`2`** usage error, **`130`** `SIGINT`), **shell completions (`bash`, `zsh`, `fish`, `pwsh`)**, a `man` page, Homebrew/Winget/Scoop/Cargo/npm binary packaging, **release `SHA-256` checksums/signatures**, and **explicit uninstall instructions** (cleaning binaries, completions, and config paths).
38
+
39
+ ## Anti-lazy-default & anti-slop guard
40
+
41
+ - **Reject raw `print()` / `console.log()` / manual ANSI escape spaghetti** (`\x1b[31m...`) when structured TUI/CLI libraries fit the language: **Rich** / **Textual** (Python), **Bubble Tea v2 + Lip Gloss v2 + Huh** (Go), **Ratatui** (Rust), **Ink** / **`@clack/prompts`** (Node/Bun), or **Spectre.Console** / **Terminal.Gui v2** (.NET).
42
+ - **Match buffer mode to task scope**: use inline CLI prompts/output for one-shot commands and reserve full-screen alternate-buffer TUIs for persistent interactive workspaces; reject decorative ASCII banners that crowd out real data at `80×24`.
43
+
44
+ ## Common TUI failures
45
+
46
+ - measuring columns with `.length`/`.len()` so CJK, ZWJ emoji (`👨‍👩‍👧‍👦`), `⚠️`, or Vietnamese diacritics break borders;
47
+ - `> 500 ms` sluggish startup, missing `--plain` non-animated screen-reader mode, or tearing on `80×24` ↔ `120×36` live resize;
48
+ - missing `?2004h` Bracketed Paste causing pasted multi-line configs to execute every line on `Enter`;
49
+ - crashing with `BrokenPipeError` / `EPIPE` / Rust `.unwrap()` panic when piped into `head -n 5`, or leaking spinner ANSI to `stdout`;
50
+ - hardcoded `#ffffff` text unreadable on light 16-color terminals, or color-only diffs invisible under `NO_COLOR=1`;
51
+ - incomplete panic/signal teardown leaving `?1049h`, mouse tracking `?1003h`, `?2026h`, or Kitty `CSI u` stuck in the user's shell;
52
+ - missing `--version`, completions, `man` page, `SHA-256` release checksums, uninstall instructions, or exiting `0` on failure.
53
+
54
+ ## Verification options
55
+
56
+ Passing a unit test without a rendered frame/buffer/recording is `static`, never `rendered` (**Rule #0.3**). Deliver `hyperfine`/`time` startup benchmarks (`< 200 ms`), **`asciinema` or Charm `VHS` terminal recordings**, framework snapshot tests (`Pilot`, `TestBackend`+`insta`, `Teatest`, `ink-testing-library`), and rendered checks across **`iTerm2` / `Terminal.app`, `Windows Terminal`, `GNOME Terminal`, `tmux`, and `SSH`** (`rendered`, labeling unavailable OS emulators `not-checked`).
57
+
58
+ ## Pre-submit checklist
59
+
60
+ - [ ] zero `TODO`s, placeholder stubs, dead keybindings, or raw hardcoded ANSI escape spaghetti;
61
+ - [ ] **`< 200 ms` startup latency** (`hyperfine`/`time`), **`UAX #29` grapheme width** (CJK `2`, ZWJ emoji `2`, `VS16` `2`, Vietnamese diacritics `0`), `--ascii` fallback, and **flicker-free `80×24` + `120×36` live resize** verified;
62
+ - [ ] `DECSET 2004` Bracketed Paste (`?2004h`…`?2004l`) and `OSC 52` SSH/`tmux` + local clipboard wired;
63
+ - [ ] `stderr`/`stdout` separation, silent `SIGPIPE`/`EPIPE`/`BrokenPipeError` exit (`| head -n 5`), **`16-color` (dark+light)**, **`256-color`**, **`NO_COLOR=1`**, `TERM=dumb`, `CI=true`, and **`--plain` screen-reader non-animated mode** verified;
64
+ - [ ] full 6-step terminal restoration (`?1049l`, mouse `?1000–1006l`, `?2004l`, `?2026l`, `\x1b[<u`, `?25h` + raw mode) verified on exit, `SIGINT`/`SIGTERM`/`SIGHUP`, and panic;
65
+ - [ ] `--help`, `--version`, `0/1/2/130` exit codes, `bash`/`zsh`/`fish`/`pwsh` completions, `man` page, **`SHA-256` release checksums/signatures + uninstall instructions**, and **`asciinema`/`VHS` + multi-terminal (`iTerm2`/`Terminal.app`, `Windows Terminal`, `GNOME Terminal`, `tmux`, `SSH`)** deliverables verified or labeled `not-checked`;
66
+ - [ ] **Checklist-Until-Passing Stop-Gate (`<HARD-GATE>`):** walk every checklist item above + run `slop-scan.mjs --fail-on p2`, `check-tui.mjs` (`--cols 80`, `--cols 120`, `NO_COLOR=1`), compiler/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`).
67
+
68
+ ## Framework routing
69
+
70
+ - Read [references/terminal-protocols.md](references/terminal-protocols.md) when implementing DEC Mode 2026 synchronized output, Kitty/Sixel/iTerm2 graphics fallbacks, OSC 8 hyperlinks, Kitty keyboard protocol (`CSI u`), OSC 52 clipboard, OSC 9;4 progress, or `NO_COLOR`/`TERM`/`isatty` capability handling.
71
+ - Read [references/textual.md](references/textual.md) when building Python Textual apps with `Theme`, TCSS cell units, `CommandPalette`, `@work(exclusive=True)`, and `Pilot`/SVG snapshots.
72
+ - Read [references/rich.md](references/rich.md) when building Python Rich CLI output, `Theme` consoles, `stderr` progress/live displays, or markup-safe logging.
73
+ - Read [references/ink.md](references/ink.md) when building Node/Bun Ink 5/6 (React 19) terminal UIs with `<Static>`, `useInput`, `useFocus`, `@inkjs/ui`, and `ink-testing-library`.
74
+ - Read [references/bubbletea-lipgloss.md](references/bubbletea-lipgloss.md) when building Go Bubble Tea v2 / Lip Gloss v2 TUIs or using the Charm ecosystem (Huh, Bubbles, Glamour, Gum, Fang, Teatest).
75
+ - Read [references/ratatui.md](references/ratatui.md) when building Rust Ratatui (`0.28–0.30+`) TUIs with `ratatui::run`/`init`+`restore`, `Constraint::Fill`/`Flex`, `ratatui-image`, and `TestBackend`+`insta`.
76
+ - Read [references/extended-tui-toolkits.md](references/extended-tui-toolkits.md) when building .NET `Terminal.Gui v2` or `Spectre.Console`, Python `prompt_toolkit`, `OpenTUI`, C++ `FTXUI`, `Notcurses`, Go `tcell`/`tview`, migrating off Blessed, or choosing inline CLI prompts (`@clack/prompts`, `@inquirer/prompts`, `questionary`, `cliclack`/`inquire`/`dialoguer`).
@@ -0,0 +1,79 @@
1
+ # Bubble Tea & Lip Gloss (Go / Charm ecosystem)
2
+
3
+ ## Bubble Tea v2 & Lip Gloss v2 idioms
4
+
5
+ Bubble Tea **v2** (alongside v1 in existing repos—check `go.mod` module path before editing) introduces major craft and performance upgrades:
6
+
7
+ - **Declarative `tea.View` struct (v2)**: `View()` returns a `tea.View` value (e.g., `tea.NewView(content)`) where `AltScreen`, `MouseMode`, `WindowTitle`, `ProgressBar` (OSC 9;4), and cursor position are declared directly from model state instead of imperative startup options or command toggles.
8
+ - **Cursed Renderer**: cell-level diffing renderer minimizing terminal writes and flicker on high-frequency updates.
9
+ - **Built-in Kitty Keyboard Protocol & `tea.KeyPressMsg`**: accurate disambiguation of `shift+enter`, `ctrl+i` vs `tab`, and release events while degrading gracefully on legacy terminals.
10
+ - **Lip Gloss v2**: built-in **`table`**, **`tree`**, and **`list`** subpackages, compositing **`Layer` / `Canvas`** for clean modal overlays over panes without corrupting background cells, and automatic color **downsampling** (TrueColor → ANSI 256 → ANSI 16 → ASCII/`NO_COLOR`) via color profile detection.
11
+
12
+ ```go
13
+ // Bubble Tea v2 declarative View() + semantic Lip Gloss styles:
14
+ type PcStyles struct {
15
+ Action lipgloss.Style
16
+ Error lipgloss.Style
17
+ Focus lipgloss.Style
18
+ }
19
+
20
+ func (m model) View() tea.View {
21
+ content := m.styles.Focus.Render("> "+m.selectedTitle()) + "\n" + m.helpView()
22
+ v := tea.NewView(content)
23
+ v.AltScreen = true
24
+ v.WindowTitle = "Invoices"
25
+ return v
26
+ }
27
+ ```
28
+
29
+ *(In Bubble Tea v1 repos, `View() string` returns the string directly and `tea.WithAltScreen()` is passed to `tea.NewProgram`.)*
30
+
31
+ ## Broader Charm ecosystem decision table
32
+
33
+ Reuse first-party Charm libraries instead of reimplementing terminal primitives from scratch:
34
+
35
+ | Library | Role | When to use |
36
+ |---|---|---|
37
+ | **Bubbles** | Core widgets (`textinput`, `textarea`, `viewport`, `table`, `list`, `progress`, `spinner`, `help`, `key`) | Standard interactive controls inside Bubble Tea apps with built-in keymaps |
38
+ | **Huh** | Interactive CLI forms & multi-step wizards (`huh.NewForm`) | Setup wizards, config prompts, validated inputs; supports **`huh.WithAccessible(true)`** screen-reader-friendly linear mode |
39
+ | **Glamour** | Styled terminal Markdown renderer | Release notes, docs, AI responses, help pages with width-aware wrapping |
40
+ | **Gum** | Composable shell-scriptable TUI primitives | Bash/CI scripts needing quick filter/choose/confirm/spin UX without a Go binary |
41
+ | **Fang** | Modern Cobra CLI wrapper | Styled help text, manpages, version output, and shell completions out of the box |
42
+ | **Teatest** | Headless Bubble Tea test harness (`x/exp/teatest`) | Automated keystroke simulation, resize tests, and golden output assertions |
43
+
44
+ ## Token mapping, `UAX #29` width, & `--ascii` fallback
45
+
46
+ Centralize semantic `lipgloss.Style` definitions in one styles struct derived from detected terminal color profile / light-dark background (`lipgloss.HasDarkBackground` / v2 background-color query) so colors never clash on light terminals or disappear under `NO_COLOR=1` (never hardcode `#ffffff` or `#000000` without adapting to background luminance).
47
+
48
+ Always recompute pane widths/heights on `tea.WindowSizeMsg` using **`lipgloss.Width(...)`**, **`github.com/rivo/uniseg`** (`uniseg.StringWidth` / `uniseg.NewGraphemes`), or `go-runewidth`—**never** Go `len(str)` or `utf8.RuneCountInString(str)`, which corrupt borders on CJK (`2` cols), ZWJ emoji (`👨‍👩‍👧‍👦` = `2` cols), `VS16` (`⚠️` = `2` cols), and Vietnamese combining diacritics (`0` extra cols). Switch `lipgloss.RoundedBorder()` to `lipgloss.ASCIIBorder()` when `--ascii`, `TERM=dumb`, or non-UTF-8 locale is detected, and define a clean `80×24` minimum layout.
49
+
50
+ ## Bracketed Paste, `OSC 52`, `SIGPIPE`, 6-step teardown & CLI packaging
51
+
52
+ - **Bracketed Paste (`DECSET 2004`) & `OSC 52` clipboard**: handle `tea.PasteMsg` (Bubble Tea enables `?2004h` automatically) so pasted multi-line configs enter `textarea`/`textinput` cleanly without firing `enter` per newline; copy via **`OSC 52`** (`github.com/aymanbagabas/go-osc52/v2` / Bubble Tea v2 `tea.SetClipboard`) alongside local OS clipboard so remote SSH/`tmux` copies work out of the box.
53
+ - **Stream hygiene, `EPIPE`, & 6-step panic/signal restoration**: run interactive Bubble Tea on `tea.WithOutput(os.Stderr)` when `stdout` must emit pipeable selections, write `--json`/`--plain` strictly to `os.Stdout` while ignoring `errors.Is(err, syscall.EPIPE)` (exiting `0` silently on `| head -n 5`), and ensure `recover()` + `SIGINT`/`SIGTERM`/`SIGHUP` handlers complete the full 6-step terminal reset (`?1049l`, mouse `?1000l/?1002l/?1003l/?1006l`, `?2004l`, `?2026l`, `\x1b[<u`, `?25h` + raw mode restore—see [terminal-protocols.md](terminal-protocols.md)).
54
+ - **Accessibility, exit codes & distribution**: keep `tea.Tick` bounded, cancel async work via `context.Context` + request generation IDs, honor `ACCESSIBLE=1` (`huh.WithAccessible(true)`), use semantic exit codes (`0`, `1`, `2`, `130`), and wire **Fang** / Cobra to emit `--help`, `--version`, **`bash`/`zsh`/`fish`/`pwsh` completions**, **`man` pages**, and **GoReleaser** Homebrew/Winget/Scoop binaries.
55
+
56
+ ## Do/don't pairs
57
+
58
+ | Do | Don't |
59
+ |---|---|
60
+ | Measure/truncate graphemes with `lipgloss.Width` / `rivo/uniseg` + `lipgloss.ASCIIBorder()` fallback | Align columns with `len(s)` or `utf8.RuneCountInString(s)` (corrupts CJK, `👨‍👩‍👧‍👦`, and Vietnamese) |
61
+ | Handle `tea.PasteMsg` (`?2004h`), `OSC 52` SSH copy, and full 6-step reset on panic/signal | Treat pasted newlines as `Enter` submits or leave `?1049h`/`CSI u` active on panic |
62
+ | Route TUI chrome to `stderr` when piping, ignore `syscall.EPIPE` on `stdout`, and ship Fang/Cobra completions + `man` | Pollute `stdout` JSON with spinner ANSI codes or print errors on `mycli --plain \| head -n 5` |
63
+ | Recompute layout on every `tea.WindowSizeMsg` (tested at `80×24`) + light/dark-adaptive styles | Hard-code `120` columns or `#ffffff` text unreadable on light terminals |
64
+ | Use Bubble Tea v2 `tea.View` + Lip Gloss v2 `Layer` + **Huh** (`WithAccessible`) + **Teatest** | Mix v1 `tea.EnterAltScreen` commands with v2 `tea.View` or skip automated TUI tests |
65
+
66
+ ## Known traps
67
+
68
+ Measuring printable width with `len()` or `RuneCountInString()` instead of `lipgloss.Width()` / `uniseg`, forgetting `recover()` cleanup when spawning custom goroutines, leaving alt-screen/raw mode active on non-TTY piped output, unhandled `EPIPE` errors when piped to `head`, ignoring light-background terminal contrast.
69
+
70
+ ## Verification commands
71
+
72
+ ```sh
73
+ go test ./...
74
+ go vet ./...
75
+ NO_COLOR=1 COLUMNS=80 go run ./cmd/app --help
76
+ go run ./cmd/app --plain | head -n 5
77
+ ```
78
+
79
+ `go test` (including **Teatest** golden-file simulations) and `go vet` provide `static`/virtual-buffer evidence. Run the binary in real dark and light terminals at `80×24`, `NO_COLOR=1`, `TERM=dumb`, `--ascii`, multi-line paste, and piped `head -n 5` for `rendered` evidence; label untested emulators `not-checked`.
@@ -0,0 +1,127 @@
1
+ # Extended TUI toolkits & CLI prompt libraries
2
+
3
+ For Python Textual/Rich, Node Ink, Go Bubble Tea/Lip Gloss, and Rust Ratatui, read their dedicated references in `pixelcraft-tui`. Use this reference for **.NET (`Terminal.Gui v2`, `Spectre.Console`), Python `prompt_toolkit`, OpenTUI, C++ `FTXUI`, `Notcurses`, Go `tcell`/`tview`, legacy Blessed migration, and inline CLI prompt libraries**.
4
+
5
+ ## CLI prompts vs full-screen TUI (choose the right surface first)
6
+
7
+ Do **not** launch an alternate-screen full-screen TUI for a linear setup wizard, scaffolder, or one-shot confirmation—preserving terminal scrollback makes copy-paste, error inspection, and CI debugging far cleaner:
8
+
9
+ | Mode | When to choose | Modern libraries |
10
+ |---|---|---|
11
+ | **Inline CLI prompts** (scrollback-preserving) | Linear wizards, `init` scaffolders, auth/confirm flows, 1–5 step inputs | **TS/JS**: `@clack/prompts` (clean linear rail aesthetic), `@inquirer/prompts` (modular modern rewrite) · **Python**: `questionary` (`prompt_toolkit`-backed) · **Rust**: `cliclack`, `inquire`, `dialoguer` · **Go**: Charm `huh` / `gum` · **.NET**: `Spectre.Console` |
12
+ | **Full-screen TUI** (alternate buffer) | Live monitoring, multi-pane browsing, log/DB/git exploration, persistent keyboard workspaces | Textual, Bubble Tea v2, Ratatui, Ink, **Terminal.Gui v2**, **OpenTUI**, **FTXUI**, **tview** |
13
+
14
+ Always pair inline prompts with non-interactive flags (`--yes`, `--json`, env vars) and check `isatty` so CI pipelines never hang waiting on stdin.
15
+
16
+ ## Extended full-screen & REPL toolkit matrix
17
+
18
+ | Toolkit | Ecosystem | UI model | Best fit & key caveats |
19
+ |---|---|---|---|
20
+ | **Terminal.Gui (v2)** | .NET / C# | Retained widget toolkit (`Window`, `MenuBar`, `TableView`, `Pos`/`Dim`, `Scheme`) | .NET admin consoles, DB/file browsers; always wrap `Application.Init()` / `Shutdown()` in `try`/`finally` |
21
+ | **Spectre.Console** | .NET / C# | Inline rich CLI (`Table`, `Tree`, `Progress`, `Live`, `SelectionPrompt`) | Modern .NET CLIs & installers; escape user input with `Markup.Escape()` |
22
+ | **prompt_toolkit (v3)** | Python | Readline-plus REPL (`PromptSession`, `WordCompleter`, `patch_stdout`) & full-screen `Application` | Interactive SQL/AI/dev REPLs & multiline code prompts; for CSS dashboards prefer **Textual** |
23
+ | **OpenTUI** | TS/JS + Zig | Zig-powered high-FPS native cell renderer with `@opentui/core`, `@opentui/react`, `@opentui/solid` | Performance-sensitive TS/React/Solid TUIs needing native cell diffing beyond Ink/Yoga |
24
+ | **FTXUI** | C++ (17+) | Functional declarative C++ TUI (`ScreenInteractive`, `vbox`/`hbox`/`flex`, `CatchEvent`) | Zero-dependency native C++ CLIs, profilers, and embedded Linux diagnostics |
25
+ | **tcell / tview** | Go | `tcell` (low-level terminal cell/event engine) + `tview` (imperative widget library: `Table`, `TreeView`, `Flex`) | Existing Go repos using `tview`/`k9s`-style widgets; for new Go TUIs compare **Bubble Tea v2** (Elm architecture, richer ecosystem) |
26
+ | **Notcurses** | C / C++ / Rust | High-throughput multimedia/blitter TUI engine | Specialized visual/media terminal apps; heavy capability assumptions require plain fallback when unsupported |
27
+
28
+ **Blessed / Neo-Blessed migration note**: `blessed` and `neo-blessed` are legacy, largely unmaintained Node.js libraries with brittle terminfo/escape parsing. Migrate active or new Node/Bun TUIs to **Ink** (`references/ink.md`), **OpenTUI**, or **`@clack/prompts` / `@inquirer/prompts`** rather than building new features on Blessed internals.
29
+
30
+ ## Verified implementation idioms
31
+
32
+ ### .NET `Terminal.Gui` v2 (`Pos`/`Dim`, `Scheme`/`Attribute`, safe teardown)
33
+
34
+ Use relative **`Pos`** and **`Dim`** layout expressions (never fixed pixel-style coordinates) and semantic **`Scheme` / `Attribute`** pairs; always guarantee `Application.Shutdown()` runs even on exceptions:
35
+
36
+ ```csharp
37
+ using Terminal.Gui;
38
+
39
+ Application.Init();
40
+ try
41
+ {
42
+ var actionScheme = new Scheme(new Attribute(Color.White, Color.Blue));
43
+ var win = new Window { Title = "Invoices (Ctrl+Q Quit)", Width = Dim.Fill(), Height = Dim.Fill() };
44
+ var status = new Label { Text = "Ready", X = 1, Y = 1, Width = Dim.Fill(1) };
45
+ var saveBtn = new Button { Text = "_Save", X = Pos.Center(), Y = Pos.Bottom(status) + 1, ColorScheme = actionScheme };
46
+ win.Add(status, saveBtn);
47
+ Application.Run(win);
48
+ }
49
+ finally
50
+ {
51
+ Application.Shutdown();
52
+ }
53
+ ```
54
+
55
+ ### .NET `Spectre.Console` (markup injection guard & CI check)
56
+
57
+ Escape dynamic text with **`Markup.Escape(userInput)`** or **`AnsiConsole.MarkupLineInterpolated`** so brackets like `items[0]` never crash, and check `AnsiConsole.Profile.Capabilities.Interactive` before prompting:
58
+
59
+ ```csharp
60
+ using Spectre.Console;
61
+
62
+ string userInput = "settings[debug]";
63
+ AnsiConsole.MarkupLineInterpolated($"[green]Key:[/] {userInput}");
64
+ ```
65
+
66
+ ### Python `prompt_toolkit` (history & async-safe logging)
67
+
68
+ Wrap background logging inside **`with patch_stdout():`** so asynchronous messages print cleanly above the active prompt without shredding the user's input line:
69
+
70
+ ```python
71
+ from prompt_toolkit import PromptSession
72
+ from prompt_toolkit.completion import WordCompleter
73
+ from prompt_toolkit.history import FileHistory
74
+ from prompt_toolkit.patch_stdout import patch_stdout
75
+
76
+ session = PromptSession(
77
+ history=FileHistory(".app_history"),
78
+ completer=WordCompleter(["status", "deploy", "rollback", "exit"]),
79
+ )
80
+ with patch_stdout():
81
+ cmd = session.prompt("ops> ")
82
+ ```
83
+
84
+ ### C++ `FTXUI` (functional flexbox + keyboard handler)
85
+
86
+ ```cpp
87
+ #include <ftxui/component/component.hpp>
88
+ #include <ftxui/component/screen_interactive.hpp>
89
+ #include <ftxui/dom/elements.hpp>
90
+
91
+ using namespace ftxui;
92
+
93
+ int main() {
94
+ auto screen = ScreenInteractive::Fullscreen();
95
+ auto body = Renderer([] {
96
+ return vbox({ text("Invoices") | bold, separator(), text("[q] Quit") | dim }) | border;
97
+ });
98
+ auto app = CatchEvent(body, [&](Event e) {
99
+ if (e == Event::Character('q') || e == Event::Escape) { screen.Exit(); return true; }
100
+ return false;
101
+ });
102
+ screen.Loop(app);
103
+ }
104
+ ```
105
+
106
+ ## Do/don't pairs
107
+
108
+ | Do | Don't |
109
+ |---|---|
110
+ | Choose inline prompts (`@clack/prompts`, `questionary`, `cliclack`, `Spectre.Console`) for linear wizards | Launch a full-screen alt-buffer TUI just to ask 3 setup questions |
111
+ | Wrap `Terminal.Gui` `Application.Init()` / `Shutdown()` in `try`/`finally` with `Pos`/`Dim` | Hard-code coordinates or skip `Shutdown()` on exceptions |
112
+ | Escape dynamic strings via `Markup.Escape()` / `MarkupLineInterpolated()` in Spectre.Console | Interpolate unescaped paths/errors into `AnsiConsole.MarkupLine($"...")` |
113
+ | Wrap concurrent output in `with patch_stdout():` in `prompt_toolkit` | Call `print()` from background threads and corrupt the active REPL line |
114
+ | Migrate legacy Blessed/Neo-Blessed apps to Ink, OpenTUI, or `@clack/prompts` | Build new production Node TUIs on abandoned Blessed internals |
115
+
116
+ ## Verification commands
117
+
118
+ ```sh
119
+ # Run the build/test suite matching your ecosystem:
120
+ dotnet test # Terminal.Gui / Spectre.Console
121
+ python -m pytest # prompt_toolkit / questionary
122
+ cmake --build build && ctest --test-dir build # FTXUI / Notcurses
123
+ go test ./... # tcell / tview
124
+ npm test # OpenTUI / @clack/prompts / @inquirer/prompts
125
+ ```
126
+
127
+ Test suites provide `static` / logic evidence. Inspect live `80×24` interactive sessions, `NO_COLOR=1`, `TERM=dumb`, `Ctrl+C` cleanup, and piped non-TTY CI runs for `rendered` evidence; label untested emulators `not-checked`.
@@ -0,0 +1,109 @@
1
+ # Ink (React for CLI, v5 / v6)
2
+
3
+ Ink 5/6 runs **React 19** + **Yoga 3** Flexbox in terminal cells. Treat Ink as a keyboard-driven terminal surface—not a browser DOM running inside Node/Bun.
4
+
5
+ ## Token mapping
6
+
7
+ Centralize semantic colors, borders, and spacing in a typed theme module or `@inkjs/ui` `ThemeProvider` / `extendTheme` so components reference semantic roles (`action`, `danger`, `muted`) rather than scattering raw hex/chalk strings:
8
+
9
+ ```tsx
10
+ export const pcTheme = {
11
+ action: 'cyan',
12
+ success: 'green',
13
+ error: 'red',
14
+ muted: 'gray',
15
+ focusBorder: 'blue',
16
+ } as const;
17
+ ```
18
+
19
+ Prefer ANSI semantic palette names (`cyan`, `red`, `green`, `yellow`) or test graceful degradation under `NO_COLOR=1` and 16-color terminals—never assume truecolor support.
20
+
21
+ ## Core Ink 5/6 primitives: `<Static>`, `useInput`, `useFocus`, & `@inkjs/ui`
22
+
23
+ - **`<Static items={completedLogs}>`**: render completed log lines, build steps, or historical entries once above the dynamic interactive footer so Ink appends cleanly to terminal scrollback without flickering or redrawing thousands of past lines.
24
+ - **`useInput((input, key) => ..., { isActive })`**: gate keyboard listeners with `isActive` whenever a modal, confirmation prompt, or nested pane opens so background views never steal `Enter`, `Escape`, or arrow keys.
25
+ - **`useFocus` & `useFocusManager`**: wire `Tab` / `Shift+Tab` focus traversal across panes and show an unmistakable focus indicator (border + text marker `>`, never color alone).
26
+ - **`@inkjs/ui`**: prefer official accessible-baseline Ink widgets (`Select`, `MultiSelect`, `ConfirmInput`, `TextInput`, `Spinner`, `ProgressBar`, `StatusMessage`, `Badge`, `ThemeProvider`) before hand-rolling raw keystroke handlers.
27
+
28
+ ```tsx
29
+ import React, { useState } from 'react';
30
+ import { Box, Static, Text, useFocus, useInput } from 'ink';
31
+ import { StatusMessage } from '@inkjs/ui';
32
+
33
+ type LogEntry = { id: string; text: string };
34
+
35
+ export function DeployView({ logs, onCancel }: { logs: LogEntry[]; onCancel: () => void }) {
36
+ const { isFocused } = useFocus({ autoFocus: true });
37
+ const [confirming, setConfirming] = useState(false);
38
+
39
+ useInput(
40
+ (input, key) => {
41
+ if (key.escape || input === 'q') setConfirming(true);
42
+ if (confirming && input === 'y') onCancel();
43
+ if (confirming && input === 'n') setConfirming(false);
44
+ },
45
+ { isActive: isFocused },
46
+ );
47
+
48
+ return (
49
+ <Box flexDirection="column">
50
+ <Static items={logs}>{(entry) => <Text key={entry.id}>{entry.text}</Text>}</Static>
51
+ <Box borderStyle="round" borderColor={isFocused ? 'cyan' : 'gray'} paddingX={1}>
52
+ <Text>{isFocused ? '> ' : ' '}</Text>
53
+ {confirming ? (
54
+ <StatusMessage variant="warning">Abort deploy? [y/n]</StatusMessage>
55
+ ) : (
56
+ <Text>Press q or Esc to abort</Text>
57
+ )}
58
+ </Box>
59
+ </Box>
60
+ );
61
+ }
62
+ ```
63
+
64
+ ## Layout, `UAX #29` width, Bracketed Paste, `EPIPE`, & teardown idioms
65
+
66
+ - **Grapheme width (`Intl.Segmenter` + `string-width`) & `--ascii`**: never pad or truncate terminal strings with JS `str.length` (UTF-16 code units corrupt CJK `2`-col glyphs, `👨‍👩‍👧‍👦` ZWJ emoji, `⚠️` `VS16`, and Vietnamese NFD combining marks). Segment cursor steps with `new Intl.Segmenter(undefined, { granularity: 'grapheme' })` and measure columns with **`string-width`**; switch `borderStyle` / glyphs to ASCII (`borderStyle="classic"` or `+--+`) under `--ascii`, `TERM=dumb`, or non-UTF-8 locales.
67
+ - **Query `useStdout()` (`stdout.columns`, `stdout.rows`)** and subscribe to `resize` events to adapt layouts at `80×24` minimum; set `wrap="truncate-end"` intentionally on narrow labels.
68
+ - **Bracketed Paste (`DECSET 2004`) & `OSC 52` clipboard**: enable `\x1b[?2004h` on interactive text inputs so multi-line pastes arrive intact instead of triggering `key.return` on every newline; emit `OSC 52` (`\x1b]52;c;<base64>\x07`) alongside local clipboard helpers for SSH/`tmux` copy support.
69
+ - **Stream hygiene & silent `EPIPE` exit**: render Ink diagnostic/progress UI on `stderr` (`render(<App />, { stdout: process.stderr })`) whenever `stdout` is reserved for pipeable results, emit `--json`/`--plain` strictly to `process.stdout`, and install `process.stdout.on('error', (err) => { if (err.code === 'EPIPE') process.exit(0); })` so `mycli --plain | head -n 5` never crashes with an unhandled `Error: write EPIPE` stack trace!
70
+ - **6-step signal/crash restoration & CLI distribution**: register cleanup handlers on `SIGINT`, `SIGTERM`, `SIGHUP`, and `uncaughtException` to run the 6-step terminal reset (`?1049l`, mouse `?1000l/?1002l/?1003l/?1006l`, `?2004l`, `?2026l`, `\x1b[<u`, `?25h` + `stdin.setRawMode(false)`) before exiting (`0` ok, `1` runtime error, `2` flag error, `130` `SIGINT`). Ship `--help`, `--version`, `bash`/`zsh`/`fish`/`pwsh` completions, a `man` page, and npm/Homebrew/Winget/Scoop distribution ([terminal-protocols.md](terminal-protocols.md)).
71
+
72
+ ## Automated frame & input testing (`ink-testing-library`)
73
+
74
+ Drive deterministic component rendering and keystroke sequences with **`ink-testing-library`**:
75
+
76
+ ```tsx
77
+ import { render } from 'ink-testing-library';
78
+ import { DeployView } from './DeployView.js';
79
+
80
+ const { lastFrame, stdin } = render(<DeployView logs={[]} onCancel={() => {}} />);
81
+ stdin.write('q');
82
+ // Assert frame contains "[y/n]" prompt text and focus marker ">"
83
+ ```
84
+
85
+ ## Do/don't pairs
86
+
87
+ | Do | Don't |
88
+ |---|---|
89
+ | Render completed log history inside `<Static>` above live status | Re-render a growing 500-line array inside the dynamic `<Box>` every tick |
90
+ | Measure/slice text with `Intl.Segmenter` + `string-width` and provide `--ascii` fallback | Pad columns with `str.length` / `.padEnd()`, breaking CJK, `👨‍👩‍👧‍👦`, and Vietnamese diacritics |
91
+ | Enable Bracketed Paste (`?2004h`), handle `stdout` `EPIPE` silently, and run 6-step reset on `SIGINT`/crash | Fire `key.return` on pasted newlines, crash with `EPIPE` on `\| head -n 5`, or leave raw mode stuck |
92
+ | Gate `useInput(..., { isActive })` by focus/modal state + ANSI 16 dark/light-safe colors | Let hidden views intercept `Enter`/`Escape` or hardcode `#ffffff` on light terminals |
93
+ | Detect `!process.stdout.isTTY` / `CI=1`, emit plain/JSON to `stdout`, and ship completions + `man` page | Hang CI pipelines waiting on interactive `<Select>` or leak spinner ANSI to `stdout` |
94
+
95
+ ## Known traps
96
+
97
+ Rendering unbounded lists outside `<Static>`, `str.length` UTF-16 width misalignment on emoji/CJK/Vietnamese, unhandled `stdout` `EPIPE` stack traces when piped to `head`/`jq`, multi-line paste firing accidental `Enter` submits without `?2004h`, React effect leaks after `Ctrl+C` keeping the Node event loop alive.
98
+
99
+ ## Verification commands
100
+
101
+ ```sh
102
+ npm run lint
103
+ npm run test -- --run
104
+ npm run build
105
+ NO_COLOR=1 COLUMNS=80 node dist/cli.js --help
106
+ node dist/cli.js --plain | head -n 5
107
+ ```
108
+
109
+ Lint, build, and `ink-testing-library` assertions provide `static` / virtual-frame evidence. Run the built CLI in real dark and light terminals at `80×24`, `NO_COLOR=1`, `--ascii`, multi-line paste, piped `head -n 5`, and `Ctrl+C` interrupt paths for `rendered` evidence; label untested terminal emulators `not-checked`.
@@ -0,0 +1,102 @@
1
+ # Ratatui (Rust, 0.28–0.30+)
2
+
3
+ ## Lifecycle & panic-safe teardown (`ratatui::run` / `init` + `restore`)
4
+
5
+ Never leave a user's terminal trapped in raw mode or the alternate screen after an error or panic. On Ratatui 0.28+, use **`ratatui::init()`** paired with **`ratatui::restore()`** (or **`ratatui::run(|terminal| ...)`** on 0.30+), which automatically installs a panic hook that restores terminal state before printing the panic payload:
6
+
7
+ ```rust
8
+ use ratatui::{
9
+ layout::{Constraint, Flex, Layout},
10
+ style::{Color, Modifier, Style},
11
+ DefaultTerminal, Frame,
12
+ };
13
+
14
+ pub struct PcTheme {
15
+ pub action: Style,
16
+ pub error: Style,
17
+ pub focused: Style,
18
+ }
19
+
20
+ impl Default for PcTheme {
21
+ fn default() -> Self {
22
+ Self {
23
+ action: Style::default().fg(Color::Cyan).add_modifier(Modifier::BOLD),
24
+ error: Style::default().fg(Color::Red).add_modifier(Modifier::BOLD),
25
+ focused: Style::default().fg(Color::Yellow).add_modifier(Modifier::REVERSED),
26
+ }
27
+ }
28
+ }
29
+
30
+ fn main() -> color_eyre::Result<()> {
31
+ ratatui::run(|terminal: &mut DefaultTerminal| app_loop(terminal))
32
+ }
33
+ ```
34
+
35
+ ## Token mapping & terminal capability respect
36
+
37
+ Define semantic `Style` / `Color` fields in one theme struct (defaulting to ANSI 16 named colors or mapping down cleanly when `NO_COLOR` is set or `COLORTERM` is absent) instead of scattering `Color::Rgb(...)` literals across widgets. Respect light and dark terminal backgrounds by avoiding hard-coded dark-only `Color::White` text over default terminal backgrounds—prefer `Color::Reset` for standard foreground/background cells.
38
+
39
+ ## Layout (`Constraint::Fill` / `Flex`) & ecosystem crates
40
+
41
+ - Derive layout every frame from `frame.area()` using **`Constraint::Fill(weight)`**, `Constraint::Length`, `Constraint::Min`, `Constraint::Max`, and **`Flex`** (`Flex::SpaceBetween`, `Flex::Center`, `Flex::Start`, `Flex::Legacy`) instead of error-prone percentage math that leaves 1-cell gaps:
42
+
43
+ ```rust
44
+ let [header, body, footer] = Layout::vertical([
45
+ Constraint::Length(2),
46
+ Constraint::Fill(1),
47
+ Constraint::Length(1),
48
+ ])
49
+ .flex(Flex::Legacy)
50
+ .areas(frame.area());
51
+ ```
52
+
53
+ - **Images in terminal cells (`ratatui-image`)**: use `ratatui-image` when displaying previews/thumbnails—it automatically probes and renders via Kitty Graphics, Sixel, iTerm2 inline images, or Unicode halfblock (`▀`/`▄`) fallback without crashing unsupported terminals.
54
+ - **Multi-line text input (`tui-textarea` / `edtui`)**: reuse mature editing crates for cursor movement, selection, undo/redo, and paste rather than hand-rolling byte-offset UTF-8 string slicing (which panics on multi-byte Unicode/CJK graphemes).
55
+
56
+ ## Grapheme width (`UAX #29`), Bracketed Paste, `OSC 52` & 6-step teardown
57
+
58
+ - **Grapheme-cluster column width**: never use `str::len()` or `chars().count()` for cell alignment or cursor slicing. Segment text with **`unicode-segmentation`** (`s.graphemes(true)`) and compute column width with **`unicode-width`** (`UnicodeWidthStr::width`) so CJK (`2` cols), ZWJ emoji (`👨‍👩‍👧‍👦` = `2` cols), `VS16` (`⚠️` = `2` cols), and Vietnamese combining diacritics (`0` extra cols) never corrupt box borders; switch to `ratatui::symbols::border::ASCII` (`+--+`) when `--ascii`, `TERM=dumb`, or non-UTF-8 locale is active.
59
+ - **Bracketed Paste (`DECSET 2004`) & `OSC 52` clipboard**: enable `crossterm::event::EnableBracketedPaste` (`Event::Paste(String)`) so multi-line pastes into inputs never fire `KeyCode::Enter` per line; support copying via `arboard` locally plus **`OSC 52`** (`crossterm::clipboard::CopyToClipboard`) over SSH/`tmux`.
60
+ - **Complete 6-step panic & signal restoration**: whenever enabling mouse capture, bracketed paste, synchronized updates, or Kitty keyboard enhancement alongside `ratatui::init()`, ensure your `Drop` guard + panic hook + `tokio::signal` (`SIGINT`, `SIGTERM`, `SIGHUP`) handler executes all 6 steps ([terminal-protocols.md](terminal-protocols.md)): `?1049l` (leave alt screen), `?1000l/?1002l/?1003l/?1006l` (disable mouse), `?2004l` (disable bracketed paste), `?2026l` (end sync output), `\x1b[<u` (pop Kitty keyboard flags), and `?25h` + `disable_raw_mode()`.
61
+ - **Stream hygiene, `BrokenPipe`, & CLI packaging**: write TUI/spinners to `stderr` (or alt-screen only when `std::io::stdout().is_terminal()`), emit `--json`/`--plain` strictly to `stdout` while catching **`io::ErrorKind::BrokenPipe`** (`exit(0)` silently on `| head -n 5` instead of `.unwrap()` panicking!), use semantic exit codes (`0`, `1`, `2`, `130`), and generate `bash`/`zsh`/`fish`/`pwsh` completions + `man` pages via **`clap_complete`** and **`clap_mangen`** (`cargo-dist` / Homebrew / Winget / Scoop / Cargo).
62
+
63
+ Keep event polling (`crossterm::event::poll`) and tick intervals bounded so idle TUIs consume near-zero CPU. Manage async backend work on Tokio channels with explicit request IDs and cancellation (`CancellationToken`) so stale results never overwrite newer selections. Render explicit loading, empty, error, offline, and narrow-terminal fallback views into buffers—never leave blank black panes, and position the real terminal cursor (`frame.set_cursor_position(...)`) inside focused text inputs for assistive tools/IME.
64
+
65
+ ## Snapshot & buffer verification (`TestBackend` + `insta`)
66
+
67
+ Test layout, narrow `80×24` collapse behavior, CJK/ZWJ/Vietnamese grapheme alignment, focus markers, and error states deterministically with **`TestBackend::new(width, height)`** and **`insta`** snapshots:
68
+
69
+ ```rust
70
+ #[test]
71
+ fn renders_cleanly_at_80x24() {
72
+ let mut terminal = ratatui::Terminal::new(ratatui::backend::TestBackend::new(80, 24)).unwrap();
73
+ terminal.draw(|f| draw_ui(f, &App::sample())).unwrap();
74
+ insta::assert_snapshot!(terminal.backend());
75
+ }
76
+ ```
77
+
78
+ ## Do/don't pairs
79
+
80
+ | Do | Don't |
81
+ |---|---|
82
+ | Run `ratatui::run`/`restore` + full 6-step teardown (`?2004l`, `?1003l`, `\x1b[<u`) on panic & signals | Manual raw-mode setup leaving mouse capture, bracketed paste, or `CSI u` stuck after crashes |
83
+ | Measure/slice via `unicode-segmentation` + `unicode-width` + `border::ASCII` fallback | Slice UTF-8 strings by byte index or use `.len()` on CJK / `👨‍👩‍👧‍👦` / Vietnamese text |
84
+ | Enable `EnableBracketedPaste` (`Event::Paste`) and `OSC 52` SSH clipboard | Treat pasted newlines as accidental `Enter` confirmations |
85
+ | Catch `ErrorKind::BrokenPipe` on `--json`/`--plain` `stdout` writes and ship `clap_complete` + `man` pages | `.unwrap()` `writeln!(stdout)` so `mycli --plain \| head -n 5` panics with a backtrace |
86
+ | Centralize semantic `PcTheme` using `Color::Reset` + ANSI 16 dark/light-safe roles | Scatter `Color::Rgb(255, 255, 255)` unreadable on light terminals |
87
+ | Verify buffers across `80×24` and wide sizes with `TestBackend` + `insta` | Rely solely on `cargo build` or one wide manual glance |
88
+
89
+ ## Known traps
90
+
91
+ Byte-index string slicing panicking on UTF-8/emoji/CJK/Vietnamese characters, forgetting `DisableBracketedPaste` / `PopKeyboardEnhancementFlags` on panic, `.unwrap()` panicking on `SIGPIPE`/`BrokenPipe`, hard-coding `Color::White` on light-background terminals, spinning a 0ms event loop burning 100% CPU, emitting alt-screen control codes when piped to `grep`/`jq`.
92
+
93
+ ## Verification commands
94
+
95
+ ```sh
96
+ cargo test
97
+ cargo clippy --all-targets -- -D warnings
98
+ NO_COLOR=1 cargo run -- --help
99
+ cargo run -- --plain | head -n 5
100
+ ```
101
+
102
+ `cargo test` (`TestBackend` / `insta` snapshots) and `cargo clippy` provide `static` and deterministic buffer evidence. Run the compiled binary in real dark and light terminals at `80×24`, `NO_COLOR=1`, `TERM=dumb`, `--ascii`, multi-line paste, and panic/interrupt recovery paths for `rendered` evidence; label untested emulators `not-checked`.
@@ -0,0 +1,82 @@
1
+ # Rich (Python)
2
+
3
+ Rich is a structured terminal rendering library—not a full-screen multi-pane application framework. Use it for CLI output, tables, panels, trees, syntax highlighting, Markdown, progress bars, and bounded live status displays. When an interface needs persistent panes, focus rings, or complex keyboard navigation, move to **Textual** (`references/textual.md`).
4
+
5
+ ## Token mapping (`rich.theme.Theme`) & stdout/stderr separation
6
+
7
+ Define semantic style roles once with **`rich.theme.Theme`** and pass it to **`Console(theme=...)`**. Separate diagnostic/interactive UI (`Console(stderr=True)`) from machine-readable payload output on `stdout` so piping (`mycli list | jq`) never breaks on ANSI escape codes or spinner frames:
8
+
9
+ ```python
10
+ from rich.console import Console
11
+ from rich.markup import escape
12
+ from rich.theme import Theme
13
+
14
+ PC_THEME = Theme({
15
+ "action": "bold #0074ca",
16
+ "success": "bold green",
17
+ "warning": "bold yellow",
18
+ "error": "bold red",
19
+ "muted": "dim",
20
+ })
21
+
22
+ out = Console(theme=PC_THEME) # primary output (auto-strips ANSI when piped)
23
+ err = Console(stderr=True, theme=PC_THEME) # progress, spinners, warnings, errors
24
+
25
+ filename = "report[2026].csv"
26
+ err.print(f"[action]Importing[/action] {escape(filename)}")
27
+ ```
28
+
29
+ ## Markup safety (`rich.markup.escape`)
30
+
31
+ Rich interprets `[...]` brackets in strings as style tags. Always wrap untrusted or dynamic strings (filenames, JSON snippets, array indices like `items[0]`, log lines) with **`rich.markup.escape(text)`**—or pass `markup=False` to `console.print(...)`—so brackets never swallow text or raise `MarkupError`.
32
+
33
+ ## Layout, `rich.cells` width, & `--ascii` fallback
34
+
35
+ - Let Rich adapt tables and panels to `console.width` (`expand=False` or responsive `ratio`/`overflow="fold"`/`"ellipsis"`) rather than building fixed 120-column ASCII boxes, and measure custom padding with **`rich.cells.cell_len(text)`** (never `len(text)`, which miscounts `2`-col CJK, `👨‍👩‍👧‍👦` ZWJ emoji, `⚠️` `VS16`, and `0`-col Vietnamese combining diacritics).
36
+ - Switch tables/panels to **`rich.box.ASCII`** (`+--+`) and ASCII spinners (`spinner="line"`) when `--ascii`, `TERM=dumb`, or `legacy_windows` / non-UTF-8 encoding is active.
37
+ - Prefer ANSI 16 semantic color names (`cyan`, `green`, `yellow`, `red`, `default`) over hardcoded `#ffffff` or `#000000` so output stays legible on both dark and light terminal themes, pairing color with plain-text markers (`[OK]`, `[WARN]`, `[ERR]`) for `NO_COLOR=1` and screen readers.
38
+
39
+ ## Stream hygiene, `BrokenPipeError`, progress, & CLI packaging
40
+
41
+ - **Strict `stdout` / `stderr` & silent `BrokenPipeError` exit**: run `Progress`, `Live`, spinners, and warnings exclusively on `Console(stderr=True)` (`refresh_per_second=4`–`10`, disabled automatically when `not err.is_terminal` or `CI=true`); emit `--json` / `--plain` data strictly to `sys.stdout` wrapped in a **`BrokenPipeError`** guard so `mycli list --plain | head -n 5` exits `0` silently without printing a Python traceback:
42
+
43
+ ```python
44
+ import os
45
+ import sys
46
+
47
+ def flush_stdout_safely() -> None:
48
+ try:
49
+ sys.stdout.flush()
50
+ except BrokenPipeError:
51
+ devnull = os.open(os.devnull, os.O_WRONLY)
52
+ os.dup2(devnull, sys.stdout.fileno())
53
+ sys.exit(0)
54
+ ```
55
+
56
+ - **Interrupts, semantic exit codes & distribution**: catch `KeyboardInterrupt` cleanly (stop `Progress`/`Live` so `?25h` cursor visibility restores, print cancelled summary to `stderr`, and exit **`130`**); use **`0`** for success, **`1`** for runtime errors, and **`2`** for CLI usage errors.
57
+ - **Prompts & packaging**: Rich's `Prompt.ask` / `Confirm.ask` fit short linear confirmations (prefer **`prompt_toolkit`** with Bracketed Paste `?2004h` for multi-line input—see [extended-tui-toolkits.md](extended-tui-toolkits.md)). Always provide non-interactive flags (`--yes`), `--help`, `--version`, **`bash`/`zsh`/`fish`/`pwsh` shell completions** (Typer/Click), a **`man` page**, and `uv tool` / Homebrew / Scoop / Winget packaging.
58
+
59
+ ## Do/don't pairs
60
+
61
+ | Do | Don't |
62
+ |---|---|
63
+ | Define 16-color-safe `Theme({...})` + `rich.cells.cell_len` + `box.ASCII` fallback | Hardcode `#ffffff` on assumed-black terminals or measure columns with Python `len()` |
64
+ | Escape dynamic strings with `rich.markup.escape(val)` or `markup=False` | Interpolate raw file paths or errors like `items[0]` into Rich markup |
65
+ | Put `Progress`, `Live`, and warnings on `Console(stderr=True)` and catch `BrokenPipeError` on `stdout` | Pollute piped `stdout` JSON with spinner ANSI codes or print `BrokenPipeError` on `\| head -n 5` |
66
+ | Emit plain line-based progress, `--json` mode, `0/1/2/130` exit codes, completions, and `man` page | Render cursor-rewriting live tables into CI log files or exit `0` on failures |
67
+ | Handle `KeyboardInterrupt` cleanly (`?25h` cursor restored, exit `130`) | Leave hidden cursors or raw Python tracebacks on `Ctrl+C` |
68
+
69
+ ## Known traps
70
+
71
+ Unescaped `[...]` brackets throwing `MarkupError`, `Progress` written to `stdout` breaking `jq` pipes, uncaught `BrokenPipeError` tracebacks when piped to `head`, Python `len()` misaligning CJK/ZWJ/Vietnamese columns, `NO_COLOR=1` or light-terminal themes rendering status invisible.
72
+
73
+ ## Verification commands
74
+
75
+ ```sh
76
+ python -m compileall .
77
+ python -m pytest
78
+ NO_COLOR=1 COLUMNS=80 python cli.py --help
79
+ python cli.py --plain | head -n 5
80
+ ```
81
+
82
+ Unit tests and `Console(record=True, width=80, no_color=True)` string-capture fixtures provide repeatable `static`/snapshot evidence. Inspect actual dark and light terminal runs across `80`-column width, `NO_COLOR=1`, `--ascii`, piped `head -n 5`, and `Ctrl+C` interruption for `rendered` evidence; label untested emulators `not-checked`.