@coze-arch/cli 0.0.36-alpha.9ee522 → 0.0.36-alpha.af24fb

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 (109) hide show
  1. package/README.md +65 -114
  2. package/docs/deploy.md +2 -1
  3. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +3 -2
  4. package/lib/__templates__/expo/.cozeproj/scripts/prod_run.sh +1 -1
  5. package/lib/__templates__/expo/.cozeproj/scripts/server_dev_run.sh +1 -1
  6. package/lib/__templates__/expo/client/metro.config.js +3 -1
  7. package/lib/__templates__/expo/pnpm-lock.yaml +5 -5
  8. package/lib/__templates__/expo/server/package.json +2 -2
  9. package/lib/__templates__/expo/server/src/index.ts +1 -1
  10. package/lib/__templates__/expo/template.config.js +11 -2
  11. package/lib/__templates__/native-static/.coze +2 -0
  12. package/lib/__templates__/native-static/scripts/serve.ps1 +7 -0
  13. package/lib/__templates__/nextjs/.coze +5 -0
  14. package/lib/__templates__/nextjs/package.json +1 -1
  15. package/lib/__templates__/nextjs/pnpm-lock.yaml +5 -5
  16. package/lib/__templates__/nextjs/scripts/build.ps1 +16 -0
  17. package/lib/__templates__/nextjs/scripts/dev.ps1 +63 -0
  18. package/lib/__templates__/nextjs/scripts/dev.sh +81 -9
  19. package/lib/__templates__/nextjs/scripts/prepare.ps1 +18 -0
  20. package/lib/__templates__/nextjs/scripts/start.ps1 +11 -0
  21. package/lib/__templates__/nextjs/scripts/validate.ps1 +8 -0
  22. package/lib/__templates__/nextjs/template.config.js +1 -1
  23. package/lib/__templates__/nuxt-vue/.coze +5 -0
  24. package/lib/__templates__/nuxt-vue/package.json +1 -1
  25. package/lib/__templates__/nuxt-vue/pnpm-lock.yaml +5 -5
  26. package/lib/__templates__/nuxt-vue/scripts/build.ps1 +12 -0
  27. package/lib/__templates__/nuxt-vue/scripts/dev.ps1 +63 -0
  28. package/lib/__templates__/nuxt-vue/scripts/dev.sh +82 -1
  29. package/lib/__templates__/nuxt-vue/scripts/prepare.ps1 +12 -0
  30. package/lib/__templates__/nuxt-vue/scripts/start.ps1 +11 -0
  31. package/lib/__templates__/nuxt-vue/scripts/validate.ps1 +8 -0
  32. package/lib/__templates__/phaser/.coze +5 -0
  33. package/lib/__templates__/phaser/README.md +8 -0
  34. package/lib/__templates__/phaser/scripts/build.ps1 +12 -0
  35. package/lib/__templates__/phaser/scripts/dev.ps1 +49 -0
  36. package/lib/__templates__/phaser/scripts/prepare.ps1 +8 -0
  37. package/lib/__templates__/phaser/scripts/start.ps1 +49 -0
  38. package/lib/__templates__/phaser/scripts/validate.ps1 +7 -0
  39. package/lib/__templates__/phaser/src/global.d.ts +3 -0
  40. package/lib/__templates__/phaser/src/scene/BootScene.ts +4 -0
  41. package/lib/__templates__/phaser/src/scene/DevLoadingScene.ts +3 -0
  42. package/lib/__templates__/phaser/src/utils/mark-editable.ts +8 -1
  43. package/lib/__templates__/phaser/vite.config.ts +1 -1
  44. package/lib/__templates__/phaser-static/.coze +15 -0
  45. package/lib/__templates__/phaser-static/README.md +40 -0
  46. package/lib/__templates__/phaser-static/_gitignore +6 -0
  47. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0001.png +0 -0
  48. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0002.png +0 -0
  49. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0003.png +0 -0
  50. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0004.png +0 -0
  51. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0005.png +0 -0
  52. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0006.png +0 -0
  53. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0007.png +0 -0
  54. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0008.png +0 -0
  55. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0009.png +0 -0
  56. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0010.png +0 -0
  57. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0011.png +0 -0
  58. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0012.png +0 -0
  59. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0013.png +0 -0
  60. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0014.png +0 -0
  61. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0015.png +0 -0
  62. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0016.png +0 -0
  63. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0017.png +0 -0
  64. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0018.png +0 -0
  65. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0019.png +0 -0
  66. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0020.png +0 -0
  67. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0021.png +0 -0
  68. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0022.png +0 -0
  69. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0023.png +0 -0
  70. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/frame_0024.png +0 -0
  71. package/lib/__templates__/phaser-static/assets/image_sequence/coze-game-loading/manifest.json +11 -0
  72. package/lib/__templates__/phaser-static/debug-runtime/flow-graph.json +20 -0
  73. package/lib/__templates__/phaser-static/index.html +17 -0
  74. package/lib/__templates__/phaser-static/scripts/serve.ps1 +7 -0
  75. package/lib/__templates__/phaser-static/src/assets.js +15 -0
  76. package/lib/__templates__/phaser-static/src/main.js +26 -0
  77. package/lib/__templates__/phaser-static/src/phaser.js +7 -0
  78. package/lib/__templates__/phaser-static/src/scene/BootScene.js +205 -0
  79. package/lib/__templates__/phaser-static/src/scene/DevLoadingScene.js +67 -0
  80. package/lib/__templates__/phaser-static/src/style.css +28 -0
  81. package/lib/__templates__/phaser-static/src/utils/asset-loader.js +267 -0
  82. package/lib/__templates__/phaser-static/src/utils/index.js +2 -0
  83. package/lib/__templates__/phaser-static/src/utils/mark-editable.js +3 -0
  84. package/lib/__templates__/phaser-static/template.config.js +35 -0
  85. package/lib/__templates__/pi-agent/package.json +1 -1
  86. package/lib/__templates__/pi-agent/pnpm-lock.yaml +5 -5
  87. package/lib/__templates__/taro/.cozeproj/scripts/deploy_run.sh +1 -1
  88. package/lib/__templates__/taro/.cozeproj/scripts/dev_run.sh +144 -68
  89. package/lib/__templates__/taro/AGENTS.md +11 -7
  90. package/lib/__templates__/taro/README.md +4 -4
  91. package/lib/__templates__/taro/config/index.ts +10 -2
  92. package/lib/__templates__/taro/pnpm-lock.yaml +5 -5
  93. package/lib/__templates__/taro/server/package.json +1 -1
  94. package/lib/__templates__/taro/server/src/main.ts +8 -2
  95. package/lib/__templates__/templates.json +26 -1
  96. package/lib/__templates__/vite/.coze +5 -0
  97. package/lib/__templates__/vite/package.json +1 -1
  98. package/lib/__templates__/vite/pnpm-lock.yaml +5 -5
  99. package/lib/__templates__/vite/scripts/build.ps1 +16 -0
  100. package/lib/__templates__/vite/scripts/dev.ps1 +63 -0
  101. package/lib/__templates__/vite/scripts/dev.sh +82 -1
  102. package/lib/__templates__/vite/scripts/prepare.ps1 +18 -0
  103. package/lib/__templates__/vite/scripts/start.ps1 +11 -0
  104. package/lib/__templates__/vite/scripts/validate.ps1 +8 -0
  105. package/lib/__templates__/vite/template.config.js +1 -1
  106. package/lib/cli.js +288 -212
  107. package/lib/deploy/package-project.js +22 -4
  108. package/lib/deploy/package-project.py +18 -3
  109. package/package.json +1 -1
package/lib/cli.js CHANGED
@@ -1635,7 +1635,7 @@ function createNodeTransport() {
1635
1635
  };
1636
1636
  }
1637
1637
 
1638
- function _nullishCoalesce$c(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain$F(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
1638
+ function _nullishCoalesce$c(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain$E(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
1639
1639
  * Slardar CLI Reporter 主类
1640
1640
  * 封装 @slardar/base 的初始化和上报逻辑
1641
1641
  */
@@ -1707,7 +1707,7 @@ class SlardarCLIReporter {constructor() { SlardarCLIReporter.prototype.__init.ca
1707
1707
  this.client.on('send', (ev) => {
1708
1708
  log$6(
1709
1709
  'send hook called for event: %s',
1710
- (_optionalChain$F([ev, 'optionalAccess', _ => _.ev_type]) ) || 'unknown',
1710
+ (_optionalChain$E([ev, 'optionalAccess', _ => _.ev_type]) ) || 'unknown',
1711
1711
  );
1712
1712
  });
1713
1713
 
@@ -1765,7 +1765,7 @@ class SlardarCLIReporter {constructor() { SlardarCLIReporter.prototype.__init.ca
1765
1765
  )
1766
1766
  : undefined;
1767
1767
 
1768
- _optionalChain$F([this, 'access', _2 => _2.client, 'access', _3 => _3.sendEvent, 'optionalCall', _4 => _4({
1768
+ _optionalChain$E([this, 'access', _2 => _2.client, 'access', _3 => _3.sendEvent, 'optionalCall', _4 => _4({
1769
1769
  name,
1770
1770
  metrics: cleanMetrics ,
1771
1771
  categories: cleanCategories ,
@@ -1836,7 +1836,7 @@ class SlardarCLIReporter {constructor() { SlardarCLIReporter.prototype.__init.ca
1836
1836
  log$6('Reporting JS error:', {
1837
1837
  name: error.name,
1838
1838
  message: error.message.slice(0, 100),
1839
- stack: _optionalChain$F([error, 'access', _5 => _5.stack, 'optionalAccess', _6 => _6.slice, 'call', _7 => _7(0, 200)]),
1839
+ stack: _optionalChain$E([error, 'access', _5 => _5.stack, 'optionalAccess', _6 => _6.slice, 'call', _7 => _7(0, 200)]),
1840
1840
  extra,
1841
1841
  source,
1842
1842
  });
@@ -1856,7 +1856,7 @@ class SlardarCLIReporter {constructor() { SlardarCLIReporter.prototype.__init.ca
1856
1856
  if (!this.ensureInitialized()) {
1857
1857
  return;
1858
1858
  }
1859
- _optionalChain$F([this, 'access', _8 => _8.client, 'access', _9 => _9.context, 'optionalAccess', _10 => _10.set, 'call', _11 => _11(key, value)]);
1859
+ _optionalChain$E([this, 'access', _8 => _8.client, 'access', _9 => _9.context, 'optionalAccess', _10 => _10.set, 'call', _11 => _11(key, value)]);
1860
1860
  }
1861
1861
 
1862
1862
  /**
@@ -1867,7 +1867,7 @@ class SlardarCLIReporter {constructor() { SlardarCLIReporter.prototype.__init.ca
1867
1867
  return;
1868
1868
  }
1869
1869
  log$6('Merging context:', context);
1870
- _optionalChain$F([this, 'access', _12 => _12.client, 'access', _13 => _13.context, 'optionalAccess', _14 => _14.merge, 'call', _15 => _15(context)]);
1870
+ _optionalChain$E([this, 'access', _12 => _12.client, 'access', _13 => _13.context, 'optionalAccess', _14 => _14.merge, 'call', _15 => _15(context)]);
1871
1871
  }
1872
1872
 
1873
1873
  /**
@@ -1877,7 +1877,7 @@ class SlardarCLIReporter {constructor() { SlardarCLIReporter.prototype.__init.ca
1877
1877
  if (!this.ensureInitialized()) {
1878
1878
  return;
1879
1879
  }
1880
- _optionalChain$F([this, 'access', _16 => _16.client, 'access', _17 => _17.context, 'optionalAccess', _18 => _18.delete, 'call', _19 => _19(key)]);
1880
+ _optionalChain$E([this, 'access', _16 => _16.client, 'access', _17 => _17.context, 'optionalAccess', _18 => _18.delete, 'call', _19 => _19(key)]);
1881
1881
  }
1882
1882
 
1883
1883
  /**
@@ -1887,7 +1887,7 @@ class SlardarCLIReporter {constructor() { SlardarCLIReporter.prototype.__init.ca
1887
1887
  if (!this.ensureInitialized()) {
1888
1888
  return;
1889
1889
  }
1890
- _optionalChain$F([this, 'access', _20 => _20.client, 'access', _21 => _21.context, 'optionalAccess', _22 => _22.clear, 'call', _23 => _23()]);
1890
+ _optionalChain$E([this, 'access', _20 => _20.client, 'access', _21 => _21.context, 'optionalAccess', _22 => _22.clear, 'call', _23 => _23()]);
1891
1891
  }
1892
1892
 
1893
1893
  /**
@@ -1924,7 +1924,7 @@ class SlardarCLIReporter {constructor() { SlardarCLIReporter.prototype.__init.ca
1924
1924
  return;
1925
1925
  }
1926
1926
  log$6('Flushing Slardar data...');
1927
- _optionalChain$F([this, 'access', _24 => _24.client, 'access', _25 => _25.getSender, 'optionalCall', _26 => _26(), 'optionalAccess', _27 => _27.flush, 'call', _28 => _28()]);
1927
+ _optionalChain$E([this, 'access', _24 => _24.client, 'access', _25 => _25.getSender, 'optionalCall', _26 => _26(), 'optionalAccess', _27 => _27.flush, 'call', _28 => _28()]);
1928
1928
  log$6('Waiting %dms for events to be sent...', waitMs);
1929
1929
  await new Promise(resolve => setTimeout(resolve, waitMs));
1930
1930
  log$6('Slardar data flushed');
@@ -1943,7 +1943,7 @@ class SlardarCLIReporter {constructor() { SlardarCLIReporter.prototype.__init.ca
1943
1943
  */
1944
1944
  const reporter = new SlardarCLIReporter();
1945
1945
 
1946
- function _optionalChain$E(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1946
+ function _optionalChain$D(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
1947
1947
 
1948
1948
 
1949
1949
 
@@ -2003,11 +2003,11 @@ const EventBuilder = {
2003
2003
  name: CLI_EVENTS.CLI_COMMAND,
2004
2004
  categories: {
2005
2005
  command,
2006
- args: _optionalChain$E([options, 'optionalAccess', _ => _.args]),
2006
+ args: _optionalChain$D([options, 'optionalAccess', _ => _.args]),
2007
2007
  status: 'running' ,
2008
- ..._optionalChain$E([options, 'optionalAccess', _2 => _2.categories]),
2008
+ ..._optionalChain$D([options, 'optionalAccess', _2 => _2.categories]),
2009
2009
  },
2010
- metrics: _optionalChain$E([options, 'optionalAccess', _3 => _3.metrics]),
2010
+ metrics: _optionalChain$D([options, 'optionalAccess', _3 => _3.metrics]),
2011
2011
  };
2012
2012
  },
2013
2013
 
@@ -2028,13 +2028,13 @@ const EventBuilder = {
2028
2028
  name: CLI_EVENTS.CLI_COMMAND_COMPLETE,
2029
2029
  categories: {
2030
2030
  command,
2031
- args: _optionalChain$E([options, 'optionalAccess', _4 => _4.args]),
2031
+ args: _optionalChain$D([options, 'optionalAccess', _4 => _4.args]),
2032
2032
  status: success ? ('success' ) : ('fail' ),
2033
- ..._optionalChain$E([options, 'optionalAccess', _5 => _5.categories]),
2033
+ ..._optionalChain$D([options, 'optionalAccess', _5 => _5.categories]),
2034
2034
  },
2035
2035
  metrics: {
2036
2036
  duration,
2037
- ...(_optionalChain$E([options, 'optionalAccess', _6 => _6.errorCode]) && { errorCode: options.errorCode }),
2037
+ ...(_optionalChain$D([options, 'optionalAccess', _6 => _6.errorCode]) && { errorCode: options.errorCode }),
2038
2038
  },
2039
2039
  };
2040
2040
  },
@@ -2055,12 +2055,12 @@ const EventBuilder = {
2055
2055
  name: CLI_EVENTS.NETWORK_REQUEST,
2056
2056
  categories: {
2057
2057
  url,
2058
- method: _optionalChain$E([options, 'optionalAccess', _7 => _7.method]) || 'GET',
2059
- statusCode: _optionalChain$E([options, 'optionalAccess', _8 => _8.statusCode, 'optionalAccess', _9 => _9.toString, 'call', _10 => _10()]),
2060
- status: _optionalChain$E([options, 'optionalAccess', _11 => _11.success]) ? ('success' ) : ('fail' ),
2058
+ method: _optionalChain$D([options, 'optionalAccess', _7 => _7.method]) || 'GET',
2059
+ statusCode: _optionalChain$D([options, 'optionalAccess', _8 => _8.statusCode, 'optionalAccess', _9 => _9.toString, 'call', _10 => _10()]),
2060
+ status: _optionalChain$D([options, 'optionalAccess', _11 => _11.success]) ? ('success' ) : ('fail' ),
2061
2061
  },
2062
2062
  metrics: {
2063
- duration: _optionalChain$E([options, 'optionalAccess', _12 => _12.duration]),
2063
+ duration: _optionalChain$D([options, 'optionalAccess', _12 => _12.duration]),
2064
2064
  },
2065
2065
  };
2066
2066
  },
@@ -2082,11 +2082,11 @@ const EventBuilder = {
2082
2082
  categories: {
2083
2083
  operation,
2084
2084
  filePath,
2085
- status: _optionalChain$E([options, 'optionalAccess', _13 => _13.success]) ? ('success' ) : ('fail' ),
2085
+ status: _optionalChain$D([options, 'optionalAccess', _13 => _13.success]) ? ('success' ) : ('fail' ),
2086
2086
  },
2087
2087
  metrics: {
2088
- duration: _optionalChain$E([options, 'optionalAccess', _14 => _14.duration]),
2089
- fileSize: _optionalChain$E([options, 'optionalAccess', _15 => _15.fileSize]),
2088
+ duration: _optionalChain$D([options, 'optionalAccess', _14 => _14.duration]),
2089
+ fileSize: _optionalChain$D([options, 'optionalAccess', _15 => _15.fileSize]),
2090
2090
  },
2091
2091
  };
2092
2092
  },
@@ -2114,7 +2114,7 @@ const EventBuilder = {
2114
2114
  };
2115
2115
 
2116
2116
  var name = "@coze-arch/cli";
2117
- var version = "0.0.36-alpha.9ee522";
2117
+ var version = "0.0.36-alpha.af24fb";
2118
2118
  var description = "coze coding devtools cli";
2119
2119
  var license = "MIT";
2120
2120
  var author = "fanwenjie.fe@bytedance.com";
@@ -2224,7 +2224,7 @@ var packageJson = {
2224
2224
  cozePublishConfig: cozePublishConfig
2225
2225
  };
2226
2226
 
2227
- function _optionalChain$D(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
2227
+ function _optionalChain$C(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/**
2228
2228
  * Slardar 监控初始化和上报
2229
2229
  */
2230
2230
 
@@ -2327,11 +2327,11 @@ const reportCommandComplete = safeRun(
2327
2327
  ,
2328
2328
  ) => {
2329
2329
  const event = EventBuilder.cliCommandComplete(command, success, duration, {
2330
- args: _optionalChain$D([options, 'optionalAccess', _ => _.args]),
2331
- errorCode: _optionalChain$D([options, 'optionalAccess', _2 => _2.errorCode]),
2330
+ args: _optionalChain$C([options, 'optionalAccess', _ => _.args]),
2331
+ errorCode: _optionalChain$C([options, 'optionalAccess', _2 => _2.errorCode]),
2332
2332
  categories: {
2333
- ...(_optionalChain$D([options, 'optionalAccess', _3 => _3.errorMessage]) && { errorMessage: options.errorMessage }),
2334
- ..._optionalChain$D([options, 'optionalAccess', _4 => _4.categories]),
2333
+ ...(_optionalChain$C([options, 'optionalAccess', _3 => _3.errorMessage]) && { errorMessage: options.errorMessage }),
2334
+ ..._optionalChain$C([options, 'optionalAccess', _4 => _4.categories]),
2335
2335
  },
2336
2336
  });
2337
2337
  reporter.sendEvent(event.name, event.metrics, event.categories);
@@ -2390,7 +2390,7 @@ const flushSlardar = safeRun('flushSlardar', async () => {
2390
2390
  await reporter.flush();
2391
2391
  });
2392
2392
 
2393
- function _nullishCoalesce$b(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain$C(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var LogLevel; (function (LogLevel) {
2393
+ function _nullishCoalesce$b(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain$B(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var LogLevel; (function (LogLevel) {
2394
2394
  const ERROR = 0; LogLevel[LogLevel["ERROR"] = ERROR] = "ERROR";
2395
2395
  const WARN = 1; LogLevel[LogLevel["WARN"] = WARN] = "WARN";
2396
2396
  const SUCCESS = 2; LogLevel[LogLevel["SUCCESS"] = SUCCESS] = "SUCCESS";
@@ -2437,7 +2437,7 @@ class Logger {
2437
2437
  return level;
2438
2438
  }
2439
2439
 
2440
- const envLevel = _optionalChain$C([process, 'access', _ => _.env, 'access', _2 => _2.LOG_LEVEL, 'optionalAccess', _3 => _3.toLowerCase, 'call', _4 => _4()]);
2440
+ const envLevel = _optionalChain$B([process, 'access', _ => _.env, 'access', _2 => _2.LOG_LEVEL, 'optionalAccess', _3 => _3.toLowerCase, 'call', _4 => _4()]);
2441
2441
  if (envLevel && envLevel in LOG_LEVEL_MAP) {
2442
2442
  // envLevel 已通过 `in` 检查确认为 LOG_LEVEL_MAP 的键;
2443
2443
  // 显式判空以满足 noUncheckedIndexedAccess,运行时行为不变
@@ -2454,7 +2454,7 @@ class Logger {
2454
2454
  // 简单检测:Node.js 环境且支持 TTY
2455
2455
  return (
2456
2456
  typeof process !== 'undefined' &&
2457
- _optionalChain$C([process, 'access', _5 => _5.stdout, 'optionalAccess', _6 => _6.isTTY]) === true &&
2457
+ _optionalChain$B([process, 'access', _5 => _5.stdout, 'optionalAccess', _6 => _6.isTTY]) === true &&
2458
2458
  process.env.NO_COLOR === undefined
2459
2459
  );
2460
2460
  }
@@ -3262,7 +3262,7 @@ const registerCommand$6 = program => {
3262
3262
  });
3263
3263
  };
3264
3264
 
3265
- function _optionalChain$B(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// Safe JSON parsing utilities with type safety and error handling
3265
+ function _optionalChain$A(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// Safe JSON parsing utilities with type safety and error handling
3266
3266
  // Provides fallback values, validation, and error monitoring capabilities
3267
3267
 
3268
3268
  /**
@@ -3362,12 +3362,12 @@ function safeJsonParse(
3362
3362
  const parsed = JSON.parse(String(input));
3363
3363
 
3364
3364
  // Optional validation
3365
- if (_optionalChain$B([options, 'optionalAccess', _ => _.validate])) {
3365
+ if (_optionalChain$A([options, 'optionalAccess', _ => _.validate])) {
3366
3366
  if (options.validate(parsed)) {
3367
3367
  return parsed;
3368
3368
  } else {
3369
3369
  const validationError = new Error('JSON validation failed');
3370
- _optionalChain$B([options, 'access', _2 => _2.onError, 'optionalCall', _3 => _3(validationError, input)]);
3370
+ _optionalChain$A([options, 'access', _2 => _2.onError, 'optionalCall', _3 => _3(validationError, input)]);
3371
3371
 
3372
3372
  if (options.throwOnValidationError) {
3373
3373
  throw validationError;
@@ -3379,10 +3379,10 @@ function safeJsonParse(
3379
3379
  return parsed;
3380
3380
  } catch (error) {
3381
3381
  // Re-throw validation errors when throwOnValidationError is true
3382
- if (error instanceof Error && error.message === 'JSON validation failed' && _optionalChain$B([options, 'optionalAccess', _4 => _4.throwOnValidationError])) {
3382
+ if (error instanceof Error && error.message === 'JSON validation failed' && _optionalChain$A([options, 'optionalAccess', _4 => _4.throwOnValidationError])) {
3383
3383
  throw error;
3384
3384
  }
3385
- _optionalChain$B([options, 'optionalAccess', _5 => _5.onError, 'optionalCall', _6 => _6(error , input)]);
3385
+ _optionalChain$A([options, 'optionalAccess', _5 => _5.onError, 'optionalCall', _6 => _6(error , input)]);
3386
3386
  return defaultValue;
3387
3387
  }
3388
3388
  }
@@ -3422,7 +3422,7 @@ function isNode(node) {
3422
3422
  }
3423
3423
  const hasAnchor = (node) => (isScalar(node) || isCollection(node)) && !!node.anchor;
3424
3424
 
3425
- function _optionalChain$A(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
3425
+ function _optionalChain$z(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
3426
3426
  const BREAK = Symbol('break visit');
3427
3427
  const SKIP = Symbol('skip children');
3428
3428
  const REMOVE = Symbol('remove node');
@@ -3535,15 +3535,15 @@ function callVisitor(key, node, visitor, path) {
3535
3535
  if (typeof visitor === 'function')
3536
3536
  return visitor(key, node, path);
3537
3537
  if (isMap(node))
3538
- return _optionalChain$A([visitor, 'access', _ => _.Map, 'optionalCall', _2 => _2(key, node, path)]);
3538
+ return _optionalChain$z([visitor, 'access', _ => _.Map, 'optionalCall', _2 => _2(key, node, path)]);
3539
3539
  if (isSeq(node))
3540
- return _optionalChain$A([visitor, 'access', _3 => _3.Seq, 'optionalCall', _4 => _4(key, node, path)]);
3540
+ return _optionalChain$z([visitor, 'access', _3 => _3.Seq, 'optionalCall', _4 => _4(key, node, path)]);
3541
3541
  if (isPair(node))
3542
- return _optionalChain$A([visitor, 'access', _5 => _5.Pair, 'optionalCall', _6 => _6(key, node, path)]);
3542
+ return _optionalChain$z([visitor, 'access', _5 => _5.Pair, 'optionalCall', _6 => _6(key, node, path)]);
3543
3543
  if (isScalar(node))
3544
- return _optionalChain$A([visitor, 'access', _7 => _7.Scalar, 'optionalCall', _8 => _8(key, node, path)]);
3544
+ return _optionalChain$z([visitor, 'access', _7 => _7.Scalar, 'optionalCall', _8 => _8(key, node, path)]);
3545
3545
  if (isAlias(node))
3546
- return _optionalChain$A([visitor, 'access', _9 => _9.Alias, 'optionalCall', _10 => _10(key, node, path)]);
3546
+ return _optionalChain$z([visitor, 'access', _9 => _9.Alias, 'optionalCall', _10 => _10(key, node, path)]);
3547
3547
  return undefined;
3548
3548
  }
3549
3549
  function replaceNode(key, path, node) {
@@ -3634,7 +3634,7 @@ function applyReviver(reviver, obj, key, val) {
3634
3634
  return reviver.call(obj, key, val);
3635
3635
  }
3636
3636
 
3637
- function _optionalChain$z(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
3637
+ function _optionalChain$y(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
3638
3638
  /**
3639
3639
  * Recursively convert any node or its contents to native JavaScript
3640
3640
  *
@@ -3664,7 +3664,7 @@ function toJS(value, arg, ctx) {
3664
3664
  ctx.onCreate(res);
3665
3665
  return res;
3666
3666
  }
3667
- if (typeof value === 'bigint' && !_optionalChain$z([ctx, 'optionalAccess', _ => _.keep]))
3667
+ if (typeof value === 'bigint' && !_optionalChain$y([ctx, 'optionalAccess', _ => _.keep]))
3668
3668
  return Number(value);
3669
3669
  return value;
3670
3670
  }
@@ -3702,7 +3702,7 @@ class NodeBase {
3702
3702
  }
3703
3703
  }
3704
3704
 
3705
- function _optionalChain$y(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
3705
+ function _optionalChain$x(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
3706
3706
  class Alias extends NodeBase {
3707
3707
  constructor(source) {
3708
3708
  super(ALIAS);
@@ -3718,10 +3718,10 @@ class Alias extends NodeBase {
3718
3718
  * instance of the `source` anchor before this node.
3719
3719
  */
3720
3720
  resolve(doc, ctx) {
3721
- if (_optionalChain$y([ctx, 'optionalAccess', _ => _.maxAliasCount]) === 0)
3721
+ if (_optionalChain$x([ctx, 'optionalAccess', _ => _.maxAliasCount]) === 0)
3722
3722
  throw new ReferenceError('Alias resolution is disabled');
3723
3723
  let nodes;
3724
- if (_optionalChain$y([ctx, 'optionalAccess', _2 => _2.aliasResolveCache])) {
3724
+ if (_optionalChain$x([ctx, 'optionalAccess', _2 => _2.aliasResolveCache])) {
3725
3725
  nodes = ctx.aliasResolveCache;
3726
3726
  }
3727
3727
  else {
@@ -3760,7 +3760,7 @@ class Alias extends NodeBase {
3760
3760
  data = anchors.get(source);
3761
3761
  }
3762
3762
  /* istanbul ignore if */
3763
- if (_optionalChain$y([data, 'optionalAccess', _3 => _3.res]) === undefined) {
3763
+ if (_optionalChain$x([data, 'optionalAccess', _3 => _3.res]) === undefined) {
3764
3764
  const msg = 'This should not happen: Alias anchor was not resolved?';
3765
3765
  throw new ReferenceError(msg);
3766
3766
  }
@@ -3812,7 +3812,7 @@ function getAliasCount(doc, node, anchors) {
3812
3812
  return 1;
3813
3813
  }
3814
3814
 
3815
- function _optionalChain$x(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
3815
+ function _optionalChain$w(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
3816
3816
  const isScalarValue = (value) => !value || (typeof value !== 'function' && typeof value !== 'object');
3817
3817
  class Scalar extends NodeBase {
3818
3818
  constructor(value) {
@@ -3820,7 +3820,7 @@ class Scalar extends NodeBase {
3820
3820
  this.value = value;
3821
3821
  }
3822
3822
  toJSON(arg, ctx) {
3823
- return _optionalChain$x([ctx, 'optionalAccess', _ => _.keep]) ? this.value : toJS(this.value, arg, ctx);
3823
+ return _optionalChain$w([ctx, 'optionalAccess', _ => _.keep]) ? this.value : toJS(this.value, arg, ctx);
3824
3824
  }
3825
3825
  toString() {
3826
3826
  return String(this.value);
@@ -3832,7 +3832,7 @@ Scalar.PLAIN = 'PLAIN';
3832
3832
  Scalar.QUOTE_DOUBLE = 'QUOTE_DOUBLE';
3833
3833
  Scalar.QUOTE_SINGLE = 'QUOTE_SINGLE';
3834
3834
 
3835
- function _nullishCoalesce$a(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain$w(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
3835
+ function _nullishCoalesce$a(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain$v(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
3836
3836
  const defaultTagPrefix = 'tag:yaml.org,2002:';
3837
3837
  function findTagObject(value, tagName, tags) {
3838
3838
  if (tagName) {
@@ -3842,7 +3842,7 @@ function findTagObject(value, tagName, tags) {
3842
3842
  throw new Error(`Tag ${tagName} not found`);
3843
3843
  return tagObj;
3844
3844
  }
3845
- return tags.find(t => _optionalChain$w([t, 'access', _ => _.identify, 'optionalCall', _2 => _2(value)]) && !t.format);
3845
+ return tags.find(t => _optionalChain$v([t, 'access', _ => _.identify, 'optionalCall', _2 => _2(value)]) && !t.format);
3846
3846
  }
3847
3847
  function createNode(value, tagName, ctx) {
3848
3848
  if (isDocument(value))
@@ -3850,7 +3850,7 @@ function createNode(value, tagName, ctx) {
3850
3850
  if (isNode(value))
3851
3851
  return value;
3852
3852
  if (isPair(value)) {
3853
- const map = _optionalChain$w([ctx, 'access', _3 => _3.schema, 'access', _4 => _4[MAP], 'access', _5 => _5.createNode, 'optionalCall', _6 => _6(ctx.schema, null, ctx)]);
3853
+ const map = _optionalChain$v([ctx, 'access', _3 => _3.schema, 'access', _4 => _4[MAP], 'access', _5 => _5.createNode, 'optionalCall', _6 => _6(ctx.schema, null, ctx)]);
3854
3854
  map.items.push(value);
3855
3855
  return map;
3856
3856
  }
@@ -3877,7 +3877,7 @@ function createNode(value, tagName, ctx) {
3877
3877
  sourceObjects.set(value, ref);
3878
3878
  }
3879
3879
  }
3880
- if (_optionalChain$w([tagName, 'optionalAccess', _7 => _7.startsWith, 'call', _8 => _8('!!')]))
3880
+ if (_optionalChain$v([tagName, 'optionalAccess', _7 => _7.startsWith, 'call', _8 => _8('!!')]))
3881
3881
  tagName = defaultTagPrefix + tagName.slice(2);
3882
3882
  let tagObj = findTagObject(value, tagName, schema.tags);
3883
3883
  if (!tagObj) {
@@ -3902,9 +3902,9 @@ function createNode(value, tagName, ctx) {
3902
3902
  onTagObj(tagObj);
3903
3903
  delete ctx.onTagObj;
3904
3904
  }
3905
- const node = _optionalChain$w([tagObj, 'optionalAccess', _9 => _9.createNode])
3905
+ const node = _optionalChain$v([tagObj, 'optionalAccess', _9 => _9.createNode])
3906
3906
  ? tagObj.createNode(ctx.schema, value, ctx)
3907
- : typeof _optionalChain$w([tagObj, 'optionalAccess', _10 => _10.nodeClass, 'optionalAccess', _11 => _11.from]) === 'function'
3907
+ : typeof _optionalChain$v([tagObj, 'optionalAccess', _10 => _10.nodeClass, 'optionalAccess', _11 => _11.from]) === 'function'
3908
3908
  ? tagObj.nodeClass.from(ctx.schema, value, ctx)
3909
3909
  : new Scalar(value);
3910
3910
  if (tagName)
@@ -4222,7 +4222,7 @@ function consumeMoreIndentedLines(text, i, indent) {
4222
4222
  return end;
4223
4223
  }
4224
4224
 
4225
- function _optionalChain$v(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
4225
+ function _optionalChain$u(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
4226
4226
  const getFoldOptions = (ctx, isBlock) => ({
4227
4227
  indentAtStart: isBlock ? ctx.indent.length : ctx.indentAtStart,
4228
4228
  lineWidth: ctx.options.lineWidth,
@@ -4507,9 +4507,9 @@ function plainString(item, ctx, onComment, onChompKeep) {
4507
4507
  // booleans get parsed with those types in v1.2 (e.g. '42', 'true' & '0.9e-3'),
4508
4508
  // and others in v1.1.
4509
4509
  if (actualString) {
4510
- const test = (tag) => tag.default && tag.tag !== 'tag:yaml.org,2002:str' && _optionalChain$v([tag, 'access', _ => _.test, 'optionalAccess', _2 => _2.test, 'call', _3 => _3(str)]);
4510
+ const test = (tag) => tag.default && tag.tag !== 'tag:yaml.org,2002:str' && _optionalChain$u([tag, 'access', _ => _.test, 'optionalAccess', _2 => _2.test, 'call', _3 => _3(str)]);
4511
4511
  const { compat, tags } = ctx.doc.schema;
4512
- if (tags.some(test) || _optionalChain$v([compat, 'optionalAccess', _4 => _4.some, 'call', _5 => _5(test)]))
4512
+ if (tags.some(test) || _optionalChain$u([compat, 'optionalAccess', _4 => _4.some, 'call', _5 => _5(test)]))
4513
4513
  return quotedString(value, ctx);
4514
4514
  }
4515
4515
  return implicitKey
@@ -4555,7 +4555,7 @@ function stringifyString(item, ctx, onComment, onChompKeep) {
4555
4555
  return res;
4556
4556
  }
4557
4557
 
4558
- function _nullishCoalesce$9(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain$u(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
4558
+ function _nullishCoalesce$9(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain$t(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
4559
4559
  function createStringifyContext(doc, options) {
4560
4560
  const opt = Object.assign({
4561
4561
  blockQuote: true,
@@ -4608,7 +4608,7 @@ function getTagObject(tags, item) {
4608
4608
  let obj;
4609
4609
  if (isScalar(item)) {
4610
4610
  obj = item.value;
4611
- let match = tags.filter(t => _optionalChain$u([t, 'access', _ => _.identify, 'optionalCall', _2 => _2(obj)]));
4611
+ let match = tags.filter(t => _optionalChain$t([t, 'access', _ => _.identify, 'optionalCall', _2 => _2(obj)]));
4612
4612
  if (match.length > 1) {
4613
4613
  const testMatch = match.filter(t => t.test);
4614
4614
  if (testMatch.length > 0)
@@ -4622,7 +4622,7 @@ function getTagObject(tags, item) {
4622
4622
  tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);
4623
4623
  }
4624
4624
  if (!tagObj) {
4625
- const name = _nullishCoalesce$9(_optionalChain$u([obj, 'optionalAccess', _3 => _3.constructor, 'optionalAccess', _4 => _4.name]), () => ( (obj === null ? 'null' : typeof obj)));
4625
+ const name = _nullishCoalesce$9(_optionalChain$t([obj, 'optionalAccess', _3 => _3.constructor, 'optionalAccess', _4 => _4.name]), () => ( (obj === null ? 'null' : typeof obj)));
4626
4626
  throw new Error(`Tag not resolved for ${name} value`);
4627
4627
  }
4628
4628
  return tagObj;
@@ -4648,7 +4648,7 @@ function stringify(item, ctx, onComment, onChompKeep) {
4648
4648
  if (isAlias(item)) {
4649
4649
  if (ctx.doc.directives)
4650
4650
  return item.toString(ctx);
4651
- if (_optionalChain$u([ctx, 'access', _5 => _5.resolvedAliases, 'optionalAccess', _6 => _6.has, 'call', _7 => _7(item)])) {
4651
+ if (_optionalChain$t([ctx, 'access', _5 => _5.resolvedAliases, 'optionalAccess', _6 => _6.has, 'call', _7 => _7(item)])) {
4652
4652
  throw new TypeError(`Cannot stringify circular structure without alias nodes`);
4653
4653
  }
4654
4654
  else {
@@ -4830,7 +4830,7 @@ function warn(logLevel, warning) {
4830
4830
  }
4831
4831
  }
4832
4832
 
4833
- function _optionalChain$t(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
4833
+ function _optionalChain$s(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
4834
4834
  // If the value associated with a merge key is a single mapping node, each of
4835
4835
  // its key/value pairs is inserted into the current mapping, unless the key
4836
4836
  // already exists in it. If the value associated with the merge key is a
@@ -4854,7 +4854,7 @@ const isMergeKey = (ctx, key) => (merge.identify(key) ||
4854
4854
  (isScalar(key) &&
4855
4855
  (!key.type || key.type === Scalar.PLAIN) &&
4856
4856
  merge.identify(key.value))) &&
4857
- _optionalChain$t([ctx, 'optionalAccess', _ => _.doc, 'access', _2 => _2.schema, 'access', _3 => _3.tags, 'access', _4 => _4.some, 'call', _5 => _5(tag => tag.tag === merge.tag && tag.default)]);
4857
+ _optionalChain$s([ctx, 'optionalAccess', _ => _.doc, 'access', _2 => _2.schema, 'access', _3 => _3.tags, 'access', _4 => _4.some, 'call', _5 => _5(tag => tag.tag === merge.tag && tag.default)]);
4858
4858
  function addMergeToJSMap(ctx, map, value) {
4859
4859
  const source = resolveAliasValue(ctx, value);
4860
4860
  if (isSeq(source))
@@ -4894,7 +4894,7 @@ function resolveAliasValue(ctx, value) {
4894
4894
  return ctx && isAlias(value) ? value.resolve(ctx.doc, ctx) : value;
4895
4895
  }
4896
4896
 
4897
- function _optionalChain$s(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
4897
+ function _optionalChain$r(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
4898
4898
  function addPairToJSMap(ctx, map, { key, value }) {
4899
4899
  if (isNode(key) && key.addToJSMap)
4900
4900
  key.addToJSMap(ctx, map, value);
@@ -4931,7 +4931,7 @@ function stringifyKey(key, jsKey, ctx) {
4931
4931
  // eslint-disable-next-line @typescript-eslint/no-base-to-string
4932
4932
  if (typeof jsKey !== 'object')
4933
4933
  return String(jsKey);
4934
- if (isNode(key) && _optionalChain$s([ctx, 'optionalAccess', _ => _.doc])) {
4934
+ if (isNode(key) && _optionalChain$r([ctx, 'optionalAccess', _ => _.doc])) {
4935
4935
  const strCtx = createStringifyContext(ctx.doc, {});
4936
4936
  strCtx.anchors = new Set();
4937
4937
  for (const node of ctx.anchors.keys())
@@ -4951,7 +4951,7 @@ function stringifyKey(key, jsKey, ctx) {
4951
4951
  return JSON.stringify(jsKey);
4952
4952
  }
4953
4953
 
4954
- function _optionalChain$r(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
4954
+ function _optionalChain$q(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
4955
4955
  function createPair(key, value, ctx) {
4956
4956
  const k = createNode(key, undefined, ctx);
4957
4957
  const v = createNode(value, undefined, ctx);
@@ -4972,17 +4972,17 @@ class Pair {
4972
4972
  return new Pair(key, value);
4973
4973
  }
4974
4974
  toJSON(_, ctx) {
4975
- const pair = _optionalChain$r([ctx, 'optionalAccess', _2 => _2.mapAsMap]) ? new Map() : {};
4975
+ const pair = _optionalChain$q([ctx, 'optionalAccess', _2 => _2.mapAsMap]) ? new Map() : {};
4976
4976
  return addPairToJSMap(ctx, pair, this);
4977
4977
  }
4978
4978
  toString(ctx, onComment, onChompKeep) {
4979
- return _optionalChain$r([ctx, 'optionalAccess', _3 => _3.doc])
4979
+ return _optionalChain$q([ctx, 'optionalAccess', _3 => _3.doc])
4980
4980
  ? stringifyPair(this, ctx, onComment, onChompKeep)
4981
4981
  : JSON.stringify(this);
4982
4982
  }
4983
4983
  }
4984
4984
 
4985
- function _nullishCoalesce$7(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain$q(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
4985
+ function _nullishCoalesce$7(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain$p(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
4986
4986
  function stringifyCollection(collection, ctx, options) {
4987
4987
  const flow = _nullishCoalesce$7(ctx.inFlow, () => ( collection.flow));
4988
4988
  const stringify = flow ? stringifyFlowCollection : stringifyBlockCollection;
@@ -5076,7 +5076,7 @@ function stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {
5076
5076
  if (iv.commentBefore)
5077
5077
  reqNewline = true;
5078
5078
  }
5079
- else if (item.value == null && _optionalChain$q([ik, 'optionalAccess', _ => _.comment])) {
5079
+ else if (item.value == null && _optionalChain$p([ik, 'optionalAccess', _ => _.comment])) {
5080
5080
  comment = ik.comment;
5081
5081
  }
5082
5082
  }
@@ -5131,7 +5131,7 @@ function addCommentBefore({ indent, options: { commentString } }, lines, comment
5131
5131
  }
5132
5132
  }
5133
5133
 
5134
- function _nullishCoalesce$6(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain$p(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
5134
+ function _nullishCoalesce$6(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain$o(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
5135
5135
  function findPair(items, key) {
5136
5136
  const k = isScalar(key) ? key.value : key;
5137
5137
  for (const it of items) {
@@ -5192,12 +5192,12 @@ class YAMLMap extends Collection {
5192
5192
  _pair = pair;
5193
5193
  else if (!pair || typeof pair !== 'object' || !('key' in pair)) {
5194
5194
  // In TypeScript, this never happens.
5195
- _pair = new Pair(pair, _optionalChain$p([pair, 'optionalAccess', _2 => _2.value]));
5195
+ _pair = new Pair(pair, _optionalChain$o([pair, 'optionalAccess', _2 => _2.value]));
5196
5196
  }
5197
5197
  else
5198
5198
  _pair = new Pair(pair.key, pair.value);
5199
5199
  const prev = findPair(this.items, _pair.key);
5200
- const sortEntries = _optionalChain$p([this, 'access', _3 => _3.schema, 'optionalAccess', _4 => _4.sortMapEntries]);
5200
+ const sortEntries = _optionalChain$o([this, 'access', _3 => _3.schema, 'optionalAccess', _4 => _4.sortMapEntries]);
5201
5201
  if (prev) {
5202
5202
  if (!overwrite)
5203
5203
  throw new Error(`Key ${_pair.key} already set`);
@@ -5227,7 +5227,7 @@ class YAMLMap extends Collection {
5227
5227
  }
5228
5228
  get(key, keepScalar) {
5229
5229
  const it = findPair(this.items, key);
5230
- const node = _optionalChain$p([it, 'optionalAccess', _5 => _5.value]);
5230
+ const node = _optionalChain$o([it, 'optionalAccess', _5 => _5.value]);
5231
5231
  return _nullishCoalesce$6((!keepScalar && isScalar(node) ? node.value : node), () => ( undefined));
5232
5232
  }
5233
5233
  has(key) {
@@ -5242,8 +5242,8 @@ class YAMLMap extends Collection {
5242
5242
  * @returns Instance of Type, Map, or Object
5243
5243
  */
5244
5244
  toJSON(_, ctx, Type) {
5245
- const map = Type ? new Type() : _optionalChain$p([ctx, 'optionalAccess', _6 => _6.mapAsMap]) ? new Map() : {};
5246
- if (_optionalChain$p([ctx, 'optionalAccess', _7 => _7.onCreate]))
5245
+ const map = Type ? new Type() : _optionalChain$o([ctx, 'optionalAccess', _6 => _6.mapAsMap]) ? new Map() : {};
5246
+ if (_optionalChain$o([ctx, 'optionalAccess', _7 => _7.onCreate]))
5247
5247
  ctx.onCreate(map);
5248
5248
  for (const item of this.items)
5249
5249
  addPairToJSMap(ctx, map, item);
@@ -5268,7 +5268,7 @@ class YAMLMap extends Collection {
5268
5268
  }
5269
5269
  }
5270
5270
 
5271
- function _optionalChain$o(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
5271
+ function _optionalChain$n(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
5272
5272
  class YAMLSeq extends Collection {
5273
5273
  static get tagName() {
5274
5274
  return 'tag:yaml.org,2002:seq';
@@ -5331,7 +5331,7 @@ class YAMLSeq extends Collection {
5331
5331
  }
5332
5332
  toJSON(_, ctx) {
5333
5333
  const seq = [];
5334
- if (_optionalChain$o([ctx, 'optionalAccess', _2 => _2.onCreate]))
5334
+ if (_optionalChain$n([ctx, 'optionalAccess', _2 => _2.onCreate]))
5335
5335
  ctx.onCreate(seq);
5336
5336
  let i = 0;
5337
5337
  for (const item of this.items)
@@ -5410,7 +5410,7 @@ function createPairs(schema, iterable, ctx) {
5410
5410
  return pairs;
5411
5411
  }
5412
5412
 
5413
- function _optionalChain$n(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
5413
+ function _optionalChain$m(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
5414
5414
  class YAMLOMap extends YAMLSeq {
5415
5415
  constructor() {
5416
5416
  super();
@@ -5429,7 +5429,7 @@ class YAMLOMap extends YAMLSeq {
5429
5429
  if (!ctx)
5430
5430
  return super.toJSON(_);
5431
5431
  const map = new Map();
5432
- if (_optionalChain$n([ctx, 'optionalAccess', _2 => _2.onCreate]))
5432
+ if (_optionalChain$m([ctx, 'optionalAccess', _2 => _2.onCreate]))
5433
5433
  ctx.onCreate(map);
5434
5434
  for (const pair of this.items) {
5435
5435
  let key, value;
@@ -5547,7 +5547,7 @@ const isDirExists = async (file) => {
5547
5547
  }
5548
5548
  };
5549
5549
 
5550
- function _optionalChain$m(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// ABOUTME: Project type detection utility
5550
+ function _optionalChain$l(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// ABOUTME: Project type detection utility
5551
5551
 
5552
5552
  /**
5553
5553
  * 支持的项目类型枚举
@@ -5649,7 +5649,7 @@ const collectProjectInfo = async (
5649
5649
  }
5650
5650
 
5651
5651
  const scripts = Object.entries(
5652
- (_optionalChain$m([packageJson, 'optionalAccess', _ => _.scripts]) ) || {},
5652
+ (_optionalChain$l([packageJson, 'optionalAccess', _ => _.scripts]) ) || {},
5653
5653
  ).reduce((acc, [name, script]) => {
5654
5654
  if (typeof script === 'string') {
5655
5655
  acc[name] = script;
@@ -5803,7 +5803,7 @@ const detectProjectType = async (
5803
5803
  };
5804
5804
  };
5805
5805
 
5806
- function _optionalChain$l(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
5806
+ function _optionalChain$k(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
5807
5807
 
5808
5808
 
5809
5809
  /**
@@ -5962,35 +5962,66 @@ const saveProjectPatchState = async (
5962
5962
  await saveTomlCozeConfig(config, projectPath);
5963
5963
  };
5964
5964
 
5965
- /**
5966
- * 获取指定命令的配置
5967
- *
5968
- * @param config - .coze 配置对象
5969
- * @param commandName - 命令名称 (dev/build/start)
5970
- * @returns 命令配置数组
5971
- */
5972
- const getCommandConfig = (
5965
+
5966
+
5967
+ const getDefaultCommandConfig = (
5973
5968
  config,
5974
5969
  commandName,
5975
5970
  ) => {
5976
- let commandConfig;
5971
+ switch (commandName) {
5972
+ case 'dev':
5973
+ return _optionalChain$k([config, 'access', _ => _.dev, 'optionalAccess', _2 => _2.run]);
5974
+ case 'build':
5975
+ return _optionalChain$k([config, 'access', _3 => _3.deploy, 'optionalAccess', _4 => _4.build]);
5976
+ case 'start':
5977
+ return _optionalChain$k([config, 'access', _5 => _5.deploy, 'optionalAccess', _6 => _6.run]);
5978
+ case 'validate':
5979
+ return _optionalChain$k([config, 'access', _7 => _7.dev, 'optionalAccess', _8 => _8.validate]);
5980
+ default:
5981
+ throw new Error(`Unknown command: ${commandName}`);
5982
+ }
5983
+ };
5977
5984
 
5985
+ const getWindowsCommandConfig = (
5986
+ config,
5987
+ commandName,
5988
+ ) => {
5978
5989
  switch (commandName) {
5979
5990
  case 'dev':
5980
- commandConfig = _optionalChain$l([config, 'access', _ => _.dev, 'optionalAccess', _2 => _2.run]);
5981
- break;
5991
+ return _optionalChain$k([config, 'access', _9 => _9.dev, 'optionalAccess', _10 => _10.run_win]);
5982
5992
  case 'build':
5983
- commandConfig = _optionalChain$l([config, 'access', _3 => _3.deploy, 'optionalAccess', _4 => _4.build]);
5984
- break;
5993
+ return _optionalChain$k([config, 'access', _11 => _11.deploy, 'optionalAccess', _12 => _12.build_win]);
5985
5994
  case 'start':
5986
- commandConfig = _optionalChain$l([config, 'access', _5 => _5.deploy, 'optionalAccess', _6 => _6.run]);
5987
- break;
5995
+ return _optionalChain$k([config, 'access', _13 => _13.deploy, 'optionalAccess', _14 => _14.run_win]);
5988
5996
  case 'validate':
5989
- commandConfig = _optionalChain$l([config, 'access', _7 => _7.dev, 'optionalAccess', _8 => _8.validate]);
5990
- break;
5997
+ return _optionalChain$k([config, 'access', _15 => _15.dev, 'optionalAccess', _16 => _16.validate_win]);
5991
5998
  default:
5992
5999
  throw new Error(`Unknown command: ${commandName}`);
5993
6000
  }
6001
+ };
6002
+
6003
+ /**
6004
+ * 获取指定命令的配置
6005
+ *
6006
+ * Windows 优先使用非空的 *_win 配置;其他平台(包括 WSL)始终使用默认配置。
6007
+ *
6008
+ * @param config - .coze 配置对象
6009
+ * @param commandName - 命令名称 (dev/build/start)
6010
+ * @returns 命令配置数组
6011
+ */
6012
+ const getCommandConfig = (
6013
+ config,
6014
+ commandName,
6015
+ platform = process.platform,
6016
+ ) => {
6017
+ const defaultCommandConfig = getDefaultCommandConfig(config, commandName);
6018
+ const windowsCommandConfig =
6019
+ platform === 'win32'
6020
+ ? getWindowsCommandConfig(config, commandName)
6021
+ : undefined;
6022
+ const commandConfig = _optionalChain$k([windowsCommandConfig, 'optionalAccess', _17 => _17.length])
6023
+ ? windowsCommandConfig
6024
+ : defaultCommandConfig;
5994
6025
 
5995
6026
  if (!commandConfig || commandConfig.length === 0) {
5996
6027
  throw new Error(
@@ -6137,7 +6168,7 @@ const byFlag = (flag) => {
6137
6168
  return predicate;
6138
6169
  };
6139
6170
 
6140
- function _optionalChain$k(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
6171
+ function _optionalChain$j(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
6141
6172
 
6142
6173
 
6143
6174
 
@@ -6168,7 +6199,7 @@ echo "Validate passed!"
6168
6199
  * @returns
6169
6200
  */
6170
6201
  const isCozeValid$3 = (cozeConfig) => {
6171
- if (_optionalChain$k([cozeConfig, 'access', _ => _.dev, 'optionalAccess', _2 => _2.validate])) {
6202
+ if (_optionalChain$j([cozeConfig, 'access', _ => _.dev, 'optionalAccess', _2 => _2.validate])) {
6172
6203
  logger.info('[patch-expo-validate] NOT APPLY: dev.validate exists');
6173
6204
  return false;
6174
6205
  }
@@ -6313,7 +6344,7 @@ const patchExpoValidate = {
6313
6344
  },
6314
6345
  };
6315
6346
 
6316
- function _optionalChain$j(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
6347
+ function _optionalChain$i(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
6317
6348
 
6318
6349
 
6319
6350
 
@@ -6346,7 +6377,7 @@ echo "Validate passed!"
6346
6377
  * @returns
6347
6378
  */
6348
6379
  const isCozeValid$2 = (cozeConfig) => {
6349
- if (_optionalChain$j([cozeConfig, 'access', _ => _.dev, 'optionalAccess', _2 => _2.validate])) {
6380
+ if (_optionalChain$i([cozeConfig, 'access', _ => _.dev, 'optionalAccess', _2 => _2.validate])) {
6350
6381
  logger.info('[patch-nextjs-validate] NOT APPLY: dev.validate exists');
6351
6382
  return false;
6352
6383
  }
@@ -6494,7 +6525,7 @@ const patchNextjsValidate = {
6494
6525
  },
6495
6526
  };
6496
6527
 
6497
- function _optionalChain$i(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
6528
+ function _optionalChain$h(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
6498
6529
 
6499
6530
  const PATCH_ID$5 = 'nextjs/validate-concurrently@0.0.30';
6500
6531
  const PACKAGE_JSON_FILE$3 = 'package.json';
@@ -6527,7 +6558,7 @@ const readPackageJson = async (projectFolder) => {
6527
6558
  };
6528
6559
 
6529
6560
  const getTargetValidateScript = (packageJson) => {
6530
- const validateScript = _optionalChain$i([packageJson, 'access', _ => _.scripts, 'optionalAccess', _2 => _2.validate]);
6561
+ const validateScript = _optionalChain$h([packageJson, 'access', _ => _.scripts, 'optionalAccess', _2 => _2.validate]);
6531
6562
  if (typeof validateScript !== 'string') {
6532
6563
  return null;
6533
6564
  }
@@ -6544,7 +6575,7 @@ const getTargetValidateScript = (packageJson) => {
6544
6575
 
6545
6576
  const canStackAfterNextjsValidatePatch = async (context, packageJson) => {
6546
6577
  const scripts = packageJson.scripts || {};
6547
- if (typeof scripts.validate !== 'undefined' || typeof scripts['ts-check'] !== 'string' || _optionalChain$i([context, 'access', _3 => _3.cozeConfig, 'access', _4 => _4.dev, 'optionalAccess', _5 => _5.validate])) {
6578
+ if (typeof scripts.validate !== 'undefined' || typeof scripts['ts-check'] !== 'string' || _optionalChain$h([context, 'access', _3 => _3.cozeConfig, 'access', _4 => _4.dev, 'optionalAccess', _5 => _5.validate])) {
6548
6579
  return false;
6549
6580
  }
6550
6581
 
@@ -6613,7 +6644,7 @@ const patchNextjsValidateConcurrently = {
6613
6644
  apply: patchPackageJson$2,
6614
6645
  };
6615
6646
 
6616
- function _optionalChain$h(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
6647
+ function _optionalChain$g(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
6617
6648
 
6618
6649
 
6619
6650
 
@@ -6646,7 +6677,7 @@ echo "Validate passed!"
6646
6677
  * @returns
6647
6678
  */
6648
6679
  const isCozeValid$1 = (cozeConfig) => {
6649
- if (_optionalChain$h([cozeConfig, 'access', _ => _.dev, 'optionalAccess', _2 => _2.validate])) {
6680
+ if (_optionalChain$g([cozeConfig, 'access', _ => _.dev, 'optionalAccess', _2 => _2.validate])) {
6650
6681
  logger.info('[patch-vite-validate] NOT APPLY: dev.validate exists');
6651
6682
  return false;
6652
6683
  }
@@ -6791,7 +6822,7 @@ const patchViteValidate = {
6791
6822
  },
6792
6823
  };
6793
6824
 
6794
- function _optionalChain$g(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
6825
+ function _optionalChain$f(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
6795
6826
 
6796
6827
 
6797
6828
 
@@ -6828,7 +6859,7 @@ echo "Validate passed!"
6828
6859
  * @returns
6829
6860
  */
6830
6861
  const isCozeValid = (cozeConfig) => {
6831
- if (_optionalChain$g([cozeConfig, 'access', _ => _.dev, 'optionalAccess', _2 => _2.validate])) {
6862
+ if (_optionalChain$f([cozeConfig, 'access', _ => _.dev, 'optionalAccess', _2 => _2.validate])) {
6832
6863
  logger.info('[patch-taro-validate] NOT APPLY: dev.validate exists');
6833
6864
  return false;
6834
6865
  }
@@ -6977,7 +7008,7 @@ const patchTaroValidate = {
6977
7008
  },
6978
7009
  };
6979
7010
 
6980
- function _optionalChain$f(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
7011
+ function _optionalChain$e(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
6981
7012
  const PATCH_ID$2 = 'taro/update-pack-script-for-tt-build@0.0.13';
6982
7013
  const PACKAGE_JSON_FILE = 'package.json';
6983
7014
  const PACK_SCRIPT_FILE = '.cozeproj/scripts/pack.sh';
@@ -7056,12 +7087,12 @@ const readPackageScripts = async (
7056
7087
  const packageJsonContent = await fs$1.readFile(packageJsonPath, 'utf-8');
7057
7088
  const packageJson = safeJsonParse(packageJsonContent, null);
7058
7089
 
7059
- return _optionalChain$f([packageJson, 'optionalAccess', _ => _.scripts]) || null;
7090
+ return _optionalChain$e([packageJson, 'optionalAccess', _ => _.scripts]) || null;
7060
7091
  };
7061
7092
 
7062
7093
  const hasBuildTtScript = async (projectFolder) => {
7063
7094
  const scripts = await readPackageScripts(projectFolder);
7064
- return typeof _optionalChain$f([scripts, 'optionalAccess', _2 => _2['build:tt']]) === 'string';
7095
+ return typeof _optionalChain$e([scripts, 'optionalAccess', _2 => _2['build:tt']]) === 'string';
7065
7096
  };
7066
7097
 
7067
7098
  const hasLegacyPackScript = async (projectFolder) => {
@@ -7415,7 +7446,7 @@ const getTemplatePatches = (
7415
7446
  ) =>
7416
7447
  patches.filter(patch => patch.template === template);
7417
7448
 
7418
- function _nullishCoalesce$5(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain$e(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
7449
+ function _nullishCoalesce$5(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain$d(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
7419
7450
  const DEFAULT_LEGACY_VERSION = 'legacy';
7420
7451
 
7421
7452
  const loadFlagsWithFallback = async () => {
@@ -7521,7 +7552,7 @@ const getNextPatchState = (
7521
7552
 
7522
7553
  ) => ({
7523
7554
  template,
7524
- version: _optionalChain$e([config, 'access', _ => _.project, 'optionalAccess', _2 => _2.version]) || DEFAULT_LEGACY_VERSION,
7555
+ version: _optionalChain$d([config, 'access', _ => _.project, 'optionalAccess', _2 => _2.version]) || DEFAULT_LEGACY_VERSION,
7525
7556
  appliedPatches: [...appliedPatches, patchId],
7526
7557
  });
7527
7558
 
@@ -7545,15 +7576,15 @@ const executePatch = async (
7545
7576
  }
7546
7577
 
7547
7578
  const template =
7548
- _optionalChain$e([config, 'access', _3 => _3.project, 'optionalAccess', _4 => _4.template]) || (await detectTemplateKey(projectFolder));
7579
+ _optionalChain$d([config, 'access', _3 => _3.project, 'optionalAccess', _4 => _4.template]) || (await detectTemplateKey(projectFolder));
7549
7580
 
7550
7581
  if (!template) {
7551
7582
  logger.info('Patch skipped: template not detected');
7552
7583
  return;
7553
7584
  }
7554
7585
 
7555
- const appliedPatches = [...(_optionalChain$e([config, 'access', _5 => _5.project, 'optionalAccess', _6 => _6.appliedPatches]) || [])];
7556
- const projectVersion = _optionalChain$e([config, 'access', _7 => _7.project, 'optionalAccess', _8 => _8.version]);
7586
+ const appliedPatches = [...(_optionalChain$d([config, 'access', _5 => _5.project, 'optionalAccess', _6 => _6.appliedPatches]) || [])];
7587
+ const projectVersion = _optionalChain$d([config, 'access', _7 => _7.project, 'optionalAccess', _8 => _8.version]);
7557
7588
  const flags = await loadFlagsWithFallback();
7558
7589
 
7559
7590
  const context = {
@@ -7656,14 +7687,14 @@ const registerCommand$5 = program => {
7656
7687
  ) => {
7657
7688
  await executePatch({
7658
7689
  directory,
7659
- dryRun: _optionalChain$e([command, 'optionalAccess', _9 => _9.dryRun]),
7660
- showFlags: _optionalChain$e([command, 'optionalAccess', _10 => _10.showFlags]),
7690
+ dryRun: _optionalChain$d([command, 'optionalAccess', _9 => _9.dryRun]),
7691
+ showFlags: _optionalChain$d([command, 'optionalAccess', _10 => _10.showFlags]),
7661
7692
  });
7662
7693
  },
7663
7694
  );
7664
7695
  };
7665
7696
 
7666
- function _nullishCoalesce$4(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain$d(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
7697
+ function _nullishCoalesce$4(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain$c(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
7667
7698
  const d$1 = debug('coze-init-cli:run');
7668
7699
 
7669
7700
  /**
@@ -7794,12 +7825,12 @@ const executeRun = async (commandName, options = {}) => {
7794
7825
  }
7795
7826
 
7796
7827
  // 将输出同时写入控制台和日志文件
7797
- _optionalChain$d([childProcess, 'access', _ => _.stdout, 'optionalAccess', _2 => _2.on, 'call', _3 => _3('data', (data) => {
7828
+ _optionalChain$c([childProcess, 'access', _ => _.stdout, 'optionalAccess', _2 => _2.on, 'call', _3 => _3('data', (data) => {
7798
7829
  process.stdout.write(data);
7799
7830
  logStream.write(data);
7800
7831
  })]);
7801
7832
 
7802
- _optionalChain$d([childProcess, 'access', _4 => _4.stderr, 'optionalAccess', _5 => _5.on, 'call', _6 => _6('data', (data) => {
7833
+ _optionalChain$c([childProcess, 'access', _4 => _4.stderr, 'optionalAccess', _5 => _5.on, 'call', _6 => _6('data', (data) => {
7803
7834
  process.stderr.write(data);
7804
7835
  logStream.write(data);
7805
7836
  })]);
@@ -8743,7 +8774,7 @@ const scanRoutesOnce = async (
8743
8774
  }
8744
8775
  };
8745
8776
 
8746
- function _optionalChain$c(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// Route manifest generation command
8777
+ function _optionalChain$b(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// Route manifest generation command
8747
8778
 
8748
8779
 
8749
8780
  const log = debug('coze:routes');
@@ -8844,7 +8875,7 @@ const registerCommand$3 = program => {
8844
8875
  'Output file path (defaults to ~/.coze/routes.json)',
8845
8876
  )
8846
8877
  .action(async (directory, options) => {
8847
- await executeRoutes({ directory, output: _optionalChain$c([options, 'optionalAccess', _ => _.output]) });
8878
+ await executeRoutes({ directory, output: _optionalChain$b([options, 'optionalAccess', _ => _.output]) });
8848
8879
  });
8849
8880
  };
8850
8881
 
@@ -10435,7 +10466,7 @@ const withRequestedApplicationType = (
10435
10466
  };
10436
10467
  };
10437
10468
 
10438
- function _optionalChain$b(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
10469
+ function _optionalChain$a(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
10439
10470
 
10440
10471
  const DEFAULT_CONFIG = {
10441
10472
  apiBaseUrl: 'https://code.coze.cn/',
@@ -10464,7 +10495,7 @@ const readJson = async (path) => {
10464
10495
  };
10465
10496
 
10466
10497
  const configuredPath = (options) =>
10467
- _optionalChain$b([options, 'optionalAccess', _ => _.config]) || process.env.COZE_CONFIG_FILE;
10498
+ _optionalChain$a([options, 'optionalAccess', _ => _.config]) || process.env.COZE_CONFIG_FILE;
10468
10499
 
10469
10500
  const loadConfig = async (options = {}) => {
10470
10501
  const customPath = configuredPath(options);
@@ -10485,11 +10516,15 @@ const loadConfig = async (options = {}) => {
10485
10516
  }
10486
10517
  : {}),
10487
10518
  ...(process.env.COZE_ORG_ID ? { organizationId: process.env.COZE_ORG_ID } : {}),
10519
+ ...(process.env.COZE_ACCOUNT_ID ? { cozeAccountId: process.env.COZE_ACCOUNT_ID } : {}),
10488
10520
  ...(process.env.COZE_SPACE_ID ? { spaceId: process.env.COZE_SPACE_ID } : {}),
10489
10521
  ...(process.env.COZE_PROJECT_ID ? { projectId: process.env.COZE_PROJECT_ID } : {}),
10490
10522
  ...(options.orgId ? { organizationId: options.orgId } : {}),
10491
10523
  ...(options.spaceId ? { spaceId: options.spaceId } : {}),
10492
10524
  ...(options.apiBaseUrl ? { apiBaseUrl: options.apiBaseUrl } : {}),
10525
+ // Runtime-only trust decision: a value persisted in config.json must never enable
10526
+ // project-secret injection for an OAuth access token.
10527
+ injectApiToken: Boolean(environmentAccessToken),
10493
10528
  };
10494
10529
  return config;
10495
10530
  };
@@ -10815,7 +10850,7 @@ const loginWithOAuth = async (
10815
10850
  await saveOAuthToken(config, options, await pollToken(config, deviceCode));
10816
10851
  };
10817
10852
 
10818
- function _optionalChain$a(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
10853
+ function _optionalChain$9(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
10819
10854
 
10820
10855
 
10821
10856
 
@@ -10881,10 +10916,10 @@ const unwrap = (
10881
10916
  responseMetadata,
10882
10917
  ) => {
10883
10918
  const root = isRecord(payload) ? payload : undefined;
10884
- const first = isRecord(_optionalChain$a([root, 'optionalAccess', _ => _.data])) ? root.data : undefined;
10885
- const second = isRecord(_optionalChain$a([first, 'optionalAccess', _2 => _2.data])) ? first.data : undefined;
10919
+ const first = isRecord(_optionalChain$9([root, 'optionalAccess', _ => _.data])) ? root.data : undefined;
10920
+ const second = isRecord(_optionalChain$9([first, 'optionalAccess', _2 => _2.data])) ? first.data : undefined;
10886
10921
  const envelope = [root, first].find(candidate => candidate && 'code' in candidate);
10887
- if (_optionalChain$a([envelope, 'optionalAccess', _3 => _3.code]) !== undefined && Number(envelope.code) !== 0) {
10922
+ if (_optionalChain$9([envelope, 'optionalAccess', _3 => _3.code]) !== undefined && Number(envelope.code) !== 0) {
10888
10923
  throw new CliError(
10889
10924
  typeof envelope.msg === 'string'
10890
10925
  ? envelope.msg.slice(0, MAX_MESSAGE_LENGTH)
@@ -10933,10 +10968,22 @@ class DeployApiClient {
10933
10968
  'agw-js-conv': 'str',
10934
10969
  'x-request-from-coze-cli': '1',
10935
10970
  };
10936
- if (this.config.organizationId) {
10937
- headers['x-coze-account'] = this.config.organizationId;
10971
+ // Only an explicit environment credential may become a project runtime secret.
10972
+ // OAuth credentials loaded from config.json remain authentication-only.
10973
+ if (
10974
+ this.config.injectApiToken &&
10975
+ path === '/deploy_history/create' &&
10976
+ useApiPrefix
10977
+ ) {
10978
+ headers['x-coze-deploy-inject-api-token'] = 'true';
10979
+ }
10980
+ // Coze account id: an explicit COZE_ACCOUNT_ID (config.cozeAccountId) always wins;
10981
+ // otherwise fall back to the organization id resolved from login/config.
10982
+ const cozeAccount = this.config.cozeAccountId || this.config.organizationId;
10983
+ if (cozeAccount) {
10984
+ headers['x-coze-account'] = cozeAccount;
10938
10985
  }
10939
- const lane = _optionalChain$a([this, 'access', _4 => _4.globalOptions, 'access', _5 => _5.lane, 'optionalAccess', _6 => _6.trim, 'call', _7 => _7()]) || _optionalChain$a([this, 'access', _8 => _8.config, 'access', _9 => _9.xTTEnv, 'optionalAccess', _10 => _10.trim, 'call', _11 => _11()]);
10986
+ const lane = _optionalChain$9([this, 'access', _4 => _4.globalOptions, 'access', _5 => _5.lane, 'optionalAccess', _6 => _6.trim, 'call', _7 => _7()]) || _optionalChain$9([this, 'access', _8 => _8.config, 'access', _9 => _9.xTTEnv, 'optionalAccess', _10 => _10.trim, 'call', _11 => _11()]);
10940
10987
  if (lane) {
10941
10988
  headers['x-use-ppe'] = '1';
10942
10989
  headers['x-tt-env'] = lane;
@@ -10967,7 +11014,7 @@ class DeployApiClient {
10967
11014
  if (!response.ok) {
10968
11015
  const root = isRecord(payload) ? payload : undefined;
10969
11016
  throw new CliError(
10970
- typeof _optionalChain$a([root, 'optionalAccess', _12 => _12.msg]) === 'string'
11017
+ typeof _optionalChain$9([root, 'optionalAccess', _12 => _12.msg]) === 'string'
10971
11018
  ? root.msg.slice(0, MAX_MESSAGE_LENGTH)
10972
11019
  : `Deployment API failed: ${response.status} ${response.statusText}` +
10973
11020
  `${validJson ? '' : '; response was not JSON'}`,
@@ -11000,6 +11047,17 @@ class DeployApiClient {
11000
11047
  );
11001
11048
  }
11002
11049
 
11050
+ // 回读当前登录态对应的 Coze 账号 id。无入参:账号由服务端从登录态解析(X-Coze-Account →
11051
+ // access token → 兜底登录用户),客户端传什么都只有「等于登录态」一种合法取值。
11052
+ // 只在建 Project 前用一次,用来定这个 Project 下应用的账号归属。
11053
+ getCozeAccount() {
11054
+ return this.post(
11055
+ '/account/get',
11056
+ {},
11057
+ 'coze_account_id',
11058
+ );
11059
+ }
11060
+
11003
11061
  listSpaces(body
11004
11062
 
11005
11063
 
@@ -11434,7 +11492,7 @@ const registerDoctor = (program) => {
11434
11492
  });
11435
11493
  };
11436
11494
 
11437
- function _optionalChain$9(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
11495
+ function _optionalChain$8(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
11438
11496
 
11439
11497
 
11440
11498
 
@@ -11465,13 +11523,66 @@ function _optionalChain$9(ops) { let lastAccessLHS = undefined; let value = ops[
11465
11523
 
11466
11524
 
11467
11525
  const getDeployParentOptions = (command) =>
11468
- _optionalChain$9([command, 'access', _ => _.parent, 'optionalAccess', _2 => _2.opts, 'call', _3 => _3()]) || {};
11526
+ _optionalChain$8([command, 'access', _ => _.parent, 'optionalAccess', _2 => _2.opts, 'call', _3 => _3()]) || {};
11469
11527
 
11470
11528
  const getDeployAppIdOption = (
11471
11529
  options,
11472
11530
  command,
11473
11531
  ) => options.appId || getDeployParentOptions(command).appId;
11474
11532
 
11533
+ function _optionalChain$7(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; } async function _asyncOptionalChain$1(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = await fn(value); } else if (op === 'call' || op === 'optionalCall') { value = await fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
11534
+
11535
+ const isAccountId = (value) => /^[1-9]\d*$/u.test(value);
11536
+
11537
+ /**
11538
+ * 定出这个 Project 下的应用该归属哪个 Coze 账号,写进 project_settings.extra.coze_account_id。
11539
+ *
11540
+ * 优先级(与 api-client 里 x-coze-account 的取值顺序一致,不另立一套口径):
11541
+ * 1. COZE_ACCOUNT_ID(config.cozeAccountId)—— 用户显式指定
11542
+ * 2. COZE_ORG_ID / --org-id(config.organizationId)—— 用户显式指定组织
11543
+ * 3. 登录态回读(deploy v2 account/get)
11544
+ *
11545
+ * ⚠️ 1、2 命中时**不打接口**:本地已经知道账号了,再问一次服务端只是多一个 RTT 和一个失败点。
11546
+ *
11547
+ * 拿不到就返回 undefined(不写 extra),部署照常继续:服务端在 deploy_history/create 里仍会
11548
+ * 按同一条阶梯解析账号,结果与不加这段逻辑时完全一致 —— 只是无登录态的预览初始化那条链路
11549
+ * 少了 Project 上这份归属记录。这是一个辅助接口,不该成为首次部署的单点。
11550
+ */
11551
+ const resolveCozeAccountId = async (
11552
+ runtime,
11553
+ ) => {
11554
+ const configured =
11555
+ _optionalChain$7([runtime, 'access', _ => _.config, 'access', _2 => _2.cozeAccountId, 'optionalAccess', _3 => _3.trim, 'call', _4 => _4()]) || _optionalChain$7([runtime, 'access', _5 => _5.config, 'access', _6 => _6.organizationId, 'optionalAccess', _7 => _7.trim, 'call', _8 => _8()]);
11556
+ if (configured) {
11557
+ if (!isAccountId(configured)) {
11558
+ // 不把非法值写进 Project —— 它会被服务端当成「明确但损坏的归属」直接报错。
11559
+ // 该值仍会作为 x-coze-account 发出去,由服务端给出明确的参数错误。
11560
+ runtime.output.debug(
11561
+ `[deploy] Ignoring malformed Coze account id for project settings: ${configured}`,
11562
+ );
11563
+ return undefined;
11564
+ }
11565
+ runtime.output.debug(`[deploy] Using configured Coze account ${configured}`);
11566
+ return configured;
11567
+ }
11568
+ try {
11569
+ const accountId = await _asyncOptionalChain$1([(await runtime.client.getCozeAccount()), 'access', async _9 => _9.coze_account_id, 'optionalAccess', async _10 => _10.trim, 'call', async _11 => _11()]);
11570
+ if (!accountId || !isAccountId(accountId)) {
11571
+ runtime.output.debug(
11572
+ `[deploy] Deployment API returned no usable Coze account id: ${String(accountId)}`,
11573
+ );
11574
+ return undefined;
11575
+ }
11576
+ runtime.output.debug(`[deploy] Resolved Coze account ${accountId} from the current login`);
11577
+ return accountId;
11578
+ } catch (error) {
11579
+ runtime.output.warn(
11580
+ `Unable to resolve the Coze account from the current login; the project will be created without an explicit account: ${String(error)}`,
11581
+ );
11582
+ return undefined;
11583
+ }
11584
+ };
11585
+
11475
11586
  const getCreateDeployConfig = (config) => ({
11476
11587
  deploy_config: {
11477
11588
  cpu: config.deploy_config.cpu,
@@ -11515,10 +11626,10 @@ const TERMINAL_STATUSES = new Set([
11515
11626
  const getDeployStatusText = (status) =>
11516
11627
  status ? STATUS_NAMES[status] || 'Unknown' : 'Unknown';
11517
11628
 
11518
- function _optionalChain$8(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
11629
+ function _optionalChain$6(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
11519
11630
 
11520
11631
  const formatDeployDetails = (history) =>
11521
- (_optionalChain$8([history, 'optionalAccess', _ => _.deploy_detail]) || []).map(detail => ({
11632
+ (_optionalChain$6([history, 'optionalAccess', _ => _.deploy_detail]) || []).map(detail => ({
11522
11633
  target: detail.target,
11523
11634
  status: getDeployStatusText(detail.status),
11524
11635
  deploy_log_key: detail.deploy_log_key,
@@ -11528,7 +11639,7 @@ const formatDeployDetails = (history) =>
11528
11639
  const getDeployLogKeys = (history) =>
11529
11640
  [...new Set(
11530
11641
  (history.deploy_detail || [])
11531
- .map(detail => _optionalChain$8([detail, 'access', _2 => _2.deploy_log_key, 'optionalAccess', _3 => _3.trim, 'call', _4 => _4()]))
11642
+ .map(detail => _optionalChain$6([detail, 'access', _2 => _2.deploy_log_key, 'optionalAccess', _3 => _3.trim, 'call', _4 => _4()]))
11532
11643
  .filter((key) => Boolean(key)),
11533
11644
  )];
11534
11645
 
@@ -11543,7 +11654,7 @@ const resolveDeployHistoryId = (
11543
11654
  ) =>
11544
11655
  normalizePositiveId(deployHistoryId) || normalizePositiveId(previousDeployHistoryId);
11545
11656
 
11546
- function _optionalChain$7(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
11657
+ function _optionalChain$5(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
11547
11658
 
11548
11659
  const SOURCE_SNAPSHOT_BYTES = 20;
11549
11660
  const PROJECT_METADATA_FILE_MODE = 0o644;
@@ -11553,7 +11664,7 @@ const isId = (value) =>
11553
11664
 
11554
11665
 
11555
11666
  const resolveAppId = async (cwd, appId) => {
11556
- const explicit = _optionalChain$7([appId, 'optionalAccess', _ => _.trim, 'call', _2 => _2()]);
11667
+ const explicit = _optionalChain$5([appId, 'optionalAccess', _ => _.trim, 'call', _2 => _2()]);
11557
11668
  if (explicit) {
11558
11669
  return explicit;
11559
11670
  }
@@ -11599,11 +11710,11 @@ const readProjectMetadata = async (
11599
11710
  }
11600
11711
  throw error;
11601
11712
  }
11602
- const projectSection = _optionalChain$7([cozeFileContent, 'access', _3 => _3.match, 'call', _4 => _4(
11713
+ const projectSection = _optionalChain$5([cozeFileContent, 'access', _3 => _3.match, 'call', _4 => _4(
11603
11714
  /^\s*\[project\]\s*(?:#.*)?$([\s\S]*?)(?=^\s*\[[^\]]+\]\s*(?:#.*)?$|(?![\s\S]))/mu,
11604
11715
  ), 'optionalAccess', _5 => _5[1]]);
11605
11716
  const readProjectString = (key) =>
11606
- _optionalChain$7([projectSection
11717
+ _optionalChain$5([projectSection
11607
11718
  , 'optionalAccess', _6 => _6.match, 'call', _7 => _7(new RegExp(`^\\s*${key}\\s*=\\s*["']([^"']+)["']`, 'mu')), 'optionalAccess', _8 => _8[1]
11608
11719
  , 'optionalAccess', _9 => _9.trim, 'call', _10 => _10()]);
11609
11720
  const name = readProjectString('name');
@@ -11611,7 +11722,7 @@ const readProjectMetadata = async (
11611
11722
  const projectId = readProjectString('project_id');
11612
11723
  const appId = readProjectString('app_id');
11613
11724
  const hasUnquotedId = (key) =>
11614
- Boolean(_optionalChain$7([projectSection, 'optionalAccess', _11 => _11.match, 'call', _12 => _12(new RegExp(`^\\s*${key}\\s*=\\s*(?!["'])\\S+`, 'mu'))]));
11725
+ Boolean(_optionalChain$5([projectSection, 'optionalAccess', _11 => _11.match, 'call', _12 => _12(new RegExp(`^\\s*${key}\\s*=\\s*(?!["'])\\S+`, 'mu'))]));
11615
11726
  if (hasUnquotedId('project_id') || hasUnquotedId('app_id')) {
11616
11727
  throw new CliError(
11617
11728
  '.coze [project].project_id and app_id must be quoted decimal strings.',
@@ -11636,7 +11747,7 @@ const updateProjectValue = (content, key, value) => {
11636
11747
  const sectionStart = sectionMatch.index + sectionMatch[0].length;
11637
11748
  const following = content.slice(sectionStart);
11638
11749
  const nextSection = /^\s*\[[^\]]+\]\s*(?:#.*)?$/mu.exec(following);
11639
- const sectionEnd = _optionalChain$7([nextSection, 'optionalAccess', _13 => _13.index]) === undefined
11750
+ const sectionEnd = _optionalChain$5([nextSection, 'optionalAccess', _13 => _13.index]) === undefined
11640
11751
  ? content.length
11641
11752
  : sectionStart + nextSection.index;
11642
11753
  const before = content.slice(0, sectionStart);
@@ -11690,8 +11801,8 @@ const ensureProjectMetadata = async (
11690
11801
  throw error;
11691
11802
  }
11692
11803
  }
11693
- const name = _optionalChain$7([options, 'access', _14 => _14.name, 'optionalAccess', _15 => _15.trim, 'call', _16 => _16()]) || 'Pages application';
11694
- const projectType = _optionalChain$7([options, 'access', _17 => _17.projectType, 'optionalAccess', _18 => _18.trim, 'call', _19 => _19()]) || 'web';
11804
+ const name = _optionalChain$5([options, 'access', _14 => _14.name, 'optionalAccess', _15 => _15.trim, 'call', _16 => _16()]) || 'Pages application';
11805
+ const projectType = _optionalChain$5([options, 'access', _17 => _17.projectType, 'optionalAccess', _18 => _18.trim, 'call', _19 => _19()]) || 'web';
11695
11806
  await promises.writeFile(
11696
11807
  node_path.join(sourceRoot, '.coze'),
11697
11808
  `[project]\nname = ${JSON.stringify(name)}\nproject_type = ${JSON.stringify(projectType)}\n`,
@@ -11701,7 +11812,7 @@ const ensureProjectMetadata = async (
11701
11812
  return readProjectMetadata(sourceRoot);
11702
11813
  };
11703
11814
 
11704
- function _optionalChain$6(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
11815
+ function _optionalChain$4(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
11705
11816
  const isFile = async (path) => {
11706
11817
  try {
11707
11818
  return (await promises.stat(path)).isFile();
@@ -11731,14 +11842,14 @@ const validatePagesSource = async (
11731
11842
  );
11732
11843
  }
11733
11844
  const project = config.project ;
11734
- if (typeof _optionalChain$6([project, 'optionalAccess', _ => _.template]) !== 'string' || project.template.trim().toLowerCase() !== 'nextjs') {
11845
+ if (typeof _optionalChain$4([project, 'optionalAccess', _ => _.template]) !== 'string' || project.template.trim().toLowerCase() !== 'nextjs') {
11735
11846
  throw new CliError(
11736
11847
  'Pages source contains no index.html; .coze project.template must be "nextjs".',
11737
11848
  'PAGES_BUILD_CONFIG_REQUIRED',
11738
11849
  );
11739
11850
  }
11740
11851
  const deploy = config.deploy ;
11741
- const build = _optionalChain$6([deploy, 'optionalAccess', _2 => _2.build]);
11852
+ const build = _optionalChain$4([deploy, 'optionalAccess', _2 => _2.build]);
11742
11853
  if (!Array.isArray(build) || build.length === 0 || !build.every(part => typeof part === 'string' && part.length > 0)) {
11743
11854
  throw new CliError(
11744
11855
  'Pages source contains no index.html; .coze deploy.build must be a non-empty string array.',
@@ -11890,6 +12001,7 @@ const registerDeployReadCommands = (deploy) => {
11890
12001
  deploy_history_id: deployHistoryId,
11891
12002
  status: getDeployStatusText(history.status),
11892
12003
  commit_hash: history.commit_hash,
12004
+ commit_message: history.commit_message,
11893
12005
  domains: history.domain_list || [],
11894
12006
  error_analysis: history.error_analysis,
11895
12007
  deploy_detail: formatDeployDetails(history),
@@ -11919,6 +12031,7 @@ const registerDeployReadCommands = (deploy) => {
11919
12031
  deploy_history_id: item.deploy_history_id,
11920
12032
  status: getDeployStatusText(item.status),
11921
12033
  commit_hash: item.commit_hash_short || item.commit_hash,
12034
+ commit_message: item.commit_message,
11922
12035
  created_at: item.created_at,
11923
12036
  can_rollback: item.can_rollback,
11924
12037
  deploy_detail: formatDeployDetails(item),
@@ -11944,6 +12057,7 @@ const registerDeployReadCommands = (deploy) => {
11944
12057
  deploy_history_id: item.deploy_history_id,
11945
12058
  status: getDeployStatusText(item.status),
11946
12059
  commit_hash: item.commit_hash_short || item.commit_hash,
12060
+ commit_message: item.commit_message,
11947
12061
  created_at: item.created_at,
11948
12062
  deploy_detail: formatDeployDetails(item),
11949
12063
  domains: item.domain_list || [],
@@ -12009,7 +12123,7 @@ const registerEnv = (code) => {
12009
12123
  });
12010
12124
  };
12011
12125
 
12012
- function _optionalChain$5(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }/* eslint-disable security/detect-non-literal-fs-filename -- validated project-local build output paths */
12126
+ /* eslint-disable security/detect-non-literal-fs-filename -- validated project-local build output paths */
12013
12127
 
12014
12128
  const BUILD_OUTPUT_DIRS = new Set(['dist', 'dist-tt']);
12015
12129
  const EXCLUDED_PARTS = new Set([
@@ -12053,7 +12167,7 @@ const shouldInclude = (
12053
12167
  archivePath,
12054
12168
  entry,
12055
12169
  ) => {
12056
- if (_optionalChain$5([entry, 'access', _ => _.isSymbolicLink, 'optionalCall', _2 => _2()])) {
12170
+ if ('isSymbolicLink' in entry && entry.isSymbolicLink()) {
12057
12171
  return false;
12058
12172
  }
12059
12173
  return !archivePath.split(/[\\/]/u).some(part =>
@@ -12099,7 +12213,7 @@ const createMiniProgramPackage = async (
12099
12213
  }
12100
12214
  };
12101
12215
 
12102
- function _nullishCoalesce$1(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain$4(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
12216
+ function _nullishCoalesce$1(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
12103
12217
  const CONNECTOR_IDS = {
12104
12218
  wechat: '10000127',
12105
12219
  douyin: '10000126',
@@ -12150,7 +12264,7 @@ const resolveProjectId = async (
12150
12264
  command,
12151
12265
  options,
12152
12266
  ) => {
12153
- if (_optionalChain$4([options, 'access', _ => _.projectId, 'optionalAccess', _2 => _2.trim, 'call', _3 => _3()])) {
12267
+ if (_optionalChain$3([options, 'access', _ => _.projectId, 'optionalAccess', _2 => _2.trim, 'call', _3 => _3()])) {
12154
12268
  return options.projectId.trim();
12155
12269
  }
12156
12270
  const runtime = await getRuntime(command);
@@ -12189,7 +12303,7 @@ const getPreviewFailureMessage = (data
12189
12303
 
12190
12304
 
12191
12305
  ) =>
12192
- _optionalChain$4([data, 'access', _4 => _4.stderr, 'optionalAccess', _5 => _5.trim, 'call', _6 => _6()]) || _optionalChain$4([data, 'access', _7 => _7.stdout, 'optionalAccess', _8 => _8.trim, 'call', _9 => _9()]) || 'Mini-program preview failed.';
12306
+ _optionalChain$3([data, 'access', _4 => _4.stderr, 'optionalAccess', _5 => _5.trim, 'call', _6 => _6()]) || _optionalChain$3([data, 'access', _7 => _7.stdout, 'optionalAccess', _8 => _8.trim, 'call', _9 => _9()]) || 'Mini-program preview failed.';
12193
12307
 
12194
12308
  const registerAuthorizationCommand = (miniProgram) => {
12195
12309
  miniProgram
@@ -12385,7 +12499,7 @@ const registerMiniProgram = (code) => {
12385
12499
  registerPreviewCommand(miniProgram);
12386
12500
  };
12387
12501
 
12388
- function _optionalChain$3(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
12502
+ function _optionalChain$2(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
12389
12503
 
12390
12504
  const POLL_INTERVAL_MS = 3000;
12391
12505
  const MAX_CONSECUTIVE_RETRIES = 5;
@@ -12397,7 +12511,7 @@ const wait = async () =>
12397
12511
  const isRetryablePollError = (error) =>
12398
12512
  error instanceof CliError &&
12399
12513
  error.code === 'API_REJECTED' &&
12400
- Number(_optionalChain$3([error, 'access', _ => _.details, 'optionalAccess', _2 => _2.business_code])) === TRANSIENT_RPC_ERROR_CODE;
12514
+ Number(_optionalChain$2([error, 'access', _ => _.details, 'optionalAccess', _2 => _2.business_code])) === TRANSIENT_RPC_ERROR_CODE;
12401
12515
 
12402
12516
  const pollHistory = async (
12403
12517
  command,
@@ -12776,52 +12890,6 @@ const registerDomain = (code) => {
12776
12890
  });
12777
12891
  };
12778
12892
 
12779
- function _optionalChain$2(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
12780
-
12781
- const firstPage = { page: 1, size: 1 };
12782
-
12783
- const listSpaceRequest = (runtime) => ({
12784
- ...(runtime.config.organizationId
12785
- ? { organization_id: runtime.config.organizationId }
12786
- : {}),
12787
- ...(runtime.config.enterpriseId
12788
- ? { enterprise_id: runtime.config.enterpriseId }
12789
- : {}),
12790
- });
12791
-
12792
- const resolveDeploymentSpaceId = async (runtime) => {
12793
- const configuredSpaceId = _optionalChain$2([runtime, 'access', _ => _.config, 'access', _2 => _2.spaceId, 'optionalAccess', _3 => _3.trim, 'call', _4 => _4()]);
12794
- const request = listSpaceRequest(runtime);
12795
- if (configuredSpaceId) {
12796
- const data = await runtime.client.listSpaces(request);
12797
- if (!data.bot_space_list.some(space => space.id === configuredSpaceId)) {
12798
- throw new CliError(
12799
- `Space ID ${configuredSpaceId} is invalid or is not available to the current account.`,
12800
- 'INVALID_SPACE_ID',
12801
- );
12802
- }
12803
- return configuredSpaceId;
12804
- }
12805
-
12806
- const data = await runtime.client.listSpaces({ ...request, ...firstPage });
12807
- const space = data.bot_space_list.find(item => item.id);
12808
- if (!space) {
12809
- throw new CliError(
12810
- 'No available Space was found for the current account. Create or join a Space before deploying.',
12811
- 'SPACE_NOT_FOUND',
12812
- );
12813
- }
12814
-
12815
- runtime.config.spaceId = space.id;
12816
- try {
12817
- await saveSharedConfig({ spaceId: space.id }, runtime.globalOptions);
12818
- } catch (error) {
12819
- runtime.output.warn(`Unable to save the auto-selected Space: ${String(error)}`);
12820
- }
12821
- runtime.output.debug(`Auto-selected Space: ${space.name || space.id} (${space.id})`);
12822
- return space.id;
12823
- };
12824
-
12825
12893
  const PACKAGE_SCRIPT_CANDIDATES = [
12826
12894
  node_path.resolve(__dirname, 'deploy/package-project.js'),
12827
12895
  node_path.resolve(__dirname, '../../../scripts/deploy/package-project.js'),
@@ -13193,14 +13261,21 @@ const registerDeploy = (code) => {
13193
13261
  }
13194
13262
  }
13195
13263
  if (!projectId) {
13196
- runtime.output.debug('[deploy] Creating a dedicated deployment project...');
13197
- const spaceId = await resolveDeploymentSpaceId(runtime);
13264
+ runtime.output.debug(
13265
+ '[deploy] Creating a dedicated deployment project in personal space...',
13266
+ );
13267
+ // 账号归属只在建 Project 这一次定死:写进 project_settings.extra 之后,有登录态的首次
13268
+ // 部署和无登录态的预览初始化读到的是同一个账号。本地已经知道账号就不打这次接口。
13269
+ const cozeAccountId = await resolveCozeAccountId(runtime);
13198
13270
  const project = await runtime.client.createDeploymentProject({
13199
- space_id: spaceId,
13271
+ space_id: '0',
13200
13272
  user_query: deploymentName || 'CLI deployment project',
13201
13273
  project_type: resolveCreationProjectType(metadata.projectType),
13202
13274
  create_source: 'cli',
13203
- project_settings: { project_symbol: 'v3.5' },
13275
+ project_settings: {
13276
+ project_symbol: 'v3.5',
13277
+ ...(cozeAccountId ? { extra: { coze_account_id: cozeAccountId } } : {}),
13278
+ },
13204
13279
  });
13205
13280
  projectId = project.project_id;
13206
13281
  projectCreated = true;
@@ -13289,6 +13364,7 @@ const registerDeploy = (code) => {
13289
13364
  ...(appId ? { app_id: appId } : { project_id: projectId }),
13290
13365
  application_type: applicationType,
13291
13366
  commit_hash: commitHash,
13367
+ ...(options.message ? { commit_message: options.message } : {}),
13292
13368
  ...(!appId
13293
13369
  ? { name: deploymentName, source_root: sourceRoot }
13294
13370
  : {}),