playcademy 0.19.8 → 0.20.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -1065,7 +1065,7 @@ var SAMPLE_BUCKET_FILENAME = "bucket.ts";
1065
1065
  // ../better-auth/package.json
1066
1066
  var package_default = {
1067
1067
  name: "@playcademy/better-auth",
1068
- version: "0.0.10",
1068
+ version: "0.0.11",
1069
1069
  type: "module",
1070
1070
  exports: {
1071
1071
  "./server": {
@@ -1323,7 +1323,8 @@ var TYPESCRIPT_RUNNER = {
1323
1323
  // ../constants/src/domains.ts
1324
1324
  var PLAYCADEMY_BASE_URLS = {
1325
1325
  production: "https://hub.playcademy.net",
1326
- staging: "https://hub.dev.playcademy.net"
1326
+ staging: "https://hub.dev.playcademy.net",
1327
+ local: "http://localhost:5174"
1327
1328
  };
1328
1329
 
1329
1330
  // ../constants/src/overworld.ts
@@ -1403,7 +1404,9 @@ var WORKER_NAMING = {
1403
1404
  /** Prefix for staging worker names (e.g., "staging-bamboo") */
1404
1405
  STAGING_PREFIX: "staging-",
1405
1406
  /** Suffix for staging worker hostnames (e.g., "bamboo-staging.playcademy.gg") */
1406
- STAGING_SUFFIX: "-staging"
1407
+ STAGING_SUFFIX: "-staging",
1408
+ /** Prefix for local dev worker names (e.g., "local-hbauer-bamboo") */
1409
+ LOCAL_PREFIX: "local-"
1407
1410
  };
1408
1411
 
1409
1412
  // src/constants/urls.ts
@@ -3021,7 +3024,7 @@ import { existsSync as existsSync11, mkdirSync as mkdirSync5, readFileSync as re
3021
3024
  import { join as join13 } from "node:path";
3022
3025
 
3023
3026
  // src/version.ts
3024
- var cliVersion = false ? "0.0.0-dev" : "0.19.8";
3027
+ var cliVersion = false ? "0.0.0-dev" : "0.20.0";
3025
3028
 
3026
3029
  // src/lib/init/database.ts
3027
3030
  var drizzleConfigTemplate = loadTemplateString("database/drizzle-config.ts");
package/dist/constants.js CHANGED
@@ -20,7 +20,7 @@ var SAMPLE_BUCKET_FILENAME = "bucket.ts";
20
20
  // ../better-auth/package.json
21
21
  var package_default = {
22
22
  name: "@playcademy/better-auth",
23
- version: "0.0.10",
23
+ version: "0.0.11",
24
24
  type: "module",
25
25
  exports: {
26
26
  "./server": {
@@ -344,7 +344,8 @@ var PLAYCADEMY_DOMAINS = {
344
344
  };
345
345
  var PLAYCADEMY_BASE_URLS = {
346
346
  production: "https://hub.playcademy.net",
347
- staging: "https://hub.dev.playcademy.net"
347
+ staging: "https://hub.dev.playcademy.net",
348
+ local: "http://localhost:5174"
348
349
  };
349
350
  var GAME_WORKER_DOMAINS = {
350
351
  production: "playcademy.gg",
package/dist/db.js CHANGED
@@ -36,7 +36,7 @@ var DEFAULT_API_ROUTES_DIRECTORY = join2(SERVER_ROOT_DIRECTORY, "api");
36
36
  // ../better-auth/package.json
37
37
  var package_default = {
38
38
  name: "@playcademy/better-auth",
39
- version: "0.0.10",
39
+ version: "0.0.11",
40
40
  type: "module",
41
41
  exports: {
42
42
  "./server": {
package/dist/index.d.ts CHANGED
@@ -61,6 +61,8 @@ interface EnvironmentAuthProfiles {
61
61
  * credentials are kept separate for security.
62
62
  */
63
63
  interface AuthStore {
64
+ /** Local development profiles */
65
+ local: EnvironmentAuthProfiles;
64
66
  /** Staging environment profiles */
65
67
  staging: EnvironmentAuthProfiles;
66
68
  /** Production environment profiles */
@@ -594,12 +596,12 @@ interface PlaycademyConfig {
594
596
  * Provider-agnostic abstraction for cloud resources
595
597
  */
596
598
  interface BackendResourceBindings {
597
- /** SQL database instances to create and bind (maps to D1 on Cloudflare) */
598
- database?: string[];
599
- /** Key-value store namespaces to create and bind (maps to KV on Cloudflare) */
600
- keyValue?: string[];
601
- /** Object storage buckets to bind (maps to R2 on Cloudflare) */
602
- bucket?: string[];
599
+ /** SQL database `true` to request, server names it (maps to D1 on Cloudflare) */
600
+ database?: boolean | string[];
601
+ /** Key-value store `true` to request, server names it (maps to KV on Cloudflare) */
602
+ keyValue?: boolean | string[];
603
+ /** Object storage `true` to request, server names it (maps to R2 on Cloudflare) */
604
+ bucket?: boolean | string[];
603
605
  /** Queue bindings to create and bind */
604
606
  queues?: Record<string, QueueConfig | boolean>;
605
607
  }
@@ -1558,7 +1560,7 @@ interface LogStreamConfig {
1558
1560
  /** Game slug (for display purposes) */
1559
1561
  slug: string;
1560
1562
  /** Environment (for display purposes) */
1561
- environment: 'staging' | 'production';
1563
+ environment: 'local' | 'staging' | 'production';
1562
1564
  /** Output raw JSON with full timestamps */
1563
1565
  json?: boolean;
1564
1566
  }
package/dist/index.js CHANGED
@@ -326,7 +326,7 @@ var SAMPLE_BUCKET_FILENAME = "bucket.ts";
326
326
  // ../better-auth/package.json
327
327
  var package_default = {
328
328
  name: "@playcademy/better-auth",
329
- version: "0.0.10",
329
+ version: "0.0.11",
330
330
  type: "module",
331
331
  exports: {
332
332
  "./server": {
@@ -630,11 +630,8 @@ var TYPESCRIPT_RUNNER = {
630
630
  // ../constants/src/domains.ts
631
631
  var PLAYCADEMY_BASE_URLS = {
632
632
  production: "https://hub.playcademy.net",
633
- staging: "https://hub.dev.playcademy.net"
634
- };
635
- var GAME_WORKER_DOMAINS = {
636
- production: "playcademy.gg",
637
- staging: "staging.playcademy.gg"
633
+ staging: "https://hub.dev.playcademy.net",
634
+ local: "http://localhost:5174"
638
635
  };
639
636
  var LOG_COLLECTOR_URL = "https://logs.playcademy.gg";
640
637
 
@@ -721,7 +718,9 @@ var WORKER_NAMING = {
721
718
  /** Prefix for staging worker names (e.g., "staging-bamboo") */
722
719
  STAGING_PREFIX: "staging-",
723
720
  /** Suffix for staging worker hostnames (e.g., "bamboo-staging.playcademy.gg") */
724
- STAGING_SUFFIX: "-staging"
721
+ STAGING_SUFFIX: "-staging",
722
+ /** Prefix for local dev worker names (e.g., "local-hbauer-bamboo") */
723
+ LOCAL_PREFIX: "local-"
725
724
  };
726
725
  var SECRETS_PREFIX = "secrets_";
727
726
  var CLOUDFLARE_COMPATIBILITY_DATE = "2025-10-11";
@@ -1330,6 +1329,9 @@ function normalizeEnvironment(env) {
1330
1329
  if (normalized === "production" || normalized === "prod") {
1331
1330
  return "production";
1332
1331
  }
1332
+ if (normalized === "local") {
1333
+ return "local";
1334
+ }
1333
1335
  return null;
1334
1336
  }
1335
1337
  function ensureEnvironment(env) {
@@ -1339,7 +1341,7 @@ function ensureEnvironment(env) {
1339
1341
  logger.newLine();
1340
1342
  logger.error(`Invalid environment: "${env}"`);
1341
1343
  logger.newLine();
1342
- logger.remark("Valid environments: staging, production");
1344
+ logger.remark("Valid environments: local, staging, production");
1343
1345
  logger.newLine();
1344
1346
  process.exit(1);
1345
1347
  }
@@ -1359,8 +1361,9 @@ function requireEnvironment(env, usage) {
1359
1361
  logger.error("Missing required --env flag");
1360
1362
  logger.newLine();
1361
1363
  logger.admonition("tip", "Usage", [
1362
- `\`playcademy ${command} --env production\``,
1364
+ `\`playcademy ${command} --env local\``,
1363
1365
  `\`playcademy ${command} --env staging\``,
1366
+ `\`playcademy ${command} --env production\``,
1364
1367
  "",
1365
1368
  "Or set `PLAYCADEMY_ENV` in your environment."
1366
1369
  ]);
@@ -1373,7 +1376,7 @@ function getEnvironment() {
1373
1376
  return context2.environment;
1374
1377
  }
1375
1378
  const env = process.env.PLAYCADEMY_ENV?.toLowerCase();
1376
- if (env === "staging" || env === "production") {
1379
+ if (env === "local" || env === "staging" || env === "production") {
1377
1380
  return env;
1378
1381
  }
1379
1382
  return "staging";
@@ -1427,6 +1430,7 @@ async function loadAuthStore() {
1427
1430
  } catch {
1428
1431
  }
1429
1432
  return {
1433
+ local: createEmptyEnvironmentProfiles(),
1430
1434
  staging: createEmptyEnvironmentProfiles(),
1431
1435
  production: createEmptyEnvironmentProfiles()
1432
1436
  };
@@ -1496,29 +1500,32 @@ async function getProfile(environment, profileName) {
1496
1500
  async function listProfiles() {
1497
1501
  const store = await loadAuthStore();
1498
1502
  const profileMap = /* @__PURE__ */ new Map();
1499
- const stagingProfiles = [];
1500
- if (store.staging.default) {
1501
- stagingProfiles.push("default");
1502
- }
1503
- stagingProfiles.push(...Object.keys(store.staging.profiles));
1504
- profileMap.set("staging", stagingProfiles);
1505
- const productionProfiles = [];
1506
- if (store.production.default) {
1507
- productionProfiles.push("default");
1508
- }
1509
- productionProfiles.push(...Object.keys(store.production.profiles));
1510
- profileMap.set("production", productionProfiles);
1503
+ for (const env of ["local", "staging", "production"]) {
1504
+ const envProfiles = store[env];
1505
+ if (envProfiles) {
1506
+ const names = [];
1507
+ if (envProfiles.default) {
1508
+ names.push("default");
1509
+ }
1510
+ names.push(...Object.keys(envProfiles.profiles));
1511
+ profileMap.set(env, names);
1512
+ }
1513
+ }
1511
1514
  return profileMap;
1512
1515
  }
1516
+ function hasProfiles(env) {
1517
+ return env != null && (env.default !== null || Object.keys(env.profiles).length > 0);
1518
+ }
1513
1519
  async function getAuthenticatedEnvironments() {
1514
1520
  const store = await loadAuthStore();
1515
1521
  const environments = [];
1516
- const hasStaging = store.staging.default !== null || Object.keys(store.staging.profiles).length > 0;
1517
- const hasProduction = store.production.default !== null || Object.keys(store.production.profiles).length > 0;
1518
- if (hasStaging) {
1522
+ if (hasProfiles(store.local)) {
1523
+ environments.push("local");
1524
+ }
1525
+ if (hasProfiles(store.staging)) {
1519
1526
  environments.push("staging");
1520
1527
  }
1521
- if (hasProduction) {
1528
+ if (hasProfiles(store.production)) {
1522
1529
  environments.push("production");
1523
1530
  }
1524
1531
  return environments;
@@ -4031,7 +4038,7 @@ import { existsSync as existsSync9, mkdirSync as mkdirSync2, readFileSync as rea
4031
4038
  import { join as join13 } from "node:path";
4032
4039
 
4033
4040
  // src/version.ts
4034
- var cliVersion = false ? "0.0.0-dev" : "0.19.8";
4041
+ var cliVersion = false ? "0.0.0-dev" : "0.20.0";
4035
4042
 
4036
4043
  // src/lib/init/database.ts
4037
4044
  var drizzleConfigTemplate = loadTemplateString("database/drizzle-config.ts");
@@ -10260,10 +10267,6 @@ async function getDatabaseDirectory() {
10260
10267
  return DEFAULT_DATABASE_DIRECTORY;
10261
10268
  }
10262
10269
  }
10263
- function getDeploymentId(gameSlug) {
10264
- const environment = getEnvironment();
10265
- return environment === "production" ? gameSlug : `${WORKER_NAMING.STAGING_PREFIX}${gameSlug}`;
10266
- }
10267
10270
 
10268
10271
  // src/lib/deploy/migrations.ts
10269
10272
  var DB_RELATIVE_CANDIDATES = ["migrations", join35("..", "migrations"), "drizzle"];
@@ -10589,18 +10592,23 @@ async function selectEnvironment(options) {
10589
10592
  if (authenticatedEnvs.length === 1) {
10590
10593
  environment = authenticatedEnvs[0];
10591
10594
  logger.remark(`Deploying to ${environment}`, 1);
10592
- } else if (authenticatedEnvs.length === 2 && !options.dryRun) {
10595
+ } else if (authenticatedEnvs.length >= 2 && !options.dryRun) {
10593
10596
  if (isNonInteractive()) {
10594
- environment = "staging";
10597
+ environment = authenticatedEnvs.includes("staging") ? "staging" : authenticatedEnvs[0];
10595
10598
  logger.remark(`Deploying to ${environment} (CI default)`, 1);
10596
10599
  } else {
10600
+ const envLabels = {
10601
+ local: "Local (localhost:5174)",
10602
+ staging: "Staging (hub.dev.playcademy.net)",
10603
+ production: "Production (hub.playcademy.com)"
10604
+ };
10597
10605
  logger.newLine();
10598
10606
  environment = await select5({
10599
10607
  message: "Select deployment environment:",
10600
- choices: [
10601
- { value: "staging", name: "Staging (hub.dev.playcademy.net)" },
10602
- { value: "production", name: "Production (hub.playcademy.com)" }
10603
- ],
10608
+ choices: authenticatedEnvs.map((env) => ({
10609
+ value: env,
10610
+ name: envLabels[env]
10611
+ })),
10604
10612
  default: "staging"
10605
10613
  });
10606
10614
  }
@@ -10816,11 +10824,8 @@ function reportDeploymentSuccess(result, context2) {
10816
10824
  logger.newLine();
10817
10825
  const baseUrl = getWebBaseUrl(client.getBaseUrl());
10818
10826
  logger.data("Project URL", underline2(`${baseUrl}/play/${game.slug}`), 1);
10819
- if (backendMetadata || context2.previousBackendBundleHash) {
10820
- const env = getEnvironment();
10821
- const subdomain = env === "staging" ? `${game.slug}-staging` : game.slug;
10822
- const backendUrl = `https://${subdomain}.${GAME_WORKER_DOMAINS.production}/api`;
10823
- logger.data("Backend API", underline2(`${backendUrl}`), 1);
10827
+ if ((backendMetadata || context2.previousBackendBundleHash) && game.deploymentUrl) {
10828
+ logger.data("Backend API", underline2(`${game.deploymentUrl}/api`), 1);
10824
10829
  }
10825
10830
  logger.newLine();
10826
10831
  }
@@ -10835,11 +10840,8 @@ async function reportDryRunNewProject(plan, context2) {
10835
10840
  if (!plan.shouldDeployBackend) {
10836
10841
  return;
10837
10842
  }
10838
- const environment = getEnvironment();
10839
- const slug = context2.config.slug;
10840
- if (slug) {
10841
- const backendDomain = environment === "production" ? `${slug}.${GAME_WORKER_DOMAINS.production}` : `${slug}-staging.${GAME_WORKER_DOMAINS.staging}`;
10842
- logger.data("Backend URL", `https://${backendDomain}/api`, 1);
10843
+ if (context2.existingGame?.deploymentUrl) {
10844
+ logger.data("Backend URL", `${context2.existingGame.deploymentUrl}/api`, 1);
10843
10845
  }
10844
10846
  if (hasLocalCustomRoutes(context2.projectPath, context2.fullConfig)) {
10845
10847
  const customRoutesDir = getCustomRoutesDirectory(context2.projectPath, context2.fullConfig);
@@ -11927,16 +11929,15 @@ async function deployGame(context2, shouldUploadBuild, shouldDeployBackend) {
11927
11929
  const deploymentPrep = await runStep(
11928
11930
  "Preparing deployment",
11929
11931
  async () => {
11930
- const deploymentId = getDeploymentId(config.slug);
11931
11932
  const bindings = {};
11932
11933
  if (hasDatabaseSetup()) {
11933
- bindings.database = [deploymentId];
11934
+ bindings.database = true;
11934
11935
  }
11935
11936
  if (hasKVSetup(fullConfig)) {
11936
- bindings.keyValue = [deploymentId];
11937
+ bindings.keyValue = true;
11937
11938
  }
11938
11939
  if (hasBucketSetup(fullConfig)) {
11939
- bindings.bucket = [deploymentId];
11940
+ bindings.bucket = true;
11940
11941
  }
11941
11942
  if (hasQueueSetup(fullConfig)) {
11942
11943
  bindings.queues = Object.fromEntries(
@@ -13827,7 +13828,6 @@ export {
13827
13828
  getCustomRoutesDirectory,
13828
13829
  getDatabaseDirectory,
13829
13830
  getDeployedGame,
13830
- getDeploymentId,
13831
13831
  getDirectorySize,
13832
13832
  getDownloadBaseUrl,
13833
13833
  getDrizzleKitApiExports,
@@ -352,9 +352,9 @@ var init_routes = __esm({
352
352
  // ../edge-play/src/entry/metadata.ts
353
353
  function getRuntimeMetadata() {
354
354
  return {
355
- cliVersion: true ? "0.19.8" : "0.0.0-dev",
356
- sdkVersion: true ? "0.7.2" : "0.0.0-dev",
357
- buildId: true ? "340c35a19286" : "dev-source"
355
+ cliVersion: true ? "0.20.0" : "0.0.0-dev",
356
+ sdkVersion: true ? "0.7.3" : "0.0.0-dev",
357
+ buildId: true ? "261ef8255b09" : "dev-source"
358
358
  };
359
359
  }
360
360
  var init_metadata = __esm({
@@ -1,7 +1,7 @@
1
1
  {
2
- "cliVersion": "0.19.8",
3
- "sdkVersion": "0.7.2",
4
- "runtimeBuildId": "340c35a19286",
5
- "inputFingerprint": "340c35a1928627576bf4b8db481734ed2f0148b5973b385fa6a1c634fd5f9698",
2
+ "cliVersion": "0.20.0",
3
+ "sdkVersion": "0.7.3",
4
+ "runtimeBuildId": "261ef8255b09",
5
+ "inputFingerprint": "261ef8255b09363595311a58b6aefdc81b89cd73635fa65eb719d8e2aeebce57",
6
6
  "entry": "index.js"
7
7
  }
package/dist/utils.d.ts CHANGED
@@ -413,7 +413,7 @@ declare function startHotReload(onReload: () => Promise<void>, options?: HotRelo
413
413
  /**
414
414
  * Configuration utilities for environment variables and API endpoints
415
415
  */
416
- type Environment = 'staging' | 'production';
416
+ type Environment = 'staging' | 'production' | 'local';
417
417
 
418
418
  /**
419
419
  * Global CLI context for storing options that apply to all commands
package/dist/utils.js CHANGED
@@ -450,7 +450,9 @@ var WORKER_NAMING = {
450
450
  /** Prefix for staging worker names (e.g., "staging-bamboo") */
451
451
  STAGING_PREFIX: "staging-",
452
452
  /** Suffix for staging worker hostnames (e.g., "bamboo-staging.playcademy.gg") */
453
- STAGING_SUFFIX: "-staging"
453
+ STAGING_SUFFIX: "-staging",
454
+ /** Prefix for local dev worker names (e.g., "local-hbauer-bamboo") */
455
+ LOCAL_PREFIX: "local-"
454
456
  };
455
457
  var SECRETS_PREFIX = "secrets_";
456
458
  var CLOUDFLARE_COMPATIBILITY_DATE = "2025-10-11";
@@ -479,7 +481,7 @@ var DEFAULT_API_ROUTES_DIRECTORY = join2(SERVER_ROOT_DIRECTORY, "api");
479
481
  // ../better-auth/package.json
480
482
  var package_default = {
481
483
  name: "@playcademy/better-auth",
482
- version: "0.0.10",
484
+ version: "0.0.11",
483
485
  type: "module",
484
486
  exports: {
485
487
  "./server": {
@@ -2560,7 +2562,7 @@ import { existsSync as existsSync8, mkdirSync as mkdirSync2, writeFileSync as wr
2560
2562
  import { dirname as dirname4, join as join13 } from "node:path";
2561
2563
 
2562
2564
  // src/version.ts
2563
- var cliVersion = false ? "0.0.0-dev" : "0.19.8";
2565
+ var cliVersion = false ? "0.0.0-dev" : "0.20.0";
2564
2566
 
2565
2567
  // src/lib/build/binary-resource.ts
2566
2568
  function writeFileTree(baseDir, files) {
package/dist/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/version.ts
2
- var cliVersion = false ? "0.0.0-dev" : "0.19.8";
2
+ var cliVersion = false ? "0.0.0-dev" : "0.20.0";
3
3
  export {
4
4
  cliVersion
5
5
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playcademy",
3
- "version": "0.19.8",
3
+ "version": "0.20.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {
@@ -50,7 +50,7 @@
50
50
  },
51
51
  "dependencies": {
52
52
  "@inquirer/prompts": "^7.8.6",
53
- "@playcademy/sdk": "0.7.2",
53
+ "@playcademy/sdk": "0.7.3",
54
54
  "chokidar": "^4.0.3",
55
55
  "colorette": "^2.0.20",
56
56
  "commander": "^14.0.1",