@playcraft/cli 0.1.64 → 0.1.66
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/README.md +24 -31
- package/dist/commands/build.js +70 -5
- package/dist/commands/create.js +4 -4
- package/dist/commands/inspect.js +4 -6
- package/dist/index.js +27 -19
- package/dist/model-adaptation/node-inspection.js +173 -0
- package/dist/model-adaptation/project-template.js +40 -8
- package/dist/model-adaptation/project.js +2 -2
- package/dist/model-preparation/pipeline-engine.js +157 -0
- package/dist/model-preparation/pipeline-files.js +108 -0
- package/dist/model-preparation/pipeline-worker.js +32 -0
- package/dist/workspace-runtime/batch/deliver.js +2 -2
- package/dist/workspace-runtime/codex/delivery-tools.js +36 -3
- package/dist/workspace-runtime/previews/publish.js +2 -2
- package/dist/workspace-runtime/serve.js +5 -0
- package/dist/workspace-runtime/server/directory-access.js +1 -1
- package/dist/workspace-runtime/server/dispatch.js +27 -47
- package/dist/workspace-runtime/server/http.js +12 -0
- package/dist/workspace-runtime/workspaces/build-isolation.js +75 -0
- package/dist/workspace-runtime/workspaces/model-build-inputs.js +27 -0
- package/dist/workspace-runtime/workspaces/model-preparation-store.js +134 -0
- package/dist/workspace-runtime/workspaces/model-preparation.js +357 -0
- package/dist/workspace-runtime/workspaces/platform-export.js +1 -0
- package/package.json +4 -4
- package/project-template/.claude/skills/playcraft-build-optimizer/SKILL.md +19 -39
- package/project-templates/empty/AGENTS.md +6 -4
- package/project-templates/phaser/.claude/skills/playcraft-build-optimizer/SKILL.md +19 -39
- package/project-templates/threejs/.claude/skills/playcraft-build-optimizer/SKILL.md +19 -39
- package/dist/workspace-runtime/workspaces/delivery-build.js +0 -440
|
@@ -30,11 +30,11 @@ triggers: 构建优化,build optimizer,压缩,compress,WebP,pngquant,文件大
|
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
32
|
# 检查最终输出文件大小
|
|
33
|
-
playcraft image info --input dist/index.html --json # 不适用,用 shell
|
|
33
|
+
playcraft image info --input dist/preview/index.html --json # 不适用,用 shell
|
|
34
34
|
|
|
35
35
|
# Shell 方法:检查文件大小(字节)
|
|
36
|
-
du -sh dist/index.html
|
|
37
|
-
ls -lh dist/index.html
|
|
36
|
+
du -sh dist/preview/index.html
|
|
37
|
+
ls -lh dist/preview/index.html
|
|
38
38
|
|
|
39
39
|
# 计算:若当前原始资产总大小为 X MB
|
|
40
40
|
# 预计最终 HTML 大小 ≈ X × 1.33(Base64 膨胀)
|
|
@@ -112,34 +112,31 @@ grep -r "\.play()" game/ --include="*.js" --include="*.ts"
|
|
|
112
112
|
|
|
113
113
|
## 2. playcraft build 优化参数
|
|
114
114
|
|
|
115
|
+
- 产物固定为单文件 `dist/preview/index.html`,用于本地 review;在云工作区中它就是产物面板里的可玩预览。
|
|
116
|
+
- 下列参数只影响这份本地预览。渠道包(Meta、Google、AppLovin 等)只能通过平台导出生成,导出不会读取本地 build 的参数,渠道体积以导出时的校验为准。
|
|
117
|
+
|
|
115
118
|
### 完整优化构建命令
|
|
116
119
|
|
|
117
120
|
```bash
|
|
118
|
-
#
|
|
121
|
+
# 标准优化构建
|
|
119
122
|
playcraft build . \
|
|
120
|
-
--platform facebook \
|
|
121
123
|
--compress-images \
|
|
122
124
|
--image-quality 85 \
|
|
123
125
|
--convert-webp \
|
|
124
126
|
--js-minify \
|
|
125
|
-
--css-minify
|
|
126
|
-
--output dist/
|
|
127
|
+
--css-minify
|
|
127
128
|
|
|
128
129
|
# 带 3D 模型压缩的构建
|
|
129
130
|
playcraft build . \
|
|
130
|
-
--platform facebook \
|
|
131
131
|
--compress-images \
|
|
132
132
|
--image-quality 80 \
|
|
133
133
|
--convert-webp \
|
|
134
134
|
--compress-models \
|
|
135
135
|
--model-compression draco \
|
|
136
|
-
--js-minify
|
|
137
|
-
--output dist/
|
|
136
|
+
--js-minify
|
|
138
137
|
|
|
139
138
|
# 分析体积占用(不构建,只分析)
|
|
140
|
-
playcraft build .
|
|
141
|
-
--platform facebook \
|
|
142
|
-
--analyze
|
|
139
|
+
playcraft build . --analyze
|
|
143
140
|
```
|
|
144
141
|
|
|
145
142
|
### 图片优化参数
|
|
@@ -170,25 +167,6 @@ playcraft build . \
|
|
|
170
167
|
| `--js-minify` | 启用 JS 压缩(Terser + 混淆) |
|
|
171
168
|
| `--css-minify` | 启用 CSS 压缩 |
|
|
172
169
|
|
|
173
|
-
### 多平台批量构建
|
|
174
|
-
|
|
175
|
-
```bash
|
|
176
|
-
# 同时构建多个平台版本
|
|
177
|
-
playcraft build-all . \
|
|
178
|
-
--platforms facebook,google,applovin \
|
|
179
|
-
--compress-images \
|
|
180
|
-
--image-quality 85 \
|
|
181
|
-
--convert-webp \
|
|
182
|
-
--js-minify \
|
|
183
|
-
--output dist/
|
|
184
|
-
|
|
185
|
-
# 或按平台组
|
|
186
|
-
playcraft build-all . \
|
|
187
|
-
--group mainstream \ # 主流平台
|
|
188
|
-
--compress-images \
|
|
189
|
-
--convert-webp
|
|
190
|
-
```
|
|
191
|
-
|
|
192
170
|
---
|
|
193
171
|
|
|
194
172
|
## 3. 正确的优化执行顺序
|
|
@@ -207,9 +185,11 @@ playcraft build-all . \
|
|
|
207
185
|
↓
|
|
208
186
|
5. playcraft build --js-minify --css-minify — 代码压缩
|
|
209
187
|
↓
|
|
210
|
-
6.
|
|
188
|
+
6. 检查 dist/preview/index.html 大小(仅供参考,渠道体积以平台导出校验为准)
|
|
211
189
|
↓
|
|
212
190
|
7. 合规验证清单(§1)
|
|
191
|
+
↓
|
|
192
|
+
8. 通过平台导出生成各渠道包
|
|
213
193
|
```
|
|
214
194
|
|
|
215
195
|
**禁止行为**:
|
|
@@ -298,9 +278,9 @@ playcraft 3d optimize \
|
|
|
298
278
|
|
|
299
279
|
## 6. 常见审核被拒原因速查
|
|
300
280
|
|
|
301
|
-
| 被拒原因 | 占比 | 检查方法
|
|
302
|
-
| ----------------- | ---- |
|
|
303
|
-
| 文件大小超过 5 MB | 45% | `ls -lh dist/index.html` | `--compress-images --convert-webp` 或降低 image-quality |
|
|
304
|
-
| 包含外部请求 | 30% | `grep -r "https://"`
|
|
305
|
-
| CTA 未实现 | 15% | `grep "FbPlayableAd"`
|
|
306
|
-
| 音频自动播放 | 10% | `grep "autoplay"`
|
|
281
|
+
| 被拒原因 | 占比 | 检查方法 | 修复方法 |
|
|
282
|
+
| ----------------- | ---- | -------------------------------- | ------------------------------------------------------- |
|
|
283
|
+
| 文件大小超过 5 MB | 45% | `ls -lh dist/preview/index.html` | `--compress-images --convert-webp` 或降低 image-quality |
|
|
284
|
+
| 包含外部请求 | 30% | `grep -r "https://"` | Developer 将外部资源内嵌 |
|
|
285
|
+
| CTA 未实现 | 15% | `grep "FbPlayableAd"` | Developer 添加平台 CTA API |
|
|
286
|
+
| 音频自动播放 | 10% | `grep "autoplay"` | Developer 改为用户交互触发 |
|
|
@@ -59,13 +59,15 @@ Do not ask the user to choose reuse versus generation for every asset. Ask only
|
|
|
59
59
|
- Durable generation: `playcraft assets estimate --request <request-file>` estimates a request. `assets generate --request <request-file> --client-request-id <stable-unique-id>` starts a workspace generation task for images, audio, sprites, frame animation, models, or video. Reuse that identifier for the same request after an uncertain outcome. `assets tasks`, `assets get <taskId>`, `assets wait <taskId>`, and `assets cancel <taskId>` manage existing tasks. `assets download <taskId> --output <new-path>` retrieves a completed result. Commands infer workspace and project directory from the current checkout; explicit `--workspace` and `--directory` must match it.
|
|
60
60
|
- Generated task results can be saved to the shared library through `assets library-targets`, `assets library-save`, `assets library-saves`, and `assets library-retry`. `assets animation` reads and edits animation drafts, uploads frames, and creates export versions. Keep request files and receipts outside `dist/`.
|
|
61
61
|
|
|
62
|
-
##
|
|
62
|
+
## Workspace artifacts
|
|
63
63
|
|
|
64
|
-
The artifact panel shows
|
|
64
|
+
The artifact panel shows what this workspace builds and generates, under `dist/` at the current project directory's root: generated images, video, audio, models and documents, and the `playcraft build` preview. Channel packages are packaged by platform export, not built here; they belong in the Delivery tab and never in `dist/`. Keep working sources, input references, dependencies, receipts, and build intermediates outside `dist/`. Do not copy unrelated source files into it just to make them appear in the panel.
|
|
65
65
|
|
|
66
|
-
When a generated asset is ready
|
|
66
|
+
When a generated asset is ready, save or copy it into `dist/` with a stable relative path. Keep the resources required by a model or document within `dist/` and preserve their relative links. Reuse the same path for a revised artifact so its versions remain grouped; the platform retains its history. Use different paths for independent candidates or artifacts.
|
|
67
67
|
|
|
68
|
-
Run playable builds from the project root
|
|
68
|
+
Run playable builds from the project root with `playcraft build`. It takes no channel or format options and always produces the review build at `dist/preview/index.html`; channel packages come only from platform export. In a workspace this command builds in an isolated copy, validates the result, and retains the playable at `dist/preview/index.html` while preserving other artifacts. A successful agent command or turn that writes a valid self-contained HTML file at this same path is collected as the same playable preview. No separate publish action is required to view it. A base build's `dist/index.html` can still require resource files and remains a document. The page's generate-preview action rebuilds the current project through the same validation. After a successful build the command also publishes the playable and prints `Public URL: <address>`; when you report the build, link that address as the playable instead of the sandbox path, since it opens directly and can be shared. If the command prints `Public URL unavailable`, report that the build succeeded without a public address and give the reason it printed. Temporary `.playcraft-preview-out/` and `.playcraft-temp/` files are not artifacts. Preserve other artifacts already in `dist/` when rebuilding a playable.
|
|
69
|
+
|
|
70
|
+
When reporting finished exports, tell the user the packages are in the Delivery tab and open it with `playcraft_open_delivery`.
|
|
69
71
|
|
|
70
72
|
Keep this convention in `AGENTS.md`, the project's standard instruction filename. Do not create a separate `AGENT.md`.
|
|
71
73
|
|
|
@@ -30,11 +30,11 @@ triggers: 构建优化,build optimizer,压缩,compress,WebP,pngquant,文件大
|
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
32
|
# 检查最终输出文件大小
|
|
33
|
-
playcraft image info --input dist/index.html --json # 不适用,用 shell
|
|
33
|
+
playcraft image info --input dist/preview/index.html --json # 不适用,用 shell
|
|
34
34
|
|
|
35
35
|
# Shell 方法:检查文件大小(字节)
|
|
36
|
-
du -sh dist/index.html
|
|
37
|
-
ls -lh dist/index.html
|
|
36
|
+
du -sh dist/preview/index.html
|
|
37
|
+
ls -lh dist/preview/index.html
|
|
38
38
|
|
|
39
39
|
# 计算:若当前原始资产总大小为 X MB
|
|
40
40
|
# 预计最终 HTML 大小 ≈ X × 1.33(Base64 膨胀)
|
|
@@ -112,34 +112,31 @@ grep -r "\.play()" game/ --include="*.js" --include="*.ts"
|
|
|
112
112
|
|
|
113
113
|
## 2. playcraft build 优化参数
|
|
114
114
|
|
|
115
|
+
- 产物固定为单文件 `dist/preview/index.html`,用于本地 review;在云工作区中它就是产物面板里的可玩预览。
|
|
116
|
+
- 下列参数只影响这份本地预览。渠道包(Meta、Google、AppLovin 等)只能通过平台导出生成,导出不会读取本地 build 的参数,渠道体积以导出时的校验为准。
|
|
117
|
+
|
|
115
118
|
### 完整优化构建命令
|
|
116
119
|
|
|
117
120
|
```bash
|
|
118
|
-
#
|
|
121
|
+
# 标准优化构建
|
|
119
122
|
playcraft build . \
|
|
120
|
-
--platform facebook \
|
|
121
123
|
--compress-images \
|
|
122
124
|
--image-quality 85 \
|
|
123
125
|
--convert-webp \
|
|
124
126
|
--js-minify \
|
|
125
|
-
--css-minify
|
|
126
|
-
--output dist/
|
|
127
|
+
--css-minify
|
|
127
128
|
|
|
128
129
|
# 带 3D 模型压缩的构建
|
|
129
130
|
playcraft build . \
|
|
130
|
-
--platform facebook \
|
|
131
131
|
--compress-images \
|
|
132
132
|
--image-quality 80 \
|
|
133
133
|
--convert-webp \
|
|
134
134
|
--compress-models \
|
|
135
135
|
--model-compression draco \
|
|
136
|
-
--js-minify
|
|
137
|
-
--output dist/
|
|
136
|
+
--js-minify
|
|
138
137
|
|
|
139
138
|
# 分析体积占用(不构建,只分析)
|
|
140
|
-
playcraft build .
|
|
141
|
-
--platform facebook \
|
|
142
|
-
--analyze
|
|
139
|
+
playcraft build . --analyze
|
|
143
140
|
```
|
|
144
141
|
|
|
145
142
|
### 图片优化参数
|
|
@@ -170,25 +167,6 @@ playcraft build . \
|
|
|
170
167
|
| `--js-minify` | 启用 JS 压缩(Terser + 混淆) |
|
|
171
168
|
| `--css-minify` | 启用 CSS 压缩 |
|
|
172
169
|
|
|
173
|
-
### 多平台批量构建
|
|
174
|
-
|
|
175
|
-
```bash
|
|
176
|
-
# 同时构建多个平台版本
|
|
177
|
-
playcraft build-all . \
|
|
178
|
-
--platforms facebook,google,applovin \
|
|
179
|
-
--compress-images \
|
|
180
|
-
--image-quality 85 \
|
|
181
|
-
--convert-webp \
|
|
182
|
-
--js-minify \
|
|
183
|
-
--output dist/
|
|
184
|
-
|
|
185
|
-
# 或按平台组
|
|
186
|
-
playcraft build-all . \
|
|
187
|
-
--group mainstream \ # 主流平台
|
|
188
|
-
--compress-images \
|
|
189
|
-
--convert-webp
|
|
190
|
-
```
|
|
191
|
-
|
|
192
170
|
---
|
|
193
171
|
|
|
194
172
|
## 3. 正确的优化执行顺序
|
|
@@ -207,9 +185,11 @@ playcraft build-all . \
|
|
|
207
185
|
↓
|
|
208
186
|
5. playcraft build --js-minify --css-minify — 代码压缩
|
|
209
187
|
↓
|
|
210
|
-
6.
|
|
188
|
+
6. 检查 dist/preview/index.html 大小(仅供参考,渠道体积以平台导出校验为准)
|
|
211
189
|
↓
|
|
212
190
|
7. 合规验证清单(§1)
|
|
191
|
+
↓
|
|
192
|
+
8. 通过平台导出生成各渠道包
|
|
213
193
|
```
|
|
214
194
|
|
|
215
195
|
**禁止行为**:
|
|
@@ -298,9 +278,9 @@ playcraft 3d optimize \
|
|
|
298
278
|
|
|
299
279
|
## 6. 常见审核被拒原因速查
|
|
300
280
|
|
|
301
|
-
| 被拒原因 | 占比 | 检查方法
|
|
302
|
-
| ----------------- | ---- |
|
|
303
|
-
| 文件大小超过 5 MB | 45% | `ls -lh dist/index.html` | `--compress-images --convert-webp` 或降低 image-quality |
|
|
304
|
-
| 包含外部请求 | 30% | `grep -r "https://"`
|
|
305
|
-
| CTA 未实现 | 15% | `grep "FbPlayableAd"`
|
|
306
|
-
| 音频自动播放 | 10% | `grep "autoplay"`
|
|
281
|
+
| 被拒原因 | 占比 | 检查方法 | 修复方法 |
|
|
282
|
+
| ----------------- | ---- | -------------------------------- | ------------------------------------------------------- |
|
|
283
|
+
| 文件大小超过 5 MB | 45% | `ls -lh dist/preview/index.html` | `--compress-images --convert-webp` 或降低 image-quality |
|
|
284
|
+
| 包含外部请求 | 30% | `grep -r "https://"` | Developer 将外部资源内嵌 |
|
|
285
|
+
| CTA 未实现 | 15% | `grep "FbPlayableAd"` | Developer 添加平台 CTA API |
|
|
286
|
+
| 音频自动播放 | 10% | `grep "autoplay"` | Developer 改为用户交互触发 |
|
|
@@ -30,11 +30,11 @@ triggers: 构建优化,build optimizer,压缩,compress,WebP,pngquant,文件大
|
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
32
|
# 检查最终输出文件大小
|
|
33
|
-
playcraft image info --input dist/index.html --json # 不适用,用 shell
|
|
33
|
+
playcraft image info --input dist/preview/index.html --json # 不适用,用 shell
|
|
34
34
|
|
|
35
35
|
# Shell 方法:检查文件大小(字节)
|
|
36
|
-
du -sh dist/index.html
|
|
37
|
-
ls -lh dist/index.html
|
|
36
|
+
du -sh dist/preview/index.html
|
|
37
|
+
ls -lh dist/preview/index.html
|
|
38
38
|
|
|
39
39
|
# 计算:若当前原始资产总大小为 X MB
|
|
40
40
|
# 预计最终 HTML 大小 ≈ X × 1.33(Base64 膨胀)
|
|
@@ -112,34 +112,31 @@ grep -r "\.play()" game/ --include="*.js" --include="*.ts"
|
|
|
112
112
|
|
|
113
113
|
## 2. playcraft build 优化参数
|
|
114
114
|
|
|
115
|
+
- 产物固定为单文件 `dist/preview/index.html`,用于本地 review;在云工作区中它就是产物面板里的可玩预览。
|
|
116
|
+
- 下列参数只影响这份本地预览。渠道包(Meta、Google、AppLovin 等)只能通过平台导出生成,导出不会读取本地 build 的参数,渠道体积以导出时的校验为准。
|
|
117
|
+
|
|
115
118
|
### 完整优化构建命令
|
|
116
119
|
|
|
117
120
|
```bash
|
|
118
|
-
#
|
|
121
|
+
# 标准优化构建
|
|
119
122
|
playcraft build . \
|
|
120
|
-
--platform facebook \
|
|
121
123
|
--compress-images \
|
|
122
124
|
--image-quality 85 \
|
|
123
125
|
--convert-webp \
|
|
124
126
|
--js-minify \
|
|
125
|
-
--css-minify
|
|
126
|
-
--output dist/
|
|
127
|
+
--css-minify
|
|
127
128
|
|
|
128
129
|
# 带 3D 模型压缩的构建
|
|
129
130
|
playcraft build . \
|
|
130
|
-
--platform facebook \
|
|
131
131
|
--compress-images \
|
|
132
132
|
--image-quality 80 \
|
|
133
133
|
--convert-webp \
|
|
134
134
|
--compress-models \
|
|
135
135
|
--model-compression draco \
|
|
136
|
-
--js-minify
|
|
137
|
-
--output dist/
|
|
136
|
+
--js-minify
|
|
138
137
|
|
|
139
138
|
# 分析体积占用(不构建,只分析)
|
|
140
|
-
playcraft build .
|
|
141
|
-
--platform facebook \
|
|
142
|
-
--analyze
|
|
139
|
+
playcraft build . --analyze
|
|
143
140
|
```
|
|
144
141
|
|
|
145
142
|
### 图片优化参数
|
|
@@ -170,25 +167,6 @@ playcraft build . \
|
|
|
170
167
|
| `--js-minify` | 启用 JS 压缩(Terser + 混淆) |
|
|
171
168
|
| `--css-minify` | 启用 CSS 压缩 |
|
|
172
169
|
|
|
173
|
-
### 多平台批量构建
|
|
174
|
-
|
|
175
|
-
```bash
|
|
176
|
-
# 同时构建多个平台版本
|
|
177
|
-
playcraft build-all . \
|
|
178
|
-
--platforms facebook,google,applovin \
|
|
179
|
-
--compress-images \
|
|
180
|
-
--image-quality 85 \
|
|
181
|
-
--convert-webp \
|
|
182
|
-
--js-minify \
|
|
183
|
-
--output dist/
|
|
184
|
-
|
|
185
|
-
# 或按平台组
|
|
186
|
-
playcraft build-all . \
|
|
187
|
-
--group mainstream \ # 主流平台
|
|
188
|
-
--compress-images \
|
|
189
|
-
--convert-webp
|
|
190
|
-
```
|
|
191
|
-
|
|
192
170
|
---
|
|
193
171
|
|
|
194
172
|
## 3. 正确的优化执行顺序
|
|
@@ -207,9 +185,11 @@ playcraft build-all . \
|
|
|
207
185
|
↓
|
|
208
186
|
5. playcraft build --js-minify --css-minify — 代码压缩
|
|
209
187
|
↓
|
|
210
|
-
6.
|
|
188
|
+
6. 检查 dist/preview/index.html 大小(仅供参考,渠道体积以平台导出校验为准)
|
|
211
189
|
↓
|
|
212
190
|
7. 合规验证清单(§1)
|
|
191
|
+
↓
|
|
192
|
+
8. 通过平台导出生成各渠道包
|
|
213
193
|
```
|
|
214
194
|
|
|
215
195
|
**禁止行为**:
|
|
@@ -298,9 +278,9 @@ playcraft 3d optimize \
|
|
|
298
278
|
|
|
299
279
|
## 6. 常见审核被拒原因速查
|
|
300
280
|
|
|
301
|
-
| 被拒原因 | 占比 | 检查方法
|
|
302
|
-
| ----------------- | ---- |
|
|
303
|
-
| 文件大小超过 5 MB | 45% | `ls -lh dist/index.html` | `--compress-images --convert-webp` 或降低 image-quality |
|
|
304
|
-
| 包含外部请求 | 30% | `grep -r "https://"`
|
|
305
|
-
| CTA 未实现 | 15% | `grep "FbPlayableAd"`
|
|
306
|
-
| 音频自动播放 | 10% | `grep "autoplay"`
|
|
281
|
+
| 被拒原因 | 占比 | 检查方法 | 修复方法 |
|
|
282
|
+
| ----------------- | ---- | -------------------------------- | ------------------------------------------------------- |
|
|
283
|
+
| 文件大小超过 5 MB | 45% | `ls -lh dist/preview/index.html` | `--compress-images --convert-webp` 或降低 image-quality |
|
|
284
|
+
| 包含外部请求 | 30% | `grep -r "https://"` | Developer 将外部资源内嵌 |
|
|
285
|
+
| CTA 未实现 | 15% | `grep "FbPlayableAd"` | Developer 添加平台 CTA API |
|
|
286
|
+
| 音频自动播放 | 10% | `grep "autoplay"` | Developer 改为用户交互触发 |
|