@playdrop/playdrop-cli 0.16.16 → 0.17.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/config/client-meta.json +4 -4
- package/dist/apiClient.d.ts +1 -2
- package/dist/apiClient.js +1 -16
- package/dist/appUrls.js +4 -0
- package/dist/apps/build.d.ts +12 -4
- package/dist/apps/build.js +55 -22
- package/dist/apps/index.d.ts +2 -1
- package/dist/apps/index.js +4 -1
- package/dist/apps/loadCheck.d.ts +5 -1
- package/dist/apps/loadCheck.js +52 -18
- package/dist/apps/serverBuild.d.ts +17 -0
- package/dist/apps/serverBuild.js +155 -0
- package/dist/apps/staticHtml.d.ts +1 -0
- package/dist/apps/staticHtml.js +19 -10
- package/dist/apps/upload.d.ts +12 -2
- package/dist/apps/upload.js +127 -46
- package/dist/catalogue.d.ts +23 -1
- package/dist/catalogue.js +126 -100
- package/dist/commandContext.d.ts +6 -3
- package/dist/commandContext.js +108 -18
- package/dist/commands/build.js +0 -7
- package/dist/commands/captureListing.d.ts +3 -0
- package/dist/commands/captureListing.js +48 -4
- package/dist/commands/chat.d.ts +4 -0
- package/dist/commands/chat.js +133 -8
- package/dist/commands/check.js +34 -1
- package/dist/commands/create.js +30 -263
- package/dist/commands/dev.js +37 -3
- package/dist/commands/devBrowser.js +2 -2
- package/dist/commands/devGameServer.d.ts +16 -0
- package/dist/commands/devGameServer.js +237 -0
- package/dist/commands/devRuntimeAssets.d.ts +1 -0
- package/dist/commands/devRuntimeAssets.js +2 -0
- package/dist/commands/devServer.d.ts +3 -0
- package/dist/commands/devServer.js +111 -5
- package/dist/commands/generation.d.ts +33 -4
- package/dist/commands/generation.js +304 -115
- package/dist/commands/login.js +23 -7
- package/dist/commands/review.d.ts +1 -1
- package/dist/commands/review.js +68 -95
- package/dist/commands/source.d.ts +19 -0
- package/dist/commands/source.js +142 -0
- package/dist/commands/tweaks.js +5 -11
- package/dist/commands/upload-content.d.ts +1 -1
- package/dist/commands/upload-content.js +16 -12
- package/dist/commands/upload.d.ts +17 -1
- package/dist/commands/upload.js +47 -10
- package/dist/commands/worker/archive-staging.d.ts +1 -0
- package/dist/commands/worker/archive-staging.js +13 -2
- package/dist/commands/worker/e2e-fixtures.d.ts +32 -0
- package/dist/commands/worker/e2e-fixtures.js +466 -0
- package/dist/commands/worker/game-server-infra.d.ts +80 -0
- package/dist/commands/worker/game-server-infra.js +595 -0
- package/dist/commands/worker/game-source-git.d.ts +126 -0
- package/dist/commands/worker/game-source-git.js +782 -0
- package/dist/commands/worker/generation.d.ts +94 -0
- package/dist/commands/worker/generation.js +1458 -0
- package/dist/commands/worker/runtime.d.ts +8 -10
- package/dist/commands/worker/runtime.js +51 -45
- package/dist/commands/worker.d.ts +79 -19
- package/dist/commands/worker.js +1796 -419
- package/dist/config.d.ts +2 -0
- package/dist/config.js +16 -3
- package/dist/environment.d.ts +0 -1
- package/dist/environment.js +0 -8
- package/dist/index.js +92 -13
- package/dist/workerAppProject.d.ts +1 -1
- package/dist/workerAppProject.js +15 -2
- package/node_modules/@playdrop/api-client/dist/client.d.ts +72 -25
- package/node_modules/@playdrop/api-client/dist/client.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/client.js +33 -0
- package/node_modules/@playdrop/api-client/dist/core/request.d.ts +1 -0
- package/node_modules/@playdrop/api-client/dist/core/request.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/core/request.js +17 -11
- package/node_modules/@playdrop/api-client/dist/domains/agent-tasks.d.ts +51 -6
- 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 +338 -41
- package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts +24 -1
- package/node_modules/@playdrop/api-client/dist/domains/ai.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/ai.js +20 -0
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts +13 -8
- package/node_modules/@playdrop/api-client/dist/domains/apps.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/apps.js +158 -90
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts +4 -0
- package/node_modules/@playdrop/api-client/dist/domains/assets.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/assets.js +27 -0
- package/node_modules/@playdrop/api-client/dist/domains/chat.d.ts +35 -3
- package/node_modules/@playdrop/api-client/dist/domains/chat.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/chat.js +89 -7
- package/node_modules/@playdrop/api-client/dist/domains/player-meta.d.ts +2 -1
- package/node_modules/@playdrop/api-client/dist/domains/player-meta.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/player-meta.js +9 -0
- package/node_modules/@playdrop/api-client/dist/domains/playtrade.d.ts +1 -2
- package/node_modules/@playdrop/api-client/dist/domains/playtrade.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/domains/playtrade.js +0 -11
- package/node_modules/@playdrop/api-client/dist/domains/social.d.ts +29 -0
- package/node_modules/@playdrop/api-client/dist/domains/social.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/domains/social.js +79 -0
- package/node_modules/@playdrop/api-client/dist/index.d.ts +80 -29
- package/node_modules/@playdrop/api-client/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/api-client/dist/index.js +217 -56
- package/node_modules/@playdrop/api-client/dist/runtime.d.ts +18 -0
- package/node_modules/@playdrop/api-client/dist/runtime.d.ts.map +1 -0
- package/node_modules/@playdrop/api-client/dist/runtime.js +54 -0
- package/node_modules/@playdrop/api-client/package.json +7 -0
- package/node_modules/@playdrop/config/client-meta.json +4 -4
- package/node_modules/@playdrop/config/dist/src/creator-plans.d.ts +11 -0
- package/node_modules/@playdrop/config/dist/src/creator-plans.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/creator-plans.js +13 -1
- package/node_modules/@playdrop/config/dist/src/deployment.d.ts +0 -1
- package/node_modules/@playdrop/config/dist/src/deployment.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/deployment.js +0 -8
- package/node_modules/@playdrop/config/dist/src/public-deployment.d.ts +0 -1
- package/node_modules/@playdrop/config/dist/src/public-deployment.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/public-deployment.js +0 -8
- package/node_modules/@playdrop/config/dist/src/runtime-service-origins.d.ts +1 -1
- package/node_modules/@playdrop/config/dist/src/runtime-service-origins.js +2 -2
- package/node_modules/@playdrop/config/dist/src/server/logging.d.ts.map +1 -1
- package/node_modules/@playdrop/config/dist/src/server/logging.js +31 -2
- package/node_modules/@playdrop/config/dist/test/creator-plans.test.js +10 -0
- package/node_modules/@playdrop/config/dist/test/deployment.test.js +0 -4
- package/node_modules/@playdrop/config/dist/test/runtime-service-origins.test.js +2 -0
- package/node_modules/@playdrop/config/dist/tsconfig.tsbuildinfo +1 -1
- package/node_modules/@playdrop/config/package.json +6 -0
- package/node_modules/@playdrop/game-source-git/dist/src/archive.d.ts +9 -0
- package/node_modules/@playdrop/game-source-git/dist/src/archive.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/archive.js +107 -0
- package/node_modules/@playdrop/game-source-git/dist/src/bundle-storage.d.ts +29 -0
- package/node_modules/@playdrop/game-source-git/dist/src/bundle-storage.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/bundle-storage.js +64 -0
- package/node_modules/@playdrop/game-source-git/dist/src/export.d.ts +8 -0
- package/node_modules/@playdrop/game-source-git/dist/src/export.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/export.js +25 -0
- package/node_modules/@playdrop/game-source-git/dist/src/git.d.ts +39 -0
- package/node_modules/@playdrop/game-source-git/dist/src/git.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/git.js +195 -0
- package/node_modules/@playdrop/game-source-git/dist/src/ignore.d.ts +6 -0
- package/node_modules/@playdrop/game-source-git/dist/src/ignore.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/ignore.js +51 -0
- package/node_modules/@playdrop/game-source-git/dist/src/index.d.ts +10 -0
- package/node_modules/@playdrop/game-source-git/dist/src/index.d.ts.map +1 -0
- package/node_modules/@playdrop/{boxel-core/dist/src/humanoid/r15 → game-source-git/dist/src}/index.js +9 -4
- package/node_modules/@playdrop/game-source-git/dist/src/lock.d.ts +17 -0
- package/node_modules/@playdrop/game-source-git/dist/src/lock.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/lock.js +72 -0
- package/node_modules/@playdrop/game-source-git/dist/src/materialize.d.ts +10 -0
- package/node_modules/@playdrop/game-source-git/dist/src/materialize.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/materialize.js +99 -0
- package/node_modules/@playdrop/game-source-git/dist/src/paths.d.ts +24 -0
- package/node_modules/@playdrop/game-source-git/dist/src/paths.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/paths.js +207 -0
- package/node_modules/@playdrop/game-source-git/dist/src/repository.d.ts +66 -0
- package/node_modules/@playdrop/game-source-git/dist/src/repository.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/src/repository.js +213 -0
- package/node_modules/@playdrop/game-source-git/dist/test/core.test.d.ts +2 -0
- package/node_modules/@playdrop/game-source-git/dist/test/core.test.d.ts.map +1 -0
- package/node_modules/@playdrop/game-source-git/dist/test/core.test.js +441 -0
- package/node_modules/@playdrop/game-source-git/dist/tsconfig.tsbuildinfo +1 -0
- package/node_modules/@playdrop/game-source-git/package.json +28 -0
- 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/agent-task-terminal.js +15 -9
- package/node_modules/@playdrop/types/dist/api.d.ts +728 -164
- package/node_modules/@playdrop/types/dist/api.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/api.js +60 -11
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts +2 -0
- package/node_modules/@playdrop/types/dist/asset-pack.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/asset.d.ts +22 -8
- package/node_modules/@playdrop/types/dist/asset.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/asset.js +26 -26
- package/node_modules/@playdrop/types/dist/chat.d.ts +107 -3
- package/node_modules/@playdrop/types/dist/chat.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/chat.js +33 -4
- package/node_modules/@playdrop/types/dist/index.d.ts +3 -0
- package/node_modules/@playdrop/types/dist/index.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/index.js +7 -1
- package/node_modules/@playdrop/types/dist/public-cache-tags.d.ts +11 -0
- package/node_modules/@playdrop/types/dist/public-cache-tags.d.ts.map +1 -0
- package/node_modules/@playdrop/types/dist/public-cache-tags.js +78 -0
- package/node_modules/@playdrop/types/dist/realtime.d.ts +3 -15
- package/node_modules/@playdrop/types/dist/realtime.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/social.d.ts +64 -0
- package/node_modules/@playdrop/types/dist/social.d.ts.map +1 -0
- package/node_modules/@playdrop/{boxel-three/dist/src/types.js → types/dist/social.js} +14 -2
- package/node_modules/@playdrop/types/dist/spritesheet.d.ts +51 -0
- package/node_modules/@playdrop/types/dist/spritesheet.d.ts.map +1 -0
- package/node_modules/@playdrop/types/dist/spritesheet.js +73 -0
- package/node_modules/@playdrop/types/dist/version.d.ts +86 -58
- package/node_modules/@playdrop/types/dist/version.d.ts.map +1 -1
- package/node_modules/@playdrop/types/dist/version.js +111 -0
- package/node_modules/@playdrop/types/package.json +14 -0
- package/node_modules/@playdrop/vox-three/dist/src/index.d.ts +1 -1
- package/node_modules/@playdrop/vox-three/dist/src/index.js +1 -1
- package/node_modules/@playdrop/vox-three/dist/src/index.js.map +1 -1
- package/node_modules/@playdrop/vox-three/dist/src/vox.d.ts +0 -3
- package/node_modules/@playdrop/vox-three/dist/src/vox.js +0 -110
- package/node_modules/@playdrop/vox-three/dist/src/vox.js.map +1 -1
- package/node_modules/@playdrop/vox-three/dist/test/vox.test.js +0 -18
- package/node_modules/@playdrop/vox-three/dist/test/vox.test.js.map +1 -1
- package/node_modules/@playdrop/vox-three/package.json +8 -4
- package/node_modules/@playwright/mcp/node_modules/fsevents/LICENSE +22 -0
- package/node_modules/@playwright/mcp/node_modules/fsevents/README.md +83 -0
- package/node_modules/@playwright/mcp/node_modules/fsevents/fsevents.d.ts +46 -0
- package/node_modules/@playwright/mcp/node_modules/fsevents/fsevents.js +82 -0
- package/node_modules/@playwright/mcp/node_modules/fsevents/fsevents.node +0 -0
- package/node_modules/@playwright/mcp/node_modules/fsevents/package.json +62 -0
- package/package.json +9 -11
- package/dist/assets/model-artifacts.d.ts +0 -8
- package/dist/assets/model-artifacts.js +0 -382
- package/dist/assets/model-worker.d.ts +0 -22
- package/dist/assets/model-worker.js +0 -123
- package/node_modules/@playdrop/ai-client/dist/index.d.ts +0 -441
- package/node_modules/@playdrop/ai-client/dist/index.d.ts.map +0 -1
- package/node_modules/@playdrop/ai-client/dist/index.js +0 -499
- package/node_modules/@playdrop/ai-client/package.json +0 -22
- package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.d.ts +0 -13
- package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.js +0 -141
- package/node_modules/@playdrop/boxel-core/dist/src/entity-cleaner.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.d.ts +0 -47
- package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.js +0 -313
- package/node_modules/@playdrop/boxel-core/dist/src/entity-utils.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/format-utils.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/format-utils.js +0 -36
- package/node_modules/@playdrop/boxel-core/dist/src/format-utils.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/geometry.d.ts +0 -23
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/geometry.js +0 -11
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/geometry.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/index.d.ts +0 -4
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/index.js +0 -21
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/common.d.ts +0 -4
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/common.js +0 -24
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/common.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/index.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.js +0 -387
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/textured-builder.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/types.d.ts +0 -6
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/types.js +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/types.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.js +0 -373
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r15/voxel-builder.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.d.ts +0 -12
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.js +0 -215
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/builder.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/index.d.ts +0 -4
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/index.js +0 -18
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.d.ts +0 -42
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.js +0 -145
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/scanner.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/artifacts.d.ts +0 -26
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/artifacts.js +0 -65
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/artifacts.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.d.ts +0 -33
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.js +0 -175
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/r6/textures/face-map.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/humanoid_r15.json +0 -1517
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/humanoid_r6.json +0 -61
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/index.d.ts +0 -10
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/index.js +0 -23
- package/node_modules/@playdrop/boxel-core/dist/src/humanoid/templates/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/index.d.ts +0 -19
- package/node_modules/@playdrop/boxel-core/dist/src/index.js +0 -36
- package/node_modules/@playdrop/boxel-core/dist/src/index.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/materials.d.ts +0 -26
- package/node_modules/@playdrop/boxel-core/dist/src/materials.js +0 -184
- package/node_modules/@playdrop/boxel-core/dist/src/materials.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.d.ts +0 -68
- package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.js +0 -488
- package/node_modules/@playdrop/boxel-core/dist/src/palette_tools.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/serialization.d.ts +0 -4
- package/node_modules/@playdrop/boxel-core/dist/src/serialization.js +0 -380
- package/node_modules/@playdrop/boxel-core/dist/src/serialization.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/textures.d.ts +0 -29
- package/node_modules/@playdrop/boxel-core/dist/src/textures.js +0 -208
- package/node_modules/@playdrop/boxel-core/dist/src/textures.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.d.ts +0 -9
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.js +0 -312
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/infer-face.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.d.ts +0 -9
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.js +0 -154
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/layer-mode.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.d.ts +0 -2
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.js +0 -121
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/merge-overlay.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.d.ts +0 -20
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.js +0 -389
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/textured-boxes/slice.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.d.ts +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.js +0 -206
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/upscale.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.d.ts +0 -12
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.js +0 -81
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/slice.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.d.ts +0 -12
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.js +0 -318
- package/node_modules/@playdrop/boxel-core/dist/src/transforms/voxels/textured-to-voxel.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/types.d.ts +0 -168
- package/node_modules/@playdrop/boxel-core/dist/src/types.js +0 -3
- package/node_modules/@playdrop/boxel-core/dist/src/types.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/validation.d.ts +0 -24
- package/node_modules/@playdrop/boxel-core/dist/src/validation.js +0 -620
- package/node_modules/@playdrop/boxel-core/dist/src/validation.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.d.ts +0 -11
- package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.js +0 -135
- package/node_modules/@playdrop/boxel-core/dist/src/voxels/greedy-mesher.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/dist/src/voxels.d.ts +0 -23
- package/node_modules/@playdrop/boxel-core/dist/src/voxels.js +0 -52
- package/node_modules/@playdrop/boxel-core/dist/src/voxels.js.map +0 -1
- package/node_modules/@playdrop/boxel-core/package.json +0 -19
- package/node_modules/@playdrop/boxel-three/dist/src/animations.d.ts +0 -4
- package/node_modules/@playdrop/boxel-three/dist/src/animations.js +0 -92
- package/node_modules/@playdrop/boxel-three/dist/src/builders.d.ts +0 -8
- package/node_modules/@playdrop/boxel-three/dist/src/builders.js +0 -363
- package/node_modules/@playdrop/boxel-three/dist/src/context.d.ts +0 -24
- package/node_modules/@playdrop/boxel-three/dist/src/context.js +0 -58
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/glb.d.ts +0 -100
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/glb.js +0 -927
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/image.d.ts +0 -18
- package/node_modules/@playdrop/boxel-three/dist/src/exporters/image.js +0 -294
- package/node_modules/@playdrop/boxel-three/dist/src/index.d.ts +0 -17
- package/node_modules/@playdrop/boxel-three/dist/src/index.js +0 -64
- package/node_modules/@playdrop/boxel-three/dist/src/instantiate.d.ts +0 -40
- package/node_modules/@playdrop/boxel-three/dist/src/instantiate.js +0 -96
- package/node_modules/@playdrop/boxel-three/dist/src/nodes.d.ts +0 -8
- package/node_modules/@playdrop/boxel-three/dist/src/nodes.js +0 -88
- package/node_modules/@playdrop/boxel-three/dist/src/overlays.d.ts +0 -7
- package/node_modules/@playdrop/boxel-three/dist/src/overlays.js +0 -123
- package/node_modules/@playdrop/boxel-three/dist/src/primitives.d.ts +0 -4
- package/node_modules/@playdrop/boxel-three/dist/src/primitives.js +0 -48
- package/node_modules/@playdrop/boxel-three/dist/src/scene.d.ts +0 -3
- package/node_modules/@playdrop/boxel-three/dist/src/scene.js +0 -168
- package/node_modules/@playdrop/boxel-three/dist/src/skinned-mesh.d.ts +0 -29
- package/node_modules/@playdrop/boxel-three/dist/src/skinned-mesh.js +0 -623
- package/node_modules/@playdrop/boxel-three/dist/src/texture-atlas.d.ts +0 -13
- package/node_modules/@playdrop/boxel-three/dist/src/texture-atlas.js +0 -133
- package/node_modules/@playdrop/boxel-three/dist/src/textures.d.ts +0 -17
- package/node_modules/@playdrop/boxel-three/dist/src/textures.js +0 -216
- package/node_modules/@playdrop/boxel-three/dist/src/types.d.ts +0 -112
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/faces.d.ts +0 -28
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/faces.js +0 -344
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/mesher.d.ts +0 -24
- package/node_modules/@playdrop/boxel-three/dist/src/voxels/mesher.js +0 -113
- package/node_modules/@playdrop/boxel-three/dist/test/export-image.playwright.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/export-image.playwright.test.js +0 -137
- package/node_modules/@playdrop/boxel-three/dist/test/fixtures/render-worker.d.ts +0 -20
- package/node_modules/@playdrop/boxel-three/dist/test/fixtures/render-worker.js +0 -85
- package/node_modules/@playdrop/boxel-three/dist/test/glb-skinned.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/glb-skinned.test.js +0 -104
- package/node_modules/@playdrop/boxel-three/dist/test/index.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/index.test.js +0 -30
- package/node_modules/@playdrop/boxel-three/dist/test/instantiate.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/instantiate.test.js +0 -88
- package/node_modules/@playdrop/boxel-three/dist/test/overlays.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/overlays.test.js +0 -42
- package/node_modules/@playdrop/boxel-three/dist/test/scene-filter.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/scene-filter.test.js +0 -73
- package/node_modules/@playdrop/boxel-three/dist/test/scene-smoke.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/scene-smoke.test.js +0 -85
- package/node_modules/@playdrop/boxel-three/dist/test/skinned-mesh.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/skinned-mesh.test.js +0 -73
- package/node_modules/@playdrop/boxel-three/dist/test/textured-overlay.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/textured-overlay.test.js +0 -136
- package/node_modules/@playdrop/boxel-three/dist/test/voxels.test.d.ts +0 -1
- package/node_modules/@playdrop/boxel-three/dist/test/voxels.test.js +0 -42
- package/node_modules/@playdrop/boxel-three/package.json +0 -28
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.syncAuthoritativeListing = syncAuthoritativeListing;
|
|
7
|
+
exports.initializeGameSourceRepository = initializeGameSourceRepository;
|
|
8
|
+
exports.fastForwardTaskBranch = fastForwardTaskBranch;
|
|
9
|
+
exports.importAdditionalSourceVersions = importAdditionalSourceVersions;
|
|
10
|
+
const promises_1 = require("node:fs/promises");
|
|
11
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
12
|
+
const archive_js_1 = require("./archive.js");
|
|
13
|
+
const git_js_1 = require("./git.js");
|
|
14
|
+
const ignore_js_1 = require("./ignore.js");
|
|
15
|
+
const lock_js_1 = require("./lock.js");
|
|
16
|
+
const paths_js_1 = require("./paths.js");
|
|
17
|
+
function updateCatalogueListing(content, listing) {
|
|
18
|
+
let root;
|
|
19
|
+
try {
|
|
20
|
+
root = JSON.parse(content.toString("utf8"));
|
|
21
|
+
}
|
|
22
|
+
catch {
|
|
23
|
+
throw new Error("game_source_catalogue_invalid");
|
|
24
|
+
}
|
|
25
|
+
if (!root || typeof root !== "object" || Array.isArray(root))
|
|
26
|
+
throw new Error("game_source_catalogue_invalid");
|
|
27
|
+
const record = root;
|
|
28
|
+
const app = Array.isArray(record["apps"])
|
|
29
|
+
? record["apps"].find((entry) => Boolean(entry) && typeof entry === "object" && !Array.isArray(entry))
|
|
30
|
+
: record;
|
|
31
|
+
if (!app)
|
|
32
|
+
throw new Error("game_source_catalogue_app_missing");
|
|
33
|
+
app["version"] = listing.version;
|
|
34
|
+
const assignOptional = (key, value) => {
|
|
35
|
+
if (value === null)
|
|
36
|
+
delete app[key];
|
|
37
|
+
else
|
|
38
|
+
app[key] = value;
|
|
39
|
+
};
|
|
40
|
+
assignOptional("displayName", listing.displayName);
|
|
41
|
+
assignOptional("subtitle", listing.subtitle);
|
|
42
|
+
assignOptional("description", listing.description);
|
|
43
|
+
const media = {};
|
|
44
|
+
const assignPath = (key, value) => {
|
|
45
|
+
if (value)
|
|
46
|
+
media[key] = value;
|
|
47
|
+
};
|
|
48
|
+
assignPath("icon", listing.iconPath);
|
|
49
|
+
assignPath("heroPortrait", listing.heroPortraitPath);
|
|
50
|
+
assignPath("heroLandscape", listing.heroLandscapePath);
|
|
51
|
+
assignPath("socialLandscape", listing.socialLandscapePath);
|
|
52
|
+
if (listing.screenshotsPortrait.length > 0)
|
|
53
|
+
media["screenshotsPortrait"] = [...listing.screenshotsPortrait];
|
|
54
|
+
if (listing.screenshotsLandscape.length > 0)
|
|
55
|
+
media["screenshotsLandscape"] = [...listing.screenshotsLandscape];
|
|
56
|
+
if (listing.videosPortrait.length > 0)
|
|
57
|
+
media["videosPortrait"] = [...listing.videosPortrait];
|
|
58
|
+
if (listing.videosLandscape.length > 0)
|
|
59
|
+
media["videosLandscape"] = [...listing.videosLandscape];
|
|
60
|
+
app["listing"] = media;
|
|
61
|
+
return Buffer.from(`${JSON.stringify(root, null, 2)}\n`, "utf8");
|
|
62
|
+
}
|
|
63
|
+
async function syncAuthoritativeListing(input) {
|
|
64
|
+
const runner = input.runner ?? (0, git_js_1.createGitRunner)();
|
|
65
|
+
const cataloguePath = node_path_1.default.join(input.repoPath, "catalogue.json");
|
|
66
|
+
const lockPath = node_path_1.default.join(input.repoPath, paths_js_1.GAME_SOURCE_LOCK_PATH);
|
|
67
|
+
const previousLock = (0, lock_js_1.parseGameSourceLock)(await (0, promises_1.readFile)(lockPath));
|
|
68
|
+
const listingLock = (0, lock_js_1.createGameSourceLock)(input.listing.files);
|
|
69
|
+
for (const [filePath, entry] of Object.entries(listingLock.files)) {
|
|
70
|
+
const content = input.listing.files.get(filePath);
|
|
71
|
+
if (!content)
|
|
72
|
+
throw new Error(`game_source_material_missing:${filePath}`);
|
|
73
|
+
await input.putImmutableFile(entry.key, content, entry.sha256);
|
|
74
|
+
}
|
|
75
|
+
const files = Object.fromEntries(Object.entries(previousLock.files).filter(([filePath]) => !filePath.startsWith("listing/")));
|
|
76
|
+
Object.assign(files, listingLock.files);
|
|
77
|
+
await (0, promises_1.rm)(node_path_1.default.join(input.repoPath, "listing"), { recursive: true, force: true });
|
|
78
|
+
await (0, promises_1.writeFile)(lockPath, (0, lock_js_1.serializeGameSourceLock)({ version: 1, files }));
|
|
79
|
+
await (0, promises_1.writeFile)(cataloguePath, updateCatalogueListing(await (0, promises_1.readFile)(cataloguePath), input.listing));
|
|
80
|
+
await runner.run(["add", "-u", "--", "."], input.repoPath);
|
|
81
|
+
await runner.run(["add", "--force", "--", "catalogue.json", paths_js_1.GAME_SOURCE_LOCK_PATH], input.repoPath);
|
|
82
|
+
const status = (await runner.run(["status", "--porcelain"], input.repoPath)).toString("utf8").trim();
|
|
83
|
+
if (!status)
|
|
84
|
+
return (await runner.run(["rev-parse", "HEAD"], input.repoPath)).toString("utf8").trim();
|
|
85
|
+
await runner.run([
|
|
86
|
+
"-c",
|
|
87
|
+
"user.name=Playdrop Game Source",
|
|
88
|
+
"-c",
|
|
89
|
+
"user.email=game-source@playdrop.invalid",
|
|
90
|
+
"commit",
|
|
91
|
+
...(input.listing.updatedAt ? [`--date=${input.listing.updatedAt.toISOString()}`] : []),
|
|
92
|
+
"-m",
|
|
93
|
+
"Sync authoritative listing",
|
|
94
|
+
], input.repoPath);
|
|
95
|
+
return (await runner.run(["rev-parse", "HEAD"], input.repoPath)).toString("utf8").trim();
|
|
96
|
+
}
|
|
97
|
+
function compareVersions(left, right) {
|
|
98
|
+
return (left.version.major - right.version.major ||
|
|
99
|
+
left.version.minor - right.version.minor ||
|
|
100
|
+
left.version.patch - right.version.patch ||
|
|
101
|
+
left.id - right.id);
|
|
102
|
+
}
|
|
103
|
+
async function clearWorkingTree(repoPath) {
|
|
104
|
+
for (const entry of await (0, promises_1.readdir)(repoPath)) {
|
|
105
|
+
if (entry === ".git" || entry === "tasks")
|
|
106
|
+
continue;
|
|
107
|
+
await (0, promises_1.rm)(node_path_1.default.join(repoPath, entry), { recursive: true, force: true });
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
async function writeRepoFile(repoPath, filePath, content) {
|
|
111
|
+
const normalized = (0, paths_js_1.normalizeSourcePath)(filePath);
|
|
112
|
+
const destination = node_path_1.default.join(repoPath, normalized);
|
|
113
|
+
await (0, promises_1.mkdir)(node_path_1.default.dirname(destination), { recursive: true });
|
|
114
|
+
await (0, promises_1.writeFile)(destination, content);
|
|
115
|
+
}
|
|
116
|
+
async function commitSnapshot(repoPath, message, createdAt, runner) {
|
|
117
|
+
await runner.run(["add", "--all", "--force", "--", "."], repoPath);
|
|
118
|
+
await runner.run([
|
|
119
|
+
"-c",
|
|
120
|
+
"user.name=Playdrop Game Source",
|
|
121
|
+
"-c",
|
|
122
|
+
"user.email=game-source@playdrop.invalid",
|
|
123
|
+
"commit",
|
|
124
|
+
"--allow-empty",
|
|
125
|
+
...(createdAt ? [`--date=${createdAt.toISOString()}`] : []),
|
|
126
|
+
"-m",
|
|
127
|
+
message,
|
|
128
|
+
], repoPath);
|
|
129
|
+
return (await runner.run(["rev-parse", "HEAD"], repoPath)).toString("utf8").trim();
|
|
130
|
+
}
|
|
131
|
+
async function initializeGameSourceRepository(input) {
|
|
132
|
+
if (input.versions.length === 0)
|
|
133
|
+
throw new Error("game_source_versions_required");
|
|
134
|
+
const runner = input.runner ?? (0, git_js_1.createGitRunner)();
|
|
135
|
+
await (0, promises_1.mkdir)(input.repoPath, { recursive: true });
|
|
136
|
+
await runner.run(["init", "-b", "main"], input.repoPath);
|
|
137
|
+
const imported = [];
|
|
138
|
+
for (const snapshot of [...input.versions].sort(compareVersions)) {
|
|
139
|
+
await clearWorkingTree(input.repoPath);
|
|
140
|
+
const split = await (0, archive_js_1.splitSourceArchive)(snapshot.sourceZip);
|
|
141
|
+
const lock = (0, lock_js_1.createGameSourceLock)(split.materialFiles);
|
|
142
|
+
for (const [filePath, entry] of Object.entries(lock.files)) {
|
|
143
|
+
const content = split.materialFiles.get(filePath);
|
|
144
|
+
if (!content)
|
|
145
|
+
throw new Error(`game_source_material_missing:${filePath}`);
|
|
146
|
+
await input.putImmutableFile(entry.key, content, entry.sha256);
|
|
147
|
+
}
|
|
148
|
+
for (const [filePath, content] of split.gitFiles)
|
|
149
|
+
await writeRepoFile(input.repoPath, filePath, content);
|
|
150
|
+
await writeRepoFile(input.repoPath, paths_js_1.GAME_SOURCE_LOCK_PATH, (0, lock_js_1.serializeGameSourceLock)(lock));
|
|
151
|
+
let existingGitignore = "";
|
|
152
|
+
try {
|
|
153
|
+
existingGitignore = await (0, promises_1.readFile)(node_path_1.default.join(input.repoPath, ".gitignore"), "utf8");
|
|
154
|
+
}
|
|
155
|
+
catch (error) {
|
|
156
|
+
if (error.code !== "ENOENT")
|
|
157
|
+
throw error;
|
|
158
|
+
}
|
|
159
|
+
await writeRepoFile(input.repoPath, ".gitignore", (0, ignore_js_1.updateManagedGitignore)(existingGitignore));
|
|
160
|
+
if (snapshot.taskId && snapshot.taskSummary?.trim()) {
|
|
161
|
+
await writeRepoFile(input.repoPath, `tasks/${snapshot.taskId}.md`, `${snapshot.taskSummary.trim()}\n`);
|
|
162
|
+
}
|
|
163
|
+
const commitSha = await commitSnapshot(input.repoPath, `Import v${snapshot.version.major}.${snapshot.version.minor}.${snapshot.version.patch}`, snapshot.createdAt, runner);
|
|
164
|
+
await runner.run(["tag", (0, git_js_1.versionTagRef)(snapshot.version).slice("refs/tags/".length), commitSha], input.repoPath);
|
|
165
|
+
imported.push({ id: snapshot.id, version: snapshot.version, commitSha });
|
|
166
|
+
}
|
|
167
|
+
const headSha = (await runner.run(["rev-parse", "HEAD"], input.repoPath)).toString("utf8").trim();
|
|
168
|
+
return { headSha, versions: imported };
|
|
169
|
+
}
|
|
170
|
+
async function fastForwardTaskBranch(input) {
|
|
171
|
+
const runner = input.runner ?? (0, git_js_1.createGitRunner)();
|
|
172
|
+
const currentHead = (await runner.run(["rev-parse", "refs/heads/main"], input.repoPath)).toString("utf8").trim();
|
|
173
|
+
if (currentHead !== input.expectedHeadSha)
|
|
174
|
+
throw new Error("game_source_base_head_mismatch");
|
|
175
|
+
const taskHead = (await runner.run(["rev-parse", input.branchRef], input.repoPath)).toString("utf8").trim();
|
|
176
|
+
await runner.run(["merge-base", "--is-ancestor", currentHead, taskHead], input.repoPath);
|
|
177
|
+
await runner.run(["update-ref", "refs/heads/main", taskHead, currentHead], input.repoPath);
|
|
178
|
+
return taskHead;
|
|
179
|
+
}
|
|
180
|
+
async function importAdditionalSourceVersions(input) {
|
|
181
|
+
const runner = input.runner ?? (0, git_js_1.createGitRunner)();
|
|
182
|
+
const imported = [];
|
|
183
|
+
for (const snapshot of input.versions) {
|
|
184
|
+
await clearWorkingTree(input.repoPath);
|
|
185
|
+
const split = await (0, archive_js_1.splitSourceArchive)(snapshot.sourceZip);
|
|
186
|
+
const lock = (0, lock_js_1.createGameSourceLock)(split.materialFiles);
|
|
187
|
+
for (const [filePath, entry] of Object.entries(lock.files)) {
|
|
188
|
+
const content = split.materialFiles.get(filePath);
|
|
189
|
+
if (!content)
|
|
190
|
+
throw new Error(`game_source_material_missing:${filePath}`);
|
|
191
|
+
await input.putImmutableFile(entry.key, content, entry.sha256);
|
|
192
|
+
}
|
|
193
|
+
for (const [filePath, content] of split.gitFiles)
|
|
194
|
+
await writeRepoFile(input.repoPath, filePath, content);
|
|
195
|
+
await writeRepoFile(input.repoPath, paths_js_1.GAME_SOURCE_LOCK_PATH, (0, lock_js_1.serializeGameSourceLock)(lock));
|
|
196
|
+
let existingGitignore = "";
|
|
197
|
+
try {
|
|
198
|
+
existingGitignore = await (0, promises_1.readFile)(node_path_1.default.join(input.repoPath, ".gitignore"), "utf8");
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
if (error.code !== "ENOENT")
|
|
202
|
+
throw error;
|
|
203
|
+
}
|
|
204
|
+
await writeRepoFile(input.repoPath, ".gitignore", (0, ignore_js_1.updateManagedGitignore)(existingGitignore));
|
|
205
|
+
if (snapshot.taskId && snapshot.taskSummary?.trim()) {
|
|
206
|
+
await writeRepoFile(input.repoPath, `tasks/${snapshot.taskId}.md`, `${snapshot.taskSummary.trim()}\n`);
|
|
207
|
+
}
|
|
208
|
+
const commitSha = await commitSnapshot(input.repoPath, `Import v${snapshot.version.major}.${snapshot.version.minor}.${snapshot.version.patch}`, snapshot.createdAt, runner);
|
|
209
|
+
await runner.run(["tag", (0, git_js_1.versionTagRef)(snapshot.version).slice("refs/tags/".length), commitSha], input.repoPath);
|
|
210
|
+
imported.push({ id: snapshot.id, version: snapshot.version, commitSha });
|
|
211
|
+
}
|
|
212
|
+
return imported;
|
|
213
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"core.test.d.ts","sourceRoot":"","sources":["../../test/core.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,441 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const strict_1 = __importDefault(require("node:assert/strict"));
|
|
7
|
+
const node_child_process_1 = require("node:child_process");
|
|
8
|
+
const promises_1 = require("node:fs/promises");
|
|
9
|
+
const node_os_1 = __importDefault(require("node:os"));
|
|
10
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
11
|
+
const node_test_1 = __importDefault(require("node:test"));
|
|
12
|
+
const node_util_1 = require("node:util");
|
|
13
|
+
const jszip_1 = __importDefault(require("jszip"));
|
|
14
|
+
const index_js_1 = require("../src/index.js");
|
|
15
|
+
const execFileAsync = (0, node_util_1.promisify)(node_child_process_1.execFile);
|
|
16
|
+
async function git(cwd, ...args) {
|
|
17
|
+
const result = await execFileAsync("git", args, {
|
|
18
|
+
cwd,
|
|
19
|
+
encoding: "utf8",
|
|
20
|
+
env: {
|
|
21
|
+
...process.env,
|
|
22
|
+
GIT_AUTHOR_NAME: "Playdrop Test",
|
|
23
|
+
GIT_AUTHOR_EMAIL: "test@playdrop.invalid",
|
|
24
|
+
GIT_COMMITTER_NAME: "Playdrop Test",
|
|
25
|
+
GIT_COMMITTER_EMAIL: "test@playdrop.invalid",
|
|
26
|
+
},
|
|
27
|
+
});
|
|
28
|
+
return result.stdout.trim();
|
|
29
|
+
}
|
|
30
|
+
async function createRepo() {
|
|
31
|
+
const directory = await (0, promises_1.mkdtemp)(node_path_1.default.join(node_os_1.default.tmpdir(), "playdrop-game-source-git-"));
|
|
32
|
+
await git(directory, "init", "-b", "main");
|
|
33
|
+
await (0, promises_1.writeFile)(node_path_1.default.join(directory, "index.html"), "<main>game</main>\n");
|
|
34
|
+
await git(directory, "add", "--force", "index.html");
|
|
35
|
+
await git(directory, "commit", "-m", "Initial game");
|
|
36
|
+
const head = await git(directory, "rev-parse", "HEAD");
|
|
37
|
+
return { directory, head };
|
|
38
|
+
}
|
|
39
|
+
(0, node_test_1.default)("private object keys and file classification are canonical", () => {
|
|
40
|
+
strict_1.default.deepEqual((0, index_js_1.buildGameSourceRepoKeys)(42), {
|
|
41
|
+
current: "game-source/repos/42/current.bundle",
|
|
42
|
+
previous: "game-source/repos/42/previous.bundle",
|
|
43
|
+
});
|
|
44
|
+
const digest = (0, index_js_1.sha256)(Buffer.from("asset"));
|
|
45
|
+
strict_1.default.equal((0, index_js_1.buildGameSourceCandidateBundleKey)(42, 91, digest), `game-source/repos/42/candidates/task-91/${digest}.bundle`);
|
|
46
|
+
strict_1.default.equal((0, index_js_1.buildImmutableFileKey)(digest), `game-source/files/sha256/${digest.slice(0, 2)}/${digest}`);
|
|
47
|
+
strict_1.default.equal((0, index_js_1.buildTranscriptObjectKey)(19, 2), "agent-task-transcripts/19/attempt-2.jsonl");
|
|
48
|
+
strict_1.default.equal((0, index_js_1.classifyGameSourceFile)("src/game.ts", Buffer.from("export {};\n")), "git");
|
|
49
|
+
strict_1.default.equal((0, index_js_1.classifyGameSourceFile)("ignored.ts", Buffer.from("export {};\n")), "git");
|
|
50
|
+
strict_1.default.equal((0, index_js_1.classifyGameSourceFile)("assets/ship.png", Buffer.from("png")), "material");
|
|
51
|
+
strict_1.default.equal((0, index_js_1.classifyGameSourceFile)("vendor/sdk.tgz", Buffer.from("archive")), "material");
|
|
52
|
+
strict_1.default.equal((0, index_js_1.classifyGameSourceFile)("mystery.dat", Buffer.from([0, 1, 2])), "material");
|
|
53
|
+
strict_1.default.equal((0, index_js_1.classifyGameSourceFile)("transcripts/a.jsonl", Buffer.from("{}\n")), "transcript");
|
|
54
|
+
strict_1.default.equal((0, index_js_1.classifyGameSourceFile)("node_modules/x.js", Buffer.from("x")), "excluded");
|
|
55
|
+
strict_1.default.equal((0, index_js_1.classifyGameSourceFile)("remix-source/original/index.html", Buffer.from("old")), "excluded");
|
|
56
|
+
strict_1.default.equal((0, index_js_1.classifyGameSourceFile)(".scratch/cat.png", Buffer.from("temporary")), "excluded");
|
|
57
|
+
strict_1.default.equal((0, index_js_1.classifyGameSourceFile)(".art-brief.md", Buffer.from("internal art prompt")), "excluded");
|
|
58
|
+
strict_1.default.equal((0, index_js_1.classifyGameSourceFile)(".art-manifest.txt", Buffer.from("internal art output")), "excluded");
|
|
59
|
+
strict_1.default.equal((0, index_js_1.classifyGameSourceFile)(".art-output/manifest.txt", Buffer.from("internal art output")), "excluded");
|
|
60
|
+
strict_1.default.equal((0, index_js_1.classifyGameSourceFile)(".art-output/preview.png", Buffer.from("internal art preview")), "excluded");
|
|
61
|
+
strict_1.default.equal((0, index_js_1.classifyGameSourceFile)(".playdrop.json", Buffer.from("{}")), "excluded");
|
|
62
|
+
strict_1.default.equal((0, index_js_1.classifyGameSourceFile)("evidence/playtest.png", Buffer.from("proof")), "excluded");
|
|
63
|
+
strict_1.default.equal((0, index_js_1.classifyGameSourceFile)("platform-feedback.md", Buffer.from("internal")), "excluded");
|
|
64
|
+
strict_1.default.equal((0, index_js_1.classifyGameSourceFile)("next-steps.json", Buffer.from("{}")), "excluded");
|
|
65
|
+
strict_1.default.equal((0, index_js_1.classifyGameSourceFile)("player-feedback.md", Buffer.from("feedback")), "excluded");
|
|
66
|
+
});
|
|
67
|
+
(0, node_test_1.default)("lock serialization is deterministic and validates immutable keys", () => {
|
|
68
|
+
const files = new Map([
|
|
69
|
+
["listing/hero.png", Buffer.from("hero")],
|
|
70
|
+
["assets/ship.glb", Buffer.from("ship")],
|
|
71
|
+
]);
|
|
72
|
+
const lock = (0, index_js_1.createGameSourceLock)(files);
|
|
73
|
+
const serialized = (0, index_js_1.serializeGameSourceLock)(lock);
|
|
74
|
+
strict_1.default.deepEqual((0, index_js_1.parseGameSourceLock)(serialized), lock);
|
|
75
|
+
strict_1.default.ok(serialized.indexOf("assets/ship.glb") < serialized.indexOf("listing/hero.png"));
|
|
76
|
+
const tampered = JSON.parse(serialized.toString("utf8"));
|
|
77
|
+
tampered.files["assets/ship.glb"].key = "wrong";
|
|
78
|
+
strict_1.default.throws(() => (0, index_js_1.parseGameSourceLock)(JSON.stringify(tampered)), /invalid_game_source_lock_key/);
|
|
79
|
+
});
|
|
80
|
+
(0, node_test_1.default)("managed gitignore block preserves creator rules and replaces itself", () => {
|
|
81
|
+
const first = (0, index_js_1.updateManagedGitignore)("custom.tmp\n");
|
|
82
|
+
strict_1.default.match(first, /^custom\.tmp\n\n# >>> PLAYDROP/);
|
|
83
|
+
strict_1.default.match(first, /^\.playdrop\.json$/m);
|
|
84
|
+
strict_1.default.match(first, /^\.art-\*$/m);
|
|
85
|
+
strict_1.default.match(first, /^\.playdrop\/$/m);
|
|
86
|
+
strict_1.default.match(first, /^evidence\/$/m);
|
|
87
|
+
strict_1.default.match(first, /^\*\.tgz$/m);
|
|
88
|
+
const second = (0, index_js_1.updateManagedGitignore)(first.replace("assets/", "old-assets/"));
|
|
89
|
+
strict_1.default.equal(second, first);
|
|
90
|
+
});
|
|
91
|
+
(0, node_test_1.default)("source archive split ignores creator rules and deterministic zip round-trips", async () => {
|
|
92
|
+
const input = new jszip_1.default();
|
|
93
|
+
input.file("src/game.ts", "export const game = true;\n");
|
|
94
|
+
input.file("assets/sound.mp3", Buffer.from("audio"));
|
|
95
|
+
input.file("transcripts/live.jsonl", "{}\n");
|
|
96
|
+
input.file("PLAYDROP_TASK.md", "task");
|
|
97
|
+
const source = await input.generateAsync({ type: "nodebuffer" });
|
|
98
|
+
const split = await (0, index_js_1.splitSourceArchive)(source);
|
|
99
|
+
strict_1.default.deepEqual([...split.gitFiles.keys()], ["src/game.ts"]);
|
|
100
|
+
strict_1.default.deepEqual([...split.materialFiles.keys()], ["assets/sound.mp3"]);
|
|
101
|
+
strict_1.default.deepEqual([...split.transcriptFiles.keys()], ["transcripts/live.jsonl"]);
|
|
102
|
+
strict_1.default.deepEqual(split.excludedPaths, ["PLAYDROP_TASK.md"]);
|
|
103
|
+
const deterministic = (0, index_js_1.createDeterministicSourceZip)(new Map([
|
|
104
|
+
["z.txt", Buffer.from("z")],
|
|
105
|
+
["a.txt", Buffer.from("a")],
|
|
106
|
+
]));
|
|
107
|
+
const restored = await jszip_1.default.loadAsync(deterministic);
|
|
108
|
+
strict_1.default.equal(await restored.file("a.txt")?.async("string"), "a");
|
|
109
|
+
strict_1.default.equal(await restored.file("z.txt")?.async("string"), "z");
|
|
110
|
+
strict_1.default.deepEqual(deterministic, (0, index_js_1.createDeterministicSourceZip)(new Map([
|
|
111
|
+
["a.txt", Buffer.from("a")],
|
|
112
|
+
["z.txt", Buffer.from("z")],
|
|
113
|
+
])));
|
|
114
|
+
});
|
|
115
|
+
(0, node_test_1.default)("canonical bundle contains exactly main and authoritative version tags", async (context) => {
|
|
116
|
+
const repo = await createRepo();
|
|
117
|
+
context.after(async () => (0, promises_1.rm)(repo.directory, { recursive: true, force: true }));
|
|
118
|
+
await git(repo.directory, "tag", "v1.0.0", repo.head);
|
|
119
|
+
const expected = {
|
|
120
|
+
headSha: repo.head,
|
|
121
|
+
versions: [{ version: { major: 1, minor: 0, patch: 0 }, commitSha: repo.head }],
|
|
122
|
+
};
|
|
123
|
+
strict_1.default.deepEqual((0, index_js_1.deriveCanonicalRefs)(expected.versions), ["refs/heads/main", "refs/tags/v1.0.0"]);
|
|
124
|
+
await (0, index_js_1.validateCanonicalRefTargets)(repo.directory, expected);
|
|
125
|
+
const bundlePath = node_path_1.default.join(repo.directory, "canonical.bundle");
|
|
126
|
+
await (0, index_js_1.createCanonicalBundle)({ repoPath: repo.directory, outputPath: bundlePath, expected });
|
|
127
|
+
await (0, index_js_1.validateBundleHeads)(bundlePath, expected);
|
|
128
|
+
strict_1.default.ok((await (0, promises_1.readFile)(bundlePath)).length > 0);
|
|
129
|
+
});
|
|
130
|
+
(0, node_test_1.default)("bundle intake permits only stale semantic tags needed for deletion self-heal", async (context) => {
|
|
131
|
+
const repo = await createRepo();
|
|
132
|
+
context.after(async () => (0, promises_1.rm)(repo.directory, { recursive: true, force: true }));
|
|
133
|
+
await git(repo.directory, "tag", "v1.0.0", repo.head);
|
|
134
|
+
await git(repo.directory, "tag", "v1.0.1", repo.head);
|
|
135
|
+
const expected = {
|
|
136
|
+
headSha: repo.head,
|
|
137
|
+
versions: [{ version: { major: 1, minor: 0, patch: 0 }, commitSha: repo.head }],
|
|
138
|
+
};
|
|
139
|
+
const staleTagBundle = node_path_1.default.join(repo.directory, "stale-tag.bundle");
|
|
140
|
+
await git(repo.directory, "bundle", "create", "--version=2", staleTagBundle, "refs/heads/main", "refs/tags/v1.0.0", "refs/tags/v1.0.1");
|
|
141
|
+
await (0, index_js_1.validateBundleHeadsForSelfHeal)(staleTagBundle, expected);
|
|
142
|
+
await strict_1.default.rejects(() => (0, index_js_1.validateBundleHeads)(staleTagBundle, expected), /game_source_bundle_refs_mismatch/);
|
|
143
|
+
await git(repo.directory, "branch", "unexpected", repo.head);
|
|
144
|
+
const unexpectedBranchBundle = node_path_1.default.join(repo.directory, "unexpected-branch.bundle");
|
|
145
|
+
await git(repo.directory, "bundle", "create", "--version=2", unexpectedBranchBundle, "refs/heads/main", "refs/heads/unexpected", "refs/tags/v1.0.0");
|
|
146
|
+
await strict_1.default.rejects(() => (0, index_js_1.validateBundleHeadsForSelfHeal)(unexpectedBranchBundle, expected), /game_source_bundle_unexpected_ref/);
|
|
147
|
+
});
|
|
148
|
+
(0, node_test_1.default)("bundle command order is pinned for Apple Git", async () => {
|
|
149
|
+
const calls = [];
|
|
150
|
+
const head = "a".repeat(40);
|
|
151
|
+
const runner = {
|
|
152
|
+
async run(args) {
|
|
153
|
+
calls.push([...args]);
|
|
154
|
+
if (args[0] === "show-ref")
|
|
155
|
+
return Buffer.from(`${head} refs/heads/main\n`);
|
|
156
|
+
if (args[0] === "bundle" && args[1] === "list-heads")
|
|
157
|
+
return Buffer.from(`${head} refs/heads/main\n`);
|
|
158
|
+
return Buffer.alloc(0);
|
|
159
|
+
},
|
|
160
|
+
};
|
|
161
|
+
await (0, index_js_1.createCanonicalBundle)({ repoPath: "/repo", outputPath: "/tmp/current.bundle", expected: { headSha: head, versions: [] } }, runner);
|
|
162
|
+
strict_1.default.deepEqual(calls[1], [
|
|
163
|
+
"bundle",
|
|
164
|
+
"create",
|
|
165
|
+
"--version=2",
|
|
166
|
+
"/tmp/current.bundle",
|
|
167
|
+
"refs/heads/main",
|
|
168
|
+
]);
|
|
169
|
+
});
|
|
170
|
+
(0, node_test_1.default)("outgoing object scan rejects media, generated files, oversized blobs, and gitlinks", async (context) => {
|
|
171
|
+
const mediaRepo = await createRepo();
|
|
172
|
+
context.after(async () => (0, promises_1.rm)(mediaRepo.directory, { recursive: true, force: true }));
|
|
173
|
+
await (0, promises_1.writeFile)(node_path_1.default.join(mediaRepo.directory, "bad.png"), "not really png");
|
|
174
|
+
await git(mediaRepo.directory, "add", "--force", "bad.png");
|
|
175
|
+
await git(mediaRepo.directory, "commit", "-m", "Bad media");
|
|
176
|
+
await strict_1.default.rejects(() => (0, index_js_1.scanOutgoingObjects)({ repoPath: mediaRepo.directory, proposedRefs: ["refs/heads/main"] }), /game_source_binary_path_rejected:bad\.png/);
|
|
177
|
+
const cleanRepo = await createRepo();
|
|
178
|
+
context.after(async () => (0, promises_1.rm)(cleanRepo.directory, { recursive: true, force: true }));
|
|
179
|
+
await (0, index_js_1.scanOutgoingObjects)({ repoPath: cleanRepo.directory, proposedRefs: ["refs/heads/main"] });
|
|
180
|
+
await strict_1.default.rejects(() => (0, index_js_1.scanOutgoingObjects)({ repoPath: cleanRepo.directory, proposedRefs: ["refs/heads/main"], maxBlobBytes: 2 }), /game_source_blob_too_large:index\.html/);
|
|
181
|
+
});
|
|
182
|
+
(0, node_test_1.default)("materialization verifies cache and destination while using the clone operation", async (context) => {
|
|
183
|
+
const root = await (0, promises_1.mkdtemp)(node_path_1.default.join(node_os_1.default.tmpdir(), "playdrop-materialized-"));
|
|
184
|
+
const cache = await (0, promises_1.mkdtemp)(node_path_1.default.join(node_os_1.default.tmpdir(), "playdrop-blob-cache-"));
|
|
185
|
+
context.after(async () => Promise.all([
|
|
186
|
+
(0, promises_1.rm)(root, { recursive: true, force: true }),
|
|
187
|
+
(0, promises_1.rm)(cache, { recursive: true, force: true }),
|
|
188
|
+
]));
|
|
189
|
+
const content = Buffer.from("ship");
|
|
190
|
+
const lock = (0, index_js_1.createGameSourceLock)(new Map([["assets/ship.glb", content]]));
|
|
191
|
+
let cloneCount = 0;
|
|
192
|
+
await (0, index_js_1.materializeGameSourceLock)({
|
|
193
|
+
rootDir: root,
|
|
194
|
+
blobCacheDir: cache,
|
|
195
|
+
lock,
|
|
196
|
+
download: async () => content,
|
|
197
|
+
cloneFile: async (source, destination) => {
|
|
198
|
+
cloneCount += 1;
|
|
199
|
+
await (0, promises_1.writeFile)(destination, await (0, promises_1.readFile)(source));
|
|
200
|
+
},
|
|
201
|
+
});
|
|
202
|
+
strict_1.default.equal(cloneCount, 1);
|
|
203
|
+
strict_1.default.deepEqual(await (0, promises_1.readFile)(node_path_1.default.join(root, "assets/ship.glb")), content);
|
|
204
|
+
});
|
|
205
|
+
(0, node_test_1.default)("materialization uses the macOS clonefile path on the worker filesystem", { skip: process.platform !== "darwin" }, async (context) => {
|
|
206
|
+
const root = await (0, promises_1.mkdtemp)(node_path_1.default.join(node_os_1.default.tmpdir(), "playdrop-materialized-clone-"));
|
|
207
|
+
const cache = await (0, promises_1.mkdtemp)(node_path_1.default.join(node_os_1.default.tmpdir(), "playdrop-blob-cache-clone-"));
|
|
208
|
+
context.after(async () => Promise.all([
|
|
209
|
+
(0, promises_1.rm)(root, { recursive: true, force: true }),
|
|
210
|
+
(0, promises_1.rm)(cache, { recursive: true, force: true }),
|
|
211
|
+
]));
|
|
212
|
+
const content = Buffer.from("clone me");
|
|
213
|
+
const lock = (0, index_js_1.createGameSourceLock)(new Map([["assets/clone.glb", content]]));
|
|
214
|
+
await (0, index_js_1.materializeGameSourceLock)({
|
|
215
|
+
rootDir: root,
|
|
216
|
+
blobCacheDir: cache,
|
|
217
|
+
lock,
|
|
218
|
+
download: async () => content,
|
|
219
|
+
});
|
|
220
|
+
strict_1.default.deepEqual(await (0, promises_1.readFile)(node_path_1.default.join(root, "assets/clone.glb")), content);
|
|
221
|
+
});
|
|
222
|
+
(0, node_test_1.default)("backfill imports semantic versions, preserves summaries, and reconstructs source from Git plus immutable files", async (context) => {
|
|
223
|
+
const repoPath = await (0, promises_1.mkdtemp)(node_path_1.default.join(node_os_1.default.tmpdir(), "playdrop-backfill-"));
|
|
224
|
+
context.after(async () => (0, promises_1.rm)(repoPath, { recursive: true, force: true }));
|
|
225
|
+
const makeSource = async (code, asset) => {
|
|
226
|
+
const zip = new jszip_1.default();
|
|
227
|
+
zip.file("src/game.ts", code);
|
|
228
|
+
zip.file("catalogue.json", "{}\n");
|
|
229
|
+
zip.file("assets/ship.glb", Buffer.concat([Buffer.from([0]), Buffer.from(asset)]));
|
|
230
|
+
return zip.generateAsync({ type: "nodebuffer" });
|
|
231
|
+
};
|
|
232
|
+
const sourceV1 = await makeSource("export const version = 1;\n", "one");
|
|
233
|
+
const sourceV2 = await makeSource("export const version = 2;\n", "two");
|
|
234
|
+
const immutable = new Map();
|
|
235
|
+
const initialized = await (0, index_js_1.initializeGameSourceRepository)({
|
|
236
|
+
repoPath,
|
|
237
|
+
versions: [
|
|
238
|
+
{
|
|
239
|
+
id: 2,
|
|
240
|
+
version: { major: 1, minor: 1, patch: 0 },
|
|
241
|
+
sourceZip: sourceV2,
|
|
242
|
+
taskId: 20,
|
|
243
|
+
taskSummary: "Updated play",
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
id: 1,
|
|
247
|
+
version: { major: 1, minor: 0, patch: 0 },
|
|
248
|
+
sourceZip: sourceV1,
|
|
249
|
+
taskId: 10,
|
|
250
|
+
taskSummary: "Created game",
|
|
251
|
+
},
|
|
252
|
+
],
|
|
253
|
+
putImmutableFile: async (key, content) => {
|
|
254
|
+
const previous = immutable.get(key);
|
|
255
|
+
if (previous)
|
|
256
|
+
strict_1.default.deepEqual(previous, content);
|
|
257
|
+
else
|
|
258
|
+
immutable.set(key, Buffer.from(content));
|
|
259
|
+
},
|
|
260
|
+
});
|
|
261
|
+
strict_1.default.equal(initialized.versions.length, 2);
|
|
262
|
+
strict_1.default.equal(await git(repoPath, "rev-parse", "refs/tags/v1.0.0"), initialized.versions[0]?.commitSha);
|
|
263
|
+
strict_1.default.equal(await git(repoPath, "rev-parse", "refs/tags/v1.1.0"), initialized.versions[1]?.commitSha);
|
|
264
|
+
strict_1.default.equal(await git(repoPath, "show", `${initialized.headSha}:tasks/10.md`), "Created game");
|
|
265
|
+
strict_1.default.equal(await git(repoPath, "show", `${initialized.headSha}:tasks/20.md`), "Updated play");
|
|
266
|
+
strict_1.default.equal((await git(repoPath, "ls-tree", "-r", "--name-only", initialized.headSha)).includes("assets/ship.glb"), false);
|
|
267
|
+
const exported = await (0, index_js_1.exportGameSourceZip)({
|
|
268
|
+
repoPath,
|
|
269
|
+
commitSha: initialized.versions[0]?.commitSha ?? "",
|
|
270
|
+
loadMaterial: async (key) => {
|
|
271
|
+
const content = immutable.get(key);
|
|
272
|
+
if (!content)
|
|
273
|
+
throw new Error("missing immutable");
|
|
274
|
+
return content;
|
|
275
|
+
},
|
|
276
|
+
});
|
|
277
|
+
const originalFiles = await jszip_1.default.loadAsync(sourceV1);
|
|
278
|
+
const exportedFiles = await jszip_1.default.loadAsync(exported);
|
|
279
|
+
for (const filePath of ["src/game.ts", "catalogue.json", "assets/ship.glb"]) {
|
|
280
|
+
strict_1.default.deepEqual(await exportedFiles.file(filePath)?.async("nodebuffer"), await originalFiles.file(filePath)?.async("nodebuffer"));
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
(0, node_test_1.default)("canonical bundle persistence initializes both copies and fences later rotation", async () => {
|
|
284
|
+
const objects = new Map();
|
|
285
|
+
const writes = [];
|
|
286
|
+
let nextGeneration = 1;
|
|
287
|
+
const storage = {
|
|
288
|
+
async getPrivateObjectMetadata(key) {
|
|
289
|
+
return objects.get(key)?.metadata ?? null;
|
|
290
|
+
},
|
|
291
|
+
async putPrivateObject(key, content, options) {
|
|
292
|
+
writes.push(key);
|
|
293
|
+
const previous = objects.get(key);
|
|
294
|
+
if ((options.ifGenerationMatch === "0" && previous) ||
|
|
295
|
+
(options.ifGenerationMatch !== "0" && previous?.metadata.generation !== options.ifGenerationMatch)) {
|
|
296
|
+
throw Object.assign(new Error("conflict"), { code: 412 });
|
|
297
|
+
}
|
|
298
|
+
const metadata = {
|
|
299
|
+
generation: String(nextGeneration++),
|
|
300
|
+
sizeBytes: content.length,
|
|
301
|
+
contentType: options.contentType,
|
|
302
|
+
customMetadata: { ...options.metadata, sha256: options.sha256 },
|
|
303
|
+
};
|
|
304
|
+
objects.set(key, { content: Buffer.from(content), metadata });
|
|
305
|
+
return metadata;
|
|
306
|
+
},
|
|
307
|
+
async copyPrivateObject(sourceKey, destinationKey, options) {
|
|
308
|
+
const source = objects.get(sourceKey);
|
|
309
|
+
const destination = objects.get(destinationKey);
|
|
310
|
+
if (!source || source.metadata.generation !== options.sourceGeneration ||
|
|
311
|
+
destination?.metadata.generation !== options.ifGenerationMatch)
|
|
312
|
+
throw new Error("conflict");
|
|
313
|
+
const metadata = {
|
|
314
|
+
generation: String(nextGeneration++),
|
|
315
|
+
sizeBytes: source.content.length,
|
|
316
|
+
contentType: source.metadata.contentType,
|
|
317
|
+
customMetadata: { ...source.metadata.customMetadata, ...options.metadata },
|
|
318
|
+
};
|
|
319
|
+
objects.set(destinationKey, { content: Buffer.from(source.content), metadata });
|
|
320
|
+
return metadata;
|
|
321
|
+
},
|
|
322
|
+
};
|
|
323
|
+
const first = await (0, index_js_1.persistCanonicalBundle)({
|
|
324
|
+
storage,
|
|
325
|
+
currentKey: "current",
|
|
326
|
+
previousKey: "previous",
|
|
327
|
+
bundle: Buffer.from("first"),
|
|
328
|
+
baseGeneration: null,
|
|
329
|
+
metadata: { task: "1", head: "a".repeat(40) },
|
|
330
|
+
});
|
|
331
|
+
strict_1.default.deepEqual(writes.slice(0, 2), ["current", "previous"]);
|
|
332
|
+
strict_1.default.deepEqual(objects.get("current")?.content, objects.get("previous")?.content);
|
|
333
|
+
objects.delete("previous");
|
|
334
|
+
const repaired = await (0, index_js_1.persistCanonicalBundle)({
|
|
335
|
+
storage,
|
|
336
|
+
currentKey: "current",
|
|
337
|
+
previousKey: "previous",
|
|
338
|
+
bundle: Buffer.from("first"),
|
|
339
|
+
baseGeneration: null,
|
|
340
|
+
metadata: { task: "1", head: "a".repeat(40) },
|
|
341
|
+
});
|
|
342
|
+
strict_1.default.equal(repaired.generation, first.generation);
|
|
343
|
+
strict_1.default.deepEqual(objects.get("current")?.content, objects.get("previous")?.content);
|
|
344
|
+
const second = await (0, index_js_1.persistCanonicalBundle)({
|
|
345
|
+
storage,
|
|
346
|
+
currentKey: "current",
|
|
347
|
+
previousKey: "previous",
|
|
348
|
+
bundle: Buffer.from("second"),
|
|
349
|
+
baseGeneration: first.generation,
|
|
350
|
+
metadata: { task: "2", head: "b".repeat(40) },
|
|
351
|
+
});
|
|
352
|
+
strict_1.default.deepEqual(objects.get("previous")?.content, Buffer.from("first"));
|
|
353
|
+
strict_1.default.deepEqual(objects.get("current")?.content, Buffer.from("second"));
|
|
354
|
+
await strict_1.default.rejects(() => (0, index_js_1.persistCanonicalBundle)({
|
|
355
|
+
storage,
|
|
356
|
+
currentKey: "current",
|
|
357
|
+
previousKey: "previous",
|
|
358
|
+
bundle: Buffer.from("stale"),
|
|
359
|
+
baseGeneration: first.generation,
|
|
360
|
+
metadata: { task: "3", head: "c".repeat(40) },
|
|
361
|
+
}), /canonical_bundle_generation_mismatch/);
|
|
362
|
+
strict_1.default.notEqual(second.generation, first.generation);
|
|
363
|
+
});
|
|
364
|
+
(0, node_test_1.default)("self-heal and listing sync keep every material byte out of Git", async (context) => {
|
|
365
|
+
const repoPath = await (0, promises_1.mkdtemp)(node_path_1.default.join(node_os_1.default.tmpdir(), "playdrop-self-heal-"));
|
|
366
|
+
context.after(async () => (0, promises_1.rm)(repoPath, { recursive: true, force: true }));
|
|
367
|
+
const source = new jszip_1.default();
|
|
368
|
+
source.file("catalogue.json", JSON.stringify({ apps: [{ name: "game", version: "1.0.0" }] }));
|
|
369
|
+
source.file("index.html", "<main>game</main>");
|
|
370
|
+
source.file("assets/ship.glb", Buffer.from([0, 1, 2]));
|
|
371
|
+
const immutable = new Map();
|
|
372
|
+
const putImmutableFile = async (key, content) => {
|
|
373
|
+
immutable.set(key, Buffer.from(content));
|
|
374
|
+
};
|
|
375
|
+
const initialized = await (0, index_js_1.initializeGameSourceRepository)({
|
|
376
|
+
repoPath,
|
|
377
|
+
versions: [{ id: 1, version: { major: 1, minor: 0, patch: 0 }, sourceZip: await source.generateAsync({ type: "nodebuffer" }) }],
|
|
378
|
+
putImmutableFile,
|
|
379
|
+
});
|
|
380
|
+
const healed = await (0, index_js_1.importAdditionalSourceVersions)({
|
|
381
|
+
repoPath,
|
|
382
|
+
versions: [{ id: 2, version: { major: 1, minor: 0, patch: 1 }, sourceZip: await source.generateAsync({ type: "nodebuffer" }) }],
|
|
383
|
+
putImmutableFile,
|
|
384
|
+
});
|
|
385
|
+
strict_1.default.equal((await git(repoPath, "ls-tree", "-r", "--name-only", healed[0].commitSha)).includes("assets/ship.glb"), false);
|
|
386
|
+
const hero = Buffer.from([0, 4, 5]);
|
|
387
|
+
const listingHead = await (0, index_js_1.syncAuthoritativeListing)({
|
|
388
|
+
repoPath,
|
|
389
|
+
listing: {
|
|
390
|
+
version: "1.0.1",
|
|
391
|
+
displayName: "Game",
|
|
392
|
+
subtitle: null,
|
|
393
|
+
description: "Updated listing",
|
|
394
|
+
iconPath: null,
|
|
395
|
+
heroPortraitPath: null,
|
|
396
|
+
heroLandscapePath: "listing/hero.png",
|
|
397
|
+
socialLandscapePath: "listing/social.png",
|
|
398
|
+
screenshotsPortrait: [],
|
|
399
|
+
screenshotsLandscape: [],
|
|
400
|
+
videosPortrait: [],
|
|
401
|
+
videosLandscape: [],
|
|
402
|
+
files: new Map([
|
|
403
|
+
["listing/hero.png", hero],
|
|
404
|
+
["listing/social.png", hero],
|
|
405
|
+
]),
|
|
406
|
+
},
|
|
407
|
+
putImmutableFile,
|
|
408
|
+
});
|
|
409
|
+
strict_1.default.notEqual(listingHead, initialized.headSha);
|
|
410
|
+
strict_1.default.equal((await git(repoPath, "ls-tree", "-r", "--name-only", listingHead)).includes("listing/hero.png"), false);
|
|
411
|
+
strict_1.default.match(await git(repoPath, "show", `${listingHead}:catalogue.json`), /Updated listing/);
|
|
412
|
+
strict_1.default.match(await git(repoPath, "show", `${listingHead}:catalogue.json`), /socialLandscape/);
|
|
413
|
+
const lock = (0, index_js_1.parseGameSourceLock)(Buffer.from(await git(repoPath, "show", `${listingHead}:.playdrop/files.lock`)));
|
|
414
|
+
strict_1.default.equal(lock.files["listing/hero.png"]?.sha256, (0, index_js_1.sha256)(hero));
|
|
415
|
+
});
|
|
416
|
+
(0, node_test_1.default)("self-heal preserves caller order so the selected base can be imported last", async (context) => {
|
|
417
|
+
const repoPath = await (0, promises_1.mkdtemp)(node_path_1.default.join(node_os_1.default.tmpdir(), "playdrop-self-heal-order-"));
|
|
418
|
+
context.after(async () => (0, promises_1.rm)(repoPath, { recursive: true, force: true }));
|
|
419
|
+
const source = async (version) => {
|
|
420
|
+
const zip = new jszip_1.default();
|
|
421
|
+
zip.file("catalogue.json", JSON.stringify({ apps: [{ name: "game", version }] }));
|
|
422
|
+
zip.file("index.html", `<main>${version}</main>`);
|
|
423
|
+
return await zip.generateAsync({ type: "nodebuffer" });
|
|
424
|
+
};
|
|
425
|
+
await (0, index_js_1.initializeGameSourceRepository)({
|
|
426
|
+
repoPath,
|
|
427
|
+
versions: [{ id: 1, version: { major: 1, minor: 0, patch: 0 }, sourceZip: await source("1.0.0") }],
|
|
428
|
+
putImmutableFile: async () => undefined,
|
|
429
|
+
});
|
|
430
|
+
const imported = await (0, index_js_1.importAdditionalSourceVersions)({
|
|
431
|
+
repoPath,
|
|
432
|
+
versions: [
|
|
433
|
+
{ id: 3, version: { major: 2, minor: 0, patch: 0 }, sourceZip: await source("2.0.0") },
|
|
434
|
+
{ id: 2, version: { major: 1, minor: 5, patch: 0 }, sourceZip: await source("1.5.0") },
|
|
435
|
+
],
|
|
436
|
+
putImmutableFile: async () => undefined,
|
|
437
|
+
});
|
|
438
|
+
strict_1.default.deepEqual(imported.map((entry) => entry.id), [3, 2]);
|
|
439
|
+
strict_1.default.equal(await git(repoPath, "rev-parse", "HEAD"), imported[1]?.commitSha);
|
|
440
|
+
strict_1.default.equal(await git(repoPath, "show", "HEAD:index.html"), "<main>1.5.0</main>");
|
|
441
|
+
});
|