@playdrop/playdrop-cli 0.16.2 → 0.16.11
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/bin/playdrop +1 -2
- package/config/client-meta.json +4 -4
- package/dist/apiClient.d.ts +2 -2
- package/dist/apiClient.js +16 -20
- package/dist/appUrls.d.ts +2 -2
- package/dist/appUrls.js +31 -33
- package/dist/apps/build.d.ts +2 -2
- package/dist/apps/build.js +83 -83
- package/dist/apps/index.d.ts +7 -7
- package/dist/apps/index.js +8 -8
- package/dist/apps/loadCheck.d.ts +28 -16
- package/dist/apps/loadCheck.js +411 -279
- package/dist/apps/registration.d.ts +3 -3
- package/dist/apps/registration.js +1 -1
- package/dist/apps/staticHtml.d.ts +3 -3
- package/dist/apps/staticHtml.js +90 -91
- package/dist/apps/surfaceProfiles.d.ts +2 -2
- package/dist/apps/surfaceProfiles.js +6 -6
- package/dist/apps/upload.d.ts +5 -5
- package/dist/apps/upload.js +75 -81
- package/dist/apps/validate.d.ts +2 -2
- package/dist/apps/validate.js +18 -22
- package/dist/assetSpecs.d.ts +2 -2
- package/dist/assetSpecs.js +35 -35
- package/dist/assets/model-artifacts.d.ts +1 -1
- package/dist/assets/model-artifacts.js +81 -77
- package/dist/assets/model-worker.d.ts +1 -1
- package/dist/assets/model-worker.js +6 -6
- package/dist/browser.js +9 -9
- package/dist/catalogue-utils.d.ts +1 -1
- package/dist/catalogue-utils.js +26 -26
- package/dist/catalogue.d.ts +21 -16
- package/dist/catalogue.js +509 -413
- package/dist/clientInfo.d.ts +1 -1
- package/dist/clientInfo.js +28 -28
- package/dist/commandContext.d.ts +5 -5
- package/dist/commandContext.js +19 -23
- package/dist/commands/accounts.js +6 -6
- package/dist/commands/ads.js +16 -16
- package/dist/commands/agents.d.ts +2 -2
- package/dist/commands/agents.js +131 -127
- package/dist/commands/boosts.js +41 -31
- package/dist/commands/browse.d.ts +2 -2
- package/dist/commands/browse.js +168 -128
- package/dist/commands/build.js +9 -9
- package/dist/commands/captureListing.d.ts +8 -8
- package/dist/commands/captureListing.js +292 -332
- package/dist/commands/changelog.js +1 -1
- package/dist/commands/chat.js +51 -53
- package/dist/commands/check.d.ts +1 -1
- package/dist/commands/check.js +44 -44
- package/dist/commands/clients.d.ts +3 -3
- package/dist/commands/clients.js +67 -64
- package/dist/commands/comments.js +36 -29
- package/dist/commands/create.js +305 -312
- package/dist/commands/createRemixContent.d.ts +1 -1
- package/dist/commands/createRemixContent.js +65 -60
- package/dist/commands/creations.js +205 -135
- package/dist/commands/credits.js +37 -27
- package/dist/commands/detail.js +40 -34
- package/dist/commands/dev.js +103 -126
- package/dist/commands/devBrowser.js +74 -65
- package/dist/commands/devRuntimeAssets.d.ts +4 -4
- package/dist/commands/devRuntimeAssets.js +38 -40
- package/dist/commands/devServer.d.ts +4 -4
- package/dist/commands/devServer.js +183 -174
- package/dist/commands/devShared.d.ts +3 -3
- package/dist/commands/devShared.js +31 -31
- package/dist/commands/doctor.d.ts +5 -5
- package/dist/commands/doctor.js +63 -57
- package/dist/commands/documentation.js +42 -32
- package/dist/commands/feedback.js +59 -42
- package/dist/commands/format.js +9 -9
- package/dist/commands/generation.d.ts +2 -2
- package/dist/commands/generation.js +344 -326
- package/dist/commands/init.d.ts +4 -4
- package/dist/commands/init.js +64 -61
- package/dist/commands/login.d.ts +2 -2
- package/dist/commands/login.js +42 -62
- package/dist/commands/logout.js +4 -4
- package/dist/commands/marketing.d.ts +8 -8
- package/dist/commands/marketing.js +246 -297
- package/dist/commands/notes.js +19 -19
- package/dist/commands/notifications.js +34 -22
- package/dist/commands/npmProcess.js +3 -3
- package/dist/commands/ownedRuntimeImageValidation.d.ts +1 -1
- package/dist/commands/ownedRuntimeImageValidation.js +19 -17
- package/dist/commands/play.js +12 -21
- package/dist/commands/publicPages.js +8 -4
- package/dist/commands/review.js +123 -110
- package/dist/commands/search.js +107 -88
- package/dist/commands/tags.js +10 -12
- package/dist/commands/taskCaptureSession.d.ts +3 -3
- package/dist/commands/taskCaptureSession.js +3 -3
- package/dist/commands/tweaks.js +25 -23
- package/dist/commands/upgrade.js +40 -31
- package/dist/commands/upload-content.d.ts +5 -5
- package/dist/commands/upload-content.js +130 -122
- package/dist/commands/upload-graph.d.ts +1 -1
- package/dist/commands/upload-graph.js +7 -11
- package/dist/commands/upload.d.ts +7 -7
- package/dist/commands/upload.js +196 -217
- package/dist/commands/validate.js +33 -32
- package/dist/commands/versionsBrowse.js +61 -51
- package/dist/commands/whoami.js +11 -14
- package/dist/commands/worker/archive-staging.d.ts +9 -0
- package/dist/commands/worker/archive-staging.js +257 -0
- package/dist/commands/worker/instrument-evidence.d.ts +1 -1
- package/dist/commands/worker/instrument-evidence.js +41 -43
- package/dist/commands/worker/provider-telemetry.d.ts +2 -1
- package/dist/commands/worker/provider-telemetry.js +181 -64
- package/dist/commands/worker/runtime.d.ts +18 -3
- package/dist/commands/worker/runtime.js +291 -239
- package/dist/commands/worker.d.ts +83 -22
- package/dist/commands/worker.js +1980 -1411
- package/dist/commands/workspaces.d.ts +2 -2
- package/dist/commands/workspaces.js +57 -57
- package/dist/config.js +23 -20
- package/dist/devAuth.d.ts +3 -3
- package/dist/devAuth.js +20 -17
- package/dist/environment.d.ts +1 -1
- package/dist/environment.js +34 -34
- package/dist/errors.d.ts +1 -1
- package/dist/errors.js +7 -7
- package/dist/externalAssetPackValidation.d.ts +1 -1
- package/dist/externalAssetPackValidation.js +9 -9
- package/dist/http.d.ts +1 -1
- package/dist/http.js +9 -9
- package/dist/index.js +657 -664
- package/dist/listingCaptureLease.js +23 -23
- package/dist/listingPreflight.d.ts +2 -2
- package/dist/listingPreflight.js +33 -33
- package/dist/messages.js +6 -14
- package/dist/output.js +9 -9
- package/dist/playwright.d.ts +1 -1
- package/dist/playwright.js +35 -40
- package/dist/proxyFetch.js +30 -27
- package/dist/recorderRelease.js +8 -8
- package/dist/refs.d.ts +5 -5
- package/dist/refs.js +40 -37
- package/dist/sessionCookie.js +15 -21
- package/dist/shellProbe.js +5 -5
- package/dist/taskSelection.d.ts +3 -3
- package/dist/taskSelection.js +67 -62
- package/dist/taskUtils.d.ts +1 -1
- package/dist/taskUtils.js +4 -4
- package/dist/tweakStaleness.d.ts +3 -3
- package/dist/tweakStaleness.js +8 -8
- package/dist/uploadLog.d.ts +3 -3
- package/dist/uploadLog.js +51 -51
- package/dist/versionCompare.js +3 -3
- package/dist/workerAppProject.d.ts +1 -1
- package/dist/workerAppProject.js +10 -17
- package/dist/workspaceAuth.d.ts +1 -1
- package/dist/workspaceAuth.js +28 -22
- package/node_modules/@playdrop/ai-client/dist/index.d.ts +35 -35
- package/node_modules/@playdrop/ai-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/client.d.ts +34 -33
- package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/core/errors.d.ts +1 -1
- package/node_modules/@playdrop/api-client/dist/core/errors.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/core/request.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/core/request.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/admin.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/admin.js +4 -1
- package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.d.ts +4 -3
- package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.js +12 -0
- package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts +4 -4
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/asset-packs.d.ts +4 -4
- package/node_modules/@playdrop/api-client/dist/domains/asset-packs.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts +4 -4
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/auth.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/auth.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/chat.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/chat.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/comments.d.ts +3 -3
- package/node_modules/@playdrop/api-client/dist/domains/comments.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/free-credits.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/free-credits.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/me.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/me.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/payments.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/player-meta.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/player-meta.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/playtrade.d.ts +3 -3
- package/node_modules/@playdrop/api-client/dist/domains/playtrade.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/playtrade.js +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/search.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/search.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/tags.d.ts +2 -2
- package/node_modules/@playdrop/api-client/dist/domains/tags.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/index.d.ts +19 -18
- package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/index.js +7 -2
- package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.js +47 -47
- package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.d.ts +3 -3
- package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.js +32 -47
- package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/format-utils.js +16 -18
- package/node_modules/@playdrop/boxel-core/dist/src/format-utils.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/geometry.d.ts +2 -2
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/index.d.ts +4 -4
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/common.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/index.d.ts +3 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.d.ts +2 -2
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.js +44 -45
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/types.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.d.ts +2 -2
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.js +40 -44
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.d.ts +2 -2
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.js +30 -34
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/index.d.ts +4 -4
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/index.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.d.ts +3 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.js +23 -20
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/artifacts.d.ts +3 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/artifacts.js +3 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.js +21 -21
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/index.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/index.js +2 -2
- package/node_modules/@playdrop/boxel-core/dist/src/index.d.ts +19 -19
- package/node_modules/@playdrop/boxel-core/dist/src/materials.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/materials.js +12 -16
- package/node_modules/@playdrop/boxel-core/dist/src/materials.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.js +38 -41
- package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/serialization.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/serialization.js +54 -56
- package/node_modules/@playdrop/boxel-core/dist/src/serialization.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/textures.d.ts +3 -3
- package/node_modules/@playdrop/boxel-core/dist/src/textures.js +39 -45
- package/node_modules/@playdrop/boxel-core/dist/src/textures.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.d.ts +2 -2
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.js +39 -43
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.d.ts +3 -3
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.js +35 -35
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.js +18 -18
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.d.ts +3 -3
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.js +50 -48
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.js +22 -26
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.d.ts +2 -2
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.js +8 -8
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.d.ts +2 -2
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.js +23 -28
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/types.d.ts +8 -8
- package/node_modules/@playdrop/boxel-core/dist/src/validation.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/validation.js +93 -95
- package/node_modules/@playdrop/boxel-core/dist/src/validation.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.js +2 -2
- package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.js.map +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/voxels.d.ts +1 -1
- package/node_modules/@playdrop/boxel-core/dist/src/voxels.js +2 -7
- package/node_modules/@playdrop/boxel-core/dist/src/voxels.js.map +1 -1
- package/node_modules/@playdrop/boxel-three/dist/src/animations.d.ts +3 -3
- package/node_modules/@playdrop/boxel-three/dist/src/builders.d.ts +4 -4
- package/node_modules/@playdrop/boxel-three/dist/src/context.d.ts +3 -3
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/glb.d.ts +6 -6
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/glb.js +9 -1
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/image.d.ts +3 -3
- package/node_modules/@playdrop/boxel-three/dist/src/index.d.ts +17 -17
- package/node_modules/@playdrop/boxel-three/dist/src/instantiate.d.ts +9 -9
- package/node_modules/@playdrop/boxel-three/dist/src/nodes.d.ts +3 -3
- package/node_modules/@playdrop/boxel-three/dist/src/nodes.js +1 -1
- package/node_modules/@playdrop/boxel-three/dist/src/overlays.d.ts +2 -2
- package/node_modules/@playdrop/boxel-three/dist/src/primitives.d.ts +1 -1
- package/node_modules/@playdrop/boxel-three/dist/src/scene.d.ts +1 -1
- package/node_modules/@playdrop/boxel-three/dist/src/skinned-mesh.d.ts +2 -2
- package/node_modules/@playdrop/boxel-three/dist/src/texture-atlas.d.ts +1 -1
- package/node_modules/@playdrop/boxel-three/dist/src/textures.d.ts +3 -3
- package/node_modules/@playdrop/boxel-three/dist/src/types.d.ts +4 -4
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/faces.d.ts +2 -2
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/mesher.d.ts +1 -1
- package/node_modules/@playdrop/boxel-three/dist/test/fixtures/render-worker.d.ts +1 -1
- package/node_modules/@playdrop/config/client-meta.json +4 -4
- package/node_modules/@playdrop/config/dist/src/client-meta.d.ts +1 -1
- package/node_modules/@playdrop/config/dist/src/client-meta.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/client-meta.js +10 -10
- package/node_modules/@playdrop/config/dist/src/constants.js +10 -10
- package/node_modules/@playdrop/config/dist/src/creator-plans.d.ts +1 -1
- package/node_modules/@playdrop/config/dist/src/creator-plans.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/creator-plans.js +27 -28
- package/node_modules/@playdrop/config/dist/src/deployment.d.ts +4 -4
- package/node_modules/@playdrop/config/dist/src/deployment.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/deployment.js +42 -41
- package/node_modules/@playdrop/config/dist/src/game-arena.js +12 -12
- package/node_modules/@playdrop/config/dist/src/index.d.ts +9 -9
- package/node_modules/@playdrop/config/dist/src/index.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/index.js +24 -25
- package/node_modules/@playdrop/config/dist/src/public-deployment.d.ts +4 -4
- package/node_modules/@playdrop/config/dist/src/public-deployment.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/public-deployment.js +41 -39
- package/node_modules/@playdrop/config/dist/src/runtime-client-meta.js +1 -3
- package/node_modules/@playdrop/config/dist/src/runtime-service-origins.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/runtime-service-origins.js +23 -25
- package/node_modules/@playdrop/config/dist/src/server/fastify.d.ts +5 -5
- package/node_modules/@playdrop/config/dist/src/server/fastify.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/server/fastify.js +44 -46
- package/node_modules/@playdrop/config/dist/src/server/logging.d.ts +1 -1
- package/node_modules/@playdrop/config/dist/src/server/logging.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/server/logging.js +6 -8
- package/node_modules/@playdrop/config/dist/src/types.d.ts +2 -2
- package/node_modules/@playdrop/config/dist/test/creator-plans.test.js +12 -12
- package/node_modules/@playdrop/config/dist/test/deployment.test.js +59 -59
- package/node_modules/@playdrop/config/dist/test/fastify.test.js +4 -4
- package/node_modules/@playdrop/config/dist/test/game-arena.test.js +8 -8
- package/node_modules/@playdrop/config/dist/test/logging.test.js +6 -6
- package/node_modules/@playdrop/config/dist/test/validateClientEnvironment.test.js +57 -57
- package/node_modules/@playdrop/config/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@playdrop/types/dist/agent-task-playtest.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/agent-task-terminal.d.ts +2 -2
- package/node_modules/@playdrop/types/dist/agent-task-terminal.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/api.d.ts +314 -250
- package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/api.js +40 -59
- package/node_modules/@playdrop/types/dist/app-capability-filters.d.ts +2 -2
- package/node_modules/@playdrop/types/dist/app-playtest-tape.d.ts +6 -6
- package/node_modules/@playdrop/types/dist/app-playtest-tape.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/app-review.d.ts +2 -2
- package/node_modules/@playdrop/types/dist/app-review.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/app-review.js +1 -6
- package/node_modules/@playdrop/types/dist/app.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts +5 -5
- package/node_modules/@playdrop/types/dist/asset-spec.d.ts +4 -4
- package/node_modules/@playdrop/types/dist/asset.d.ts +11 -11
- package/node_modules/@playdrop/types/dist/attachment-policy.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/chat.d.ts +3 -3
- package/node_modules/@playdrop/types/dist/creator-public-image.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/graph.d.ts +4 -4
- package/node_modules/@playdrop/types/dist/index.d.ts +25 -25
- package/node_modules/@playdrop/types/dist/instrument-evidence.d.ts +2 -2
- package/node_modules/@playdrop/types/dist/instrument-evidence.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/instrument-evidence.js +2 -11
- package/node_modules/@playdrop/types/dist/locale.d.ts +2 -2
- package/node_modules/@playdrop/types/dist/locale.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/locale.js +2 -17
- package/node_modules/@playdrop/types/dist/owned-assets.d.ts +2 -2
- package/node_modules/@playdrop/types/dist/owned-assets.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/player-meta.d.ts +3 -3
- package/node_modules/@playdrop/types/dist/player-meta.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/playtest-notes.d.ts +11 -11
- package/node_modules/@playdrop/types/dist/playtest-notes.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/playtrade.d.ts +8 -5
- package/node_modules/@playdrop/types/dist/playtrade.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/realtime.d.ts +1 -1
- package/node_modules/@playdrop/types/dist/tweaks.d.ts +4 -4
- package/node_modules/@playdrop/types/dist/tweaks.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/tweaks.js +12 -2
- package/node_modules/@playdrop/types/dist/version.d.ts +14 -14
- package/node_modules/@playdrop/types/dist/version.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/version.js +4 -1
- package/node_modules/@playdrop/vox-three/dist/src/index.d.ts +1 -1
- package/node_modules/@playdrop/vox-three/dist/src/vox.d.ts +2 -2
- package/node_modules/@playdrop/vox-three/dist/src/vox.js +20 -18
- package/node_modules/@playdrop/vox-three/dist/src/vox.js.map +1 -1
- package/node_modules/@playdrop/vox-three/dist/test/vox.test.js +11 -14
- package/node_modules/@playdrop/vox-three/dist/test/vox.test.js.map +1 -1
- package/package.json +1 -1
package/dist/commands/create.js
CHANGED
|
@@ -27,9 +27,9 @@ const devShared_1 = require("./devShared");
|
|
|
27
27
|
const init_1 = require("./init");
|
|
28
28
|
const npmProcess_1 = require("./npmProcess");
|
|
29
29
|
const taskCaptureSession_1 = require("./taskCaptureSession");
|
|
30
|
-
const CATALOGUE_FILENAME =
|
|
31
|
-
const LEGACY_CATALOGUE_VERSION_KEY = [
|
|
32
|
-
const ALLOWED_CATALOGUE_TOP_LEVEL_KEYS = new Set([
|
|
30
|
+
const CATALOGUE_FILENAME = "catalogue.json";
|
|
31
|
+
const LEGACY_CATALOGUE_VERSION_KEY = ["schema", "Version"].join("");
|
|
32
|
+
const ALLOWED_CATALOGUE_TOP_LEVEL_KEYS = new Set(["apps", "assetSpecs", "assets", "assetPacks"]);
|
|
33
33
|
function buildArchiveDownloadHeaders(url, apiBase, token) {
|
|
34
34
|
const targetUrl = new URL(url, apiBase);
|
|
35
35
|
const apiOrigin = new URL(apiBase).origin;
|
|
@@ -38,7 +38,7 @@ function buildArchiveDownloadHeaders(url, apiBase, token) {
|
|
|
38
38
|
}
|
|
39
39
|
const headers = new Headers((0, clientInfo_1.createClientHeaders)());
|
|
40
40
|
if (token.trim().length > 0) {
|
|
41
|
-
headers.set(
|
|
41
|
+
headers.set("authorization", `Bearer ${token}`);
|
|
42
42
|
}
|
|
43
43
|
return headers;
|
|
44
44
|
}
|
|
@@ -78,11 +78,11 @@ function writeCreatedProjectWorkspaceAuth(projectDir, ctx) {
|
|
|
78
78
|
if (workspaceAuth.taskAttempt) {
|
|
79
79
|
projectAuth.taskAttempt = workspaceAuth.taskAttempt;
|
|
80
80
|
}
|
|
81
|
-
(0, node_fs_1.writeFileSync)((0, node_path_1.resolve)(projectDir,
|
|
81
|
+
(0, node_fs_1.writeFileSync)((0, node_path_1.resolve)(projectDir, ".playdrop.json"), `${JSON.stringify(projectAuth, null, 2)}\n`);
|
|
82
82
|
}
|
|
83
83
|
function sanitizeArchivePath(targetDir, relativePath) {
|
|
84
|
-
const normalized = relativePath.replace(/\\/g,
|
|
85
|
-
if (!normalized || normalized.includes(
|
|
84
|
+
const normalized = relativePath.replace(/\\/g, "/");
|
|
85
|
+
if (!normalized || normalized.includes("..")) {
|
|
86
86
|
return null;
|
|
87
87
|
}
|
|
88
88
|
const absolute = (0, node_path_1.resolve)(targetDir, normalized);
|
|
@@ -93,19 +93,19 @@ function sanitizeArchivePath(targetDir, relativePath) {
|
|
|
93
93
|
}
|
|
94
94
|
function trimArchivePrefix(entries) {
|
|
95
95
|
const filtered = entries
|
|
96
|
-
.map((name) => name.replace(/\\/g,
|
|
97
|
-
.filter((name) => name.length > 0 && !name.startsWith(
|
|
96
|
+
.map((name) => name.replace(/\\/g, "/"))
|
|
97
|
+
.filter((name) => name.length > 0 && !name.startsWith("__MACOSX/"));
|
|
98
98
|
if (filtered.length === 0) {
|
|
99
|
-
return
|
|
99
|
+
return "";
|
|
100
100
|
}
|
|
101
|
-
const firstSegments = new Set(filtered.map((name) => name.split(
|
|
101
|
+
const firstSegments = new Set(filtered.map((name) => name.split("/")[0]));
|
|
102
102
|
if (firstSegments.size === 1) {
|
|
103
103
|
const [segment] = Array.from(firstSegments);
|
|
104
|
-
if (segment && !segment.includes(
|
|
104
|
+
if (segment && !segment.includes(".")) {
|
|
105
105
|
return `${segment}/`;
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
return
|
|
108
|
+
return "";
|
|
109
109
|
}
|
|
110
110
|
function extractProjectArchive(buffer, targetDir) {
|
|
111
111
|
const files = (0, fflate_1.unzipSync)(buffer);
|
|
@@ -113,8 +113,8 @@ function extractProjectArchive(buffer, targetDir) {
|
|
|
113
113
|
const prefix = trimArchivePrefix(names);
|
|
114
114
|
let manifest = null;
|
|
115
115
|
for (const originalName of names) {
|
|
116
|
-
let name = originalName.replace(/\\/g,
|
|
117
|
-
if (!name || name.startsWith(
|
|
116
|
+
let name = originalName.replace(/\\/g, "/");
|
|
117
|
+
if (!name || name.startsWith("__MACOSX/")) {
|
|
118
118
|
continue;
|
|
119
119
|
}
|
|
120
120
|
if (prefix && name.startsWith(prefix)) {
|
|
@@ -123,7 +123,7 @@ function extractProjectArchive(buffer, targetDir) {
|
|
|
123
123
|
if (!name) {
|
|
124
124
|
continue;
|
|
125
125
|
}
|
|
126
|
-
const isDirectory = name.endsWith(
|
|
126
|
+
const isDirectory = name.endsWith("/");
|
|
127
127
|
const destination = sanitizeArchivePath(targetDir, name);
|
|
128
128
|
if (!destination) {
|
|
129
129
|
continue;
|
|
@@ -136,9 +136,9 @@ function extractProjectArchive(buffer, targetDir) {
|
|
|
136
136
|
const data = files[originalName];
|
|
137
137
|
const bufferData = Buffer.from(data);
|
|
138
138
|
(0, node_fs_1.writeFileSync)(destination, bufferData);
|
|
139
|
-
if (name ===
|
|
139
|
+
if (name === "playdrop.project.json") {
|
|
140
140
|
try {
|
|
141
|
-
manifest = JSON.parse(Buffer.from(data).toString(
|
|
141
|
+
manifest = JSON.parse(Buffer.from(data).toString("utf8"));
|
|
142
142
|
}
|
|
143
143
|
catch {
|
|
144
144
|
manifest = null;
|
|
@@ -167,13 +167,13 @@ function findFirstHtmlFile(projectDir) {
|
|
|
167
167
|
for (const entry of entries) {
|
|
168
168
|
const absolute = (0, node_path_1.join)(current, entry.name);
|
|
169
169
|
if (entry.isDirectory()) {
|
|
170
|
-
if (entry.name ===
|
|
170
|
+
if (entry.name === "node_modules" || entry.name === ".git") {
|
|
171
171
|
continue;
|
|
172
172
|
}
|
|
173
173
|
stack.push(absolute);
|
|
174
174
|
continue;
|
|
175
175
|
}
|
|
176
|
-
if (entry.isFile() && entry.name.toLowerCase().endsWith(
|
|
176
|
+
if (entry.isFile() && entry.name.toLowerCase().endsWith(".html")) {
|
|
177
177
|
return absolute;
|
|
178
178
|
}
|
|
179
179
|
}
|
|
@@ -191,19 +191,19 @@ async function promptInstallDependencies(projectDir) {
|
|
|
191
191
|
return /^y(es)?$/i.test(answer.trim());
|
|
192
192
|
}
|
|
193
193
|
function resolveNpmInstallInvocation(platform = process.platform, nodeExecutable = process.execPath) {
|
|
194
|
-
return (0, npmProcess_1.resolveNpmInvocation)([
|
|
194
|
+
return (0, npmProcess_1.resolveNpmInvocation)(["install"], platform, nodeExecutable);
|
|
195
195
|
}
|
|
196
196
|
function runNpmInstall(projectDir) {
|
|
197
197
|
const invocation = resolveNpmInstallInvocation();
|
|
198
198
|
const result = (0, node_child_process_1.spawnSync)(invocation.command, invocation.args, {
|
|
199
199
|
cwd: projectDir,
|
|
200
|
-
stdio:
|
|
200
|
+
stdio: "inherit",
|
|
201
201
|
});
|
|
202
202
|
return result.status === 0;
|
|
203
203
|
}
|
|
204
204
|
function findUnsupportedCatalogueTopLevelKey(parsed) {
|
|
205
205
|
for (const key of Object.keys(parsed)) {
|
|
206
|
-
if (!ALLOWED_CATALOGUE_TOP_LEVEL_KEYS.has(key) && key !==
|
|
206
|
+
if (!ALLOWED_CATALOGUE_TOP_LEVEL_KEYS.has(key) && key !== "games") {
|
|
207
207
|
return key;
|
|
208
208
|
}
|
|
209
209
|
}
|
|
@@ -214,28 +214,28 @@ function extractEntryPointFromMetadata(metadata) {
|
|
|
214
214
|
return null;
|
|
215
215
|
}
|
|
216
216
|
const candidate = metadata.entryPoint;
|
|
217
|
-
if (typeof candidate ===
|
|
217
|
+
if (typeof candidate === "string" && candidate.trim().length > 0) {
|
|
218
218
|
return candidate.trim();
|
|
219
219
|
}
|
|
220
|
-
if (typeof metadata.file ===
|
|
220
|
+
if (typeof metadata.file === "string" && metadata.file.trim().length > 0) {
|
|
221
221
|
return metadata.file.trim();
|
|
222
222
|
}
|
|
223
223
|
return null;
|
|
224
224
|
}
|
|
225
225
|
const DEFAULT_SURFACE_TARGETS = {
|
|
226
|
-
desktop: app_1.DEFAULT_APP_SURFACE_TARGETS.includes(
|
|
227
|
-
mobileLandscape: app_1.DEFAULT_APP_SURFACE_TARGETS.includes(
|
|
228
|
-
mobilePortrait: app_1.DEFAULT_APP_SURFACE_TARGETS.includes(
|
|
226
|
+
desktop: app_1.DEFAULT_APP_SURFACE_TARGETS.includes("DESKTOP"),
|
|
227
|
+
mobileLandscape: app_1.DEFAULT_APP_SURFACE_TARGETS.includes("MOBILE_LANDSCAPE"),
|
|
228
|
+
mobilePortrait: app_1.DEFAULT_APP_SURFACE_TARGETS.includes("MOBILE_PORTRAIT"),
|
|
229
229
|
};
|
|
230
|
-
const DEFAULT_APP_VERSION =
|
|
231
|
-
const DEFAULT_ASSET_SPEC_VERSION =
|
|
230
|
+
const DEFAULT_APP_VERSION = "1.0.0";
|
|
231
|
+
const DEFAULT_ASSET_SPEC_VERSION = "1.0.0";
|
|
232
232
|
function makeDefaultAppEntry(name, filePath) {
|
|
233
233
|
return {
|
|
234
234
|
name,
|
|
235
235
|
file: filePath,
|
|
236
236
|
version: DEFAULT_APP_VERSION,
|
|
237
237
|
displayName: name,
|
|
238
|
-
description:
|
|
238
|
+
description: "",
|
|
239
239
|
type: app_1.DEFAULT_APP_TYPE,
|
|
240
240
|
surfaceTargets: { ...DEFAULT_SURFACE_TARGETS },
|
|
241
241
|
};
|
|
@@ -246,20 +246,20 @@ function makeDefaultAssetSpecEntry(name) {
|
|
|
246
246
|
name,
|
|
247
247
|
version: DEFAULT_ASSET_SPEC_VERSION,
|
|
248
248
|
displayName: name,
|
|
249
|
-
description:
|
|
249
|
+
description: "",
|
|
250
250
|
symbol: `${basePath}/symbol.svg`,
|
|
251
251
|
contract: `${basePath}/contract.json`,
|
|
252
252
|
documentation: `${basePath}/README.md`,
|
|
253
|
-
visibility:
|
|
253
|
+
visibility: "PUBLIC",
|
|
254
254
|
};
|
|
255
255
|
}
|
|
256
256
|
function resolveTaskScaffoldOutputVersion(startDir = process.cwd()) {
|
|
257
257
|
const context = (0, listingPreflight_1.readWorkerUploadPreflightContext)(startDir);
|
|
258
|
-
if (!context || (context.kind !==
|
|
258
|
+
if (!context || (context.kind !== "NEW_GAME" && context.kind !== "REMIX_GAME")) {
|
|
259
259
|
return null;
|
|
260
260
|
}
|
|
261
261
|
if (!context.outputVersion) {
|
|
262
|
-
throw new Error(
|
|
262
|
+
throw new Error("agent_task_output_version_missing: task.metadata.playdrop.output.version is required when scaffolding a game task.");
|
|
263
263
|
}
|
|
264
264
|
return context.outputVersion;
|
|
265
265
|
}
|
|
@@ -286,75 +286,73 @@ function buildCatalogueEntry(name, metadata, sourceInfo, relativeFilePath) {
|
|
|
286
286
|
}
|
|
287
287
|
return entry;
|
|
288
288
|
}
|
|
289
|
-
if (typeof metadata.displayName ===
|
|
289
|
+
if (typeof metadata.displayName === "string" && metadata.displayName.trim().length > 0) {
|
|
290
290
|
entry.displayName = metadata.displayName.trim();
|
|
291
291
|
}
|
|
292
|
-
if (typeof metadata.description ===
|
|
292
|
+
if (typeof metadata.description === "string") {
|
|
293
293
|
entry.description = metadata.description;
|
|
294
294
|
}
|
|
295
|
-
if (typeof metadata.type ===
|
|
295
|
+
if (typeof metadata.type === "string" && metadata.type.trim().length > 0) {
|
|
296
296
|
const parsedType = (0, app_1.parseAppType)(metadata.type.trim());
|
|
297
297
|
if (parsedType) {
|
|
298
298
|
entry.type = parsedType;
|
|
299
299
|
}
|
|
300
300
|
}
|
|
301
|
-
if (Object.prototype.hasOwnProperty.call(metadata,
|
|
301
|
+
if (Object.prototype.hasOwnProperty.call(metadata, "emoji")) {
|
|
302
302
|
const emoji = metadata.emoji;
|
|
303
|
-
if (emoji === null || (typeof emoji ===
|
|
303
|
+
if (emoji === null || (typeof emoji === "string" && emoji.trim().length === 0)) {
|
|
304
304
|
entry.emoji = null;
|
|
305
305
|
}
|
|
306
|
-
else if (typeof emoji ===
|
|
306
|
+
else if (typeof emoji === "string") {
|
|
307
307
|
entry.emoji = emoji;
|
|
308
308
|
}
|
|
309
309
|
}
|
|
310
|
-
if (Object.prototype.hasOwnProperty.call(metadata,
|
|
310
|
+
if (Object.prototype.hasOwnProperty.call(metadata, "color")) {
|
|
311
311
|
const color = metadata.color;
|
|
312
|
-
if (color === null || (typeof color ===
|
|
312
|
+
if (color === null || (typeof color === "string" && color.trim().length === 0)) {
|
|
313
313
|
entry.color = null;
|
|
314
314
|
}
|
|
315
|
-
else if (typeof color ===
|
|
315
|
+
else if (typeof color === "string") {
|
|
316
316
|
entry.color = color;
|
|
317
317
|
}
|
|
318
318
|
}
|
|
319
|
-
if (Object.prototype.hasOwnProperty.call(metadata,
|
|
319
|
+
if (Object.prototype.hasOwnProperty.call(metadata, "file")) {
|
|
320
320
|
const providedFile = metadata.file;
|
|
321
|
-
if (typeof providedFile ===
|
|
321
|
+
if (typeof providedFile === "string" && providedFile.trim().length > 0) {
|
|
322
322
|
entry.file = providedFile.trim();
|
|
323
323
|
}
|
|
324
324
|
else if (providedFile === null) {
|
|
325
325
|
delete entry.file;
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
|
-
if (Object.prototype.hasOwnProperty.call(metadata,
|
|
328
|
+
if (Object.prototype.hasOwnProperty.call(metadata, "version")) {
|
|
329
329
|
const providedVersion = metadata.version;
|
|
330
|
-
if (typeof providedVersion ===
|
|
330
|
+
if (typeof providedVersion === "string" && providedVersion.trim().length > 0) {
|
|
331
331
|
entry.version = providedVersion.trim();
|
|
332
332
|
}
|
|
333
333
|
}
|
|
334
|
-
if (Object.prototype.hasOwnProperty.call(metadata,
|
|
334
|
+
if (Object.prototype.hasOwnProperty.call(metadata, "surfaceTargets")) {
|
|
335
335
|
try {
|
|
336
336
|
const parsed = (0, catalogue_utils_1.parseSurfaceTargets)(metadata.surfaceTargets);
|
|
337
337
|
entry.surfaceTargets = { ...parsed.map };
|
|
338
338
|
}
|
|
339
339
|
catch (error) {
|
|
340
|
-
const message = error instanceof Error && error.message.trim()
|
|
341
|
-
? error.message.trim()
|
|
342
|
-
: String(error);
|
|
340
|
+
const message = error instanceof Error && error.message.trim() ? error.message.trim() : String(error);
|
|
343
341
|
throw new Error(`Invalid surfaceTargets for ${name}: ${message}`);
|
|
344
342
|
}
|
|
345
343
|
}
|
|
346
|
-
if (Object.prototype.hasOwnProperty.call(metadata,
|
|
344
|
+
if (Object.prototype.hasOwnProperty.call(metadata, "templateSource")) {
|
|
347
345
|
const templateSource = metadata.templateSource;
|
|
348
|
-
if (templateSource === null || typeof templateSource ===
|
|
346
|
+
if (templateSource === null || typeof templateSource === "string") {
|
|
349
347
|
entry.templateSource = templateSource;
|
|
350
348
|
}
|
|
351
349
|
}
|
|
352
350
|
else if (sourceInfo.templateSlug) {
|
|
353
351
|
entry.templateSource = sourceInfo.templateSlug;
|
|
354
352
|
}
|
|
355
|
-
if (Object.prototype.hasOwnProperty.call(metadata,
|
|
353
|
+
if (Object.prototype.hasOwnProperty.call(metadata, "remix")) {
|
|
356
354
|
const remix = metadata.remix;
|
|
357
|
-
if (remix === null || typeof remix ===
|
|
355
|
+
if (remix === null || typeof remix === "string") {
|
|
358
356
|
entry.remix = remix;
|
|
359
357
|
}
|
|
360
358
|
}
|
|
@@ -365,9 +363,9 @@ function buildCatalogueEntry(name, metadata, sourceInfo, relativeFilePath) {
|
|
|
365
363
|
}
|
|
366
364
|
function readCatalogue(path) {
|
|
367
365
|
try {
|
|
368
|
-
const raw = (0, node_fs_1.readFileSync)(path,
|
|
366
|
+
const raw = (0, node_fs_1.readFileSync)(path, "utf8");
|
|
369
367
|
const parsed = JSON.parse(raw);
|
|
370
|
-
if (!parsed || typeof parsed !==
|
|
368
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
371
369
|
return null;
|
|
372
370
|
}
|
|
373
371
|
return parsed;
|
|
@@ -383,7 +381,7 @@ function hasNestedCatalogueFiles(rootDir) {
|
|
|
383
381
|
const current = stack.pop();
|
|
384
382
|
const entries = (0, node_fs_1.readdirSync)(current, { withFileTypes: true });
|
|
385
383
|
for (const entry of entries) {
|
|
386
|
-
if (entry.name.startsWith(
|
|
384
|
+
if (entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
387
385
|
continue;
|
|
388
386
|
}
|
|
389
387
|
const absolutePath = (0, node_path_1.join)(current, entry.name);
|
|
@@ -402,10 +400,10 @@ function ensureCatalogueEntry(name, metadata, cataloguePath, sourceInfo, htmlFil
|
|
|
402
400
|
const path = (0, node_path_1.resolve)(cataloguePath);
|
|
403
401
|
const catalogueDir = (0, node_path_1.dirname)(path);
|
|
404
402
|
if (hasNestedCatalogueFiles(catalogueDir)) {
|
|
405
|
-
return { path, createdFile: false, addedEntry: false, error:
|
|
403
|
+
return { path, createdFile: false, addedEntry: false, error: "workspace_root_marker_required" };
|
|
406
404
|
}
|
|
407
405
|
const relativeFilePath = (0, node_path_1.relative)(catalogueDir, (0, node_path_1.resolve)(htmlFilePath)) || `${name}.html`;
|
|
408
|
-
const normalizedFilePath = relativeFilePath.replace(/\\/g,
|
|
406
|
+
const normalizedFilePath = relativeFilePath.replace(/\\/g, "/");
|
|
409
407
|
const entry = buildCatalogueEntry(name, metadata, sourceInfo, normalizedFilePath);
|
|
410
408
|
if (!(0, node_fs_1.existsSync)(path)) {
|
|
411
409
|
const catalogue = { apps: [entry] };
|
|
@@ -414,20 +412,20 @@ function ensureCatalogueEntry(name, metadata, cataloguePath, sourceInfo, htmlFil
|
|
|
414
412
|
}
|
|
415
413
|
const parsed = readCatalogue(path);
|
|
416
414
|
if (!parsed) {
|
|
417
|
-
return { path, createdFile: false, addedEntry: false, error:
|
|
415
|
+
return { path, createdFile: false, addedEntry: false, error: "invalid_json" };
|
|
418
416
|
}
|
|
419
417
|
if (Object.prototype.hasOwnProperty.call(parsed, LEGACY_CATALOGUE_VERSION_KEY)) {
|
|
420
|
-
return { path, createdFile: false, addedEntry: false, error:
|
|
418
|
+
return { path, createdFile: false, addedEntry: false, error: "invalid_schema_version" };
|
|
421
419
|
}
|
|
422
420
|
const unsupportedKey = findUnsupportedCatalogueTopLevelKey(parsed);
|
|
423
421
|
if (unsupportedKey) {
|
|
424
|
-
return { path, createdFile: false, addedEntry: false, error:
|
|
422
|
+
return { path, createdFile: false, addedEntry: false, error: "unsupported_top_level_key", unsupportedKey };
|
|
425
423
|
}
|
|
426
424
|
if (!Array.isArray(parsed.apps) && Array.isArray(parsed.games)) {
|
|
427
|
-
return { path, createdFile: false, addedEntry: false, error:
|
|
425
|
+
return { path, createdFile: false, addedEntry: false, error: "legacy_games_property" };
|
|
428
426
|
}
|
|
429
427
|
const apps = Array.isArray(parsed.apps) ? [...parsed.apps] : [];
|
|
430
|
-
if (apps.some((app) => typeof app?.name ===
|
|
428
|
+
if (apps.some((app) => typeof app?.name === "string" && app.name === name)) {
|
|
431
429
|
return { path, createdFile: false, addedEntry: false, alreadyPresent: true };
|
|
432
430
|
}
|
|
433
431
|
apps.push(entry);
|
|
@@ -437,32 +435,36 @@ function ensureCatalogueEntry(name, metadata, cataloguePath, sourceInfo, htmlFil
|
|
|
437
435
|
}
|
|
438
436
|
function logCatalogueOutcome(result, name) {
|
|
439
437
|
const label = (0, node_path_1.relative)(process.cwd(), result.path) || CATALOGUE_FILENAME;
|
|
440
|
-
if (result.error ===
|
|
438
|
+
if (result.error === "invalid_json") {
|
|
441
439
|
(0, messages_1.printErrorWithHelp)(`Could not update ${label} because it contains invalid JSON.`, [
|
|
442
|
-
`Fix the JSON in ${label} and add ${name} to the apps list, then rerun "playdrop project create app ${name}" if needed
|
|
443
|
-
], { command:
|
|
440
|
+
`Fix the JSON in ${label} and add ${name} to the apps list, then rerun "playdrop project create app ${name}" if needed.`,
|
|
441
|
+
], { command: "project create app" });
|
|
444
442
|
process.exitCode = process.exitCode || 1;
|
|
445
443
|
return false;
|
|
446
444
|
}
|
|
447
|
-
if (result.error ===
|
|
445
|
+
if (result.error === "legacy_games_property") {
|
|
448
446
|
(0, messages_1.printErrorWithHelp)(`${label} still uses the legacy "games" catalogue field.`, [
|
|
449
|
-
'Rename the top-level "games" array to "apps" and rerun `playdrop project create app`. This rename removes the old terminology.'
|
|
450
|
-
], { command:
|
|
447
|
+
'Rename the top-level "games" array to "apps" and rerun `playdrop project create app`. This rename removes the old terminology.',
|
|
448
|
+
], { command: "project create app" });
|
|
451
449
|
process.exitCode = process.exitCode || 1;
|
|
452
450
|
return false;
|
|
453
451
|
}
|
|
454
|
-
if (result.error ===
|
|
455
|
-
(0, messages_1.printErrorWithHelp)(`${label} must not define the legacy top-level version field.`, [
|
|
452
|
+
if (result.error === "invalid_schema_version") {
|
|
453
|
+
(0, messages_1.printErrorWithHelp)(`${label} must not define the legacy top-level version field.`, ["Remove the legacy top-level version field from the file and rerun `playdrop project create app`."], { command: "project create app" });
|
|
456
454
|
process.exitCode = process.exitCode || 1;
|
|
457
455
|
return false;
|
|
458
456
|
}
|
|
459
|
-
if (result.error ===
|
|
460
|
-
(0, messages_1.printErrorWithHelp)(`${label} contains unsupported top-level key "${result.unsupportedKey ||
|
|
457
|
+
if (result.error === "unsupported_top_level_key") {
|
|
458
|
+
(0, messages_1.printErrorWithHelp)(`${label} contains unsupported top-level key "${result.unsupportedKey || "unknown"}".`, [
|
|
459
|
+
"Keep catalogue.json limited to apps, assetSpecs, assets, and assetPacks, then rerun `playdrop project create app`.",
|
|
460
|
+
], { command: "project create app" });
|
|
461
461
|
process.exitCode = process.exitCode || 1;
|
|
462
462
|
return false;
|
|
463
463
|
}
|
|
464
|
-
if (result.error ===
|
|
465
|
-
(0, messages_1.printErrorWithHelp)(`${label} must stay {} because nested catalogue.json files already exist below this directory.`, [
|
|
464
|
+
if (result.error === "workspace_root_marker_required") {
|
|
465
|
+
(0, messages_1.printErrorWithHelp)(`${label} must stay {} because nested catalogue.json files already exist below this directory.`, [
|
|
466
|
+
"Create the app inside its own project folder instead of writing entries into the workspace root catalogue.json.",
|
|
467
|
+
], { command: "project create app" });
|
|
466
468
|
process.exitCode = process.exitCode || 1;
|
|
467
469
|
return false;
|
|
468
470
|
}
|
|
@@ -483,7 +485,7 @@ function ensureAssetSpecCatalogueEntry(name, cataloguePath) {
|
|
|
483
485
|
const path = (0, node_path_1.resolve)(cataloguePath);
|
|
484
486
|
const catalogueDir = (0, node_path_1.dirname)(path);
|
|
485
487
|
if (hasNestedCatalogueFiles(catalogueDir)) {
|
|
486
|
-
return { path, createdFile: false, addedEntry: false, error:
|
|
488
|
+
return { path, createdFile: false, addedEntry: false, error: "workspace_root_marker_required" };
|
|
487
489
|
}
|
|
488
490
|
const entry = makeDefaultAssetSpecEntry(name);
|
|
489
491
|
if (!(0, node_fs_1.existsSync)(path)) {
|
|
@@ -493,20 +495,20 @@ function ensureAssetSpecCatalogueEntry(name, cataloguePath) {
|
|
|
493
495
|
}
|
|
494
496
|
const parsed = readCatalogue(path);
|
|
495
497
|
if (!parsed) {
|
|
496
|
-
return { path, createdFile: false, addedEntry: false, error:
|
|
498
|
+
return { path, createdFile: false, addedEntry: false, error: "invalid_json" };
|
|
497
499
|
}
|
|
498
500
|
if (Object.prototype.hasOwnProperty.call(parsed, LEGACY_CATALOGUE_VERSION_KEY)) {
|
|
499
|
-
return { path, createdFile: false, addedEntry: false, error:
|
|
501
|
+
return { path, createdFile: false, addedEntry: false, error: "invalid_schema_version" };
|
|
500
502
|
}
|
|
501
503
|
const unsupportedKey = findUnsupportedCatalogueTopLevelKey(parsed);
|
|
502
504
|
if (unsupportedKey) {
|
|
503
|
-
return { path, createdFile: false, addedEntry: false, error:
|
|
505
|
+
return { path, createdFile: false, addedEntry: false, error: "unsupported_top_level_key", unsupportedKey };
|
|
504
506
|
}
|
|
505
507
|
if (!Array.isArray(parsed.apps) && Array.isArray(parsed.games)) {
|
|
506
|
-
return { path, createdFile: false, addedEntry: false, error:
|
|
508
|
+
return { path, createdFile: false, addedEntry: false, error: "legacy_games_property" };
|
|
507
509
|
}
|
|
508
510
|
const assetSpecs = Array.isArray(parsed.assetSpecs) ? [...parsed.assetSpecs] : [];
|
|
509
|
-
if (assetSpecs.some((assetSpec) => typeof assetSpec?.name ===
|
|
511
|
+
if (assetSpecs.some((assetSpec) => typeof assetSpec?.name === "string" && assetSpec.name === name)) {
|
|
510
512
|
return { path, createdFile: false, addedEntry: false, alreadyPresent: true };
|
|
511
513
|
}
|
|
512
514
|
assetSpecs.push(entry);
|
|
@@ -516,32 +518,34 @@ function ensureAssetSpecCatalogueEntry(name, cataloguePath) {
|
|
|
516
518
|
}
|
|
517
519
|
function logAssetSpecCatalogueOutcome(result, name) {
|
|
518
520
|
const label = (0, node_path_1.relative)(process.cwd(), result.path) || CATALOGUE_FILENAME;
|
|
519
|
-
if (result.error ===
|
|
521
|
+
if (result.error === "invalid_json") {
|
|
520
522
|
(0, messages_1.printErrorWithHelp)(`Could not update ${label} because it contains invalid JSON.`, [
|
|
521
523
|
`Fix the JSON in ${label} and add ${name} to the assetSpecs list, then rerun "playdrop project create asset-spec ${name}" if needed.`,
|
|
522
|
-
], { command:
|
|
524
|
+
], { command: "project create asset-spec" });
|
|
523
525
|
process.exitCode = process.exitCode || 1;
|
|
524
526
|
return false;
|
|
525
527
|
}
|
|
526
|
-
if (result.error ===
|
|
527
|
-
(0, messages_1.printErrorWithHelp)(`${label} still uses the legacy "games" catalogue field.`, [
|
|
528
|
-
'Rename the top-level "games" array to "apps" and rerun `playdrop project create asset-spec`.',
|
|
529
|
-
], { command: 'project create asset-spec' });
|
|
528
|
+
if (result.error === "legacy_games_property") {
|
|
529
|
+
(0, messages_1.printErrorWithHelp)(`${label} still uses the legacy "games" catalogue field.`, ['Rename the top-level "games" array to "apps" and rerun `playdrop project create asset-spec`.'], { command: "project create asset-spec" });
|
|
530
530
|
process.exitCode = process.exitCode || 1;
|
|
531
531
|
return false;
|
|
532
532
|
}
|
|
533
|
-
if (result.error ===
|
|
534
|
-
(0, messages_1.printErrorWithHelp)(`${label} must not define the legacy top-level version field.`, [
|
|
533
|
+
if (result.error === "invalid_schema_version") {
|
|
534
|
+
(0, messages_1.printErrorWithHelp)(`${label} must not define the legacy top-level version field.`, ["Remove the legacy top-level version field from the file and rerun `playdrop project create asset-spec`."], { command: "project create asset-spec" });
|
|
535
535
|
process.exitCode = process.exitCode || 1;
|
|
536
536
|
return false;
|
|
537
537
|
}
|
|
538
|
-
if (result.error ===
|
|
539
|
-
(0, messages_1.printErrorWithHelp)(`${label} contains unsupported top-level key "${result.unsupportedKey ||
|
|
538
|
+
if (result.error === "unsupported_top_level_key") {
|
|
539
|
+
(0, messages_1.printErrorWithHelp)(`${label} contains unsupported top-level key "${result.unsupportedKey || "unknown"}".`, [
|
|
540
|
+
"Keep catalogue.json limited to apps, assetSpecs, assets, and assetPacks, then rerun `playdrop project create asset-spec`.",
|
|
541
|
+
], { command: "project create asset-spec" });
|
|
540
542
|
process.exitCode = process.exitCode || 1;
|
|
541
543
|
return false;
|
|
542
544
|
}
|
|
543
|
-
if (result.error ===
|
|
544
|
-
(0, messages_1.printErrorWithHelp)(`${label} must stay {} because nested catalogue.json files already exist below this directory.`, [
|
|
545
|
+
if (result.error === "workspace_root_marker_required") {
|
|
546
|
+
(0, messages_1.printErrorWithHelp)(`${label} must stay {} because nested catalogue.json files already exist below this directory.`, [
|
|
547
|
+
"Create the asset spec inside its own project folder instead of writing entries into the workspace root catalogue.json.",
|
|
548
|
+
], { command: "project create asset-spec" });
|
|
545
549
|
process.exitCode = process.exitCode || 1;
|
|
546
550
|
return false;
|
|
547
551
|
}
|
|
@@ -561,29 +565,29 @@ function logAssetSpecCatalogueOutcome(result, name) {
|
|
|
561
565
|
function updateExtractedProjectCatalogue(name, metadata, projectCataloguePath, sourceInfo, htmlFilePath) {
|
|
562
566
|
const path = (0, node_path_1.resolve)(projectCataloguePath);
|
|
563
567
|
if (hasNestedCatalogueFiles((0, node_path_1.dirname)(path))) {
|
|
564
|
-
return { path, updated: false, error:
|
|
568
|
+
return { path, updated: false, error: "workspace_root_marker_required" };
|
|
565
569
|
}
|
|
566
570
|
const parsed = readCatalogue(path);
|
|
567
571
|
if (!parsed) {
|
|
568
|
-
return { path, updated: false, error:
|
|
572
|
+
return { path, updated: false, error: "invalid_json" };
|
|
569
573
|
}
|
|
570
574
|
if (Object.prototype.hasOwnProperty.call(parsed, LEGACY_CATALOGUE_VERSION_KEY)) {
|
|
571
|
-
return { path, updated: false, error:
|
|
575
|
+
return { path, updated: false, error: "invalid_schema_version" };
|
|
572
576
|
}
|
|
573
577
|
const unsupportedKey = findUnsupportedCatalogueTopLevelKey(parsed);
|
|
574
578
|
if (unsupportedKey) {
|
|
575
|
-
return { path, updated: false, error:
|
|
579
|
+
return { path, updated: false, error: "unsupported_top_level_key", unsupportedKey };
|
|
576
580
|
}
|
|
577
581
|
if (!Array.isArray(parsed.apps) && Array.isArray(parsed.games)) {
|
|
578
|
-
return { path, updated: false, error:
|
|
582
|
+
return { path, updated: false, error: "legacy_games_property" };
|
|
579
583
|
}
|
|
580
584
|
const apps = Array.isArray(parsed.apps) ? [...parsed.apps] : [];
|
|
581
585
|
const relativeFilePath = (0, node_path_1.relative)((0, node_path_1.dirname)(path), (0, node_path_1.resolve)(htmlFilePath)) || `${name}.html`;
|
|
582
|
-
const normalizedFilePath = relativeFilePath.replace(/\\/g,
|
|
583
|
-
const metadataName = metadata && typeof metadata.name ===
|
|
586
|
+
const normalizedFilePath = relativeFilePath.replace(/\\/g, "/");
|
|
587
|
+
const metadataName = metadata && typeof metadata.name === "string" && metadata.name.trim().length > 0
|
|
584
588
|
? metadata.name.trim()
|
|
585
589
|
: null;
|
|
586
|
-
const metadataFile = metadata && typeof metadata.file ===
|
|
590
|
+
const metadataFile = metadata && typeof metadata.file === "string" && metadata.file.trim().length > 0
|
|
587
591
|
? metadata.file.trim()
|
|
588
592
|
: null;
|
|
589
593
|
const nextType = app_1.DEFAULT_APP_TYPE;
|
|
@@ -593,19 +597,19 @@ function updateExtractedProjectCatalogue(name, metadata, projectCataloguePath, s
|
|
|
593
597
|
if (!entry) {
|
|
594
598
|
continue;
|
|
595
599
|
}
|
|
596
|
-
if (metadataName && typeof entry.name ===
|
|
600
|
+
if (metadataName && typeof entry.name === "string" && entry.name === metadataName) {
|
|
597
601
|
targetIndex = i;
|
|
598
602
|
break;
|
|
599
603
|
}
|
|
600
|
-
if (typeof entry.name ===
|
|
604
|
+
if (typeof entry.name === "string" && entry.name === name) {
|
|
601
605
|
targetIndex = i;
|
|
602
606
|
break;
|
|
603
607
|
}
|
|
604
|
-
if (metadataFile && typeof entry.file ===
|
|
608
|
+
if (metadataFile && typeof entry.file === "string" && entry.file === metadataFile) {
|
|
605
609
|
targetIndex = i;
|
|
606
610
|
break;
|
|
607
611
|
}
|
|
608
|
-
if (typeof entry.file ===
|
|
612
|
+
if (typeof entry.file === "string" && entry.file === normalizedFilePath) {
|
|
609
613
|
targetIndex = i;
|
|
610
614
|
break;
|
|
611
615
|
}
|
|
@@ -627,7 +631,7 @@ function updateExtractedProjectCatalogue(name, metadata, projectCataloguePath, s
|
|
|
627
631
|
if (!existing.file) {
|
|
628
632
|
existing.file = normalizedFilePath;
|
|
629
633
|
}
|
|
630
|
-
if (typeof existing.version !==
|
|
634
|
+
if (typeof existing.version !== "string" || existing.version.trim().length === 0) {
|
|
631
635
|
existing.version = DEFAULT_APP_VERSION;
|
|
632
636
|
}
|
|
633
637
|
if (sourceInfo.templateSlug) {
|
|
@@ -644,32 +648,36 @@ function updateExtractedProjectCatalogue(name, metadata, projectCataloguePath, s
|
|
|
644
648
|
}
|
|
645
649
|
function logProjectCatalogueOutcome(result, name) {
|
|
646
650
|
const label = (0, node_path_1.relative)(process.cwd(), result.path) || CATALOGUE_FILENAME;
|
|
647
|
-
if (result.error ===
|
|
651
|
+
if (result.error === "invalid_json") {
|
|
648
652
|
(0, messages_1.printErrorWithHelp)(`Could not update ${label} because it contains invalid JSON.`, [
|
|
649
|
-
`Fix the JSON in ${label} and add ${name} to the apps list, then rerun "playdrop project create app ${name}" if needed
|
|
650
|
-
], { command:
|
|
653
|
+
`Fix the JSON in ${label} and add ${name} to the apps list, then rerun "playdrop project create app ${name}" if needed.`,
|
|
654
|
+
], { command: "project create app" });
|
|
651
655
|
process.exitCode = process.exitCode || 1;
|
|
652
656
|
return false;
|
|
653
657
|
}
|
|
654
|
-
if (result.error ===
|
|
658
|
+
if (result.error === "legacy_games_property") {
|
|
655
659
|
(0, messages_1.printErrorWithHelp)(`${label} still uses the legacy "games" catalogue field.`, [
|
|
656
|
-
'Rename the top-level "games" array to "apps" and rerun `playdrop project create app`. This rename removes the old terminology.'
|
|
657
|
-
], { command:
|
|
660
|
+
'Rename the top-level "games" array to "apps" and rerun `playdrop project create app`. This rename removes the old terminology.',
|
|
661
|
+
], { command: "project create app" });
|
|
658
662
|
process.exitCode = process.exitCode || 1;
|
|
659
663
|
return false;
|
|
660
664
|
}
|
|
661
|
-
if (result.error ===
|
|
662
|
-
(0, messages_1.printErrorWithHelp)(`${label} must not define the legacy top-level version field.`, [
|
|
665
|
+
if (result.error === "invalid_schema_version") {
|
|
666
|
+
(0, messages_1.printErrorWithHelp)(`${label} must not define the legacy top-level version field.`, ["Remove the legacy top-level version field from the file and rerun `playdrop project create app`."], { command: "project create app" });
|
|
663
667
|
process.exitCode = process.exitCode || 1;
|
|
664
668
|
return false;
|
|
665
669
|
}
|
|
666
|
-
if (result.error ===
|
|
667
|
-
(0, messages_1.printErrorWithHelp)(`${label} contains unsupported top-level key "${result.unsupportedKey ||
|
|
670
|
+
if (result.error === "unsupported_top_level_key") {
|
|
671
|
+
(0, messages_1.printErrorWithHelp)(`${label} contains unsupported top-level key "${result.unsupportedKey || "unknown"}".`, [
|
|
672
|
+
"Keep catalogue.json limited to apps, assetSpecs, assets, and assetPacks, then rerun `playdrop project create app`.",
|
|
673
|
+
], { command: "project create app" });
|
|
668
674
|
process.exitCode = process.exitCode || 1;
|
|
669
675
|
return false;
|
|
670
676
|
}
|
|
671
|
-
if (result.error ===
|
|
672
|
-
(0, messages_1.printErrorWithHelp)(`${label} must stay {} because nested catalogue.json files already exist below this directory.`, [
|
|
677
|
+
if (result.error === "workspace_root_marker_required") {
|
|
678
|
+
(0, messages_1.printErrorWithHelp)(`${label} must stay {} because nested catalogue.json files already exist below this directory.`, [
|
|
679
|
+
"Create the app inside its own project folder instead of writing entries into the workspace root catalogue.json.",
|
|
680
|
+
], { command: "project create app" });
|
|
673
681
|
process.exitCode = process.exitCode || 1;
|
|
674
682
|
return false;
|
|
675
683
|
}
|
|
@@ -683,10 +691,10 @@ function buildPendingExternalRemixTask(name, metadata, sourceInfo, cataloguePath
|
|
|
683
691
|
const catalogueDir = (0, node_path_1.dirname)(absoluteCataloguePath);
|
|
684
692
|
const absoluteHtmlPath = (0, node_path_1.resolve)(htmlFilePath);
|
|
685
693
|
const relativeFilePath = (0, node_path_1.relative)(catalogueDir, absoluteHtmlPath) || `${name}.html`;
|
|
686
|
-
const entry = buildCatalogueEntry(name, metadata, sourceInfo, relativeFilePath.replace(/\\/g,
|
|
694
|
+
const entry = buildCatalogueEntry(name, metadata, sourceInfo, relativeFilePath.replace(/\\/g, "/"));
|
|
687
695
|
const surfaceTargets = (0, catalogue_utils_1.parseSurfaceTargets)(entry.surfaceTargets ?? DEFAULT_SURFACE_TARGETS).list;
|
|
688
696
|
return {
|
|
689
|
-
kind:
|
|
697
|
+
kind: "app",
|
|
690
698
|
name,
|
|
691
699
|
cataloguePath: (0, node_path_1.relative)(process.cwd(), absoluteCataloguePath) || CATALOGUE_FILENAME,
|
|
692
700
|
catalogueAbsolutePath: absoluteCataloguePath,
|
|
@@ -700,7 +708,7 @@ function buildPendingExternalRemixTask(name, metadata, sourceInfo, cataloguePath
|
|
|
700
708
|
hasFormatScript: false,
|
|
701
709
|
displayName: entry.displayName,
|
|
702
710
|
description: entry.description,
|
|
703
|
-
type: typeof entry.type ===
|
|
711
|
+
type: typeof entry.type === "string" ? ((0, app_1.parseAppType)(entry.type) ?? undefined) : undefined,
|
|
704
712
|
emoji: entry.emoji,
|
|
705
713
|
color: entry.color,
|
|
706
714
|
surfaceTargets,
|
|
@@ -708,7 +716,7 @@ function buildPendingExternalRemixTask(name, metadata, sourceInfo, cataloguePath
|
|
|
708
716
|
tags: [],
|
|
709
717
|
missingMetadata: [],
|
|
710
718
|
version: entry.version,
|
|
711
|
-
remix: typeof entry.remix ===
|
|
719
|
+
remix: typeof entry.remix === "string" ? entry.remix : undefined,
|
|
712
720
|
achievements: [],
|
|
713
721
|
leaderboards: [],
|
|
714
722
|
ownedAssets: [],
|
|
@@ -718,7 +726,7 @@ function buildPendingExternalRemixTask(name, metadata, sourceInfo, cataloguePath
|
|
|
718
726
|
};
|
|
719
727
|
}
|
|
720
728
|
function logNextSteps(name, options) {
|
|
721
|
-
console.log(
|
|
729
|
+
console.log("\nNext steps:");
|
|
722
730
|
if (options.hasCatalogue && options.catalogueLabel) {
|
|
723
731
|
console.log(` - Review ${options.catalogueLabel} to set displayName, description, emoji, color, type, and surfaceTargets as needed.`);
|
|
724
732
|
}
|
|
@@ -772,13 +780,13 @@ async function ensureLocalCatalogue(cataloguePath) {
|
|
|
772
780
|
}
|
|
773
781
|
const shouldInit = node_process_1.stdin.isTTY && node_process_1.stdout.isTTY ? await promptInit() : true;
|
|
774
782
|
if (!shouldInit) {
|
|
775
|
-
(0, messages_1.printErrorWithHelp)(
|
|
776
|
-
'Run "playdrop project init ." in this directory to create catalogue.json and starter docs before running "playdrop project create app".'
|
|
777
|
-
], { command:
|
|
783
|
+
(0, messages_1.printErrorWithHelp)("A local catalogue.json is required to register app metadata next to the app file.", [
|
|
784
|
+
'Run "playdrop project init ." in this directory to create catalogue.json and starter docs before running "playdrop project create app".',
|
|
785
|
+
], { command: "project create app", includeGeneralHelp: false });
|
|
778
786
|
process.exitCode = process.exitCode || 1;
|
|
779
787
|
return null;
|
|
780
788
|
}
|
|
781
|
-
const summary = await (0, init_1.init)(
|
|
789
|
+
const summary = await (0, init_1.init)(".", { quiet: true });
|
|
782
790
|
if (!summary) {
|
|
783
791
|
process.exitCode = process.exitCode || 1;
|
|
784
792
|
return null;
|
|
@@ -805,20 +813,20 @@ function buildAssetSpecSymbolSvg() {
|
|
|
805
813
|
' <path d="M14 18h36v28H14z" stroke="#fff" stroke-width="4" stroke-linejoin="round"/>',
|
|
806
814
|
' <path d="M24 28h16" stroke="#fff" stroke-width="4" stroke-linecap="round"/>',
|
|
807
815
|
' <path d="M24 36h10" stroke="#fff" stroke-width="4" stroke-linecap="round"/>',
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
].join(
|
|
816
|
+
"</svg>",
|
|
817
|
+
"",
|
|
818
|
+
].join("\n");
|
|
811
819
|
}
|
|
812
820
|
function buildAssetSpecContractTemplate() {
|
|
813
821
|
return `${JSON.stringify({
|
|
814
|
-
primaryRole:
|
|
822
|
+
primaryRole: "primary",
|
|
815
823
|
roles: [
|
|
816
824
|
{
|
|
817
|
-
name:
|
|
825
|
+
name: "primary",
|
|
818
826
|
required: true,
|
|
819
|
-
contentTypes: [
|
|
820
|
-
extensions: [
|
|
821
|
-
mode:
|
|
827
|
+
contentTypes: ["application/json"],
|
|
828
|
+
extensions: [".json"],
|
|
829
|
+
mode: "TEXT",
|
|
822
830
|
},
|
|
823
831
|
],
|
|
824
832
|
}, null, 2)}\n`;
|
|
@@ -826,41 +834,41 @@ function buildAssetSpecContractTemplate() {
|
|
|
826
834
|
function buildAssetSpecReadmeTemplate(name) {
|
|
827
835
|
return [
|
|
828
836
|
`# ${name}`,
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
].join(
|
|
837
|
+
"",
|
|
838
|
+
"Describe the custom asset format in plain English.",
|
|
839
|
+
"",
|
|
840
|
+
"## Files",
|
|
841
|
+
"",
|
|
842
|
+
"- `primary`: Main JSON payload for this asset format.",
|
|
843
|
+
"",
|
|
844
|
+
"## Notes",
|
|
845
|
+
"",
|
|
846
|
+
"- Update `contract.json` as the format evolves.",
|
|
847
|
+
"- Keep this documentation in sync with the published version.",
|
|
848
|
+
"",
|
|
849
|
+
].join("\n");
|
|
842
850
|
}
|
|
843
851
|
async function createAssetSpecProject(name) {
|
|
844
852
|
const normalizedName = name.trim();
|
|
845
853
|
if (!normalizedName) {
|
|
846
|
-
(0, messages_1.printErrorWithHelp)(
|
|
847
|
-
command:
|
|
854
|
+
(0, messages_1.printErrorWithHelp)("An asset spec name is required.", ["Example: playdrop project create asset-spec platformer-level"], {
|
|
855
|
+
command: "project create asset-spec",
|
|
848
856
|
});
|
|
849
857
|
process.exitCode = process.exitCode || 1;
|
|
850
858
|
return;
|
|
851
859
|
}
|
|
852
860
|
if (!(0, types_1.isValidAssetSpecName)(normalizedName)) {
|
|
853
|
-
(0, messages_1.printErrorWithHelp)(`Asset spec name "${normalizedName}" is not valid.`, [
|
|
861
|
+
(0, messages_1.printErrorWithHelp)(`Asset spec name "${normalizedName}" is not valid.`, ["Use lowercase kebab-case, for example: playdrop project create asset-spec platformer-level"], { command: "project create asset-spec" });
|
|
854
862
|
process.exitCode = process.exitCode || 1;
|
|
855
863
|
return;
|
|
856
864
|
}
|
|
857
865
|
const cataloguePath = (0, node_path_1.resolve)(process.cwd(), CATALOGUE_FILENAME);
|
|
858
|
-
const assetSpecDir = (0, node_path_1.resolve)(process.cwd(),
|
|
859
|
-
const contractPath = (0, node_path_1.resolve)(assetSpecDir,
|
|
860
|
-
const symbolPath = (0, node_path_1.resolve)(assetSpecDir,
|
|
861
|
-
const readmePath = (0, node_path_1.resolve)(assetSpecDir,
|
|
866
|
+
const assetSpecDir = (0, node_path_1.resolve)(process.cwd(), "asset-specs", normalizedName);
|
|
867
|
+
const contractPath = (0, node_path_1.resolve)(assetSpecDir, "contract.json");
|
|
868
|
+
const symbolPath = (0, node_path_1.resolve)(assetSpecDir, "symbol.svg");
|
|
869
|
+
const readmePath = (0, node_path_1.resolve)(assetSpecDir, "README.md");
|
|
862
870
|
if ((0, node_fs_1.existsSync)(assetSpecDir)) {
|
|
863
|
-
(0, messages_1.printErrorWithHelp)(`Asset spec directory already exists at ${(0, node_path_1.relative)(process.cwd(), assetSpecDir) || assetSpecDir}.`, [
|
|
871
|
+
(0, messages_1.printErrorWithHelp)(`Asset spec directory already exists at ${(0, node_path_1.relative)(process.cwd(), assetSpecDir) || assetSpecDir}.`, ["Choose a different asset spec name or remove the existing directory before rerunning the command."], { command: "project create asset-spec" });
|
|
864
872
|
process.exitCode = process.exitCode || 1;
|
|
865
873
|
return;
|
|
866
874
|
}
|
|
@@ -876,7 +884,7 @@ async function createAssetSpecProject(name) {
|
|
|
876
884
|
}
|
|
877
885
|
const relativeAssetSpecDir = (0, node_path_1.relative)(process.cwd(), assetSpecDir) || assetSpecDir;
|
|
878
886
|
const catalogueLabel = (0, node_path_1.relative)(process.cwd(), cataloguePath) || CATALOGUE_FILENAME;
|
|
879
|
-
console.log(
|
|
887
|
+
console.log("\nNext steps:");
|
|
880
888
|
console.log(` - Review ${catalogueLabel} and update the assetSpecs entry for ${normalizedName}.`);
|
|
881
889
|
console.log(` - Edit ${relativeAssetSpecDir}/contract.json to define the file contract.`);
|
|
882
890
|
console.log(` - Replace ${relativeAssetSpecDir}/symbol.svg with your final icon.`);
|
|
@@ -885,26 +893,29 @@ async function createAssetSpecProject(name) {
|
|
|
885
893
|
}
|
|
886
894
|
function warnMissingWorkspaceReadme(cataloguePath) {
|
|
887
895
|
const workspaceRoot = findWorkspaceRootDirectory(cataloguePath);
|
|
888
|
-
const readmePath = (0, node_path_1.resolve)(workspaceRoot,
|
|
896
|
+
const readmePath = (0, node_path_1.resolve)(workspaceRoot, "README.md");
|
|
889
897
|
if ((0, node_fs_1.existsSync)(readmePath)) {
|
|
890
898
|
return;
|
|
891
899
|
}
|
|
892
|
-
const workspaceLabel = (0, node_path_1.relative)(process.cwd(), workspaceRoot) ||
|
|
893
|
-
const initCommandTarget = workspaceLabel ===
|
|
900
|
+
const workspaceLabel = (0, node_path_1.relative)(process.cwd(), workspaceRoot) || ".";
|
|
901
|
+
const initCommandTarget = workspaceLabel === "." ? "." : workspaceLabel;
|
|
894
902
|
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.`);
|
|
895
903
|
}
|
|
896
904
|
function parseTemplateKey(value) {
|
|
897
|
-
const parts = value
|
|
905
|
+
const parts = value
|
|
906
|
+
.split("/")
|
|
907
|
+
.map((part) => part.trim())
|
|
908
|
+
.filter(Boolean);
|
|
898
909
|
if (parts.length >= 3) {
|
|
899
910
|
const [creator, typeSegment, ...rest] = parts;
|
|
900
911
|
if (!creator) {
|
|
901
912
|
return null;
|
|
902
913
|
}
|
|
903
914
|
const normalizedType = typeSegment.toLowerCase();
|
|
904
|
-
if (normalizedType !==
|
|
915
|
+
if (normalizedType !== "template" && normalizedType !== "app") {
|
|
905
916
|
return null;
|
|
906
917
|
}
|
|
907
|
-
const slug = rest.join(
|
|
918
|
+
const slug = rest.join("/");
|
|
908
919
|
if (!slug) {
|
|
909
920
|
return null;
|
|
910
921
|
}
|
|
@@ -914,7 +925,7 @@ function parseTemplateKey(value) {
|
|
|
914
925
|
}
|
|
915
926
|
function parseRemixRef(value) {
|
|
916
927
|
const parsed = (0, types_1.parseContentVersionRef)(value);
|
|
917
|
-
if (!parsed || parsed.kind !==
|
|
928
|
+
if (!parsed || parsed.kind !== "app") {
|
|
918
929
|
return null;
|
|
919
930
|
}
|
|
920
931
|
return {
|
|
@@ -925,19 +936,19 @@ function parseRemixRef(value) {
|
|
|
925
936
|
};
|
|
926
937
|
}
|
|
927
938
|
function parseRemixScaffoldResponse(response, version) {
|
|
928
|
-
const remixMode = typeof response?.remixMode ===
|
|
929
|
-
const archiveUrl = typeof response?.archiveUrl ===
|
|
939
|
+
const remixMode = typeof response?.remixMode === "string" ? response.remixMode : "";
|
|
940
|
+
const archiveUrl = typeof response?.archiveUrl === "string" && response.archiveUrl.trim().length > 0
|
|
930
941
|
? response.archiveUrl.trim()
|
|
931
942
|
: null;
|
|
932
|
-
const htmlContent = typeof response?.html ===
|
|
933
|
-
const externalListingUrl = typeof response?.externalListingUrl ===
|
|
943
|
+
const htmlContent = typeof response?.html === "string" ? response.html : null;
|
|
944
|
+
const externalListingUrl = typeof response?.externalListingUrl === "string" && response.externalListingUrl.trim().length > 0
|
|
934
945
|
? response.externalListingUrl.trim()
|
|
935
946
|
: null;
|
|
936
947
|
const metadata = response.metadata;
|
|
937
948
|
const entryPoint = extractEntryPointFromMetadata(metadata);
|
|
938
|
-
if (remixMode ===
|
|
949
|
+
if (remixMode === "archive") {
|
|
939
950
|
if (!archiveUrl) {
|
|
940
|
-
throw new Error(
|
|
951
|
+
throw new Error("Remix response missing archiveUrl");
|
|
941
952
|
}
|
|
942
953
|
return {
|
|
943
954
|
html: null,
|
|
@@ -947,9 +958,9 @@ function parseRemixScaffoldResponse(response, version) {
|
|
|
947
958
|
sourceVersion: version,
|
|
948
959
|
};
|
|
949
960
|
}
|
|
950
|
-
if (remixMode ===
|
|
961
|
+
if (remixMode === "inline-html") {
|
|
951
962
|
if (!htmlContent) {
|
|
952
|
-
throw new Error(
|
|
963
|
+
throw new Error("Remix response missing html");
|
|
953
964
|
}
|
|
954
965
|
return {
|
|
955
966
|
html: htmlContent,
|
|
@@ -958,9 +969,9 @@ function parseRemixScaffoldResponse(response, version) {
|
|
|
958
969
|
sourceVersion: null,
|
|
959
970
|
};
|
|
960
971
|
}
|
|
961
|
-
if (remixMode ===
|
|
972
|
+
if (remixMode === "external-metadata-only") {
|
|
962
973
|
if (!externalListingUrl) {
|
|
963
|
-
throw new Error(
|
|
974
|
+
throw new Error("Remix response missing externalListingUrl");
|
|
964
975
|
}
|
|
965
976
|
const externalMetadata = parseExternalRemixMetadata(response.metadata);
|
|
966
977
|
return {
|
|
@@ -971,28 +982,28 @@ function parseRemixScaffoldResponse(response, version) {
|
|
|
971
982
|
sourceVersion: null,
|
|
972
983
|
};
|
|
973
984
|
}
|
|
974
|
-
throw new Error(`Unsupported remix mode: ${remixMode ||
|
|
985
|
+
throw new Error(`Unsupported remix mode: ${remixMode || "missing"}`);
|
|
975
986
|
}
|
|
976
987
|
function parseExternalRemixMetadata(value) {
|
|
977
|
-
if (!value || typeof value !==
|
|
978
|
-
throw new Error(
|
|
988
|
+
if (!value || typeof value !== "object" || Array.isArray(value)) {
|
|
989
|
+
throw new Error("Remix response missing external metadata");
|
|
979
990
|
}
|
|
980
991
|
const record = value;
|
|
981
|
-
const name = typeof record.name ===
|
|
982
|
-
const displayName = typeof record.displayName ===
|
|
983
|
-
const description = typeof record.description ===
|
|
984
|
-
const creatorUsername = typeof record.creatorUsername ===
|
|
985
|
-
const type = (0, app_1.parseAppType)(record.type) ??
|
|
992
|
+
const name = typeof record.name === "string" ? record.name.trim() : "";
|
|
993
|
+
const displayName = typeof record.displayName === "string" ? record.displayName.trim() : "";
|
|
994
|
+
const description = typeof record.description === "string" ? record.description.trim() : "";
|
|
995
|
+
const creatorUsername = typeof record.creatorUsername === "string" ? record.creatorUsername.trim() : "";
|
|
996
|
+
const type = (0, app_1.parseAppType)(record.type) ?? "";
|
|
986
997
|
const emoji = record.emoji;
|
|
987
998
|
const color = record.color;
|
|
988
999
|
if (!name || !displayName || !description || !creatorUsername || !type) {
|
|
989
|
-
throw new Error(
|
|
1000
|
+
throw new Error("Remix response missing required external metadata fields");
|
|
990
1001
|
}
|
|
991
|
-
if (emoji !== null && typeof emoji !==
|
|
992
|
-
throw new Error(
|
|
1002
|
+
if (emoji !== null && typeof emoji !== "string") {
|
|
1003
|
+
throw new Error("Remix response has invalid external metadata emoji");
|
|
993
1004
|
}
|
|
994
|
-
if (color !== null && typeof color !==
|
|
995
|
-
throw new Error(
|
|
1005
|
+
if (color !== null && typeof color !== "string") {
|
|
1006
|
+
throw new Error("Remix response has invalid external metadata color");
|
|
996
1007
|
}
|
|
997
1008
|
return {
|
|
998
1009
|
name,
|
|
@@ -1012,7 +1023,7 @@ async function fetchRemixScaffold(client, creator, app, version) {
|
|
|
1012
1023
|
}
|
|
1013
1024
|
catch (unknownError) {
|
|
1014
1025
|
if (unknownError instanceof types_1.UnsupportedClientError) {
|
|
1015
|
-
(0, http_1.handleUnsupportedError)(unknownError,
|
|
1026
|
+
(0, http_1.handleUnsupportedError)(unknownError, "Remix scaffold");
|
|
1016
1027
|
}
|
|
1017
1028
|
if (unknownError instanceof types_1.ApiError) {
|
|
1018
1029
|
const detail = unknownError.message?.trim();
|
|
@@ -1022,26 +1033,26 @@ async function fetchRemixScaffold(client, creator, app, version) {
|
|
|
1022
1033
|
}
|
|
1023
1034
|
}
|
|
1024
1035
|
async function resolveAuthenticatedCreatorUsername(ctx) {
|
|
1025
|
-
const workspaceOwnerUsername = ctx.workspaceAuth?.config.ownerUsername?.trim() ??
|
|
1036
|
+
const workspaceOwnerUsername = ctx.workspaceAuth?.config.ownerUsername?.trim() ?? "";
|
|
1026
1037
|
if (workspaceOwnerUsername) {
|
|
1027
1038
|
return workspaceOwnerUsername;
|
|
1028
1039
|
}
|
|
1029
1040
|
const response = await ctx.client.me();
|
|
1030
|
-
const username = typeof response?.user?.username ===
|
|
1041
|
+
const username = typeof response?.user?.username === "string" ? response.user.username.trim() : "";
|
|
1031
1042
|
if (!username) {
|
|
1032
|
-
throw new Error(
|
|
1043
|
+
throw new Error("missing_creator_username");
|
|
1033
1044
|
}
|
|
1034
1045
|
return username;
|
|
1035
1046
|
}
|
|
1036
1047
|
async function fetchTemplateScaffold(client, namespace, slug) {
|
|
1037
1048
|
try {
|
|
1038
1049
|
const response = await client.fetchTemplateScaffold(namespace, slug);
|
|
1039
|
-
const archiveUrl = typeof response?.archiveUrl ===
|
|
1050
|
+
const archiveUrl = typeof response?.archiveUrl === "string" && response.archiveUrl.trim().length > 0
|
|
1040
1051
|
? response.archiveUrl.trim()
|
|
1041
1052
|
: null;
|
|
1042
|
-
const htmlContent = typeof response?.html ===
|
|
1053
|
+
const htmlContent = typeof response?.html === "string" ? response.html : null;
|
|
1043
1054
|
if (!archiveUrl && !htmlContent) {
|
|
1044
|
-
throw new Error(
|
|
1055
|
+
throw new Error("Template response missing scaffold content");
|
|
1045
1056
|
}
|
|
1046
1057
|
const metadata = response.metadata;
|
|
1047
1058
|
const entryPoint = extractEntryPointFromMetadata(metadata);
|
|
@@ -1054,7 +1065,7 @@ async function fetchTemplateScaffold(client, namespace, slug) {
|
|
|
1054
1065
|
}
|
|
1055
1066
|
catch (unknownError) {
|
|
1056
1067
|
if (unknownError instanceof types_1.UnsupportedClientError) {
|
|
1057
|
-
(0, http_1.handleUnsupportedError)(unknownError,
|
|
1068
|
+
(0, http_1.handleUnsupportedError)(unknownError, "Template scaffold");
|
|
1058
1069
|
}
|
|
1059
1070
|
if (unknownError instanceof types_1.ApiError) {
|
|
1060
1071
|
const detail = unknownError.message?.trim();
|
|
@@ -1068,16 +1079,16 @@ function describeInitSummary(summary) {
|
|
|
1068
1079
|
return null;
|
|
1069
1080
|
}
|
|
1070
1081
|
const parts = [];
|
|
1071
|
-
parts.push(summary.readmeStatus ===
|
|
1072
|
-
parts.push(summary.agentsStatus ===
|
|
1073
|
-
parts.push(summary.catalogueStatus ===
|
|
1074
|
-
if (summary.gitStatus ===
|
|
1075
|
-
parts.push(
|
|
1082
|
+
parts.push(summary.readmeStatus === "created" ? "created README.md" : "kept existing README.md");
|
|
1083
|
+
parts.push(summary.agentsStatus === "created" ? "created AGENTS.md" : "kept existing AGENTS.md");
|
|
1084
|
+
parts.push(summary.catalogueStatus === "created" ? "created catalogue.json" : "kept existing catalogue.json");
|
|
1085
|
+
if (summary.gitStatus === "initialized") {
|
|
1086
|
+
parts.push("initialized git repository");
|
|
1076
1087
|
}
|
|
1077
|
-
else if (summary.gitStatus ===
|
|
1078
|
-
parts.push(
|
|
1088
|
+
else if (summary.gitStatus === "declined") {
|
|
1089
|
+
parts.push("skipped git init");
|
|
1079
1090
|
}
|
|
1080
|
-
return `Project bootstrap recap: ${parts.join(
|
|
1091
|
+
return `Project bootstrap recap: ${parts.join("; ")}.`;
|
|
1081
1092
|
}
|
|
1082
1093
|
async function create(name, options = {}) {
|
|
1083
1094
|
const file = (0, node_path_1.resolve)(`${name}.html`);
|
|
@@ -1090,7 +1101,7 @@ async function create(name, options = {}) {
|
|
|
1090
1101
|
if (existingLookup.errors.length > 0) {
|
|
1091
1102
|
for (const error of existingLookup.errors) {
|
|
1092
1103
|
(0, messages_1.printErrorWithHelp)(error, ['Fix the catalogue issues noted above, then rerun "playdrop project create app".'], {
|
|
1093
|
-
command:
|
|
1104
|
+
command: "project create app",
|
|
1094
1105
|
includeGeneralHelp: false,
|
|
1095
1106
|
});
|
|
1096
1107
|
}
|
|
@@ -1098,32 +1109,30 @@ async function create(name, options = {}) {
|
|
|
1098
1109
|
return;
|
|
1099
1110
|
}
|
|
1100
1111
|
if (existingLookup.apps.length > 1) {
|
|
1101
|
-
(0, messages_1.printErrorWithHelp)(`Multiple catalogue entries share the app name "${name}".`, [
|
|
1102
|
-
'Ensure each app has a unique name across catalogue.json files before running "playdrop project create app".'
|
|
1103
|
-
], { command: 'project create app' });
|
|
1112
|
+
(0, messages_1.printErrorWithHelp)(`Multiple catalogue entries share the app name "${name}".`, ['Ensure each app has a unique name across catalogue.json files before running "playdrop project create app".'], { command: "project create app" });
|
|
1104
1113
|
process.exitCode = 1;
|
|
1105
1114
|
return;
|
|
1106
1115
|
}
|
|
1107
1116
|
const existingTask = existingLookup.apps.length === 1 ? existingLookup.apps[0] : null;
|
|
1108
1117
|
if (templateOptionRaw && remixOptionRaw) {
|
|
1109
|
-
(0, messages_1.printErrorWithHelp)(
|
|
1118
|
+
(0, messages_1.printErrorWithHelp)("Cannot use --template and --remix at the same time.", [
|
|
1119
|
+
'Choose one source: use "--remix app:creator/name@1.2.3" to remix an app version, or "--template {creator}/template/{name}" to start from a template.',
|
|
1120
|
+
], { command: "project create app" });
|
|
1110
1121
|
process.exitCode = 1;
|
|
1111
1122
|
return;
|
|
1112
1123
|
}
|
|
1113
1124
|
const reuseExistingApp = existingTask !== null && !templateOptionRaw && !remixOptionRaw;
|
|
1114
1125
|
if (!reuseExistingApp && ((0, node_fs_1.existsSync)(file) || (0, node_fs_1.existsSync)(projectDirCandidate))) {
|
|
1115
|
-
(0, messages_1.printErrorWithHelp)(`Cannot create ${name} because a file or directory with that name already exists.`, [
|
|
1116
|
-
'Choose a different app name or remove the existing file before running "playdrop project create app" again.'
|
|
1117
|
-
], { command: 'project create app' });
|
|
1126
|
+
(0, messages_1.printErrorWithHelp)(`Cannot create ${name} because a file or directory with that name already exists.`, ['Choose a different app name or remove the existing file before running "playdrop project create app" again.'], { command: "project create app" });
|
|
1118
1127
|
process.exitCode = 1;
|
|
1119
1128
|
return;
|
|
1120
1129
|
}
|
|
1121
1130
|
if (!templateOptionRaw && !remixOptionRaw) {
|
|
1122
1131
|
if (!reuseExistingApp) {
|
|
1123
|
-
(0, messages_1.printErrorWithHelp)(
|
|
1132
|
+
(0, messages_1.printErrorWithHelp)("Specify either --template or --remix when creating an app.", [
|
|
1124
1133
|
'Use "playdrop browse --kind app --app-type template" to discover available templates.',
|
|
1125
|
-
'Browse https://playdrop.ai, pick an app version, and pass its canonical ref with "--remix app:creator/name@1.2.3".'
|
|
1126
|
-
], { command:
|
|
1134
|
+
'Browse https://playdrop.ai, pick an app version, and pass its canonical ref with "--remix app:creator/name@1.2.3".',
|
|
1135
|
+
], { command: "project create app" });
|
|
1127
1136
|
process.exitCode = 1;
|
|
1128
1137
|
return;
|
|
1129
1138
|
}
|
|
@@ -1133,10 +1142,10 @@ async function create(name, options = {}) {
|
|
|
1133
1142
|
if (!reuseExistingApp && remixOption) {
|
|
1134
1143
|
parsedRemix = parseRemixRef(remixOption);
|
|
1135
1144
|
if (!parsedRemix) {
|
|
1136
|
-
(0, messages_1.printErrorWithHelp)(
|
|
1137
|
-
|
|
1138
|
-
'Use "playdrop browse --kind app" or "playdrop search <query> --kind app" to find remixable apps.'
|
|
1139
|
-
], { command:
|
|
1145
|
+
(0, messages_1.printErrorWithHelp)("The --remix value must use canonical app version ref format.", [
|
|
1146
|
+
"Example: app:playdrop/hangingout@1.2.3.",
|
|
1147
|
+
'Use "playdrop browse --kind app" or "playdrop search <query> --kind app" to find remixable apps.',
|
|
1148
|
+
], { command: "project create app" });
|
|
1140
1149
|
process.exitCode = 1;
|
|
1141
1150
|
return;
|
|
1142
1151
|
}
|
|
@@ -1144,22 +1153,22 @@ async function create(name, options = {}) {
|
|
|
1144
1153
|
else if (templateOption && !reuseExistingApp) {
|
|
1145
1154
|
parsedTemplate = parseTemplateKey(templateOption);
|
|
1146
1155
|
if (!parsedTemplate) {
|
|
1147
|
-
(0, messages_1.printErrorWithHelp)(
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
], { command:
|
|
1156
|
+
(0, messages_1.printErrorWithHelp)("The --template value must use the {creator}/template/{name} or {creator}/app/{name} key format.", [
|
|
1157
|
+
"Examples: playdrop/template/typescript_template or playdrop/app/typescript_template.",
|
|
1158
|
+
"Use the exact template ref shown in Playdrop.",
|
|
1159
|
+
], { command: "project create app" });
|
|
1151
1160
|
process.exitCode = 1;
|
|
1152
1161
|
return;
|
|
1153
1162
|
}
|
|
1154
1163
|
}
|
|
1155
|
-
const ctx = await (0, commandContext_1.resolveAuthenticatedEnvironmentContext)(
|
|
1164
|
+
const ctx = await (0, commandContext_1.resolveAuthenticatedEnvironmentContext)("project create app", "Creating an app", {
|
|
1165
|
+
workspacePath: process.cwd(),
|
|
1166
|
+
});
|
|
1156
1167
|
if (!ctx) {
|
|
1157
1168
|
return;
|
|
1158
1169
|
}
|
|
1159
1170
|
const currentDir = process.cwd();
|
|
1160
|
-
const taskScaffoldOutputVersion = !reuseExistingApp
|
|
1161
|
-
? resolveTaskScaffoldOutputVersion(currentDir)
|
|
1162
|
-
: null;
|
|
1171
|
+
const taskScaffoldOutputVersion = !reuseExistingApp ? resolveTaskScaffoldOutputVersion(currentDir) : null;
|
|
1163
1172
|
const localCataloguePath = (0, node_path_1.resolve)(currentDir, CATALOGUE_FILENAME);
|
|
1164
1173
|
let initSummary = null;
|
|
1165
1174
|
let workspaceCatalogueResult = null;
|
|
@@ -1171,7 +1180,7 @@ async function create(name, options = {}) {
|
|
|
1171
1180
|
const sourceInfo = {};
|
|
1172
1181
|
let remixSourceTarget = null;
|
|
1173
1182
|
let scaffold = null;
|
|
1174
|
-
let provenanceMessage =
|
|
1183
|
+
let provenanceMessage = "";
|
|
1175
1184
|
if (!reuseExistingApp && remixOption) {
|
|
1176
1185
|
const parsed = parsedRemix;
|
|
1177
1186
|
remixSourceTarget = { creator: parsed.creator, name: parsed.name, version: parsed.version };
|
|
@@ -1185,16 +1194,14 @@ async function create(name, options = {}) {
|
|
|
1185
1194
|
process.exitCode = 1;
|
|
1186
1195
|
return;
|
|
1187
1196
|
}
|
|
1188
|
-
const detailMessage = error instanceof Error && error.message.trim()
|
|
1189
|
-
? error.message.trim()
|
|
1190
|
-
: '';
|
|
1197
|
+
const detailMessage = error instanceof Error && error.message.trim() ? error.message.trim() : "";
|
|
1191
1198
|
const problem = detailMessage
|
|
1192
1199
|
? `Failed to fetch remix source: ${detailMessage}`
|
|
1193
|
-
:
|
|
1200
|
+
: "Failed to fetch remix source.";
|
|
1194
1201
|
(0, messages_1.printErrorWithHelp)(problem, [
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
], { command:
|
|
1202
|
+
"Confirm the key is correct and that you have access to remix the source app.",
|
|
1203
|
+
"Retry once you are logged in and the Playdrop API is reachable.",
|
|
1204
|
+
], { command: "project create app" });
|
|
1198
1205
|
process.exitCode = 1;
|
|
1199
1206
|
return;
|
|
1200
1207
|
}
|
|
@@ -1215,36 +1222,31 @@ async function create(name, options = {}) {
|
|
|
1215
1222
|
process.exitCode = 1;
|
|
1216
1223
|
return;
|
|
1217
1224
|
}
|
|
1218
|
-
const detailMessage = typeof error?.message ===
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
const problem = detailMessage
|
|
1222
|
-
? `Failed to fetch template: ${detailMessage}`
|
|
1223
|
-
: 'Failed to fetch template.';
|
|
1224
|
-
(0, messages_1.printErrorWithHelp)(problem, [
|
|
1225
|
-
'Verify the template key and ensure you are logged in.',
|
|
1226
|
-
'Retry when the Playdrop API is reachable.'
|
|
1227
|
-
], { command: 'project create app' });
|
|
1225
|
+
const detailMessage = typeof error?.message === "string" && error.message.trim() ? error.message.trim() : "";
|
|
1226
|
+
const problem = detailMessage ? `Failed to fetch template: ${detailMessage}` : "Failed to fetch template.";
|
|
1227
|
+
(0, messages_1.printErrorWithHelp)(problem, ["Verify the template key and ensure you are logged in.", "Retry when the Playdrop API is reachable."], { command: "project create app" });
|
|
1228
1228
|
process.exitCode = 1;
|
|
1229
1229
|
return;
|
|
1230
1230
|
}
|
|
1231
1231
|
}
|
|
1232
1232
|
}
|
|
1233
1233
|
if (!reuseExistingApp && !scaffold) {
|
|
1234
|
-
(0, messages_1.printErrorWithHelp)(
|
|
1234
|
+
(0, messages_1.printErrorWithHelp)("Failed to retrieve scaffold data. Specify a valid --template or --remix key and try again.", [
|
|
1235
1235
|
'Use "playdrop browse --kind app --app-type template" to discover available templates.',
|
|
1236
|
-
'Browse https://playdrop.ai and copy an exact app version ref to pass with "--remix".'
|
|
1237
|
-
], { command:
|
|
1236
|
+
'Browse https://playdrop.ai and copy an exact app version ref to pass with "--remix".',
|
|
1237
|
+
], { command: "project create app" });
|
|
1238
1238
|
process.exitCode = 1;
|
|
1239
1239
|
return;
|
|
1240
1240
|
}
|
|
1241
|
-
const hasArchive = !reuseExistingApp && typeof scaffold?.archiveUrl ===
|
|
1242
|
-
const externalRemixListingUrl = !reuseExistingApp &&
|
|
1241
|
+
const hasArchive = !reuseExistingApp && typeof scaffold?.archiveUrl === "string" && scaffold.archiveUrl?.trim().length > 0;
|
|
1242
|
+
const externalRemixListingUrl = !reuseExistingApp &&
|
|
1243
|
+
typeof scaffold?.externalListingUrl === "string" &&
|
|
1244
|
+
scaffold.externalListingUrl.trim().length > 0
|
|
1243
1245
|
? scaffold.externalListingUrl.trim()
|
|
1244
1246
|
: null;
|
|
1245
|
-
let htmlFilePath = reuseExistingApp && existingTask ? existingTask.filePath :
|
|
1247
|
+
let htmlFilePath = reuseExistingApp && existingTask ? existingTask.filePath : "";
|
|
1246
1248
|
let projectDir = reuseExistingApp && existingTask ? existingTask.projectDir : null;
|
|
1247
|
-
let packageJsonPath = reuseExistingApp && existingTask ? existingTask.packageJsonPath ?? null : null;
|
|
1249
|
+
let packageJsonPath = reuseExistingApp && existingTask ? (existingTask.packageJsonPath ?? null) : null;
|
|
1248
1250
|
if (!reuseExistingApp && !hasArchive) {
|
|
1249
1251
|
const ensuredCatalogue = await ensureLocalCatalogue(localCataloguePath);
|
|
1250
1252
|
if (!ensuredCatalogue) {
|
|
@@ -1259,9 +1261,7 @@ async function create(name, options = {}) {
|
|
|
1259
1261
|
(0, node_fs_1.mkdirSync)(projectDir);
|
|
1260
1262
|
}
|
|
1261
1263
|
catch {
|
|
1262
|
-
(0, messages_1.printErrorWithHelp)(`Cannot create ${projectDir} because it already exists.`, [
|
|
1263
|
-
'Remove or rename the existing directory before running "playdrop project create app" again.'
|
|
1264
|
-
], { command: 'project create app' });
|
|
1264
|
+
(0, messages_1.printErrorWithHelp)(`Cannot create ${projectDir} because it already exists.`, ['Remove or rename the existing directory before running "playdrop project create app" again.'], { command: "project create app" });
|
|
1265
1265
|
process.exitCode = 1;
|
|
1266
1266
|
return;
|
|
1267
1267
|
}
|
|
@@ -1276,12 +1276,15 @@ async function create(name, options = {}) {
|
|
|
1276
1276
|
const entryPointCandidates = [
|
|
1277
1277
|
extraction.entryPoint,
|
|
1278
1278
|
scaffold.entryPoint ?? null,
|
|
1279
|
-
|
|
1279
|
+
"dist/index.html",
|
|
1280
1280
|
`${name}.html`,
|
|
1281
|
-
].filter((value) => typeof value ===
|
|
1281
|
+
].filter((value) => typeof value === "string" && value.trim().length > 0);
|
|
1282
1282
|
let resolvedEntryPoint = null;
|
|
1283
1283
|
for (const candidate of entryPointCandidates) {
|
|
1284
|
-
const normalized = candidate
|
|
1284
|
+
const normalized = candidate
|
|
1285
|
+
.replace(/^\.\/?/, "")
|
|
1286
|
+
.replace(/^\\+/, "")
|
|
1287
|
+
.replace(/\\/g, "/");
|
|
1285
1288
|
const candidatePath = (0, node_path_1.resolve)(projectDir, normalized);
|
|
1286
1289
|
if ((0, node_fs_1.existsSync)(candidatePath) && (0, node_fs_1.statSync)(candidatePath).isFile()) {
|
|
1287
1290
|
resolvedEntryPoint = candidatePath;
|
|
@@ -1296,22 +1299,20 @@ async function create(name, options = {}) {
|
|
|
1296
1299
|
}
|
|
1297
1300
|
if (!resolvedEntryPoint) {
|
|
1298
1301
|
(0, node_fs_1.rmSync)(projectDir, { recursive: true, force: true });
|
|
1299
|
-
(0, messages_1.printErrorWithHelp)(
|
|
1300
|
-
'Check the template archive and ensure playdrop.project.json specifies a valid entryPoint before retrying.'
|
|
1301
|
-
], { command: 'project create app' });
|
|
1302
|
+
(0, messages_1.printErrorWithHelp)("Extracted project archive did not include an HTML entry point.", ["Check the template archive and ensure playdrop.project.json specifies a valid entryPoint before retrying."], { command: "project create app" });
|
|
1302
1303
|
process.exitCode = 1;
|
|
1303
1304
|
return;
|
|
1304
1305
|
}
|
|
1305
1306
|
htmlFilePath = resolvedEntryPoint;
|
|
1306
|
-
const packageCandidate = (0, node_path_1.join)(projectDir,
|
|
1307
|
+
const packageCandidate = (0, node_path_1.join)(projectDir, "package.json");
|
|
1307
1308
|
packageJsonPath = (0, node_fs_1.existsSync)(packageCandidate) ? packageCandidate : null;
|
|
1308
1309
|
}
|
|
1309
1310
|
catch (error) {
|
|
1310
1311
|
(0, node_fs_1.rmSync)(projectDir, { recursive: true, force: true });
|
|
1311
|
-
const detailMessage = typeof error?.message ===
|
|
1312
|
+
const detailMessage = typeof error?.message === "string" && error.message.trim()
|
|
1312
1313
|
? error.message.trim()
|
|
1313
|
-
:
|
|
1314
|
-
(0, messages_1.printNetworkIssue)(detailMessage,
|
|
1314
|
+
: "Failed to download or extract the project archive.";
|
|
1315
|
+
(0, messages_1.printNetworkIssue)(detailMessage, "project create app");
|
|
1315
1316
|
process.exitCode = 1;
|
|
1316
1317
|
return;
|
|
1317
1318
|
}
|
|
@@ -1321,9 +1322,7 @@ async function create(name, options = {}) {
|
|
|
1321
1322
|
if (reuseExistingApp) {
|
|
1322
1323
|
htmlFilePath = existingTask.filePath;
|
|
1323
1324
|
if (!(0, node_fs_1.existsSync)(htmlFilePath) || !(0, node_fs_1.statSync)(htmlFilePath).isFile()) {
|
|
1324
|
-
(0, messages_1.printErrorWithHelp)(`Could not reuse existing app because ${htmlFilePath} does not exist.`, [
|
|
1325
|
-
'Update catalogue.json or remove the entry before rerunning "playdrop project create app".'
|
|
1326
|
-
], { command: 'project create app' });
|
|
1325
|
+
(0, messages_1.printErrorWithHelp)(`Could not reuse existing app because ${htmlFilePath} does not exist.`, ['Update catalogue.json or remove the entry before rerunning "playdrop project create app".'], { command: "project create app" });
|
|
1327
1326
|
process.exitCode = 1;
|
|
1328
1327
|
return;
|
|
1329
1328
|
}
|
|
@@ -1335,7 +1334,7 @@ async function create(name, options = {}) {
|
|
|
1335
1334
|
htmlFilePath = file;
|
|
1336
1335
|
}
|
|
1337
1336
|
else if (!scaffold?.html) {
|
|
1338
|
-
(0, messages_1.printNetworkIssue)(
|
|
1337
|
+
(0, messages_1.printNetworkIssue)("Unable to retrieve template content for playdrop project create app.", "project create app");
|
|
1339
1338
|
process.exitCode = 1;
|
|
1340
1339
|
return;
|
|
1341
1340
|
}
|
|
@@ -1373,15 +1372,15 @@ async function create(name, options = {}) {
|
|
|
1373
1372
|
}
|
|
1374
1373
|
catch (error) {
|
|
1375
1374
|
const fallbackLabel = cataloguePathToUse
|
|
1376
|
-
? (
|
|
1375
|
+
? (0, node_path_1.relative)(process.cwd(), cataloguePathToUse) || CATALOGUE_FILENAME
|
|
1377
1376
|
: CATALOGUE_FILENAME;
|
|
1378
|
-
const message = typeof error?.message ===
|
|
1377
|
+
const message = typeof error?.message === "string" && error.message.includes("surfaceTargets")
|
|
1379
1378
|
? error.message
|
|
1380
1379
|
: `Could not update ${fallbackLabel} because it contains invalid JSON.`;
|
|
1381
|
-
const suggestions = typeof error?.message ===
|
|
1380
|
+
const suggestions = typeof error?.message === "string" && error.message.includes("surfaceTargets")
|
|
1382
1381
|
? ['Fix the catalogue entry described above, then rerun "playdrop project create app".']
|
|
1383
1382
|
: [`Fix the JSON in ${fallbackLabel} and add ${name} again before rerunning "playdrop project create app".`];
|
|
1384
|
-
(0, messages_1.printErrorWithHelp)(message, suggestions, { command:
|
|
1383
|
+
(0, messages_1.printErrorWithHelp)(message, suggestions, { command: "project create app" });
|
|
1385
1384
|
process.exitCode = 1;
|
|
1386
1385
|
return;
|
|
1387
1386
|
}
|
|
@@ -1399,7 +1398,7 @@ async function create(name, options = {}) {
|
|
|
1399
1398
|
scaffoldedCataloguePaths.add((0, node_path_1.resolve)(workspaceCatalogueResult.path));
|
|
1400
1399
|
}
|
|
1401
1400
|
if (scaffoldedCataloguePaths.size === 0) {
|
|
1402
|
-
throw new Error(
|
|
1401
|
+
throw new Error("agent_task_scaffold_catalogue_missing: scaffolding did not produce a catalogue to version.");
|
|
1403
1402
|
}
|
|
1404
1403
|
for (const scaffoldedCataloguePath of scaffoldedCataloguePaths) {
|
|
1405
1404
|
forceScaffoldedCatalogueVersion(scaffoldedCataloguePath, name, taskScaffoldOutputVersion);
|
|
@@ -1412,26 +1411,24 @@ async function create(name, options = {}) {
|
|
|
1412
1411
|
else if (!reuseExistingApp && externalRemixListingUrl && !(0, node_fs_1.existsSync)(htmlFilePath)) {
|
|
1413
1412
|
const pendingCataloguePath = workspaceCatalogueResult?.path ?? cataloguePathToUse;
|
|
1414
1413
|
if (!pendingCataloguePath) {
|
|
1415
|
-
throw new Error(
|
|
1414
|
+
throw new Error("Missing catalogue path for external remix scaffold.");
|
|
1416
1415
|
}
|
|
1417
1416
|
registrationTask = buildPendingExternalRemixTask(name, scaffold.metadata, sourceInfo, pendingCataloguePath, htmlFilePath);
|
|
1418
1417
|
}
|
|
1419
1418
|
else {
|
|
1420
1419
|
const registrationLookup = (0, catalogue_1.resolveCatalogueEntries)(process.cwd(), { filterName: name });
|
|
1421
1420
|
if (registrationLookup.errors.length > 0) {
|
|
1422
|
-
const otherErrors = registrationLookup.errors.filter((error) => typeof error !==
|
|
1421
|
+
const otherErrors = registrationLookup.errors.filter((error) => typeof error !== "string" || !error.includes("Duplicate app name"));
|
|
1423
1422
|
if (otherErrors.length > 0) {
|
|
1424
1423
|
for (const error of otherErrors) {
|
|
1425
|
-
(0, messages_1.printErrorWithHelp)(error, ['Fix the catalogue issues noted above, then rerun "playdrop project create app".'], { command:
|
|
1424
|
+
(0, messages_1.printErrorWithHelp)(error, ['Fix the catalogue issues noted above, then rerun "playdrop project create app".'], { command: "project create app", includeGeneralHelp: false });
|
|
1426
1425
|
}
|
|
1427
1426
|
process.exitCode = 1;
|
|
1428
1427
|
return;
|
|
1429
1428
|
}
|
|
1430
1429
|
}
|
|
1431
1430
|
if (registrationLookup.apps.length === 0) {
|
|
1432
|
-
(0, messages_1.printErrorWithHelp)(`App "${name}" was not found in any catalogue.json after scaffolding.`, [
|
|
1433
|
-
'Ensure catalogue.json was updated, then rerun "playdrop project create app".'
|
|
1434
|
-
], { command: 'project create app' });
|
|
1431
|
+
(0, messages_1.printErrorWithHelp)(`App "${name}" was not found in any catalogue.json after scaffolding.`, ['Ensure catalogue.json was updated, then rerun "playdrop project create app".'], { command: "project create app" });
|
|
1435
1432
|
process.exitCode = 1;
|
|
1436
1433
|
return;
|
|
1437
1434
|
}
|
|
@@ -1445,7 +1442,7 @@ async function create(name, options = {}) {
|
|
|
1445
1442
|
}
|
|
1446
1443
|
let selectedTask = null;
|
|
1447
1444
|
for (const preferred of preferredCataloguePaths) {
|
|
1448
|
-
const match = candidates.find(task => (0, node_path_1.resolve)(task.catalogueAbsolutePath) === preferred);
|
|
1445
|
+
const match = candidates.find((task) => (0, node_path_1.resolve)(task.catalogueAbsolutePath) === preferred);
|
|
1449
1446
|
if (match) {
|
|
1450
1447
|
selectedTask = match;
|
|
1451
1448
|
break;
|
|
@@ -1455,29 +1452,27 @@ async function create(name, options = {}) {
|
|
|
1455
1452
|
selectedTask = candidates[0];
|
|
1456
1453
|
}
|
|
1457
1454
|
if (!selectedTask) {
|
|
1458
|
-
const matchingByHtml = candidates.filter(task => task.filePath === htmlFilePath);
|
|
1455
|
+
const matchingByHtml = candidates.filter((task) => task.filePath === htmlFilePath);
|
|
1459
1456
|
if (matchingByHtml.length === 1) {
|
|
1460
1457
|
selectedTask = matchingByHtml[0];
|
|
1461
1458
|
}
|
|
1462
1459
|
}
|
|
1463
1460
|
if (!selectedTask) {
|
|
1464
|
-
(0, messages_1.printErrorWithHelp)(`Multiple catalogue entries share the app name "${name}".`, [
|
|
1465
|
-
'Ensure each app has a unique name across catalogue.json files before running "playdrop project create app".'
|
|
1466
|
-
], { command: 'project create app' });
|
|
1461
|
+
(0, messages_1.printErrorWithHelp)(`Multiple catalogue entries share the app name "${name}".`, ['Ensure each app has a unique name across catalogue.json files before running "playdrop project create app".'], { command: "project create app" });
|
|
1467
1462
|
process.exitCode = 1;
|
|
1468
1463
|
return;
|
|
1469
1464
|
}
|
|
1470
1465
|
registrationTask = selectedTask;
|
|
1471
1466
|
}
|
|
1472
1467
|
let dependenciesInstalled = false;
|
|
1473
|
-
if (!reuseExistingApp
|
|
1474
|
-
&&
|
|
1475
|
-
&&
|
|
1476
|
-
|
|
1468
|
+
if (!reuseExistingApp &&
|
|
1469
|
+
projectDir &&
|
|
1470
|
+
packageJsonPath &&
|
|
1471
|
+
(ctx.workspaceAuth?.config.taskId || ctx.workspaceAuth?.config.taskToken)) {
|
|
1477
1472
|
console.log(`Installing dependencies for worker shell preflight in ${(0, node_path_1.relative)(process.cwd(), projectDir) || projectDir}.`);
|
|
1478
1473
|
dependenciesInstalled = runNpmInstall(projectDir);
|
|
1479
1474
|
if (!dependenciesInstalled) {
|
|
1480
|
-
(0, messages_1.printErrorWithHelp)(
|
|
1475
|
+
(0, messages_1.printErrorWithHelp)("Worker project dependency installation failed.", ["Fix the template dependencies before retrying the task."], { command: "project create app" });
|
|
1481
1476
|
process.exitCode = 1;
|
|
1482
1477
|
return;
|
|
1483
1478
|
}
|
|
@@ -1497,7 +1492,7 @@ async function create(name, options = {}) {
|
|
|
1497
1492
|
...(Number.isInteger(taskId) && Number(taskId) > 0 ? { agentTaskId: Number(taskId) } : {}),
|
|
1498
1493
|
...(sourceInfo.remixRef ? { remixRef: sourceInfo.remixRef } : {}),
|
|
1499
1494
|
};
|
|
1500
|
-
let creatorUsername =
|
|
1495
|
+
let creatorUsername = "";
|
|
1501
1496
|
try {
|
|
1502
1497
|
creatorUsername = await resolveAuthenticatedCreatorUsername(ctx);
|
|
1503
1498
|
}
|
|
@@ -1507,22 +1502,22 @@ async function create(name, options = {}) {
|
|
|
1507
1502
|
return;
|
|
1508
1503
|
}
|
|
1509
1504
|
if (error instanceof types_1.UnsupportedClientError) {
|
|
1510
|
-
(0, http_1.handleUnsupportedError)(error,
|
|
1505
|
+
(0, http_1.handleUnsupportedError)(error, "Resolve creator account");
|
|
1511
1506
|
process.exitCode = 1;
|
|
1512
1507
|
return;
|
|
1513
1508
|
}
|
|
1514
1509
|
if (error instanceof types_1.ApiError) {
|
|
1515
|
-
(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:
|
|
1510
|
+
(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" });
|
|
1516
1511
|
process.exitCode = 1;
|
|
1517
1512
|
return;
|
|
1518
1513
|
}
|
|
1519
1514
|
if (error instanceof TypeError) {
|
|
1520
|
-
(0, messages_1.printNetworkIssue)(
|
|
1515
|
+
(0, messages_1.printNetworkIssue)("Could not reach the Playdrop API to resolve your creator account.", "project create app");
|
|
1521
1516
|
process.exitCode = 1;
|
|
1522
1517
|
return;
|
|
1523
1518
|
}
|
|
1524
|
-
if (error instanceof Error && error.message ===
|
|
1525
|
-
(0, messages_1.printErrorWithHelp)(
|
|
1519
|
+
if (error instanceof Error && error.message === "missing_creator_username") {
|
|
1520
|
+
(0, messages_1.printErrorWithHelp)("The API did not return a creator username.", ['Run "playdrop auth login" again, then retry.'], { command: "project create app" });
|
|
1526
1521
|
process.exitCode = 1;
|
|
1527
1522
|
return;
|
|
1528
1523
|
}
|
|
@@ -1538,17 +1533,17 @@ async function create(name, options = {}) {
|
|
|
1538
1533
|
return;
|
|
1539
1534
|
}
|
|
1540
1535
|
if (error instanceof types_1.UnsupportedClientError) {
|
|
1541
|
-
(0, http_1.handleUnsupportedError)(error,
|
|
1536
|
+
(0, http_1.handleUnsupportedError)(error, "Register app");
|
|
1542
1537
|
process.exitCode = 1;
|
|
1543
1538
|
return;
|
|
1544
1539
|
}
|
|
1545
1540
|
if (error instanceof types_1.ApiError) {
|
|
1546
|
-
(0, messages_1.printErrorWithHelp)(`Failed to register ${name} (status ${error.status}: ${error.code}).`, [
|
|
1541
|
+
(0, messages_1.printErrorWithHelp)(`Failed to register ${name} (status ${error.status}: ${error.code}).`, ["Resolve the API error, then retry the same project create command."], { command: "project create app" });
|
|
1547
1542
|
process.exitCode = 1;
|
|
1548
1543
|
return;
|
|
1549
1544
|
}
|
|
1550
1545
|
else if (error instanceof TypeError) {
|
|
1551
|
-
(0, messages_1.printNetworkIssue)(
|
|
1546
|
+
(0, messages_1.printNetworkIssue)("Could not reach the Playdrop API to register the app.", "project create app");
|
|
1552
1547
|
process.exitCode = 1;
|
|
1553
1548
|
return;
|
|
1554
1549
|
}
|
|
@@ -1574,19 +1569,17 @@ async function create(name, options = {}) {
|
|
|
1574
1569
|
return;
|
|
1575
1570
|
}
|
|
1576
1571
|
if (error instanceof types_1.UnsupportedClientError) {
|
|
1577
|
-
(0, http_1.handleUnsupportedError)(error,
|
|
1572
|
+
(0, http_1.handleUnsupportedError)(error, "Update app");
|
|
1578
1573
|
process.exitCode = 1;
|
|
1579
1574
|
return;
|
|
1580
1575
|
}
|
|
1581
1576
|
if (error instanceof types_1.ApiError) {
|
|
1582
|
-
(0, messages_1.printErrorWithHelp)(`Failed to update ${name} metadata (status ${error.status}).`, [
|
|
1583
|
-
'Update the catalogue entry and retry, or contact the Playdrop team if the issue persists.'
|
|
1584
|
-
], { command: 'project create app' });
|
|
1577
|
+
(0, messages_1.printErrorWithHelp)(`Failed to update ${name} metadata (status ${error.status}).`, ["Update the catalogue entry and retry, or contact the Playdrop team if the issue persists."], { command: "project create app" });
|
|
1585
1578
|
process.exitCode = 1;
|
|
1586
1579
|
return;
|
|
1587
1580
|
}
|
|
1588
1581
|
if (error instanceof TypeError) {
|
|
1589
|
-
(0, messages_1.printNetworkIssue)(
|
|
1582
|
+
(0, messages_1.printNetworkIssue)("Could not reach the Playdrop API to update the app.", "project create app");
|
|
1590
1583
|
process.exitCode = 1;
|
|
1591
1584
|
return;
|
|
1592
1585
|
}
|
|
@@ -1598,7 +1591,7 @@ async function create(name, options = {}) {
|
|
|
1598
1591
|
const registeredApp = await (0, devShared_1.assertAppRegistered)(client, creatorUsername, name);
|
|
1599
1592
|
const captureSession = (0, taskCaptureSession_1.resolveTaskCaptureSession)(ctx.workspaceAuth, registeredApp);
|
|
1600
1593
|
if (!captureSession) {
|
|
1601
|
-
throw new Error(
|
|
1594
|
+
throw new Error("worker_capture_session_missing");
|
|
1602
1595
|
}
|
|
1603
1596
|
console.log(`Running worker shell preflight for ${creatorUsername}/${name}.`);
|
|
1604
1597
|
const preflight = await (0, loadCheck_1.runLocalHostedLoadCheck)({
|
|
@@ -1610,21 +1603,21 @@ async function create(name, options = {}) {
|
|
|
1610
1603
|
captureSession,
|
|
1611
1604
|
timeoutMs: 15000,
|
|
1612
1605
|
});
|
|
1613
|
-
if (preflight.status !==
|
|
1614
|
-
(0, messages_1.printErrorWithHelp)((0, loadCheck_1.formatHostedLoadCheckFailure)(name, preflight,
|
|
1606
|
+
if (preflight.status !== "PASSED") {
|
|
1607
|
+
(0, messages_1.printErrorWithHelp)((0, loadCheck_1.formatHostedLoadCheckFailure)(name, preflight, "local"), ["Fix the worker shell or capture authorization before implementing the game."], { command: "project create app" });
|
|
1615
1608
|
process.exitCode = 1;
|
|
1616
1609
|
return;
|
|
1617
1610
|
}
|
|
1618
1611
|
console.log(`Worker shell preflight passed for ${creatorUsername}/${name}.`);
|
|
1619
1612
|
}
|
|
1620
1613
|
catch (error) {
|
|
1621
|
-
(0, messages_1.printErrorWithHelp)(`Worker shell preflight failed: ${error?.message ||
|
|
1614
|
+
(0, messages_1.printErrorWithHelp)(`Worker shell preflight failed: ${error?.message || "unknown_error"}`, ["Fix the worker shell or capture authorization before implementing the game."], { command: "project create app" });
|
|
1622
1615
|
process.exitCode = 1;
|
|
1623
1616
|
return;
|
|
1624
1617
|
}
|
|
1625
1618
|
}
|
|
1626
1619
|
}
|
|
1627
|
-
const projectDirLabel = projectDir ? (
|
|
1620
|
+
const projectDirLabel = projectDir ? (0, node_path_1.relative)(process.cwd(), projectDir) || projectDir : null;
|
|
1628
1621
|
const entryPointLabel = (0, node_path_1.relative)(process.cwd(), htmlFilePath) || (0, node_path_1.basename)(htmlFilePath);
|
|
1629
1622
|
const hasPackageJson = Boolean(packageJsonPath);
|
|
1630
1623
|
if (!dependenciesInstalled && !reuseExistingApp && projectDir && packageJsonPath && node_process_1.stdin.isTTY && node_process_1.stdout.isTTY) {
|
|
@@ -1633,7 +1626,7 @@ async function create(name, options = {}) {
|
|
|
1633
1626
|
const success = runNpmInstall(projectDir);
|
|
1634
1627
|
dependenciesInstalled = success;
|
|
1635
1628
|
if (!success) {
|
|
1636
|
-
console.warn(
|
|
1629
|
+
console.warn("npm install failed. Install dependencies manually before continuing.");
|
|
1637
1630
|
}
|
|
1638
1631
|
}
|
|
1639
1632
|
}
|