@homie-rocks/studio 0.58.15 → 0.58.16

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.
package/CHANGELOG.md CHANGED
@@ -17,6 +17,17 @@ To bring a studio up to date, tell Claude: "Upgrade my studio to the newest Homi
17
17
  `npx -y @homie-rocks/studio@latest upgrade`, which shows what's new since the version your studio pins (from this
18
18
  file) and what the upgrade would change, and changes nothing until you agree.
19
19
 
20
+ ## [0.58.16] - 2026-10-21
21
+
22
+ **Plugin 0.58.10**
23
+
24
+ A failed deploy says what Cloudflare or the host actually refused.
25
+
26
+ ### Fixed
27
+
28
+ - A failed deploy whose Worker uses a queue no longer says the token needs Account > Queues > Edit unless Cloudflare refused a Queues request for authentication. Any other failure, an asset upload for one, now shows Wrangler's own error.
29
+ - When the host refuses a database call during a deploy, the reason it gives (for example "A routine does not publish the live site: the owner does.") now shows after "D1 migrations failed" instead of being cut off by Wrangler's closing lines. The same goes for creating the database and registering the studio's functions.
30
+
20
31
  ## [0.58.15] - 2026-10-20
21
32
 
22
33
  **Plugin 0.58.9**
@@ -57,12 +57,26 @@ import { LOCAL_STATE, configPath, domainOrigin, isRulesGame, isWorkersDev, layou
57
57
  const ANSI = /\u001b\[[0-9;]*m/g;
58
58
 
59
59
  /** Keep Wrangler's error and its context; progress/footer lines must not hide it. */
60
- export function wranglerDeployError(out) {
60
+ export function wranglerError(out) {
61
61
  const clean = redactText(String(out ?? '').replace(ANSI, '')).text;
62
62
  const error = clean.search(/(?:^|\n)[^\n]*\[ERROR\]/);
63
63
  return (error >= 0 ? clean.slice(error) : clean).trim();
64
64
  }
65
65
 
66
+ /**
67
+ * Each Cloudflare API request Wrangler reports as failed, with the codes Cloudflare answered it with. Wrangler prints
68
+ * "[ERROR] A request to the Cloudflare API (/accounts/<id>/queues?name=…) failed." and then each of Cloudflare's errors
69
+ * as "<message> [code: <n>]" (workers-utils cfetch throwFetchError).
70
+ */
71
+ export function failedRequests(out) {
72
+ const text = String(out ?? '').replace(ANSI, '');
73
+ return [...text.matchAll(/\[ERROR\] A request to the Cloudflare API \(([^)\s]+)\) failed\.([\s\S]*?)(?=\n[^\n]*\[ERROR\]|$)/g)]
74
+ .map(([, resource, notes]) => ({ resource, codes: [...notes.matchAll(/\[code: (\d+)\]/g)].map((m) => Number(m[1])) }));
75
+ }
76
+ // The codes Wrangler itself treats as an authentication error (wrangler's AUTHENTICATION_ERROR_CODES): a token
77
+ // without the permission the request needs is answered with 10000, "Authentication error".
78
+ const AUTH_CODES = new Set([9106, 10000]);
79
+
66
80
  export function experienceAddresses(root, id, url) {
67
81
  const app = listGames(root).find(g => g.id === id)?.kind === 'app';
68
82
  return { [app ? 'open' : 'play']: url ? `${url}/${id}/${app ? 'open' : 'play'}` : null, wall: url ? `${url}/${id}/tv` : null };
@@ -132,7 +146,9 @@ function parseJson(text) {
132
146
  export function explainCloudflare(out, accountId = null) {
133
147
  const text = String(out ?? '');
134
148
  const dash = accountId ? `https://dash.cloudflare.com/${accountId}` : 'https://dash.cloudflare.com';
135
- if (/queue.*(?:permission|authentication|forbidden|unauthori)|(?:permission|authentication|forbidden|unauthori).*queue/is.test(text)) {
149
+ // Only a Queues API request Cloudflare refused for authentication: a failed deploy that merely binds a queue keeps
150
+ // Wrangler's own error.
151
+ if (failedRequests(text).some((r) => /\/accounts\/[^/]+\/queues(?:[/?]|$)/.test(r.resource) && r.codes.some((c) => AUTH_CODES.has(c)))) {
136
152
  return {needs:'queues-permission',why:'The deployment token needs Account > Queues > Edit on this account. Update the CI/Workers Builds token permissions, then retry deploy.'};
137
153
  }
138
154
  if (/(?:cron|schedule).*?(?:limit|maximum|exceed)|(?:limit|maximum|exceed).*?(?:cron|schedule)/i.test(text)) {
@@ -388,7 +404,7 @@ async function deployLocked(root, { log = () => {}, homie, fetchFn = null, ownRo
388
404
  if (exists.code === 0) {
389
405
  return { ok: false, command: 'deploy', why: `A Worker named "${cf.worker}" already exists on this Cloudflare account and this studio did not create it, so nothing was deployed. Pick another name in studio.json (cloudflare.worker) and site/wrangler.jsonc (name).` };
390
406
  }
391
- if (!/10007|does not exist/i.test(exists.out)) return refuse(`could not check the Worker name: ${exists.out.trim().split('\n').slice(-3).join(' ')}`, exists.out);
407
+ if (!/10007|does not exist/i.test(exists.out)) return refuse(`could not check the Worker name: ${wranglerError(exists.out)}`, exists.out);
392
408
  }
393
409
 
394
410
  // D1.
@@ -401,7 +417,7 @@ async function deployLocked(root, { log = () => {}, homie, fetchFn = null, ownRo
401
417
  if (!db) {
402
418
  const made = w(['d1', 'create', cf.d1]);
403
419
  const id = /"?database_id"?\s*[:=]\s*"([0-9a-f-]{36})"/.exec(made.out)?.[1];
404
- if (made.code !== 0 || !id) return refuse(`could not create the D1 database "${cf.d1}": ${made.out.trim().split('\n').slice(-4).join(' ')}`, made.out);
420
+ if (made.code !== 0 || !id) return refuse(`could not create the D1 database "${cf.d1}": ${wranglerError(made.out)}`, made.out);
405
421
  db = { name: cf.d1, uuid: id };
406
422
  remember(`d1:${cf.d1}`);
407
423
  step(`created D1 ${cf.d1}`);
@@ -431,11 +447,11 @@ async function deployLocked(root, { log = () => {}, homie, fetchFn = null, ownRo
431
447
  for (const added of ensureMigrations(root)) step(`added ${added} (${migrationWord(added)})`);
432
448
  try {await ensureBackgroundQueues(root,w,{accountId,...(fetchFn?{fetchFn}:{})});for(const key of readStudio(root).cloudflare.created??[])created.add(key);} catch(error) {return refuse(error.message);}
433
449
  const migrate = w(['d1', 'migrations', 'apply', cf.d1, '--remote']);
434
- if (migrate.code !== 0) return refuse(`D1 migrations failed: ${migrate.out.trim().split('\n').slice(-4).join(' ')}`, migrate.out);
450
+ if (migrate.code !== 0) return refuse(`D1 migrations failed: ${wranglerError(migrate.out)}`, migrate.out);
435
451
  try {const replication=await enableReadReplication(root,w,{accountId,databaseId:db.uuid,...(fetchFn?{fetchFn}:{})});step(replication.enabled?'D1 read replication enabled':`D1 uses the primary: ${replication.reason}`);} catch(error) {step(`D1 uses the primary: ${error.message}`);}
436
452
  step('D1 migrations applied');
437
453
  const subscriptions=w(['d1','execute',cf.d1,'--remote','--command',(await import('./functions-build.mjs')).functionDeploymentSQL(root)]);
438
- if(subscriptions.code!==0)return refuse('Could not register studio functions',subscriptions.out);
454
+ if(subscriptions.code!==0)return refuse(`Could not register studio functions: ${wranglerError(subscriptions.out)}`,subscriptions.out);
439
455
 
440
456
  const started = Date.now();
441
457
  let dep = w(['deploy', ...(workerEntry(root) ? [workerEntry(root)] : []), ...repoVar(root)]);
@@ -447,7 +463,7 @@ async function deployLocked(root, { log = () => {}, homie, fetchFn = null, ownRo
447
463
  step(address.created ? 'registered the account’s workers.dev address automatically' : 'kept the account’s existing workers.dev address');
448
464
  dep = w(['deploy', ...(workerEntry(root) ? [workerEntry(root)] : []), ...repoVar(root)]);
449
465
  }
450
- if (dep.code !== 0) return refuse(`wrangler deploy failed: ${wranglerDeployError(dep.out)}`, dep.out);
466
+ if (dep.code !== 0) return refuse(`wrangler deploy failed: ${wranglerError(dep.out)}`, dep.out);
451
467
  try{await ensureStudioSigningKey(readStudio(root),w);}catch(error){return refuse(error.message);}
452
468
  if (paidReleases(root).length) {
453
469
  const bin = wranglerBin(root);
@@ -658,11 +674,11 @@ export async function ciDeploy(root, { log = () => {}, wrangler = null, preview
658
674
  const apply = () => w(['d1', 'migrations', 'apply', names.binding, '--remote']);
659
675
  let migrate = apply();
660
676
  const first = !target && migrate.code !== 0 && /not found|could(?:n't| not) find|does not exist|no database|database_id/i.test(migrate.out);
661
- if (migrate.code !== 0 && !first) return refuse(`D1 migrations failed: ${migrate.out.trim().split('\n').slice(-4).join(' ')}`, migrate.out);
677
+ if (migrate.code !== 0 && !first) return refuse(`D1 migrations failed: ${wranglerError(migrate.out)}`, migrate.out);
662
678
  if (!first) step('D1 migrations applied');
663
679
  const register=()=>w(['d1','execute',names.binding,'--remote','--command',functionDeploymentSQL(root)]);
664
680
  const {functionDeploymentSQL}=await import('./functions-build.mjs');
665
- if(!first) {const registered=register();if(registered.code!==0)return refuse('Could not register studio functions',registered.out);}
681
+ if(!first) {const registered=register();if(registered.code!==0)return refuse(`Could not register studio functions: ${wranglerError(registered.out)}`,registered.out);}
666
682
  step(`Cron triggers: ${(readConfig(root)?.triggers?.crons??[]).join('; ')||'none (remove toolkit triggers)'}`);
667
683
  // Workers AI (0.17.0): bound only when a server's AI guides think with it. The checkout is thrown away after.
668
684
  if (!first && needsWorkersAi(root, w, names.binding)) {
@@ -674,16 +690,16 @@ export async function ciDeploy(root, { log = () => {}, wrangler = null, preview
674
690
  }
675
691
  const started = Date.now();
676
692
  const dep = w(['deploy', ...(workerEntry(root) ? [workerEntry(root)] : []), ...repoVar(root)]);
677
- if (dep.code !== 0) return refuse(`wrangler deploy failed: ${wranglerDeployError(dep.out)}`, dep.out);
693
+ if (dep.code !== 0) return refuse(`wrangler deploy failed: ${wranglerError(dep.out)}`, dep.out);
678
694
  try{await ensureStudioSigningKey(readStudio(root),w);}catch(error){return refuse(error.message);}
679
695
  step(`deployed ${names.worker ?? 'the Worker'} in ${Math.round((Date.now() - started) / 1000)} s`);
680
696
  const repo = repoOf(root);
681
697
  step(repo ? `the live site knows its GitHub repository (${repo}), for the Claude app's hand-off` : 'no GitHub repository found here (no HOMIE_REPO, studio.json "github" or git remote): the Claude app\'s card asks the person which it is');
682
698
  if (first) {
683
699
  migrate = apply();
684
- if (migrate.code !== 0) return refuse(`D1 migrations failed after the first deploy: ${migrate.out.trim().split('\n').slice(-4).join(' ')}`, migrate.out);
700
+ if (migrate.code !== 0) return refuse(`D1 migrations failed after the first deploy: ${wranglerError(migrate.out)}`, migrate.out);
685
701
  step('D1 migrations applied (the database was created with this first deploy)');
686
- const registered=register();if(registered.code!==0)return refuse('Could not register studio functions',registered.out);
702
+ const registered=register();if(registered.code!==0)return refuse(`Could not register studio functions: ${wranglerError(registered.out)}`,registered.out);
687
703
  }
688
704
  try {const replication=await enableReadReplication(root,w);step(replication.enabled?'D1 read replication enabled':`D1 uses the primary: ${replication.reason}`);} catch(error) {step(`D1 uses the primary: ${error.message}`);}
689
705
  // The live address, from what Wrangler printed (a custom domain in studio.json wins).
@@ -735,7 +751,7 @@ export async function storageAdd(root, { log = () => {} } = {}) {
735
751
  const buckets = w(['r2', 'bucket', 'list']);
736
752
  if (buckets.code !== 0) {
737
753
  if (/enable R2|R2 is not enabled|10042|purchase|subscription|payment/i.test(buckets.out)) return enable;
738
- return { ok: false, command: 'storage add', ...(explainCloudflare(buckets.out, accountId) ?? { why: `could not list R2 buckets: ${buckets.out.trim().split('\n').slice(-3).join(' ')}` }) };
754
+ return { ok: false, command: 'storage add', ...(explainCloudflare(buckets.out, accountId) ?? { why: `could not list R2 buckets: ${wranglerError(buckets.out)}` }) };
739
755
  }
740
756
  const names = [...buckets.out.matchAll(/^name:\s+(\S+)/gm)].map((m) => m[1]);
741
757
  if (names.includes(bucket)) {
@@ -744,7 +760,7 @@ export async function storageAdd(root, { log = () => {} } = {}) {
744
760
  const made = w(['r2', 'bucket', 'create', bucket]);
745
761
  if (made.code !== 0) {
746
762
  if (/enable R2|R2 is not enabled|10042|purchase|subscription|payment/i.test(made.out)) return enable;
747
- return { ok: false, command: 'storage add', why: `could not create the R2 bucket "${bucket}": ${made.out.trim().split('\n').slice(-4).join(' ')}` };
763
+ return { ok: false, command: 'storage add', why: `could not create the R2 bucket "${bucket}": ${wranglerError(made.out)}` };
748
764
  }
749
765
  created.add(`r2:${bucket}`);
750
766
  const next = { ...readStudio(root), cloudflare: { ...readStudio(root).cloudflare, accountId, r2: bucket, created: [...created].sort() } };
@@ -844,7 +860,7 @@ export async function mediaMove(root, { paths = null, dryRun = false, verify = f
844
860
  // Where the file is meanwhile: on the site when it fits; a bigger one keeps an older R2 copy, or waits.
845
861
  const meanwhile = r.bytes <= MAX_ASSET_BYTES ? ' It stays on the site.' : r.held ? ' Its page keeps playing the older copy in R2.' : ' At this size the site cannot carry it, so its page waits until it is in R2.';
846
862
  if (put.code !== 0) {
847
- failed.push({ path: r.path, bytes: r.bytes, why: `${explainCloudflare(put.out, account)?.why ?? `the upload failed: ${put.out.trim().split('\n').slice(-3).join(' ')}`}${meanwhile}` });
863
+ failed.push({ path: r.path, bytes: r.bytes, why: `${explainCloudflare(put.out, account)?.why ?? `the upload failed: ${wranglerError(put.out)}`}${meanwhile}` });
848
864
  continue;
849
865
  }
850
866
  const got = await hashRemote(bin, `${bucket}/${key}`, opts);
@@ -4638,6 +4638,48 @@
4638
4638
  }
4639
4639
  }
4640
4640
  }
4641
+ },
4642
+ "0.58.16": {
4643
+ "files": {
4644
+ "CLAUDE.md": "ddf2b2a0376202f6",
4645
+ "README.md": "684b3cca8001673c",
4646
+ "HANDOFF.md": "29337e2ace95b2e7",
4647
+ "games/README.md": "5ad32fe80c61f117",
4648
+ "music/README.md": "a3dc042dadd39df8",
4649
+ "videos/README.md": "16babc3437d5545b",
4650
+ "posts/README.md": "37841aae476bd540",
4651
+ "site/README.md": "1dbdf22c03a1e505",
4652
+ "site/src/worker.mjs": "6cc5c6131eaf6fd0"
4653
+ },
4654
+ "sections": {
4655
+ "AGENTS.md": {
4656
+ "(intro)": "af7f2f732505d379",
4657
+ "## Version-matched authoring guides": "f6261a0e5801b96b",
4658
+ "## Layout": "f3a280b8c96cd068",
4659
+ "## Apps: one screen, roles and parts": "c10aa0441ea89702",
4660
+ "## Commands (all through the pinned CLI in node_modules)": "c20d90de21cde0c7",
4661
+ "## The site": "0cb8dd9a6f8a0096",
4662
+ "## Making games": "bb715272fd1a615b",
4663
+ "## The Game Codex and progress": "0738ef719cef3a4c",
4664
+ "## Art direction and models": "a48fff7bf0a5f2fc",
4665
+ "## Running live games (the back office)": "51ebf2ab756f6e4d",
4666
+ "## Servers and AI seats": "1ccfd549d2369a60",
4667
+ "## Selling things (the shop)": "0df5a5fe1833c624",
4668
+ "## Continuing a build from the Claude app": "0d68081e924ca419",
4669
+ "## Rules": "b2234d80f6cbe71d",
4670
+ "## Telling Homie": "80b46fdd9e578db8",
4671
+ "## Beta": "9d02638207a26e73"
4672
+ }
4673
+ },
4674
+ "named": {
4675
+ "Homie Arcade": {
4676
+ "sections": {
4677
+ "AGENTS.md": {
4678
+ "## Commands (all through the pinned CLI in node_modules)": "8364e05cebefcba4"
4679
+ }
4680
+ }
4681
+ }
4682
+ }
4641
4683
  }
4642
4684
  }
4643
4685
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homie-rocks/studio",
3
- "version": "0.58.15",
3
+ "version": "0.58.16",
4
4
  "description": "A studio for games, music and video on its own Cloudflare: scaffold, multiplayer starters on the netplay contract, a port toolkit that makes existing single-player web games multiplayer, the site Worker with public rooms (Table/Lobby Durable Objects and D1, all on the free Workers plan, no payment method), a site with the hub's sections (Home, Games, Music, Videos, Rooms, Posts with feeds) in the studio's own look, an epic landing page for every game, big songs and videos in the studio's own R2 once it has storage (uploaded, checked by SHA-256, served at the same addresses), deploy, and the homie.rocks directory.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -1,2 +1,2 @@
1
1
  // Generated by lib/build-identity.mjs; identifies the bundled runtime sources.
2
- export const STUDIO_BUILD = Object.freeze({"version":"0.58.15","sha256":"21d2ff598c3349a401492759f1ee0ce077752b2e3e00b8078973d3eac14197fc"});
2
+ export const STUDIO_BUILD = Object.freeze({"version":"0.58.16","sha256":"b981661e89026fb01e4ebd4e0cc06a403b0f90a5b22cf07d3425afcf6f99b075"});
@@ -1,2 +1,2 @@
1
1
  /** The @homie-rocks/studio version this Worker code is (package.json's; a test keeps them equal). Cache-busts /_homie/site.js. */
2
- export const STUDIO_VERSION_TAG = '0.58.15';
2
+ export const STUDIO_VERSION_TAG = '0.58.16';