@thanhnguyxn/pixelcraft 0.0.0-stage → 0.1.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 (297) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/.claude-plugin/marketplace.json +20 -0
  3. package/.claude-plugin/plugin.json +11 -0
  4. package/LICENSE +21 -0
  5. package/README.md +407 -2
  6. package/assets/README.md +28 -0
  7. package/assets/pixelcraft-logo-512.png +0 -0
  8. package/bin/pixelcraft.mjs +444 -0
  9. package/docs/ARCHITECTURE.md +102 -0
  10. package/docs/DESIGN-RATIONALE.md +143 -0
  11. package/evals/README.md +27 -0
  12. package/evals/fixtures/README.md +36 -0
  13. package/evals/fixtures/direction-prototype-complexity.json +29 -0
  14. package/evals/fixtures/finish-gate-anti-slop.json +30 -0
  15. package/evals/fixtures/forms-accessibility-negative.json +29 -0
  16. package/evals/fixtures/handoff-fidelity-tolerance.json +29 -0
  17. package/evals/fixtures/plan-brownfield-evidence.json +28 -0
  18. package/evals/fixtures/visual-qa-task-evidence.json +29 -0
  19. package/evals/fixtures/workflow-checkpoints.json +30 -0
  20. package/evals/pixelcraft-accessibility.md +57 -0
  21. package/evals/pixelcraft-brandkit.md +58 -0
  22. package/evals/pixelcraft-chat-ui.md +55 -0
  23. package/evals/pixelcraft-constrained.md +55 -0
  24. package/evals/pixelcraft-craft.md +60 -0
  25. package/evals/pixelcraft-data-apps.md +55 -0
  26. package/evals/pixelcraft-dataviz.md +59 -0
  27. package/evals/pixelcraft-desktop.md +55 -0
  28. package/evals/pixelcraft-direction.md +60 -0
  29. package/evals/pixelcraft-document.md +55 -0
  30. package/evals/pixelcraft-email.md +55 -0
  31. package/evals/pixelcraft-extensions.md +55 -0
  32. package/evals/pixelcraft-game-ui.md +59 -0
  33. package/evals/pixelcraft-handoff.md +57 -0
  34. package/evals/pixelcraft-media.md +55 -0
  35. package/evals/pixelcraft-mobile.md +59 -0
  36. package/evals/pixelcraft-patterns.md +57 -0
  37. package/evals/pixelcraft-plan.md +65 -0
  38. package/evals/pixelcraft-review.md +63 -0
  39. package/evals/pixelcraft-spatial.md +55 -0
  40. package/evals/pixelcraft-tokens.md +57 -0
  41. package/evals/pixelcraft-tui.md +55 -0
  42. package/evals/pixelcraft-ux.md +59 -0
  43. package/evals/pixelcraft-visual-qa.md +80 -0
  44. package/evals/pixelcraft-web.md +71 -0
  45. package/evals/pixelcraft.md +70 -0
  46. package/gemini-extension.json +5 -0
  47. package/install.ps1 +295 -0
  48. package/install.sh +437 -0
  49. package/package.json +63 -4
  50. package/plugin.json +24 -0
  51. package/scripts/build-adapters.mjs +290 -0
  52. package/scripts/build-release-archives.mjs +61 -0
  53. package/scripts/build-skill-zips.mjs +94 -0
  54. package/scripts/test-build-adapters.mjs +48 -0
  55. package/scripts/test-distribution.mjs +124 -0
  56. package/scripts/test-export-tokens.mjs +105 -0
  57. package/scripts/test-finish-gate.mjs +148 -0
  58. package/scripts/test-installers.mjs +67 -0
  59. package/scripts/test-release-archives.mjs +42 -0
  60. package/scripts/test-shoot.mjs +65 -0
  61. package/scripts/test-slop-scan.mjs +29 -0
  62. package/scripts/test-style-inventory.mjs +211 -0
  63. package/scripts/test-validate-skills.mjs +117 -0
  64. package/scripts/validate-skills.mjs +512 -0
  65. package/skills/pixelcraft/SKILL.md +135 -0
  66. package/skills/pixelcraft/references/design-brief.md +75 -0
  67. package/skills/pixelcraft/references/floor.md +73 -0
  68. package/skills/pixelcraft/references/report-template.md +35 -0
  69. package/skills/pixelcraft/references/stack-detection.md +155 -0
  70. package/skills/pixelcraft/references/surface-acceptance.md +40 -0
  71. package/skills/pixelcraft/references/workflow-checkpoints.md +29 -0
  72. package/skills/pixelcraft-accessibility/SKILL.md +33 -0
  73. package/skills/pixelcraft-accessibility/references/apg-patterns.md +51 -0
  74. package/skills/pixelcraft-accessibility/references/platforms.md +58 -0
  75. package/skills/pixelcraft-accessibility/references/verification.md +59 -0
  76. package/skills/pixelcraft-accessibility/references/wcag22-checks.md +66 -0
  77. package/skills/pixelcraft-brandkit/SKILL.md +115 -0
  78. package/skills/pixelcraft-brandkit/references/asset-pipeline.md +125 -0
  79. package/skills/pixelcraft-brandkit/references/brand-governance.md +80 -0
  80. package/skills/pixelcraft-brandkit/references/layouts.md +88 -0
  81. package/skills/pixelcraft-brandkit/references/logo-concepting.md +83 -0
  82. package/skills/pixelcraft-brandkit/references/logo-methods.md +98 -0
  83. package/skills/pixelcraft-brandkit/references/pixel-art-logos.md +82 -0
  84. package/skills/pixelcraft-brandkit/references/prompt-template.md +85 -0
  85. package/skills/pixelcraft-brandkit/references/qa-checklist.md +88 -0
  86. package/skills/pixelcraft-brandkit/references/visual-modes.md +123 -0
  87. package/skills/pixelcraft-chat-ui/SKILL.md +53 -0
  88. package/skills/pixelcraft-chat-ui/references/conversation-design.md +78 -0
  89. package/skills/pixelcraft-chat-ui/references/mobile-business-platforms.md +87 -0
  90. package/skills/pixelcraft-chat-ui/references/slack-discord.md +96 -0
  91. package/skills/pixelcraft-constrained/SKILL.md +51 -0
  92. package/skills/pixelcraft-constrained/references/specialized-hardware.md +66 -0
  93. package/skills/pixelcraft-constrained/references/tv-wearables.md +84 -0
  94. package/skills/pixelcraft-constrained/references/voice-ui.md +63 -0
  95. package/skills/pixelcraft-craft/SKILL.md +44 -0
  96. package/skills/pixelcraft-craft/references/color.md +69 -0
  97. package/skills/pixelcraft-craft/references/imagery-icons.md +37 -0
  98. package/skills/pixelcraft-craft/references/layout-quality.md +65 -0
  99. package/skills/pixelcraft-craft/references/layout.md +41 -0
  100. package/skills/pixelcraft-craft/references/motion.md +76 -0
  101. package/skills/pixelcraft-craft/references/typography.md +71 -0
  102. package/skills/pixelcraft-data-apps/SKILL.md +67 -0
  103. package/skills/pixelcraft-data-apps/references/dash.md +53 -0
  104. package/skills/pixelcraft-data-apps/references/evidence.md +75 -0
  105. package/skills/pixelcraft-data-apps/references/gradio.md +65 -0
  106. package/skills/pixelcraft-data-apps/references/julia-genie.md +54 -0
  107. package/skills/pixelcraft-data-apps/references/jupyter-widgets.md +53 -0
  108. package/skills/pixelcraft-data-apps/references/nicegui.md +63 -0
  109. package/skills/pixelcraft-data-apps/references/observable-framework.md +67 -0
  110. package/skills/pixelcraft-data-apps/references/panel.md +53 -0
  111. package/skills/pixelcraft-data-apps/references/r-shiny.md +54 -0
  112. package/skills/pixelcraft-data-apps/references/reflex.md +62 -0
  113. package/skills/pixelcraft-data-apps/references/shiny.md +53 -0
  114. package/skills/pixelcraft-data-apps/references/streamlit.md +65 -0
  115. package/skills/pixelcraft-dataviz/SKILL.md +63 -0
  116. package/skills/pixelcraft-dataviz/references/chart-choice.md +55 -0
  117. package/skills/pixelcraft-dataviz/references/color-accessibility.md +112 -0
  118. package/skills/pixelcraft-dataviz/references/encoding-tables-dashboards.md +97 -0
  119. package/skills/pixelcraft-dataviz/references/libraries.md +57 -0
  120. package/skills/pixelcraft-dataviz/references/realtime-graphs-maps-scale.md +99 -0
  121. package/skills/pixelcraft-desktop/SKILL.md +71 -0
  122. package/skills/pixelcraft-desktop/references/appkit.md +58 -0
  123. package/skills/pixelcraft-desktop/references/avalonia.md +59 -0
  124. package/skills/pixelcraft-desktop/references/cpp-gui.md +52 -0
  125. package/skills/pixelcraft-desktop/references/electron.md +54 -0
  126. package/skills/pixelcraft-desktop/references/go-gui.md +54 -0
  127. package/skills/pixelcraft-desktop/references/gtk.md +54 -0
  128. package/skills/pixelcraft-desktop/references/javafx-swing.md +52 -0
  129. package/skills/pixelcraft-desktop/references/qt-pyside-qml.md +61 -0
  130. package/skills/pixelcraft-desktop/references/rust-gui.md +65 -0
  131. package/skills/pixelcraft-desktop/references/tauri.md +54 -0
  132. package/skills/pixelcraft-desktop/references/uno-platform.md +52 -0
  133. package/skills/pixelcraft-desktop/references/winui-wpf.md +58 -0
  134. package/skills/pixelcraft-desktop/references/working-context.md +5 -0
  135. package/skills/pixelcraft-direction/SKILL.md +154 -0
  136. package/skills/pixelcraft-direction/references/composition-library.md +84 -0
  137. package/skills/pixelcraft-direction/references/direction-card.md +54 -0
  138. package/skills/pixelcraft-direction/references/direction-scoring.md +72 -0
  139. package/skills/pixelcraft-direction/references/movements.md +68 -0
  140. package/skills/pixelcraft-direction/references/repetition-history.md +75 -0
  141. package/skills/pixelcraft-direction/references/slop-fingerprints.md +58 -0
  142. package/skills/pixelcraft-direction/references/wildcards.md +47 -0
  143. package/skills/pixelcraft-document/SKILL.md +54 -0
  144. package/skills/pixelcraft-document/references/archetypes.md +83 -0
  145. package/skills/pixelcraft-document/references/pdf-tools.md +154 -0
  146. package/skills/pixelcraft-document/references/print-css.md +134 -0
  147. package/skills/pixelcraft-document/references/slides.md +102 -0
  148. package/skills/pixelcraft-email/SKILL.md +58 -0
  149. package/skills/pixelcraft-email/references/client-quirks.md +45 -0
  150. package/skills/pixelcraft-email/references/html-tables.md +53 -0
  151. package/skills/pixelcraft-email/references/mjml.md +52 -0
  152. package/skills/pixelcraft-email/references/react-email.md +53 -0
  153. package/skills/pixelcraft-extensions/SKILL.md +51 -0
  154. package/skills/pixelcraft-extensions/references/browser-extensions.md +31 -0
  155. package/skills/pixelcraft-extensions/references/figma-office.md +23 -0
  156. package/skills/pixelcraft-extensions/references/raycast.md +19 -0
  157. package/skills/pixelcraft-extensions/references/vscode-webviews.md +26 -0
  158. package/skills/pixelcraft-game-ui/SKILL.md +61 -0
  159. package/skills/pixelcraft-game-ui/references/bevy.md +52 -0
  160. package/skills/pixelcraft-game-ui/references/godot.md +57 -0
  161. package/skills/pixelcraft-game-ui/references/hud-principles.md +38 -0
  162. package/skills/pixelcraft-game-ui/references/love2d.md +51 -0
  163. package/skills/pixelcraft-game-ui/references/monogame.md +52 -0
  164. package/skills/pixelcraft-game-ui/references/unity-ui-toolkit.md +65 -0
  165. package/skills/pixelcraft-game-ui/references/unreal-umg.md +53 -0
  166. package/skills/pixelcraft-handoff/SKILL.md +49 -0
  167. package/skills/pixelcraft-handoff/references/design-translation.md +104 -0
  168. package/skills/pixelcraft-handoff/references/fidelity-tolerance.md +78 -0
  169. package/skills/pixelcraft-media/SKILL.md +52 -0
  170. package/skills/pixelcraft-media/references/banners-video.md +112 -0
  171. package/skills/pixelcraft-media/references/og-generation.md +107 -0
  172. package/skills/pixelcraft-media/references/social-cards.md +72 -0
  173. package/skills/pixelcraft-mobile/SKILL.md +69 -0
  174. package/skills/pixelcraft-mobile/references/dotnet-maui.md +63 -0
  175. package/skills/pixelcraft-mobile/references/flet.md +53 -0
  176. package/skills/pixelcraft-mobile/references/flutter.md +69 -0
  177. package/skills/pixelcraft-mobile/references/ionic-capacitor.md +65 -0
  178. package/skills/pixelcraft-mobile/references/jetpack-compose.md +61 -0
  179. package/skills/pixelcraft-mobile/references/kivy.md +59 -0
  180. package/skills/pixelcraft-mobile/references/kotlin-multiplatform.md +60 -0
  181. package/skills/pixelcraft-mobile/references/react-native-expo.md +71 -0
  182. package/skills/pixelcraft-mobile/references/swiftui.md +70 -0
  183. package/skills/pixelcraft-mobile/references/task-state-composition.md +5 -0
  184. package/skills/pixelcraft-mobile/references/uikit.md +58 -0
  185. package/skills/pixelcraft-patterns/SKILL.md +58 -0
  186. package/skills/pixelcraft-patterns/references/auth-onboarding.md +25 -0
  187. package/skills/pixelcraft-patterns/references/commerce.md +28 -0
  188. package/skills/pixelcraft-patterns/references/communication.md +26 -0
  189. package/skills/pixelcraft-patterns/references/creative-tools.md +29 -0
  190. package/skills/pixelcraft-patterns/references/dashboard-admin.md +31 -0
  191. package/skills/pixelcraft-patterns/references/marketing.md +32 -0
  192. package/skills/pixelcraft-patterns/references/pattern-selection.md +74 -0
  193. package/skills/pixelcraft-patterns/references/search-filtering.md +42 -0
  194. package/skills/pixelcraft-patterns/references/settings.md +23 -0
  195. package/skills/pixelcraft-patterns/references/tables-crud.md +43 -0
  196. package/skills/pixelcraft-plan/SKILL.md +67 -0
  197. package/skills/pixelcraft-plan/references/design-input.md +69 -0
  198. package/skills/pixelcraft-plan/references/plan-template.md +99 -0
  199. package/skills/pixelcraft-plan/references/repo-discovery.md +42 -0
  200. package/skills/pixelcraft-plan/references/stack-freshness.md +50 -0
  201. package/skills/pixelcraft-plan/references/stack-selection.md +42 -0
  202. package/skills/pixelcraft-review/SKILL.md +64 -0
  203. package/skills/pixelcraft-review/references/audit-report.md +50 -0
  204. package/skills/pixelcraft-review/references/critique-protocol.md +89 -0
  205. package/skills/pixelcraft-review/references/heuristics.md +18 -0
  206. package/skills/pixelcraft-review/references/personas.md +26 -0
  207. package/skills/pixelcraft-review/references/polish.md +38 -0
  208. package/skills/pixelcraft-review/scripts/fixtures/brand-critique-waivers.json +14 -0
  209. package/skills/pixelcraft-review/scripts/fixtures/brand-critique.css +18 -0
  210. package/skills/pixelcraft-review/scripts/fixtures/clean.html +43 -0
  211. package/skills/pixelcraft-review/scripts/fixtures/focus-after-block.css +4 -0
  212. package/skills/pixelcraft-review/scripts/fixtures/focus-at-rules.css +17 -0
  213. package/skills/pixelcraft-review/scripts/fixtures/focus-comments.css +10 -0
  214. package/skills/pixelcraft-review/scripts/fixtures/focus-html-quote-leak.html +12 -0
  215. package/skills/pixelcraft-review/scripts/fixtures/focus-invalid-replacements.css +27 -0
  216. package/skills/pixelcraft-review/scripts/fixtures/focus-nested-rules.css +19 -0
  217. package/skills/pixelcraft-review/scripts/fixtures/focus-not-visible-skip.css +8 -0
  218. package/skills/pixelcraft-review/scripts/fixtures/focus-outline-shorthands.css +11 -0
  219. package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-and-border.css +15 -0
  220. package/skills/pixelcraft-review/scripts/fixtures/focus-unknown-last-wins.css +19 -0
  221. package/skills/pixelcraft-review/scripts/fixtures/focus-valid-replacements-extended.css +29 -0
  222. package/skills/pixelcraft-review/scripts/fixtures/focus-visible-no-replacement.css +3 -0
  223. package/skills/pixelcraft-review/scripts/fixtures/focus-visible-valid-replacements.css +9 -0
  224. package/skills/pixelcraft-review/scripts/fixtures/slop.html +28 -0
  225. package/skills/pixelcraft-review/scripts/slop-scan.mjs +586 -0
  226. package/skills/pixelcraft-spatial/SKILL.md +52 -0
  227. package/skills/pixelcraft-spatial/references/comfort-accessibility.md +98 -0
  228. package/skills/pixelcraft-spatial/references/platforms.md +77 -0
  229. package/skills/pixelcraft-tokens/SKILL.md +56 -0
  230. package/skills/pixelcraft-tokens/assets/tokens.example.json +71 -0
  231. package/skills/pixelcraft-tokens/assets/tokens.modes.example.json +47 -0
  232. package/skills/pixelcraft-tokens/references/adoption.md +55 -0
  233. package/skills/pixelcraft-tokens/references/format.md +54 -0
  234. package/skills/pixelcraft-tokens/references/governance.md +80 -0
  235. package/skills/pixelcraft-tokens/references/state-tokens.md +62 -0
  236. package/skills/pixelcraft-tokens/references/theme-presets.md +94 -0
  237. package/skills/pixelcraft-tokens/scripts/export-tokens.mjs +285 -0
  238. package/skills/pixelcraft-tui/SKILL.md +60 -0
  239. package/skills/pixelcraft-tui/references/bubbletea-lipgloss.md +60 -0
  240. package/skills/pixelcraft-tui/references/ink.md +60 -0
  241. package/skills/pixelcraft-tui/references/ratatui.md +62 -0
  242. package/skills/pixelcraft-tui/references/rich.md +62 -0
  243. package/skills/pixelcraft-tui/references/textual.md +67 -0
  244. package/skills/pixelcraft-ux/SKILL.md +46 -0
  245. package/skills/pixelcraft-ux/references/cognitive-walkthrough.md +70 -0
  246. package/skills/pixelcraft-ux/references/feedback-performance.md +30 -0
  247. package/skills/pixelcraft-ux/references/flows-ia.md +44 -0
  248. package/skills/pixelcraft-ux/references/forms.md +97 -0
  249. package/skills/pixelcraft-ux/references/i18n.md +183 -0
  250. package/skills/pixelcraft-ux/references/laws.md +18 -0
  251. package/skills/pixelcraft-ux/references/locale-test-matrix.md +60 -0
  252. package/skills/pixelcraft-ux/references/state-matrix.md +39 -0
  253. package/skills/pixelcraft-ux/references/usability-testing.md +84 -0
  254. package/skills/pixelcraft-ux/references/ux-writing.md +43 -0
  255. package/skills/pixelcraft-visual-qa/SKILL.md +82 -0
  256. package/skills/pixelcraft-visual-qa/references/baseline-governance.md +70 -0
  257. package/skills/pixelcraft-visual-qa/references/capture-desktop-game.md +38 -0
  258. package/skills/pixelcraft-visual-qa/references/capture-email.md +34 -0
  259. package/skills/pixelcraft-visual-qa/references/capture-mobile.md +35 -0
  260. package/skills/pixelcraft-visual-qa/references/capture-terminal.md +31 -0
  261. package/skills/pixelcraft-visual-qa/references/critique-rubric.md +71 -0
  262. package/skills/pixelcraft-visual-qa/references/finish-gate.md +35 -0
  263. package/skills/pixelcraft-visual-qa/references/measured-craft.md +30 -0
  264. package/skills/pixelcraft-visual-qa/references/performance-budgets.md +65 -0
  265. package/skills/pixelcraft-visual-qa/references/task-verification.md +81 -0
  266. package/skills/pixelcraft-visual-qa/scripts/finish-gate.mjs +135 -0
  267. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-aria-modal.html +19 -0
  268. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-audit.html +34 -0
  269. package/skills/pixelcraft-visual-qa/scripts/fixtures/shoot-modal.html +17 -0
  270. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-deferred.js +1 -0
  271. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory-edge.html +52 -0
  272. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.html +80 -0
  273. package/skills/pixelcraft-visual-qa/scripts/fixtures/style-inventory.js +8 -0
  274. package/skills/pixelcraft-visual-qa/scripts/shoot.mjs +513 -0
  275. package/skills/pixelcraft-visual-qa/scripts/style-inventory.mjs +1154 -0
  276. package/skills/pixelcraft-web/SKILL.md +76 -0
  277. package/skills/pixelcraft-web/references/adaptive-layout.md +25 -0
  278. package/skills/pixelcraft-web/references/angular.md +61 -0
  279. package/skills/pixelcraft-web/references/astro.md +62 -0
  280. package/skills/pixelcraft-web/references/clojurescript.md +53 -0
  281. package/skills/pixelcraft-web/references/elm.md +53 -0
  282. package/skills/pixelcraft-web/references/fsharp-fable.md +53 -0
  283. package/skills/pixelcraft-web/references/html-css.md +88 -0
  284. package/skills/pixelcraft-web/references/htmx-alpine.md +53 -0
  285. package/skills/pixelcraft-web/references/java-web.md +52 -0
  286. package/skills/pixelcraft-web/references/kotlin-web.md +53 -0
  287. package/skills/pixelcraft-web/references/leptos-yew.md +54 -0
  288. package/skills/pixelcraft-web/references/lit-web-components.md +61 -0
  289. package/skills/pixelcraft-web/references/pwa.md +225 -0
  290. package/skills/pixelcraft-web/references/qwik.md +54 -0
  291. package/skills/pixelcraft-web/references/react-next.md +69 -0
  292. package/skills/pixelcraft-web/references/scala-laminar.md +53 -0
  293. package/skills/pixelcraft-web/references/server-rendered.md +71 -0
  294. package/skills/pixelcraft-web/references/solid.md +60 -0
  295. package/skills/pixelcraft-web/references/svelte.md +61 -0
  296. package/skills/pixelcraft-web/references/tailwind.md +73 -0
  297. package/skills/pixelcraft-web/references/vue-nuxt.md +62 -0
@@ -0,0 +1,290 @@
1
+ #!/usr/bin/env node
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+
6
+ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
7
+ const skillsRoot = path.join(root, 'skills');
8
+
9
+ function help() {
10
+ return `Usage: node scripts/build-adapters.mjs [--out DIR]
11
+
12
+ Generate dependency-free agent adapter distribution fragments from skills/.
13
+ The output is a build artifact in dist/ and is not a second source of truth.
14
+
15
+ Options:
16
+ --out DIR Output directory (default: dist)
17
+ --help Show this help
18
+ `;
19
+ }
20
+
21
+ function parse(args) {
22
+ const options = { out: 'dist', help: false, explicitOut: false };
23
+ for (let index = 0; index < args.length; index += 1) {
24
+ const arg = args[index];
25
+ if (arg === '--help' || arg === '-h') options.help = true;
26
+ else if (arg === '--out') { options.out = args[++index]; options.explicitOut = true; }
27
+ else if (arg.startsWith('--out=')) { options.out = arg.slice(6); options.explicitOut = true; }
28
+ else throw new Error(`unknown option: ${arg}`);
29
+ }
30
+ return options;
31
+ }
32
+
33
+ function frontmatterValue(text, key) {
34
+ const match = new RegExp(`^${key}:[ \\t]*(?:["']?)(.+?)(?:["']?)$`, 'm').exec(text);
35
+ return match ? match[1].trim() : '';
36
+ }
37
+
38
+ function catalog() {
39
+ return fs.readdirSync(skillsRoot, { withFileTypes: true })
40
+ .filter((entry) => entry.isDirectory() && fs.existsSync(path.join(skillsRoot, entry.name, 'SKILL.md')))
41
+ .map((entry) => {
42
+ const text = fs.readFileSync(path.join(skillsRoot, entry.name, 'SKILL.md'), 'utf8');
43
+ return { name: entry.name, description: frontmatterValue(text, 'description') };
44
+ })
45
+ .sort((a, b) => a.name.localeCompare(b.name));
46
+ }
47
+
48
+ function write(file, text) {
49
+ fs.mkdirSync(path.dirname(file), { recursive: true });
50
+ fs.writeFileSync(file, text.endsWith('\n') ? text : `${text}\n`);
51
+ }
52
+
53
+ function copySkill(name, destinationRoot) {
54
+ fs.cpSync(path.join(skillsRoot, name), path.join(destinationRoot, name), { recursive: true });
55
+ }
56
+
57
+ function copyAllSkills(skills, fragmentRoot, relativeSkillsDir) {
58
+ const destination = path.join(fragmentRoot, ...relativeSkillsDir.split('/'));
59
+ fs.mkdirSync(destination, { recursive: true });
60
+ for (const skill of skills) copySkill(skill.name, destination);
61
+ }
62
+
63
+ function skillList(skills, basePath) {
64
+ return skills.map((skill) => `- \`${skill.name}\` — read \`${basePath}/${skill.name}/SKILL.md\` when its trigger matches.`).join('\n');
65
+ }
66
+
67
+ const routingText = `Use Pixelcraft for any request to design, build, redesign, review, audit, polish, or visually verify a user interface. Start with \`pixelcraft-plan\` before implementation, use the \`pixelcraft\` orchestrator for routing, choose the matching platform/pattern skills, and finish with \`pixelcraft-review\` plus \`pixelcraft-visual-qa\` when rendered verification is possible. Preserve the user's explicit brief, existing project design system, platform conventions, accessibility floor, and evidence labels.`;
68
+
69
+ function cursorRule(skills) {
70
+ return `---
71
+ description: Route UI design, implementation, review, and visual QA through Pixelcraft skills
72
+ alwaysApply: true
73
+ ---
74
+
75
+ # Pixelcraft router
76
+
77
+ ${routingText}
78
+
79
+ Do not inline or copy the skill bodies into prompts. Open the relevant self-contained skill under \`.cursor/skills/\`:
80
+
81
+ ${skillList(skills, '.cursor/skills')}
82
+ `;
83
+ }
84
+
85
+ function copilotInstructions(skills) {
86
+ return `# Pixelcraft router
87
+
88
+ ${routingText}
89
+
90
+ The complete skills are installed under \`.github/skills/\`. Read the relevant \`SKILL.md\` instead of assuming framework defaults or inlining this catalog:
91
+
92
+ ${skillList(skills, '.github/skills')}
93
+ `;
94
+ }
95
+
96
+ function copilotPathInstructions() {
97
+ return `---
98
+ applyTo: "**/*.{html,css,scss,js,jsx,ts,tsx,vue,svelte,astro,py,rb,php,cs,java,kt,swift,dart,rs,go,lua,ex,exs,clj,cljs,elm,fs,scala}"
99
+ ---
100
+
101
+ When editing interface, styling, navigation, interaction, or user-facing copy in these files, follow the Pixelcraft routing instructions in \`.github/copilot-instructions.md\` and read the matching skill under \`.github/skills/\` before implementation or review.
102
+ `;
103
+ }
104
+
105
+ function windsurfRule(skills) {
106
+ return `# Pixelcraft router
107
+
108
+ ${routingText}
109
+
110
+ Rules stay deliberately small. Read the authoritative self-contained skill under \`.windsurf/skills/\` before detailed work; do not inline large generated content here:
111
+
112
+ ${skillList(skills, '.windsurf/skills')}
113
+ `;
114
+ }
115
+
116
+ function kiroSteering(skills) {
117
+ return `# Pixelcraft steering
118
+
119
+ ${routingText}
120
+
121
+ Treat this file as a router only. Read the matching self-contained \`SKILL.md\` under \`.kiro/skills/\` before detailed implementation:
122
+
123
+ ${skillList(skills, '.kiro/skills')}
124
+ `;
125
+ }
126
+
127
+ const actions = [
128
+ ['pixelcraft', 'pixelcraft', 'Run the Pixelcraft orchestrator for UI design/build work'],
129
+ ['pixelcraft-plan', 'pixelcraft-plan', 'Run Pixelcraft step-zero planning before UI work'],
130
+ ['pixelcraft-review', 'pixelcraft-review', 'Audit or critique UI with Pixelcraft evidence rules'],
131
+ ['pixelcraft-visual-qa', 'pixelcraft-visual-qa', 'Capture and inspect rendered UI evidence'],
132
+ ['pixelcraft-direction', 'pixelcraft-direction', 'Generate divergent visual directions'],
133
+ ];
134
+
135
+ function commandBody(skill, task) {
136
+ return `${task}. Read and follow the self-contained \`${skill}\` skill available in this workspace or user installation. Do not substitute generic framework defaults; preserve the user's brief, existing design system, platform conventions, accessibility requirements, and evidence labels.`;
137
+ }
138
+
139
+ function claudeCommand(skill, task) {
140
+ return `---
141
+ description: ${task}
142
+ ---
143
+
144
+ ${commandBody(skill, task)}
145
+ `;
146
+ }
147
+
148
+ function copilotPrompt(skill, task) {
149
+ return `---
150
+ description: ${task}
151
+ ---
152
+
153
+ ${commandBody(skill, task)}
154
+ `;
155
+ }
156
+
157
+ function windsurfWorkflow(name, skill, task) {
158
+ return `# ${name}
159
+
160
+ ${task}.
161
+
162
+ ## Steps
163
+
164
+ 1. Read the self-contained \`${skill}\` skill from the installed Pixelcraft distribution or source checkout.
165
+ 2. Follow its workflow exactly, including referenced files when they match the task.
166
+ 3. Keep user requirements, existing project conventions, accessibility, and verification evidence ahead of generic model taste.
167
+ 4. Report what was rendered, statically checked, not checked, or waived using the skill's evidence labels.
168
+ `;
169
+ }
170
+
171
+ const markerName = '.pixelcraft-dist';
172
+
173
+ function comparisonPath(file) {
174
+ let current = path.resolve(file);
175
+ const missing = [];
176
+ while (!fs.existsSync(current)) {
177
+ missing.push(path.basename(current));
178
+ const parent = path.dirname(current);
179
+ if (parent === current) break;
180
+ current = parent;
181
+ }
182
+ let real = fs.realpathSync(current);
183
+ for (let index = missing.length - 1; index >= 0; index -= 1) real = path.join(real, missing[index]);
184
+ return process.platform === 'win32' || process.platform === 'darwin' ? real.toLowerCase() : real;
185
+ }
186
+
187
+ function sameOrInside(parent, child) {
188
+ const relative = path.relative(parent, child);
189
+ return relative === '' || (!relative.startsWith('..') && !path.isAbsolute(relative));
190
+ }
191
+
192
+ function prepareOutput(dist) {
193
+ let stat = null;
194
+ try {
195
+ stat = fs.lstatSync(dist);
196
+ } catch (error) {
197
+ if (error.code !== 'ENOENT') throw error;
198
+ }
199
+ if (stat?.isSymbolicLink()) throw new Error(`refusing output directory symlink: ${dist}`);
200
+ if (stat && !stat.isDirectory()) throw new Error(`output path is not a directory: ${dist}`);
201
+ if (stat) {
202
+ const entries = fs.readdirSync(dist);
203
+ if (entries.length > 0 && !entries.includes(markerName)) throw new Error(`refusing to clear non-empty output directory without ${markerName}: ${dist}`);
204
+ fs.rmSync(dist, { recursive: true, force: true });
205
+ }
206
+ fs.mkdirSync(dist, { recursive: true });
207
+ fs.writeFileSync(path.join(dist, markerName), 'generated by scripts/build-adapters.mjs; safe to replace\n');
208
+ }
209
+
210
+ function build() {
211
+ const options = parse(process.argv.slice(2));
212
+ if (options.help) {
213
+ console.log(help());
214
+ return;
215
+ }
216
+ const skills = catalog();
217
+ if (!skills.length) throw new Error('no skills found under skills/');
218
+ if (!String(options.out ?? '').trim()) throw new Error('--out must not be empty');
219
+ const dist = path.resolve(root, options.out);
220
+ const compareDist = comparisonPath(dist);
221
+ const compareRoot = comparisonPath(root);
222
+ const compareSkills = comparisonPath(skillsRoot);
223
+ if (sameOrInside(compareDist, compareRoot)) throw new Error(`refusing to remove repository root or ancestor: ${dist}`);
224
+ if (sameOrInside(compareSkills, compareDist)) throw new Error(`refusing output inside canonical skills directory: ${dist}`);
225
+ const insideDefault = sameOrInside(comparisonPath(path.join(root, 'dist')), compareDist);
226
+ if (!insideDefault && !options.explicitOut) throw new Error(`refusing implicit output outside dist/: ${dist}`);
227
+ prepareOutput(dist);
228
+
229
+ const fragments = {
230
+ claude: '.claude/skills',
231
+ codex: '.agents/skills',
232
+ cursor: '.cursor/skills',
233
+ gemini: '.gemini/skills',
234
+ copilot: '.github/skills',
235
+ opencode: '.opencode/skills',
236
+ devin: '.agents/skills',
237
+ cline: '.cline/skills',
238
+ roo: '.roo/skills',
239
+ droid: '.factory/skills',
240
+ antigravity: '.agents/skills',
241
+ };
242
+ for (const [agent, relative] of Object.entries(fragments)) copyAllSkills(skills, path.join(dist, agent), relative);
243
+ copyAllSkills(skills, path.join(dist, 'windsurf'), '.windsurf/skills');
244
+ copyAllSkills(skills, path.join(dist, 'kiro'), '.kiro/skills');
245
+
246
+ for (const [command, skill, task] of actions.slice(0, 4)) {
247
+ write(path.join(dist, 'claude/.claude/commands', `${command}.md`), claudeCommand(skill, task));
248
+ }
249
+
250
+ write(path.join(dist, 'cursor/.cursor/rules/pixelcraft.mdc'), cursorRule(skills));
251
+
252
+ write(path.join(dist, 'copilot/.github/copilot-instructions.md'), copilotInstructions(skills));
253
+ write(path.join(dist, 'copilot/.github/instructions/pixelcraft.instructions.md'), copilotPathInstructions());
254
+ for (const [command, skill, task] of actions.slice(1)) {
255
+ write(path.join(dist, 'copilot/.github/prompts', `${command}.prompt.md`), copilotPrompt(skill, task));
256
+ }
257
+
258
+ write(path.join(dist, 'windsurf/.windsurf/rules/pixelcraft.md'), windsurfRule(skills));
259
+ for (const [command, skill, task] of actions.slice(1)) {
260
+ write(path.join(dist, 'windsurf/.windsurf/workflows', `${command}.md`), windsurfWorkflow(command, skill, task));
261
+ }
262
+
263
+ write(path.join(dist, 'kiro/.kiro/steering/pixelcraft.md'), kiroSteering(skills));
264
+
265
+ const manifest = {
266
+ source: 'skills/',
267
+ generatedBy: 'scripts/build-adapters.mjs',
268
+ layout: 'each agent directory is a copyable project-root fragment',
269
+ agents: Object.keys(fragments).concat('windsurf', 'kiro').sort(),
270
+ skills: skills.map((skill) => skill.name),
271
+ };
272
+ write(path.join(dist, 'manifest.json'), `${JSON.stringify(manifest, null, 2)}\n`);
273
+ write(path.join(dist, 'README.md'), `# Pixelcraft adapter distribution
274
+
275
+ Generated from \`skills/\` by \`node scripts/build-adapters.mjs\`. Do not edit this output manually.
276
+
277
+ Each agent directory is a project-root fragment. Copy its hidden dot-directories into a project, or unpack the release archive and copy only the fragment for the agent you use. Router/rules files intentionally point to the self-contained skills instead of inlining them.
278
+ `);
279
+
280
+ console.log(`built adapters: ${Object.keys(fragments).concat('windsurf', 'kiro').sort().join(', ')}`);
281
+ console.log(`skills copied: ${skills.length}`);
282
+ console.log(`output: ${dist}`);
283
+ }
284
+
285
+ try {
286
+ build();
287
+ } catch (error) {
288
+ console.error(`build-adapters: ${error.message}`);
289
+ process.exit(1);
290
+ }
@@ -0,0 +1,61 @@
1
+ import { execFileSync } from 'node:child_process';
2
+ import { createHash } from 'node:crypto';
3
+ import fs from 'node:fs';
4
+ import os from 'node:os';
5
+ import path from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+
8
+ const root = fileURLToPath(new URL('..', import.meta.url));
9
+ const [output, ...extra] = process.argv.slice(2);
10
+ if (output === '--help' || output === '-h') {
11
+ console.log('Usage: node scripts/build-release-archives.mjs OUTPUT_DIRECTORY');
12
+ console.log('Build reproducible skill and adapter archives on Linux (requires git, GNU tar, gzip, and zip).');
13
+ process.exit(0);
14
+ }
15
+ if (!output || extra.length) throw new Error('expected OUTPUT_DIRECTORY (see --help)');
16
+
17
+ const commitTime = Number(execFileSync('git', ['log', '-1', '--format=%ct'], { cwd: root, encoding: 'utf8' }).trim());
18
+ const timestamp = new Date(commitTime * 1000);
19
+ const stage = fs.mkdtempSync(path.join(os.tmpdir(), 'pixelcraft-release-'));
20
+ const out = path.resolve(output);
21
+ const dirs = ['skills', 'adapters'];
22
+
23
+ function* archiveEntries(relativePath) {
24
+ const entry = path.join(stage, relativePath);
25
+ const stat = fs.lstatSync(entry);
26
+ const directory = stat.isDirectory();
27
+ if (!directory && !stat.isFile()) throw new Error(`unsupported archive entry: ${relativePath}`);
28
+ fs.chmodSync(entry, directory || (stat.mode & 0o111) ? 0o755 : 0o644);
29
+ fs.utimesSync(entry, timestamp, timestamp);
30
+ yield directory ? `${relativePath}/` : relativePath;
31
+ if (directory) {
32
+ for (const child of fs.readdirSync(entry).sort()) yield* archiveEntries(`${relativePath}/${child}`);
33
+ }
34
+ }
35
+
36
+ try {
37
+ fs.cpSync(path.join(root, 'skills'), path.join(stage, 'skills'), { recursive: true });
38
+ execFileSync(process.execPath, [path.join(root, 'scripts/build-adapters.mjs'), '--out', path.join(stage, 'adapters')], {
39
+ stdio: 'inherit',
40
+ });
41
+ const entries = dirs.flatMap((dir) => [...archiveEntries(dir)]);
42
+ const env = { ...process.env, TZ: 'UTC', LC_ALL: 'C', ZIPOPT: '', TAR_OPTIONS: '' };
43
+ execFileSync('zip', ['-X', '-q', 'pixelcraft-skills.zip', '-@'], {
44
+ cwd: stage,
45
+ env,
46
+ input: entries.join('\n') + '\n',
47
+ });
48
+ execFileSync('tar', ['--format=gnu', '--sort=name', `--mtime=@${commitTime}`, '--owner=0', '--group=0', '--numeric-owner',
49
+ '--use-compress-program=gzip -n', '-cf', 'pixelcraft-skills.tar.gz', ...dirs], { cwd: stage, env });
50
+ fs.mkdirSync(out, { recursive: true });
51
+ const checksumLines = [];
52
+ for (const name of ['pixelcraft-skills.zip', 'pixelcraft-skills.tar.gz']) {
53
+ const dest = path.join(out, name);
54
+ fs.copyFileSync(path.join(stage, name), dest);
55
+ const digest = createHash('sha256').update(fs.readFileSync(dest)).digest('hex');
56
+ checksumLines.push(`${digest} ${name}`);
57
+ }
58
+ fs.writeFileSync(path.join(out, 'SHA256SUMS.txt'), checksumLines.join('\n') + '\n', 'utf8');
59
+ } finally {
60
+ fs.rmSync(stage, { recursive: true, force: true });
61
+ }
@@ -0,0 +1,94 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
4
+ import { deflateRawSync } from 'node:zlib';
5
+
6
+ const root = fileURLToPath(new URL('..', import.meta.url));
7
+ const skills = path.join(root, 'skills');
8
+ const crcTable = Array.from({ length: 256 }, (_, byte) => {
9
+ for (let bit = 0; bit < 8; bit++) byte = (byte >>> 1) ^ ((byte & 1) ? 0xedb88320 : 0);
10
+ return byte;
11
+ });
12
+
13
+ function crc32(data) {
14
+ let crc = 0xffffffff;
15
+ for (const byte of data) crc = (crc >>> 8) ^ crcTable[(crc ^ byte) & 0xff];
16
+ return (crc ^ 0xffffffff) >>> 0;
17
+ }
18
+
19
+ function* files(directory) {
20
+ for (const name of fs.readdirSync(directory).sort()) {
21
+ const file = path.join(directory, name);
22
+ const stat = fs.lstatSync(file);
23
+ if (name.includes('\\') || name.includes(':')) throw new Error(`unsupported ZIP path: ${file}`);
24
+ if (stat.isDirectory()) yield* files(file);
25
+ else if (stat.isFile()) yield { file, mode: stat.mode };
26
+ else throw new Error(`refusing non-regular ZIP input: ${file}`);
27
+ }
28
+ }
29
+
30
+ function buildZip(skill) {
31
+ const local = [];
32
+ const central = [];
33
+ let offset = 0;
34
+ for (const { file, mode } of files(path.join(skills, skill))) {
35
+ const name = Buffer.from(path.relative(skills, file).split(path.sep).join('/'));
36
+ const data = fs.readFileSync(file);
37
+ const compressed = deflateRawSync(data);
38
+ const header = Buffer.alloc(30);
39
+ header.writeUInt32LE(0x04034b50, 0);
40
+ header.writeUInt16LE(20, 4);
41
+ header.writeUInt16LE(0x0800, 6);
42
+ header.writeUInt16LE(8, 8);
43
+ header.writeUInt16LE(33, 12);
44
+ header.writeUInt32LE(crc32(data), 14);
45
+ header.writeUInt32LE(compressed.length, 18);
46
+ header.writeUInt32LE(data.length, 22);
47
+ header.writeUInt16LE(name.length, 26);
48
+
49
+ const entry = Buffer.alloc(46);
50
+ entry.writeUInt32LE(0x02014b50, 0);
51
+ entry.writeUInt16LE(0x0314, 4);
52
+ header.copy(entry, 6, 4);
53
+ entry.writeUInt32LE((mode << 16) >>> 0, 38);
54
+ entry.writeUInt32LE(offset, 42);
55
+ central.push(entry, name);
56
+ local.push(header, name, compressed);
57
+ offset += header.length + name.length + compressed.length;
58
+ }
59
+
60
+ const end = Buffer.alloc(22);
61
+ end.writeUInt32LE(0x06054b50, 0);
62
+ end.writeUInt16LE(central.length / 2, 8);
63
+ end.writeUInt16LE(central.length / 2, 10);
64
+ end.writeUInt32LE(central.reduce((size, part) => size + part.length, 0), 12);
65
+ end.writeUInt32LE(offset, 16);
66
+ return Buffer.concat([...local, ...central, end]);
67
+ }
68
+
69
+ const args = process.argv.slice(2);
70
+ if (args.includes('--help') || args.includes('-h')) {
71
+ console.log('Usage: node scripts/build-skill-zips.mjs [--out DIRECTORY]');
72
+ console.log('Build one upload ZIP per canonical skill (default: skill-zips/).');
73
+ process.exit(0);
74
+ }
75
+
76
+ try {
77
+ if (args.length !== 0 && (args.length !== 2 || args[0] !== '--out' || args[1].startsWith('-'))) {
78
+ throw new Error('expected --out DIRECTORY (see --help)');
79
+ }
80
+ const out = args.length ? path.resolve(args[1]) : path.join(root, 'skill-zips');
81
+ const names = fs.readdirSync(skills, { withFileTypes: true })
82
+ .filter((entry) => entry.isDirectory() && fs.existsSync(path.join(skills, entry.name, 'SKILL.md')))
83
+ .map((entry) => entry.name)
84
+ .sort();
85
+ fs.mkdirSync(out, { recursive: true });
86
+ for (const name of names) {
87
+ const target = path.join(out, `${name}.zip`);
88
+ fs.writeFileSync(target, buildZip(name), { flag: 'wx' });
89
+ }
90
+ console.log(`Built ${names.length} skill ZIPs in ${out}`);
91
+ } catch (error) {
92
+ console.error(`build-skill-zips: ${error.message}`);
93
+ process.exitCode = 1;
94
+ }
@@ -0,0 +1,48 @@
1
+ #!/usr/bin/env node
2
+ import assert from 'node:assert/strict';
3
+ import { spawnSync } from 'node:child_process';
4
+ import fs from 'node:fs';
5
+ import os from 'node:os';
6
+ import path from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
8
+
9
+ const root = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
10
+ const script = path.join(root, 'scripts/build-adapters.mjs');
11
+ const base = fs.mkdtempSync(path.join(os.tmpdir(), 'pixelcraft-build-adapters-'));
12
+
13
+ function run(out) {
14
+ return spawnSync(process.execPath, [script, '--out', out], { encoding: 'utf8' });
15
+ }
16
+
17
+ try {
18
+ const nonMarker = path.join(base, 'non-marker');
19
+ fs.mkdirSync(nonMarker, { recursive: true });
20
+ fs.writeFileSync(path.join(nonMarker, 'user-file.txt'), 'do not delete\n');
21
+ const refused = run(nonMarker);
22
+ assert.notEqual(refused.status, 0);
23
+ assert.match(refused.stderr, /refusing to clear non-empty output directory without \.pixelcraft-dist/);
24
+ assert.equal(fs.readFileSync(path.join(nonMarker, 'user-file.txt'), 'utf8'), 'do not delete\n');
25
+ console.log('ok 1 - refuses a non-empty directory without the marker');
26
+
27
+ const marked = path.join(base, 'marked');
28
+ fs.mkdirSync(marked, { recursive: true });
29
+ fs.writeFileSync(path.join(marked, '.pixelcraft-dist'), 'generated\n');
30
+ fs.writeFileSync(path.join(marked, 'stale.txt'), 'replace me\n');
31
+ const rebuilt = run(marked);
32
+ assert.equal(rebuilt.status, 0, rebuilt.stderr);
33
+ assert.equal(fs.existsSync(path.join(marked, 'stale.txt')), false);
34
+ assert.equal(fs.existsSync(path.join(marked, '.pixelcraft-dist')), true);
35
+ assert.equal(fs.existsSync(path.join(marked, 'manifest.json')), true);
36
+ console.log('ok 2 - clears and rebuilds a directory containing the marker');
37
+
38
+ const empty = path.join(base, 'empty');
39
+ fs.mkdirSync(empty, { recursive: true });
40
+ const accepted = run(empty);
41
+ assert.equal(accepted.status, 0, accepted.stderr);
42
+ assert.equal(fs.existsSync(path.join(empty, '.pixelcraft-dist')), true);
43
+ assert.equal(fs.existsSync(path.join(empty, 'manifest.json')), true);
44
+ console.log('ok 3 - accepts an empty output directory');
45
+ console.log('adapter output safety tests passed');
46
+ } finally {
47
+ fs.rmSync(base, { recursive: true, force: true });
48
+ }
@@ -0,0 +1,124 @@
1
+ import assert from 'node:assert/strict';
2
+ import { execFileSync } from 'node:child_process';
3
+ import fs from 'node:fs';
4
+ import os from 'node:os';
5
+ import path from 'node:path';
6
+ import { fileURLToPath } from 'node:url';
7
+ import { inflateRawSync } from 'node:zlib';
8
+
9
+ if (process.argv.includes('--help')) {
10
+ console.log('Usage: npm run test:distribution -- [--release]');
11
+ process.exit(0);
12
+ }
13
+
14
+ const root = fileURLToPath(new URL('..', import.meta.url));
15
+ const json = (relativePath) => JSON.parse(fs.readFileSync(path.join(root, relativePath), 'utf8'));
16
+ const pkg = json('package.json');
17
+ const portable = json('plugin.json');
18
+ const claudeCatalog = json('.claude-plugin/marketplace.json');
19
+ const claudePlugin = json('.claude-plugin/plugin.json');
20
+ const codexCatalog = json('.agents/plugins/marketplace.json');
21
+ const gemini = json('gemini-extension.json');
22
+ const skillDirectories = fs.readdirSync(path.join(root, 'skills'), { withFileTypes: true })
23
+ .filter((entry) => entry.isDirectory() && fs.existsSync(path.join(root, 'skills', entry.name, 'SKILL.md')))
24
+ .map((entry) => `./skills/${entry.name}`)
25
+ .sort();
26
+
27
+ assert.equal(claudeCatalog.plugins.length, 1);
28
+ const [claude] = claudeCatalog.plugins;
29
+ for (const manifest of [portable, claude, gemini]) {
30
+ assert.equal(manifest.name, 'pixelcraft');
31
+ assert.equal(manifest.version, pkg.version);
32
+ }
33
+ assert.equal(claude.source, './');
34
+ assert.equal(claudePlugin.name, claude.name);
35
+ assert.equal(claudePlugin.version, pkg.version);
36
+ assert.equal(claude.strict, undefined);
37
+ assert.equal(claude.skills, undefined, 'Claude discovers the canonical skills/ directory from the plugin root');
38
+ assert.equal(codexCatalog.plugins[0].name, portable.name);
39
+ assert.equal(codexCatalog.plugins[0].source.source, 'local');
40
+ assert.equal(path.resolve(root, codexCatalog.plugins[0].source.path), path.resolve(root));
41
+ assert.equal(portable.extensions['com.openai'].interface.displayName, codexCatalog.interface.displayName);
42
+ assert.deepEqual(pkg.pi.skills, ['./skills']);
43
+ console.log('ok - native manifests share the canonical skill root and package version');
44
+
45
+ if (process.argv.includes('--release')) {
46
+ assert.equal(process.env.GITHUB_REF, `refs/tags/v${pkg.version}`, 'the release tag must match package.json');
47
+ }
48
+
49
+ const packArgs = ['pack', '--dry-run', '--json'];
50
+ const npmCli = process.env.npm_execpath;
51
+ const rawPack = JSON.parse(execFileSync(npmCli ? process.execPath : 'npm', npmCli ? [npmCli, ...packArgs] : packArgs, {
52
+ cwd: root,
53
+ encoding: 'utf8',
54
+ }));
55
+ const pack = Array.isArray(rawPack) ? rawPack[0] : (rawPack.files ? rawPack : rawPack[pkg.name] || Object.values(rawPack)[0]);
56
+ assert.equal(pack.name, '@thanhnguyxn/pixelcraft');
57
+ assert.equal(pkg.publishConfig.access, 'public');
58
+ assert.deepEqual(pkg.bin, { pixelcraft: 'bin/pixelcraft.mjs' });
59
+ const files = new Set(pack.files.map((entry) => entry.path));
60
+ for (const expected of ['package.json', pkg.bin.pixelcraft, 'plugin.json', 'gemini-extension.json', 'scripts/build-skill-zips.mjs',
61
+ '.claude-plugin/marketplace.json', '.claude-plugin/plugin.json', '.agents/plugins/marketplace.json', 'assets/pixelcraft-logo-512.png']) {
62
+ assert.ok(files.has(expected), `missing from npm package: ${expected}`);
63
+ }
64
+ for (const directory of skillDirectories) {
65
+ const skill = `${directory.slice(2)}/SKILL.md`;
66
+ assert.ok(files.has(skill), `missing from npm package: ${skill}`);
67
+ }
68
+ console.log(`ok - npm pack --dry-run includes the CLI, host manifests, and canonical skills for ${pack.name}@${pack.version}`);
69
+
70
+ function countFiles(folder) {
71
+ return fs.readdirSync(folder, { withFileTypes: true }).reduce((count, entry) =>
72
+ count + (entry.isDirectory() ? countFiles(path.join(folder, entry.name)) : Number(entry.isFile())), 0);
73
+ }
74
+
75
+ const output = fs.mkdtempSync(path.join(os.tmpdir(), 'pixelcraft-skill-zips-'));
76
+ try {
77
+ execFileSync(process.execPath, [path.join(root, 'scripts/build-skill-zips.mjs'), '--out', output]);
78
+ assert.deepEqual(fs.readdirSync(output).sort(), skillDirectories.map((directory) => `${path.basename(directory)}.zip`).sort());
79
+ for (const directory of skillDirectories) {
80
+ const folder = path.basename(directory);
81
+ const zip = fs.readFileSync(path.join(output, `${folder}.zip`));
82
+ const end = zip.length - 22;
83
+ assert.equal(zip.readUInt32LE(end), 0x06054b50);
84
+ let cursor = zip.readUInt32LE(end + 16);
85
+ const entries = new Set();
86
+ for (let n = 0; n < zip.readUInt16LE(end + 10); n++) {
87
+ assert.equal(zip.readUInt32LE(cursor), 0x02014b50);
88
+ const nameLength = zip.readUInt16LE(cursor + 28);
89
+ const name = zip.toString('utf8', cursor + 46, cursor + 46 + nameLength);
90
+ assert.ok(name.startsWith(`${folder}/`) && !name.split('/').includes('..') && !entries.has(name), name);
91
+ entries.add(name);
92
+ const local = zip.readUInt32LE(cursor + 42);
93
+ const start = local + 30 + zip.readUInt16LE(local + 26);
94
+ assert.deepEqual(inflateRawSync(zip.subarray(start, start + zip.readUInt32LE(cursor + 20))),
95
+ fs.readFileSync(path.join(root, 'skills', name)), name);
96
+ cursor += 46 + nameLength;
97
+ }
98
+ assert.equal(entries.size, countFiles(path.join(root, directory)));
99
+ assert.ok(entries.has(`${folder}/SKILL.md`));
100
+ }
101
+ console.log(`ok - all ${skillDirectories.length} upload ZIPs contain one canonical skill and all its bundled files`);
102
+ } finally {
103
+ fs.rmSync(output, { recursive: true, force: true });
104
+ }
105
+
106
+ const checkout = fs.mkdtempSync(path.join(os.tmpdir(), 'pixelcraft-default-builds-'));
107
+ try {
108
+ fs.cpSync(path.join(root, 'skills'), path.join(checkout, 'skills'), { recursive: true });
109
+ fs.cpSync(path.join(root, 'scripts'), path.join(checkout, 'scripts'), { recursive: true });
110
+ const run = (script) => execFileSync(process.execPath, [path.join(checkout, 'scripts', script)]);
111
+ run('build-skill-zips.mjs');
112
+ const archive = path.join(checkout, 'skill-zips', 'pixelcraft.zip');
113
+ const original = fs.readFileSync(archive);
114
+ run('build-adapters.mjs');
115
+ run('build-adapters.mjs');
116
+ assert.deepEqual(fs.readFileSync(archive), original);
117
+ fs.rmSync(path.dirname(archive), { recursive: true });
118
+ run('build-skill-zips.mjs');
119
+ assert.deepEqual(fs.readFileSync(archive), original);
120
+ assert.ok(fs.existsSync(path.join(checkout, 'dist', 'manifest.json')));
121
+ console.log('ok - default skill ZIPs and adapters can build in either order and survive adapter rebuilds');
122
+ } finally {
123
+ fs.rmSync(checkout, { recursive: true, force: true });
124
+ }