@joiner-platform/cli 0.0.0-stage → 0.1.1

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 (303) hide show
  1. package/README.md +30 -2
  2. package/bundled-resources/poe-tile-templates/base/CLAUDE.md +72 -0
  3. package/bundled-resources/poe-tile-templates/base/README.md +7 -0
  4. package/bundled-resources/poe-tile-templates/base/_bunfig.toml +8 -0
  5. package/bundled-resources/poe-tile-templates/base/_gitignore +18 -0
  6. package/bundled-resources/poe-tile-templates/base/client.ts +12 -0
  7. package/bundled-resources/poe-tile-templates/base/package.json +36 -0
  8. package/bundled-resources/poe-tile-templates/base/playwright.config.ts +38 -0
  9. package/bundled-resources/poe-tile-templates/base/scripts/check-source.ts +148 -0
  10. package/bundled-resources/poe-tile-templates/base/scripts/dev.ts +19 -0
  11. package/bundled-resources/poe-tile-templates/base/scripts/doctor.sh +29 -0
  12. package/bundled-resources/poe-tile-templates/base/scripts/visual-check.ts +64 -0
  13. package/bundled-resources/poe-tile-templates/base/synced-store/backend-config.ts +9 -0
  14. package/bundled-resources/poe-tile-templates/base/synced-store/client-config.ts +8 -0
  15. package/bundled-resources/poe-tile-templates/base/synced-store/data/items.ts +16 -0
  16. package/bundled-resources/poe-tile-templates/base/synced-store/mutators/index.ts +10 -0
  17. package/bundled-resources/poe-tile-templates/base/synced-store/mutators/remove-todo.ts +5 -0
  18. package/bundled-resources/poe-tile-templates/base/synced-store/mutators/set-todo.ts +20 -0
  19. package/bundled-resources/poe-tile-templates/base/synced-store/mutators/types.ts +5 -0
  20. package/bundled-resources/poe-tile-templates/base/synced-store/mutators.test.ts +138 -0
  21. package/bundled-resources/poe-tile-templates/base/synced-store/schema.ts +40 -0
  22. package/bundled-resources/poe-tile-templates/base/tests/e2e.test.playwright.ts +92 -0
  23. package/bundled-resources/poe-tile-templates/base/tests/mobile-viewport.test.playwright.ts +111 -0
  24. package/bundled-resources/poe-tile-templates/base/tests/render-check.test.playwright.ts +128 -0
  25. package/bundled-resources/poe-tile-templates/base/tests/screenshot.test.playwright.ts +86 -0
  26. package/bundled-resources/poe-tile-templates/base/tests/setup-dom.ts +70 -0
  27. package/bundled-resources/poe-tile-templates/base/tile/src/backend.ts +3 -0
  28. package/bundled-resources/poe-tile-templates/base/tile/styles.css +47 -0
  29. package/bundled-resources/poe-tile-templates/base/tsconfig.json +13 -0
  30. package/bundled-resources/poe-tile-templates/coverage.config.json +6 -0
  31. package/bundled-resources/poe-tile-templates/index.ts +27 -0
  32. package/bundled-resources/poe-tile-templates/package.json +31 -0
  33. package/bundled-resources/poe-tile-templates/phaserjs/package.partial.json +6 -0
  34. package/bundled-resources/poe-tile-templates/phaserjs/tile/index.html +14 -0
  35. package/bundled-resources/poe-tile-templates/phaserjs/tile/src/entry.ts +35 -0
  36. package/bundled-resources/poe-tile-templates/phaserjs/ui/App.test.happydom.tsx +98 -0
  37. package/bundled-resources/poe-tile-templates/phaserjs/ui/App.ts +180 -0
  38. package/bundled-resources/poe-tile-templates/phaserjs/ui/phaser-scene.ts +174 -0
  39. package/bundled-resources/poe-tile-templates/phaserjs/vite.config.ts +28 -0
  40. package/bundled-resources/poe-tile-templates/preact/package.partial.json +9 -0
  41. package/bundled-resources/poe-tile-templates/preact/postcss.config.js +5 -0
  42. package/bundled-resources/poe-tile-templates/preact/tile/index.html +14 -0
  43. package/bundled-resources/poe-tile-templates/preact/tile/src/entry.tsx +36 -0
  44. package/bundled-resources/poe-tile-templates/preact/tile/styles.css +51 -0
  45. package/bundled-resources/poe-tile-templates/preact/tsconfig.json +15 -0
  46. package/bundled-resources/poe-tile-templates/preact/ui/App.test.happydom.tsx +69 -0
  47. package/bundled-resources/poe-tile-templates/preact/ui/App.tsx +116 -0
  48. package/bundled-resources/poe-tile-templates/preact/vite.config.ts +18 -0
  49. package/bundled-resources/poe-tile-templates/react/package.partial.json +12 -0
  50. package/bundled-resources/poe-tile-templates/react/postcss.config.js +5 -0
  51. package/bundled-resources/poe-tile-templates/react/tile/index.html +14 -0
  52. package/bundled-resources/poe-tile-templates/react/tile/src/entry.tsx +38 -0
  53. package/bundled-resources/poe-tile-templates/react/tile/styles.css +51 -0
  54. package/bundled-resources/poe-tile-templates/react/tsconfig.json +14 -0
  55. package/bundled-resources/poe-tile-templates/react/ui/App.test.happydom.tsx +71 -0
  56. package/bundled-resources/poe-tile-templates/react/ui/App.tsx +110 -0
  57. package/bundled-resources/poe-tile-templates/react/vite.config.ts +21 -0
  58. package/bundled-resources/poe-tile-templates/scripts/cleanup.ts +10 -0
  59. package/bundled-resources/poe-tile-templates/scripts/generate.ts +57 -0
  60. package/bundled-resources/poe-tile-templates/scripts/install-diagnostics.ts +52 -0
  61. package/bundled-resources/poe-tile-templates/scripts/paths.ts +7 -0
  62. package/bundled-resources/poe-tile-templates/scripts/sdk-dependency-key.ts +288 -0
  63. package/bundled-resources/poe-tile-templates/scripts/verify-all-sdks.ts +132 -0
  64. package/bundled-resources/poe-tile-templates/scripts/verify-local-sdk-command.ts +30 -0
  65. package/bundled-resources/poe-tile-templates/scripts/verify-local-sdk-tarball.ts +397 -0
  66. package/bundled-resources/poe-tile-templates/solidjs/_bunfig.toml +14 -0
  67. package/bundled-resources/poe-tile-templates/solidjs/package.partial.json +13 -0
  68. package/bundled-resources/poe-tile-templates/solidjs/postcss.config.js +5 -0
  69. package/bundled-resources/poe-tile-templates/solidjs/tests/solid-plugin.ts +49 -0
  70. package/bundled-resources/poe-tile-templates/solidjs/tile/index.html +14 -0
  71. package/bundled-resources/poe-tile-templates/solidjs/tile/src/entry.tsx +36 -0
  72. package/bundled-resources/poe-tile-templates/solidjs/tile/styles.css +51 -0
  73. package/bundled-resources/poe-tile-templates/solidjs/tsconfig.json +15 -0
  74. package/bundled-resources/poe-tile-templates/solidjs/ui/App.test.happydom.tsx +70 -0
  75. package/bundled-resources/poe-tile-templates/solidjs/ui/App.tsx +129 -0
  76. package/bundled-resources/poe-tile-templates/solidjs/vite.config.ts +18 -0
  77. package/bundled-resources/poe-tile-templates/tests/check-source.test.ts +131 -0
  78. package/bundled-resources/poe-tile-templates/tests/dev-script.test.slow.ts +166 -0
  79. package/bundled-resources/poe-tile-templates/tests/fixtures/customized-manager.ts +67 -0
  80. package/bundled-resources/poe-tile-templates/tests/fixtures/extended-mutators.ts.txt +106 -0
  81. package/bundled-resources/poe-tile-templates/tests/fixtures/multiplayer-verification.test.playwright.ts.txt +103 -0
  82. package/bundled-resources/poe-tile-templates/tests/fixtures/replace-starter-schema.ts +67 -0
  83. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/phaserjs.tsx.txt +85 -0
  84. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/preact.tsx.txt +69 -0
  85. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/react.tsx.txt +73 -0
  86. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/seating.ts.txt +54 -0
  87. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/solidjs.tsx.txt +70 -0
  88. package/bundled-resources/poe-tile-templates/tests/fixtures/starter-demo/vanilla-js.tsx.txt +85 -0
  89. package/bundled-resources/poe-tile-templates/tests/generated-templates.test.ts +278 -0
  90. package/bundled-resources/poe-tile-templates/tests/happy-dom-version.test.ts +27 -0
  91. package/bundled-resources/poe-tile-templates/tests/install-diagnostics.test.ts +99 -0
  92. package/bundled-resources/poe-tile-templates/tests/native-gesture-defaults.test.ts +23 -0
  93. package/bundled-resources/poe-tile-templates/tests/playwright-version.test.ts +84 -0
  94. package/bundled-resources/poe-tile-templates/tests/render-check-scaffold.test.ts +56 -0
  95. package/bundled-resources/poe-tile-templates/tests/sdk-dependency-key.test.ts +129 -0
  96. package/bundled-resources/poe-tile-templates/tests/visual-check.test.ts +90 -0
  97. package/bundled-resources/poe-tile-templates/vanilla-js/package.partial.json +3 -0
  98. package/bundled-resources/poe-tile-templates/vanilla-js/tile/index.html +14 -0
  99. package/bundled-resources/poe-tile-templates/vanilla-js/tile/src/entry.ts +35 -0
  100. package/bundled-resources/poe-tile-templates/vanilla-js/ui/App.test.happydom.tsx +96 -0
  101. package/bundled-resources/poe-tile-templates/vanilla-js/ui/App.ts +113 -0
  102. package/bundled-resources/poe-tile-templates/vanilla-js/vite.config.ts +17 -0
  103. package/cli.ts +134 -0
  104. package/index.ts +96 -0
  105. package/package.json +48 -5
  106. package/skills/audio-generation/.generated-by-poe-templated-docs +0 -0
  107. package/skills/audio-generation/SKILL.md +125 -0
  108. package/skills/finish-prototype/.generated-by-poe-templated-docs +0 -0
  109. package/skills/finish-prototype/SKILL.md +22 -0
  110. package/skills/help-me-build/.generated-by-poe-templated-docs +0 -0
  111. package/skills/help-me-build/SKILL.md +56 -0
  112. package/skills/image-generation/.generated-by-poe-templated-docs +0 -0
  113. package/skills/image-generation/SKILL.md +128 -0
  114. package/skills/one-shot/.generated-by-poe-templated-docs +0 -0
  115. package/skills/one-shot/SKILL.md +22 -0
  116. package/skills/platform-prototype/.generated-by-poe-templated-docs +0 -0
  117. package/skills/platform-prototype/SKILL.md +60 -0
  118. package/skills/platform-subagent/.generated-by-poe-templated-docs +0 -0
  119. package/skills/platform-subagent/SKILL.md +16 -0
  120. package/skills/poe-tiles-cli/.generated-by-poe-templated-docs +0 -0
  121. package/skills/poe-tiles-cli/SKILL.md +609 -0
  122. package/skills/poe-tiles-cli/references/device-motion.md +40 -0
  123. package/skills/poe-tiles-cli/references/player-updates.md +41 -0
  124. package/skills/prototype/.generated-by-poe-templated-docs +0 -0
  125. package/skills/prototype/SKILL.md +149 -0
  126. package/skills/publish/.generated-by-poe-templated-docs +0 -0
  127. package/skills/publish/SKILL.md +73 -0
  128. package/skills/synced-store/.generated-by-poe-templated-docs +0 -0
  129. package/skills/synced-store/SKILL.md +583 -0
  130. package/skills/synced-store/references/actions.md +85 -0
  131. package/skills/synced-store/references/api-patterns.md +245 -0
  132. package/skills/synced-store/references/architecture-scaling-and-performance.md +280 -0
  133. package/skills/synced-store/references/client-api-reference.md +263 -0
  134. package/skills/synced-store/references/data-visibility.md +95 -0
  135. package/skills/synced-store/references/external-stores.md +162 -0
  136. package/skills/synced-store/references/file-uploads.md +216 -0
  137. package/skills/synced-store/references/getting-user-info-of-members.md +228 -0
  138. package/skills/synced-store/references/limitations.md +72 -0
  139. package/skills/synced-store/references/live-data-limit-hook.md +131 -0
  140. package/skills/synced-store/references/mutator-rules.md +169 -0
  141. package/skills/synced-store/references/platform.md +49 -0
  142. package/skills/synced-store/references/schema-and-bindings.md +85 -0
  143. package/skills/synced-store/references/schema-libraries.md +57 -0
  144. package/skills/synced-store/references/schema-migrations.md +119 -0
  145. package/skills/synced-store/references/searchable-tables.md +27 -0
  146. package/skills/synced-store/references/server-forking.md +115 -0
  147. package/skills/synced-store/references/singleton-tables.md +61 -0
  148. package/skills/synced-store/references/sort-keys.md +253 -0
  149. package/skills/synced-store/references/ui-patterns.md +95 -0
  150. package/skills/tile-creator/.generated-by-poe-templated-docs +0 -0
  151. package/skills/tile-creator/SKILL.md +197 -0
  152. package/skills/tile-creator/references/assets.md +124 -0
  153. package/skills/tile-creator/references/backend-api.md +354 -0
  154. package/skills/tile-creator/references/cli-limitations.md +64 -0
  155. package/skills/tile-creator/references/cli.md +604 -0
  156. package/skills/tile-creator/references/client-api.md +2407 -0
  157. package/skills/tile-creator/references/composing-apps.md +166 -0
  158. package/skills/tile-creator/references/e2e-tests.md +55 -0
  159. package/skills/tile-creator/references/game-ux-best-practices.md +57 -0
  160. package/skills/tile-creator/references/migrating-pre-rename-tiles.md +79 -0
  161. package/skills/tile-creator/references/multiplayer-api-recipe.md +205 -0
  162. package/skills/tile-creator/references/native-results.md +100 -0
  163. package/skills/tile-creator/references/platform-integration.md +201 -0
  164. package/skills/tile-creator/references/power-report.md +199 -0
  165. package/skills/tile-creator/references/publish-rollout.md +166 -0
  166. package/skills/tile-creator/references/publishing.md +33 -0
  167. package/skills/tile-creator/references/push-notification-guidelines.md +58 -0
  168. package/skills/tile-creator/references/render-check.md +266 -0
  169. package/skills/tile-creator/references/running-the-client-api-on-a-server-owned-by-the-user.md +95 -0
  170. package/skills/tile-creator/references/safe-area-insets.md +79 -0
  171. package/skills/tile-creator/references/sandbox-limitations.md +32 -0
  172. package/skills/tile-creator/references/scaffolded-tile-folder-structure.md +48 -0
  173. package/skills/tile-creator/references/scaffolding-a-new-app.md +202 -0
  174. package/skills/tile-creator/references/simulations.md +125 -0
  175. package/skills/tile-creator/references/synced-store-client-reference.md +92 -0
  176. package/skills/tile-creator/references/troubleshooting.md +22 -0
  177. package/skills/tile-creator/references/turn-based-mutator.md +43 -0
  178. package/skills/tile-creator/references/user-erasure.md +14 -0
  179. package/skills/tile-creator/references/vite-plugin.md +166 -0
  180. package/skills/tile-creator/references/workspace-retention.md +72 -0
  181. package/src/admin-conversions-client.ts +28 -0
  182. package/src/admin-reviews-client.ts +36 -0
  183. package/src/api.generated.ts +1527 -0
  184. package/src/auth-token.ts +198 -0
  185. package/src/bounded-read.ts +35 -0
  186. package/src/bun-version.ts +33 -0
  187. package/src/checkout-base.ts +207 -0
  188. package/src/cli-bun-version.ts +16 -0
  189. package/src/cli-env.ts +28 -0
  190. package/src/cli-name.ts +23 -0
  191. package/src/client.ts +2474 -0
  192. package/src/collect-files.ts +226 -0
  193. package/src/commands/accounts.ts +55 -0
  194. package/src/commands/admin-abandon-conversion.ts +60 -0
  195. package/src/commands/admin-reviews.ts +66 -0
  196. package/src/commands/admin.ts +219 -0
  197. package/src/commands/auth.ts +89 -0
  198. package/src/commands/checkout-prototype.ts +67 -0
  199. package/src/commands/creator-source-capability.ts +11 -0
  200. package/src/commands/doctor-bun.ts +145 -0
  201. package/src/commands/doctor-command.ts +64 -0
  202. package/src/commands/doctor-package-json.ts +47 -0
  203. package/src/commands/doctor-sdk-pin.ts +156 -0
  204. package/src/commands/doctor-store-keys-lexer.ts +213 -0
  205. package/src/commands/doctor-store-keys-scan.ts +262 -0
  206. package/src/commands/doctor-store-keys.ts +196 -0
  207. package/src/commands/doctor.ts +371 -0
  208. package/src/commands/init/blank-scaffold-templates.ts +397 -0
  209. package/src/commands/init/index.ts +170 -0
  210. package/src/commands/init/internal-toolchain.ts +49 -0
  211. package/src/commands/init/manager-test-template.ts +107 -0
  212. package/src/commands/init/multiplayer-test-template.ts +217 -0
  213. package/src/commands/init/name-input.tsx +167 -0
  214. package/src/commands/init/no-store-scaffold-templates.ts +281 -0
  215. package/src/commands/init/no-store-scaffold.ts +134 -0
  216. package/src/commands/init/package-json-scripts.ts +72 -0
  217. package/src/commands/init/scaffold.ts +960 -0
  218. package/src/commands/init/sdk-tarball-url.generated.ts +4 -0
  219. package/src/commands/init/sdk-tarball-url.ts +31 -0
  220. package/src/commands/init/template-picker.tsx +147 -0
  221. package/src/commands/inspect-child-entry.ts +107 -0
  222. package/src/commands/inspect-contract.ts +87 -0
  223. package/src/commands/inspect-freshness.ts +217 -0
  224. package/src/commands/inspect-lock.ts +201 -0
  225. package/src/commands/inspect-options.ts +360 -0
  226. package/src/commands/inspect-orchestrate.ts +375 -0
  227. package/src/commands/inspect-process.ts +172 -0
  228. package/src/commands/inspect-ready.ts +65 -0
  229. package/src/commands/inspect-report.ts +235 -0
  230. package/src/commands/inspect-run-state.ts +296 -0
  231. package/src/commands/inspect-run.ts +157 -0
  232. package/src/commands/inspect-watchdog.ts +74 -0
  233. package/src/commands/install-joiner.ts +208 -0
  234. package/src/commands/login.ts +308 -0
  235. package/src/commands/models.ts +40 -0
  236. package/src/commands/parse-options.ts +36 -0
  237. package/src/commands/remix-package-json.ts +64 -0
  238. package/src/commands/remix.ts +379 -0
  239. package/src/commands/sdk-url.ts +141 -0
  240. package/src/commands/simulations.ts +133 -0
  241. package/src/commands/skills.ts +108 -0
  242. package/src/commands/store-files.ts +92 -0
  243. package/src/commands/stores.ts +703 -0
  244. package/src/commands/tiles-channel-commands.ts +115 -0
  245. package/src/commands/tiles-checkout.ts +351 -0
  246. package/src/commands/tiles-gallery-command.ts +95 -0
  247. package/src/commands/tiles-get-helpers.ts +27 -0
  248. package/src/commands/tiles-inspect.ts +276 -0
  249. package/src/commands/tiles-power-command.ts +308 -0
  250. package/src/commands/tiles-power-format.ts +396 -0
  251. package/src/commands/tiles-power-versions.ts +299 -0
  252. package/src/commands/tiles-publish-helpers.ts +145 -0
  253. package/src/commands/tiles-upload-command.ts +277 -0
  254. package/src/commands/tiles-version-commands.ts +201 -0
  255. package/src/commands/tiles-visibility-command.ts +103 -0
  256. package/src/commands/tiles.ts +257 -0
  257. package/src/commands/upgrade.ts +307 -0
  258. package/src/commit-in-progress.ts +42 -0
  259. package/src/creator-source-context.ts +97 -0
  260. package/src/creator-source-publish.ts +52 -0
  261. package/src/deferred-assets.ts +125 -0
  262. package/src/distribution.ts +28 -0
  263. package/src/errors.ts +61 -0
  264. package/src/install-command.ts +43 -0
  265. package/src/output.ts +62 -0
  266. package/src/poe-tile-config-files.ts +100 -0
  267. package/src/poe-tile-config-players.ts +168 -0
  268. package/src/poe-tile-config-remix.ts +166 -0
  269. package/src/poe-tile-config.ts +831 -0
  270. package/src/power-report-client.ts +55 -0
  271. package/src/prototype-startup.ts +21 -0
  272. package/src/publish-change-summary.ts +55 -0
  273. package/src/publish-overrides-validation.ts +49 -0
  274. package/src/publish-pack.ts +167 -0
  275. package/src/publish-phases.ts +57 -0
  276. package/src/publish-retry.ts +51 -0
  277. package/src/publish-tile-from-config.ts +434 -0
  278. package/src/recorder-stream.ts +169 -0
  279. package/src/remix-provenance.ts +156 -0
  280. package/src/resolve-client-credential.ts +71 -0
  281. package/src/resolve-media-uploads.ts +147 -0
  282. package/src/sdk-dependency.ts +54 -0
  283. package/src/sdk-skills.ts +85 -0
  284. package/src/should-skip-client-setup.ts +20 -0
  285. package/src/simulation-snapshot.ts +123 -0
  286. package/src/simulation-types.ts +74 -0
  287. package/src/simulations-client.ts +112 -0
  288. package/src/source-bundle.ts +466 -0
  289. package/src/staged-publish-cleanup.ts +44 -0
  290. package/src/staged-publish-deferred.ts +160 -0
  291. package/src/staged-publish.ts +401 -0
  292. package/src/store-file-upload.ts +268 -0
  293. package/src/store-request.ts +168 -0
  294. package/src/tar-canonical.ts +41 -0
  295. package/src/tar-extensions.ts +159 -0
  296. package/src/tar-extract.ts +193 -0
  297. package/src/tar-parse.ts +224 -0
  298. package/src/tar.ts +231 -0
  299. package/src/template-check-scripts.ts +18 -0
  300. package/src/tile-gallery-client.ts +82 -0
  301. package/src/types.ts +258 -0
  302. package/src/upload-concurrency.ts +54 -0
  303. package/src/whole-tile.ts +52 -0
@@ -0,0 +1,278 @@
1
+ // owner: jyoung-q
2
+ /**
3
+ * Verifies that generated templates work: mutator tests pass and vite build succeeds.
4
+ *
5
+ * Prerequisites: run `bun run generate` first to scaffold templates into
6
+ * generated-apps/template-<name>/.
7
+ *
8
+ * Cleanup: run `bun run generate:cleanup` after to remove generated dirs.
9
+ */
10
+
11
+ import { describe, expect, test } from "bun:test";
12
+ import { existsSync, rmSync, writeFileSync } from "node:fs";
13
+ import { join } from "node:path";
14
+ import { TEMPLATES } from "..";
15
+ import { GENERATED_APPS_DIR } from "../scripts/paths.ts";
16
+
17
+ function generatedDir(template: string): string {
18
+ return join(GENERATED_APPS_DIR, `template-${template}`);
19
+ }
20
+
21
+ function run(
22
+ cmd: string[],
23
+ cwd: string,
24
+ ): { exitCode: number; stdout: string; stderr: string } {
25
+ const result = Bun.spawnSync(cmd, {
26
+ cwd,
27
+ env: process.env,
28
+ stdout: "pipe",
29
+ stderr: "pipe",
30
+ });
31
+ return {
32
+ exitCode: result.exitCode,
33
+ stdout: result.stdout.toString(),
34
+ stderr: result.stderr.toString(),
35
+ };
36
+ }
37
+
38
+ function assertGenerated(dir: string): void {
39
+ if (!existsSync(dir)) {
40
+ throw new Error(
41
+ `Generated dir not found: ${dir}\nRun "bun run generate" in poe-tile-templates first.`,
42
+ );
43
+ }
44
+ }
45
+
46
+ describe("generated templates", () => {
47
+ test("checks and repairs the pinned Playwright browser cache before launching scaffolds", () => {
48
+ const dir = generatedDir(TEMPLATES[0]);
49
+ assertGenerated(dir);
50
+
51
+ // Resolve the scaffold's pinned version and verify its actual executable.
52
+ // A healthy cache needs no download; a partial cache still gets repaired.
53
+ const checkBrowser = () =>
54
+ run(
55
+ [
56
+ "bun",
57
+ "-e",
58
+ 'const { chromium } = await import("@playwright/test"); const browser = await chromium.launch({ timeout: 10000 }); await browser.close();',
59
+ ],
60
+ dir,
61
+ );
62
+ const ready = checkBrowser();
63
+ if (ready.exitCode === 0) {
64
+ expect(ready.exitCode).toBe(0);
65
+ return;
66
+ }
67
+
68
+ // Run from a generated scaffold so bunx resolves that scaffold's exact
69
+ // Playwright version. --force repairs runner caches where the revision
70
+ // directory exists but its headless-shell executable is missing.
71
+ const result = run(
72
+ ["bunx", "playwright", "install", "--force", "chromium-headless-shell"],
73
+ dir,
74
+ );
75
+ if (result.exitCode !== 0) {
76
+ throw new Error(
77
+ `Playwright browser install failed:\n${result.stdout}\n${result.stderr}`,
78
+ );
79
+ }
80
+ const repaired = checkBrowser();
81
+ if (repaired.exitCode !== 0) {
82
+ throw new Error(
83
+ `Playwright browser launch failed after repair:\n${repaired.stdout}\n${repaired.stderr}`,
84
+ );
85
+ }
86
+ expect(repaired.exitCode).toBe(0);
87
+ }, 120_000);
88
+
89
+ for (const template of TEMPLATES) {
90
+ // `generate.ts` mirrors the `poe-tiles tiles init` CLI defaults
91
+ // (`--skills`, `--blank`), so the scaffold a real user gets from the
92
+ // getting-started guide must ship these SDK skills. Asserting their
93
+ // presence here means any regression that drops the bundled-resource
94
+ // fallback, the `_claude` rename, or the skills directory itself
95
+ // fails CI before we ship a CLI that hands users a broken setup.
96
+ test(`${template}: scaffold ships .claude/skills/{tile-creator,synced-store}`, () => {
97
+ const dir = generatedDir(template);
98
+ assertGenerated(dir);
99
+ expect(existsSync(join(dir, "bunfig.toml"))).toBe(true);
100
+ expect(existsSync(join(dir, ".claude/settings.json"))).toBe(true);
101
+ expect(
102
+ existsSync(join(dir, ".claude/skills/tile-creator/SKILL.md")),
103
+ ).toBe(true);
104
+ expect(
105
+ existsSync(join(dir, ".claude/skills/synced-store/SKILL.md")),
106
+ ).toBe(true);
107
+ });
108
+
109
+ test(`${template}: bun run test passes`, () => {
110
+ const dir = generatedDir(template);
111
+ assertGenerated(dir);
112
+
113
+ // Invokes scaffold's own `test` script — covers mutator tests AND
114
+ // happy-dom UI tests (App.test.happydom.tsx) with `--conditions browser`.
115
+ // Calling `bun test` directly here would skip happy-dom setup + browser
116
+ // conditions and let UI regressions slip past CI.
117
+ const result = run(["bun", "run", "test"], dir);
118
+
119
+ if (result.exitCode !== 0) {
120
+ throw new Error(
121
+ `bun run test failed for ${template}:\n${result.stdout}\n${result.stderr}`,
122
+ );
123
+ }
124
+ expect(result.exitCode).toBe(0);
125
+ });
126
+
127
+ test(`${template}: build + playwright e2e tests pass`, () => {
128
+ const dir = generatedDir(template);
129
+ assertGenerated(dir);
130
+
131
+ // Build first — playwright needs dist/
132
+ const buildResult = run(["bun", "run", "build"], dir);
133
+ if (buildResult.exitCode !== 0) {
134
+ throw new Error(
135
+ `Build failed for ${template}:\n${buildResult.stdout}\n${buildResult.stderr}`,
136
+ );
137
+ }
138
+ expect(existsSync(join(dir, "dist/index.html"))).toBe(true);
139
+ // `tile-frontend.js` is intentionally NOT on disk: the poeTile() vite
140
+ // plugin inlines the entry chunk into `index.html` as a poe-chunk
141
+ // and deletes the standalone file in writeBundle. See
142
+ // `packages/poe-tiles-sdk/src/vite-plugin.ts` writeBundle hook.
143
+ expect(existsSync(join(dir, "dist/synced-store-backend-config.js"))).toBe(
144
+ true,
145
+ );
146
+ expect(
147
+ existsSync(join(dir, "dist/synced-store-backend-config.quickjs")),
148
+ ).toBe(true);
149
+
150
+ // Playwright E2E
151
+ const e2eResult = run(["bunx", "playwright", "test"], dir);
152
+ if (e2eResult.exitCode !== 0) {
153
+ throw new Error(
154
+ `Playwright tests failed for ${template}:\n${e2eResult.stdout}\n${e2eResult.stderr}`,
155
+ );
156
+ }
157
+ expect(e2eResult.exitCode).toBe(0);
158
+ }, 30_000);
159
+ }
160
+ });
161
+
162
+ describe("generated store-less templates (tiles init --no-store)", () => {
163
+ for (const template of TEMPLATES) {
164
+ const dir = generatedDir(`${template}-no-store`);
165
+
166
+ test(`${template} --no-store: ships no synced-store files`, () => {
167
+ assertGenerated(dir);
168
+ expect(existsSync(join(dir, "synced-store"))).toBe(false);
169
+ expect(existsSync(join(dir, "client.ts"))).toBe(false);
170
+ expect(existsSync(join(dir, "tile/src/backend.ts"))).toBe(false);
171
+ expect(existsSync(join(dir, "tests/e2e.test.playwright.ts"))).toBe(false);
172
+ expect(existsSync(join(dir, "ui/App.test.happydom.tsx"))).toBe(true);
173
+ });
174
+
175
+ test(`${template} --no-store: type-check and bun run test pass`, () => {
176
+ assertGenerated(dir);
177
+ const typeCheck = run(["bun", "run", "type-check"], dir);
178
+ if (typeCheck.exitCode !== 0) {
179
+ throw new Error(
180
+ `type-check failed for ${template} --no-store:\n${typeCheck.stdout}\n${typeCheck.stderr}`,
181
+ );
182
+ }
183
+ const result = run(["bun", "run", "test"], dir);
184
+ if (result.exitCode !== 0) {
185
+ throw new Error(
186
+ `bun run test failed for ${template} --no-store:\n${result.stdout}\n${result.stderr}`,
187
+ );
188
+ }
189
+ expect(result.exitCode).toBe(0);
190
+ }, 60_000);
191
+
192
+ test(`${template} --no-store: build emits no backend artifact and the viewport check passes`, () => {
193
+ assertGenerated(dir);
194
+ const buildResult = run(["bun", "run", "build"], dir);
195
+ if (buildResult.exitCode !== 0) {
196
+ throw new Error(
197
+ `Build failed for ${template} --no-store:\n${buildResult.stdout}\n${buildResult.stderr}`,
198
+ );
199
+ }
200
+ expect(existsSync(join(dir, "dist/index.html"))).toBe(true);
201
+ // No backend entry, so the poeTile() plugin builds no backend config.
202
+ expect(existsSync(join(dir, "dist/synced-store-backend-config.js"))).toBe(
203
+ false,
204
+ );
205
+ expect(
206
+ existsSync(join(dir, "dist/synced-store-backend-config.quickjs")),
207
+ ).toBe(false);
208
+
209
+ // The remaining Playwright spec is the mobile-viewport check; it
210
+ // proves the store-less entry mounts the UI inside `#root`.
211
+ const e2eResult = run(["bunx", "playwright", "test"], dir);
212
+ if (e2eResult.exitCode !== 0) {
213
+ throw new Error(
214
+ `Playwright tests failed for ${template} --no-store:\n${e2eResult.stdout}\n${e2eResult.stderr}`,
215
+ );
216
+ }
217
+ expect(e2eResult.exitCode).toBe(0);
218
+ }, 60_000);
219
+ }
220
+ });
221
+
222
+ /** Runs `bun run type-check` in `dir` with `file` written, then removes it. */
223
+ function typeCheckWith({
224
+ dir,
225
+ file,
226
+ }: {
227
+ dir: string;
228
+ file: { path: string; text: string };
229
+ }): { exitCode: number; stdout: string; stderr: string } {
230
+ const path = join(dir, file.path);
231
+ writeFileSync(path, file.text);
232
+ try {
233
+ return run(["bun", "run", "type-check"], dir);
234
+ } finally {
235
+ rmSync(path, { force: true });
236
+ }
237
+ }
238
+
239
+ describe("generated templates enforce the /finish-prototype source rules", () => {
240
+ for (const template of TEMPLATES) {
241
+ // A conversion scaffolds with the default `--skills`, so the copied
242
+ // skills (which quote the suppression comments) sit beside the tile
243
+ // source. The untouched scaffold must still pass, and a `?url` asset
244
+ // import must type-check without a suppression.
245
+ test(`${template}: type-check passes on the scaffold with a ?url import`, () => {
246
+ const dir = generatedDir(template);
247
+ assertGenerated(dir);
248
+ const result = typeCheckWith({
249
+ dir,
250
+ file: {
251
+ path: "ui/url-import-probe.ts",
252
+ text: 'import iconUrl from "../assets/icon.png?url";\nexport const probe: string = iconUrl;\n',
253
+ },
254
+ });
255
+ if (result.exitCode !== 0) {
256
+ throw new Error(
257
+ `type-check failed for ${template}:\n${result.stdout}\n${result.stderr}`,
258
+ );
259
+ }
260
+ }, 60_000);
261
+
262
+ test(`${template}: type-check fails before tsc when a file turns checking off`, () => {
263
+ const dir = generatedDir(template);
264
+ assertGenerated(dir);
265
+ const result = typeCheckWith({
266
+ dir,
267
+ file: {
268
+ path: "ui/unchecked-probe.ts",
269
+ text: "// @ts-nocheck\nexport const probe = 1;\n",
270
+ },
271
+ });
272
+ expect(result.exitCode).toBe(1);
273
+ expect(result.stderr).toContain(
274
+ "ui/unchecked-probe.ts:1: @ts-nocheck hides type errors.",
275
+ );
276
+ }, 60_000);
277
+ }
278
+ });
@@ -0,0 +1,27 @@
1
+ import { expect, test } from "bun:test";
2
+ import { readFileSync } from "node:fs";
3
+ import { join } from "node:path";
4
+
5
+ test("generated tiles require the Happy DOM version pinned for workspace tests", () => {
6
+ const templatesPackageDir = join(import.meta.dir, "..");
7
+ const templatePackage = JSON.parse(
8
+ readFileSync(join(templatesPackageDir, "base/package.json"), "utf8"),
9
+ ) as { devDependencies: { "happy-dom": string } };
10
+ const syncpackConfig = JSON.parse(
11
+ readFileSync(join(templatesPackageDir, "../../.syncpackrc.json"), "utf8"),
12
+ ) as {
13
+ versionGroups: { dependencies?: string[]; pinVersion?: string }[];
14
+ };
15
+ const happyDomPin = syncpackConfig.versionGroups.find(
16
+ (group) =>
17
+ typeof group.pinVersion === "string" &&
18
+ group.dependencies?.includes("happy-dom"),
19
+ )?.pinVersion;
20
+
21
+ // External apps pin the tested version; workspace tests may use compatible
22
+ // patch releases. Keep their baseline equal without floating the scaffold.
23
+ expect(happyDomPin).toBeTruthy();
24
+ const templatePin = templatePackage.devDependencies["happy-dom"];
25
+ expect(templatePin).toMatch(/^\d+\.\d+\.\d+$/);
26
+ expect(happyDomPin).toBe(`^${templatePin}`);
27
+ });
@@ -0,0 +1,99 @@
1
+ import { afterEach, expect, test } from "bun:test";
2
+ import {
3
+ existsSync,
4
+ mkdirSync,
5
+ mkdtempSync,
6
+ readFileSync,
7
+ realpathSync,
8
+ rmSync,
9
+ writeFileSync,
10
+ } from "node:fs";
11
+ import { createRequire } from "node:module";
12
+ import { tmpdir } from "node:os";
13
+ import { join } from "node:path";
14
+ import { saveInstallDiagnostics } from "../scripts/install-diagnostics";
15
+
16
+ const roots: string[] = [];
17
+ afterEach(() => {
18
+ for (const root of roots.splice(0))
19
+ rmSync(root, { recursive: true, force: true });
20
+ });
21
+
22
+ function fixture() {
23
+ const root = realpathSync(
24
+ mkdtempSync(join(tmpdir(), "install-diagnostics-")),
25
+ );
26
+ roots.push(root);
27
+ const app = join(root, "app");
28
+ const output = join(root, "evidence");
29
+ mkdirSync(app);
30
+ writeFileSync(join(app, "package.json"), '{"name":"test-app"}');
31
+ return { app, output };
32
+ }
33
+
34
+ test("missing native dependency evidence survives scaffold cleanup", () => {
35
+ const { app, output } = fixture();
36
+ writeFileSync(join(app, "bun.lock"), '{"lockfileVersion":1}');
37
+ writeFileSync(join(app, ".env"), "PRIVATE_TEST_VALUE=do-not-copy");
38
+ writeFileSync(join(app, ".npmrc"), "//example.test/:_authToken=do-not-copy");
39
+ const vite = join(app, "node_modules/vite");
40
+ const rollup = join(vite, "node_modules/rollup");
41
+ mkdirSync(rollup, { recursive: true });
42
+ writeFileSync(
43
+ join(vite, "package.json"),
44
+ '{"name":"vite","version":"6.0.0"}',
45
+ );
46
+ const native = "@rollup/rollup-linux-x64-gnu";
47
+ const rollupPackage = JSON.stringify({
48
+ name: "rollup",
49
+ version: "4.0.0",
50
+ main: "index.cjs",
51
+ optionalDependencies: { [native]: "4.0.0", "installed-native": "1.0.0" },
52
+ });
53
+ writeFileSync(join(rollup, "package.json"), rollupPackage);
54
+ writeFileSync(
55
+ join(rollup, "index.cjs"),
56
+ `module.exports = require(${JSON.stringify(native)});`,
57
+ );
58
+ const installed = join(rollup, "node_modules/installed-native");
59
+ mkdirSync(installed, { recursive: true });
60
+ writeFileSync(join(installed, "index.js"), "module.exports = {};");
61
+
62
+ // Node really fails to load the optional native dependency, as Vite did in CI.
63
+ expect(() => createRequire(join(vite, "package.json"))("rollup")).toThrow(
64
+ native,
65
+ );
66
+ saveInstallDiagnostics(app, output);
67
+ rmSync(app, { recursive: true });
68
+
69
+ expect(readFileSync(join(output, "bun.lock"), "utf8")).toBe(
70
+ '{"lockfileVersion":1}',
71
+ );
72
+ expect(readFileSync(join(output, "rollup-package.json"), "utf8")).toBe(
73
+ rollupPackage,
74
+ );
75
+ const report = JSON.parse(
76
+ readFileSync(join(output, "resolution.json"), "utf8"),
77
+ );
78
+ expect(report.resolutions.rollup).toBe(join(rollup, "package.json"));
79
+ expect(report.resolutions[native]).toContain("Cannot find module");
80
+ expect(report.resolutions["installed-native"]).toBe(
81
+ join(installed, "index.js"),
82
+ );
83
+ expect(existsSync(join(output, ".env"))).toBe(false);
84
+ expect(existsSync(join(output, ".npmrc"))).toBe(false);
85
+ expect(existsSync(join(output, "node_modules"))).toBe(false);
86
+ });
87
+
88
+ test("an incomplete install still saves the manifest and resolution error", () => {
89
+ const { app, output } = fixture();
90
+ saveInstallDiagnostics(app, output);
91
+ expect(readFileSync(join(output, "package.json"), "utf8")).toBe(
92
+ '{"name":"test-app"}',
93
+ );
94
+ expect(existsSync(join(output, "bun.lock"))).toBe(false);
95
+ const report = JSON.parse(
96
+ readFileSync(join(output, "resolution.json"), "utf8"),
97
+ );
98
+ expect(report.resolutions.error).toContain("vite/package.json");
99
+ });
@@ -0,0 +1,23 @@
1
+ import { expect, test } from "bun:test";
2
+ import { readFileSync } from "node:fs";
3
+ import { join } from "node:path";
4
+
5
+ const templatesPackageDir = join(import.meta.dir, "..");
6
+ const entryFiles = [
7
+ "react/tile/src/entry.tsx",
8
+ "preact/tile/src/entry.tsx",
9
+ "solidjs/tile/src/entry.tsx",
10
+ "vanilla-js/tile/src/entry.ts",
11
+ "phaserjs/tile/src/entry.ts",
12
+ ];
13
+
14
+ test("player-facing scaffold entries enable native gesture overrides", () => {
15
+ for (const entryFile of entryFiles) {
16
+ const source = readFileSync(join(templatesPackageDir, entryFile), "utf8");
17
+ expect(source).toContain("applyNativeAppGestureOverrides,");
18
+ expect(source).toContain("applyNativeAppGestureOverrides();");
19
+ expect(source).not.toContain(
20
+ "// import { applyNativeAppGestureOverrides }",
21
+ );
22
+ }
23
+ });
@@ -0,0 +1,84 @@
1
+ import { expect, test } from "bun:test";
2
+ import { readFileSync } from "node:fs";
3
+ import { join } from "node:path";
4
+
5
+ const templatesPackageDir = join(import.meta.dir, "..");
6
+
7
+ function documentedPlaywrightVersion(doc: string): string | undefined {
8
+ const section = doc
9
+ .split(/^### .*`generated-apps`.*$/m)[1]
10
+ ?.split(/^#{1,3} /m)[0];
11
+ return section?.match(
12
+ /`npx --yes --package=playwright@(\S+) playwright\s+install\s+chromium(?:\s|$)/,
13
+ )?.[1];
14
+ }
15
+
16
+ test("creator sandbox, CI, and docs use the Playwright browser required by generated apps", () => {
17
+ const templatePackage = JSON.parse(
18
+ readFileSync(join(templatesPackageDir, "base/package.json"), "utf8"),
19
+ ) as { devDependencies: { "@playwright/test": string } };
20
+ const dockerfile = readFileSync(
21
+ join(
22
+ templatesPackageDir,
23
+ "../../projects/creator-v2-sandbox/container/Dockerfile",
24
+ ),
25
+ "utf8",
26
+ );
27
+ const prCheckWorkflow = readFileSync(
28
+ join(templatesPackageDir, "../../.github/workflows/pr-check.yml"),
29
+ "utf8",
30
+ );
31
+ const blockingChecksDoc = readFileSync(
32
+ join(templatesPackageDir, "../../docs/blocking-pr-checks.md"),
33
+ "utf8",
34
+ );
35
+ const requiredPlaywrightVersion =
36
+ templatePackage.devDependencies["@playwright/test"];
37
+ const bakedVersion = dockerfile.match(/^ARG PLAYWRIGHT_VERSION=(\S+)$/m)?.[1];
38
+ const ciInstalls = [
39
+ ...prCheckWorkflow.matchAll(
40
+ /^\s*npx --yes --package=playwright@(\S+) playwright install (chromium(?:-headless-shell)?)$/gm,
41
+ ),
42
+ ].map((match) => ({ version: match[1], browser: match[2] }));
43
+ const documentedVersion = documentedPlaywrightVersion(blockingChecksDoc);
44
+
45
+ expect(bakedVersion).toBe(requiredPlaywrightVersion);
46
+ expect(ciInstalls).toEqual([
47
+ { version: requiredPlaywrightVersion, browser: "chromium" },
48
+ { version: requiredPlaywrightVersion, browser: "chromium-headless-shell" },
49
+ ]);
50
+ expect(documentedVersion).toBe(requiredPlaywrightVersion);
51
+ });
52
+
53
+ test("documented Playwright version rejects a headless-shell-only install", () => {
54
+ const headlessOnlyCommand = `### \`Generated app tests\` (\`generated-apps\` job ID)
55
+
56
+ **Reproduce:** \`npx --yes --package=playwright@1.61.1 playwright install chromium-headless-shell\`.
57
+ `;
58
+
59
+ expect(documentedPlaywrightVersion(headlessOnlyCommand)).toBeUndefined();
60
+ });
61
+
62
+ test("documented Playwright version ignores installs in the next check", () => {
63
+ const otherCheckCommand = `### \`Generated app tests\` (\`generated-apps\` job ID)
64
+
65
+ **Reproduce:** See CI.
66
+
67
+ ### Another check
68
+
69
+ **Reproduce:** \`npx --yes --package=playwright@1.61.1 playwright install chromium\`.
70
+ `;
71
+
72
+ expect(documentedPlaywrightVersion(otherCheckCommand)).toBeUndefined();
73
+ });
74
+
75
+ test("generated-app tests repair the scaffold's pinned browser cache", () => {
76
+ const generatedTemplatesTest = readFileSync(
77
+ join(templatesPackageDir, "tests/generated-templates.test.ts"),
78
+ "utf8",
79
+ );
80
+
81
+ expect(generatedTemplatesTest).toMatch(
82
+ /\[\s*"bunx",\s*"playwright",\s*"install",\s*"--force",\s*"chromium-headless-shell",?\s*\]/,
83
+ );
84
+ });
@@ -0,0 +1,56 @@
1
+ // The scaffold's render check is three pieces that must agree: the gated test
2
+ // file, its entry in the `mobile-viewport` Playwright project, and the
3
+ // `render-check` package script that runs it. A scaffold missing any one of
4
+ // them hands the Creator agent a command that does nothing.
5
+ import { expect, test } from "bun:test";
6
+ import { readFileSync } from "node:fs";
7
+ import { join } from "node:path";
8
+
9
+ const base = join(import.meta.dir, "../base");
10
+
11
+ test("the render-check test file is gated on RENDER_CHECK and imports the SDK's render-check entry", () => {
12
+ const source = readFileSync(
13
+ join(base, "tests/render-check.test.playwright.ts"),
14
+ "utf8",
15
+ );
16
+ expect(source).toContain('from "joiner-sdk/v1/test-utils/render-check.js"');
17
+ expect(source).toContain(
18
+ "const { RENDER_CHECK, RENDER_CHECK_REPORT_ONLY } = process.env;",
19
+ );
20
+ expect(source).toContain("test.skip(\n\t!RENDER_CHECK,");
21
+ expect(source).toContain("renderCheckTimeoutMs(screens.length)");
22
+ expect(source).toContain("renderCheckDeadlineMs(screens.length)");
23
+ expect(source).toContain('visualCheckPath("render-check.json", TILE_DIR)');
24
+ expect(source).toContain("test.afterEach(");
25
+ expect(source).toContain('kind: "unknown"');
26
+ });
27
+
28
+ test("the render-check test runs in the mobile-viewport project and nowhere else", () => {
29
+ const config = readFileSync(join(base, "playwright.config.ts"), "utf8");
30
+ const desktop = config.slice(
31
+ config.indexOf('name: "desktop"'),
32
+ config.indexOf('name: "mobile-viewport"'),
33
+ );
34
+ const mobile = config.slice(config.indexOf('name: "mobile-viewport"'));
35
+ expect(desktop).toContain('"**/render-check.test.playwright.ts"');
36
+ expect(desktop).toContain("testIgnore");
37
+ expect(mobile).toContain('"**/render-check.test.playwright.ts"');
38
+ expect(mobile).toContain("testMatch");
39
+ });
40
+
41
+ test("the render-check script mirrors regenerate-screenshot and verify is untouched by it", () => {
42
+ const pkg = JSON.parse(readFileSync(join(base, "package.json"), "utf8")) as {
43
+ scripts: {
44
+ verify: string;
45
+ "render-check": string;
46
+ "regenerate-screenshot": string;
47
+ };
48
+ };
49
+ expect(pkg.scripts["render-check"]).toBe(
50
+ "bun run build && bunx playwright install chromium && RENDER_CHECK=1 bunx playwright test tests/render-check.test.playwright.ts",
51
+ );
52
+ expect(pkg.scripts["regenerate-screenshot"]).toBe(
53
+ "bun run build && bunx playwright install chromium && REGEN_SCREENSHOTS=1 bunx playwright test tests/screenshot.test.playwright.ts",
54
+ );
55
+ expect(pkg.scripts.verify).not.toContain("render-check");
56
+ });