@cloudbase/cli 2.9.8 → 2.9.10-beta.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.
Files changed (167) hide show
  1. package/bin/cloudbase.js +2 -1
  2. package/bin/tcb.js +35 -28
  3. package/cloudbase-cli-2.7.8.tgz +0 -0
  4. package/lib/auth/login.js +21 -13
  5. package/lib/commands/account/login.js +43 -42
  6. package/lib/commands/account/logout.js +3 -2
  7. package/lib/commands/ai/index.js +13 -12
  8. package/lib/commands/cloudfunction/base.js +24 -26
  9. package/lib/commands/cloudrun/base.js +87 -96
  10. package/lib/commands/common.js +11 -10
  11. package/lib/commands/config/delete.js +72 -0
  12. package/lib/commands/config/get.js +69 -0
  13. package/lib/commands/config/index.js +21 -0
  14. package/lib/commands/config/interface.js +24 -0
  15. package/lib/commands/config/list.js +72 -0
  16. package/lib/commands/config/set.js +89 -0
  17. package/lib/commands/db/base.js +33 -32
  18. package/lib/commands/env/base.js +12 -11
  19. package/lib/commands/env/domain.js +24 -23
  20. package/lib/commands/env/login.js +31 -30
  21. package/lib/commands/fun/base.js +37 -36
  22. package/lib/commands/functions/alias/getRoute.js +5 -4
  23. package/lib/commands/functions/alias/setRoute.js +7 -6
  24. package/lib/commands/functions/code-download.js +15 -11
  25. package/lib/commands/functions/code-update.js +8 -7
  26. package/lib/commands/functions/concurrency/delete.js +5 -4
  27. package/lib/commands/functions/concurrency/list.js +6 -5
  28. package/lib/commands/functions/concurrency/set.js +5 -4
  29. package/lib/commands/functions/config-update.js +8 -7
  30. package/lib/commands/functions/copy.js +7 -6
  31. package/lib/commands/functions/delete.js +8 -7
  32. package/lib/commands/functions/deploy.js +35 -34
  33. package/lib/commands/functions/detail.js +32 -31
  34. package/lib/commands/functions/invoke.js +16 -15
  35. package/lib/commands/functions/layer/bind.js +26 -25
  36. package/lib/commands/functions/layer/common.js +2 -1
  37. package/lib/commands/functions/layer/create.js +7 -6
  38. package/lib/commands/functions/layer/delete.js +9 -8
  39. package/lib/commands/functions/layer/download.js +10 -9
  40. package/lib/commands/functions/layer/list.js +10 -9
  41. package/lib/commands/functions/layer/sort.js +9 -8
  42. package/lib/commands/functions/list.js +9 -8
  43. package/lib/commands/functions/log.js +28 -27
  44. package/lib/commands/functions/run.js +21 -20
  45. package/lib/commands/functions/trigger-create.js +9 -8
  46. package/lib/commands/functions/trigger-delete.js +10 -9
  47. package/lib/commands/functions/version/list.js +9 -8
  48. package/lib/commands/functions/version/publish.js +5 -4
  49. package/lib/commands/gateway/create.js +14 -13
  50. package/lib/commands/gateway/delete.js +10 -9
  51. package/lib/commands/gateway/domain.js +25 -24
  52. package/lib/commands/gateway/list.js +11 -10
  53. package/lib/commands/gateway/switch.js +22 -19
  54. package/lib/commands/helpers/init.js +38 -37
  55. package/lib/commands/helpers/new.js +7 -6
  56. package/lib/commands/helpers/open.js +7 -6
  57. package/lib/commands/hosting/hosting.js +45 -44
  58. package/lib/commands/index.js +1 -0
  59. package/lib/commands/pull/pull.js +12 -11
  60. package/lib/commands/run/delete.js +16 -15
  61. package/lib/commands/run/image/common.js +2 -1
  62. package/lib/commands/run/image/delete.js +10 -9
  63. package/lib/commands/run/image/download.js +8 -7
  64. package/lib/commands/run/image/list.js +11 -10
  65. package/lib/commands/run/image/upload.js +9 -8
  66. package/lib/commands/run/list.js +10 -9
  67. package/lib/commands/run/service/config.js +13 -12
  68. package/lib/commands/run/service/deploy.js +24 -23
  69. package/lib/commands/run/service/list.js +10 -9
  70. package/lib/commands/run/service/update.js +22 -21
  71. package/lib/commands/run/standalonegateway/common.js +2 -1
  72. package/lib/commands/run/standalonegateway/create.js +14 -13
  73. package/lib/commands/run/standalonegateway/destroy.js +9 -8
  74. package/lib/commands/run/standalonegateway/list.js +7 -6
  75. package/lib/commands/run/standalonegateway/package.js +7 -6
  76. package/lib/commands/run/standalonegateway/turn.js +10 -9
  77. package/lib/commands/run/version/common.js +2 -1
  78. package/lib/commands/run/version/create.js +41 -40
  79. package/lib/commands/run/version/delete.js +10 -9
  80. package/lib/commands/run/version/list.js +13 -12
  81. package/lib/commands/run/version/modify.js +13 -12
  82. package/lib/commands/run/version/update.js +57 -54
  83. package/lib/commands/runf/base.js +42 -40
  84. package/lib/commands/self-update.js +11 -10
  85. package/lib/commands/smart.js +5 -4
  86. package/lib/commands/storage/storage.js +61 -56
  87. package/lib/commands/third/thirdAttach.js +6 -5
  88. package/lib/commands/utils.js +8 -5
  89. package/lib/constant.js +18 -17
  90. package/lib/decorators/deprecate.js +2 -1
  91. package/lib/function/alias.js +3 -2
  92. package/lib/function/base.js +9 -8
  93. package/lib/function/concurrency.js +4 -3
  94. package/lib/function/create.js +5 -4
  95. package/lib/function/delete.js +2 -1
  96. package/lib/function/layer/attach.js +2 -1
  97. package/lib/function/layer/create.js +2 -1
  98. package/lib/function/layer/download.js +2 -1
  99. package/lib/function/trigger.js +6 -5
  100. package/lib/function/update.js +3 -2
  101. package/lib/function/version.js +3 -2
  102. package/lib/help.js +22 -20
  103. package/lib/hosting.js +18 -17
  104. package/lib/i18n/index.js +81 -0
  105. package/lib/run/service/common.js +14 -13
  106. package/lib/run/service/config.js +4 -3
  107. package/lib/run/service/deployPackage.js +6 -5
  108. package/lib/run/service/showLogs.js +3 -2
  109. package/lib/run/service/update.js +7 -6
  110. package/lib/run/standalonegateway/list.js +5 -1
  111. package/lib/storage.js +2 -1
  112. package/lib/utils/ai/banner.js +12 -11
  113. package/lib/utils/ai/claudeWindows.js +5 -3
  114. package/lib/utils/ai/config.js +3 -2
  115. package/lib/utils/ai/const.js +4 -3
  116. package/lib/utils/ai/env.js +3 -2
  117. package/lib/utils/ai/envLocalManager.js +6 -5
  118. package/lib/utils/ai/nodeVersion.js +5 -1
  119. package/lib/utils/ai/router.js +129 -106
  120. package/lib/utils/ai/setup.js +95 -91
  121. package/lib/utils/checkTcbrEnv.js +22 -21
  122. package/lib/utils/cli-table.js +2 -1
  123. package/lib/utils/commonParamsCheck.js +4 -3
  124. package/lib/utils/debug-logger.js +2 -1
  125. package/lib/utils/dts.js +4 -3
  126. package/lib/utils/env.js +23 -21
  127. package/lib/utils/fs/index.js +5 -4
  128. package/lib/utils/function-packer.js +3 -2
  129. package/lib/utils/index.js +1 -0
  130. package/lib/utils/mcp-config-modifier.js +18 -17
  131. package/lib/utils/net/cloud-api-request.js +2 -1
  132. package/lib/utils/net/credential.js +2 -1
  133. package/lib/utils/net/http-request.js +2 -1
  134. package/lib/utils/progress-bar.js +2 -1
  135. package/lib/utils/prompt/select.js +8 -6
  136. package/lib/utils/store/auth.js +3 -2
  137. package/lib/utils/store/config.js +49 -0
  138. package/lib/utils/store/db.js +5 -0
  139. package/lib/utils/store/index.js +1 -1
  140. package/lib/utils/tcbrApi/callTcbrApi.js +2 -1
  141. package/lib/utils/template-manager.js +37 -36
  142. package/lib/utils/template.js +10 -9
  143. package/lib/utils/tools/common.js +3 -2
  144. package/lib/utils/url.js +19 -0
  145. package/lib/utils/validator.js +12 -4
  146. package/locales/README.md +160 -0
  147. package/locales/i18next-scanner.config.js +206 -0
  148. package/locales/langs/en.json +1235 -0
  149. package/locales/langs/zh.json +1235 -0
  150. package/locales/mapping.json +1235 -0
  151. package/package.json +10 -3
  152. package/types/commands/config/delete.d.ts +13 -0
  153. package/types/commands/config/get.d.ts +13 -0
  154. package/types/commands/config/index.d.ts +5 -0
  155. package/types/commands/config/interface.d.ts +17 -0
  156. package/types/commands/config/list.d.ts +13 -0
  157. package/types/commands/config/set.d.ts +13 -0
  158. package/types/commands/index.d.ts +1 -0
  159. package/types/i18n/index.d.ts +3 -0
  160. package/types/utils/ai/const.d.ts +1 -1
  161. package/types/utils/index.d.ts +1 -0
  162. package/types/utils/store/config.d.ts +8 -0
  163. package/types/utils/store/db.d.ts +2 -0
  164. package/types/utils/store/index.d.ts +1 -1
  165. package/types/utils/url.d.ts +18 -0
  166. package/dist/standalone/ccr.js +0 -78668
  167. package/dist/standalone/cli.js +0 -626422
@@ -72,6 +72,7 @@ const utils_1 = require("../../utils");
72
72
  const common_1 = require("../common");
73
73
  const constants_1 = require("../constants");
74
74
  const utils_2 = require("../utils");
75
+ const i18n_1 = require("../../i18n");
75
76
  const { CloudAPI } = iac_core_1.CloudAPI;
76
77
  const AccessType = {
77
78
  OA: 'OA',
@@ -80,8 +81,8 @@ const AccessType = {
80
81
  VPC: 'VPC'
81
82
  };
82
83
  const ResourceTitle = {
83
- container: '容器型云托管',
84
- function: '函数型云托管'
84
+ container: (0, i18n_1.t)('容器型云托管'),
85
+ function: (0, i18n_1.t)('函数型云托管')
85
86
  };
86
87
  function getCloudrunService(envId) {
87
88
  return __awaiter(this, void 0, void 0, function* () {
@@ -123,24 +124,24 @@ let CloudRunInitCommand = class CloudRunInitCommand extends common_1.Command {
123
124
  options: [
124
125
  {
125
126
  flags: '-e, --envId <envId>',
126
- desc: '环境 ID'
127
+ desc: (0, i18n_1.t)('环境 ID')
127
128
  },
128
129
  {
129
130
  flags: '-s, --serviceName <serviceName>',
130
- desc: '服务名称'
131
+ desc: (0, i18n_1.t)('服务名称')
131
132
  },
132
133
  {
133
134
  flags: '--template <template>',
134
- desc: '模板名称'
135
+ desc: (0, i18n_1.t)('模板名称')
135
136
  },
136
137
  {
137
138
  flags: '--targetPath <targetPath>',
138
- desc: '项目初始化目标路径(绝对路径或相对路径,默认: 当前目录)'
139
+ desc: (0, i18n_1.t)('项目初始化目标路径(绝对路径或相对路径,默认: 当前目录)')
139
140
  }
140
141
  ],
141
142
  requiredEnvId: false,
142
143
  autoRunLogin: true,
143
- desc: '初始化云托管服务代码项目'
144
+ desc: (0, i18n_1.t)('初始化云托管服务代码项目')
144
145
  };
145
146
  }
146
147
  execute(ctx, envId, log, options) {
@@ -160,7 +161,7 @@ let CloudRunInitCommand = class CloudRunInitCommand extends common_1.Command {
160
161
  {
161
162
  type: 'list',
162
163
  name: 'templateId',
163
- message: '请选择模板',
164
+ message: (0, i18n_1.t)('请选择模板'),
164
165
  choices: templates.map((t) => ({
165
166
  name: `${t.title}(${t.identifier})`,
166
167
  value: t.identifier
@@ -170,7 +171,7 @@ let CloudRunInitCommand = class CloudRunInitCommand extends common_1.Command {
170
171
  template = templateId;
171
172
  }
172
173
  const spinner = (0, ora_1.default)({
173
- text: '正在初始化项目代码...',
174
+ text: (0, i18n_1.t)('正在初始化项目代码...'),
174
175
  color: 'blue'
175
176
  }).start();
176
177
  try {
@@ -183,11 +184,11 @@ let CloudRunInitCommand = class CloudRunInitCommand extends common_1.Command {
183
184
  envId,
184
185
  cloudrun: { name: serviceName }
185
186
  });
186
- spinner.succeed('项目初始化成功');
187
- console.log(chalk_1.default.green(`项目路径:${projectDir}`));
187
+ spinner.succeed((0, i18n_1.t)('项目初始化成功'));
188
+ console.log(chalk_1.default.green((0, i18n_1.t)('项目路径:{{projectDir}}', { projectDir })));
188
189
  }
189
190
  catch (e) {
190
- spinner.fail('项目初始化失败');
191
+ spinner.fail((0, i18n_1.t)('项目初始化失败'));
191
192
  const error = e instanceof Error ? e : new Error(String(e));
192
193
  log.error(error.message);
193
194
  }
@@ -216,31 +217,31 @@ let CloudRunListCommand = class CloudRunListCommand extends common_1.Command {
216
217
  options: [
217
218
  {
218
219
  flags: '-e, --envId <envId>',
219
- desc: '环境 ID'
220
+ desc: (0, i18n_1.t)('环境 ID')
220
221
  },
221
222
  {
222
223
  flags: '--pageSize <pageSize>',
223
- desc: '每页数量(默认值: 10)',
224
+ desc: (0, i18n_1.t)('每页数量(默认值: 10)'),
224
225
  defaultValue: 10
225
226
  },
226
227
  {
227
228
  flags: '--pageNum <pageNum>',
228
- desc: '页码(默认值: 1)',
229
+ desc: (0, i18n_1.t)('页码(默认值: 1)'),
229
230
  defaultValue: 1
230
231
  },
231
232
  {
232
233
  flags: '--serviceName <serviceName>',
233
- desc: '服务名称筛选'
234
+ desc: (0, i18n_1.t)('服务名称筛选')
234
235
  },
235
236
  {
236
237
  flags: '--serverType <serverType>',
237
- desc: '服务类型筛选(可选值: function | container)',
238
+ desc: (0, i18n_1.t)('服务类型筛选(可选值: function | container)'),
238
239
  choices: ['function', 'container']
239
240
  }
240
241
  ],
241
242
  requiredEnvId: false,
242
243
  autoRunLogin: true,
243
- desc: '查看云托管服务列表'
244
+ desc: (0, i18n_1.t)('查看云托管服务列表')
244
245
  };
245
246
  }
246
247
  execute(ctx, envId, log, options) {
@@ -249,7 +250,7 @@ let CloudRunListCommand = class CloudRunListCommand extends common_1.Command {
249
250
  if (!envId) {
250
251
  envId = yield _selectEnv();
251
252
  }
252
- log.info(`当前环境:${envId}`);
253
+ log.info((0, i18n_1.t)('当前环境:{{envId}}', { envId }));
253
254
  const cloudrunService = yield getCloudrunService(envId);
254
255
  const services = yield cloudrunService.list({
255
256
  pageSize: parseInt(pageSize),
@@ -258,14 +259,14 @@ let CloudRunListCommand = class CloudRunListCommand extends common_1.Command {
258
259
  serverType: serverType
259
260
  });
260
261
  const table = new cli_table3_1.default({
261
- head: ['服务名称', '类型', '更新时间', '运行状态', '公网访问'],
262
+ head: [(0, i18n_1.t)('服务名称'), (0, i18n_1.t)('类型'), (0, i18n_1.t)('更新时间'), (0, i18n_1.t)('运行状态'), (0, i18n_1.t)('公网访问')],
262
263
  style: {
263
264
  head: ['green']
264
265
  }
265
266
  });
266
267
  const serverTypeTitleMap = {
267
- function: '函数型服务',
268
- container: '容器型服务'
268
+ function: (0, i18n_1.t)('函数型服务'),
269
+ container: (0, i18n_1.t)('容器型服务')
269
270
  };
270
271
  services.ServerList.forEach((service) => {
271
272
  table.push([
@@ -273,7 +274,7 @@ let CloudRunListCommand = class CloudRunListCommand extends common_1.Command {
273
274
  serverTypeTitleMap[service.ServerType] || service.ServerType,
274
275
  service.UpdateTime,
275
276
  service.Status,
276
- isPublicAccessOpen(service.AccessTypes) ? '允许' : '不允许'
277
+ isPublicAccessOpen(service.AccessTypes) ? (0, i18n_1.t)('允许') : (0, i18n_1.t)('不允许')
277
278
  ]);
278
279
  });
279
280
  console.log(table.toString());
@@ -305,27 +306,27 @@ let CloudRunDownloadCommand = class CloudRunDownloadCommand extends common_1.Com
305
306
  options: [
306
307
  {
307
308
  flags: '-e, --envId <envId>',
308
- desc: '环境 ID'
309
+ desc: (0, i18n_1.t)('环境 ID')
309
310
  },
310
311
  {
311
312
  flags: '-s, --serviceName <serviceName>',
312
- desc: '服务名称',
313
+ desc: (0, i18n_1.t)('服务名称'),
313
314
  required: true
314
315
  },
315
316
  {
316
317
  flags: '--targetPath <targetPath>',
317
- desc: '代码下载目标路径(绝对路径或相对路径,默认: 当前目录)',
318
+ desc: (0, i18n_1.t)('代码下载目标路径(绝对路径或相对路径,默认: 当前目录)'),
318
319
  defaultValue: process.cwd()
319
320
  },
320
321
  {
321
322
  flags: '--force',
322
- desc: '强制覆盖,不提示确认',
323
+ desc: (0, i18n_1.t)('强制覆盖,不提示确认'),
323
324
  defaultValue: false
324
325
  }
325
326
  ],
326
327
  requiredEnvId: false,
327
328
  autoRunLogin: true,
328
- desc: '下载云托管服务代码'
329
+ desc: (0, i18n_1.t)('下载云托管服务代码')
329
330
  };
330
331
  }
331
332
  execute(ctx, envId, log, options) {
@@ -336,7 +337,7 @@ let CloudRunDownloadCommand = class CloudRunDownloadCommand extends common_1.Com
336
337
  if (!envId) {
337
338
  envId = yield _selectEnv();
338
339
  }
339
- log.info(`当前环境:${envId}`);
340
+ log.info((0, i18n_1.t)('当前环境:{{envId}}', { envId }));
340
341
  const cloudrunService = yield getCloudrunService(envId);
341
342
  const maybeInProject = yield fs_extra_1.default.pathExists(path_1.default.join(targetDir, 'README.md'));
342
343
  if (!serviceName) {
@@ -368,12 +369,12 @@ let CloudRunDownloadCommand = class CloudRunDownloadCommand extends common_1.Com
368
369
  {
369
370
  type: 'confirm',
370
371
  name: 'confirm',
371
- message: `下载将覆盖 ${targetDir} 目录下的代码,是否继续?`,
372
+ message: (0, i18n_1.t)('下载将覆盖 {{targetDir}} 目录下的代码,是否继续?', { targetDir }),
372
373
  default: true
373
374
  }
374
375
  ]);
375
376
  if (!answers.confirm) {
376
- log.info('用户已取消下载操作');
377
+ log.info((0, i18n_1.t)('用户已取消下载操作'));
377
378
  return;
378
379
  }
379
380
  }
@@ -386,7 +387,7 @@ let CloudRunDownloadCommand = class CloudRunDownloadCommand extends common_1.Com
386
387
  envId,
387
388
  cloudrun: { name: serviceName }
388
389
  });
389
- log.success(`云托管服务 ${serviceName} 代码已成功下载到: ${targetDir}`);
390
+ log.success((0, i18n_1.t)('云托管服务 {{serviceName}} 代码已成功下载到: {{targetDir}}', { serviceName, targetDir }));
390
391
  }
391
392
  catch (e) {
392
393
  const error = e instanceof Error ? e : new Error(String(e));
@@ -421,22 +422,22 @@ let CloudRunDeleteCommand = class CloudRunDeleteCommand extends common_1.Command
421
422
  options: [
422
423
  {
423
424
  flags: '-e, --envId <envId>',
424
- desc: '环境 ID'
425
+ desc: (0, i18n_1.t)('环境 ID')
425
426
  },
426
427
  {
427
428
  flags: '-s, --serviceName <serviceName>',
428
- desc: '服务名称',
429
+ desc: (0, i18n_1.t)('服务名称'),
429
430
  required: true
430
431
  },
431
432
  {
432
433
  flags: '--force',
433
- desc: '强制删除,不提示确认',
434
+ desc: (0, i18n_1.t)('强制删除,不提示确认'),
434
435
  defaultValue: false
435
436
  }
436
437
  ],
437
438
  requiredEnvId: false,
438
439
  autoRunLogin: true,
439
- desc: '删除云托管服务'
440
+ desc: (0, i18n_1.t)('删除云托管服务')
440
441
  };
441
442
  }
442
443
  execute(ctx, envId, log, options) {
@@ -446,7 +447,7 @@ let CloudRunDeleteCommand = class CloudRunDeleteCommand extends common_1.Command
446
447
  if (!envId) {
447
448
  envId = yield _selectEnv();
448
449
  }
449
- log.info(`当前环境:${envId}`);
450
+ log.info((0, i18n_1.t)('当前环境:{{envId}}', { envId }));
450
451
  const cloudrunService = yield getCloudrunService(envId);
451
452
  if (!serviceName) {
452
453
  const config = yield (0, utils_2.getCloudbaserc)(process.cwd());
@@ -461,12 +462,12 @@ let CloudRunDeleteCommand = class CloudRunDeleteCommand extends common_1.Command
461
462
  {
462
463
  type: 'confirm',
463
464
  name: 'confirm',
464
- message: `确定要删除云托管服务 ${serviceName} 吗?`,
465
+ message: (0, i18n_1.t)('确定要删除云托管服务 {{serviceName}} 吗?', { serviceName }),
465
466
  default: false
466
467
  }
467
468
  ]);
468
469
  if (!answers.confirm) {
469
- log.info('已取消删除操作');
470
+ log.info((0, i18n_1.t)('已取消删除操作'));
470
471
  return;
471
472
  }
472
473
  }
@@ -474,7 +475,7 @@ let CloudRunDeleteCommand = class CloudRunDeleteCommand extends common_1.Command
474
475
  yield cloudrunService.delete({
475
476
  serverName: serviceName
476
477
  });
477
- log.success(`云托管服务 ${serviceName} 删除成功`);
478
+ log.success((0, i18n_1.t)('云托管服务 {{serviceName}} 删除成功', { serviceName }));
478
479
  }
479
480
  catch (e) {
480
481
  const error = e instanceof Error ? e : new Error(String(e));
@@ -509,33 +510,33 @@ let CloudRunDeployCommand = class CloudRunDeployCommand extends common_1.Command
509
510
  options: [
510
511
  {
511
512
  flags: '-e, --envId <envId>',
512
- desc: '环境 ID'
513
+ desc: (0, i18n_1.t)('环境 ID')
513
514
  },
514
515
  {
515
516
  flags: '-s, --serviceName <serviceName>',
516
- desc: '服务名称'
517
+ desc: (0, i18n_1.t)('服务名称')
517
518
  },
518
519
  {
519
520
  flags: '--port <port>',
520
- desc: '容器型云托管服务端口(函数型云托管设置无效)'
521
+ desc: (0, i18n_1.t)('容器型云托管服务端口(函数型云托管设置无效)')
521
522
  },
522
523
  {
523
524
  flags: '--source <source>',
524
- desc: '部署代码所在目录路径(绝对路径或相对路径,默认: 当前目录)'
525
+ desc: (0, i18n_1.t)('部署代码所在目录路径(绝对路径或相对路径,默认: 当前目录)')
525
526
  },
526
527
  {
527
528
  flags: '--createAgent',
528
- desc: '创建函数型 Agent'
529
+ desc: (0, i18n_1.t)('创建函数型 Agent')
529
530
  },
530
531
  {
531
532
  flags: '--force',
532
- desc: '强制部署,跳过所有确认提示',
533
+ desc: (0, i18n_1.t)('强制部署,跳过所有确认提示'),
533
534
  defaultValue: false
534
535
  }
535
536
  ],
536
537
  requiredEnvId: false,
537
538
  autoRunLogin: true,
538
- desc: '部署云托管服务'
539
+ desc: (0, i18n_1.t)('部署云托管服务')
539
540
  };
540
541
  }
541
542
  execute(ctx, envId, log, options) {
@@ -552,16 +553,16 @@ let CloudRunDeployCommand = class CloudRunDeployCommand extends common_1.Command
552
553
  envId = yield _selectEnv();
553
554
  }
554
555
  }
555
- log.info(`当前环境 Id:${envId}`);
556
+ log.info((0, i18n_1.t)('当前环境 Id{{envId}}', { envId }));
556
557
  if (createAgent) {
557
558
  const questions = [
558
559
  {
559
560
  type: 'input',
560
561
  name: 'Name',
561
- message: '请输入函数式 Agent 名称:',
562
+ message: (0, i18n_1.t)('请输入函数式 Agent 名称:'),
562
563
  validate: (input) => {
563
564
  if (!input.trim()) {
564
- return '名称不能为空';
565
+ return (0, i18n_1.t)('名称不能为空');
565
566
  }
566
567
  return true;
567
568
  }
@@ -569,10 +570,10 @@ let CloudRunDeployCommand = class CloudRunDeployCommand extends common_1.Command
569
570
  {
570
571
  type: 'input',
571
572
  name: 'BotId',
572
- message: '请输入括号内的标识 ibot-(服务名-BotTag)。示例:agent-chat:',
573
+ message: (0, i18n_1.t)('请输入括号内的标识 ibot-(服务名-BotTag)。示例:agent-chat:'),
573
574
  validate: (input) => {
574
575
  if (!/^[a-z0-9_]+-[a-z0-9_]+$/.test(input)) {
575
- return '标识格式错误,应为"xxx-xxx"';
576
+ return (0, i18n_1.t)('标识格式错误,应为"xxx-xxx"');
576
577
  }
577
578
  return true;
578
579
  }
@@ -586,7 +587,7 @@ let CloudRunDeployCommand = class CloudRunDeployCommand extends common_1.Command
586
587
  BotId: botId
587
588
  });
588
589
  (0, utils_2.trackCallback)({
589
- details: `请打开链接查看部署状态: https://tcb.cloud.tencent.com/dev?envId=${envId}#/ai?tab=agent&agent=${botId}`
590
+ details: (0, i18n_1.t)('请打开链接查看部署状态: {{url}}', { url: `${utils_1.EUrl.DevPlatform}?envId=${envId}#/ai?tab=agent&agent=${botId}` })
590
591
  }, log);
591
592
  return;
592
593
  }
@@ -605,14 +606,14 @@ let CloudRunDeployCommand = class CloudRunDeployCommand extends common_1.Command
605
606
  const containerConfigFile = 'container.config.json';
606
607
  const containerConfigPath = path_1.default.join(targetDir, containerConfigFile);
607
608
  if (yield fs_extra_1.default.pathExists(containerConfigPath)) {
608
- log.warn(`CLI 中 ${containerConfigFile} 文件将不会生效,请通过命令行参数进行配置!`);
609
+ log.warn((0, i18n_1.t)('CLI 中 {{containerConfigFile}} 文件将不会生效,请通过命令行参数进行配置!', { containerConfigFile }));
609
610
  }
610
611
  if (!force) {
611
612
  const answers = yield inquirer_1.default.prompt([
612
613
  {
613
614
  type: 'confirm',
614
615
  name: 'confirm',
615
- message: '即将开始部署,是否确认继续?',
616
+ message: (0, i18n_1.t)('即将开始部署,是否确认继续?'),
616
617
  default: true
617
618
  }
618
619
  ]);
@@ -643,17 +644,17 @@ let CloudRunDeployCommand = class CloudRunDeployCommand extends common_1.Command
643
644
  }
644
645
  }
645
646
  if (!serverType) {
646
- throw new Error('无法判断云托管服务类型');
647
+ throw new Error((0, i18n_1.t)('无法判断云托管服务类型'));
647
648
  }
648
649
  if (!['container', 'function'].includes(serverType)) {
649
- throw new Error(`不支持的云托管服务类型:${serverType}`);
650
+ throw new Error((0, i18n_1.t)('不支持的云托管服务类型:{{serverType}}', { serverType }));
650
651
  }
651
652
  yield _runDeploy();
652
653
  function _runDeploy() {
653
654
  return __awaiter(this, void 0, void 0, function* () {
654
655
  try {
655
656
  utils_2.trackCallback === null || utils_2.trackCallback === void 0 ? void 0 : (0, utils_2.trackCallback)({
656
- details: `正在提交${ResourceTitle[serverType]} ${serviceName} 中,请稍候...`,
657
+ details: (0, i18n_1.t)('正在提交{{serverType}} {{serviceName}} 中,请稍候...', { serverType: ResourceTitle[serverType], serviceName }),
657
658
  status: 'progress'
658
659
  }, log);
659
660
  yield cloudrunService.deploy({
@@ -662,7 +663,7 @@ let CloudRunDeployCommand = class CloudRunDeployCommand extends common_1.Command
662
663
  serverConfig: Object.assign({}, (port ? { Port: Number(port) } : {}))
663
664
  });
664
665
  utils_2.trackCallback === null || utils_2.trackCallback === void 0 ? void 0 : (0, utils_2.trackCallback)({
665
- details: `提交${ResourceTitle[serverType]} ${serviceName} 已完成!`,
666
+ details: (0, i18n_1.t)('提交{{serverType}} {{serviceName}} 已完成!', { serverType: ResourceTitle[serverType], serviceName }),
666
667
  status: 'done'
667
668
  }, log);
668
669
  yield (0, utils_2.upsertCloudbaserc)(targetDir, {
@@ -670,7 +671,7 @@ let CloudRunDeployCommand = class CloudRunDeployCommand extends common_1.Command
670
671
  cloudrun: { name: serviceName }
671
672
  });
672
673
  (0, utils_2.trackCallback)({
673
- details: `请打开链接查看部署状态: https://tcb.cloud.tencent.com/dev?envId=${envId}#/platform-run/service/detail?serverName=${serviceName}&tabId=deploy&envId=${envId}`
674
+ details: (0, i18n_1.t)('请打开链接查看部署状态: {{url}}', { url: `${utils_1.EUrl.DevPlatform}?envId=${envId}#/platform-run/service/detail?serverName=${serviceName}&tabId=deploy&envId=${envId}` })
674
675
  }, log);
675
676
  }
676
677
  catch (e) {
@@ -680,7 +681,7 @@ let CloudRunDeployCommand = class CloudRunDeployCommand extends common_1.Command
680
681
  {
681
682
  type: 'confirm',
682
683
  name: 'confirm',
683
- message: '平台当前有部署发布任务正在运行中。确认继续部署,正在执行的部署任务将被取消,并立即部署最新的代码',
684
+ message: (0, i18n_1.t)('平台当前有部署发布任务正在运行中。确认继续部署,正在执行的部署任务将被取消,并立即部署最新的代码'),
684
685
  default: true
685
686
  }
686
687
  ])
@@ -748,61 +749,51 @@ let CloudRunRunCommand = class CloudRunRunCommand extends common_1.Command {
748
749
  options: [
749
750
  {
750
751
  flags: '--runMode <runMode>',
751
- desc: '运行模式,可选值: normal(普通函数) | agent(函数式 Agent),默认值: normal'
752
+ desc: (0, i18n_1.t)('运行模式,可选值: normal(普通函数) | agent(函数式 Agent),默认值: normal')
752
753
  },
753
754
  {
754
755
  flags: '--agentId <agentId>',
755
- desc: '在 agent 模式下需要提供 Agent ID 进行调试'
756
+ desc: (0, i18n_1.t)('在 agent 模式下需要提供 Agent ID 进行调试')
756
757
  },
757
758
  {
758
759
  flags: '-e, --envId <envId>',
759
- desc: '环境 ID'
760
+ desc: (0, i18n_1.t)('环境 ID')
760
761
  },
761
762
  {
762
763
  flags: '--port <port>',
763
- desc: `监听的端口,默认为 3000
764
- `
764
+ desc: (0, i18n_1.t)('监听的端口,默认为 3000')
765
765
  },
766
766
  {
767
767
  flags: '-w, --watch',
768
- desc: `是否启用热重启模式,如启用,将会在文件变更时自动重启服务,默认为 false
769
- `
768
+ desc: (0, i18n_1.t)('是否启用热重启模式,如启用,将会在文件变更时自动重启服务,默认为 false')
770
769
  },
771
770
  {
772
771
  flags: '--dry-run',
773
- desc: `是否不启动服务,只验证代码可以正常加载,默认为 false
774
- `
772
+ desc: (0, i18n_1.t)('是否不启动服务,只验证代码可以正常加载,默认为 false')
775
773
  },
776
774
  {
777
775
  flags: '--logDirname <logDirname>',
778
- desc: `日志文件目录,默认为 ./logs
779
- `
776
+ desc: (0, i18n_1.t)('日志文件目录,默认为 ./logs')
780
777
  },
781
778
  {
782
779
  flags: '--functionsConfigFile <functionsConfigFile>',
783
- desc: `多函数定义配置文件,默认为 ./cloudbase-functions.json
784
- 环境变量: FUNCTIONS_CONFIG_FILE
785
- `
780
+ desc: (0, i18n_1.t)('多函数定义配置文件,默认为 ./cloudbase-functions.json。环境变量: FUNCTIONS_CONFIG_FILE')
786
781
  },
787
782
  {
788
783
  flags: '--loadAllFunctions',
789
- desc: `是否加载 "functionsRoot" 目录中的所有函数。默认为 false
790
- `
784
+ desc: (0, i18n_1.t)('是否加载 "functionsRoot" 目录中的所有函数。默认为 false')
791
785
  },
792
786
  {
793
787
  flags: '--extendedContext <extendedContext>',
794
- desc: `用于解析 context.extendedContext 的值。""表示该功能已关闭。默认值为 null
795
- 示例:--extendedContext '{"a":1,"b":2}'
796
- 环境变量:EXTENDED_CONTEXT
797
- `
788
+ desc: (0, i18n_1.t)('用于解析 context.extendedContext 的值。""表示该功能已关闭。默认值为 null。示例:--extendedContext \'{"a":1,"b":2}\'。环境变量:EXTENDED_CONTEXT')
798
789
  },
799
790
  {
800
791
  flags: '--open-debug-panel <openDebugPanel>',
801
- desc: '是否打开调试面板,默认为 \'true\''
792
+ desc: (0, i18n_1.t)('是否打开调试面板,默认为 \'true\'')
802
793
  }
803
794
  ],
804
795
  requiredEnvId: false,
805
- desc: '本地运行函数型云托管服务(不支持容器型云托管服务)'
796
+ desc: (0, i18n_1.t)('本地运行函数型云托管服务(不支持容器型云托管服务)')
806
797
  };
807
798
  }
808
799
  execute(envId, logger, ctx, options) {
@@ -810,7 +801,7 @@ let CloudRunRunCommand = class CloudRunRunCommand extends common_1.Command {
810
801
  debugger;
811
802
  let { runMode = 'normal', agentId, openDebugPanel = true } = options;
812
803
  const type = runMode;
813
- console.log(chalk_1.default.green(`当前运行模式: ${type}`));
804
+ console.log(chalk_1.default.green((0, i18n_1.t)('当前运行模式: {{type}}', { type })));
814
805
  if (!process.argv.some((arg) => arg.includes('--dotEnvFilePath='))) {
815
806
  process.argv.push('--dotEnvFilePath=.env.local');
816
807
  }
@@ -826,22 +817,22 @@ let CloudRunRunCommand = class CloudRunRunCommand extends common_1.Command {
826
817
  envId = yield _selectEnv();
827
818
  }
828
819
  }
829
- logger.info(`当前环境 Id:${envId}`);
820
+ logger.info((0, i18n_1.t)('当前环境 Id{{envId}}', { envId }));
830
821
  if (type === 'agent') {
831
822
  if (!agentId) {
832
823
  const answers = yield inquirer_1.default.prompt([
833
824
  {
834
825
  type: 'input',
835
826
  name: 'agentId',
836
- message: '请输入 Agent ID(如没有请填写任意值):',
827
+ message: (0, i18n_1.t)('请输入 Agent ID(如没有请填写任意值):'),
837
828
  validate: (val) => {
838
- return val.trim() ? true : 'Agent ID 不能为空';
829
+ return val.trim() ? true : (0, i18n_1.t)('Agent ID 不能为空');
839
830
  }
840
831
  }
841
832
  ]);
842
833
  agentId = answers.agentId;
843
834
  }
844
- logger.info(`当前 Agent ID: ${agentId}`);
835
+ logger.info((0, i18n_1.t)('当前 Agent ID: {{agentId}}', { agentId }));
845
836
  }
846
837
  const credential = yield (0, utils_2.getCredential)(ctx, options);
847
838
  process.env.EXTENDED_CONTEXT = JSON.stringify({
@@ -931,7 +922,7 @@ let CloudRunRunCommand = class CloudRunRunCommand extends common_1.Command {
931
922
  console.log(data.toString());
932
923
  });
933
924
  child.on('exit', (code) => {
934
- console.log(`子进程退出,退出码 ${code}`);
925
+ console.log((0, i18n_1.t)('子进程退出,退出码 {{code}}', { code }));
935
926
  });
936
927
  }
937
928
  });
@@ -941,10 +932,10 @@ let CloudRunRunCommand = class CloudRunRunCommand extends common_1.Command {
941
932
  let url = `http://127.0.0.1:${port}/cloudrun-run-ui/index.html?type=${type}&envId=${envId}&port=${port}`;
942
933
  if (type === 'agent') {
943
934
  url += `&agentId=${agentId}`;
944
- console.log(chalk_1.default.green(`点击 [${url}] 可以打开 Agent 调试应用`));
935
+ console.log(chalk_1.default.green((0, i18n_1.t)('点击 [{{url}}] 可以打开 Agent 调试应用', { url })));
945
936
  }
946
937
  else {
947
- console.log(chalk_1.default.green(`点击 [${url}] 可以打开函数调试面板`));
938
+ console.log(chalk_1.default.green((0, i18n_1.t)('点击 [{{url}}] 可以打开函数调试面板', { url })));
948
939
  }
949
940
  if (isOpen) {
950
941
  yield this.waitForPort(url);
@@ -970,7 +961,7 @@ let CloudRunRunCommand = class CloudRunRunCommand extends common_1.Command {
970
961
  }
971
962
  yield new Promise((resolve) => setTimeout(resolve, 500));
972
963
  }
973
- throw new Error(`等待服务${url}就绪超时`);
964
+ throw new Error((0, i18n_1.t)('等待服务{{url}}就绪超时', { url }));
974
965
  });
975
966
  }
976
967
  };
@@ -999,7 +990,7 @@ function _inputServiceName(defaultVal = '') {
999
990
  {
1000
991
  type: 'input',
1001
992
  name: 'serviceName',
1002
- message: '请输入服务名称',
993
+ message: (0, i18n_1.t)('请输入服务名称'),
1003
994
  default: defaultVal,
1004
995
  validate: (val) => {
1005
996
  const isValid = !val.startsWith('lcap') &&
@@ -1007,7 +998,7 @@ function _inputServiceName(defaultVal = '') {
1007
998
  /^[A-Za-z][\w-_]{0,43}[A-Za-z0-9]$/.test(val);
1008
999
  return isValid
1009
1000
  ? true
1010
- : '支持大小写字母、数字、-和_,但必须以字母开头、以字母和数字结尾,不支持以lcap、lowcode开头,最长45个字符';
1001
+ : (0, i18n_1.t)('支持大小写字母、数字、-和_,但必须以字母开头、以字母和数字结尾,不支持以lcap、lowcode开头,最长45个字符');
1011
1002
  }
1012
1003
  }
1013
1004
  ];
@@ -1021,7 +1012,7 @@ function _inputTargetPath(defaultVal = process.cwd()) {
1021
1012
  {
1022
1013
  type: 'input',
1023
1014
  name: 'targetPath',
1024
- message: '请输入目标路径(目录名称或绝对路径)',
1015
+ message: (0, i18n_1.t)('请输入目标路径(目录名称或绝对路径)'),
1025
1016
  default: defaultVal,
1026
1017
  validate: (val) => {
1027
1018
  try {
@@ -1029,7 +1020,7 @@ function _inputTargetPath(defaultVal = process.cwd()) {
1029
1020
  return true;
1030
1021
  }
1031
1022
  catch (e) {
1032
- return '请输入有效的路径';
1023
+ return (0, i18n_1.t)('请输入有效的路径');
1033
1024
  }
1034
1025
  },
1035
1026
  filter: (val) => {