@ttmg/cli 0.4.5 → 0.4.6-vibe-beta.2
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 +169 -0
- package/dist/index.js +9591 -863
- package/dist/index.js.map +1 -1
- package/dist/package.json +21 -2
- package/dist/public/assets/{Card-BAsimNoh.js → Card-CN2lxY0Y.js} +1 -1
- package/dist/public/assets/{Detail-rVxbEDgh.js → Detail-CELZZ-4h.js} +1 -1
- package/dist/public/assets/Detail-CELZZ-4h.js.br +0 -0
- package/dist/public/assets/{MonetizationMode-B20TAE9o.js → MonetizationMode-C7DNqium.js} +1 -1
- package/dist/public/assets/{MonetizationModeSummary-CnHqXyco.js → MonetizationModeSummary-DYE7XUq1.js} +1 -1
- package/dist/public/assets/{SectionHeader-Cn3FnOqh.js → SectionHeader-BKc3BWXP.js} +1 -1
- package/dist/public/assets/{baseForm-kBTxn8h8.js → baseForm-I9suIiQn.js} +1 -1
- package/dist/public/assets/baseForm-I9suIiQn.js.br +0 -0
- package/dist/public/assets/{col-VN3Ivd-x.js → col-w9Q-2mgM.js} +1 -1
- package/dist/public/assets/{compass-BabZVjAl.js → compass-D6waJ52O.js} +1 -1
- package/dist/public/assets/{index-DHdJsD10.js → index-8sDAOAcS.js} +1 -1
- package/dist/public/assets/index-8sDAOAcS.js.br +0 -0
- package/dist/public/assets/{index-DK4IvdRl.js → index-B6hY5GdS.js} +1 -1
- package/dist/public/assets/{index-Cl0_vMWE.js → index-BIrFkB6r.js} +1 -1
- package/dist/public/assets/index-BIrFkB6r.js.br +0 -0
- package/dist/public/assets/{index-BjQlJrX7.js → index-BLWgpW64.js} +1 -1
- package/dist/public/assets/{index-odEI7YQF.js → index-BY3eQmfP.js} +1 -1
- package/dist/public/assets/index-BY3eQmfP.js.br +0 -0
- package/dist/public/assets/{index-Bjn0ctEd.js → index-BegU9LBT.js} +2 -2
- package/dist/public/assets/index-BegU9LBT.js.br +0 -0
- package/dist/public/assets/{index-1WjGwqIV.js → index-BqwflQml.js} +1 -1
- package/dist/public/assets/{index-DXDZCuG4.js → index-BrOFdVbv.js} +1 -1
- package/dist/public/assets/{index-BxsB5E3u.js → index-BvPolBSn.js} +1 -1
- package/dist/public/assets/{index-BnOeYQAd.js → index-BwrZjkCc.js} +1 -1
- package/dist/public/assets/{index-CUuX90R9.js → index-CLKKui8G.js} +1 -1
- package/dist/public/assets/{index-Dohibgdp.js → index-Cb4Ja0tZ.js} +1 -1
- package/dist/public/assets/{index-C83QHLmD.js → index-CcUgN29Y.js} +1 -1
- package/dist/public/assets/{index-aSl6Wdrp.js → index-CgXOkYrX.js} +1 -1
- package/dist/public/assets/index-CgXOkYrX.js.br +0 -0
- package/dist/public/assets/{index-DulANwbq.js → index-CsiIrLKY.js} +1 -1
- package/dist/public/assets/{index-Ba-JWe4X.js → index-Csmg5oyu.js} +1 -1
- package/dist/public/assets/{index-DnnfZ7H_.js → index-DDecPuod.js} +1 -1
- package/dist/public/assets/{index-Clq0hTDI.js → index-DDy4PkWT.js} +1 -1
- package/dist/public/assets/{index-DIcz5ciL.js → index-DEQ2hVPA.js} +1 -1
- package/dist/public/assets/index-DEQ2hVPA.js.br +0 -0
- package/dist/public/assets/{index-CpM8t743.js → index-DGkgqtgJ.js} +1 -1
- package/dist/public/assets/{index-QNLvejKK.js → index-FVHabbDB.js} +1 -1
- package/dist/public/assets/{index-CzXMNZL3.js → index-M8jf-YAZ.js} +1 -1
- package/dist/public/assets/{index-BxokHznc.js → index-Q0GC8Irj.js} +1 -1
- package/dist/public/assets/index-Q0GC8Irj.js.br +0 -0
- package/dist/public/assets/{index--6iHQzho.js → index-YVB9ZW00.js} +1 -1
- package/dist/public/assets/{index-O_L1tU2b.js → index-mjEeEQcC.js} +1 -1
- package/dist/public/assets/index-mjEeEQcC.js.br +0 -0
- package/dist/public/assets/{index-BFFsJ47B.js → index-rLkONFpx.js} +1 -1
- package/dist/public/assets/{layers-B4zhx14P.js → layers-Dbwq9AyL.js} +1 -1
- package/dist/public/assets/{list-checks-Br6imjXC.js → list-checks-og1usOZf.js} +1 -1
- package/dist/public/assets/{sparkles-BjIkcbAi.js → sparkles-p-dZbjGb.js} +1 -1
- package/dist/public/assets/{triangle-alert-CgKAc3w5.js → triangle-alert-BZVAEUiL.js} +1 -1
- package/dist/public/assets/{zap-DFHw5liD.js → zap-BAhZUPPa.js} +1 -1
- package/dist/public/index.html +1 -1
- package/dist/scripts/dev-default-smoke.js +67 -0
- package/dist/scripts/dev-game-ready-smoke.js +130 -0
- package/dist/scripts/run-ts-test.js +41 -0
- package/dist/scripts/verify-agent-contract.js +150 -0
- package/dist/scripts/worker.js +28 -22
- package/package.json +21 -2
- package/CHANGELOG.md +0 -277
- package/dist/public/assets/Detail-rVxbEDgh.js.br +0 -0
- package/dist/public/assets/baseForm-kBTxn8h8.js.br +0 -0
- package/dist/public/assets/index-Bjn0ctEd.js.br +0 -0
- package/dist/public/assets/index-BxokHznc.js.br +0 -0
- package/dist/public/assets/index-Cl0_vMWE.js.br +0 -0
- package/dist/public/assets/index-DHdJsD10.js.br +0 -0
- package/dist/public/assets/index-DIcz5ciL.js.br +0 -0
- package/dist/public/assets/index-O_L1tU2b.js.br +0 -0
- package/dist/public/assets/index-aSl6Wdrp.js.br +0 -0
- package/dist/public/assets/index-odEI7YQF.js.br +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
### @ttmg/cli
|
|
2
|
+
|
|
2
3
|
`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.
|
|
3
4
|
`ttmg` 是一款专为小游戏项目管理与开发设计的命令行工具,支持 H5 小游戏和原生小游戏的初始化、开发调试及打包构建。
|
|
5
|
+
|
|
4
6
|
#### Installation 安装
|
|
5
7
|
|
|
6
8
|
You can install `ttmg` globally or as a project dependency via npm:
|
|
@@ -26,6 +28,55 @@ Before running any `ttmg` commands, please log in with your TikTok account. Once
|
|
|
26
28
|
ttmg login
|
|
27
29
|
```
|
|
28
30
|
|
|
31
|
+
For Agent usage, implicit mode accepts credentials without terminal prompts,
|
|
32
|
+
keeps the existing `~/.ttmgrc` write behavior, and returns one JSON result on
|
|
33
|
+
stdout. The result never contains the password or session Cookie.
|
|
34
|
+
Agent 可使用 implicit 模式传入账号密码,无需终端交互;登录成功后继续按原逻辑写入 `~/.ttmgrc`,stdout 返回一个 JSON 结果,结果中不包含密码或会话 Cookie。
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
ttmg login --implicit --email <email> --password <password>
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
`TTMG_LOGIN_EMAIL` and `TTMG_LOGIN_PASSWORD` can replace the two credential
|
|
41
|
+
options when credentials are provided by the execution environment.
|
|
42
|
+
执行环境也可以通过 `TTMG_LOGIN_EMAIL` 和 `TTMG_LOGIN_PASSWORD` 提供凭据。
|
|
43
|
+
|
|
44
|
+
Inspect the reusable local session without exposing its Cookie. The status is
|
|
45
|
+
local-only; it does not make a network request. `--require-auth` is useful for
|
|
46
|
+
Agent preflight because it exits non-zero when login is missing.
|
|
47
|
+
可在不暴露 Cookie 的情况下读取本地会话是否可复用。该状态只检查本地配置,不发起网络请求;Agent 预检可增加 `--require-auth`,未登录时以非零状态退出。
|
|
48
|
+
|
|
49
|
+
```
|
|
50
|
+
ttmg auth status --format json
|
|
51
|
+
ttmg auth status --format json --require-auth
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Agents can discover the exact command and runtime capability surface before
|
|
55
|
+
acting. Unsupported device and Runtime features are explicitly reported as
|
|
56
|
+
`false`; commands that create a platform version are marked with
|
|
57
|
+
`platformWrite: true`.
|
|
58
|
+
Agent 可在执行前读取当前 CLI 的准确能力;尚未支持的设备和 Runtime 能力明确返回 `false`,会创建平台版本的命令明确标记 `platformWrite: true`。
|
|
59
|
+
|
|
60
|
+
```
|
|
61
|
+
ttmg capabilities --format json
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
#### Test Account 测试账号
|
|
65
|
+
|
|
66
|
+
Generate the TikTok authorization link and QR code for a Mini Game test account.
|
|
67
|
+
This command does not write to Developer Platform automatically; verify the
|
|
68
|
+
account in the project's Test User list after scanning.
|
|
69
|
+
为小游戏生成 TikTok 测试账号授权链接和二维码。该命令不会自动写入 Developer Platform;扫码后仍需在项目 Test User 列表确认账号状态。
|
|
70
|
+
|
|
71
|
+
```
|
|
72
|
+
ttmg test-account add --client-key <client-key>
|
|
73
|
+
ttmg test-account add --client-key <client-key> --format json
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The QR code is written to `.ttmg/test-account-<client-key>.png` by default. Use
|
|
77
|
+
`--qr-output <path>` to choose another path.
|
|
78
|
+
二维码默认写入 `.ttmg/test-account-<client-key>.png`,可通过 `--qr-output <path>` 指定其他路径。
|
|
79
|
+
|
|
29
80
|
#### Debugging 调试
|
|
30
81
|
|
|
31
82
|
- By default, debug native mini-games:
|
|
@@ -35,6 +86,124 @@ ttmg login
|
|
|
35
86
|
ttmg dev
|
|
36
87
|
```
|
|
37
88
|
|
|
89
|
+
For Agent usage, pass the Client Key explicitly, suppress the browser, and
|
|
90
|
+
request the session manifest plus NDJSON lifecycle events. The existing
|
|
91
|
+
interactive `ttmg dev` flow is unchanged.
|
|
92
|
+
Agent 调用时需显式传入 Client Key、禁止自动打开浏览器,并读取会话描述和 NDJSON 生命周期事件;原有交互式 `ttmg dev` 流程保持不变。
|
|
93
|
+
|
|
94
|
+
```
|
|
95
|
+
ttmg dev --client-key <client-key> --format json --events ndjson --no-open
|
|
96
|
+
ttmg dev --client-key <client-key> --format json --events ndjson --no-open --timeout 120
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The command writes `manifest.json`, `events.ndjson`, `actions.ndjson`,
|
|
100
|
+
`screenshots/`, `summary.json`, and `launch.png` under
|
|
101
|
+
`.ttmg/sessions/<session-id>/` by default. `launch.rawUrl` and
|
|
102
|
+
`launch.qrPayload` are identical. This beta exposes the local DevTool session
|
|
103
|
+
and client connection events. Compile events also include the normalized
|
|
104
|
+
project diagnostics produced by the existing checker. The existing runtime
|
|
105
|
+
`reportScene({ sceneId: 9999 })` signal is forwarded to the CLI as a
|
|
106
|
+
`GAME_READY` lifecycle event; a stopped session is only marked `passed` after
|
|
107
|
+
that evidence is observed. Device launch, runtime logs, screenshots, and
|
|
108
|
+
actions remain unavailable and are reported as `false` capabilities. The
|
|
109
|
+
manifest keeps `gameReady=false` until this path completes real-device
|
|
110
|
+
verification, while `gameReadyProtocol=true` only declares local protocol
|
|
111
|
+
support.
|
|
112
|
+
命令默认在 `.ttmg/sessions/<session-id>/` 写入 `manifest.json`、`events.ndjson`、`actions.ndjson`、`screenshots/`、`summary.json` 和 `launch.png`,其中 `launch.rawUrl` 与 `launch.qrPayload` 完全一致。本 beta 会把现有运行时 `reportScene({ sceneId: 9999 })` 信号旁路转发为 CLI 的 `GAME_READY` 生命周期事件;会话只有观察到该证据后才把 `summary.json` 写为 `passed`。设备直开、运行时日志、截图和操作仍返回 `false`,不伪造已支持状态。真实设备联调完成前,manifest 保持 `gameReady=false`,仅用 `gameReadyProtocol=true` 表示本地协议已经接通。
|
|
113
|
+
编译事件会同时包含现有检查器产生的标准化项目诊断,Agent 不需要再从拼接后的错误文本反推问题位置。
|
|
114
|
+
|
|
115
|
+
Structured sessions can be discovered, inspected, and safely stopped from a
|
|
116
|
+
new CLI process. Stop verifies that the recorded PID is a `ttmg dev` process
|
|
117
|
+
before sending SIGTERM.
|
|
118
|
+
结构化会话可以由新的 CLI 进程列出、查询和安全停止;停止前会确认 manifest 中记录的 PID 确实属于 `ttmg dev`,不会直接终止无法验证的进程。
|
|
119
|
+
|
|
120
|
+
```
|
|
121
|
+
ttmg dev session list --format json
|
|
122
|
+
ttmg dev session inspect <session-id> --format json
|
|
123
|
+
ttmg dev session events <session-id> --after <seq> --limit <count> --format json
|
|
124
|
+
ttmg dev session stop <session-id> --format json
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
#### Project Check 项目检查
|
|
128
|
+
|
|
129
|
+
Run the existing project, package-size, subpackage, path, and API checks without
|
|
130
|
+
starting DevTool or writing to Developer Platform. Text remains the default for
|
|
131
|
+
developers; Agents should request one JSON report.
|
|
132
|
+
无需启动 DevTool 或写入 Developer Platform,即可执行现有的项目配置、包体、分包、路径和 API 检查。开发者默认读取文本结果;Agent 使用单个 JSON 报告。
|
|
133
|
+
|
|
134
|
+
```
|
|
135
|
+
ttmg check
|
|
136
|
+
ttmg check --dir <game-dir> --format json
|
|
137
|
+
ttmg check --dir <game-dir> --format json --include-passed
|
|
138
|
+
ttmg check --dir <game-dir> --format json --fail-on warning
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
The JSON result includes a stable operation ID, overall status, counts, stable
|
|
142
|
+
diagnostic codes, severity, file locations, byte sizes, and help links. Errors
|
|
143
|
+
exit non-zero. Warnings do not block by default; use `--fail-on warning` in a
|
|
144
|
+
strict Agent or CI workflow.
|
|
145
|
+
JSON 结果包含稳定 operation ID、整体状态、数量汇总、稳定诊断码、严重级别、文件位置、字节数和帮助链接。错误默认以非零状态退出;warning 默认不阻断,严格的 Agent 或 CI 流程可增加 `--fail-on warning`。
|
|
146
|
+
|
|
147
|
+
Use the `--ai` option to add static Agent-debug readiness checks to the existing
|
|
148
|
+
checks. It currently detects a direct
|
|
149
|
+
`reportScene({ sceneId: 9999 })` checkpoint, reports the matching file and scan
|
|
150
|
+
coverage, and keeps `platformWrite: false`. Static detection proves integration
|
|
151
|
+
evidence only; real-device `GAME_READY` is still required.
|
|
152
|
+
使用 `--ai` option 可在现有检查之外增加 Agent 调试准备度检查。目前会静态识别直接的 `reportScene({ sceneId: 9999 })` 检查点,返回命中文件和扫描范围,并保持 `platformWrite: false`。静态检出只证明代码已接入,最终仍需真机收到 `GAME_READY`。
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
ttmg check --ai --dir <game-dir> --format json
|
|
156
|
+
ttmg check --ai --dir <game-dir> --format json --fail-on warning
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
Use the read-only doctor before debugging to inspect the CLI and Node version,
|
|
160
|
+
project detection, reusable local login, selected LAN hosts, and whether proxy
|
|
161
|
+
environment variables are present. Proxy values and session Cookies are never
|
|
162
|
+
returned.
|
|
163
|
+
调试前可执行只读 doctor,检查 CLI 与 Node 版本、工程识别、本地登录是否可复用、选中的局域网地址以及是否存在代理环境变量;结果不返回代理值或会话 Cookie。
|
|
164
|
+
|
|
165
|
+
```
|
|
166
|
+
ttmg doctor --dir <game-dir> --format json
|
|
167
|
+
ttmg doctor --dir <game-dir> --format json --fail-on warning
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
#### Structured Build 结构化构建
|
|
171
|
+
|
|
172
|
+
The existing native `ttmg build` default behavior is unchanged. Agents can
|
|
173
|
+
explicitly request a local structured build; artifacts are written outside the
|
|
174
|
+
game project under `~/__TTMG__/build/<operation-id>/`, and no platform write is
|
|
175
|
+
performed.
|
|
176
|
+
现有 Native `ttmg build` 默认行为不变。Agent 可显式执行本地结构化构建;产物写入游戏工程外的 `~/__TTMG__/build/<operation-id>/`,不会写入平台。
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
ttmg build --dir <game-dir> --format json
|
|
180
|
+
ttmg build --dir <game-dir> --format json --include-passed
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
The report includes duration, engine, source size, package summaries, output
|
|
184
|
+
directory, package manifest, normalized diagnostics, and
|
|
185
|
+
`platformWrite: false`.
|
|
186
|
+
结果包含耗时、引擎、源码大小、各包摘要、产物目录、package manifest、标准化诊断以及 `platformWrite: false`。
|
|
187
|
+
|
|
188
|
+
#### Platform Preview Upload 平台预览版本上传
|
|
189
|
+
|
|
190
|
+
The upload command packages the project and creates a new Developer Platform
|
|
191
|
+
version. With `--preview`, it also waits for platform processing and returns the
|
|
192
|
+
preview payload.
|
|
193
|
+
上传命令会打包项目并在 Developer Platform 创建新版本;增加 `--preview` 后还会等待平台处理完成并返回预览地址。
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
ttmg upload --preview --client-key <client-key> --dir <game-dir> --format ndjson
|
|
197
|
+
```
|
|
198
|
+
|
|
199
|
+
The NDJSON states are `precheck`, `packaging`, `uploading`,
|
|
200
|
+
`processing`, and `ready` or `failed`. A ready result includes `previewUrl`,
|
|
201
|
+
the identical `qrPayload`, the platform version URL, and `platformWrite: true`.
|
|
202
|
+
During platform processing, `platformStatus` uses readable values such as
|
|
203
|
+
`waiting_for_asset`, `pending`, `processing`, `success`, and `failed`; the
|
|
204
|
+
optional `platformStatusRaw` retains the original platform enum for debugging.
|
|
205
|
+
NDJSON 状态依次为 `precheck`、`packaging`、`uploading`、`processing`,最终进入 `ready` 或 `failed`。平台处理阶段的 `platformStatus` 使用 `waiting_for_asset`、`pending`、`processing`、`success`、`failed` 等可读值;可选的 `platformStatusRaw` 仅保留平台原始枚举用于排障。成功结果包含 `previewUrl`、与其一致的 `qrPayload`、平台版本地址和 `platformWrite: true`。
|
|
206
|
+
|
|
38
207
|
- 调试 H5 小游戏:
|
|
39
208
|
- To debug H5 mini-games:
|
|
40
209
|
ttmg dev --h5
|