@ttmg/cli 0.4.6-vibe-beta.24 → 0.4.6

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.
Files changed (72) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/README.md +46 -17
  3. package/dist/index.js +312 -134
  4. package/dist/index.js.map +1 -1
  5. package/dist/package.json +8 -4
  6. package/dist/public/assets/{Card-CN2lxY0Y.js → Card-D4FjfZC9.js} +1 -1
  7. package/dist/public/assets/{Detail-CELZZ-4h.js → Detail-m3nH8XXe.js} +1 -1
  8. package/dist/public/assets/Detail-m3nH8XXe.js.br +0 -0
  9. package/dist/public/assets/{MonetizationMode-C7DNqium.js → MonetizationMode-1rShmN0o.js} +1 -1
  10. package/dist/public/assets/{MonetizationModeSummary-DYE7XUq1.js → MonetizationModeSummary-CVfWOth1.js} +1 -1
  11. package/dist/public/assets/{SectionHeader-BKc3BWXP.js → SectionHeader-CAuUcT9Q.js} +1 -1
  12. package/dist/public/assets/{baseForm-I9suIiQn.js → baseForm-C3PqJ30b.js} +1 -1
  13. package/dist/public/assets/baseForm-C3PqJ30b.js.br +0 -0
  14. package/dist/public/assets/{col-w9Q-2mgM.js → col-CcZ10DdH.js} +1 -1
  15. package/dist/public/assets/{compass-D6waJ52O.js → compass-H7uPUHxP.js} +1 -1
  16. package/dist/public/assets/{index-mjEeEQcC.js → index-B0xVTiB7.js} +1 -1
  17. package/dist/public/assets/index-B0xVTiB7.js.br +0 -0
  18. package/dist/public/assets/{index-CgXOkYrX.js → index-BAbIp3cP.js} +1 -1
  19. package/dist/public/assets/index-BAbIp3cP.js.br +0 -0
  20. package/dist/public/assets/{index-DDecPuod.js → index-BESASZaa.js} +1 -1
  21. package/dist/public/assets/{index-YVB9ZW00.js → index-BIZgIFOe.js} +1 -1
  22. package/dist/public/assets/{index-BIrFkB6r.js → index-BX17swkm.js} +1 -1
  23. package/dist/public/assets/index-BX17swkm.js.br +0 -0
  24. package/dist/public/assets/{index-BqwflQml.js → index-Bbsc4UYr.js} +1 -1
  25. package/dist/public/assets/{index-B6hY5GdS.js → index-BhswTE7o.js} +1 -1
  26. package/dist/public/assets/{index-DGkgqtgJ.js → index-BntW17GH.js} +1 -1
  27. package/dist/public/assets/{index-BY3eQmfP.js → index-BswJGTPK.js} +1 -1
  28. package/dist/public/assets/index-BswJGTPK.js.br +0 -0
  29. package/dist/public/assets/{index-BvPolBSn.js → index-CCX74BCm.js} +1 -1
  30. package/dist/public/assets/{index-Q0GC8Irj.js → index-CQ3yj6IA.js} +1 -1
  31. package/dist/public/assets/index-CQ3yj6IA.js.br +0 -0
  32. package/dist/public/assets/{index-Csmg5oyu.js → index-CRqInRg3.js} +1 -1
  33. package/dist/public/assets/{index-BegU9LBT.js → index-C_G_C9eS.js} +10 -10
  34. package/dist/public/assets/index-C_G_C9eS.js.br +0 -0
  35. package/dist/public/assets/{index-rLkONFpx.js → index-CqDAcAbN.js} +1 -1
  36. package/dist/public/assets/{index-Cb4Ja0tZ.js → index-CrRxN4us.js} +1 -1
  37. package/dist/public/assets/{index-CcUgN29Y.js → index-CyDpw03-.js} +1 -1
  38. package/dist/public/assets/{index-BrOFdVbv.js → index-D8BnlF58.js} +1 -1
  39. package/dist/public/assets/{index-DDy4PkWT.js → index-DAY6FKtH.js} +1 -1
  40. package/dist/public/assets/{index-CsiIrLKY.js → index-DKcAZ6VY.js} +1 -1
  41. package/dist/public/assets/{index-M8jf-YAZ.js → index-DS5Uafh7.js} +1 -1
  42. package/dist/public/assets/{index-FVHabbDB.js → index-DdxoW9oQ.js} +1 -1
  43. package/dist/public/assets/{index-CLKKui8G.js → index-O0yoYI51.js} +1 -1
  44. package/dist/public/assets/{index-DEQ2hVPA.js → index-aQ98LrVv.js} +1 -1
  45. package/dist/public/assets/index-aQ98LrVv.js.br +0 -0
  46. package/dist/public/assets/{index-8sDAOAcS.js → index-ivwHgxUB.js} +1 -1
  47. package/dist/public/assets/index-ivwHgxUB.js.br +0 -0
  48. package/dist/public/assets/{index-BwrZjkCc.js → index-sIdIkg5O.js} +1 -1
  49. package/dist/public/assets/{index-BLWgpW64.js → index-wTaBRIal.js} +1 -1
  50. package/dist/public/assets/{layers-Dbwq9AyL.js → layers-Bw-W5e-K.js} +1 -1
  51. package/dist/public/assets/{list-checks-og1usOZf.js → list-checks-ClFMgLBy.js} +1 -1
  52. package/dist/public/assets/{sparkles-p-dZbjGb.js → sparkles-JXa7CZhS.js} +1 -1
  53. package/dist/public/assets/{triangle-alert-BZVAEUiL.js → triangle-alert--wDqk97a.js} +1 -1
  54. package/dist/public/assets/{zap-BAhZUPPa.js → zap-D27jUGUv.js} +1 -1
  55. package/dist/public/index.html +1 -1
  56. package/dist/scripts/dev-remote-resources-smoke.js +80 -0
  57. package/dist/scripts/remoteResources.js +54 -0
  58. package/dist/scripts/verify-agent-contract.js +28 -0
  59. package/dist/scripts/wasm-collect-smoke.js +8 -2
  60. package/dist/scripts/worker.js +5 -1
  61. package/package.json +8 -4
  62. package/vibe-upload.md +4 -4
  63. package/dist/public/assets/Detail-CELZZ-4h.js.br +0 -0
  64. package/dist/public/assets/baseForm-I9suIiQn.js.br +0 -0
  65. package/dist/public/assets/index-8sDAOAcS.js.br +0 -0
  66. package/dist/public/assets/index-BIrFkB6r.js.br +0 -0
  67. package/dist/public/assets/index-BY3eQmfP.js.br +0 -0
  68. package/dist/public/assets/index-BegU9LBT.js.br +0 -0
  69. package/dist/public/assets/index-CgXOkYrX.js.br +0 -0
  70. package/dist/public/assets/index-DEQ2hVPA.js.br +0 -0
  71. package/dist/public/assets/index-Q0GC8Irj.js.br +0 -0
  72. package/dist/public/assets/index-mjEeEQcC.js.br +0 -0
@@ -18,17 +18,19 @@ fs.writeFileSync(rc, JSON.stringify({ cookie: secret }));
18
18
  let mode = 'success'; const calls = [];
19
19
  const server = http.createServer(async (req, res) => {
20
20
  let body = ''; for await (const b of req) body += b;
21
- calls.push({ url: req.url, method: req.method, body: body ? JSON.parse(body) : null, cookie: req.headers.cookie });
21
+ calls.push({ url: req.url, method: req.method, body: body ? JSON.parse(body) : null, cookie: req.headers.cookie,
22
+ ppe: req.headers['x-use-ppe'], lane: req.headers['x-tt-env'] });
22
23
  res.setHeader('content-type', 'application/json');
23
24
  const data = mode === 'auth' ? { code: -401, message: secret }
24
25
  : req.url.includes('/start') ? { code: 0, collect_state: 'open', cookie: secret }
25
26
  : { code: 0, func_ids: [1, 0, 1], boot_func_ids: [0], cookie: secret };
26
27
  res.end(JSON.stringify(data));
27
28
  });
28
- async function run(args) {
29
+ async function run(args, environment = {}) {
29
30
  return new Promise((resolve, reject) => {
30
31
  const child = spawn(process.execPath, ['-r', preload, entry, ...args], { cwd: root,
31
32
  env: { ...process.env, TTMGRC_PATH: rc, TTMG_COLLECT_TEST_PORT: String(server.address().port),
33
+ TTMG_PPE_ENV: '', ...environment,
32
34
  HTTP_PROXY: '', HTTPS_PROXY: '', ALL_PROXY: '', http_proxy: '', https_proxy: '', all_proxy: '',
33
35
  NO_COLOR: '1', FORCE_COLOR: '0' } });
34
36
  let stdout = '', stderr = '';
@@ -49,6 +51,7 @@ function result(r, code = 0) {
49
51
  const a = result(await run(['wasm','collect','start', ...args, '--verbose']));
50
52
  assert.equal(a.collectState,'open'); assert.equal(calls[0].cookie,secret);
51
53
  assert.equal(calls[0].body.reset,false);
54
+ assert.equal(calls[0].ppe,undefined);assert.equal(calls[0].lane,undefined);
52
55
  result(await run(['wasm','collect','start',...args,'--reset']));
53
56
  assert.equal(calls[1].body.reset,true);
54
57
  const beforeDefault = calls.length;
@@ -72,6 +75,9 @@ function result(r, code = 0) {
72
75
  const unknown=await run(['wasm','collect','export',...args,'--reset']);assert.notEqual(unknown.code,0);
73
76
  assert.equal(calls.length,count);
74
77
  assert.deepEqual(fs.readFileSync(input),wasm);
78
+ fs.writeFileSync(rc, JSON.stringify({ cookie: secret }));mode='success';
79
+ result(await run(['wasm','collect','start',...args], { TTMG_PPE_ENV: 'ppe_fixture' }));
80
+ assert.equal(calls.at(-1).ppe,'1');assert.equal(calls.at(-1).lane,'ppe_fixture');
75
81
  console.log('Wasm collect process contract passed: local login transport, reset, export-to-split, clean verbose output; fixture only');
76
82
  })().catch(e => { console.error(e); process.exitCode=1; }).finally(() => {
77
83
  server.closeAllConnections();server.close();fs.rmSync(root,{recursive:true,force:true});
@@ -2,6 +2,7 @@
2
2
  * 子线程进行编译(Worker)
3
3
  */
4
4
  const { debugPkgs } = require('ttmg-pack');
5
+ const { prepareRemoteResources } = require('./remoteResources');
5
6
  const https = require('https');
6
7
  const chalk = require('chalk');
7
8
  const fs = require('fs');
@@ -144,7 +145,7 @@ async function compile(context = {}) {
144
145
  parentPort?.postMessage({ type: 'status', status: 'start' });
145
146
 
146
147
  // 调用打包
147
- const { isSuccess, errorMsg, packages, checkResults } = await debugPkgs(
148
+ const { isSuccess, errorMsg, packages, checkResults, packageConfig } = await debugPkgs(
148
149
  {
149
150
  entry: entryDir,
150
151
  output: outputDir,
@@ -186,11 +187,14 @@ async function compile(context = {}) {
186
187
  checkResults: checkResults || [],
187
188
  });
188
189
  } else {
190
+ const remoteCdnResources = packageConfig?.remote_cdn_resources;
191
+ prepareRemoteResources(entryDir, outputDir, remoteCdnResources);
189
192
  parentPort?.postMessage({
190
193
  type: 'status',
191
194
  status: 'end',
192
195
  isSuccess: true,
193
196
  packages,
197
+ remoteCdnResources,
194
198
  checkResults: checkResults || [],
195
199
  });
196
200
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ttmg/cli",
3
- "version": "0.4.6-vibe-beta.24",
3
+ "version": "0.4.6",
4
4
  "description": "TikTok Mini Game Command Line Tool",
5
5
  "license": "ISC",
6
6
  "bin": {
@@ -8,6 +8,7 @@
8
8
  },
9
9
  "files": [
10
10
  "dist",
11
+ "CHANGELOG.md",
11
12
  "vibe-upload.md"
12
13
  ],
13
14
  "publishConfig": {
@@ -29,10 +30,11 @@
29
30
  "test:preview-page-detached": "node scripts/run-ts-test.js src/commands/common/previewPageDetached.test.ts",
30
31
  "test:preview-page-process": "node scripts/preview-page-server-smoke.js",
31
32
  "test:login": "node scripts/run-ts-test.js src/commands/common/login.test.ts",
33
+ "test:api-routing": "node scripts/run-ts-test.js src/libs/api/request.test.ts",
32
34
  "test:auth": "node scripts/run-ts-test.js src/commands/common/auth.test.ts",
33
35
  "test:capabilities": "node scripts/run-ts-test.js src/commands/common/capabilities.test.ts",
34
36
  "test:test-account": "node scripts/run-ts-test.js src/commands/common/testAccount.test.ts",
35
- "test:dev-session": "node scripts/run-ts-test.js src/commands/native/dev/agentSession.test.ts && npm run test:packaging-compatibility",
37
+ "test:dev-session": "node scripts/run-ts-test.js src/commands/native/dev/agentSession.test.ts && npm run test:packaging-compatibility && npm run test:dev-remote-resources",
36
38
  "test:packaging-compatibility": "node scripts/run-ts-test.js src/commands/native/dev/packagingCompatibility.test.ts",
37
39
  "test:dev-session-command": "node scripts/run-ts-test.js src/commands/native/dev/session.test.ts && node scripts/run-ts-test.js src/commands/native/dev/projectSession.test.ts && node scripts/run-ts-test.js src/commands/native/dev/scanPage.test.ts && node scripts/run-ts-test.js src/commands/native/dev/runtime/logArchive.test.ts && node scripts/run-ts-test.js src/commands/native/dev/capture.test.ts",
38
40
  "test:dev-runtime-event": "node scripts/run-ts-test.js src/commands/native/dev/utils/scoket.test.ts",
@@ -41,6 +43,8 @@
41
43
  "test:dev-runtime-session-follow": "node scripts/run-ts-test.js src/commands/native/dev/runtime/runtimeSessionFollow.test.ts",
42
44
  "test:dev-client-preview-orchestrator": "node scripts/run-ts-test.js src/commands/native/dev/runtime/clientPreviewOrchestrator.test.ts",
43
45
  "test:dev-watch-change": "node scripts/run-ts-test.js src/commands/native/dev/utils/watchChange.test.ts",
46
+ "test:dev-remote-resources": "node scripts/run-ts-test.js src/commands/native/dev/remoteResources.test.ts",
47
+ "test:dev-remote-process": "node scripts/dev-remote-resources-smoke.js",
44
48
  "test:dev-game-ready-process": "npm run build && node scripts/dev-game-ready-smoke.js",
45
49
  "test:dev-default-process": "npm run build && node scripts/dev-default-smoke.js",
46
50
  "test:dev-client-preview-control-process": "npm run build && node scripts/dev-client-preview-control-smoke.js",
@@ -49,8 +53,8 @@
49
53
  "test:build-structured": "node scripts/run-ts-test.js src/commands/native/build/build.test.ts",
50
54
  "test:doctor": "node scripts/run-ts-test.js src/commands/native/doctor/doctor.test.ts",
51
55
  "test:wasm": "node scripts/run-ts-test.js src/commands/native/wasm/wasm.test.ts && node scripts/run-ts-test.js src/commands/native/wasm/collect.test.ts && node scripts/acceptance-fixture.test.js",
52
- "test:agent-contract": "npm run test:login && npm run test:auth && npm run test:capabilities && npm run test:test-account && npm run test:upload-preview && npm run test:preview-page && npm run test:check && npm run test:check-ai && npm run test:build-structured && npm run test:doctor && npm run test:wasm && npm run test:dev-session && npm run test:dev-session-command && npm run test:dev-runtime-event && npm run test:dev-runtime-client && npm run test:dev-session-control && npm run test:dev-runtime-session-follow && npm run test:dev-client-preview-orchestrator && npm run test:dev-watch-change && npm run test:network && npm run test:vibe && npx tsc --noEmit && npm run build && npm run test:vibe-process && npm run test:preview-page-process && npm run test:preview-page-detached && npm run verify:dist-version && npm run verify:agent-contract",
53
- "test:agent-contract:full": "npm run test:agent-contract && npm run test:dev-default-process && npm run test:dev-game-ready-process && npm run test:dev-client-preview-control-process && node scripts/dev-workflow-smoke.js",
56
+ "test:agent-contract": "npm run test:api-routing && npm run test:login && npm run test:auth && npm run test:capabilities && npm run test:test-account && npm run test:upload-preview && npm run test:preview-page && npm run test:check && npm run test:check-ai && npm run test:build-structured && npm run test:doctor && npm run test:wasm && npm run test:dev-session && npm run test:dev-session-command && npm run test:dev-runtime-event && npm run test:dev-runtime-client && npm run test:dev-session-control && npm run test:dev-runtime-session-follow && npm run test:dev-client-preview-orchestrator && npm run test:dev-watch-change && npm run test:network && npm run test:vibe && npx tsc --noEmit && npm run build && npm run test:vibe-process && npm run test:preview-page-process && npm run test:preview-page-detached && npm run verify:dist-version && npm run verify:agent-contract",
57
+ "test:agent-contract:full": "npm run test:agent-contract && npm run test:dev-default-process && npm run test:dev-game-ready-process && npm run test:dev-client-preview-control-process && node scripts/dev-workflow-smoke.js && npm run test:dev-remote-process",
54
58
  "publish:beta": "npm publish --registry=https://registry.npmjs.org/ --access public --tag beta",
55
59
  "setup": "node scripts/setup.js",
56
60
  "reset:local-state": "node scripts/resetLocalState.js",
package/vibe-upload.md CHANGED
@@ -2,9 +2,9 @@
2
2
 
3
3
  `ttmg upload --vibe` 将本地小游戏上传到 TikTok Mini Games。用户提供游戏标题和头像,在手机 TikTok 扫码授权后,CLI 自动完成头像、应用资料和代码包上传。Skill 负责准备工程、调用命令和读取结果;CLI 负责素材校验、打包、授权轮询及上传。
4
4
 
5
- `0.4.6-vibe-beta.24` 支持手机授权、自动上传、同任务轮询和双二维码预览,并兼容后端返回的 TikTok 客户端授权地址。NDJSON 模式下,即使 Skill 将 stdout 保存到文件,控制台仍会在扫码页就绪时显示 `page: <url>`。左侧保留原码用于「查看进度」,右侧从加载态切换为「扫码预览」。页面按浏览器语言显示中英文。当前为 PPE 测试链路,上传完成不代表审核通过或正式发布。
5
+ `0.4.6` 保留 beta.24 的手机授权、自动上传、同任务轮询和双二维码预览,并兼容后端返回的 TikTok 客户端授权地址。NDJSON 模式下,即使 Skill 将 stdout 保存到文件,控制台仍会在扫码页就绪时显示 `page: <url>`。左侧保留原码用于「查看进度」,右侧从加载态切换为「扫码预览」。页面按浏览器语言显示中英文。当前为 PPE 测试链路,上传完成不代表审核通过或正式发布。
6
6
 
7
- Version `0.4.6-vibe-beta.24` supports phone authorization, automatic upload, same-task polling and two QR codes, including TikTok client authorization URLs returned by the backend. In NDJSON mode, the console shows `page: <url>` when the scan page is ready, even if the Skill saves stdout to a file. Check progress remains on the left, and the preview loader or QR appears on the right. This is a PPE trial; upload success is not review approval or production release.
7
+ Version `0.4.6` retains beta.24 phone authorization, automatic upload, same-task polling and two QR codes, including TikTok client authorization URLs returned by the backend. In NDJSON mode, the console shows `page: <url>` when the scan page is ready, even if the Skill saves stdout to a file. Check progress remains on the left, and the preview loader or QR appears on the right. This is a PPE trial; upload success is not review approval or production release.
8
8
 
9
9
  ## Quick Start
10
10
 
@@ -38,10 +38,10 @@ ttmg upload --vibe --dir ./game --title "星环守卫" --icon ./avatar.png --for
38
38
 
39
39
  在独立 Tool 工程目录调用:`ttmg upload --vibe --minis-type MINI_TOOL --dir ./tool --title "Focus Timer" --icon ./icon.png --format ndjson`。工程身份首次创建后固定类型,不要复用小游戏的 `.ttmg/vibe-project.json`。
40
40
 
41
- 安装后确认版本为 `0.4.6-vibe-beta.24`。能力声明中 `authorizationMode=qr`、`previewQr=true`,预览主码用途为 `game_preview`(Tool 为 `tool_preview`),原码仍保留。支持 Node.js 20.19.1–20.x 或 22 及以上版本。
41
+ 安装后确认版本为 `0.4.6`。发布准备期间使用本地候选包,下列 registry 安装命令供正式发布后使用。能力声明中 `authorizationMode=qr`、`previewQr=true`,预览主码用途为 `game_preview`(Tool 为 `tool_preview`),原码仍保留。支持 Node.js 20.19.1–20.x 或 22 及以上版本。
42
42
 
43
43
  ```sh
44
- npm install -g @ttmg/cli@0.4.6-vibe-beta.24
44
+ npm install -g @ttmg/cli@0.4.6
45
45
  ttmg --version
46
46
  ttmg capabilities --format json
47
47
  ```