@playdrop/playdrop-cli 0.3.4-build.1 → 0.3.5-build.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 (141) hide show
  1. package/README.md +60 -23
  2. package/config/client-meta.json +5 -5
  3. package/dist/apps/upload.js +5 -3
  4. package/dist/assets/model-artifacts.js +1 -1
  5. package/dist/catalogue.d.ts +6 -0
  6. package/dist/catalogue.js +38 -1
  7. package/dist/commandContext.d.ts +1 -0
  8. package/dist/commandContext.js +45 -15
  9. package/dist/commands/browse.d.ts +16 -0
  10. package/dist/commands/browse.js +370 -0
  11. package/dist/commands/build.js +4 -9
  12. package/dist/commands/capture.js +24 -24
  13. package/dist/commands/captureRemote.d.ts +11 -0
  14. package/dist/commands/captureRemote.js +90 -0
  15. package/dist/commands/comments.d.ts +14 -0
  16. package/dist/commands/comments.js +189 -0
  17. package/dist/commands/create.js +112 -72
  18. package/dist/commands/creations.d.ts +49 -0
  19. package/dist/commands/creations.js +657 -0
  20. package/dist/commands/credits.d.ts +10 -0
  21. package/dist/commands/credits.js +91 -0
  22. package/dist/commands/detail.d.ts +2 -2
  23. package/dist/commands/detail.js +148 -290
  24. package/dist/commands/dev.js +24 -24
  25. package/dist/commands/devShared.js +2 -2
  26. package/dist/commands/documentation.d.ts +4 -1
  27. package/dist/commands/documentation.js +79 -104
  28. package/dist/commands/feedback.d.ts +12 -9
  29. package/dist/commands/feedback.js +125 -257
  30. package/dist/commands/format.js +6 -13
  31. package/dist/commands/generation.d.ts +11 -0
  32. package/dist/commands/generation.js +204 -42
  33. package/dist/commands/gettingStarted.d.ts +1 -0
  34. package/dist/commands/gettingStarted.js +26 -0
  35. package/dist/commands/init.js +26 -24
  36. package/dist/commands/login.js +9 -8
  37. package/dist/commands/logout.js +2 -1
  38. package/dist/commands/notifications.d.ts +14 -0
  39. package/dist/commands/notifications.js +179 -0
  40. package/dist/commands/search.d.ts +13 -0
  41. package/dist/commands/search.js +198 -0
  42. package/dist/commands/upload.js +20 -17
  43. package/dist/commands/validate.js +15 -1
  44. package/dist/commands/versionsBrowse.d.ts +7 -0
  45. package/dist/commands/versionsBrowse.js +209 -0
  46. package/dist/commands/whoami.js +9 -8
  47. package/dist/errors.d.ts +9 -0
  48. package/dist/errors.js +52 -0
  49. package/dist/externalAssetPackValidation.d.ts +2 -0
  50. package/dist/externalAssetPackValidation.js +115 -0
  51. package/dist/http.js +1 -1
  52. package/dist/index.js +570 -630
  53. package/dist/messages.js +11 -11
  54. package/dist/output.d.ts +5 -0
  55. package/dist/output.js +45 -0
  56. package/dist/playwright.js +1 -1
  57. package/dist/refs.d.ts +18 -0
  58. package/dist/refs.js +105 -0
  59. package/node_modules/@playdrop/ai-client/dist/index.d.ts +42 -15
  60. package/node_modules/@playdrop/ai-client/dist/index.d.ts.map +1 -1
  61. package/node_modules/@playdrop/ai-client/package.json +1 -0
  62. package/node_modules/@playdrop/api-client/dist/client.d.ts +39 -27
  63. package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
  64. package/node_modules/@playdrop/api-client/dist/client.js +280 -1669
  65. package/node_modules/@playdrop/api-client/dist/core/errors.d.ts +9 -0
  66. package/node_modules/@playdrop/api-client/dist/core/errors.d.ts.map +1 -0
  67. package/node_modules/@playdrop/api-client/dist/core/errors.js +46 -0
  68. package/node_modules/@playdrop/api-client/dist/core/request.d.ts +27 -0
  69. package/node_modules/@playdrop/api-client/dist/core/request.d.ts.map +1 -0
  70. package/node_modules/@playdrop/api-client/dist/core/request.js +122 -0
  71. package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts +75 -0
  72. package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts.map +1 -0
  73. package/node_modules/@playdrop/api-client/dist/domains/admin.js +282 -0
  74. package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts +22 -0
  75. package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts.map +1 -0
  76. package/node_modules/@playdrop/api-client/dist/domains/ai.js +15 -0
  77. package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts +60 -0
  78. package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts.map +1 -0
  79. package/node_modules/@playdrop/api-client/dist/domains/apps.js +301 -0
  80. package/node_modules/@playdrop/api-client/dist/domains/asset-packs.d.ts +59 -0
  81. package/node_modules/@playdrop/api-client/dist/domains/asset-packs.d.ts.map +1 -0
  82. package/node_modules/@playdrop/api-client/dist/domains/asset-packs.js +297 -0
  83. package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts +62 -0
  84. package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts.map +1 -0
  85. package/node_modules/@playdrop/api-client/dist/domains/assets.js +297 -0
  86. package/node_modules/@playdrop/api-client/dist/domains/auth.d.ts +28 -0
  87. package/node_modules/@playdrop/api-client/dist/domains/auth.d.ts.map +1 -0
  88. package/node_modules/@playdrop/api-client/dist/domains/auth.js +78 -0
  89. package/node_modules/@playdrop/api-client/dist/domains/comments.d.ts +29 -0
  90. package/node_modules/@playdrop/api-client/dist/domains/comments.d.ts.map +1 -0
  91. package/node_modules/@playdrop/api-client/dist/domains/comments.js +65 -0
  92. package/node_modules/@playdrop/api-client/dist/domains/me.d.ts +24 -0
  93. package/node_modules/@playdrop/api-client/dist/domains/me.d.ts.map +1 -0
  94. package/node_modules/@playdrop/api-client/dist/domains/me.js +35 -0
  95. package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts +37 -0
  96. package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts.map +1 -0
  97. package/node_modules/@playdrop/api-client/dist/domains/payments.js +148 -0
  98. package/node_modules/@playdrop/api-client/dist/domains/search.d.ts +27 -0
  99. package/node_modules/@playdrop/api-client/dist/domains/search.d.ts.map +1 -0
  100. package/node_modules/@playdrop/api-client/dist/domains/search.js +65 -0
  101. package/node_modules/@playdrop/api-client/dist/index.d.ts +33 -56
  102. package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
  103. package/node_modules/@playdrop/api-client/dist/index.js +103 -44
  104. package/node_modules/@playdrop/api-client/package.json +3 -2
  105. package/node_modules/@playdrop/boxel-core/package.json +1 -1
  106. package/node_modules/@playdrop/boxel-three/dist/test/glb-skinned.test.js +1 -1
  107. package/node_modules/@playdrop/boxel-three/dist/test/instantiate.test.js +1 -1
  108. package/node_modules/@playdrop/boxel-three/dist/test/skinned-mesh.test.js +1 -1
  109. package/node_modules/@playdrop/boxel-three/package.json +2 -1
  110. package/node_modules/@playdrop/config/client-meta.json +5 -5
  111. package/node_modules/@playdrop/config/dist/src/constants.d.ts +5 -0
  112. package/node_modules/@playdrop/config/dist/src/constants.d.ts.map +1 -1
  113. package/node_modules/@playdrop/config/dist/src/constants.js +5 -1
  114. package/node_modules/@playdrop/config/dist/tsconfig.tsbuildinfo +1 -1
  115. package/node_modules/@playdrop/config/package.json +1 -1
  116. package/node_modules/@playdrop/types/dist/api.d.ts +178 -17
  117. package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
  118. package/node_modules/@playdrop/types/dist/api.js +30 -1
  119. package/node_modules/@playdrop/types/dist/app.d.ts +0 -14
  120. package/node_modules/@playdrop/types/dist/app.d.ts.map +1 -1
  121. package/node_modules/@playdrop/types/dist/app.js +0 -10
  122. package/node_modules/@playdrop/types/dist/asset-pack.d.ts +11 -1
  123. package/node_modules/@playdrop/types/dist/asset-pack.d.ts.map +1 -1
  124. package/node_modules/@playdrop/types/dist/asset.d.ts +65 -0
  125. package/node_modules/@playdrop/types/dist/asset.d.ts.map +1 -1
  126. package/node_modules/@playdrop/types/dist/realtime.d.ts +26 -26
  127. package/node_modules/@playdrop/types/dist/realtime.d.ts.map +1 -1
  128. package/node_modules/@playdrop/types/dist/version.d.ts +5 -0
  129. package/node_modules/@playdrop/types/dist/version.d.ts.map +1 -1
  130. package/package.json +2 -3
  131. package/bin/playdrop-cli +0 -2
  132. package/dist/commands/asset-packs.d.ts +0 -27
  133. package/dist/commands/asset-packs.js +0 -508
  134. package/dist/commands/assets.d.ts +0 -35
  135. package/dist/commands/assets.js +0 -668
  136. package/dist/commands/list.d.ts +0 -7
  137. package/dist/commands/list.js +0 -347
  138. package/dist/commands/migrateCatalogueV2.d.ts +0 -1
  139. package/dist/commands/migrateCatalogueV2.js +0 -142
  140. package/dist/commands/versions.d.ts +0 -17
  141. package/dist/commands/versions.js +0 -384
@@ -169,11 +169,8 @@ const DEFAULT_APP_VERSION = '1.0.0';
169
169
  const APP_TYPE_SLUGS = {
170
170
  game: 'GAME',
171
171
  template: 'TEMPLATE',
172
- templates: 'TEMPLATE',
173
172
  tool: 'TOOL',
174
- tools: 'TOOL',
175
173
  demo: 'DEMO',
176
- demos: 'DEMO',
177
174
  };
178
175
  function makeDefaultAppEntry(name, filePath) {
179
176
  return {
@@ -321,20 +318,20 @@ function logCatalogueOutcome(result, name) {
321
318
  const label = (0, node_path_1.relative)(process.cwd(), result.path) || CATALOGUE_FILENAME;
322
319
  if (result.error === 'invalid_json') {
323
320
  (0, messages_1.printErrorWithHelp)(`Could not update ${label} because it contains invalid JSON.`, [
324
- `Fix the JSON in ${label} and add ${name} to the apps list, then rerun "playdrop-cli create ${name}" if needed.`
325
- ], { command: 'create' });
321
+ `Fix the JSON in ${label} and add ${name} to the apps list, then rerun "playdrop project create app ${name}" if needed.`
322
+ ], { command: 'project create app' });
326
323
  process.exitCode = process.exitCode || 1;
327
324
  return false;
328
325
  }
329
326
  if (result.error === 'legacy_games_property') {
330
327
  (0, messages_1.printErrorWithHelp)(`${label} still uses the legacy "games" catalogue field.`, [
331
- 'Rename the top-level "games" array to "apps" and rerun `playdrop-cli create`. This rename removes the old terminology.'
332
- ], { command: 'create' });
328
+ 'Rename the top-level "games" array to "apps" and rerun `playdrop project create app`. This rename removes the old terminology.'
329
+ ], { command: 'project create app' });
333
330
  process.exitCode = process.exitCode || 1;
334
331
  return false;
335
332
  }
336
333
  if (result.error === 'invalid_schema_version') {
337
- (0, messages_1.printErrorWithHelp)(`${label} must set "schemaVersion": 2.`, ['Update the file to schema v2 and rerun `playdrop-cli create`.'], { command: 'create' });
334
+ (0, messages_1.printErrorWithHelp)(`${label} must set "schemaVersion": 2.`, ['Update the file to schema v2 and rerun `playdrop project create app`.'], { command: 'project create app' });
338
335
  process.exitCode = process.exitCode || 1;
339
336
  return false;
340
337
  }
@@ -432,20 +429,20 @@ function logProjectCatalogueOutcome(result, name) {
432
429
  const label = (0, node_path_1.relative)(process.cwd(), result.path) || CATALOGUE_FILENAME;
433
430
  if (result.error === 'invalid_json') {
434
431
  (0, messages_1.printErrorWithHelp)(`Could not update ${label} because it contains invalid JSON.`, [
435
- `Fix the JSON in ${label} and add ${name} to the apps list, then rerun "playdrop-cli create ${name}" if needed.`
436
- ], { command: 'create' });
432
+ `Fix the JSON in ${label} and add ${name} to the apps list, then rerun "playdrop project create app ${name}" if needed.`
433
+ ], { command: 'project create app' });
437
434
  process.exitCode = process.exitCode || 1;
438
435
  return false;
439
436
  }
440
437
  if (result.error === 'legacy_games_property') {
441
438
  (0, messages_1.printErrorWithHelp)(`${label} still uses the legacy "games" catalogue field.`, [
442
- 'Rename the top-level "games" array to "apps" and rerun `playdrop-cli create`. This rename removes the old terminology.'
443
- ], { command: 'create' });
439
+ 'Rename the top-level "games" array to "apps" and rerun `playdrop project create app`. This rename removes the old terminology.'
440
+ ], { command: 'project create app' });
444
441
  process.exitCode = process.exitCode || 1;
445
442
  return false;
446
443
  }
447
444
  if (result.error === 'invalid_schema_version') {
448
- (0, messages_1.printErrorWithHelp)(`${label} must set "schemaVersion": 2.`, ['Update the file to schema v2 and rerun `playdrop-cli create`.'], { command: 'create' });
445
+ (0, messages_1.printErrorWithHelp)(`${label} must set "schemaVersion": 2.`, ['Update the file to schema v2 and rerun `playdrop project create app`.'], { command: 'project create app' });
449
446
  process.exitCode = process.exitCode || 1;
450
447
  return false;
451
448
  }
@@ -460,7 +457,7 @@ function logNextSteps(name, options) {
460
457
  console.log(` - Review ${options.catalogueLabel} to set displayName, description, emoji, color, type, and surfaceTargets as needed.`);
461
458
  }
462
459
  else {
463
- console.log(' - Run "playdrop-cli init ." when you are ready to add catalogue metadata and project docs.');
460
+ console.log(' - Run "playdrop project init ." when you are ready to add catalogue metadata and project docs.');
464
461
  }
465
462
  if (options.projectDir) {
466
463
  console.log(` - Open ${options.projectDir} to continue building your project.`);
@@ -477,12 +474,12 @@ function logNextSteps(name, options) {
477
474
  else {
478
475
  console.log(` - Build your app in ${options.entryPointLabel}.`);
479
476
  }
480
- console.log(` - Test locally with "playdrop-cli dev ${name}".`);
477
+ console.log(` - Test locally with "playdrop project dev ${name}".`);
481
478
  if (options.hasCatalogue) {
482
- console.log(` - Deploy a single app with "playdrop-cli upload ${name}" or everything in the catalogue with "playdrop-cli upload .".`);
479
+ console.log(` - Publish a single app with "playdrop project publish ${name}" or everything in the catalogue with "playdrop project publish .".`);
483
480
  }
484
481
  else {
485
- console.log(' - After running "playdrop-cli init", upload with "playdrop-cli upload ." to share your project.');
482
+ console.log(' - After running "playdrop project init", publish with "playdrop project publish ." to share your project.');
486
483
  }
487
484
  }
488
485
  async function promptInit() {
@@ -490,7 +487,7 @@ async function promptInit() {
490
487
  return false;
491
488
  }
492
489
  const rl = promises_1.default.createInterface({ input: node_process_1.stdin, output: node_process_1.stdout });
493
- const answer = await rl.question('No catalogue.json found. Run "playdrop-cli init ." first? (y/N) ');
490
+ const answer = await rl.question('No catalogue.json found. Run "playdrop project init ." first? (y/N) ');
494
491
  rl.close();
495
492
  return /^y(es)?$/i.test(answer.trim());
496
493
  }
@@ -501,8 +498,8 @@ async function ensureLocalCatalogue(cataloguePath) {
501
498
  const shouldInit = await promptInit();
502
499
  if (!shouldInit) {
503
500
  (0, messages_1.printErrorWithHelp)('A local catalogue.json is required to register app metadata next to the app file.', [
504
- 'Run "playdrop-cli init ." in this directory to create catalogue.json and starter docs before running "playdrop-cli create".'
505
- ], { command: 'create', includeGeneralHelp: false });
501
+ 'Run "playdrop project init ." in this directory to create catalogue.json and starter docs before running "playdrop project create app".'
502
+ ], { command: 'project create app', includeGeneralHelp: false });
506
503
  process.exitCode = process.exitCode || 1;
507
504
  return null;
508
505
  }
@@ -535,24 +532,17 @@ function warnMissingWorkspaceReadme(cataloguePath) {
535
532
  }
536
533
  const workspaceLabel = (0, node_path_1.relative)(process.cwd(), workspaceRoot) || '.';
537
534
  const initCommandTarget = workspaceLabel === '.' ? '.' : workspaceLabel;
538
- console.log(`\nWorkspace docs reminder: README.md is missing at ${workspaceLabel}. Add documentation there or run "playdrop-cli init ${initCommandTarget}" before creating apps next time to auto-populate it.`);
535
+ console.log(`\nWorkspace docs reminder: README.md is missing at ${workspaceLabel}. Add documentation there or run "playdrop project init ${initCommandTarget}" before creating apps next time to auto-populate it.`);
539
536
  }
540
537
  function parseTemplateKey(value) {
541
538
  const parts = value.split('/').map((part) => part.trim()).filter(Boolean);
542
- if (parts.length === 1) {
543
- const slug = parts[0];
544
- if (!slug) {
545
- return null;
546
- }
547
- return { namespace: 'playdrop', slug, key: `playdrop/template/${slug}` };
548
- }
549
539
  if (parts.length >= 3) {
550
540
  const [creator, typeSegment, ...rest] = parts;
551
541
  if (!creator) {
552
542
  return null;
553
543
  }
554
544
  const normalizedType = typeSegment.toLowerCase();
555
- if (normalizedType !== 'template' && normalizedType !== 'templates') {
545
+ if (normalizedType !== 'template') {
556
546
  return null;
557
547
  }
558
548
  const slug = rest.join('/');
@@ -600,11 +590,18 @@ async function fetchRemixScaffold(client, creator, app) {
600
590
  }
601
591
  const metadata = response.metadata;
602
592
  const entryPoint = extractEntryPointFromMetadata(metadata);
593
+ const sourceVersion = archiveUrl
594
+ ? (await client.fetchAppBySlug(creator, app)).app.currentVersion ?? null
595
+ : null;
596
+ if (archiveUrl && !sourceVersion) {
597
+ throw new Error('Remix source archive is missing a current version');
598
+ }
603
599
  return {
604
600
  html: htmlContent,
605
601
  metadata,
606
602
  archiveUrl,
607
603
  entryPoint,
604
+ sourceVersion,
608
605
  };
609
606
  }
610
607
  catch (unknownError) {
@@ -618,6 +615,14 @@ async function fetchRemixScaffold(client, creator, app) {
618
615
  throw unknownError;
619
616
  }
620
617
  }
618
+ async function resolveAuthenticatedCreatorUsername(client) {
619
+ const response = await client.me();
620
+ const username = typeof response?.user?.username === 'string' ? response.user.username.trim() : '';
621
+ if (!username) {
622
+ throw new Error('missing_creator_username');
623
+ }
624
+ return username;
625
+ }
621
626
  async function fetchTemplateScaffold(client, namespace, slug) {
622
627
  try {
623
628
  const response = await client.fetchTemplateScaffold(namespace, slug);
@@ -672,8 +677,8 @@ async function create(name, options = {}) {
672
677
  const existingLookup = (0, catalogue_1.resolveCatalogueEntries)(process.cwd(), { filterName: name });
673
678
  if (existingLookup.errors.length > 0) {
674
679
  for (const error of existingLookup.errors) {
675
- (0, messages_1.printErrorWithHelp)(error, ['Fix the catalogue issues noted above, then rerun "playdrop-cli create".'], {
676
- command: 'create',
680
+ (0, messages_1.printErrorWithHelp)(error, ['Fix the catalogue issues noted above, then rerun "playdrop project create app".'], {
681
+ command: 'project create app',
677
682
  includeGeneralHelp: false,
678
683
  });
679
684
  }
@@ -682,8 +687,8 @@ async function create(name, options = {}) {
682
687
  }
683
688
  if (existingLookup.apps.length > 1) {
684
689
  (0, messages_1.printErrorWithHelp)(`Multiple catalogue entries share the app name "${name}".`, [
685
- 'Ensure each app has a unique name across catalogue.json files before running "playdrop-cli create".'
686
- ], { command: 'create' });
690
+ 'Ensure each app has a unique name across catalogue.json files before running "playdrop project create app".'
691
+ ], { command: 'project create app' });
687
692
  process.exitCode = 1;
688
693
  return;
689
694
  }
@@ -691,24 +696,24 @@ async function create(name, options = {}) {
691
696
  const reuseExistingApp = existingTask !== null && !templateOptionRaw && !remixOptionRaw;
692
697
  if (!reuseExistingApp && ((0, node_fs_1.existsSync)(file) || (0, node_fs_1.existsSync)(projectDirCandidate))) {
693
698
  (0, messages_1.printErrorWithHelp)(`Cannot create ${name} because a file or directory with that name already exists.`, [
694
- 'Choose a different app name or remove the existing file before running "playdrop-cli create" again.'
695
- ], { command: 'create' });
699
+ 'Choose a different app name or remove the existing file before running "playdrop project create app" again.'
700
+ ], { command: 'project create app' });
696
701
  process.exitCode = 1;
697
702
  return;
698
703
  }
699
704
  if (templateOptionRaw && remixOptionRaw) {
700
705
  (0, messages_1.printErrorWithHelp)('Cannot use --template and --remix at the same time.', [
701
706
  'Choose one source: use "--remix {creator}/{type}/{name}" to remix an existing app, or "--template {creator}/template/{name}" to start from a template.'
702
- ], { command: 'create' });
707
+ ], { command: 'project create app' });
703
708
  process.exitCode = 1;
704
709
  return;
705
710
  }
706
711
  if (!templateOptionRaw && !remixOptionRaw) {
707
712
  if (!reuseExistingApp) {
708
713
  (0, messages_1.printErrorWithHelp)('Specify either --template or --remix when creating an app.', [
709
- 'Use "playdrop-cli list --type templates" to discover available templates.',
714
+ 'Use "playdrop browse --kind app --app-type template" to discover available templates.',
710
715
  'Browse https://playdrop.ai, pick an app, and pass its key with "--remix creator/type/name".'
711
- ], { command: 'create' });
716
+ ], { command: 'project create app' });
712
717
  process.exitCode = 1;
713
718
  return;
714
719
  }
@@ -718,7 +723,7 @@ async function create(name, options = {}) {
718
723
  const cfg = (0, config_1.loadConfig)();
719
724
  const envName = cfg.env;
720
725
  if (!envName) {
721
- (0, messages_1.printLoginRequired)('Creating an app', 'create');
726
+ (0, messages_1.printLoginRequired)('Creating an app', 'project create app');
722
727
  process.exitCode = 1;
723
728
  return;
724
729
  }
@@ -727,13 +732,13 @@ async function create(name, options = {}) {
727
732
  const choices = (0, environment_1.formatEnvironmentList)();
728
733
  (0, messages_1.printErrorWithHelp)(`Environment "${envName}" from your Playdrop config is not supported.`, [
729
734
  `Available environments: ${choices}.`,
730
- 'Run "playdrop-cli login --env <env>" to save a supported environment before creating apps.'
731
- ], { command: 'create', includeGeneralHelp: false });
735
+ 'Run "playdrop auth login --env <env>" to save a supported environment before creating apps.'
736
+ ], { command: 'project create app', includeGeneralHelp: false });
732
737
  process.exitCode = 1;
733
738
  return;
734
739
  }
735
740
  if (!cfg.token) {
736
- (0, messages_1.printLoginRequired)('Creating an app', 'create');
741
+ (0, messages_1.printLoginRequired)('Creating an app', 'project create app');
737
742
  process.exitCode = 1;
738
743
  return;
739
744
  }
@@ -750,6 +755,7 @@ async function create(name, options = {}) {
750
755
  let projectCataloguePath = null;
751
756
  const client = (0, apiClient_1.createCliApiClient)({ baseUrl: envConfig.apiBase, token: cfg.token });
752
757
  const sourceInfo = {};
758
+ let remixSourceTarget = null;
753
759
  let scaffold = null;
754
760
  let provenanceMessage = '';
755
761
  if (!reuseExistingApp && remixOption) {
@@ -757,12 +763,13 @@ async function create(name, options = {}) {
757
763
  if (!parsed) {
758
764
  (0, messages_1.printErrorWithHelp)('The --remix value must use the {creator}/{type}/{name} key format.', [
759
765
  'Example: playdrop/game/hangingout.',
760
- 'Use "playdrop-cli list --type app" to find remixable keys.'
761
- ], { command: 'create' });
766
+ 'Use "playdrop browse --kind app" or "playdrop search <query> --kind app" to find remixable apps.'
767
+ ], { command: 'project create app' });
762
768
  process.exitCode = 1;
763
769
  return;
764
770
  }
765
771
  const remixKeyDisplay = `${parsed.creator}/${parsed.typeSlug}/${parsed.name}`;
772
+ remixSourceTarget = { creator: parsed.creator, name: parsed.name };
766
773
  sourceInfo.remixSlug = remixKeyDisplay;
767
774
  try {
768
775
  scaffold = await fetchRemixScaffold(client, parsed.creator, parsed.name);
@@ -782,7 +789,7 @@ async function create(name, options = {}) {
782
789
  (0, messages_1.printErrorWithHelp)(problem, [
783
790
  'Confirm the key is correct and that you have access to remix the source app.',
784
791
  'Retry once you are logged in and the Playdrop API is reachable.'
785
- ], { command: 'create' });
792
+ ], { command: 'project create app' });
786
793
  process.exitCode = 1;
787
794
  return;
788
795
  }
@@ -796,8 +803,8 @@ async function create(name, options = {}) {
796
803
  if (!parsed) {
797
804
  (0, messages_1.printErrorWithHelp)('The --template value must use the {creator}/template/{name} key format.', [
798
805
  'Example: playdrop/template/typescript_template.',
799
- 'You can also pass a short name like "starter" to use playdrop/template/starter.'
800
- ], { command: 'create' });
806
+ 'Use the exact template ref shown in Playdrop.'
807
+ ], { command: 'project create app' });
801
808
  process.exitCode = 1;
802
809
  return;
803
810
  }
@@ -820,7 +827,7 @@ async function create(name, options = {}) {
820
827
  (0, messages_1.printErrorWithHelp)(problem, [
821
828
  'Verify the template key and ensure you are logged in.',
822
829
  'Retry when the Playdrop API is reachable.'
823
- ], { command: 'create' });
830
+ ], { command: 'project create app' });
824
831
  process.exitCode = 1;
825
832
  return;
826
833
  }
@@ -828,9 +835,9 @@ async function create(name, options = {}) {
828
835
  }
829
836
  if (!reuseExistingApp && !scaffold) {
830
837
  (0, messages_1.printErrorWithHelp)('Failed to retrieve scaffold data. Specify a valid --template or --remix key and try again.', [
831
- 'Use "playdrop-cli list --type templates" to discover available templates.',
838
+ 'Use "playdrop browse --kind app --app-type template" to discover available templates.',
832
839
  'Browse https://playdrop.ai and copy an app key to pass with "--remix".'
833
- ], { command: 'create' });
840
+ ], { command: 'project create app' });
834
841
  process.exitCode = 1;
835
842
  return;
836
843
  }
@@ -853,13 +860,15 @@ async function create(name, options = {}) {
853
860
  }
854
861
  catch (error) {
855
862
  (0, messages_1.printErrorWithHelp)(`Cannot create ${projectDir} because it already exists.`, [
856
- 'Remove or rename the existing directory before running "playdrop-cli create" again.'
857
- ], { command: 'create' });
863
+ 'Remove or rename the existing directory before running "playdrop project create app" again.'
864
+ ], { command: 'project create app' });
858
865
  process.exitCode = 1;
859
866
  return;
860
867
  }
861
868
  try {
862
- const archiveBuffer = await downloadArchive(scaffold.archiveUrl);
869
+ const archiveBuffer = remixSourceTarget
870
+ ? new Uint8Array(await (await client.downloadAppSource(remixSourceTarget.creator, remixSourceTarget.name, scaffold.sourceVersion)).blob.arrayBuffer())
871
+ : await downloadArchive(scaffold.archiveUrl);
863
872
  const extraction = extractProjectArchive(archiveBuffer, projectDir);
864
873
  const extractedCatalogue = (0, node_path_1.resolve)(projectDir, CATALOGUE_FILENAME);
865
874
  projectCataloguePath = (0, node_fs_1.existsSync)(extractedCatalogue) ? extractedCatalogue : null;
@@ -888,7 +897,7 @@ async function create(name, options = {}) {
888
897
  (0, node_fs_1.rmSync)(projectDir, { recursive: true, force: true });
889
898
  (0, messages_1.printErrorWithHelp)('Extracted project archive did not include an HTML entry point.', [
890
899
  'Check the template archive and ensure playdrop.project.json specifies a valid entryPoint before retrying.'
891
- ], { command: 'create' });
900
+ ], { command: 'project create app' });
892
901
  process.exitCode = 1;
893
902
  return;
894
903
  }
@@ -901,7 +910,7 @@ async function create(name, options = {}) {
901
910
  const detailMessage = typeof error?.message === 'string' && error.message.trim()
902
911
  ? error.message.trim()
903
912
  : 'Failed to download or extract the project archive.';
904
- (0, messages_1.printNetworkIssue)(detailMessage, 'create');
913
+ (0, messages_1.printNetworkIssue)(detailMessage, 'project create app');
905
914
  process.exitCode = 1;
906
915
  return;
907
916
  }
@@ -912,8 +921,8 @@ async function create(name, options = {}) {
912
921
  htmlFilePath = existingTask.filePath;
913
922
  if (!(0, node_fs_1.existsSync)(htmlFilePath) || !(0, node_fs_1.statSync)(htmlFilePath).isFile()) {
914
923
  (0, messages_1.printErrorWithHelp)(`Could not reuse existing app because ${htmlFilePath} does not exist.`, [
915
- 'Update catalogue.json or remove the entry before rerunning "playdrop-cli create".'
916
- ], { command: 'create' });
924
+ 'Update catalogue.json or remove the entry before rerunning "playdrop project create app".'
925
+ ], { command: 'project create app' });
917
926
  process.exitCode = 1;
918
927
  return;
919
928
  }
@@ -922,7 +931,7 @@ async function create(name, options = {}) {
922
931
  cataloguePathToUse = existingTask.catalogueAbsolutePath;
923
932
  }
924
933
  else if (!scaffold?.html) {
925
- (0, messages_1.printNetworkIssue)('Unable to retrieve template content for playdrop-cli create.', 'create');
934
+ (0, messages_1.printNetworkIssue)('Unable to retrieve template content for playdrop project create app.', 'project create app');
926
935
  process.exitCode = 1;
927
936
  return;
928
937
  }
@@ -966,9 +975,9 @@ async function create(name, options = {}) {
966
975
  ? error.message
967
976
  : `Could not update ${fallbackLabel} because it contains invalid JSON.`;
968
977
  const suggestions = typeof error?.message === 'string' && error.message.includes('surfaceTargets')
969
- ? ['Fix the catalogue entry described above, then rerun "playdrop-cli create".']
970
- : [`Fix the JSON in ${fallbackLabel} and add ${name} again before rerunning "playdrop-cli create".`];
971
- (0, messages_1.printErrorWithHelp)(message, suggestions, { command: 'create' });
978
+ ? ['Fix the catalogue entry described above, then rerun "playdrop project create app".']
979
+ : [`Fix the JSON in ${fallbackLabel} and add ${name} again before rerunning "playdrop project create app".`];
980
+ (0, messages_1.printErrorWithHelp)(message, suggestions, { command: 'project create app' });
972
981
  process.exitCode = 1;
973
982
  return;
974
983
  }
@@ -987,7 +996,7 @@ async function create(name, options = {}) {
987
996
  const otherErrors = registrationLookup.errors.filter((error) => typeof error !== 'string' || !error.includes('Duplicate app name'));
988
997
  if (otherErrors.length > 0) {
989
998
  for (const error of otherErrors) {
990
- (0, messages_1.printErrorWithHelp)(error, ['Fix the catalogue issues noted above, then rerun "playdrop-cli create".'], { command: 'create', includeGeneralHelp: false });
999
+ (0, messages_1.printErrorWithHelp)(error, ['Fix the catalogue issues noted above, then rerun "playdrop project create app".'], { command: 'project create app', includeGeneralHelp: false });
991
1000
  }
992
1001
  process.exitCode = 1;
993
1002
  return;
@@ -995,8 +1004,8 @@ async function create(name, options = {}) {
995
1004
  }
996
1005
  if (registrationLookup.apps.length === 0) {
997
1006
  (0, messages_1.printErrorWithHelp)(`App "${name}" was not found in any catalogue.json after scaffolding.`, [
998
- 'Ensure catalogue.json was updated, then rerun "playdrop-cli create".'
999
- ], { command: 'create' });
1007
+ 'Ensure catalogue.json was updated, then rerun "playdrop project create app".'
1008
+ ], { command: 'project create app' });
1000
1009
  process.exitCode = 1;
1001
1010
  return;
1002
1011
  }
@@ -1027,8 +1036,8 @@ async function create(name, options = {}) {
1027
1036
  }
1028
1037
  if (!selectedTask) {
1029
1038
  (0, messages_1.printErrorWithHelp)(`Multiple catalogue entries share the app name "${name}".`, [
1030
- 'Ensure each app has a unique name across catalogue.json files before running "playdrop-cli create".'
1031
- ], { command: 'create' });
1039
+ 'Ensure each app has a unique name across catalogue.json files before running "playdrop project create app".'
1040
+ ], { command: 'project create app' });
1032
1041
  process.exitCode = 1;
1033
1042
  return;
1034
1043
  }
@@ -1046,9 +1055,40 @@ async function create(name, options = {}) {
1046
1055
  name,
1047
1056
  displayName,
1048
1057
  };
1058
+ let creatorUsername = '';
1059
+ try {
1060
+ creatorUsername = await resolveAuthenticatedCreatorUsername(client);
1061
+ }
1062
+ catch (error) {
1063
+ if (error instanceof http_1.CLIUnsupportedClientError) {
1064
+ process.exitCode = 1;
1065
+ return;
1066
+ }
1067
+ if (error instanceof types_1.UnsupportedClientError) {
1068
+ (0, http_1.handleUnsupportedError)(error, 'Resolve creator account');
1069
+ process.exitCode = 1;
1070
+ return;
1071
+ }
1072
+ if (error instanceof types_1.ApiError) {
1073
+ (0, messages_1.printErrorWithHelp)(`Failed to resolve your creator account (status ${error.status}).`, ['Run "playdrop auth login" to refresh your session, then try again.'], { command: 'project create app' });
1074
+ process.exitCode = 1;
1075
+ return;
1076
+ }
1077
+ if (error instanceof TypeError) {
1078
+ (0, messages_1.printNetworkIssue)('Could not reach the Playdrop API to resolve your creator account.', 'project create app');
1079
+ process.exitCode = 1;
1080
+ return;
1081
+ }
1082
+ if (error instanceof Error && error.message === 'missing_creator_username') {
1083
+ (0, messages_1.printErrorWithHelp)('The API did not return a creator username.', ['Run "playdrop auth login" again, then retry.'], { command: 'project create app' });
1084
+ process.exitCode = 1;
1085
+ return;
1086
+ }
1087
+ throw error;
1088
+ }
1049
1089
  let createConflict = false;
1050
1090
  try {
1051
- await client.createApp(createPayload);
1091
+ await client.createApp(creatorUsername, createPayload);
1052
1092
  console.log(`Registered ${displayName} with the Playdrop API.`);
1053
1093
  }
1054
1094
  catch (error) {
@@ -1069,13 +1109,13 @@ async function create(name, options = {}) {
1069
1109
  else {
1070
1110
  (0, messages_1.printErrorWithHelp)(`Failed to register ${name} (status ${error.status}).`, [
1071
1111
  'Ensure your account has creator permissions and retry once the issue is resolved.'
1072
- ], { command: 'create' });
1112
+ ], { command: 'project create app' });
1073
1113
  process.exitCode = 1;
1074
1114
  return;
1075
1115
  }
1076
1116
  }
1077
1117
  else if (error instanceof TypeError) {
1078
- (0, messages_1.printNetworkIssue)('Could not reach the Playdrop API to register the app.', 'create');
1118
+ (0, messages_1.printNetworkIssue)('Could not reach the Playdrop API to register the app.', 'project create app');
1079
1119
  process.exitCode = 1;
1080
1120
  return;
1081
1121
  }
@@ -1093,7 +1133,7 @@ async function create(name, options = {}) {
1093
1133
  }
1094
1134
  if (Object.keys(updatePayload).length > 0) {
1095
1135
  try {
1096
- await client.updateApp(name, updatePayload);
1136
+ await client.updateApp(creatorUsername, name, updatePayload);
1097
1137
  if (createConflict) {
1098
1138
  console.log(`Updated ${name} metadata on the Playdrop API.`);
1099
1139
  }
@@ -1111,12 +1151,12 @@ async function create(name, options = {}) {
1111
1151
  if (error instanceof types_1.ApiError) {
1112
1152
  (0, messages_1.printErrorWithHelp)(`Failed to update ${name} metadata (status ${error.status}).`, [
1113
1153
  'Update the catalogue entry and retry, or contact the Playdrop team if the issue persists.'
1114
- ], { command: 'create' });
1154
+ ], { command: 'project create app' });
1115
1155
  process.exitCode = 1;
1116
1156
  return;
1117
1157
  }
1118
1158
  if (error instanceof TypeError) {
1119
- (0, messages_1.printNetworkIssue)('Could not reach the Playdrop API to update the app.', 'create');
1159
+ (0, messages_1.printNetworkIssue)('Could not reach the Playdrop API to update the app.', 'project create app');
1120
1160
  process.exitCode = 1;
1121
1161
  return;
1122
1162
  }
@@ -0,0 +1,49 @@
1
+ type BrowseCreationsOptions = {
2
+ kind?: string;
3
+ creator?: string;
4
+ limit?: string | number;
5
+ offset?: string | number;
6
+ json?: boolean;
7
+ };
8
+ type AppUpdateOptions = {
9
+ creator?: string;
10
+ displayName?: string;
11
+ type?: string;
12
+ json?: boolean;
13
+ };
14
+ type AssetUpdateOptions = {
15
+ creator?: string;
16
+ name?: string;
17
+ displayName?: string;
18
+ description?: string;
19
+ clearDescription?: boolean;
20
+ json?: boolean;
21
+ };
22
+ type AssetPackUpdateOptions = AssetUpdateOptions & {
23
+ previewAppVersionId?: string | number;
24
+ clearPreviewAppVersionId?: boolean;
25
+ };
26
+ type MutationOptions = {
27
+ creator?: string;
28
+ json?: boolean;
29
+ };
30
+ export declare function browseCreations(options?: BrowseCreationsOptions): Promise<void>;
31
+ export declare function updateCreationApp(nameArg: string | undefined, options?: AppUpdateOptions): Promise<void>;
32
+ export declare function deleteCreationApp(nameArg: string | undefined, options?: MutationOptions): Promise<void>;
33
+ export declare function setCurrentCreationAppVersion(nameArg: string | undefined, versionArg: string | undefined, options?: MutationOptions): Promise<void>;
34
+ export declare function publishCreationAppVersion(nameArg: string | undefined, versionArg: string | undefined, options?: MutationOptions): Promise<void>;
35
+ export declare function unpublishCreationAppVersion(nameArg: string | undefined, versionArg: string | undefined, options?: MutationOptions): Promise<void>;
36
+ export declare function deleteCreationAppVersion(nameArg: string | undefined, versionArg: string | undefined, options?: MutationOptions): Promise<void>;
37
+ export declare function updateCreationAsset(nameArg: string | undefined, options?: AssetUpdateOptions): Promise<void>;
38
+ export declare function deleteCreationAsset(nameArg: string | undefined, options?: MutationOptions): Promise<void>;
39
+ export declare function setCurrentCreationAssetVersion(nameArg: string | undefined, revisionArg: string | undefined, options?: MutationOptions): Promise<void>;
40
+ export declare function publishCreationAssetVersion(nameArg: string | undefined, revisionArg: string | undefined, options?: MutationOptions): Promise<void>;
41
+ export declare function unpublishCreationAssetVersion(nameArg: string | undefined, revisionArg: string | undefined, options?: MutationOptions): Promise<void>;
42
+ export declare function deleteCreationAssetVersion(nameArg: string | undefined, revisionArg: string | undefined, options?: MutationOptions): Promise<void>;
43
+ export declare function updateCreationAssetPack(nameArg: string | undefined, options?: AssetPackUpdateOptions): Promise<void>;
44
+ export declare function deleteCreationAssetPack(nameArg: string | undefined, options?: MutationOptions): Promise<void>;
45
+ export declare function setCurrentCreationAssetPackVersion(nameArg: string | undefined, versionArg: string | undefined, options?: MutationOptions): Promise<void>;
46
+ export declare function publishCreationAssetPackVersion(nameArg: string | undefined, versionArg: string | undefined, options?: MutationOptions): Promise<void>;
47
+ export declare function unpublishCreationAssetPackVersion(nameArg: string | undefined, versionArg: string | undefined, options?: MutationOptions): Promise<void>;
48
+ export declare function deleteCreationAssetPackVersion(nameArg: string | undefined, versionArg: string | undefined, options?: MutationOptions): Promise<void>;
49
+ export {};