@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,57 @@
1
+ // owner: jyoung-q
2
+ /**
3
+ * Scaffolds all templates into generated-apps/template-<name>/.
4
+ * Run this before testing to create workspace-resolvable template instances.
5
+ */
6
+
7
+ import { mkdirSync, rmSync } from "node:fs";
8
+ import { join } from "node:path";
9
+ import { scaffoldApp } from "../../../projects/poe-tiles-cli/src/commands/init/scaffold.ts";
10
+ import { TEMPLATES } from "..";
11
+ import { GENERATED_APPS_DIR } from "./paths.ts";
12
+
13
+ mkdirSync(GENERATED_APPS_DIR, { recursive: true });
14
+
15
+ for (const template of TEMPLATES) {
16
+ const dir = join(GENERATED_APPS_DIR, `template-${template}`);
17
+ rmSync(dir, { recursive: true, force: true });
18
+ scaffoldApp({
19
+ appName: `template-${template}`,
20
+ template,
21
+ outputDir: dir,
22
+ // Generated apps live inside the monorepo workspace, so resolve
23
+ // `joiner-sdk` to `workspace:*` rather than the published tarball.
24
+ // Without this, the base template's mutator tests fail with
25
+ // "Export named 'waitForKeyExists' not found" because the tarball
26
+ // SDK lags the workspace SDK. The tarball path is exercised
27
+ // separately by `bun run test:generated-apps:all-sdks` /
28
+ // `verify-all-sdks.ts`.
29
+ internalMonoRepo: true,
30
+ // Mirror `poe-tiles tiles init` CLI defaults so the generated-apps
31
+ // suite verifies the actual getting-started experience — a user
32
+ // running the CLI with no flags gets `--blank` + `--skills`, and any
33
+ // regression that breaks build/test/e2e for that exact shape (or
34
+ // drops the bundled SDK skills) must fail this suite.
35
+ includeSkill: true,
36
+ blank: true,
37
+ });
38
+ console.log(` Generated: ${template}`);
39
+ }
40
+
41
+ // The store-less variant behind `poe-tiles tiles init --no-store`. Generated
42
+ // beside the default so the suite proves each template still installs,
43
+ // type-checks, tests, and builds with synced-store removed.
44
+ for (const template of TEMPLATES) {
45
+ const dir = join(GENERATED_APPS_DIR, `template-${template}-no-store`);
46
+ rmSync(dir, { recursive: true, force: true });
47
+ scaffoldApp({
48
+ appName: `template-${template}-no-store`,
49
+ template,
50
+ outputDir: dir,
51
+ internalMonoRepo: true,
52
+ includeSkill: true,
53
+ blank: true,
54
+ noStore: true,
55
+ });
56
+ console.log(` Generated (no-store): ${template}`);
57
+ }
@@ -0,0 +1,52 @@
1
+ import { copyFileSync, existsSync, mkdirSync, writeFileSync } from "node:fs";
2
+ import { createRequire } from "node:module";
3
+ import { join } from "node:path";
4
+
5
+ /** Preserve only install evidence, never the scaffold's environment or credentials. */
6
+ export function saveInstallDiagnostics(
7
+ appDir: string,
8
+ outputDir: string,
9
+ ): void {
10
+ mkdirSync(outputDir, { recursive: true });
11
+ for (const name of ["package.json", "bun.lock"]) {
12
+ const path = join(appDir, name);
13
+ if (existsSync(path)) copyFileSync(path, join(outputDir, name));
14
+ }
15
+
16
+ const appRequire = createRequire(join(appDir, "package.json"));
17
+ const resolutions: Record<string, string> = {};
18
+ try {
19
+ const vitePath = appRequire.resolve("vite/package.json");
20
+ resolutions["vite"] = vitePath;
21
+ copyFileSync(vitePath, join(outputDir, "vite-package.json"));
22
+ // Follow Vite's dependency graph, including a nested Rollup installation.
23
+ const rollupPath = createRequire(vitePath).resolve("rollup/package.json");
24
+ resolutions["rollup"] = rollupPath;
25
+ copyFileSync(rollupPath, join(outputDir, "rollup-package.json"));
26
+ const rollupRequire = createRequire(rollupPath);
27
+ const rollup: { optionalDependencies?: Record<string, string> } =
28
+ rollupRequire(rollupPath);
29
+ for (const name of Object.keys(rollup.optionalDependencies ?? {})) {
30
+ try {
31
+ resolutions[name] = rollupRequire.resolve(name);
32
+ } catch (error) {
33
+ resolutions[name] = String(error);
34
+ }
35
+ }
36
+ } catch (error) {
37
+ resolutions["error"] = String(error);
38
+ }
39
+ writeFileSync(
40
+ join(outputDir, "resolution.json"),
41
+ JSON.stringify(
42
+ {
43
+ platform: process.platform,
44
+ arch: process.arch,
45
+ bun: Bun.version,
46
+ resolutions,
47
+ },
48
+ null,
49
+ 2,
50
+ ),
51
+ );
52
+ }
@@ -0,0 +1,7 @@
1
+ // owner: jyoung-q
2
+ /** Shared path constants for template generation scripts and tests. */
3
+
4
+ import { join, resolve } from "node:path";
5
+
6
+ export const MONOREPO_ROOT = resolve(import.meta.dir, "../../..");
7
+ export const GENERATED_APPS_DIR = join(MONOREPO_ROOT, "generated-apps");
@@ -0,0 +1,288 @@
1
+ // owner: jyoung-q
2
+ /**
3
+ * Lets the packed-SDK verification run a scaffold under either SDK dependency
4
+ * key (`joiner-sdk` or the legacy `poe-tiles-sdk`), and repack the tarball
5
+ * under either package name. Every tarball the release bot publishes must
6
+ * install and build under both keys, because old projects keep the legacy
7
+ * key with no end date:
8
+ *
9
+ * bun scripts/verify-local-sdk-tarball.ts \
10
+ * [--dependency-key joiner-sdk|poe-tiles-sdk] \
11
+ * [--tarball-name joiner-sdk|poe-tiles-sdk]
12
+ *
13
+ * `--dependency-key` (default `joiner-sdk`, what the CLI scaffold writes) is
14
+ * the key the scaffolded projects install the SDK under and the name their
15
+ * source imports. `--tarball-name` repacks the tarball under that package
16
+ * name first (default: the name in the source package.json, `joiner-sdk`).
17
+ */
18
+
19
+ import assert from "node:assert/strict";
20
+ import { execFileSync } from "node:child_process";
21
+ import {
22
+ copyFileSync,
23
+ existsSync,
24
+ mkdtempSync,
25
+ readdirSync,
26
+ readFileSync,
27
+ rmSync,
28
+ writeFileSync,
29
+ } from "node:fs";
30
+ import { tmpdir } from "node:os";
31
+ import { extname, join } from "node:path";
32
+ import { runVerificationCommand } from "./verify-local-sdk-command";
33
+
34
+ export const SDK_DEPENDENCY_KEYS = ["poe-tiles-sdk", "joiner-sdk"] as const;
35
+ export type SdkDependencyKey = (typeof SDK_DEPENDENCY_KEYS)[number];
36
+
37
+ /** The key the CLI scaffold writes, and the packed tarball's `name`. */
38
+ const SCAFFOLD_KEY: SdkDependencyKey = "joiner-sdk";
39
+
40
+ export interface VerifyOptions {
41
+ /** The key the scaffolded project installs the SDK under. */
42
+ dependencyKey: SdkDependencyKey;
43
+ /** Repack the tarball under this `name`; undefined keeps the packed name. */
44
+ tarballName: SdkDependencyKey | undefined;
45
+ }
46
+
47
+ function parseKey(flag: string, value: string | undefined): SdkDependencyKey {
48
+ const key = SDK_DEPENDENCY_KEYS.find((candidate) => candidate === value);
49
+ if (!key) {
50
+ throw new Error(
51
+ `${flag} must be one of ${SDK_DEPENDENCY_KEYS.join(", ")}; got ${value ?? "nothing"}`,
52
+ );
53
+ }
54
+ return key;
55
+ }
56
+
57
+ /** `--dependency-key <key>` and `--tarball-name <key>`; both optional. */
58
+ export function parseVerifyOptions(argv: readonly string[]): VerifyOptions {
59
+ const options: VerifyOptions = {
60
+ dependencyKey: SCAFFOLD_KEY,
61
+ tarballName: undefined,
62
+ };
63
+ for (let index = 0; index < argv.length; index += 1) {
64
+ const flag = argv[index];
65
+ const value = argv[index + 1];
66
+ if (flag === "--dependency-key") {
67
+ options.dependencyKey = parseKey(flag, value);
68
+ } else if (flag === "--tarball-name") {
69
+ options.tarballName = parseKey(flag, value);
70
+ } else {
71
+ throw new Error(`Unknown option: ${flag}`);
72
+ }
73
+ index += 1;
74
+ }
75
+ return options;
76
+ }
77
+
78
+ const QUOTED_SDK_SPECIFIER = /(["'`])joiner-sdk(?=["'`/])/g;
79
+ const INSTALLED_SDK_PATH = /node_modules\/joiner-sdk(?=\/)/g;
80
+
81
+ /** Rewrites quoted `joiner-sdk` specifiers and installed paths to `key`. */
82
+ export function rewriteSdkSpecifiers(
83
+ text: string,
84
+ key: SdkDependencyKey,
85
+ ): string {
86
+ if (key === SCAFFOLD_KEY) return text;
87
+ return text
88
+ .replace(QUOTED_SDK_SPECIFIER, `$1${key}`)
89
+ .replace(INSTALLED_SDK_PATH, `node_modules/${key}`);
90
+ }
91
+
92
+ const PROJECT_SOURCE_EXTENSIONS = new Set([
93
+ ".ts",
94
+ ".tsx",
95
+ ".mts",
96
+ ".cts",
97
+ ".js",
98
+ ".jsx",
99
+ ".mjs",
100
+ ".cjs",
101
+ ".json",
102
+ ".html",
103
+ ]);
104
+ const SKIPPED_DIRECTORIES = new Set(["node_modules", ".git", "dist"]);
105
+
106
+ function* projectSourceFiles(dir: string): Generator<string> {
107
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
108
+ const path = join(dir, entry.name);
109
+ if (entry.isDirectory()) {
110
+ if (!SKIPPED_DIRECTORIES.has(entry.name)) yield* projectSourceFiles(path);
111
+ } else if (
112
+ entry.isFile() &&
113
+ PROJECT_SOURCE_EXTENSIONS.has(extname(entry.name))
114
+ ) {
115
+ yield path;
116
+ }
117
+ }
118
+ }
119
+
120
+ type PackageJson = Record<string, unknown> & {
121
+ dependencies?: Record<string, string>;
122
+ devDependencies?: Record<string, string>;
123
+ };
124
+
125
+ /**
126
+ * Moves a scaffolded project from the `joiner-sdk` key to `key`: the
127
+ * dependency entry (renamed in place, so the manifest changes only by name)
128
+ * and every import and installed path in its source.
129
+ */
130
+ export function useSdkDependencyKey(
131
+ appDir: string,
132
+ key: SdkDependencyKey,
133
+ ): void {
134
+ if (key === SCAFFOLD_KEY) return;
135
+ for (const path of projectSourceFiles(appDir)) {
136
+ const text = readFileSync(path, "utf8");
137
+ const rewritten = rewriteSdkSpecifiers(text, key);
138
+ if (rewritten !== text) writeFileSync(path, rewritten);
139
+ }
140
+ const manifestPath = join(appDir, "package.json");
141
+ const manifest = JSON.parse(
142
+ readFileSync(manifestPath, "utf8"),
143
+ ) as PackageJson;
144
+ const declared = [manifest.dependencies, manifest.devDependencies].some(
145
+ (deps) => deps !== undefined && key in deps && !(SCAFFOLD_KEY in deps),
146
+ );
147
+ if (!declared) {
148
+ throw new Error(`${manifestPath} must depend on ${key} only`);
149
+ }
150
+ }
151
+
152
+ /**
153
+ * The SDK's imports of its own entries, which the packer keeps external: the
154
+ * `joiner-sdk/...` entries of `EXTERNAL` in
155
+ * `packages/poe-tiles-sdk/scripts/publish-constants.ts`. A self-import missing
156
+ * here keeps its old name in the repacked tarball and fails to resolve there,
157
+ * so the verification fails loudly rather than passing on a stale list.
158
+ */
159
+ const SDK_SELF_IMPORTS = [
160
+ "joiner-sdk/v1/test-utils/harness.js",
161
+ "joiner-sdk/v1/test-utils/headless-element.js",
162
+ "joiner-sdk/v1/test-utils.js",
163
+ "joiner-sdk/v1/test-utils/playwright.js",
164
+ ];
165
+
166
+ /**
167
+ * Rewrites the SDK's self-imports in one packed file to `name`. Only the
168
+ * self-imports change: the wire specifiers the SDK emits into built tiles
169
+ * (`poe-tiles-sdk/v1/client.js`) stay as they are.
170
+ */
171
+ export function renameSdkSelfImports(text: string, name: string): string {
172
+ let result = text;
173
+ for (const specifier of SDK_SELF_IMPORTS) {
174
+ const renamed = `${name}${specifier.slice(SCAFFOLD_KEY.length)}`;
175
+ for (const quote of ['"', "'"]) {
176
+ result = result.replaceAll(
177
+ `${quote}${specifier}${quote}`,
178
+ `${quote}${renamed}${quote}`,
179
+ );
180
+ }
181
+ }
182
+ return result;
183
+ }
184
+
185
+ function* packedCodeFiles(dir: string): Generator<string> {
186
+ for (const entry of readdirSync(dir, { withFileTypes: true })) {
187
+ const path = join(dir, entry.name);
188
+ if (entry.isDirectory()) yield* packedCodeFiles(path);
189
+ else if (entry.name.endsWith(".js") || entry.name.endsWith(".d.ts"))
190
+ yield path;
191
+ }
192
+ }
193
+
194
+ /**
195
+ * Repacks `sourceTarball` as `targetTarball` with package `name`, and its
196
+ * self-imports under that name. This builds the tarball the workspace rename
197
+ * will publish, from today's source, so both keys can be tested against it.
198
+ */
199
+ export function repackSdkTarballAs(
200
+ sourceTarball: string,
201
+ targetTarball: string,
202
+ name: SdkDependencyKey,
203
+ ): void {
204
+ const workDir = mkdtempSync(join(tmpdir(), "sdk-tarball-repack-"));
205
+ try {
206
+ execFileSync("tar", ["xzf", sourceTarball, "-C", workDir]);
207
+ const packageDir = join(workDir, "package");
208
+ const manifestPath = join(packageDir, "package.json");
209
+ const manifest = JSON.parse(readFileSync(manifestPath, "utf8")) as {
210
+ name: string;
211
+ };
212
+ manifest.name = name;
213
+ writeFileSync(manifestPath, `${JSON.stringify(manifest, null, "\t")}\n`);
214
+ let rewrittenFiles = 0;
215
+ for (const path of packedCodeFiles(packageDir)) {
216
+ const text = readFileSync(path, "utf8");
217
+ const rewritten = renameSdkSelfImports(text, name);
218
+ if (rewritten === text) continue;
219
+ writeFileSync(path, rewritten);
220
+ rewrittenFiles += 1;
221
+ }
222
+ if (name !== SCAFFOLD_KEY && rewrittenFiles === 0) {
223
+ throw new Error(
224
+ "Repacked SDK tarball has no self-imports to rename; update SDK_SELF_IMPORTS",
225
+ );
226
+ }
227
+ execFileSync("tar", [
228
+ "czf",
229
+ targetTarball,
230
+ "--no-xattrs",
231
+ "-C",
232
+ workDir,
233
+ "package",
234
+ ]);
235
+ } finally {
236
+ rmSync(workDir, { recursive: true, force: true });
237
+ }
238
+ }
239
+
240
+ /** The SDK is installed under the key only, from the tarball, by its packed name. */
241
+ export function assertInstalledSdk(
242
+ appDir: string,
243
+ { dependencyKey, tarballName }: VerifyOptions,
244
+ ): void {
245
+ const manifestPath = join(
246
+ appDir,
247
+ "node_modules",
248
+ dependencyKey,
249
+ "package.json",
250
+ );
251
+ const manifest = JSON.parse(readFileSync(manifestPath, "utf8")) as {
252
+ name: string;
253
+ };
254
+ const expected = tarballName ?? SCAFFOLD_KEY;
255
+ assert.equal(
256
+ manifest.name,
257
+ expected,
258
+ `${manifestPath} must name ${expected}`,
259
+ );
260
+ for (const other of SDK_DEPENDENCY_KEYS) {
261
+ if (other === dependencyKey) continue;
262
+ assert(
263
+ !existsSync(join(appDir, "node_modules", other)),
264
+ `the SDK must be installed under ${dependencyKey} only, not ${other}`,
265
+ );
266
+ }
267
+ }
268
+
269
+ /** Copies the packed tarball to `target`, repacked as `tarballName` if set. */
270
+ export function stageSdkTarball(
271
+ source: string,
272
+ target: string,
273
+ tarballName: SdkDependencyKey | undefined,
274
+ ): void {
275
+ if (tarballName === undefined) copyFileSync(source, target);
276
+ else repackSdkTarballAs(source, target, tarballName);
277
+ }
278
+
279
+ /** Moves a scaffold to the key, installs it, and checks what got installed. */
280
+ export function installWithSdkKey(
281
+ appDir: string,
282
+ options: VerifyOptions,
283
+ label: string,
284
+ ): void {
285
+ useSdkDependencyKey(appDir, options.dependencyKey);
286
+ runVerificationCommand(["bun", "install", "--ignore-scripts"], appDir, label);
287
+ assertInstalledSdk(appDir, options);
288
+ }
@@ -0,0 +1,132 @@
1
+ // owner: jyoung-q
2
+ /**
3
+ * Cleans and scaffolds every template with both SDK resolution modes. Workspace
4
+ * mode exercises the default blank creator experience against the code under
5
+ * test. Released-tarball mode retains the canonical example because a scaffold
6
+ * may intentionally depend on SDK changes that have not shipped yet. The local
7
+ * packed-SDK regression covers that exact candidate combination.
8
+ *
9
+ * Workspace mode requires the SDK to be built (the `./vite` export resolves
10
+ * to `dist/`), so we run `turbo build --filter joiner-sdk` once up front.
11
+ * Tarball mode pulls a prebuilt SDK from the URL committed at
12
+ * `projects/poe-tiles-cli/src/commands/init/sdk-tarball-url.generated.ts`.
13
+ *
14
+ * Note: installs pass --no-save so the root bun.lock is not rewritten;
15
+ * the gitignored generated-apps/template-* workspaces would otherwise
16
+ * leak into the lockfile and pollute unrelated PR diffs.
17
+ */
18
+
19
+ import { spawnSync } from "node:child_process";
20
+ import { copyFileSync, mkdirSync, rmSync } from "node:fs";
21
+ import { join } from "node:path";
22
+ import { scaffoldApp } from "../../../projects/poe-tiles-cli/src/commands/init/scaffold.ts";
23
+ import { SDK_TARBALL_URL } from "../../../projects/poe-tiles-cli/src/commands/init/sdk-tarball-url.generated.ts";
24
+ import { TEMPLATES } from "..";
25
+ import {
26
+ installStarterDemoTests,
27
+ replaceStarterSchema,
28
+ } from "../tests/fixtures/replace-starter-schema";
29
+ import { GENERATED_APPS_DIR, MONOREPO_ROOT } from "./paths.ts";
30
+
31
+ type SdkMode = "workspace" | "tarball";
32
+
33
+ function run(cmd: string[], cwd: string, label: string): void {
34
+ console.log(`\n→ ${label}: ${cmd.join(" ")}`);
35
+ const result = spawnSync(cmd[0]!, cmd.slice(1), {
36
+ cwd,
37
+ stdio: "inherit",
38
+ env: process.env,
39
+ });
40
+ if (result.status !== 0) {
41
+ throw new Error(`${label} failed (exit ${result.status})`);
42
+ }
43
+ }
44
+
45
+ function scaffoldAll(mode: SdkMode): void {
46
+ rmSync(GENERATED_APPS_DIR, { recursive: true, force: true });
47
+ mkdirSync(GENERATED_APPS_DIR, { recursive: true });
48
+ const sdkVersion = mode === "workspace" ? "workspace:*" : SDK_TARBALL_URL;
49
+ for (const template of TEMPLATES) {
50
+ const dir = join(GENERATED_APPS_DIR, `template-${template}`);
51
+ scaffoldApp({
52
+ appName: `template-${template}`,
53
+ template,
54
+ outputDir: dir,
55
+ sdkVersion,
56
+ includeSkill: true,
57
+ blank: mode === "workspace",
58
+ });
59
+ if (mode === "workspace") {
60
+ installStarterDemoTests(dir, template);
61
+ copyFileSync(
62
+ join(
63
+ import.meta.dir,
64
+ "../tests/fixtures/multiplayer-verification.test.playwright.ts.txt",
65
+ ),
66
+ join(dir, "tests/multiplayer-verification.test.playwright.ts"),
67
+ );
68
+ }
69
+ console.log(` Scaffolded (${mode}): ${template}`);
70
+ }
71
+ }
72
+
73
+ function verifyMode(mode: SdkMode): void {
74
+ console.log("\n=========================");
75
+ console.log(`SDK mode: ${mode}`);
76
+ console.log("=========================");
77
+ scaffoldAll(mode);
78
+ run(
79
+ ["bun", "install", "--ignore-scripts", "--no-save"],
80
+ MONOREPO_ROOT,
81
+ `bun install (${mode})`,
82
+ );
83
+ for (const template of TEMPLATES) {
84
+ const dir = join(GENERATED_APPS_DIR, `template-${template}`);
85
+ run(["bun", "run", "type-check"], dir, `${mode}/${template} type-check`);
86
+ run(["bun", "run", "test"], dir, `${mode}/${template} test`);
87
+ if (mode === "workspace") {
88
+ run(
89
+ [
90
+ "bun",
91
+ "test",
92
+ "--conditions",
93
+ "browser",
94
+ "./ui/starter-demo.test.happydom.tsx",
95
+ ],
96
+ dir,
97
+ `${template} starter demo UI`,
98
+ );
99
+ replaceStarterSchema(dir, template);
100
+ run(
101
+ ["bun", "run", "type-check"],
102
+ dir,
103
+ `${template} replacement schema types`,
104
+ );
105
+ run(
106
+ ["bun", "run", "test"],
107
+ dir,
108
+ `${template} unchanged tests after schema replacement`,
109
+ );
110
+ }
111
+ run(
112
+ ["bun", "run", "test:playwright"],
113
+ dir,
114
+ `${mode}/${template} test:playwright`,
115
+ );
116
+ }
117
+ }
118
+
119
+ // Workspace mode resolves `joiner-sdk/vite` to dist/ — build first.
120
+ run(
121
+ ["bunx", "turbo", "build", "--filter", "joiner-sdk"],
122
+ MONOREPO_ROOT,
123
+ "turbo build poe-tiles-sdk",
124
+ );
125
+
126
+ verifyMode("workspace");
127
+ verifyMode("tarball");
128
+
129
+ rmSync(GENERATED_APPS_DIR, { recursive: true, force: true });
130
+ console.log(
131
+ "\n✓ All templates passed type-check + test + test:playwright in both SDK modes.",
132
+ );
@@ -0,0 +1,30 @@
1
+ // owner: jyoung-q
2
+ import { spawnSync } from "node:child_process";
3
+
4
+ export function runVerificationCommand(
5
+ cmd: string[],
6
+ cwd: string,
7
+ label: string,
8
+ env: NodeJS.ProcessEnv = process.env,
9
+ ): void {
10
+ console.log(`\n-> ${label}: ${cmd.join(" ")}`);
11
+ const result = spawnSync(cmd[0]!, cmd.slice(1), {
12
+ cwd,
13
+ stdio: "inherit",
14
+ env,
15
+ });
16
+ if (result.status !== 0) {
17
+ throw new Error(`${label} failed (exit ${result.status})`);
18
+ }
19
+ }
20
+
21
+ export function getPublishEnvironment(): NodeJS.ProcessEnv {
22
+ const env: NodeJS.ProcessEnv = {
23
+ ...process.env,
24
+ SKIP_SDK_TARBALL_UPLOAD: "1",
25
+ };
26
+ delete env["UPLOAD_SECRET"];
27
+ delete env["POE_API_KEY"];
28
+ delete env["POE_API_KEY_USER_2"];
29
+ return env;
30
+ }