@ttmg/cli 0.4.6-agent-beta.1 → 0.4.6-agent-beta.3
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 +119 -12
- package/dist/index.js +1371 -165
- package/dist/index.js.map +1 -1
- package/dist/package.json +9 -6
- package/dist/scripts/dev-default-smoke.js +22 -1
- package/dist/scripts/verify-agent-contract.js +70 -2
- package/dist/scripts/vibe-auth-open-test-preload.cjs +11 -0
- package/dist/scripts/vibe-ppe-test-preload.cjs +16 -2
- package/dist/scripts/vibe-upload-smoke.js +243 -7
- package/dist/scripts/wasm-collect-smoke.js +78 -0
- package/dist/scripts/wasm-collect-test-preload.cjs +13 -0
- package/package.json +9 -6
- package/vibe-upload.md +358 -0
package/README.md
CHANGED
|
@@ -1,10 +1,45 @@
|
|
|
1
1
|
### @ttmg/cli
|
|
2
2
|
|
|
3
|
+
Vibe 真实网页授权与上传:`ttmg upload --vibe --web --dir ./game --title "My game" --icon ./avatar.png --format ndjson`。只向用户收集标题和本地头像,并使用游戏目录或代码包;其他应用资料由 CLI 使用既有 PPE 试用默认值补齐,不需要用户填写。网页授权后,CLI 自动继续上传。见 [Vibe 接入说明](vibe-upload.md)。
|
|
4
|
+
|
|
5
|
+
Vibe real web authorization and upload: use `--web` with the title, local icon and game directory or ZIP. Collect only the title and icon from the user; the CLI fills other app metadata with existing PPE trial defaults. Upload continues after browser authorization. See [Vibe integration](vibe-upload.md).
|
|
6
|
+
|
|
3
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.
|
|
4
8
|
`ttmg` 是一款专为小游戏项目管理与开发设计的命令行工具,支持 H5 小游戏和原生小游戏的初始化、开发调试及打包构建。
|
|
5
9
|
|
|
6
10
|
#### Installation 安装
|
|
7
11
|
|
|
12
|
+
`0.4.6-vibe-beta.14` 支持分类查询与可选上传分类参数。Skill 可用 `ttmg game categories --format json` 查询,再向 Vibe 上传传入 `--category Puzzle --subcategory Physics`。两个参数都省略时保留 Other/Other;详见 [分类用法](vibe-upload.md)。
|
|
13
|
+
|
|
14
|
+
`0.4.6-vibe-beta.14` supports category discovery and optional upload classification. Query `ttmg game categories --format json`, then pass `--category Puzzle --subcategory Physics` to Vibe upload. Omitting both preserves Other/Other. See [category usage](vibe-upload.md).
|
|
15
|
+
|
|
16
|
+
For Vibe Web authorization and upload, install the `vibe-beta` release:
|
|
17
|
+
Vibe 网页授权上传安装 `vibe-beta` 版本:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
npm install -g @ttmg/cli@vibe-beta
|
|
21
|
+
ttmg --version
|
|
22
|
+
ttmg capabilities --format json
|
|
23
|
+
ttmg upload --help
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
The package includes [vibe-upload.md](vibe-upload.md). Keep the Web upload process running during authorization and read NDJSON until a terminal event. The `beta` and `vibe-beta` tags point to different published versions.
|
|
27
|
+
安装包包含 [vibe-upload.md](vibe-upload.md)。授权期间保持原 Web 上传进程运行,持续读取 NDJSON,直到收到终态。`beta` 与 `vibe-beta` 指向不同发布版本。
|
|
28
|
+
|
|
29
|
+
For Agent and Monetization workflows, the published beta is:
|
|
30
|
+
Agent、商业化流程的已发布 beta 为:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
npm install -g @ttmg/cli@0.4.6-agent-beta.3
|
|
34
|
+
ttmg --version
|
|
35
|
+
ttmg capabilities --format json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
This version uses `ttmg-pack@0.4.13`. The unversioned installation below uses
|
|
39
|
+
the stable `latest` release and does not select this beta.
|
|
40
|
+
本版依赖正式版 `ttmg-pack@0.4.13`。下方不指定版本的安装命令使用稳定版
|
|
41
|
+
`latest`,不会安装本次 beta。
|
|
42
|
+
|
|
8
43
|
The Wasm split binding loads only when preparing or splitting Unity Wasm. A
|
|
9
44
|
missing platform binding does not block CLI startup or unrelated commands.
|
|
10
45
|
The split dependency `@anrans001/ttmg-wasmtool@0.3.3` provides Linux x64/arm64
|
|
@@ -29,23 +64,29 @@ npm install @ttmg/cli --save-dev
|
|
|
29
64
|
|
|
30
65
|
#### Login 登录
|
|
31
66
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
67
|
+
To open an existing Vibe task in the system browser, use the `pageUrl` from its
|
|
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`,
|
|
73
|
+
执行 `ttmg auth open --page-url <pageUrl> --format json`。保持原上传进程运行;
|
|
74
|
+
新命令在 CLI 所在电脑打开系统浏览器,不新建任务,`open_requested` 不代表授权成功。
|
|
75
|
+
`--web` 已自动打开授权页;上述辅助命令只用于重新打开同一任务的授权页。
|
|
76
|
+
|
|
77
|
+
`ttmg upload --vibe --web` uses real browser authorization and uploads to PPE without a prior platform login or environment setup. `--mock` is a separate demo: task creation/polling are real, but authorization and material uploads are simulated. See [Vibe binding/upload](vibe-upload.md) for schema-v2 results.
|
|
78
|
+
`ttmg upload --vibe --web` 无需预先平台登录或配置环境,使用真实浏览器授权并上传到 PPE。`--mock` 是独立演示:真实创建/查询任务,模拟授权和素材上传。详见 [Vibe 绑定上传](vibe-upload.md)。
|
|
38
79
|
|
|
39
80
|
`--mock` 现在会真实创建 PPE 任务,不再表示全程离线;真实请求失败仍报错。
|
|
40
81
|
上线时由 CLI 发布版本去掉 PPE 路由,Skill 无需承担环境切换。
|
|
41
82
|
`--mock` now creates real PPE tasks, not a fully offline run. Real request failures
|
|
42
83
|
still fail. Production routing is a future CLI release change, not Skill configuration.
|
|
43
84
|
|
|
44
|
-
|
|
45
|
-
|
|
85
|
+
当前上传只需要标题、头像和游戏目录或代码包,其他应用资料由 CLI 使用既有 PPE 试用默认值补齐。Skill 读取 `inputRequirements`,不向用户索要额外资料;本地预检使用 `--dry-run`。
|
|
86
|
+
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.
|
|
46
87
|
|
|
47
|
-
For the existing authenticated platform workflow, log in first;
|
|
48
|
-
|
|
88
|
+
For the existing authenticated platform workflow, log in first; Vibe Web upload uses its own browser authorization.
|
|
89
|
+
原有需要平台鉴权的流程仍先登录;Vibe Web 上传使用本次任务的浏览器授权。
|
|
49
90
|
|
|
50
91
|
```
|
|
51
92
|
ttmg login
|
|
@@ -196,9 +237,70 @@ ttmg dev session stop <SESSION_ID> --format json
|
|
|
196
237
|
|
|
197
238
|
### Wasm prepare and split / Wasm 准备与分包
|
|
198
239
|
|
|
240
|
+
#### Platform collection commands (agent-beta.3) / 平台采集命令
|
|
241
|
+
|
|
242
|
+
Install `0.4.6-agent-beta.3` and check `commands.wasmCollect` in `ttmg capabilities`.
|
|
243
|
+
The CLI uses its own `ttmg login` session; do not pass or read Cookie values in
|
|
244
|
+
Agent prompts, arguments or local HTTP requests. No running DevTool server is required.
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
ttmg wasm prepare --input original.wasm.br --output .ttmg/wasm/prepared --format json
|
|
248
|
+
# Use prepare's input.wasmMd5 for <MD5> and configure the instrumented game
|
|
249
|
+
# to report that same original MD5 and Client Key.
|
|
250
|
+
ttmg wasm collect start --client-key <CLIENT_KEY> --wasm-md5 <MD5> --format json
|
|
251
|
+
# Integrate the prepared copy, scan, clear device storage and play the game.
|
|
252
|
+
ttmg wasm collect export --client-key <CLIENT_KEY> --wasm-md5 <MD5> \
|
|
253
|
+
--input original.wasm.br --output .ttmg/wasm/collection.json --format json
|
|
254
|
+
ttmg wasm split --input original.wasm.br --collection .ttmg/wasm/collection.json --output .ttmg/wasm/split --format json
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
Run these examples at the game project root. Keep collection and temporary
|
|
258
|
+
artifacts outside the project or under its root `.ttmg`; an ordinary JSON file
|
|
259
|
+
in game assets can be included in future builds and uploads.
|
|
260
|
+
`start` opens or resumes a window and preserves existing IDs by default.
|
|
261
|
+
`--reset` clears platform collection for this game and MD5; it does not clear
|
|
262
|
+
phone storage. On an uncertain start or timeout, retry without `--reset`.
|
|
263
|
+
`export` reads a union snapshot without closing the window. It needs the original
|
|
264
|
+
Wasm, validates the collection MD5 against its file bytes or uncompressed bytes,
|
|
265
|
+
and writes schema 1 with the uncompressed `wasmSha256`, `funcIds` and `bootFuncIds`.
|
|
266
|
+
Read the file at the returned `collection.path`. Existing files are rejected;
|
|
267
|
+
use a new output name for each snapshot. Credentials and raw API responses are
|
|
268
|
+
omitted even with `--verbose`.
|
|
269
|
+
|
|
270
|
+
Only `start` writes platform state. `export` only reads collection and writes a
|
|
271
|
+
local file. Neither command changes Unity files or clears device storage.
|
|
272
|
+
Platform requests default to 30 seconds (`--timeout`, 1–300). Missing or expired
|
|
273
|
+
login returns `WASM_AUTH_REQUIRED`; empty collection returns `WASM_COLLECTION_EMPTY`;
|
|
274
|
+
an unmatched original returns `WASM_COLLECTION_MISMATCH`. No file is published on
|
|
275
|
+
these failures. A nonempty collection does not prove gameplay coverage.
|
|
276
|
+
The commands reuse the existing platform request environment; local fixture
|
|
277
|
+
tests do not establish real platform or device acceptance.
|
|
278
|
+
|
|
279
|
+
安装 `0.4.6-agent-beta.3`,通过 `ttmg capabilities` 中的 `commands.wasmCollect` 确认支持。
|
|
280
|
+
CLI 内部复用 `ttmg login` 登录态,无需运行 DevTool 本地服务,Agent 不读取或传递 Cookie。
|
|
281
|
+
按上方命令执行:prepare → 开采集窗口 → 接入插桩副本并扫码、清存储、玩游戏 → export → split。
|
|
282
|
+
`<MD5>` 使用 prepare 返回的 `input.wasmMd5`,插桩游戏须上报相同的原始 MD5 和 Client Key。
|
|
283
|
+
|
|
284
|
+
示例在游戏工程根目录执行。采集文件和临时产物应放工程外或根目录 `.ttmg` 下;
|
|
285
|
+
放在普通游戏资源目录的 JSON 会参与后续构建和上传。
|
|
286
|
+
`start` 默认保留已有函数 ID;只有 `--reset` 清空平台上此游戏、此 MD5 的历史采集,
|
|
287
|
+
不会清理手机存储。超时或不确定是否成功时,不带 `--reset` 重试。
|
|
288
|
+
`export` 读取当前合集快照,不关闭采集窗口;必须提供原始 Wasm,命令校验文件字节或
|
|
289
|
+
解压后字节的 MD5,再写入 schema 1、解压后原始 `wasmSha256`、`funcIds` 和 `bootFuncIds`。
|
|
290
|
+
从返回的 `collection.path` 读取文件;已有文件不覆盖,每轮快照使用新文件名。
|
|
291
|
+
即使开启 `--verbose`,也不输出登录凭证或原始接口响应。
|
|
292
|
+
|
|
293
|
+
仅 `start` 写平台状态;`export` 只读平台并写本地文件。两者均不写回 Unity 工程或清理手机存储。
|
|
294
|
+
请求默认超时 30 秒,`--timeout` 范围为 1–300 秒。未登录或登录过期返回 `WASM_AUTH_REQUIRED`,
|
|
295
|
+
空采集返回 `WASM_COLLECTION_EMPTY`,原始文件不匹配返回 `WASM_COLLECTION_MISMATCH`;
|
|
296
|
+
这些失败不会生成采集文件。非空结果不等于玩法覆盖完整。
|
|
297
|
+
命令沿用现有平台请求环境;本地模拟测试不代表真实平台或真机验收。
|
|
298
|
+
|
|
299
|
+
#### Local artifacts / 本地产物
|
|
300
|
+
|
|
199
301
|
```bash
|
|
200
|
-
ttmg wasm prepare --input original.wasm.br --output prepared --format json
|
|
201
|
-
ttmg wasm split --input original.wasm.br --collection collection.json --output split --format json
|
|
302
|
+
ttmg wasm prepare --input original.wasm.br --output .ttmg/wasm/prepared --format json
|
|
303
|
+
ttmg wasm split --input original.wasm.br --collection .ttmg/wasm/collection.json --output .ttmg/wasm/split --format json
|
|
202
304
|
```
|
|
203
305
|
|
|
204
306
|
These experimental commands create artifacts in a new directory; they do not
|
|
@@ -369,12 +471,17 @@ specified with `--evidence-dir`. Screenshot output prints the saved file path;
|
|
|
369
471
|
use `--output <path>` for a custom destination. Log follow ends after 30 seconds
|
|
370
472
|
by default without stopping preview; the owner terminal streams logs until you
|
|
371
473
|
stop preview with Ctrl+C. Both logs and screenshots require a compatible client.
|
|
474
|
+
Keep custom evidence outside the project or under its root `.ttmg` directory;
|
|
475
|
+
other in-project destinations fail before the session starts. CLI state is
|
|
476
|
+
excluded from game builds, package-size checks and directory uploads.
|
|
372
477
|
快捷命令自动找到当前工程(含子目录)唯一的运行中真机预览会话;多个会话时列出
|
|
373
478
|
候选,需用 `--session <session-id>` 明确选择,不会自动连接任意设备。
|
|
374
479
|
自定义证据目录使用 `--sessions-dir <path>`,可以指定会话集合目录或启动时的
|
|
375
480
|
`--evidence-dir`。截图完成后输出本地保存路径,支持 `--output <path>`。
|
|
376
481
|
`logs --follow` 默认读取 30 秒后退出,不停止预览;主终端持续输出日志,Ctrl+C
|
|
377
482
|
停止预览。日志和截图均需要客户端支持对应协议。
|
|
483
|
+
自定义证据目录须位于工程外或工程根目录的 `.ttmg` 下;其他工程内目录会在启动前
|
|
484
|
+
被拒绝。CLI 状态目录不进入游戏构建、包体积检查和目录上传。
|
|
378
485
|
|
|
379
486
|
For automation, use `dev logs --format json`, `dev logs --follow --format ndjson`,
|
|
380
487
|
or `dev screenshot --format json`. Successful results reuse the existing
|