@ttmg/cli 0.4.6-vibe-beta.9 → 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`。内置 PPE 创建任务后打开系统浏览器,持续查询真实绑定状态;授权就绪后,依次上传头像、提交应用信息、上传代码包,等待后端回执。`--web` 不能与 `--mock` 或 `--no-open` 同用,原 `--mock` 链路不变。完整应用资料可通过 `--app-info` 提供,字段要求见 [Vibe 接入说明](vibe-upload.md)。此上传修复尚未发布,已发布的 `0.4.6-vibe-beta.8` 仍会在授权后报错。
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` without `--mock`. It creates a PPE task, opens the system browser and polls real binding status. Once authorized, it uploads the icon, submits app information and uploads the package, waiting for backend receipts. It conflicts with `--mock` and `--no-open`. The original Mock workflow is unchanged. Supply complete app information with `--app-info`; see [Vibe integration](vibe-upload.md). This upload fix is unreleased; published `0.4.6-vibe-beta.8` still fails after authorization.
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
- 维护者可用 `--app-info ./app-info.json --dry-run` 校验完整应用信息和平台头像要求;文件字段见 [Vibe 绑定上传](vibe-upload.md)。不传此选项时,现有 Mock 输入保持不变。真实上传仍未开放。
73
- Maintainers can add `--app-info ./app-info.json --dry-run` to validate complete metadata and platform icon requirements; see [Vibe binding/upload](vibe-upload.md). Existing Mock inputs remain unchanged without this option. Real upload remains disabled.
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,9 +7435,9 @@ 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': 'Skill-guided binding and upload (schema v2; use --mock for the integration trial)',
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
- 'cli.command.upload.vibeAppInfo': 'Local JSON with complete app metadata; validates platform title/icon requirements (--vibe)',
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)',
7442
7442
  'cli.command.upload.vibePackage': 'Prepared ZIP instead of --dir (--vibe)',
7443
7443
  'cli.command.upload.vibeDryRun': 'Validate and package locally without authorization or upload (--vibe)',
@@ -7848,8 +7848,8 @@ 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': 'Skill 引导绑定上传(schema v2;使用 --mock 联调试用)',
7852
- 'cli.command.upload.vibeAppInfo': '完整应用信息 JSON 文件,同时检查平台名称和头像要求(--vibe)',
7851
+ 'cli.command.upload.vibe': '绑定上传:只收集标题和头像,CLI 自动补齐其他字段的 PPE 试用默认值(schema v2)',
7852
+ 'cli.command.upload.vibeAppInfo': '仅兼容旧资料文件;当前上传无需此参数,不应向用户索要',
7853
7853
  'cli.command.upload.vibeTitle': 'Skill 提供的游戏标题(--vibe)',
7854
7854
  'cli.command.upload.vibeIcon': '用户指定的本地 PNG/JPEG/WebP 图片(--vibe)',
7855
7855
  'cli.command.upload.vibePackage': '已准备的 ZIP,与 --dir 二选一(--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.9";
16311
+ var version = "0.4.6-vibe-beta.11";
16312
16312
  var engines = {
16313
16313
  node: ">=20.19.1 <21 || >=22"
16314
16314
  };
@@ -16317,6 +16317,21 @@ var pkg = {
16317
16317
  engines: engines
16318
16318
  };
16319
16319
 
16320
+ // Skill-facing v2 contract. Backend credentials never cross this boundary.
16321
+ const VIBE_INPUT_REQUIREMENTS = {
16322
+ requiredUserInputs: ['title', 'icon'],
16323
+ codeSource: ['dir', 'package'],
16324
+ additionalMetadataSource: 'cli-defaults',
16325
+ defaultMetadataProfile: 'ppe-trial',
16326
+ requestAdditionalMetadata: false,
16327
+ };
16328
+ class VibeError extends Error {
16329
+ constructor(code) {
16330
+ super(code);
16331
+ this.code = code;
16332
+ }
16333
+ }
16334
+
16320
16335
  function getCapabilities() {
16321
16336
  return {
16322
16337
  schemaVersion: '1',
@@ -16358,12 +16373,18 @@ function getCapabilities() {
16358
16373
  uploadSteps: ['avatar', 'app_info', 'package'],
16359
16374
  sourceProjectIdentity: '.ttmg/vibe-project.json',
16360
16375
  metadataInputs: ['title', 'icon', 'dir|package'],
16376
+ inputRequirements: VIBE_INPUT_REQUIREMENTS,
16361
16377
  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 },
16362
16378
  optionalMetadataFile: '--app-info',
16363
16379
  appInfoFields: {
16364
- required: ['description', 'category', 'subcategory', 'terms_of_service', 'privacy_policy', 'copyright_confirmation'],
16365
- optional: ['apple_team_id', 'contact_email', 'region', 'min_sdk_version'],
16380
+ required: [],
16381
+ optional: [],
16366
16382
  suppliedByCli: ['app_name', 'icon_uri'],
16383
+ additionalMetadataSource: 'cli-defaults',
16384
+ defaultMetadataProfile: 'ppe-trial',
16385
+ requestFromUser: false,
16386
+ legacyFileOption: '--app-info',
16387
+ legacyFileOptionRecommended: false,
16367
16388
  },
16368
16389
  appInfoPreflight: {
16369
16390
  titleMaxCharacters: 30,
@@ -17125,7 +17146,7 @@ withVerboseOption(program
17125
17146
  // Vibe v2 backend selection (including opt-in ppe-mock) stays outside the Skill workflow.
17126
17147
  .option('--title <title>', t('cli.command.upload.vibeTitle'))
17127
17148
  .option('--icon <path>', t('cli.command.upload.vibeIcon'))
17128
- .option('--app-info <path>', t('cli.command.upload.vibeAppInfo'))
17149
+ .addOption(new commander.Option('--app-info <path>', t('cli.command.upload.vibeAppInfo')).hideHelp())
17129
17150
  .option('--package <path>', t('cli.command.upload.vibePackage'))
17130
17151
  .option('--dry-run', t('cli.command.upload.vibeDryRun'))
17131
17152
  .option('--mock', t('cli.command.upload.vibeMock'))
@@ -17575,13 +17596,6 @@ else {
17575
17596
  program.parse(process.argv);
17576
17597
  }
17577
17598
 
17578
- class VibeError extends Error {
17579
- constructor(code) {
17580
- super(code);
17581
- this.code = code;
17582
- }
17583
- }
17584
-
17585
17599
  // Only the backend-owned authorization page can be a browser redirect target.
17586
17600
  // Never return its import_token to Skill stdout or put it in a CLI argument.
17587
17601
  function browserLandingUrl(value) {
@@ -17693,6 +17707,112 @@ var authOpen = /*#__PURE__*/Object.freeze({
17693
17707
  vibeAuthOpen: vibeAuthOpen
17694
17708
  });
17695
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
+
17696
17816
  // BFF IDL: feat-minis-import. PPE import flow; no production adapter.
17697
17817
  const prefix = '/bff/app_info/minis_import/';
17698
17818
  const MINIS_IMPORT_PATHS = {
@@ -17813,7 +17933,7 @@ function createBackend(mode, transport) {
17813
17933
  path: MINIS_IMPORT_PATHS.info,
17814
17934
  data: {
17815
17935
  ...credentials(task),
17816
- app_info: { ...appInfo, app_name: title, icon_uri: iconUri },
17936
+ app_info: { ...(appInfo || VIBE_PPE_DEFAULT_APP_INFO), app_name: title, icon_uri: iconUri },
17817
17937
  },
17818
17938
  signal,
17819
17939
  });
@@ -18289,101 +18409,6 @@ async function checkCommand(options = {}) {
18289
18409
  return report;
18290
18410
  }
18291
18411
 
18292
- // BFF IDL + Import Service ValidateAppInfo, feat-minis-import (2026-09-14).
18293
- // Keep credentials, app_name and icon_uri out of this file: CLI owns those fields.
18294
- const requiredStrings = [
18295
- 'description', 'category', 'subcategory', 'terms_of_service', 'privacy_policy',
18296
- ];
18297
- const optionalStrings = ['apple_team_id', 'contact_email', 'region', 'min_sdk_version'];
18298
- function readVibeAppInfo(file) {
18299
- if (file === undefined)
18300
- return undefined;
18301
- try {
18302
- const stat = fs.statSync(file);
18303
- if (!stat.isFile() || stat.size > 64 * 1024)
18304
- throw new Error();
18305
- const value = JSON.parse(fs.readFileSync(file, 'utf8'));
18306
- if (!value || typeof value !== 'object' || Array.isArray(value))
18307
- throw new Error();
18308
- const allowed = new Set([...requiredStrings, ...optionalStrings, 'copyright_confirmation']);
18309
- if (Object.keys(value).some(key => !allowed.has(key)))
18310
- throw new Error();
18311
- // JSON can encode lone surrogates that Go rejects as invalid UTF-8 input.
18312
- for (const item of Object.values(value)) {
18313
- if (typeof item === 'string' && [...item].some(char => /^[\uD800-\uDFFF]$/.test(char)))
18314
- throw new Error();
18315
- }
18316
- for (const key of requiredStrings) {
18317
- if (typeof value[key] !== 'string' || !value[key].trim())
18318
- throw new Error();
18319
- }
18320
- for (const key of optionalStrings) {
18321
- if (value[key] !== undefined && (typeof value[key] !== 'string' || !value[key].trim()))
18322
- throw new Error();
18323
- }
18324
- // An explicit declaration is required; never infer consent or supply a default.
18325
- if (value.copyright_confirmation !== true)
18326
- throw new Error();
18327
- for (const key of ['terms_of_service', 'privacy_policy']) {
18328
- if (/\s/.test(value[key]))
18329
- throw new Error();
18330
- const url = new URL(value[key]);
18331
- if (!['http:', 'https:'].includes(url.protocol) || !url.hostname || url.username || url.password)
18332
- throw new Error();
18333
- }
18334
- if (value.contact_email !== undefined && !/^[^\s<>@]+@[^\s<>@]+$/.test(value.contact_email))
18335
- throw new Error();
18336
- return value;
18337
- }
18338
- catch {
18339
- // Do not expose paths, file contents or parser errors in structured output.
18340
- throw new VibeError('VIBE_INVALID_APP_INFO');
18341
- }
18342
- }
18343
- const VIBE_PLATFORM_ICON_LIMIT = 5 * 1024 * 1024;
18344
- // Header preflight only. The BFF remains responsible for decoding the image.
18345
- function validateVibeUploadInput(input) {
18346
- if ([...input.title].length > 30)
18347
- throw new VibeError('VIBE_TITLE_TOO_LONG');
18348
- const image = input.icon.bytes;
18349
- if (image.length > VIBE_PLATFORM_ICON_LIMIT)
18350
- throw new VibeError('VIBE_PLATFORM_ICON_INVALID');
18351
- let width = 0, height = 0;
18352
- if (image.length >= 33 && image.subarray(0, 8).equals(Buffer.from('89504e470d0a1a0a', 'hex')) &&
18353
- image.readUInt32BE(8) === 13 && image.toString('ascii', 12, 16) === 'IHDR') {
18354
- width = image.readUInt32BE(16);
18355
- height = image.readUInt32BE(20);
18356
- }
18357
- else if (image[0] === 0xff && image[1] === 0xd8) {
18358
- let offset = 2;
18359
- while (offset + 4 <= image.length) {
18360
- if (image[offset++] !== 0xff)
18361
- break;
18362
- while (image[offset] === 0xff)
18363
- offset++;
18364
- const marker = image[offset++];
18365
- if (marker === 0xda || marker === 0xd9)
18366
- break;
18367
- if (marker === 0x01 || (marker >= 0xd0 && marker <= 0xd7))
18368
- continue;
18369
- if (offset + 2 > image.length)
18370
- break;
18371
- const length = image.readUInt16BE(offset);
18372
- if (length < 2 || offset + length > image.length)
18373
- break;
18374
- // Go image/jpeg accepts baseline, extended sequential and progressive SOF.
18375
- if ([0xc0, 0xc1, 0xc2].includes(marker) && length >= 8) {
18376
- height = image.readUInt16BE(offset + 3);
18377
- width = image.readUInt16BE(offset + 5);
18378
- break;
18379
- }
18380
- offset += length;
18381
- }
18382
- }
18383
- if (width !== 1024 || height !== 1024)
18384
- throw new VibeError('VIBE_PLATFORM_ICON_INVALID');
18385
- }
18386
-
18387
18412
  // Prototype resource guards, not agreed platform validation rules.
18388
18413
  const VIBE_ICON_LIMIT = 10 * 1024 * 1024;
18389
18414
  const VIBE_ZIP_LIMIT = 100 * 1024 * 1024;
@@ -18854,6 +18879,7 @@ async function executeVibeUpload(options, onEvent = () => { }, dependencies = {}
18854
18879
  schemaVersion: '2',
18855
18880
  command: 'upload',
18856
18881
  mode: 'vibe',
18882
+ inputRequirements: VIBE_INPUT_REQUIREMENTS,
18857
18883
  operationId: `vibe_${crypto.randomUUID()}`,
18858
18884
  ts: Date.now(),
18859
18885
  status: 'precheck',
@@ -19166,8 +19192,8 @@ async function executeVibeUpload(options, onEvent = () => { }, dependencies = {}
19166
19192
  VIBE_TITLE_REQUIRED: ['请提供游戏名称。', 'Provide a game title.'],
19167
19193
  VIBE_TITLE_TOO_LONG: ['游戏名称不能超过 30 个字符。', 'The game title must not exceed 30 characters.'],
19168
19194
  VIBE_INVALID_APP_INFO: [
19169
- '请检查 --app-info JSON:需要简介、分类、子分类、有效的条款及隐私链接、明确的版权确认;不要填写任务凭据、名称或头像 URI。',
19170
- 'Check --app-info JSON: description, category, subcategory, valid terms/privacy URLs and explicit copyright confirmation are required. Do not include credentials, app_name or icon_uri.',
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.',
19171
19197
  ],
19172
19198
  VIBE_PLATFORM_ICON_INVALID: [
19173
19199
  '平台头像要求 PNG/JPEG、1024×1024,且不超过 5 MiB,请重新选择本地图片。',