@playcraft/cli 0.1.65 → 0.1.67
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/assets/client.js +4 -2
- package/dist/assets/messages.js +2 -0
- package/dist/audio-source/messages.js +35 -0
- package/dist/commands/assets.js +1 -1
- package/dist/commands/audio-source.js +109 -0
- package/dist/commands/audio.js +11 -4
- package/dist/commands/build.js +4 -2
- package/dist/commands/tools-context.js +46 -0
- package/dist/commands/tools.js +2 -0
- package/dist/model-adaptation/project.js +1 -1
- package/dist/project-skills/builtin-import.js +69 -22
- package/dist/project-skills/commands.js +11 -2
- package/dist/project-skills/lifecycle.js +1 -1
- package/dist/project-skills/local-store.js +90 -31
- package/dist/project-skills/messages.js +16 -0
- package/dist/project-skills/migrate-lock.js +166 -0
- package/dist/project-skills/remote-cache.js +36 -5
- package/dist/utils/agent-api-client.js +18 -1
- package/dist/utils/agent-generation-provenance.js +8 -2
- package/dist/utils/audio-export.js +249 -0
- package/dist/utils/audio-processor.js +22 -99
- package/dist/utils/execution-context-bridge.js +28 -0
- package/dist/workspace-runtime/batch/control.js +13 -2
- package/dist/workspace-runtime/batch/generate.js +43 -2
- package/dist/workspace-runtime/batch/prepare.js +4 -0
- package/dist/workspace-runtime/batch/skill-artifacts.js +103 -0
- package/dist/workspace-runtime/batch/source-capture.js +6 -8
- package/dist/workspace-runtime/codex/app-server.js +26 -2
- package/dist/workspace-runtime/codex/execution-context-broker.js +61 -0
- package/dist/workspace-runtime/codex/execution-context-tools.js +37 -0
- package/dist/workspace-runtime/codex/generation-provenance-broker.js +9 -6
- package/dist/workspace-runtime/codex/level-editor-tools.js +18 -0
- package/dist/workspace-runtime/codex/model-broker.js +15 -2
- package/dist/workspace-runtime/codex/scheduled-task-tools.js +1 -1
- package/dist/workspace-runtime/previews/finalize.js +1 -1
- package/dist/workspace-runtime/previews/output.js +4 -1
- package/dist/workspace-runtime/previews/publish.js +5 -2
- package/dist/workspace-runtime/previews/runtime-preview.js +38 -3
- package/dist/workspace-runtime/serve.js +6 -0
- package/dist/workspace-runtime/server/accept-operation.js +85 -13
- package/dist/workspace-runtime/server/audio-assets.js +211 -0
- package/dist/workspace-runtime/server/audio-export.js +136 -0
- package/dist/workspace-runtime/server/directory-access.js +222 -67
- package/dist/workspace-runtime/server/dispatch.js +252 -29
- package/dist/workspace-runtime/server/http.js +97 -3
- package/dist/workspace-runtime/server/operation-record.js +1 -1
- package/dist/workspace-runtime/workspaces/artifact-files.js +10 -3
- package/dist/workspace-runtime/workspaces/artifacts.js +47 -6
- package/dist/workspace-runtime/workspaces/audio-assets/artifact-package.js +104 -0
- package/dist/workspace-runtime/workspaces/audio-assets/binding-usage.js +71 -0
- package/dist/workspace-runtime/workspaces/audio-assets/build-inputs.js +76 -0
- package/dist/workspace-runtime/workspaces/audio-assets/render-worker.js +117 -0
- package/dist/workspace-runtime/workspaces/audio-assets/renderer.js +128 -0
- package/dist/workspace-runtime/workspaces/audio-assets/representations.js +73 -0
- package/dist/workspace-runtime/workspaces/audio-assets/service.js +327 -0
- package/dist/workspace-runtime/workspaces/audio-assets/storage.js +125 -0
- package/dist/workspace-runtime/workspaces/build-isolation.js +2 -0
- package/dist/workspace-runtime/workspaces/composer-context.js +40 -1
- package/dist/workspace-runtime/workspaces/empty-template.js +1 -1
- package/dist/workspace-runtime/workspaces/execution-context.js +24 -0
- package/dist/workspace-runtime/workspaces/files.js +3 -5
- package/dist/workspace-runtime/workspaces/level-editor-agent-store.js +143 -0
- package/dist/workspace-runtime/workspaces/level-editor-agent.js +410 -0
- package/dist/workspace-runtime/workspaces/level-editor-atomic.js +424 -0
- package/dist/workspace-runtime/workspaces/level-editor-extensions.js +140 -0
- package/dist/workspace-runtime/workspaces/level-editor-format.js +75 -0
- package/dist/workspace-runtime/workspaces/level-editor-history-store.js +250 -0
- package/dist/workspace-runtime/workspaces/level-editor-json5.js +132 -0
- package/dist/workspace-runtime/workspaces/level-editor-requests.js +724 -0
- package/dist/workspace-runtime/workspaces/level-editor.js +454 -0
- package/dist/workspace-runtime/workspaces/parameter-initialization-skill.js +62 -22
- package/dist/workspace-runtime/workspaces/parameter-production.js +1 -1
- package/dist/workspace-runtime/workspaces/remix-reference-skill.js +4 -3
- package/dist/workspace-runtime/workspaces/skill-artifact-loader.js +19 -5
- package/dist/workspace-runtime/workspaces/skills.js +48 -13
- package/package.json +6 -4
- package/project-template/.claude/skills/playcraft-audio-generation/SKILL.md +74 -4
- package/project-template/.claude/skills/playcraft-level-editor/SKILL.md +34 -0
- package/project-template/.claude/skills/playcraft-level-editor/references/authoring-contract.json +3475 -0
- package/project-template/.claude/skills/playcraft-level-editor/references/extensions.md +37 -0
- package/project-template/.claude/skills/playcraft-level-editor/references/preview.md +15 -0
- package/project-template/.claude/skills/playcraft-level-editor/references/protocol-v1.md +35 -0
- package/project-template/vite.config.ts +1 -1
- package/project-template-v2/.claude/skills/playcraft-audio-generation/SKILL.md +74 -4
- package/project-template-v2/.playcraft/skills.lock.json +9 -2
- package/project-template-v2/vite.config.ts +1 -1
- package/project-templates/empty/AGENTS.md +8 -4
- package/project-templates/phaser/.claude/skills/playcraft-audio-generation/SKILL.md +74 -4
- package/project-templates/phaser/vite.config.ts +1 -1
- package/project-templates/playable-template-phaser/vite.config.ts +1 -1
- package/project-templates/threejs/.claude/skills/playcraft-audio-generation/SKILL.md +74 -4
- package/project-templates/threejs/vite.config.ts +1 -1
- package/templates/preview-runtime/v1/README.md +12 -0
- package/templates/preview-runtime/v1/build-preview.mjs +17 -8
- package/templates/preview-runtime/v1/manifest.json +9 -6
- package/templates/preview-runtime/v1/release-guard.mjs +1 -1
- package/templates/preview-runtime/v1/runtime.d.mts +1 -3
- package/templates/preview-runtime/v1/runtime.d.ts +1 -3
- package/templates/preview-runtime/v1/runtime.mjs +1142 -257
- package/templates/preview-runtime/v1/types/host.d.ts +29 -0
- package/templates/preview-runtime/v1/types/index.d.ts +6 -0
- package/templates/preview-runtime/v1/types/level-editor.d.ts +123 -0
|
@@ -1182,11 +1182,19 @@ async function buildWorkspacePreview({ entry, config, mountId = "game", root = p
|
|
|
1182
1182
|
const entryPath = await inside(root, entry);
|
|
1183
1183
|
const configPath = config ? await inside(root, config) : false;
|
|
1184
1184
|
if (!/^[A-Za-z][A-Za-z0-9_-]{0,63}$/.test(mountId)) throw new Error("preview_runtime_mount_invalid");
|
|
1185
|
-
const
|
|
1186
|
-
|
|
1187
|
-
const
|
|
1188
|
-
const
|
|
1189
|
-
|
|
1185
|
+
const parameterFiles = manifest.parameters?.schemaPath && manifest.parameters?.dataPath;
|
|
1186
|
+
if (!parameterFiles && !context.levelEditor) throw new Error("preview_runtime_source_missing");
|
|
1187
|
+
const schemaPath = parameterFiles ? await inside(root, manifest.parameters.schemaPath) : void 0;
|
|
1188
|
+
const dataPath = parameterFiles ? await inside(root, manifest.parameters.dataPath) : void 0;
|
|
1189
|
+
const schema = schemaPath ? await readFile(schemaPath) : void 0;
|
|
1190
|
+
const data = dataPath ? await readFile(dataPath) : void 0;
|
|
1191
|
+
const schemaHash = schema ? hash(schema) : context.levelEditor.schemaHash;
|
|
1192
|
+
const dataHash = data ? hash(data) : context.levelEditor.dataHash;
|
|
1193
|
+
if (schemaHash !== context.binding.schemaVersion || dataHash !== context.baseline.dataHash)
|
|
1194
|
+
throw new Error("preview_runtime_source_changed");
|
|
1195
|
+
const levelInputs = context.levelEditor?.inputs ?? [];
|
|
1196
|
+
if (context.levelEditor && (!Array.isArray(levelInputs) || !levelInputs.length)) throw new Error("preview_runtime_level_inputs_missing");
|
|
1197
|
+
for (const input of levelInputs) if (hash(await readFile(await inside(root, input.path))) !== input.sha256)
|
|
1190
1198
|
throw new Error("preview_runtime_source_changed");
|
|
1191
1199
|
const sdkPath = await realpath(path.join(sdkDirectory, "runtime.mjs"));
|
|
1192
1200
|
const sdkRelativePath = slash(path.relative(root, sdkPath));
|
|
@@ -1239,6 +1247,7 @@ async function buildWorkspacePreview({ entry, config, mountId = "game", root = p
|
|
|
1239
1247
|
path.join(root, "package.json"),
|
|
1240
1248
|
schemaPath,
|
|
1241
1249
|
dataPath,
|
|
1250
|
+
...levelInputs.map((input2) => path.join(root, input2.path)),
|
|
1242
1251
|
path.join(root, ".playcraft/workspace.json"),
|
|
1243
1252
|
...["pnpm-lock.yaml", "package-lock.json", "yarn.lock"].map((name) => path.join(root, name))
|
|
1244
1253
|
])
|
|
@@ -1290,14 +1299,14 @@ async function buildWorkspacePreview({ entry, config, mountId = "game", root = p
|
|
|
1290
1299
|
throw new Error("preview_runtime_external_resource");
|
|
1291
1300
|
const css = outputs.filter((output) => output.type === "asset").map((output) => typeof output.source === "string" ? output.source : Buffer.from(output.source).toString()).join("\n");
|
|
1292
1301
|
const html = '<!doctype html><html><head><meta charset="UTF-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>PlayCraft preview</title><style>' + css.replace(/<\/style/gi, "<\\/style") + '</style></head><body><div id="' + mountId + '"></div><script type="module">' + chunks[0].code.replace(/<\/script/gi, "<\\/script") + "</script></body></html>";
|
|
1293
|
-
if (hash(await readFile(schemaPath)) !== hash(schema) || hash(await readFile(dataPath)) !== hash(data) || hash(await readFile(await inside(root, ".playcraft/workspace.json"))) !== hash(manifestBytes) || hash(await readFile(sdkPath)) !== hash(sdkBytes)) throw new Error("preview_runtime_source_changed");
|
|
1302
|
+
if (schemaPath && hash(await readFile(schemaPath)) !== hash(schema) || dataPath && hash(await readFile(dataPath)) !== hash(data) || hash(await readFile(await inside(root, ".playcraft/workspace.json"))) !== hash(manifestBytes) || hash(await readFile(sdkPath)) !== hash(sdkBytes)) throw new Error("preview_runtime_source_changed");
|
|
1294
1303
|
const report = {
|
|
1295
1304
|
target: "editor-static",
|
|
1296
1305
|
buildId: context.buildId,
|
|
1297
1306
|
htmlDigest: hash(html),
|
|
1298
|
-
schemaDigest:
|
|
1307
|
+
schemaDigest: schemaHash,
|
|
1299
1308
|
sourceFingerprint: context.sourceFingerprint,
|
|
1300
|
-
dataHash
|
|
1309
|
+
dataHash,
|
|
1301
1310
|
dataRevision: context.baseline.dataRevision,
|
|
1302
1311
|
schemaRevision: context.baseline.schemaRevision,
|
|
1303
1312
|
moduleIds,
|
|
@@ -3,13 +3,16 @@
|
|
|
3
3
|
"sdkVersion": "0.0.1",
|
|
4
4
|
"protocolVersion": 1,
|
|
5
5
|
"files": {
|
|
6
|
-
"build-preview.mjs": "
|
|
7
|
-
"README.md": "
|
|
8
|
-
"release-guard.mjs": "
|
|
9
|
-
"runtime.d.mts": "
|
|
10
|
-
"runtime.d.ts": "
|
|
11
|
-
"runtime.mjs": "
|
|
6
|
+
"build-preview.mjs": "c72ab758e39bb419cc194dce1ee711bd6f9bfda322e15198d4657d61742af386",
|
|
7
|
+
"README.md": "61a4dcf4dc5b6ae4000578cb2d369bb5f6a999c30e1c9c2dac44e3035bcd0a4b",
|
|
8
|
+
"release-guard.mjs": "728ac088f8d885a50a1c9bcdddad724fa80afd06e66a6dd3658756034e563055",
|
|
9
|
+
"runtime.d.mts": "a90c69a8b72105e8dc8fe0b3bcd272f038ed255f7daf5ec6c1aefc293a1e84b2",
|
|
10
|
+
"runtime.d.ts": "a90c69a8b72105e8dc8fe0b3bcd272f038ed255f7daf5ec6c1aefc293a1e84b2",
|
|
11
|
+
"runtime.mjs": "50dc53ff94effedf10903df708c1ecdb51bd8145a5a6ec1eac9449cad7424a24",
|
|
12
12
|
"types/adapters.d.ts": "f5e70c4bb9043de1c590eada14266f613286360c809faf26680b0bbbd1cc7b2c",
|
|
13
|
+
"types/host.d.ts": "9ea867d5485a66aba7da86ea7e5583bca6b9a7a89618afd0eb70ace58e06faf9",
|
|
14
|
+
"types/index.d.ts": "210d24a767f260bc8944d917b50dae1357cba31b8b5d499bea7bcc99b1051e6c",
|
|
15
|
+
"types/level-editor.d.ts": "7f1a8c348e23b186c1f64e4f38fcb08fa663b0cfc2655a4acb86c640e0172a72",
|
|
13
16
|
"types/preview.d.ts": "db2e7eb1fa3406ca53fc7c3a4352da061c05af714ead978111ab5118de58db32",
|
|
14
17
|
"types/protocol.d.ts": "b298d1d35d6e261bbf6a0500f9029f38cad1532bb46475566180b3b92833c507",
|
|
15
18
|
"types/runtime.d.ts": "f52d08d7b53ff84394381f9d1741a624142f75fac468abf9a5029e98fe172ca4"
|
|
@@ -4,7 +4,7 @@ import path from 'node:path';
|
|
|
4
4
|
|
|
5
5
|
const slash = value => value.replaceAll('\\', '/').replaceAll('\0', '').split('?')[0];
|
|
6
6
|
const hash = value => createHash('sha256').update(value).digest('hex');
|
|
7
|
-
const marker = /runtime\.parameters\.|playcraft-preview-storage:|
|
|
7
|
+
const marker = /runtime\.(?:parameters|levelEditor|level-editor)\.|playcraft-preview-storage:|__playcraft_(?:preview|level_editor)_context__|playcraft-level-editor-profile/i;
|
|
8
8
|
/** A production-only Vite module boundary, separate from the development preview builder. */
|
|
9
9
|
export function previewRuntimeReleaseGuard({ root = process.cwd(), previewEntries = [], reportPath = '.playcraft-editor-preview/release-report.json' } = {}) {
|
|
10
10
|
root = path.resolve(root);
|