@cloudbase/cli 2.9.9 → 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 (164) hide show
  1. package/bin/cloudbase.js +2 -1
  2. package/bin/tcb.js +35 -28
  3. package/lib/auth/login.js +21 -13
  4. package/lib/commands/account/login.js +43 -42
  5. package/lib/commands/account/logout.js +3 -2
  6. package/lib/commands/ai/index.js +13 -12
  7. package/lib/commands/cloudfunction/base.js +24 -26
  8. package/lib/commands/cloudrun/base.js +87 -96
  9. package/lib/commands/common.js +11 -10
  10. package/lib/commands/config/delete.js +72 -0
  11. package/lib/commands/config/get.js +69 -0
  12. package/lib/commands/config/index.js +21 -0
  13. package/lib/commands/config/interface.js +24 -0
  14. package/lib/commands/config/list.js +72 -0
  15. package/lib/commands/config/set.js +89 -0
  16. package/lib/commands/db/base.js +33 -32
  17. package/lib/commands/env/base.js +12 -11
  18. package/lib/commands/env/domain.js +24 -23
  19. package/lib/commands/env/login.js +31 -30
  20. package/lib/commands/fun/base.js +37 -36
  21. package/lib/commands/functions/alias/getRoute.js +5 -4
  22. package/lib/commands/functions/alias/setRoute.js +7 -6
  23. package/lib/commands/functions/code-download.js +15 -11
  24. package/lib/commands/functions/code-update.js +8 -7
  25. package/lib/commands/functions/concurrency/delete.js +5 -4
  26. package/lib/commands/functions/concurrency/list.js +6 -5
  27. package/lib/commands/functions/concurrency/set.js +5 -4
  28. package/lib/commands/functions/config-update.js +8 -7
  29. package/lib/commands/functions/copy.js +7 -6
  30. package/lib/commands/functions/delete.js +8 -7
  31. package/lib/commands/functions/deploy.js +35 -34
  32. package/lib/commands/functions/detail.js +32 -31
  33. package/lib/commands/functions/invoke.js +16 -15
  34. package/lib/commands/functions/layer/bind.js +26 -25
  35. package/lib/commands/functions/layer/common.js +2 -1
  36. package/lib/commands/functions/layer/create.js +7 -6
  37. package/lib/commands/functions/layer/delete.js +9 -8
  38. package/lib/commands/functions/layer/download.js +10 -9
  39. package/lib/commands/functions/layer/list.js +10 -9
  40. package/lib/commands/functions/layer/sort.js +9 -8
  41. package/lib/commands/functions/list.js +9 -8
  42. package/lib/commands/functions/log.js +28 -27
  43. package/lib/commands/functions/run.js +21 -20
  44. package/lib/commands/functions/trigger-create.js +9 -8
  45. package/lib/commands/functions/trigger-delete.js +10 -9
  46. package/lib/commands/functions/version/list.js +9 -8
  47. package/lib/commands/functions/version/publish.js +5 -4
  48. package/lib/commands/gateway/create.js +14 -13
  49. package/lib/commands/gateway/delete.js +10 -9
  50. package/lib/commands/gateway/domain.js +25 -24
  51. package/lib/commands/gateway/list.js +11 -10
  52. package/lib/commands/gateway/switch.js +22 -19
  53. package/lib/commands/helpers/init.js +38 -37
  54. package/lib/commands/helpers/new.js +7 -6
  55. package/lib/commands/helpers/open.js +7 -6
  56. package/lib/commands/hosting/hosting.js +45 -44
  57. package/lib/commands/index.js +1 -0
  58. package/lib/commands/pull/pull.js +12 -11
  59. package/lib/commands/run/delete.js +16 -15
  60. package/lib/commands/run/image/common.js +2 -1
  61. package/lib/commands/run/image/delete.js +10 -9
  62. package/lib/commands/run/image/download.js +8 -7
  63. package/lib/commands/run/image/list.js +11 -10
  64. package/lib/commands/run/image/upload.js +9 -8
  65. package/lib/commands/run/list.js +10 -9
  66. package/lib/commands/run/service/config.js +13 -12
  67. package/lib/commands/run/service/deploy.js +24 -23
  68. package/lib/commands/run/service/list.js +10 -9
  69. package/lib/commands/run/service/update.js +22 -21
  70. package/lib/commands/run/standalonegateway/common.js +2 -1
  71. package/lib/commands/run/standalonegateway/create.js +14 -13
  72. package/lib/commands/run/standalonegateway/destroy.js +9 -8
  73. package/lib/commands/run/standalonegateway/list.js +7 -6
  74. package/lib/commands/run/standalonegateway/package.js +7 -6
  75. package/lib/commands/run/standalonegateway/turn.js +10 -9
  76. package/lib/commands/run/version/common.js +2 -1
  77. package/lib/commands/run/version/create.js +41 -40
  78. package/lib/commands/run/version/delete.js +10 -9
  79. package/lib/commands/run/version/list.js +13 -12
  80. package/lib/commands/run/version/modify.js +13 -12
  81. package/lib/commands/run/version/update.js +57 -54
  82. package/lib/commands/runf/base.js +42 -40
  83. package/lib/commands/self-update.js +11 -10
  84. package/lib/commands/smart.js +5 -4
  85. package/lib/commands/storage/storage.js +61 -56
  86. package/lib/commands/third/thirdAttach.js +6 -5
  87. package/lib/commands/utils.js +8 -5
  88. package/lib/constant.js +18 -17
  89. package/lib/decorators/deprecate.js +2 -1
  90. package/lib/function/alias.js +3 -2
  91. package/lib/function/base.js +9 -8
  92. package/lib/function/concurrency.js +4 -3
  93. package/lib/function/create.js +5 -4
  94. package/lib/function/delete.js +2 -1
  95. package/lib/function/layer/attach.js +2 -1
  96. package/lib/function/layer/create.js +2 -1
  97. package/lib/function/layer/download.js +2 -1
  98. package/lib/function/trigger.js +6 -5
  99. package/lib/function/update.js +3 -2
  100. package/lib/function/version.js +3 -2
  101. package/lib/help.js +22 -20
  102. package/lib/hosting.js +18 -17
  103. package/lib/i18n/index.js +81 -0
  104. package/lib/run/service/common.js +14 -13
  105. package/lib/run/service/config.js +4 -3
  106. package/lib/run/service/deployPackage.js +6 -5
  107. package/lib/run/service/showLogs.js +3 -2
  108. package/lib/run/service/update.js +7 -6
  109. package/lib/run/standalonegateway/list.js +5 -1
  110. package/lib/storage.js +2 -1
  111. package/lib/utils/ai/banner.js +12 -11
  112. package/lib/utils/ai/claudeWindows.js +5 -3
  113. package/lib/utils/ai/config.js +3 -2
  114. package/lib/utils/ai/const.js +4 -3
  115. package/lib/utils/ai/env.js +3 -2
  116. package/lib/utils/ai/envLocalManager.js +6 -5
  117. package/lib/utils/ai/nodeVersion.js +5 -1
  118. package/lib/utils/ai/router.js +129 -106
  119. package/lib/utils/ai/setup.js +95 -91
  120. package/lib/utils/checkTcbrEnv.js +22 -21
  121. package/lib/utils/cli-table.js +2 -1
  122. package/lib/utils/commonParamsCheck.js +4 -3
  123. package/lib/utils/debug-logger.js +2 -1
  124. package/lib/utils/dts.js +4 -3
  125. package/lib/utils/env.js +23 -21
  126. package/lib/utils/fs/index.js +5 -4
  127. package/lib/utils/function-packer.js +3 -2
  128. package/lib/utils/index.js +1 -0
  129. package/lib/utils/mcp-config-modifier.js +18 -17
  130. package/lib/utils/net/cloud-api-request.js +2 -1
  131. package/lib/utils/net/credential.js +2 -1
  132. package/lib/utils/net/http-request.js +2 -1
  133. package/lib/utils/progress-bar.js +2 -1
  134. package/lib/utils/prompt/select.js +8 -6
  135. package/lib/utils/store/auth.js +3 -2
  136. package/lib/utils/store/config.js +49 -0
  137. package/lib/utils/store/db.js +5 -0
  138. package/lib/utils/store/index.js +1 -1
  139. package/lib/utils/tcbrApi/callTcbrApi.js +2 -1
  140. package/lib/utils/template-manager.js +37 -36
  141. package/lib/utils/template.js +10 -9
  142. package/lib/utils/tools/common.js +3 -2
  143. package/lib/utils/url.js +19 -0
  144. package/lib/utils/validator.js +12 -4
  145. package/locales/README.md +160 -0
  146. package/locales/i18next-scanner.config.js +206 -0
  147. package/locales/langs/en.json +1235 -0
  148. package/locales/langs/zh.json +1235 -0
  149. package/locales/mapping.json +1235 -0
  150. package/package.json +9 -2
  151. package/types/commands/config/delete.d.ts +13 -0
  152. package/types/commands/config/get.d.ts +13 -0
  153. package/types/commands/config/index.d.ts +5 -0
  154. package/types/commands/config/interface.d.ts +17 -0
  155. package/types/commands/config/list.d.ts +13 -0
  156. package/types/commands/config/set.d.ts +13 -0
  157. package/types/commands/index.d.ts +1 -0
  158. package/types/i18n/index.d.ts +3 -0
  159. package/types/utils/ai/const.d.ts +1 -1
  160. package/types/utils/index.d.ts +1 -0
  161. package/types/utils/store/config.d.ts +8 -0
  162. package/types/utils/store/db.d.ts +2 -0
  163. package/types/utils/store/index.d.ts +1 -1
  164. package/types/utils/url.d.ts +18 -0
@@ -40,6 +40,7 @@ const decorators_1 = require("../../decorators");
40
40
  const common_1 = require("../common");
41
41
  const constants_1 = require("../constants");
42
42
  const utils_1 = require("../utils");
43
+ const i18n_1 = require("../../i18n");
43
44
  let CloudFunctionDeployCommand = class CloudFunctionDeployCommand extends common_1.Command {
44
45
  get options() {
45
46
  return {
@@ -48,20 +49,20 @@ let CloudFunctionDeployCommand = class CloudFunctionDeployCommand extends common
48
49
  options: [
49
50
  {
50
51
  flags: '-e, --envId <envId>',
51
- desc: '环境 Id'
52
+ desc: (0, i18n_1.t)('环境 Id')
52
53
  },
53
54
  {
54
55
  flags: '-s, --serviceName <serviceName>',
55
- desc: '服务名称'
56
+ desc: (0, i18n_1.t)('服务名称')
56
57
  },
57
58
  {
58
59
  flags: '--source <source>',
59
- desc: '目标函数文件所在目录路径。默认为当前路径'
60
+ desc: (0, i18n_1.t)('目标函数文件所在目录路径。默认为当前路径')
60
61
  }
61
62
  ],
62
63
  requiredEnvId: false,
63
64
  autoRunLogin: true,
64
- desc: '部署云函数服务'
65
+ desc: (0, i18n_1.t)('部署云函数服务')
65
66
  };
66
67
  }
67
68
  execute(ctx, envId, log, options) {
@@ -72,14 +73,14 @@ let CloudFunctionDeployCommand = class CloudFunctionDeployCommand extends common
72
73
  const envConfig = (0, camelcase_keys_1.default)(yield iac_core_1.utils.loadEnv(targetDir));
73
74
  if (envConfig.envId) {
74
75
  envId = envConfig.envId;
75
- log.info(`当前环境 Id:${envId}`);
76
+ log.info((0, i18n_1.t)('当前环境 Id{{envId}}', { envId }));
76
77
  }
77
78
  else {
78
79
  envId = yield _selectEnv();
79
80
  }
80
81
  }
81
82
  else {
82
- log.info(`当前环境 Id:${envId}`);
83
+ log.info((0, i18n_1.t)('当前环境 Id{{envId}}', { envId }));
83
84
  }
84
85
  if (!serviceName) {
85
86
  const { shortName } = yield (0, utils_1.getPackageJsonName)(path_1.default.join(targetDir, 'package.json'));
@@ -89,7 +90,7 @@ let CloudFunctionDeployCommand = class CloudFunctionDeployCommand extends common
89
90
  {
90
91
  type: 'confirm',
91
92
  name: 'confirm',
92
- message: `即将开始部署,是否确认继续?`,
93
+ message: (0, i18n_1.t)('即将开始部署,是否确认继续?'),
93
94
  default: true
94
95
  }
95
96
  ]);
@@ -118,10 +119,10 @@ let CloudFunctionDeployCommand = class CloudFunctionDeployCommand extends common
118
119
  }
119
120
  catch (e) {
120
121
  if ((e === null || e === void 0 ? void 0 : e.action) === 'UpdateFunctionConfiguration' &&
121
- ((_a = e === null || e === void 0 ? void 0 : e.message) === null || _a === void 0 ? void 0 : _a.includes('当前函数处于Updating状态,无法进行此操作,请稍后重试'))) {
122
+ ((_a = e === null || e === void 0 ? void 0 : e.message) === null || _a === void 0 ? void 0 : _a.includes((0, i18n_1.t)('当前函数处于Updating状态,无法进行此操作,请稍后重试')))) {
122
123
  (0, utils_1.trackCallback)({
123
124
  type: 'error',
124
- details: '当前函数处于更新状态,无法进行此操作,请稍后重试',
125
+ details: (0, i18n_1.t)('当前函数处于更新状态,无法进行此操作,请稍后重试'),
125
126
  originalError: e
126
127
  }, log);
127
128
  }
@@ -160,20 +161,20 @@ let CloudFunctionDownloadCommand = class CloudFunctionDownloadCommand extends co
160
161
  options: [
161
162
  {
162
163
  flags: '-e, --envId <envId>',
163
- desc: '环境 Id'
164
+ desc: (0, i18n_1.t)('环境 Id')
164
165
  },
165
166
  {
166
167
  flags: '-s, --serviceName <serviceName>',
167
- desc: '服务名称'
168
+ desc: (0, i18n_1.t)('服务名称')
168
169
  },
169
170
  {
170
171
  flags: '--source <source>',
171
- desc: '目标函数文件所在目录路径。默认为当前路径'
172
+ desc: (0, i18n_1.t)('目标函数文件所在目录路径。默认为当前路径')
172
173
  }
173
174
  ],
174
175
  requiredEnvId: false,
175
176
  autoRunLogin: true,
176
- desc: '下载云函数服务代码'
177
+ desc: (0, i18n_1.t)('下载云函数服务代码')
177
178
  };
178
179
  }
179
180
  execute(ctx, envId, log, options) {
@@ -185,7 +186,7 @@ let CloudFunctionDownloadCommand = class CloudFunctionDownloadCommand extends co
185
186
  envId = envConfig.envId || (yield _selectEnv());
186
187
  }
187
188
  else {
188
- log.info(`当前环境 Id:${envId}`);
189
+ log.info((0, i18n_1.t)('当前环境 Id{{envId}}', { envId }));
189
190
  }
190
191
  if (!serviceName) {
191
192
  const { shortName } = yield (0, utils_1.getPackageJsonName)(path_1.default.join(targetDir, 'package.json'));
@@ -200,7 +201,7 @@ let CloudFunctionDownloadCommand = class CloudFunctionDownloadCommand extends co
200
201
  {
201
202
  type: 'confirm',
202
203
  name: 'confirm',
203
- message: `下载将覆盖 ${targetDir} 目录下的代码,是否继续?`,
204
+ message: (0, i18n_1.t)('下载将覆盖 {{targetDir}} 目录下的代码,是否继续?', { targetDir }),
204
205
  default: true
205
206
  }
206
207
  ]);
@@ -256,22 +257,19 @@ let CloudFunctionRunCommand = class CloudFunctionRunCommand extends common_1.Com
256
257
  options: [
257
258
  {
258
259
  flags: '--source <source>',
259
- desc: `目标函数文件所在目录路径,默认为当前路径
260
- `
260
+ desc: (0, i18n_1.t)('目标函数文件所在目录路径,默认为当前路径')
261
261
  },
262
262
  {
263
263
  flags: '--port <port>',
264
- desc: `监听的端口,默认为 3000
265
- `
264
+ desc: (0, i18n_1.t)('监听的端口,默认为 3000')
266
265
  },
267
266
  {
268
267
  flags: '-w, --watch',
269
- desc: `是否启用热重启模式,如启用,将会在文件变更时自动重启服务,默认为 false
270
- `
268
+ desc: (0, i18n_1.t)('是否启用热重启模式,如启用,将会在文件变更时自动重启服务,默认为 false')
271
269
  }
272
270
  ],
273
271
  requiredEnvId: false,
274
- desc: '本地运行云函数代码'
272
+ desc: (0, i18n_1.t)('本地运行云函数代码')
275
273
  };
276
274
  }
277
275
  execute(logger, ctx, options) {
@@ -288,7 +286,7 @@ let CloudFunctionRunCommand = class CloudFunctionRunCommand extends common_1.Com
288
286
  if (watchFlag.some((flag) => args.includes(flag))) {
289
287
  const cmd = args.filter((arg) => !watchFlag.includes(arg)).join(' ');
290
288
  if (!nodemon) {
291
- throw new Error('缺少开发依赖 nodemon,独立发行版已不内置。请在本地开发环境中安装再使用该命令。');
289
+ throw new Error((0, i18n_1.t)('缺少开发依赖 nodemon,独立发行版已不内置。请在本地开发环境中安装再使用该命令。'));
292
290
  }
293
291
  nodemon({
294
292
  script: '',
@@ -316,7 +314,7 @@ let CloudFunctionRunCommand = class CloudFunctionRunCommand extends common_1.Com
316
314
  logger.info(`[nodemon ${e.type}] ${e.message}`);
317
315
  })
318
316
  .on('crash', () => {
319
- logger.error(`Server crashed.`);
317
+ logger.error('Server crashed.');
320
318
  process.exit(1);
321
319
  })
322
320
  .on('exit', (e) => {
@@ -353,7 +351,7 @@ function _inputServiceName(defaultVal = '') {
353
351
  {
354
352
  type: 'input',
355
353
  name: 'serviceName',
356
- message: '请输入服务名称',
354
+ message: (0, i18n_1.t)('请输入服务名称'),
357
355
  default: defaultVal,
358
356
  validate: (val) => {
359
357
  const isValid = !val.startsWith('lcap') &&
@@ -361,7 +359,7 @@ function _inputServiceName(defaultVal = '') {
361
359
  /^[A-Za-z][\w-_]{0,43}[A-Za-z0-9]$/.test(val);
362
360
  return isValid
363
361
  ? true
364
- : '支持大小写字母、数字、-和_,但必须以字母开头、以字母和数字结尾,不支持以lcap、lowcode开头,最长45个字符';
362
+ : (0, i18n_1.t)('支持大小写字母、数字、-和_,但必须以字母开头、以字母和数字结尾,不支持以lcap、lowcode开头,最长45个字符');
365
363
  }
366
364
  }
367
365
  ];