@ttmg/cli 0.4.6-vibe-beta.10 → 0.4.6-vibe-beta.13
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 -15
- package/dist/index.js +170 -107
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/scripts/verify-agent-contract.js +8 -0
- package/dist/scripts/vibe-upload-smoke.js +10 -3
- package/package.json +1 -1
- package/vibe-upload.md +56 -20
package/README.md
CHANGED
|
@@ -1,16 +1,29 @@
|
|
|
1
1
|
### @ttmg/cli
|
|
2
2
|
|
|
3
|
-
Vibe 真实网页授权与上传:`ttmg upload --vibe --web --dir ./game --title "My game" --icon ./avatar.png --format ndjson
|
|
3
|
+
Vibe 真实网页授权与上传:`ttmg upload --vibe --web --dir ./game --title "My game" --icon ./avatar.png --format ndjson`。只向用户收集标题和本地头像,并使用游戏目录或代码包;其他应用资料由 CLI 使用既有 PPE 试用默认值补齐,不需要用户填写。网页授权后,CLI 自动继续上传。见 [Vibe 接入说明](vibe-upload.md)。
|
|
4
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
|
|
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
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
|
-
For
|
|
13
|
-
|
|
12
|
+
For Vibe Web authorization and upload, install the `vibe-beta` release:
|
|
13
|
+
Vibe 网页授权上传安装 `vibe-beta` 版本:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install -g @ttmg/cli@vibe-beta
|
|
17
|
+
ttmg --version
|
|
18
|
+
ttmg capabilities --format json
|
|
19
|
+
ttmg upload --help
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
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.
|
|
23
|
+
安装包包含 [vibe-upload.md](vibe-upload.md)。授权期间保持原 Web 上传进程运行,持续读取 NDJSON,直到收到终态。`beta` 与 `vibe-beta` 指向不同发布版本。
|
|
24
|
+
|
|
25
|
+
For Agent and Monetization workflows, the published beta is:
|
|
26
|
+
Agent、商业化流程的已发布 beta 为:
|
|
14
27
|
|
|
15
28
|
```bash
|
|
16
29
|
npm install -g @ttmg/cli@0.4.6-agent-beta.2
|
|
@@ -55,25 +68,21 @@ Keep the upload process running; this command creates no task and reports only
|
|
|
55
68
|
Skill 如需手动打开网页授权,读取上传进程 `waiting_authorization` 事件的 `pageUrl`,
|
|
56
69
|
执行 `ttmg auth open --page-url <pageUrl> --format json`。保持原上传进程运行;
|
|
57
70
|
新命令在 CLI 所在电脑打开系统浏览器,不新建任务,`open_requested` 不代表授权成功。
|
|
58
|
-
|
|
71
|
+
`--web` 已自动打开授权页;上述辅助命令只用于重新打开同一任务的授权页。
|
|
59
72
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
task creation/polling use the built-in PPE lane; authorization and uploads are
|
|
63
|
-
simulated. See [Vibe binding/upload](vibe-upload.md) for schema-v2 results.
|
|
64
|
-
实验性 `upload --vibe --mock` 不要求平台登录或环境配置。CLI 内置 PPE 创建/查询任务,
|
|
65
|
-
模拟授权和上传;本次结束于模拟上传完成,不含预览和发布。详见 [Vibe 绑定上传](vibe-upload.md)。
|
|
73
|
+
`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.
|
|
74
|
+
`ttmg upload --vibe --web` 无需预先平台登录或配置环境,使用真实浏览器授权并上传到 PPE。`--mock` 是独立演示:真实创建/查询任务,模拟授权和素材上传。详见 [Vibe 绑定上传](vibe-upload.md)。
|
|
66
75
|
|
|
67
76
|
`--mock` 现在会真实创建 PPE 任务,不再表示全程离线;真实请求失败仍报错。
|
|
68
77
|
上线时由 CLI 发布版本去掉 PPE 路由,Skill 无需承担环境切换。
|
|
69
78
|
`--mock` now creates real PPE tasks, not a fully offline run. Real request failures
|
|
70
79
|
still fail. Production routing is a future CLI release change, not Skill configuration.
|
|
71
80
|
|
|
72
|
-
|
|
73
|
-
Current uploads need only the title, icon and game directory or ZIP. The
|
|
81
|
+
当前上传只需要标题、头像和游戏目录或代码包,其他应用资料由 CLI 使用既有 PPE 试用默认值补齐。Skill 读取 `inputRequirements`,不向用户索要额外资料;本地预检使用 `--dry-run`。
|
|
82
|
+
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.
|
|
74
83
|
|
|
75
|
-
For the existing authenticated platform workflow, log in first;
|
|
76
|
-
|
|
84
|
+
For the existing authenticated platform workflow, log in first; Vibe Web upload uses its own browser authorization.
|
|
85
|
+
原有需要平台鉴权的流程仍先登录;Vibe Web 上传使用本次任务的浏览器授权。
|
|
77
86
|
|
|
78
87
|
```
|
|
79
88
|
ttmg login
|
package/dist/index.js
CHANGED
|
@@ -7233,6 +7233,18 @@ const messages = {
|
|
|
7233
7233
|
'cli.command.auth.desc': 'Inspect local authentication state',
|
|
7234
7234
|
'cli.command.auth.open.desc': 'Open an existing Vibe task authorization page in the system browser',
|
|
7235
7235
|
'cli.command.upload.vibeWeb': 'Authorize in the browser, then upload to PPE (--vibe; no Mock or --no-open)',
|
|
7236
|
+
'cli.command.upload.vibeWebGuide': `
|
|
7237
|
+
Vibe web upload (real PPE trial):
|
|
7238
|
+
ttmg upload --vibe --web --dir ./game --title "My game" --icon ./avatar.png --format ndjson
|
|
7239
|
+
Use --package ./game.zip instead of --dir for an existing ZIP.
|
|
7240
|
+
Collect only title and icon; the CLI fills other app_info fields with PPE trial defaults.
|
|
7241
|
+
Keep this process running. At waiting_authorization, complete authorization in the system browser on the CLI computer.
|
|
7242
|
+
pageUrl is the local binding/progress page. To reopen authorization, execute the returned authorizationOpenCommand.
|
|
7243
|
+
The CLI polls and uploads avatar, app_info and package automatically after authorization. Do not start a second upload.
|
|
7244
|
+
Real success: terminal=true, status=uploaded, uploaded=true, simulation=false. On failure, read errorCode and nextAction.
|
|
7245
|
+
--web opens the browser for every output format. --mock is a separate simulation mode.
|
|
7246
|
+
Upload completion is not review approval or production release. See bundled vibe-upload.md and ttmg capabilities --format json.
|
|
7247
|
+
`,
|
|
7236
7248
|
'cli.command.auth.open.pageUrl': 'Local pageUrl returned by the running Vibe upload command',
|
|
7237
7249
|
'cli.command.auth.open.requested': 'Browser open requested. Complete authorization there; the existing upload process continues polling.',
|
|
7238
7250
|
'cli.command.auth.open.invalidPage': 'Pass the local pageUrl from the running Vibe upload command, not the platform URL.',
|
|
@@ -7435,7 +7447,7 @@ const messages = {
|
|
|
7435
7447
|
'cli.command.upload.servePreviewPage': 'Serve a temporary local preview page with test-account and preview QR codes',
|
|
7436
7448
|
'cli.command.upload.noOpen': 'Do not open the local preview page in the default browser',
|
|
7437
7449
|
'cli.command.upload.format': 'Output format: text | json | ndjson',
|
|
7438
|
-
'cli.command.upload.vibe': 'Binding and upload: collect only title and icon; other
|
|
7450
|
+
'cli.command.upload.vibe': 'Binding and upload: collect only title and icon; CLI fills other fields with PPE trial defaults (schema v2)',
|
|
7439
7451
|
'cli.command.upload.vibeTitle': 'Game title supplied by the Skill (--vibe)',
|
|
7440
7452
|
'cli.command.upload.vibeAppInfo': 'Legacy metadata file compatibility; not needed for current uploads and must not be requested from users',
|
|
7441
7453
|
'cli.command.upload.vibeIcon': 'Local PNG/JPEG/WebP selected by the user (--vibe)',
|
|
@@ -7646,6 +7658,18 @@ const messages = {
|
|
|
7646
7658
|
'cli.command.auth.desc': '查看本地登录状态',
|
|
7647
7659
|
'cli.command.auth.open.desc': '在系统浏览器打开已有 Vibe 任务的授权页',
|
|
7648
7660
|
'cli.command.upload.vibeWeb': '网页授权就绪后自动上传到 PPE(--vibe;不能与 Mock 或 --no-open 同用)',
|
|
7661
|
+
'cli.command.upload.vibeWebGuide': `
|
|
7662
|
+
Vibe 网页上传(真实 PPE 试用):
|
|
7663
|
+
ttmg upload --vibe --web --dir ./game --title "游戏名称" --icon ./avatar.png --format ndjson
|
|
7664
|
+
已有 ZIP 时,用 --package ./game.zip 替换 --dir。
|
|
7665
|
+
只收集标题和头像;其他 app_info 字段由 CLI 使用 PPE 试用默认值补齐。
|
|
7666
|
+
保持原进程运行。在 waiting_authorization 阶段,在 CLI 所在电脑的系统浏览器完成授权。
|
|
7667
|
+
pageUrl 是本机绑定/进度页;重新打开授权页时,执行返回的 authorizationOpenCommand。
|
|
7668
|
+
CLI 负责轮询,授权后自动上传 avatar、app_info、package,不再启动第二次上传。
|
|
7669
|
+
真实成功:terminal=true、status=uploaded、uploaded=true、simulation=false。失败时读取 errorCode 和 nextAction。
|
|
7670
|
+
--web 在所有输出格式下都会打开浏览器;--mock 是独立的模拟模式。
|
|
7671
|
+
上传完成不代表审核通过或正式上线。详见包内 vibe-upload.md 和 ttmg capabilities --format json。
|
|
7672
|
+
`,
|
|
7649
7673
|
'cli.command.auth.open.pageUrl': '正在运行的 Vibe 上传命令返回的本地 pageUrl',
|
|
7650
7674
|
'cli.command.auth.open.requested': '已请求浏览器打开授权页。请在页面完成授权,原上传进程继续轮询。',
|
|
7651
7675
|
'cli.command.auth.open.invalidPage': '请传入正在运行的 Vibe 上传命令返回的本地 pageUrl,不是平台授权链接。',
|
|
@@ -7848,7 +7872,7 @@ const messages = {
|
|
|
7848
7872
|
'cli.command.upload.servePreviewPage': '启动包含测试账号与预览二维码的临时本地页面',
|
|
7849
7873
|
'cli.command.upload.noOpen': '不使用默认浏览器打开本地预览页面',
|
|
7850
7874
|
'cli.command.upload.format': '输出格式:text | json | ndjson',
|
|
7851
|
-
'cli.command.upload.vibe': '
|
|
7875
|
+
'cli.command.upload.vibe': '绑定上传:只收集标题和头像,CLI 自动补齐其他字段的 PPE 试用默认值(schema v2)',
|
|
7852
7876
|
'cli.command.upload.vibeAppInfo': '仅兼容旧资料文件;当前上传无需此参数,不应向用户索要',
|
|
7853
7877
|
'cli.command.upload.vibeTitle': 'Skill 提供的游戏标题(--vibe)',
|
|
7854
7878
|
'cli.command.upload.vibeIcon': '用户指定的本地 PNG/JPEG/WebP 图片(--vibe)',
|
|
@@ -16308,7 +16332,7 @@ async function authStatus(options = {}) {
|
|
|
16308
16332
|
return result;
|
|
16309
16333
|
}
|
|
16310
16334
|
|
|
16311
|
-
var version = "0.4.6-vibe-beta.
|
|
16335
|
+
var version = "0.4.6-vibe-beta.13";
|
|
16312
16336
|
var engines = {
|
|
16313
16337
|
node: ">=20.19.1 <21 || >=22"
|
|
16314
16338
|
};
|
|
@@ -16321,7 +16345,8 @@ var pkg = {
|
|
|
16321
16345
|
const VIBE_INPUT_REQUIREMENTS = {
|
|
16322
16346
|
requiredUserInputs: ['title', 'icon'],
|
|
16323
16347
|
codeSource: ['dir', 'package'],
|
|
16324
|
-
additionalMetadataSource: '
|
|
16348
|
+
additionalMetadataSource: 'cli-defaults',
|
|
16349
|
+
defaultMetadataProfile: 'ppe-trial',
|
|
16325
16350
|
requestAdditionalMetadata: false,
|
|
16326
16351
|
};
|
|
16327
16352
|
class VibeError extends Error {
|
|
@@ -16331,6 +16356,113 @@ class VibeError extends Error {
|
|
|
16331
16356
|
}
|
|
16332
16357
|
}
|
|
16333
16358
|
|
|
16359
|
+
// Current PPE trial defaults: the owner-approved metadata used by the successful
|
|
16360
|
+
// real upload fixture on 2026-09-14, with owner-specified legal URLs updated on
|
|
16361
|
+
// 2026-09-15. This is not a production metadata profile.
|
|
16362
|
+
const VIBE_PPE_DEFAULT_APP_INFO = Object.freeze({
|
|
16363
|
+
description: 'DevTool PPE integration test fixture. Not a production game.',
|
|
16364
|
+
category: 'Other',
|
|
16365
|
+
subcategory: 'Other',
|
|
16366
|
+
terms_of_service: 'https://www.tiktok.com',
|
|
16367
|
+
privacy_policy: 'https://www.tiktok.com',
|
|
16368
|
+
copyright_confirmation: true,
|
|
16369
|
+
contact_email: 'devtool-test@example.invalid',
|
|
16370
|
+
});
|
|
16371
|
+
// BFF IDL + Import Service ValidateAppInfo, feat-minis-import (2026-09-14).
|
|
16372
|
+
// Keep credentials, app_name and icon_uri out of this file: CLI owns those fields.
|
|
16373
|
+
const requiredStrings = [
|
|
16374
|
+
'description', 'category', 'subcategory', 'terms_of_service', 'privacy_policy',
|
|
16375
|
+
];
|
|
16376
|
+
const optionalStrings = ['apple_team_id', 'contact_email', 'region', 'min_sdk_version'];
|
|
16377
|
+
function readVibeAppInfo(file) {
|
|
16378
|
+
if (file === undefined)
|
|
16379
|
+
return undefined;
|
|
16380
|
+
try {
|
|
16381
|
+
const stat = fs.statSync(file);
|
|
16382
|
+
if (!stat.isFile() || stat.size > 64 * 1024)
|
|
16383
|
+
throw new Error();
|
|
16384
|
+
const value = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
16385
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
16386
|
+
throw new Error();
|
|
16387
|
+
const allowed = new Set([...requiredStrings, ...optionalStrings, 'copyright_confirmation']);
|
|
16388
|
+
if (Object.keys(value).some(key => !allowed.has(key)))
|
|
16389
|
+
throw new Error();
|
|
16390
|
+
// JSON can encode lone surrogates that Go rejects as invalid UTF-8 input.
|
|
16391
|
+
for (const item of Object.values(value)) {
|
|
16392
|
+
if (typeof item === 'string' && [...item].some(char => /^[\uD800-\uDFFF]$/.test(char)))
|
|
16393
|
+
throw new Error();
|
|
16394
|
+
}
|
|
16395
|
+
for (const key of requiredStrings) {
|
|
16396
|
+
if (typeof value[key] !== 'string' || !value[key].trim())
|
|
16397
|
+
throw new Error();
|
|
16398
|
+
}
|
|
16399
|
+
for (const key of optionalStrings) {
|
|
16400
|
+
if (value[key] !== undefined && (typeof value[key] !== 'string' || !value[key].trim()))
|
|
16401
|
+
throw new Error();
|
|
16402
|
+
}
|
|
16403
|
+
// An explicit declaration is required; never infer consent or supply a default.
|
|
16404
|
+
if (value.copyright_confirmation !== true)
|
|
16405
|
+
throw new Error();
|
|
16406
|
+
for (const key of ['terms_of_service', 'privacy_policy']) {
|
|
16407
|
+
if (/\s/.test(value[key]))
|
|
16408
|
+
throw new Error();
|
|
16409
|
+
const url = new URL(value[key]);
|
|
16410
|
+
if (!['http:', 'https:'].includes(url.protocol) || !url.hostname || url.username || url.password)
|
|
16411
|
+
throw new Error();
|
|
16412
|
+
}
|
|
16413
|
+
if (value.contact_email !== undefined && !/^[^\s<>@]+@[^\s<>@]+$/.test(value.contact_email))
|
|
16414
|
+
throw new Error();
|
|
16415
|
+
return value;
|
|
16416
|
+
}
|
|
16417
|
+
catch {
|
|
16418
|
+
// Do not expose paths, file contents or parser errors in structured output.
|
|
16419
|
+
throw new VibeError('VIBE_INVALID_APP_INFO');
|
|
16420
|
+
}
|
|
16421
|
+
}
|
|
16422
|
+
const VIBE_PLATFORM_ICON_LIMIT = 5 * 1024 * 1024;
|
|
16423
|
+
// Header preflight only. The BFF remains responsible for decoding the image.
|
|
16424
|
+
function validateVibeUploadInput(input) {
|
|
16425
|
+
if ([...input.title].length > 30)
|
|
16426
|
+
throw new VibeError('VIBE_TITLE_TOO_LONG');
|
|
16427
|
+
const image = input.icon.bytes;
|
|
16428
|
+
if (image.length > VIBE_PLATFORM_ICON_LIMIT)
|
|
16429
|
+
throw new VibeError('VIBE_PLATFORM_ICON_INVALID');
|
|
16430
|
+
let width = 0, height = 0;
|
|
16431
|
+
if (image.length >= 33 && image.subarray(0, 8).equals(Buffer.from('89504e470d0a1a0a', 'hex')) &&
|
|
16432
|
+
image.readUInt32BE(8) === 13 && image.toString('ascii', 12, 16) === 'IHDR') {
|
|
16433
|
+
width = image.readUInt32BE(16);
|
|
16434
|
+
height = image.readUInt32BE(20);
|
|
16435
|
+
}
|
|
16436
|
+
else if (image[0] === 0xff && image[1] === 0xd8) {
|
|
16437
|
+
let offset = 2;
|
|
16438
|
+
while (offset + 4 <= image.length) {
|
|
16439
|
+
if (image[offset++] !== 0xff)
|
|
16440
|
+
break;
|
|
16441
|
+
while (image[offset] === 0xff)
|
|
16442
|
+
offset++;
|
|
16443
|
+
const marker = image[offset++];
|
|
16444
|
+
if (marker === 0xda || marker === 0xd9)
|
|
16445
|
+
break;
|
|
16446
|
+
if (marker === 0x01 || (marker >= 0xd0 && marker <= 0xd7))
|
|
16447
|
+
continue;
|
|
16448
|
+
if (offset + 2 > image.length)
|
|
16449
|
+
break;
|
|
16450
|
+
const length = image.readUInt16BE(offset);
|
|
16451
|
+
if (length < 2 || offset + length > image.length)
|
|
16452
|
+
break;
|
|
16453
|
+
// Go image/jpeg accepts baseline, extended sequential and progressive SOF.
|
|
16454
|
+
if ([0xc0, 0xc1, 0xc2].includes(marker) && length >= 8) {
|
|
16455
|
+
height = image.readUInt16BE(offset + 3);
|
|
16456
|
+
width = image.readUInt16BE(offset + 5);
|
|
16457
|
+
break;
|
|
16458
|
+
}
|
|
16459
|
+
offset += length;
|
|
16460
|
+
}
|
|
16461
|
+
}
|
|
16462
|
+
if (width !== 1024 || height !== 1024)
|
|
16463
|
+
throw new VibeError('VIBE_PLATFORM_ICON_INVALID');
|
|
16464
|
+
}
|
|
16465
|
+
|
|
16334
16466
|
function getCapabilities() {
|
|
16335
16467
|
return {
|
|
16336
16468
|
schemaVersion: '1',
|
|
@@ -16343,7 +16475,9 @@ function getCapabilities() {
|
|
|
16343
16475
|
},
|
|
16344
16476
|
commands: {
|
|
16345
16477
|
vibeUpload: {
|
|
16346
|
-
command: 'ttmg upload --vibe --
|
|
16478
|
+
command: 'ttmg upload --vibe --web --dir <gameDir> --title <title> --icon <iconPath> --format ndjson',
|
|
16479
|
+
mockCommand: 'ttmg upload --vibe --mock --dir <gameDir> --title <title> --icon <iconPath> --format ndjson',
|
|
16480
|
+
guide: 'vibe-upload.md',
|
|
16347
16481
|
option: '--vibe',
|
|
16348
16482
|
available: true,
|
|
16349
16483
|
platformWrite: true,
|
|
@@ -16374,12 +16508,34 @@ function getCapabilities() {
|
|
|
16374
16508
|
metadataInputs: ['title', 'icon', 'dir|package'],
|
|
16375
16509
|
inputRequirements: VIBE_INPUT_REQUIREMENTS,
|
|
16376
16510
|
webAuthorization: { option: '--web', backend: 'ppe', defaultLane: 'ppe_op_vc', simulation: false, opensSystemBrowser: true, continuesPolling: true, formatIndependent: true, conflictsWith: ['--mock', '--mock-scenario', '--vibe-api', '--no-open'], mockBehaviorUnchanged: true, materialUploadEnabled: true },
|
|
16511
|
+
skillWorkflow: {
|
|
16512
|
+
preferredFormat: 'ndjson',
|
|
16513
|
+
packageAlternative: '--package <zipPath> replaces --dir <gameDir>',
|
|
16514
|
+
keepUploadProcessRunning: true,
|
|
16515
|
+
pollingOwner: 'cli',
|
|
16516
|
+
uploadOwner: 'cli',
|
|
16517
|
+
waitingAuthorization: {
|
|
16518
|
+
status: 'waiting_authorization',
|
|
16519
|
+
userAction: 'complete authorization in the system browser on the CLI computer',
|
|
16520
|
+
pageUrlField: 'pageUrl',
|
|
16521
|
+
pageUrlPurpose: 'local binding and upload progress page',
|
|
16522
|
+
reopenCommandField: 'authorizationOpenCommand',
|
|
16523
|
+
browserOpenRequestedProvesAuthorization: false,
|
|
16524
|
+
createAnotherUploadTask: false,
|
|
16525
|
+
},
|
|
16526
|
+
realUploadSuccess: { terminal: true, status: 'uploaded', uploaded: true, simulation: false },
|
|
16527
|
+
failure: 'Read errorCode and nextAction; do not automatically create another task or reupload',
|
|
16528
|
+
completionMeaning: 'materials uploaded to PPE; review and production release are separate',
|
|
16529
|
+
sameHostRequired: true,
|
|
16530
|
+
},
|
|
16377
16531
|
optionalMetadataFile: '--app-info',
|
|
16378
16532
|
appInfoFields: {
|
|
16379
16533
|
required: [],
|
|
16380
16534
|
optional: [],
|
|
16381
16535
|
suppliedByCli: ['app_name', 'icon_uri'],
|
|
16382
|
-
|
|
16536
|
+
defaultedByCli: Object.keys(VIBE_PPE_DEFAULT_APP_INFO),
|
|
16537
|
+
additionalMetadataSource: 'cli-defaults',
|
|
16538
|
+
defaultMetadataProfile: 'ppe-trial',
|
|
16383
16539
|
requestFromUser: false,
|
|
16384
16540
|
legacyFileOption: '--app-info',
|
|
16385
16541
|
legacyFileOptionRecommended: false,
|
|
@@ -16408,8 +16564,9 @@ function getCapabilities() {
|
|
|
16408
16564
|
httpContract: 'minis-import-task',
|
|
16409
16565
|
authorizationQr: true,
|
|
16410
16566
|
previewQr: false,
|
|
16411
|
-
realAuthorizationVerified:
|
|
16412
|
-
realUploadVerified:
|
|
16567
|
+
realAuthorizationVerified: true,
|
|
16568
|
+
realUploadVerified: true,
|
|
16569
|
+
verificationScope: { backend: 'ppe', assets: 'test-fixtures', date: '2026-09-15', production: false },
|
|
16413
16570
|
autoUploadAfterAuthorization: true,
|
|
16414
16571
|
boundedPolling: true,
|
|
16415
16572
|
cancellation: true,
|
|
@@ -17153,7 +17310,8 @@ withVerboseOption(program
|
|
|
17153
17310
|
.option('--vibe-authorize-url <url>', t('cli.command.upload.vibeAuthorizeUrl'))
|
|
17154
17311
|
.option('--poll-interval <seconds>', t('cli.command.upload.vibePollInterval'))
|
|
17155
17312
|
.option('--timeout <seconds>', t('cli.command.upload.vibeTimeout'))
|
|
17156
|
-
.option('--format <format>', t('cli.command.upload.format'), 'text')
|
|
17313
|
+
.option('--format <format>', t('cli.command.upload.format'), 'text')
|
|
17314
|
+
.addHelpText('after', t('cli.command.upload.vibeWebGuide'))).action(async (cmd) => {
|
|
17157
17315
|
if (cmd.vibe) {
|
|
17158
17316
|
const { vibeUpload } = await Promise.resolve().then(function () { return index$1; });
|
|
17159
17317
|
await vibeUpload(cmd);
|
|
@@ -17825,7 +17983,7 @@ function createBackend(mode, transport) {
|
|
|
17825
17983
|
path: MINIS_IMPORT_PATHS.info,
|
|
17826
17984
|
data: {
|
|
17827
17985
|
...credentials(task),
|
|
17828
|
-
app_info: { ...appInfo, app_name: title, icon_uri: iconUri },
|
|
17986
|
+
app_info: { ...(appInfo || VIBE_PPE_DEFAULT_APP_INFO), app_name: title, icon_uri: iconUri },
|
|
17829
17987
|
},
|
|
17830
17988
|
signal,
|
|
17831
17989
|
});
|
|
@@ -18301,101 +18459,6 @@ async function checkCommand(options = {}) {
|
|
|
18301
18459
|
return report;
|
|
18302
18460
|
}
|
|
18303
18461
|
|
|
18304
|
-
// BFF IDL + Import Service ValidateAppInfo, feat-minis-import (2026-09-14).
|
|
18305
|
-
// Keep credentials, app_name and icon_uri out of this file: CLI owns those fields.
|
|
18306
|
-
const requiredStrings = [
|
|
18307
|
-
'description', 'category', 'subcategory', 'terms_of_service', 'privacy_policy',
|
|
18308
|
-
];
|
|
18309
|
-
const optionalStrings = ['apple_team_id', 'contact_email', 'region', 'min_sdk_version'];
|
|
18310
|
-
function readVibeAppInfo(file) {
|
|
18311
|
-
if (file === undefined)
|
|
18312
|
-
return undefined;
|
|
18313
|
-
try {
|
|
18314
|
-
const stat = fs.statSync(file);
|
|
18315
|
-
if (!stat.isFile() || stat.size > 64 * 1024)
|
|
18316
|
-
throw new Error();
|
|
18317
|
-
const value = JSON.parse(fs.readFileSync(file, 'utf8'));
|
|
18318
|
-
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
18319
|
-
throw new Error();
|
|
18320
|
-
const allowed = new Set([...requiredStrings, ...optionalStrings, 'copyright_confirmation']);
|
|
18321
|
-
if (Object.keys(value).some(key => !allowed.has(key)))
|
|
18322
|
-
throw new Error();
|
|
18323
|
-
// JSON can encode lone surrogates that Go rejects as invalid UTF-8 input.
|
|
18324
|
-
for (const item of Object.values(value)) {
|
|
18325
|
-
if (typeof item === 'string' && [...item].some(char => /^[\uD800-\uDFFF]$/.test(char)))
|
|
18326
|
-
throw new Error();
|
|
18327
|
-
}
|
|
18328
|
-
for (const key of requiredStrings) {
|
|
18329
|
-
if (typeof value[key] !== 'string' || !value[key].trim())
|
|
18330
|
-
throw new Error();
|
|
18331
|
-
}
|
|
18332
|
-
for (const key of optionalStrings) {
|
|
18333
|
-
if (value[key] !== undefined && (typeof value[key] !== 'string' || !value[key].trim()))
|
|
18334
|
-
throw new Error();
|
|
18335
|
-
}
|
|
18336
|
-
// An explicit declaration is required; never infer consent or supply a default.
|
|
18337
|
-
if (value.copyright_confirmation !== true)
|
|
18338
|
-
throw new Error();
|
|
18339
|
-
for (const key of ['terms_of_service', 'privacy_policy']) {
|
|
18340
|
-
if (/\s/.test(value[key]))
|
|
18341
|
-
throw new Error();
|
|
18342
|
-
const url = new URL(value[key]);
|
|
18343
|
-
if (!['http:', 'https:'].includes(url.protocol) || !url.hostname || url.username || url.password)
|
|
18344
|
-
throw new Error();
|
|
18345
|
-
}
|
|
18346
|
-
if (value.contact_email !== undefined && !/^[^\s<>@]+@[^\s<>@]+$/.test(value.contact_email))
|
|
18347
|
-
throw new Error();
|
|
18348
|
-
return value;
|
|
18349
|
-
}
|
|
18350
|
-
catch {
|
|
18351
|
-
// Do not expose paths, file contents or parser errors in structured output.
|
|
18352
|
-
throw new VibeError('VIBE_INVALID_APP_INFO');
|
|
18353
|
-
}
|
|
18354
|
-
}
|
|
18355
|
-
const VIBE_PLATFORM_ICON_LIMIT = 5 * 1024 * 1024;
|
|
18356
|
-
// Header preflight only. The BFF remains responsible for decoding the image.
|
|
18357
|
-
function validateVibeUploadInput(input) {
|
|
18358
|
-
if ([...input.title].length > 30)
|
|
18359
|
-
throw new VibeError('VIBE_TITLE_TOO_LONG');
|
|
18360
|
-
const image = input.icon.bytes;
|
|
18361
|
-
if (image.length > VIBE_PLATFORM_ICON_LIMIT)
|
|
18362
|
-
throw new VibeError('VIBE_PLATFORM_ICON_INVALID');
|
|
18363
|
-
let width = 0, height = 0;
|
|
18364
|
-
if (image.length >= 33 && image.subarray(0, 8).equals(Buffer.from('89504e470d0a1a0a', 'hex')) &&
|
|
18365
|
-
image.readUInt32BE(8) === 13 && image.toString('ascii', 12, 16) === 'IHDR') {
|
|
18366
|
-
width = image.readUInt32BE(16);
|
|
18367
|
-
height = image.readUInt32BE(20);
|
|
18368
|
-
}
|
|
18369
|
-
else if (image[0] === 0xff && image[1] === 0xd8) {
|
|
18370
|
-
let offset = 2;
|
|
18371
|
-
while (offset + 4 <= image.length) {
|
|
18372
|
-
if (image[offset++] !== 0xff)
|
|
18373
|
-
break;
|
|
18374
|
-
while (image[offset] === 0xff)
|
|
18375
|
-
offset++;
|
|
18376
|
-
const marker = image[offset++];
|
|
18377
|
-
if (marker === 0xda || marker === 0xd9)
|
|
18378
|
-
break;
|
|
18379
|
-
if (marker === 0x01 || (marker >= 0xd0 && marker <= 0xd7))
|
|
18380
|
-
continue;
|
|
18381
|
-
if (offset + 2 > image.length)
|
|
18382
|
-
break;
|
|
18383
|
-
const length = image.readUInt16BE(offset);
|
|
18384
|
-
if (length < 2 || offset + length > image.length)
|
|
18385
|
-
break;
|
|
18386
|
-
// Go image/jpeg accepts baseline, extended sequential and progressive SOF.
|
|
18387
|
-
if ([0xc0, 0xc1, 0xc2].includes(marker) && length >= 8) {
|
|
18388
|
-
height = image.readUInt16BE(offset + 3);
|
|
18389
|
-
width = image.readUInt16BE(offset + 5);
|
|
18390
|
-
break;
|
|
18391
|
-
}
|
|
18392
|
-
offset += length;
|
|
18393
|
-
}
|
|
18394
|
-
}
|
|
18395
|
-
if (width !== 1024 || height !== 1024)
|
|
18396
|
-
throw new VibeError('VIBE_PLATFORM_ICON_INVALID');
|
|
18397
|
-
}
|
|
18398
|
-
|
|
18399
18462
|
// Prototype resource guards, not agreed platform validation rules.
|
|
18400
18463
|
const VIBE_ICON_LIMIT = 10 * 1024 * 1024;
|
|
18401
18464
|
const VIBE_ZIP_LIMIT = 100 * 1024 * 1024;
|
|
@@ -19179,8 +19242,8 @@ async function executeVibeUpload(options, onEvent = () => { }, dependencies = {}
|
|
|
19179
19242
|
VIBE_TITLE_REQUIRED: ['请提供游戏名称。', 'Provide a game title.'],
|
|
19180
19243
|
VIBE_TITLE_TOO_LONG: ['游戏名称不能超过 30 个字符。', 'The game title must not exceed 30 characters.'],
|
|
19181
19244
|
VIBE_INVALID_APP_INFO: [
|
|
19182
|
-
'旧 --app-info
|
|
19183
|
-
'Invalid legacy --app-info file. Current uploads need only title and icon;
|
|
19245
|
+
'旧 --app-info 文件无效。当前上传只需标题和头像,CLI 自动补齐其他字段的 PPE 试用默认值;移除 --app-info 后重试,不要向用户索要额外资料。',
|
|
19246
|
+
'Invalid legacy --app-info file. Current uploads need only title and icon; CLI fills other fields with PPE trial defaults. Remove --app-info and retry without requesting extra fields from the user.',
|
|
19184
19247
|
],
|
|
19185
19248
|
VIBE_PLATFORM_ICON_INVALID: [
|
|
19186
19249
|
'平台头像要求 PNG/JPEG、1024×1024,且不超过 5 MiB,请重新选择本地图片。',
|