@ttmg/cli 0.4.6-vibe-beta.10 → 0.4.6-vibe-beta.11

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 CHANGED
@@ -1,8 +1,8 @@
1
1
  ### @ttmg/cli
2
2
 
3
- Vibe 真实网页授权与上传:`ttmg upload --vibe --web --dir ./game --title "My game" --icon ./avatar.png --format ndjson`。只向用户收集标题和本地头像,并使用游戏目录或代码包;其他应用资料由平台默认处理,不需要用户填写。网页授权后,CLI 自动继续上传。见 [Vibe 接入说明](vibe-upload.md)。
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 platform defaults all other app metadata. Upload continues after browser authorization. See [Vibe integration](vibe-upload.md).
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 小游戏和原生小游戏的初始化、开发调试及打包构建。
@@ -69,8 +69,8 @@ simulated. See [Vibe binding/upload](vibe-upload.md) for schema-v2 results.
69
69
  `--mock` now creates real PPE tasks, not a fully offline run. Real request failures
70
70
  still fail. Production routing is a future CLI release change, not Skill configuration.
71
71
 
72
- 当前上传只需要标题、头像和游戏目录或代码包,其他应用资料由平台默认处理。Skill 读取 `inputRequirements`,不向用户索要额外资料;本地预检使用 `--dry-run`。
73
- Current uploads need only the title, icon and game directory or ZIP. The platform defaults other metadata. Read `inputRequirements` and do not request extra fields. Use `--dry-run` for local preparation.
72
+ 当前上传只需要标题、头像和游戏目录或代码包,其他应用资料由 CLI 使用既有 PPE 试用默认值补齐。Skill 读取 `inputRequirements`,不向用户索要额外资料;本地预检使用 `--dry-run`。
73
+ 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
74
 
75
75
  For the existing authenticated platform workflow, log in first; this does not apply to the local Vibe prototype above.
76
76
  原有需要平台鉴权的流程仍先登录;上述 Vibe 本地原型不需要此步骤。
package/dist/index.js CHANGED
@@ -7435,7 +7435,7 @@ const messages = {
7435
7435
  'cli.command.upload.servePreviewPage': 'Serve a temporary local preview page with test-account and preview QR codes',
7436
7436
  'cli.command.upload.noOpen': 'Do not open the local preview page in the default browser',
7437
7437
  'cli.command.upload.format': 'Output format: text | json | ndjson',
7438
- 'cli.command.upload.vibe': 'Binding and upload: collect only title and icon; other app metadata uses platform defaults (schema v2)',
7438
+ 'cli.command.upload.vibe': 'Binding and upload: collect only title and icon; CLI fills other fields with PPE trial defaults (schema v2)',
7439
7439
  'cli.command.upload.vibeTitle': 'Game title supplied by the Skill (--vibe)',
7440
7440
  'cli.command.upload.vibeAppInfo': 'Legacy metadata file compatibility; not needed for current uploads and must not be requested from users',
7441
7441
  'cli.command.upload.vibeIcon': 'Local PNG/JPEG/WebP selected by the user (--vibe)',
@@ -7848,7 +7848,7 @@ const messages = {
7848
7848
  'cli.command.upload.servePreviewPage': '启动包含测试账号与预览二维码的临时本地页面',
7849
7849
  'cli.command.upload.noOpen': '不使用默认浏览器打开本地预览页面',
7850
7850
  'cli.command.upload.format': '输出格式:text | json | ndjson',
7851
- 'cli.command.upload.vibe': '绑定上传:只收集标题和头像,其他应用资料由平台默认处理(schema v2)',
7851
+ 'cli.command.upload.vibe': '绑定上传:只收集标题和头像,CLI 自动补齐其他字段的 PPE 试用默认值(schema v2)',
7852
7852
  'cli.command.upload.vibeAppInfo': '仅兼容旧资料文件;当前上传无需此参数,不应向用户索要',
7853
7853
  'cli.command.upload.vibeTitle': 'Skill 提供的游戏标题(--vibe)',
7854
7854
  'cli.command.upload.vibeIcon': '用户指定的本地 PNG/JPEG/WebP 图片(--vibe)',
@@ -16308,7 +16308,7 @@ async function authStatus(options = {}) {
16308
16308
  return result;
16309
16309
  }
16310
16310
 
16311
- var version = "0.4.6-vibe-beta.10";
16311
+ var version = "0.4.6-vibe-beta.11";
16312
16312
  var engines = {
16313
16313
  node: ">=20.19.1 <21 || >=22"
16314
16314
  };
@@ -16321,7 +16321,8 @@ var pkg = {
16321
16321
  const VIBE_INPUT_REQUIREMENTS = {
16322
16322
  requiredUserInputs: ['title', 'icon'],
16323
16323
  codeSource: ['dir', 'package'],
16324
- additionalMetadataSource: 'platform-defaults',
16324
+ additionalMetadataSource: 'cli-defaults',
16325
+ defaultMetadataProfile: 'ppe-trial',
16325
16326
  requestAdditionalMetadata: false,
16326
16327
  };
16327
16328
  class VibeError extends Error {
@@ -16379,7 +16380,8 @@ function getCapabilities() {
16379
16380
  required: [],
16380
16381
  optional: [],
16381
16382
  suppliedByCli: ['app_name', 'icon_uri'],
16382
- additionalMetadataSource: 'platform-defaults',
16383
+ additionalMetadataSource: 'cli-defaults',
16384
+ defaultMetadataProfile: 'ppe-trial',
16383
16385
  requestFromUser: false,
16384
16386
  legacyFileOption: '--app-info',
16385
16387
  legacyFileOptionRecommended: false,
@@ -17705,6 +17707,112 @@ var authOpen = /*#__PURE__*/Object.freeze({
17705
17707
  vibeAuthOpen: vibeAuthOpen
17706
17708
  });
17707
17709
 
17710
+ // Current PPE trial defaults: the owner-approved metadata used by the successful
17711
+ // real upload fixture on 2026-09-14. This is not a production metadata profile.
17712
+ const VIBE_PPE_DEFAULT_APP_INFO = Object.freeze({
17713
+ description: 'DevTool PPE integration test fixture. Not a production game.',
17714
+ category: 'Other',
17715
+ subcategory: 'Other',
17716
+ terms_of_service: 'https://example.invalid/devtool-ppe-test/terms',
17717
+ privacy_policy: 'https://example.invalid/devtool-ppe-test/privacy',
17718
+ copyright_confirmation: true,
17719
+ contact_email: 'devtool-test@example.invalid',
17720
+ });
17721
+ // BFF IDL + Import Service ValidateAppInfo, feat-minis-import (2026-09-14).
17722
+ // Keep credentials, app_name and icon_uri out of this file: CLI owns those fields.
17723
+ const requiredStrings = [
17724
+ 'description', 'category', 'subcategory', 'terms_of_service', 'privacy_policy',
17725
+ ];
17726
+ const optionalStrings = ['apple_team_id', 'contact_email', 'region', 'min_sdk_version'];
17727
+ function readVibeAppInfo(file) {
17728
+ if (file === undefined)
17729
+ return undefined;
17730
+ try {
17731
+ const stat = fs.statSync(file);
17732
+ if (!stat.isFile() || stat.size > 64 * 1024)
17733
+ throw new Error();
17734
+ const value = JSON.parse(fs.readFileSync(file, 'utf8'));
17735
+ if (!value || typeof value !== 'object' || Array.isArray(value))
17736
+ throw new Error();
17737
+ const allowed = new Set([...requiredStrings, ...optionalStrings, 'copyright_confirmation']);
17738
+ if (Object.keys(value).some(key => !allowed.has(key)))
17739
+ throw new Error();
17740
+ // JSON can encode lone surrogates that Go rejects as invalid UTF-8 input.
17741
+ for (const item of Object.values(value)) {
17742
+ if (typeof item === 'string' && [...item].some(char => /^[\uD800-\uDFFF]$/.test(char)))
17743
+ throw new Error();
17744
+ }
17745
+ for (const key of requiredStrings) {
17746
+ if (typeof value[key] !== 'string' || !value[key].trim())
17747
+ throw new Error();
17748
+ }
17749
+ for (const key of optionalStrings) {
17750
+ if (value[key] !== undefined && (typeof value[key] !== 'string' || !value[key].trim()))
17751
+ throw new Error();
17752
+ }
17753
+ // An explicit declaration is required; never infer consent or supply a default.
17754
+ if (value.copyright_confirmation !== true)
17755
+ throw new Error();
17756
+ for (const key of ['terms_of_service', 'privacy_policy']) {
17757
+ if (/\s/.test(value[key]))
17758
+ throw new Error();
17759
+ const url = new URL(value[key]);
17760
+ if (!['http:', 'https:'].includes(url.protocol) || !url.hostname || url.username || url.password)
17761
+ throw new Error();
17762
+ }
17763
+ if (value.contact_email !== undefined && !/^[^\s<>@]+@[^\s<>@]+$/.test(value.contact_email))
17764
+ throw new Error();
17765
+ return value;
17766
+ }
17767
+ catch {
17768
+ // Do not expose paths, file contents or parser errors in structured output.
17769
+ throw new VibeError('VIBE_INVALID_APP_INFO');
17770
+ }
17771
+ }
17772
+ const VIBE_PLATFORM_ICON_LIMIT = 5 * 1024 * 1024;
17773
+ // Header preflight only. The BFF remains responsible for decoding the image.
17774
+ function validateVibeUploadInput(input) {
17775
+ if ([...input.title].length > 30)
17776
+ throw new VibeError('VIBE_TITLE_TOO_LONG');
17777
+ const image = input.icon.bytes;
17778
+ if (image.length > VIBE_PLATFORM_ICON_LIMIT)
17779
+ throw new VibeError('VIBE_PLATFORM_ICON_INVALID');
17780
+ let width = 0, height = 0;
17781
+ if (image.length >= 33 && image.subarray(0, 8).equals(Buffer.from('89504e470d0a1a0a', 'hex')) &&
17782
+ image.readUInt32BE(8) === 13 && image.toString('ascii', 12, 16) === 'IHDR') {
17783
+ width = image.readUInt32BE(16);
17784
+ height = image.readUInt32BE(20);
17785
+ }
17786
+ else if (image[0] === 0xff && image[1] === 0xd8) {
17787
+ let offset = 2;
17788
+ while (offset + 4 <= image.length) {
17789
+ if (image[offset++] !== 0xff)
17790
+ break;
17791
+ while (image[offset] === 0xff)
17792
+ offset++;
17793
+ const marker = image[offset++];
17794
+ if (marker === 0xda || marker === 0xd9)
17795
+ break;
17796
+ if (marker === 0x01 || (marker >= 0xd0 && marker <= 0xd7))
17797
+ continue;
17798
+ if (offset + 2 > image.length)
17799
+ break;
17800
+ const length = image.readUInt16BE(offset);
17801
+ if (length < 2 || offset + length > image.length)
17802
+ break;
17803
+ // Go image/jpeg accepts baseline, extended sequential and progressive SOF.
17804
+ if ([0xc0, 0xc1, 0xc2].includes(marker) && length >= 8) {
17805
+ height = image.readUInt16BE(offset + 3);
17806
+ width = image.readUInt16BE(offset + 5);
17807
+ break;
17808
+ }
17809
+ offset += length;
17810
+ }
17811
+ }
17812
+ if (width !== 1024 || height !== 1024)
17813
+ throw new VibeError('VIBE_PLATFORM_ICON_INVALID');
17814
+ }
17815
+
17708
17816
  // BFF IDL: feat-minis-import. PPE import flow; no production adapter.
17709
17817
  const prefix = '/bff/app_info/minis_import/';
17710
17818
  const MINIS_IMPORT_PATHS = {
@@ -17825,7 +17933,7 @@ function createBackend(mode, transport) {
17825
17933
  path: MINIS_IMPORT_PATHS.info,
17826
17934
  data: {
17827
17935
  ...credentials(task),
17828
- app_info: { ...appInfo, app_name: title, icon_uri: iconUri },
17936
+ app_info: { ...(appInfo || VIBE_PPE_DEFAULT_APP_INFO), app_name: title, icon_uri: iconUri },
17829
17937
  },
17830
17938
  signal,
17831
17939
  });
@@ -18301,101 +18409,6 @@ async function checkCommand(options = {}) {
18301
18409
  return report;
18302
18410
  }
18303
18411
 
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
18412
  // Prototype resource guards, not agreed platform validation rules.
18400
18413
  const VIBE_ICON_LIMIT = 10 * 1024 * 1024;
18401
18414
  const VIBE_ZIP_LIMIT = 100 * 1024 * 1024;
@@ -19179,8 +19192,8 @@ async function executeVibeUpload(options, onEvent = () => { }, dependencies = {}
19179
19192
  VIBE_TITLE_REQUIRED: ['请提供游戏名称。', 'Provide a game title.'],
19180
19193
  VIBE_TITLE_TOO_LONG: ['游戏名称不能超过 30 个字符。', 'The game title must not exceed 30 characters.'],
19181
19194
  VIBE_INVALID_APP_INFO: [
19182
- '旧 --app-info 文件无效。当前上传只需标题和头像,其他资料由平台默认处理;移除 --app-info 后重试,不要向用户索要额外资料。',
19183
- 'Invalid legacy --app-info file. Current uploads need only title and icon; the platform defaults other metadata. Remove --app-info and retry without requesting extra fields from the user.',
19195
+ '旧 --app-info 文件无效。当前上传只需标题和头像,CLI 自动补齐其他字段的 PPE 试用默认值;移除 --app-info 后重试,不要向用户索要额外资料。',
19196
+ '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
19197
  ],
19185
19198
  VIBE_PLATFORM_ICON_INVALID: [
19186
19199
  '平台头像要求 PNG/JPEG、1024×1024,且不超过 5 MiB,请重新选择本地图片。',