@cloudbase/cli 2.8.28 → 2.9.0

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.
@@ -11,7 +11,7 @@ const chalk = __webpack_require__(15896)
11
11
  const { program } = __webpack_require__(62116)
12
12
  const logSymbols = __webpack_require__(68329)
13
13
  const didYouMean = __webpack_require__(71492)
14
- const updateNotifier = __webpack_require__(72523)
14
+ const updateNotifier = __webpack_require__(66281)
15
15
  const frameworkPkg = __webpack_require__(92822)
16
16
  let wedaPkg = {}
17
17
  try {
@@ -946,7 +946,7 @@ let AICommand = class AICommand extends common_1.Command {
946
946
  options: [
947
947
  {
948
948
  flags: '-a, --agent <agent>',
949
- desc: 'AI CLI 工具 (claude, qwen, codex, aider)'
949
+ desc: 'AI CLI 工具 (claude, qwen, codex, aider, codebuddy)'
950
950
  },
951
951
  {
952
952
  flags: '-e, --envId <envId>',
@@ -973,7 +973,7 @@ let AICommand = class AICommand extends common_1.Command {
973
973
  desc: '指定模板类型 (miniprogram, react, vue, uniapp, rules)'
974
974
  }
975
975
  ],
976
- desc: 'CloudBase AI ToolKit CLI - 快速启动和配置主流 AI 编程工具\n\n示例:\n tcb ai -a claude -- --continue\n\n说明:-- 后的参数会直接传递给目标 AI CLI。',
976
+ desc: 'CloudBase AI ToolKit CLI - 快速启动和配置主流 AI 编程工具\n\n示例:\n tcb ai -a claude -- --continue\n tcb ai -a codebuddy -- mcp list\n\n说明:-- 后的参数会直接传递给目标 AI CLI。',
977
977
  requiredEnvId: false,
978
978
  withoutAuth: true,
979
979
  allowUnknownOption: true
@@ -10983,6 +10983,7 @@ let PullCommand = class PullCommand extends common_1.Command {
10983
10983
  get options() {
10984
10984
  return {
10985
10985
  cmd: 'pull',
10986
+ childCmd: '<source>',
10986
10987
  options: [
10987
10988
  {
10988
10989
  flags: '-o, --output <output>',
@@ -10998,10 +10999,10 @@ let PullCommand = class PullCommand extends common_1.Command {
10998
10999
  withoutAuth: true
10999
11000
  };
11000
11001
  }
11001
- execute(options, log) {
11002
+ execute(options, params, log) {
11002
11003
  return __awaiter(this, void 0, void 0, function* () {
11003
11004
  const { output, force } = options;
11004
- const source = process.argv[3];
11005
+ const [source] = params || [];
11005
11006
  if (!source || typeof source !== 'string') {
11006
11007
  throw new error_1.CloudBaseError('请指定要拉取的模板来源');
11007
11008
  }
@@ -11041,9 +11042,10 @@ let PullCommand = class PullCommand extends common_1.Command {
11041
11042
  __decorate([
11042
11043
  (0, decorators_1.InjectParams)(),
11043
11044
  __param(0, (0, decorators_1.ArgsOptions)()),
11044
- __param(1, (0, decorators_1.Log)()),
11045
+ __param(1, (0, decorators_1.ArgsParams)()),
11046
+ __param(2, (0, decorators_1.Log)()),
11045
11047
  __metadata("design:type", Function),
11046
- __metadata("design:paramtypes", [Object, log_1.Logger]),
11048
+ __metadata("design:paramtypes", [Object, Array, log_1.Logger]),
11047
11049
  __metadata("design:returntype", Promise)
11048
11050
  ], PullCommand.prototype, "execute", null);
11049
11051
  PullCommand = __decorate([
@@ -19348,13 +19350,12 @@ AI ToolKit`, {
19348
19350
  log.log(' ⚡ 生成、部署和托管全栈 Web 应用与小程序、数据库和后端服务');
19349
19351
  log.log(' 🎯 无需运维,极速上线你的创意 💫');
19350
19352
  }
19353
+ log.log('Github:');
19354
+ log.log((0, output_1.genClickableLink)('https://github.com/TencentCloudBase/CloudBase-AI-ToolKit'));
19351
19355
  log.log('');
19352
19356
  log.log('使用指引');
19353
19357
  log.log((0, output_1.genClickableLink)('https://docs.cloudbase.net/cli-v1/ai/introduce'));
19354
19358
  log.log('');
19355
- log.log('Beta 能力,如遇问题可创建 issue:');
19356
- log.log((0, output_1.genClickableLink)('https://cnb.cool/tencent/cloud/cloudbase/community/-/issues'));
19357
- log.log('');
19358
19359
  }
19359
19360
  catch (e) {
19360
19361
  log.log(chalk_1.default.bold.cyanBright('⛰︎'), chalk_1.default.bold.hex('#FFFFFF')(' CloudBase AI ToolKit CLI'));
@@ -19363,6 +19364,9 @@ AI ToolKit`, {
19363
19364
  log.log(chalk_1.default.hex('#34495E')(' ⚡ 生成、部署和托管全栈 Web 应用与小程序、数据库和后端服务'));
19364
19365
  log.log(chalk_1.default.hex('#34495E')(' 🎯 无需运维,极速上线你的创意 💫'));
19365
19366
  log.log('');
19367
+ log.log('Github:');
19368
+ log.log((0, output_1.genClickableLink)('https://github.com/TencentCloudBase/CloudBase-AI-ToolKit'));
19369
+ log.log('');
19366
19370
  log.log('使用指引');
19367
19371
  log.log((0, output_1.genClickableLink)('https://docs.cloudbase.net/cli-v1/ai/introduce'));
19368
19372
  log.log('');
@@ -19475,7 +19479,7 @@ const notFoundError = () => {
19475
19479
  });
19476
19480
  };
19477
19481
  function isValidAgent(agent) {
19478
- return [const_1.CLAUDE, const_1.QWEN, const_1.CODEX, const_1.AIDER, const_1.CURSOR].some((x) => x.value === agent);
19482
+ return [const_1.CLAUDE, const_1.QWEN, const_1.CODEX, const_1.AIDER, const_1.CURSOR, const_1.CODEBUDDY].some((x) => x.value === agent);
19479
19483
  }
19480
19484
  exports.isValidAgent = isValidAgent;
19481
19485
  exports.TOOLKIT_CONFIGS = {
@@ -19483,6 +19487,9 @@ exports.TOOLKIT_CONFIGS = {
19483
19487
  mcp: '.mcp.json',
19484
19488
  rules: 'CLAUDE.md'
19485
19489
  },
19490
+ [const_1.CODEBUDDY.value]: {
19491
+ config: '.env.local'
19492
+ },
19486
19493
  [const_1.QWEN.value]: {
19487
19494
  config: '.env.local',
19488
19495
  rules: '.qwen/QWEN.md'
@@ -19495,7 +19502,7 @@ exports.TOOLKIT_CONFIGS = {
19495
19502
  },
19496
19503
  [const_1.CURSOR.value]: {
19497
19504
  config: '.cursor/mcp.json'
19498
- }
19505
+ },
19499
19506
  };
19500
19507
  function createConfigParser() {
19501
19508
  return new toolbox_1.ConfigParser({ configPath: const_1.CONFIG_PATH });
@@ -19703,6 +19710,17 @@ class AIConfigManager {
19703
19710
  yield this.updateConfig('ai.agents.cursor.type', type);
19704
19711
  });
19705
19712
  }
19713
+ updateCodebuddyConfig(type, config) {
19714
+ return __awaiter(this, void 0, void 0, function* () {
19715
+ yield this.updateConfig('ai.agents.codebuddy', {});
19716
+ yield this.updateConfig('ai.agents.codebuddy.type', type);
19717
+ if (type === 'custom') {
19718
+ if (config.apiKey) {
19719
+ yield this.updateConfig('ai.agents.codebuddy.apiKey', config.apiKey, 'CODEBUDDY_API_KEY');
19720
+ }
19721
+ }
19722
+ });
19723
+ }
19706
19724
  updateConfig(key, value, env) {
19707
19725
  return __awaiter(this, void 0, void 0, function* () {
19708
19726
  const configParser = createConfigParser();
@@ -19730,7 +19748,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
19730
19748
  return (mod && mod.__esModule) ? mod : { "default": mod };
19731
19749
  };
19732
19750
  Object.defineProperty(exports, "__esModule", ({ value: true }));
19733
- exports.LIST_HINT = exports.getBooleanHint = exports.getDefaultModelByBaseUrl = exports.BASE_URL_MODEL_MAPPING = exports.getAgentConfigValidator = exports.getDefaultConfig = exports.CLOUDBASE_PROVIDERS = exports.AGENTS = exports.NONE = exports.CURSOR = exports.AIDER = exports.CODEX = exports.QWEN = exports.CLAUDE = exports.DEFAULT_CONFIG = exports.CLOUDBASE_MCP_CONFIG_PATH = exports.CLAUDE_CODE_ROUTER_LOGS_DIR_PATH = exports.CLAUDE_CODE_ROUTER_LOG_PATH = exports.CLAUDE_CODE_ROUTER_CONFIG_PATH = exports.ENV_LOCAL_PATH = exports.CONFIG_PATH = void 0;
19751
+ exports.LIST_HINT = exports.getBooleanHint = exports.getDefaultModelByBaseUrl = exports.BASE_URL_MODEL_MAPPING = exports.getAgentConfigValidator = exports.getDefaultConfig = exports.CLOUDBASE_PROVIDERS = exports.AGENTS = exports.NONE = exports.CODEBUDDY = exports.CURSOR = exports.AIDER = exports.CODEX = exports.QWEN = exports.CLAUDE = exports.DEFAULT_CONFIG = exports.CLOUDBASE_MCP_CONFIG_PATH = exports.CLAUDE_CODE_ROUTER_LOGS_DIR_PATH = exports.CLAUDE_CODE_ROUTER_LOG_PATH = exports.CLAUDE_CODE_ROUTER_CONFIG_PATH = exports.ENV_LOCAL_PATH = exports.CONFIG_PATH = void 0;
19734
19752
  const os_1 = __importDefault(__webpack_require__(70857));
19735
19753
  const path_1 = __importDefault(__webpack_require__(16928));
19736
19754
  const v3_1 = __importDefault(__webpack_require__(19164));
@@ -19828,11 +19846,24 @@ exports.CURSOR = {
19828
19846
  type: v3_1.default.literal('none')
19829
19847
  })
19830
19848
  };
19849
+ exports.CODEBUDDY = {
19850
+ name: 'Codebuddy Code CLI',
19851
+ value: 'codebuddy',
19852
+ configSchema: v3_1.default.discriminatedUnion('type', [
19853
+ v3_1.default.object({
19854
+ type: v3_1.default.literal('none')
19855
+ }),
19856
+ v3_1.default.object({
19857
+ type: v3_1.default.literal('custom'),
19858
+ apiKey: v3_1.default.string().optional()
19859
+ })
19860
+ ])
19861
+ };
19831
19862
  exports.NONE = {
19832
19863
  name: '暂不配置',
19833
19864
  value: 'none'
19834
19865
  };
19835
- exports.AGENTS = [exports.CLAUDE, exports.QWEN, exports.CODEX, exports.AIDER, exports.CURSOR, exports.NONE];
19866
+ exports.AGENTS = [exports.CLAUDE, exports.QWEN, exports.CODEX, exports.AIDER, exports.CURSOR, exports.CODEBUDDY, exports.NONE];
19836
19867
  exports.CLOUDBASE_PROVIDERS = [
19837
19868
  {
19838
19869
  name: 'Kimi',
@@ -20286,7 +20317,7 @@ class AICommandRouter {
20286
20317
  if (missingFiles.length > 0) {
20287
20318
  const skipTemplate = yield this.checkSkipTemplateConfig();
20288
20319
  if (skipTemplate) {
20289
- log.info('🚫 已配置跳过模板下载');
20320
+ log.info('🚫 已跳过模板下载,无法使用云开发 MCP 及 AI 规则。如需使用,请参考 tcb pull --help');
20290
20321
  return;
20291
20322
  }
20292
20323
  log.log('');
@@ -20535,6 +20566,13 @@ class AICommandRouter {
20535
20566
  args: ['install', '-g', '@google/gemini-cli'],
20536
20567
  message: 'npm install -g @google/gemini-cli'
20537
20568
  };
20569
+ case 'codebuddy':
20570
+ return {
20571
+ success: true,
20572
+ command: 'npm',
20573
+ args: ['install', '-g', '@tencent-ai/codebuddy-code@beta'],
20574
+ message: 'npm install -g @tencent-ai/codebuddy-code@beta'
20575
+ };
20538
20576
  default:
20539
20577
  return { success: false, message: `# 请查阅 ${agent} 的官方安装文档` };
20540
20578
  }
@@ -20542,8 +20580,7 @@ class AICommandRouter {
20542
20580
  executeCommand(command, args, env, log) {
20543
20581
  return __awaiter(this, void 0, void 0, function* () {
20544
20582
  return new Promise((resolve, reject) => {
20545
- const useShell = process.platform !== 'win32' ||
20546
- (process.env.WSL_DISTRO_NAME || process.env.MSYS2 || process.env.GIT_BASH);
20583
+ const useShell = process.platform === 'win32';
20547
20584
  const child = (0, child_process_1.spawn)(command, args, {
20548
20585
  stdio: 'inherit',
20549
20586
  env,
@@ -20588,11 +20625,9 @@ class AICommandRouter {
20588
20625
  isToolAvailable(command) {
20589
20626
  return __awaiter(this, void 0, void 0, function* () {
20590
20627
  return new Promise((resolve) => {
20591
- const useShell = process.platform !== 'win32' ||
20592
- (process.env.WSL_DISTRO_NAME || process.env.MSYS2 || process.env.GIT_BASH);
20593
20628
  const child = (0, child_process_1.spawn)(command, ['--version'], {
20594
20629
  stdio: 'pipe',
20595
- shell: useShell
20630
+ shell: true
20596
20631
  });
20597
20632
  child.on('close', (code) => {
20598
20633
  resolve(code === 0);
@@ -20668,6 +20703,13 @@ class AICommandRouter {
20668
20703
  }
20669
20704
  case const_1.CURSOR.value:
20670
20705
  return yield this.executeNoneCursorAgent(additionalArgs, log);
20706
+ case const_1.CODEBUDDY.value:
20707
+ if (agentConfig.type === 'custom') {
20708
+ return yield this.executeCodebuddyAgent(agentConfig, additionalArgs, log);
20709
+ }
20710
+ else {
20711
+ return yield this.executeNoneCodebuddyAgent(additionalArgs, log);
20712
+ }
20671
20713
  default:
20672
20714
  throw new Error(`不支持的 AI 工具: ${agent}`);
20673
20715
  }
@@ -21347,6 +21389,43 @@ class AICommandRouter {
21347
21389
  }
21348
21390
  return lines.join('\n');
21349
21391
  }
21392
+ executeCodebuddyAgent({ apiKey }, additionalArgs, log) {
21393
+ return __awaiter(this, void 0, void 0, function* () {
21394
+ yield this.ensureCodebuddy(log);
21395
+ yield this.executeCommand('codebuddy', additionalArgs, Object.assign(Object.assign({}, process.env), (apiKey && { CODEBUDDY_API_KEY: apiKey })), log);
21396
+ });
21397
+ }
21398
+ executeNoneCodebuddyAgent(additionalArgs, log) {
21399
+ return __awaiter(this, void 0, void 0, function* () {
21400
+ yield this.ensureCodebuddy(log);
21401
+ yield this.executeCommand('codebuddy', additionalArgs, Object.assign({}, process.env), log);
21402
+ });
21403
+ }
21404
+ ensureCodebuddy(log) {
21405
+ return __awaiter(this, void 0, void 0, function* () {
21406
+ if (yield this.isToolAvailable('codebuddy')) {
21407
+ log.debug('codebuddy 已安装!');
21408
+ }
21409
+ else {
21410
+ const { shouldInstall } = yield inquirer_1.default.prompt([
21411
+ {
21412
+ type: 'confirm',
21413
+ name: 'shouldInstall',
21414
+ message: `AI 开发缺少 codebuddy 依赖,是否安装? ${(0, const_1.getBooleanHint)(true)}`
21415
+ }
21416
+ ]);
21417
+ if (shouldInstall) {
21418
+ yield this.executeCommand('npm', ['install', '-g', '@tencent-ai/codebuddy-code@beta'], process.env, log);
21419
+ log.info('✅ codebuddy 安装完成');
21420
+ }
21421
+ else {
21422
+ log.info('❌ codebuddy 未安装,请手动安装');
21423
+ log.info('📦 安装命令: npm install -g @tencent-ai/codebuddy-code@beta');
21424
+ process.exit(1);
21425
+ }
21426
+ }
21427
+ });
21428
+ }
21350
21429
  }
21351
21430
  exports.AICommandRouter = AICommandRouter;
21352
21431
  function safeParseJson(json) {
@@ -21561,7 +21640,7 @@ class AISetupWizard {
21561
21640
  type: 'list',
21562
21641
  name: 'agent',
21563
21642
  message: `${message} ${const_1.LIST_HINT}`,
21564
- choices: [const_1.CLAUDE, const_1.QWEN, const_1.CODEX, const_1.CURSOR, const_1.AIDER, ...(includeNone ? [const_1.NONE] : [])],
21643
+ choices: [const_1.CLAUDE, const_1.QWEN, const_1.CODEX, const_1.CURSOR, const_1.AIDER, const_1.CODEBUDDY, ...(includeNone ? [const_1.NONE] : [])],
21565
21644
  default: const_1.CLAUDE.value
21566
21645
  }
21567
21646
  ]);
@@ -21570,7 +21649,7 @@ class AISetupWizard {
21570
21649
  }
21571
21650
  configureAgent(agent, log) {
21572
21651
  return __awaiter(this, void 0, void 0, function* () {
21573
- const agentInfo = [const_1.CLAUDE, const_1.QWEN, const_1.CODEX, const_1.AIDER, const_1.CURSOR].find((a) => a.value === agent);
21652
+ const agentInfo = [const_1.CLAUDE, const_1.QWEN, const_1.CODEX, const_1.AIDER, const_1.CURSOR, const_1.CODEBUDDY].find((a) => a.value === agent);
21574
21653
  log.info(`\n📝 配置 ${(agentInfo === null || agentInfo === void 0 ? void 0 : agentInfo.name) || agent.toUpperCase()}:`);
21575
21654
  switch (agent) {
21576
21655
  case const_1.CLAUDE.value:
@@ -21583,6 +21662,8 @@ class AISetupWizard {
21583
21662
  return yield this.configureAiderAgent(log);
21584
21663
  case const_1.CURSOR.value:
21585
21664
  return yield this.configureCursorAgent(log);
21665
+ case const_1.CODEBUDDY.value:
21666
+ return yield this.configureCodebuddyAgent(log);
21586
21667
  default:
21587
21668
  throw new Error(`不支持的 AI 工具: ${agent}`);
21588
21669
  }
@@ -22008,6 +22089,47 @@ class AISetupWizard {
22008
22089
  }
22009
22090
  });
22010
22091
  }
22092
+ configureCodebuddyAgent(log) {
22093
+ return __awaiter(this, void 0, void 0, function* () {
22094
+ log.info(`配置说明可参考 ${(0, output_1.genClickableLink)('https://cnb.woa.com/genie/genie/-/tree/main/docs')}`);
22095
+ const { configMethod } = yield inquirer_1.default.prompt([
22096
+ {
22097
+ type: 'list',
22098
+ name: 'configMethod',
22099
+ message: `选择配置方式: ${const_1.LIST_HINT}`,
22100
+ choices: [
22101
+ {
22102
+ name: '使用 Codebuddy Code CLI 内置鉴权方式(如 OAuth)',
22103
+ value: 'none'
22104
+ },
22105
+ {
22106
+ name: '配置 API KEY(用于无交互环境)',
22107
+ value: 'custom'
22108
+ }
22109
+ ],
22110
+ default: 'none'
22111
+ }
22112
+ ]);
22113
+ if (configMethod === 'custom') {
22114
+ const { apiKey } = yield inquirer_1.default.prompt([
22115
+ {
22116
+ type: 'password',
22117
+ name: 'apiKey',
22118
+ message: '请输入 Codebuddy API Key:',
22119
+ validate: (input) => input.trim().length > 0 || 'API Key 不能为空'
22120
+ }
22121
+ ]);
22122
+ yield this.aiConfigManager.updateCodebuddyConfig('custom', {
22123
+ apiKey
22124
+ });
22125
+ }
22126
+ else {
22127
+ yield this.aiConfigManager.updateCodebuddyConfig('none', {});
22128
+ }
22129
+ log.info('✅ Codebuddy Code CLI 配置完成');
22130
+ log.info('💡 提示:首次使用时会自动打开浏览器进行 OAuth 身份验证');
22131
+ });
22132
+ }
22011
22133
  }
22012
22134
  exports.AISetupWizard = AISetupWizard;
22013
22135
 
@@ -358589,6 +358711,67 @@ webpackEmptyContext.resolve = webpackEmptyContext;
358589
358711
  webpackEmptyContext.id = 92288;
358590
358712
  module.exports = webpackEmptyContext;
358591
358713
 
358714
+ /***/ }),
358715
+
358716
+ /***/ 28401:
358717
+ /***/ ((module) => {
358718
+
358719
+ "use strict";
358720
+
358721
+ const lazy = (mod, fn, id) => mod === undefined ? fn(id) : mod;
358722
+
358723
+ module.exports = fn => {
358724
+ return id => {
358725
+ let mod;
358726
+
358727
+ return function () {
358728
+ if (arguments.length === 0) {
358729
+ mod = lazy(mod, fn, id);
358730
+ return mod;
358731
+ }
358732
+
358733
+ const ret = {};
358734
+
358735
+ [].forEach.call(arguments, prop => {
358736
+ Object.defineProperty(ret, prop, {
358737
+ get: () => {
358738
+ mod = lazy(mod, fn, id);
358739
+ if (typeof mod[prop] === 'function') {
358740
+ return function () {
358741
+ return mod[prop].apply(mod, arguments);
358742
+ };
358743
+ }
358744
+
358745
+ return mod[prop];
358746
+ }
358747
+ });
358748
+ });
358749
+
358750
+ return ret;
358751
+ };
358752
+ };
358753
+ };
358754
+
358755
+ module.exports.proxy = fn => {
358756
+ return id => {
358757
+ let mod;
358758
+
358759
+ const handler = {
358760
+ get: (target, property) => {
358761
+ mod = lazy(mod, fn, id);
358762
+ return Reflect.get(mod, property);
358763
+ },
358764
+ apply: (target, thisArg, argumentsList) => {
358765
+ mod = lazy(mod, fn, id);
358766
+ return Reflect.apply(mod, thisArg, argumentsList);
358767
+ }
358768
+ };
358769
+
358770
+ return new Proxy(() => {}, handler);
358771
+ };
358772
+ };
358773
+
358774
+
358592
358775
  /***/ }),
358593
358776
 
358594
358777
  /***/ 82063:
@@ -557268,6 +557451,216 @@ exports.Open = __webpack_require__(74773);
557268
557451
 
557269
557452
  /***/ }),
557270
557453
 
557454
+ /***/ 66281:
557455
+ /***/ ((module, __unused_webpack_exports, __webpack_require__) => {
557456
+
557457
+ "use strict";
557458
+
557459
+ const {spawn} = __webpack_require__(35317);
557460
+ const path = __webpack_require__(16928);
557461
+ const {format} = __webpack_require__(39023);
557462
+ const importLazy = __webpack_require__(28401)(__webpack_require__(88156));
557463
+
557464
+ const configstore = importLazy('configstore');
557465
+ const chalk = importLazy('chalk');
557466
+ const semverDiff = importLazy('semver-diff');
557467
+ const latestVersion = importLazy('latest-version');
557468
+ const isNpm = importLazy('is-npm');
557469
+ const isInstalledGlobally = importLazy('is-installed-globally');
557470
+ const isYarnGlobal = importLazy('is-yarn-global');
557471
+ const hasYarn = importLazy('has-yarn');
557472
+ const boxen = importLazy('boxen');
557473
+ const xdgBasedir = importLazy('xdg-basedir');
557474
+ const isCi = importLazy('is-ci');
557475
+ const pupa = importLazy('pupa');
557476
+
557477
+ const ONE_DAY = 1000 * 60 * 60 * 24;
557478
+
557479
+ class UpdateNotifier {
557480
+ constructor(options = {}) {
557481
+ this.options = options;
557482
+ options.pkg = options.pkg || {};
557483
+ options.distTag = options.distTag || 'latest';
557484
+
557485
+ // Reduce pkg to the essential keys. with fallback to deprecated options
557486
+ // TODO: Remove deprecated options at some point far into the future
557487
+ options.pkg = {
557488
+ name: options.pkg.name || options.packageName,
557489
+ version: options.pkg.version || options.packageVersion
557490
+ };
557491
+
557492
+ if (!options.pkg.name || !options.pkg.version) {
557493
+ throw new Error('pkg.name and pkg.version required');
557494
+ }
557495
+
557496
+ this.packageName = options.pkg.name;
557497
+ this.packageVersion = options.pkg.version;
557498
+ this.updateCheckInterval = typeof options.updateCheckInterval === 'number' ? options.updateCheckInterval : ONE_DAY;
557499
+ this.disabled = 'NO_UPDATE_NOTIFIER' in process.env ||
557500
+ "production" === 'test' ||
557501
+ process.argv.includes('--no-update-notifier') ||
557502
+ isCi();
557503
+ this.shouldNotifyInNpmScript = options.shouldNotifyInNpmScript;
557504
+
557505
+ if (!this.disabled) {
557506
+ try {
557507
+ const ConfigStore = configstore();
557508
+ this.config = new ConfigStore(`update-notifier-${this.packageName}`, {
557509
+ optOut: false,
557510
+ // Init with the current time so the first check is only
557511
+ // after the set interval, so not to bother users right away
557512
+ lastUpdateCheck: Date.now()
557513
+ });
557514
+ } catch (_) {
557515
+ // Expecting error code EACCES or EPERM
557516
+ const message =
557517
+ chalk().yellow(format(' %s update check failed ', options.pkg.name)) +
557518
+ format('\n Try running with %s or get access ', chalk().cyan('sudo')) +
557519
+ '\n to the local update config store via \n' +
557520
+ chalk().cyan(format(' sudo chown -R $USER:$(id -gn $USER) %s ', xdgBasedir().config));
557521
+
557522
+ process.on('exit', () => {
557523
+ console.error(boxen()(message, {align: 'center'}));
557524
+ });
557525
+ }
557526
+ }
557527
+ }
557528
+
557529
+ check() {
557530
+ if (
557531
+ !this.config ||
557532
+ this.config.get('optOut') ||
557533
+ this.disabled
557534
+ ) {
557535
+ return;
557536
+ }
557537
+
557538
+ this.update = this.config.get('update');
557539
+
557540
+ if (this.update) {
557541
+ // Use the real latest version instead of the cached one
557542
+ this.update.current = this.packageVersion;
557543
+
557544
+ // Clear cached information
557545
+ this.config.delete('update');
557546
+ }
557547
+
557548
+ // Only check for updates on a set interval
557549
+ if (Date.now() - this.config.get('lastUpdateCheck') < this.updateCheckInterval) {
557550
+ return;
557551
+ }
557552
+
557553
+ // Spawn a detached process, passing the options as an environment property
557554
+ spawn(process.execPath, [path.join(__dirname, 'check.js'), JSON.stringify(this.options)], {
557555
+ detached: true,
557556
+ stdio: 'ignore'
557557
+ }).unref();
557558
+ }
557559
+
557560
+ async fetchInfo() {
557561
+ const {distTag} = this.options;
557562
+ const latest = await latestVersion()(this.packageName, {version: distTag});
557563
+
557564
+ return {
557565
+ latest,
557566
+ current: this.packageVersion,
557567
+ type: semverDiff()(this.packageVersion, latest) || distTag,
557568
+ name: this.packageName
557569
+ };
557570
+ }
557571
+
557572
+ notify(options) {
557573
+ const suppressForNpm = !this.shouldNotifyInNpmScript && isNpm().isNpmOrYarn;
557574
+ if (!process.stdout.isTTY || suppressForNpm || !this.update || this.update.current === this.update.latest) {
557575
+ return this;
557576
+ }
557577
+
557578
+ options = Object.assign({
557579
+ isGlobal: isInstalledGlobally(),
557580
+ isYarnGlobal: isYarnGlobal()()
557581
+ }, options);
557582
+
557583
+ let installCommand;
557584
+
557585
+ if (options.isYarnGlobal) {
557586
+ installCommand = `yarn global add ${this.packageName}`;
557587
+ } else if (options.isGlobal) {
557588
+ installCommand = `npm i -g ${this.packageName}`;
557589
+ } else if (hasYarn()()) {
557590
+ installCommand = `yarn add ${this.packageName}`;
557591
+ } else {
557592
+ installCommand = `npm i ${this.packageName}`;
557593
+ }
557594
+
557595
+ const defaultTemplate = 'Update available ' +
557596
+ chalk().dim('{currentVersion}') +
557597
+ chalk().reset(' → ') +
557598
+ chalk().green('{latestVersion}') +
557599
+ ' \nRun ' + chalk().cyan('{updateCommand}') + ' to update';
557600
+
557601
+ const template = options.message || defaultTemplate;
557602
+
557603
+ options.boxenOptions = options.boxenOptions || {
557604
+ padding: 1,
557605
+ margin: 1,
557606
+ align: 'center',
557607
+ borderColor: 'yellow',
557608
+ borderStyle: 'round'
557609
+ };
557610
+
557611
+ const message = boxen()(
557612
+ pupa()(template, {
557613
+ packageName: this.packageName,
557614
+ currentVersion: this.update.current,
557615
+ latestVersion: this.update.latest,
557616
+ updateCommand: installCommand
557617
+ }),
557618
+ options.boxenOptions
557619
+ );
557620
+
557621
+ if (options.defer === false) {
557622
+ console.error(message);
557623
+ } else {
557624
+ process.on('exit', () => {
557625
+ console.error(message);
557626
+ });
557627
+
557628
+ process.on('SIGINT', () => {
557629
+ console.error('');
557630
+ process.exit();
557631
+ });
557632
+ }
557633
+
557634
+ return this;
557635
+ }
557636
+ }
557637
+
557638
+ module.exports = options => {
557639
+ const updateNotifier = new UpdateNotifier(options);
557640
+ updateNotifier.check();
557641
+ return updateNotifier;
557642
+ };
557643
+
557644
+ module.exports.UpdateNotifier = UpdateNotifier;
557645
+
557646
+
557647
+ /***/ }),
557648
+
557649
+ /***/ 88156:
557650
+ /***/ ((module) => {
557651
+
557652
+ function webpackEmptyContext(req) {
557653
+ var e = new Error("Cannot find module '" + req + "'");
557654
+ e.code = 'MODULE_NOT_FOUND';
557655
+ throw e;
557656
+ }
557657
+ webpackEmptyContext.keys = () => ([]);
557658
+ webpackEmptyContext.resolve = webpackEmptyContext;
557659
+ webpackEmptyContext.id = 88156;
557660
+ module.exports = webpackEmptyContext;
557661
+
557662
+ /***/ }),
557663
+
557271
557664
  /***/ 46579:
557272
557665
  /***/ (function(__unused_webpack_module, exports) {
557273
557666
 
@@ -568101,22 +568494,6 @@ module.exports = {
568101
568494
  }
568102
568495
 
568103
568496
 
568104
- /***/ }),
568105
-
568106
- /***/ 72523:
568107
- /***/ ((module) => {
568108
-
568109
- // No-op shim for update-notifier in standalone bundle
568110
- // Usage: const notifier = updateNotifier(opts); notifier.notify({ isGlobal: true })
568111
- module.exports = function updateNotifier() {
568112
- return {
568113
- notify: function notify() {
568114
- // intentionally no-op in standalone distribution
568115
- }
568116
- }
568117
- }
568118
-
568119
-
568120
568497
  /***/ }),
568121
568498
 
568122
568499
  /***/ 62882:
@@ -623676,7 +624053,7 @@ module.exports = {"version":"3.13.1"};
623676
624053
  /***/ ((module) => {
623677
624054
 
623678
624055
  "use strict";
623679
- module.exports = /*#__PURE__*/JSON.parse('{"name":"@cloudbase/cli","version":"2.8.27","description":"cli tool for cloudbase","main":"lib/index.js","scripts":{"build":"rimraf lib types && tsc --resolveJsonModule && cpx \\"src/**/*.html\\" lib","watch":"rimraf lib types && tsc -w","dev":"rimraf lib types && cpx \\"src/**/*.html\\" lib && tsc -w","eslint":"eslint \\"./**/*.ts\\"","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand --forceExit --detectOpenHandles --coverage --verbose --testTimeout=10000","tsc":"tsc","pkg":"pkg ./bin/cloudbase.js --out-path ./pkg","postinstall":"node ./post-install.js || exit 0 && patch-package","prepublishOnly":"npm run build","debug":"bin/tcb.js lowcode watch","build:bundle":"webpack --config build/webpack/cli.cjs && webpack --config build/webpack/ccr.cjs","package:darwin-arm64":"OS=darwin ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:darwin-x64":"OS=darwin ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:linux-arm64":"OS=linux ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:linux-x64":"OS=linux ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:all":"bash build/scripts/build-all.sh","node:fetch:one":"node -e \\"require(\'child_process\').execSync(\'bash build/scripts/fetch-node.sh\',{stdio:\'inherit\'})\\"","node:fetch:all":"NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh --all","node:fetch:win-x64":"OS=windows ARCH=x64 NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh","node:fetch:win-arm64":"OS=windows ARCH=arm64 NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh","package:windows-x64":"OS=windows ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:windows-arm64":"OS=windows ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:windows-all":"npm run -s node:fetch:win-x64 && npm run -s node:fetch:win-arm64 && npm run -s package:windows-x64 && npm run -s package:windows-arm64","out:prune":"bash build/scripts/prune-out.sh"},"repository":{"type":"git","url":"https://github.com/TencentCloudBase/cloud-base-cli.git"},"bin":{"cloudbase":"bin/cloudbase.js","cloudbase-mcp":"bin/cloudbase-mcp.cjs","tcb":"bin/tcb.js","ccr":"bin/ccr.js"},"husky":{"hooks":{"pre-commit":"npm run build"}},"author":"cwuyiqing@gmail.com","license":"ISC","dependencies":{"@cloudbase/cloud-api":"^0.5.5","@cloudbase/cloudbase-mcp":"^1.8.39","@cloudbase/framework-core":"^1.9.7","@cloudbase/functions-framework":"1.16.0","@cloudbase/iac-core":"0.0.3-alpha.11","@cloudbase/lowcode-cli":"^0.22.2","@cloudbase/manager-node":"4.5.0","@cloudbase/toolbox":"^0.7.9","@dotenvx/dotenvx":"^1.48.3","@musistudio/claude-code-router":"1.0.36","address":"^1.1.2","camelcase-keys":"^7.0.2","chalk":"^2.4.2","cli-table3":"^0.5.1","commander":"7","del":"^5.1.0","didyoumean":"^1.2.2","enquirer":"^2.3.6","execa":"^4.0.3","figlet":"^1.7.0","fs-extra":"^8.1.0","gradient-string":"^2.0.2","https-proxy-agent":"^5.0.1","i":"^0.3.7","inquirer":"^6.5.0","json-schema-to-typescript":"^14.0.5","lodash":"^4.17.21","log-symbols":"^3.0.0","lowdb":"^1.0.0","make-dir":"^3.0.0","node-fetch":"^2.6.0","nodemon":"^3.1.4","npm":"^11.5.2","open":"^7.0.0","ora":"^4.0.2","patch-package":"^8.0.0","portfinder":"^1.0.28","progress":"^2.0.3","query-string":"^6.8.1","reflect-metadata":"^0.1.13","semver":"^7.3.7","simple-git":"^3.28.0","tar-fs":"^2.0.1","terminal-link":"^2.1.1","toml":"^3.0.0","unzipper":"^0.10.10","update-notifier":"^4.0.0","xdg-basedir":"^4.0.0","yargs":"^16.2.0","yargs-parser":"^21.0.1","zod":"^4.0.13"},"devDependencies":{"@types/fs-extra":"^11.0.4","@types/jest":"^27","@types/koa__router":"^8.0.11","@types/lodash":"^4.14.182","@types/node":"^12.12.38","@types/node-fetch":"^2.5.4","@types/react":"^17.0.37","@types/semver":"^7.3.9","@types/unzipper":"^0.10.11","@types/webpack-dev-server":"^3.11.1","@typescript-eslint/eslint-plugin":"^4.8.1","@typescript-eslint/parser":"^4.8.1","cpx":"^1.5.0","eslint":"^7.14.0","eslint-config-alloy":"^3.8.2","husky":"^3.0.9","jest":"^27","rimraf":"^3.0.2","ts-jest":"^27","typescript":"^4.7.2","webpack":"^5.92.0","webpack-cli":"^5.1.4"},"packageManager":"yarn@3.6.2+sha512.2c2f8b9615e6659773f65cdec7cf92ef773a98a99e611579601f61c7a91ec94c89c929aac86f1cee819421a9b0db7acfd53ec3ebb95af44f77f77634b08b9557"}');
624056
+ module.exports = /*#__PURE__*/JSON.parse('{"name":"@cloudbase/cli","version":"2.8.28","description":"cli tool for cloudbase","main":"lib/index.js","scripts":{"build":"rimraf lib types && tsc --resolveJsonModule && cpx \\"src/**/*.html\\" lib","watch":"rimraf lib types && tsc -w","dev":"rimraf lib types && cpx \\"src/**/*.html\\" lib && tsc -w","eslint":"eslint \\"./**/*.ts\\"","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand --forceExit --detectOpenHandles --coverage --verbose --testTimeout=10000","tsc":"tsc","pkg":"pkg ./bin/cloudbase.js --out-path ./pkg","postinstall":"node ./post-install.js || exit 0 && patch-package","prepublishOnly":"npm run build","debug":"bin/tcb.js lowcode watch","build:bundle":"webpack --config build/webpack/cli.cjs && webpack --config build/webpack/ccr.cjs","package:darwin-arm64":"OS=darwin ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:darwin-x64":"OS=darwin ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:linux-arm64":"OS=linux ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:linux-x64":"OS=linux ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:all":"bash build/scripts/build-all.sh","node:fetch:one":"node -e \\"require(\'child_process\').execSync(\'bash build/scripts/fetch-node.sh\',{stdio:\'inherit\'})\\"","node:fetch:all":"NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh --all","node:fetch:win-x64":"OS=windows ARCH=x64 NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh","node:fetch:win-arm64":"OS=windows ARCH=arm64 NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh","package:windows-x64":"OS=windows ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:windows-arm64":"OS=windows ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:windows-all":"npm run -s node:fetch:win-x64 && npm run -s node:fetch:win-arm64 && npm run -s package:windows-x64 && npm run -s package:windows-arm64","out:prune":"bash build/scripts/prune-out.sh"},"repository":{"type":"git","url":"https://github.com/TencentCloudBase/cloud-base-cli.git"},"bin":{"cloudbase":"bin/cloudbase.js","cloudbase-mcp":"bin/cloudbase-mcp.cjs","tcb":"bin/tcb.js","ccr":"bin/ccr.js"},"husky":{"hooks":{"pre-commit":"npm run build"}},"author":"cwuyiqing@gmail.com","license":"ISC","dependencies":{"@cloudbase/cloud-api":"^0.5.5","@cloudbase/cloudbase-mcp":"^1.8.40","@cloudbase/framework-core":"^1.9.7","@cloudbase/functions-framework":"1.16.0","@cloudbase/iac-core":"0.0.3-alpha.11","@cloudbase/lowcode-cli":"^0.22.2","@cloudbase/manager-node":"4.5.0","@cloudbase/toolbox":"^0.7.9","@dotenvx/dotenvx":"^1.48.3","@musistudio/claude-code-router":"1.0.36","address":"^1.1.2","camelcase-keys":"^7.0.2","chalk":"^2.4.2","cli-table3":"^0.5.1","commander":"7","del":"^5.1.0","didyoumean":"^1.2.2","enquirer":"^2.3.6","execa":"^4.0.3","figlet":"^1.7.0","fs-extra":"^8.1.0","gradient-string":"^2.0.2","https-proxy-agent":"^5.0.1","i":"^0.3.7","inquirer":"^6.5.0","json-schema-to-typescript":"^14.0.5","lodash":"^4.17.21","log-symbols":"^3.0.0","lowdb":"^1.0.0","make-dir":"^3.0.0","node-fetch":"^2.6.0","nodemon":"^3.1.4","npm":"^11.5.2","open":"^7.0.0","ora":"^4.0.2","patch-package":"^8.0.0","portfinder":"^1.0.28","progress":"^2.0.3","query-string":"^6.8.1","reflect-metadata":"^0.1.13","semver":"^7.3.7","simple-git":"^3.28.0","tar-fs":"^2.0.1","terminal-link":"^2.1.1","toml":"^3.0.0","unzipper":"^0.10.10","update-notifier":"^4.0.0","xdg-basedir":"^4.0.0","yargs":"^16.2.0","yargs-parser":"^21.0.1","zod":"^4.0.13"},"devDependencies":{"@types/fs-extra":"^11.0.4","@types/jest":"^27","@types/koa__router":"^8.0.11","@types/lodash":"^4.14.182","@types/node":"^12.12.38","@types/node-fetch":"^2.5.4","@types/react":"^17.0.37","@types/semver":"^7.3.9","@types/unzipper":"^0.10.11","@types/webpack-dev-server":"^3.11.1","@typescript-eslint/eslint-plugin":"^4.8.1","@typescript-eslint/parser":"^4.8.1","cpx":"^1.5.0","eslint":"^7.14.0","eslint-config-alloy":"^3.8.2","husky":"^3.0.9","jest":"^27","rimraf":"^3.0.2","ts-jest":"^27","typescript":"^4.7.2","webpack":"^5.92.0","webpack-cli":"^5.1.4"},"packageManager":"yarn@3.6.2+sha512.2c2f8b9615e6659773f65cdec7cf92ef773a98a99e611579601f61c7a91ec94c89c929aac86f1cee819421a9b0db7acfd53ec3ebb95af44f77f77634b08b9557"}');
623680
624057
 
623681
624058
  /***/ })
623682
624059