@ttmg/cli 0.4.6-vibe-beta.14 → 0.4.6-vibe-beta.16
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 +74 -29
- package/dist/index.js +414 -121
- package/dist/index.js.map +1 -1
- package/dist/package.json +2 -2
- package/dist/scripts/verify-agent-contract.js +16 -2
- package/dist/scripts/vibe-upload-smoke.js +60 -20
- package/dist/scripts/wasm-collect-smoke.js +78 -0
- package/dist/scripts/wasm-collect-test-preload.cjs +13 -0
- package/package.json +2 -2
- package/vibe-upload.md +97 -245
package/README.md
CHANGED
|
@@ -1,36 +1,32 @@
|
|
|
1
1
|
### @ttmg/cli
|
|
2
2
|
|
|
3
|
-
Vibe
|
|
3
|
+
Vibe 手机扫码授权与上传:`ttmg upload --vibe --dir ./game --title "My game" --icon ./avatar.png --format ndjson`。用户在手机 TikTok 扫码授权后,原命令自动上传。只收集标题和本地头像,并使用游戏目录或代码包;其他应用资料由 CLI 补齐。页面展示标题、头像、描述、类型和子类型。见 [Vibe 接入说明](vibe-upload.md)。
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
扫码上传使用 `0.4.6-vibe-beta.16`,安装后核对版本与能力声明。扫码链路已用 PPE 测试素材完成真实上传;正式环境未开放。
|
|
6
6
|
|
|
7
7
|
`ttmg` is a command-line tool designed for managing and developing mini-game projects. It supports initialization, development, debugging, and packaging for both H5 and native mini-games.
|
|
8
8
|
`ttmg` 是一款专为小游戏项目管理与开发设计的命令行工具,支持 H5 小游戏和原生小游戏的初始化、开发调试及打包构建。
|
|
9
9
|
|
|
10
10
|
#### Installation 安装
|
|
11
11
|
|
|
12
|
-
|
|
12
|
+
Vibe 版本支持手机扫码授权上传、可选 `--description`、分类查询及 `--category / --subcategory`。默认描述为 `Discover the fun of TikTok Mini Games.`,默认分类为 Other/Other。完整流程见 [Quick Start](vibe-upload.md)。
|
|
13
13
|
|
|
14
|
-
`
|
|
15
|
-
|
|
16
|
-
For Vibe Web authorization and upload, install the `vibe-beta` release:
|
|
17
|
-
Vibe 网页授权上传安装 `vibe-beta` 版本:
|
|
14
|
+
固定版本安装(发布标签为 `vibe-beta`):
|
|
18
15
|
|
|
19
16
|
```bash
|
|
20
|
-
npm install -g @ttmg/cli@vibe-beta
|
|
17
|
+
npm install -g @ttmg/cli@0.4.6-vibe-beta.16
|
|
21
18
|
ttmg --version
|
|
22
19
|
ttmg capabilities --format json
|
|
23
20
|
ttmg upload --help
|
|
24
21
|
```
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
安装包包含 [vibe-upload.md](vibe-upload.md)。授权期间保持原 Web 上传进程运行,持续读取 NDJSON,直到收到终态。`beta` 与 `vibe-beta` 指向不同发布版本。
|
|
23
|
+
安装包包含 [vibe-upload.md](vibe-upload.md)。授权期间保持原上传进程运行,持续读取 NDJSON,直到收到终态。`beta` 与 `vibe-beta` 指向不同发布版本。
|
|
28
24
|
|
|
29
25
|
For Agent and Monetization workflows, the published beta is:
|
|
30
26
|
Agent、商业化流程的已发布 beta 为:
|
|
31
27
|
|
|
32
28
|
```bash
|
|
33
|
-
npm install -g @ttmg/cli@0.4.6-agent-beta.
|
|
29
|
+
npm install -g @ttmg/cli@0.4.6-agent-beta.3
|
|
34
30
|
ttmg --version
|
|
35
31
|
ttmg capabilities --format json
|
|
36
32
|
```
|
|
@@ -64,29 +60,17 @@ npm install @ttmg/cli --save-dev
|
|
|
64
60
|
|
|
65
61
|
#### Login 登录
|
|
66
62
|
|
|
67
|
-
|
|
68
|
-
`waiting_authorization` event: `ttmg auth open --page-url <pageUrl> --format json`.
|
|
69
|
-
Keep the upload process running; this command creates no task and reports only
|
|
70
|
-
`open_requested`, not authorization success. It runs on the CLI computer.
|
|
71
|
-
|
|
72
|
-
Skill 如需手动打开网页授权,读取上传进程 `waiting_authorization` 事件的 `pageUrl`,
|
|
63
|
+
Skill 如需重新打开二维码页,读取上传进程 `waiting_authorization` 事件的 `pageUrl`,
|
|
73
64
|
执行 `ttmg auth open --page-url <pageUrl> --format json`。保持原上传进程运行;
|
|
74
65
|
新命令在 CLI 所在电脑打开系统浏览器,不新建任务,`open_requested` 不代表授权成功。
|
|
75
|
-
|
|
66
|
+
该命令只打开同一任务的本地二维码页,用户仍需手机扫码。
|
|
76
67
|
|
|
77
|
-
`ttmg upload --vibe
|
|
78
|
-
`ttmg upload --vibe --web` 无需预先平台登录或配置环境,使用真实浏览器授权并上传到 PPE。`--mock` 是独立演示:真实创建/查询任务,模拟授权和素材上传。详见 [Vibe 绑定上传](vibe-upload.md)。
|
|
79
|
-
|
|
80
|
-
`--mock` 现在会真实创建 PPE 任务,不再表示全程离线;真实请求失败仍报错。
|
|
81
|
-
上线时由 CLI 发布版本去掉 PPE 路由,Skill 无需承担环境切换。
|
|
82
|
-
`--mock` now creates real PPE tasks, not a fully offline run. Real request failures
|
|
83
|
-
still fail. Production routing is a future CLI release change, not Skill configuration.
|
|
68
|
+
`ttmg upload --vibe` 无需预先平台登录或配置环境,使用手机 TikTok 扫码授权并上传到 PPE。详见 [Vibe 绑定上传](vibe-upload.md)。
|
|
84
69
|
|
|
85
70
|
当前上传只需要标题、头像和游戏目录或代码包,其他应用资料由 CLI 使用既有 PPE 试用默认值补齐。Skill 读取 `inputRequirements`,不向用户索要额外资料;本地预检使用 `--dry-run`。
|
|
86
71
|
Current uploads need only the title, icon and game directory or ZIP. The CLI fills other metadata with existing PPE trial defaults. Read `inputRequirements` and do not request extra fields. Use `--dry-run` for local preparation.
|
|
87
72
|
|
|
88
|
-
|
|
89
|
-
原有需要平台鉴权的流程仍先登录;Vibe Web 上传使用本次任务的浏览器授权。
|
|
73
|
+
原有需要平台鉴权的流程仍先登录;Vibe 上传使用本次任务的手机扫码授权。
|
|
90
74
|
|
|
91
75
|
```
|
|
92
76
|
ttmg login
|
|
@@ -237,9 +221,70 @@ ttmg dev session stop <SESSION_ID> --format json
|
|
|
237
221
|
|
|
238
222
|
### Wasm prepare and split / Wasm 准备与分包
|
|
239
223
|
|
|
224
|
+
#### Platform collection commands (agent-beta.3) / 平台采集命令
|
|
225
|
+
|
|
226
|
+
Install `0.4.6-agent-beta.3` and check `commands.wasmCollect` in `ttmg capabilities`.
|
|
227
|
+
The CLI uses its own `ttmg login` session; do not pass or read Cookie values in
|
|
228
|
+
Agent prompts, arguments or local HTTP requests. No running DevTool server is required.
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
ttmg wasm prepare --input original.wasm.br --output .ttmg/wasm/prepared --format json
|
|
232
|
+
# Use prepare's input.wasmMd5 for <MD5> and configure the instrumented game
|
|
233
|
+
# to report that same original MD5 and Client Key.
|
|
234
|
+
ttmg wasm collect start --client-key <CLIENT_KEY> --wasm-md5 <MD5> --format json
|
|
235
|
+
# Integrate the prepared copy, scan, clear device storage and play the game.
|
|
236
|
+
ttmg wasm collect export --client-key <CLIENT_KEY> --wasm-md5 <MD5> \
|
|
237
|
+
--input original.wasm.br --output .ttmg/wasm/collection.json --format json
|
|
238
|
+
ttmg wasm split --input original.wasm.br --collection .ttmg/wasm/collection.json --output .ttmg/wasm/split --format json
|
|
239
|
+
```
|
|
240
|
+
|
|
241
|
+
Run these examples at the game project root. Keep collection and temporary
|
|
242
|
+
artifacts outside the project or under its root `.ttmg`; an ordinary JSON file
|
|
243
|
+
in game assets can be included in future builds and uploads.
|
|
244
|
+
`start` opens or resumes a window and preserves existing IDs by default.
|
|
245
|
+
`--reset` clears platform collection for this game and MD5; it does not clear
|
|
246
|
+
phone storage. On an uncertain start or timeout, retry without `--reset`.
|
|
247
|
+
`export` reads a union snapshot without closing the window. It needs the original
|
|
248
|
+
Wasm, validates the collection MD5 against its file bytes or uncompressed bytes,
|
|
249
|
+
and writes schema 1 with the uncompressed `wasmSha256`, `funcIds` and `bootFuncIds`.
|
|
250
|
+
Read the file at the returned `collection.path`. Existing files are rejected;
|
|
251
|
+
use a new output name for each snapshot. Credentials and raw API responses are
|
|
252
|
+
omitted even with `--verbose`.
|
|
253
|
+
|
|
254
|
+
Only `start` writes platform state. `export` only reads collection and writes a
|
|
255
|
+
local file. Neither command changes Unity files or clears device storage.
|
|
256
|
+
Platform requests default to 30 seconds (`--timeout`, 1–300). Missing or expired
|
|
257
|
+
login returns `WASM_AUTH_REQUIRED`; empty collection returns `WASM_COLLECTION_EMPTY`;
|
|
258
|
+
an unmatched original returns `WASM_COLLECTION_MISMATCH`. No file is published on
|
|
259
|
+
these failures. A nonempty collection does not prove gameplay coverage.
|
|
260
|
+
The commands reuse the existing platform request environment; local fixture
|
|
261
|
+
tests do not establish real platform or device acceptance.
|
|
262
|
+
|
|
263
|
+
安装 `0.4.6-agent-beta.3`,通过 `ttmg capabilities` 中的 `commands.wasmCollect` 确认支持。
|
|
264
|
+
CLI 内部复用 `ttmg login` 登录态,无需运行 DevTool 本地服务,Agent 不读取或传递 Cookie。
|
|
265
|
+
按上方命令执行:prepare → 开采集窗口 → 接入插桩副本并扫码、清存储、玩游戏 → export → split。
|
|
266
|
+
`<MD5>` 使用 prepare 返回的 `input.wasmMd5`,插桩游戏须上报相同的原始 MD5 和 Client Key。
|
|
267
|
+
|
|
268
|
+
示例在游戏工程根目录执行。采集文件和临时产物应放工程外或根目录 `.ttmg` 下;
|
|
269
|
+
放在普通游戏资源目录的 JSON 会参与后续构建和上传。
|
|
270
|
+
`start` 默认保留已有函数 ID;只有 `--reset` 清空平台上此游戏、此 MD5 的历史采集,
|
|
271
|
+
不会清理手机存储。超时或不确定是否成功时,不带 `--reset` 重试。
|
|
272
|
+
`export` 读取当前合集快照,不关闭采集窗口;必须提供原始 Wasm,命令校验文件字节或
|
|
273
|
+
解压后字节的 MD5,再写入 schema 1、解压后原始 `wasmSha256`、`funcIds` 和 `bootFuncIds`。
|
|
274
|
+
从返回的 `collection.path` 读取文件;已有文件不覆盖,每轮快照使用新文件名。
|
|
275
|
+
即使开启 `--verbose`,也不输出登录凭证或原始接口响应。
|
|
276
|
+
|
|
277
|
+
仅 `start` 写平台状态;`export` 只读平台并写本地文件。两者均不写回 Unity 工程或清理手机存储。
|
|
278
|
+
请求默认超时 30 秒,`--timeout` 范围为 1–300 秒。未登录或登录过期返回 `WASM_AUTH_REQUIRED`,
|
|
279
|
+
空采集返回 `WASM_COLLECTION_EMPTY`,原始文件不匹配返回 `WASM_COLLECTION_MISMATCH`;
|
|
280
|
+
这些失败不会生成采集文件。非空结果不等于玩法覆盖完整。
|
|
281
|
+
命令沿用现有平台请求环境;本地模拟测试不代表真实平台或真机验收。
|
|
282
|
+
|
|
283
|
+
#### Local artifacts / 本地产物
|
|
284
|
+
|
|
240
285
|
```bash
|
|
241
|
-
ttmg wasm prepare --input original.wasm.br --output prepared --format json
|
|
242
|
-
ttmg wasm split --input original.wasm.br --collection collection.json --output split --format json
|
|
286
|
+
ttmg wasm prepare --input original.wasm.br --output .ttmg/wasm/prepared --format json
|
|
287
|
+
ttmg wasm split --input original.wasm.br --collection .ttmg/wasm/collection.json --output .ttmg/wasm/split --format json
|
|
243
288
|
```
|
|
244
289
|
|
|
245
290
|
These experimental commands create artifacts in a new directory; they do not
|