@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.
- package/bin/cloudbase.js +2 -1
- package/bin/tcb.js +35 -28
- package/lib/auth/login.js +21 -13
- package/lib/commands/account/login.js +43 -42
- package/lib/commands/account/logout.js +3 -2
- package/lib/commands/ai/index.js +13 -12
- package/lib/commands/cloudfunction/base.js +24 -26
- package/lib/commands/cloudrun/base.js +87 -96
- package/lib/commands/common.js +11 -10
- package/lib/commands/config/delete.js +72 -0
- package/lib/commands/config/get.js +69 -0
- package/lib/commands/config/index.js +21 -0
- package/lib/commands/config/interface.js +24 -0
- package/lib/commands/config/list.js +72 -0
- package/lib/commands/config/set.js +89 -0
- package/lib/commands/db/base.js +33 -32
- package/lib/commands/env/base.js +12 -11
- package/lib/commands/env/domain.js +24 -23
- package/lib/commands/env/login.js +31 -30
- package/lib/commands/fun/base.js +37 -36
- package/lib/commands/functions/alias/getRoute.js +5 -4
- package/lib/commands/functions/alias/setRoute.js +7 -6
- package/lib/commands/functions/code-download.js +15 -11
- package/lib/commands/functions/code-update.js +8 -7
- package/lib/commands/functions/concurrency/delete.js +5 -4
- package/lib/commands/functions/concurrency/list.js +6 -5
- package/lib/commands/functions/concurrency/set.js +5 -4
- package/lib/commands/functions/config-update.js +8 -7
- package/lib/commands/functions/copy.js +7 -6
- package/lib/commands/functions/delete.js +8 -7
- package/lib/commands/functions/deploy.js +35 -34
- package/lib/commands/functions/detail.js +32 -31
- package/lib/commands/functions/invoke.js +16 -15
- package/lib/commands/functions/layer/bind.js +26 -25
- package/lib/commands/functions/layer/common.js +2 -1
- package/lib/commands/functions/layer/create.js +7 -6
- package/lib/commands/functions/layer/delete.js +9 -8
- package/lib/commands/functions/layer/download.js +10 -9
- package/lib/commands/functions/layer/list.js +10 -9
- package/lib/commands/functions/layer/sort.js +9 -8
- package/lib/commands/functions/list.js +9 -8
- package/lib/commands/functions/log.js +28 -27
- package/lib/commands/functions/run.js +21 -20
- package/lib/commands/functions/trigger-create.js +9 -8
- package/lib/commands/functions/trigger-delete.js +10 -9
- package/lib/commands/functions/version/list.js +9 -8
- package/lib/commands/functions/version/publish.js +5 -4
- package/lib/commands/gateway/create.js +14 -13
- package/lib/commands/gateway/delete.js +10 -9
- package/lib/commands/gateway/domain.js +25 -24
- package/lib/commands/gateway/list.js +11 -10
- package/lib/commands/gateway/switch.js +22 -19
- package/lib/commands/helpers/init.js +38 -37
- package/lib/commands/helpers/new.js +7 -6
- package/lib/commands/helpers/open.js +7 -6
- package/lib/commands/hosting/hosting.js +45 -44
- package/lib/commands/index.js +1 -0
- package/lib/commands/pull/pull.js +12 -11
- package/lib/commands/run/delete.js +16 -15
- package/lib/commands/run/image/common.js +2 -1
- package/lib/commands/run/image/delete.js +10 -9
- package/lib/commands/run/image/download.js +8 -7
- package/lib/commands/run/image/list.js +11 -10
- package/lib/commands/run/image/upload.js +9 -8
- package/lib/commands/run/list.js +10 -9
- package/lib/commands/run/service/config.js +13 -12
- package/lib/commands/run/service/deploy.js +24 -23
- package/lib/commands/run/service/list.js +10 -9
- package/lib/commands/run/service/update.js +22 -21
- package/lib/commands/run/standalonegateway/common.js +2 -1
- package/lib/commands/run/standalonegateway/create.js +14 -13
- package/lib/commands/run/standalonegateway/destroy.js +9 -8
- package/lib/commands/run/standalonegateway/list.js +7 -6
- package/lib/commands/run/standalonegateway/package.js +7 -6
- package/lib/commands/run/standalonegateway/turn.js +10 -9
- package/lib/commands/run/version/common.js +2 -1
- package/lib/commands/run/version/create.js +41 -40
- package/lib/commands/run/version/delete.js +10 -9
- package/lib/commands/run/version/list.js +13 -12
- package/lib/commands/run/version/modify.js +13 -12
- package/lib/commands/run/version/update.js +57 -54
- package/lib/commands/runf/base.js +42 -40
- package/lib/commands/self-update.js +11 -10
- package/lib/commands/smart.js +5 -4
- package/lib/commands/storage/storage.js +61 -56
- package/lib/commands/third/thirdAttach.js +6 -5
- package/lib/commands/utils.js +8 -5
- package/lib/constant.js +18 -17
- package/lib/decorators/deprecate.js +2 -1
- package/lib/function/alias.js +3 -2
- package/lib/function/base.js +9 -8
- package/lib/function/concurrency.js +4 -3
- package/lib/function/create.js +5 -4
- package/lib/function/delete.js +2 -1
- package/lib/function/layer/attach.js +2 -1
- package/lib/function/layer/create.js +2 -1
- package/lib/function/layer/download.js +2 -1
- package/lib/function/trigger.js +6 -5
- package/lib/function/update.js +3 -2
- package/lib/function/version.js +3 -2
- package/lib/help.js +22 -20
- package/lib/hosting.js +18 -17
- package/lib/i18n/index.js +81 -0
- package/lib/run/service/common.js +14 -13
- package/lib/run/service/config.js +4 -3
- package/lib/run/service/deployPackage.js +6 -5
- package/lib/run/service/showLogs.js +3 -2
- package/lib/run/service/update.js +7 -6
- package/lib/run/standalonegateway/list.js +5 -1
- package/lib/storage.js +2 -1
- package/lib/utils/ai/banner.js +12 -11
- package/lib/utils/ai/claudeWindows.js +5 -3
- package/lib/utils/ai/config.js +3 -2
- package/lib/utils/ai/const.js +4 -3
- package/lib/utils/ai/env.js +3 -2
- package/lib/utils/ai/envLocalManager.js +6 -5
- package/lib/utils/ai/nodeVersion.js +5 -1
- package/lib/utils/ai/router.js +129 -106
- package/lib/utils/ai/setup.js +95 -91
- package/lib/utils/checkTcbrEnv.js +22 -21
- package/lib/utils/cli-table.js +2 -1
- package/lib/utils/commonParamsCheck.js +4 -3
- package/lib/utils/debug-logger.js +2 -1
- package/lib/utils/dts.js +4 -3
- package/lib/utils/env.js +23 -21
- package/lib/utils/fs/index.js +5 -4
- package/lib/utils/function-packer.js +3 -2
- package/lib/utils/index.js +1 -0
- package/lib/utils/mcp-config-modifier.js +18 -17
- package/lib/utils/net/cloud-api-request.js +2 -1
- package/lib/utils/net/credential.js +2 -1
- package/lib/utils/net/http-request.js +2 -1
- package/lib/utils/progress-bar.js +2 -1
- package/lib/utils/prompt/select.js +8 -6
- package/lib/utils/store/auth.js +3 -2
- package/lib/utils/store/config.js +49 -0
- package/lib/utils/store/db.js +5 -0
- package/lib/utils/store/index.js +1 -1
- package/lib/utils/tcbrApi/callTcbrApi.js +2 -1
- package/lib/utils/template-manager.js +37 -36
- package/lib/utils/template.js +10 -9
- package/lib/utils/tools/common.js +3 -2
- package/lib/utils/url.js +19 -0
- package/lib/utils/validator.js +12 -4
- package/locales/README.md +160 -0
- package/locales/i18next-scanner.config.js +206 -0
- package/locales/langs/en.json +1235 -0
- package/locales/langs/zh.json +1235 -0
- package/locales/mapping.json +1235 -0
- package/package.json +9 -2
- package/types/commands/config/delete.d.ts +13 -0
- package/types/commands/config/get.d.ts +13 -0
- package/types/commands/config/index.d.ts +5 -0
- package/types/commands/config/interface.d.ts +17 -0
- package/types/commands/config/list.d.ts +13 -0
- package/types/commands/config/set.d.ts +13 -0
- package/types/commands/index.d.ts +1 -0
- package/types/i18n/index.d.ts +3 -0
- package/types/utils/ai/const.d.ts +1 -1
- package/types/utils/index.d.ts +1 -0
- package/types/utils/store/config.d.ts +8 -0
- package/types/utils/store/db.d.ts +2 -0
- package/types/utils/store/index.d.ts +1 -1
- package/types/utils/url.d.ts +18 -0
package/lib/utils/ai/setup.js
CHANGED
|
@@ -42,6 +42,7 @@ const inquirer_1 = __importDefault(require("inquirer"));
|
|
|
42
42
|
const error_1 = require("../../error");
|
|
43
43
|
const utils_1 = require("../../commands/utils");
|
|
44
44
|
const constants_1 = require("../../commands/constants");
|
|
45
|
+
const i18n_1 = require("../../i18n");
|
|
45
46
|
const const_1 = require("./const");
|
|
46
47
|
const config_1 = require("./config");
|
|
47
48
|
const auth_1 = require("../../auth");
|
|
@@ -53,27 +54,27 @@ class AISetupWizard {
|
|
|
53
54
|
}
|
|
54
55
|
setUpDefault(log, agent) {
|
|
55
56
|
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
log.info('🤖 欢迎使用 CloudBase AI ToolKit CLI 配置向导');
|
|
57
|
+
log.info((0, i18n_1.t)('🤖 欢迎使用 CloudBase AI ToolKit CLI 配置向导'));
|
|
57
58
|
try {
|
|
58
59
|
this.showConfigInfo(log);
|
|
59
|
-
const defaultAgent = agent || (yield this.selectAgent('选择默认使用的 AI CLI 工具:', false));
|
|
60
|
+
const defaultAgent = agent || (yield this.selectAgent((0, i18n_1.t)('选择默认使用的 AI CLI 工具:'), false));
|
|
60
61
|
yield this.aiConfigManager.updateDefaultAgent(defaultAgent);
|
|
61
62
|
const currentAgent = defaultAgent;
|
|
62
63
|
yield this.configureAgent(currentAgent, log);
|
|
63
64
|
yield this.ensureGitignore();
|
|
64
|
-
log.info('✅ AI 配置完成!配置信息已保存到 .env.local 文件');
|
|
65
|
-
log.info('💡 提示:请确保 .env.local 文件已添加到 .gitignore 以保护敏感信息');
|
|
66
|
-
log.info('🚀 现在可以使用 tcb ai 命令了!');
|
|
65
|
+
log.info((0, i18n_1.t)('✅ AI 配置完成!配置信息已保存到 .env.local 文件'));
|
|
66
|
+
log.info((0, i18n_1.t)('💡 提示:请确保 .env.local 文件已添加到 .gitignore 以保护敏感信息'));
|
|
67
|
+
log.info((0, i18n_1.t)('🚀 现在可以使用 tcb ai 命令了!'));
|
|
67
68
|
return { defaultAgent };
|
|
68
69
|
}
|
|
69
70
|
catch (error) {
|
|
70
|
-
throw new error_1.CloudBaseError('配置向导执行失败', { original: error });
|
|
71
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('配置向导执行失败'), { original: error });
|
|
71
72
|
}
|
|
72
73
|
});
|
|
73
74
|
}
|
|
74
75
|
setUp(log) {
|
|
75
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
76
|
-
log.info('🤖 欢迎使用 CloudBase AI ToolKit CLI 配置向导');
|
|
77
|
+
log.info((0, i18n_1.t)('🤖 欢迎使用 CloudBase AI ToolKit CLI 配置向导'));
|
|
77
78
|
try {
|
|
78
79
|
this.showConfigInfo(log);
|
|
79
80
|
const currentAgent = yield this.selectCurrentAgent();
|
|
@@ -83,13 +84,13 @@ class AISetupWizard {
|
|
|
83
84
|
const defaultAgent = yield this.selectDefaultAgent(log);
|
|
84
85
|
yield this.aiConfigManager.updateDefaultAgent(defaultAgent);
|
|
85
86
|
yield this.ensureGitignore();
|
|
86
|
-
log.info('✅ AI 配置完成!配置信息已保存到 .env.local 文件');
|
|
87
|
-
log.info('💡 提示:请确保 .env.local 文件已添加到 .gitignore 以保护敏感信息');
|
|
88
|
-
log.info('🚀 现在可以使用 tcb ai 命令了!');
|
|
87
|
+
log.info((0, i18n_1.t)('✅ AI 配置完成!配置信息已保存到 .env.local 文件'));
|
|
88
|
+
log.info((0, i18n_1.t)('💡 提示:请确保 .env.local 文件已添加到 .gitignore 以保护敏感信息'));
|
|
89
|
+
log.info((0, i18n_1.t)('🚀 现在可以使用 tcb ai 命令了!'));
|
|
89
90
|
return { defaultAgent };
|
|
90
91
|
}
|
|
91
92
|
catch (error) {
|
|
92
|
-
throw new error_1.CloudBaseError('配置向导执行失败', { original: error });
|
|
93
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('配置向导执行失败'), { original: error });
|
|
93
94
|
}
|
|
94
95
|
});
|
|
95
96
|
}
|
|
@@ -97,15 +98,15 @@ class AISetupWizard {
|
|
|
97
98
|
return __awaiter(this, void 0, void 0, function* () {
|
|
98
99
|
let envId;
|
|
99
100
|
if (_envId) {
|
|
100
|
-
log.info(
|
|
101
|
+
log.info((0, i18n_1.t)('使用传入的 envId {{envId}}', { envId: _envId }));
|
|
101
102
|
envId = _envId;
|
|
102
103
|
}
|
|
103
104
|
else {
|
|
104
|
-
log.info('未传入 envId,从 cloudbaserc.json 中获取');
|
|
105
|
+
log.info((0, i18n_1.t)('未传入 envId,从 cloudbaserc.json 中获取'));
|
|
105
106
|
const parser = (0, config_1.createConfigParser)();
|
|
106
107
|
const configEnvId = yield parser.get('envId').catch(() => null);
|
|
107
108
|
if (!configEnvId || configEnvId === '{{env.ENV_ID}}') {
|
|
108
|
-
log.info('cloudbaserc.json 中无 envId 配置!');
|
|
109
|
+
log.info((0, i18n_1.t)('cloudbaserc.json 中无 envId 配置!'));
|
|
109
110
|
const { authSupevisor } = yield Promise.resolve().then(() => __importStar(require('../../utils/auth')));
|
|
110
111
|
let loginState = yield authSupevisor.getLoginState();
|
|
111
112
|
if (!loginState) {
|
|
@@ -113,7 +114,7 @@ class AISetupWizard {
|
|
|
113
114
|
loginState = yield authSupevisor.getLoginState();
|
|
114
115
|
}
|
|
115
116
|
envId = yield (0, utils_1.selectEnv)({ source: [constants_1.EnvSource.MINIAPP, constants_1.EnvSource.QCLOUD] });
|
|
116
|
-
log.info(
|
|
117
|
+
log.info((0, i18n_1.t)('已选择 envId: {{envId}}', { envId }));
|
|
117
118
|
if (!configEnvId) {
|
|
118
119
|
parser.update('envId', '{{env.ENV_ID}}');
|
|
119
120
|
}
|
|
@@ -121,19 +122,22 @@ class AISetupWizard {
|
|
|
121
122
|
}
|
|
122
123
|
else {
|
|
123
124
|
envId = configEnvId;
|
|
124
|
-
log.info(
|
|
125
|
+
log.info((0, i18n_1.t)('使用 cloudbaserc.json 中的 envId: {{envId}}', { envId: configEnvId }));
|
|
125
126
|
const { shouldUpdateEnvId } = yield inquirer_1.default.prompt([
|
|
126
127
|
{
|
|
127
128
|
type: 'confirm',
|
|
128
129
|
name: 'shouldUpdateEnvId',
|
|
129
|
-
message:
|
|
130
|
+
message: (0, i18n_1.t)('当前使用的 envId 为 {{envId}},是否需要更新? {{hint}}', {
|
|
131
|
+
envId: configEnvId,
|
|
132
|
+
hint: (0, const_1.getBooleanHint)(false)
|
|
133
|
+
}),
|
|
130
134
|
default: false
|
|
131
135
|
}
|
|
132
136
|
]);
|
|
133
137
|
if (shouldUpdateEnvId) {
|
|
134
138
|
yield (0, auth_1.checkLogin)();
|
|
135
139
|
envId = yield (0, utils_1.selectEnv)({ source: [constants_1.EnvSource.MINIAPP, constants_1.EnvSource.QCLOUD] });
|
|
136
|
-
log.info(
|
|
140
|
+
log.info((0, i18n_1.t)('已选择 envId: {{envId}}', { envId }));
|
|
137
141
|
yield this.aiConfigManager.updateEnvId(envId);
|
|
138
142
|
}
|
|
139
143
|
}
|
|
@@ -146,7 +150,7 @@ class AISetupWizard {
|
|
|
146
150
|
const config = yield this.aiConfigManager.loadConfig().catch(() => null);
|
|
147
151
|
const configuredAgents = (config === null || config === void 0 ? void 0 : config.agents) ? Object.keys(config.agents) : [];
|
|
148
152
|
if (configuredAgents.length === 0) {
|
|
149
|
-
const errorMsg = '没有已配置的 AI 工具,请先运行 tcb ai --setup 进行配置';
|
|
153
|
+
const errorMsg = (0, i18n_1.t)('没有已配置的 AI 工具,请先运行 tcb ai --setup 进行配置');
|
|
150
154
|
log.error(errorMsg);
|
|
151
155
|
process.exit(1);
|
|
152
156
|
}
|
|
@@ -154,7 +158,7 @@ class AISetupWizard {
|
|
|
154
158
|
const selectedAgent = configuredAgents[0];
|
|
155
159
|
const agentInfo = [const_1.CLAUDE, const_1.QWEN, const_1.CODEX, const_1.CURSOR, const_1.AIDER].find((a) => a.value === selectedAgent);
|
|
156
160
|
const agentName = (agentInfo === null || agentInfo === void 0 ? void 0 : agentInfo.name) || selectedAgent.toUpperCase();
|
|
157
|
-
log.info(
|
|
161
|
+
log.info((0, i18n_1.t)('🔧 自动选择已配置的唯一 AI 工具: {{agentName}}', { agentName }));
|
|
158
162
|
return selectedAgent;
|
|
159
163
|
}
|
|
160
164
|
const availableChoices = configuredAgents.map((agent) => {
|
|
@@ -165,7 +169,7 @@ class AISetupWizard {
|
|
|
165
169
|
{
|
|
166
170
|
type: 'list',
|
|
167
171
|
name: 'agent',
|
|
168
|
-
message:
|
|
172
|
+
message: (0, i18n_1.t)('选择默认使用的 AI CLI 工具: {{hint}}', { hint: const_1.LIST_HINT }),
|
|
169
173
|
choices: availableChoices,
|
|
170
174
|
default: configuredAgents[0]
|
|
171
175
|
}
|
|
@@ -175,16 +179,16 @@ class AISetupWizard {
|
|
|
175
179
|
}
|
|
176
180
|
selectCurrentAgent() {
|
|
177
181
|
return __awaiter(this, void 0, void 0, function* () {
|
|
178
|
-
return this.selectAgent('选择当前要配置的 AI CLI 工具:', true);
|
|
182
|
+
return this.selectAgent((0, i18n_1.t)('选择当前要配置的 AI CLI 工具:'), true);
|
|
179
183
|
});
|
|
180
184
|
}
|
|
181
185
|
showConfigInfo(log) {
|
|
182
186
|
log.info('');
|
|
183
|
-
log.info('📋 配置说明:');
|
|
184
|
-
log.info('• 本配置仅在 CloudBase AI CLI 中生效');
|
|
185
|
-
log.info('• 不会修改您系统中已安装的 AI 工具的原始配置');
|
|
186
|
-
log.info('• 配置文件将保存在当前项目目录下(.env.local 等)');
|
|
187
|
-
log.info('• 您可以随时通过 tcb ai --reset 重置配置');
|
|
187
|
+
log.info((0, i18n_1.t)('📋 配置说明:'));
|
|
188
|
+
log.info((0, i18n_1.t)('• 本配置仅在 CloudBase AI CLI 中生效'));
|
|
189
|
+
log.info((0, i18n_1.t)('• 不会修改您系统中已安装的 AI 工具的原始配置'));
|
|
190
|
+
log.info((0, i18n_1.t)('• 配置文件将保存在当前项目目录下(.env.local 等)'));
|
|
191
|
+
log.info((0, i18n_1.t)('• 您可以随时通过 tcb ai --reset 重置配置'));
|
|
188
192
|
log.info('');
|
|
189
193
|
}
|
|
190
194
|
selectAgent(message, includeNone = false) {
|
|
@@ -204,7 +208,7 @@ class AISetupWizard {
|
|
|
204
208
|
configureAgent(agent, log) {
|
|
205
209
|
return __awaiter(this, void 0, void 0, function* () {
|
|
206
210
|
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);
|
|
207
|
-
log.info(
|
|
211
|
+
log.info((0, i18n_1.t)('\n📝 配置 {{agentName}}:', { agentName: (agentInfo === null || agentInfo === void 0 ? void 0 : agentInfo.name) || agent.toUpperCase() }));
|
|
208
212
|
switch (agent) {
|
|
209
213
|
case const_1.CLAUDE.value:
|
|
210
214
|
return yield this.configureClaudeAgent(log);
|
|
@@ -219,25 +223,25 @@ class AISetupWizard {
|
|
|
219
223
|
case const_1.CODEBUDDY.value:
|
|
220
224
|
return yield this.configureCodebuddyAgent(log);
|
|
221
225
|
default:
|
|
222
|
-
throw new Error(
|
|
226
|
+
throw new Error((0, i18n_1.t)('不支持的 AI 工具: {{agent}}', { agent }));
|
|
223
227
|
}
|
|
224
228
|
});
|
|
225
229
|
}
|
|
226
230
|
configureClaudeAgent(log) {
|
|
227
231
|
return __awaiter(this, void 0, void 0, function* () {
|
|
228
|
-
log.info(
|
|
232
|
+
log.info((0, i18n_1.t)('配置说明可参考 {{link}}', { link: (0, output_1.genClickableLink)('https://docs.cloudbase.net/cli-v1/ai/claude') }));
|
|
229
233
|
const { configMethod } = yield inquirer_1.default.prompt([
|
|
230
234
|
{
|
|
231
235
|
type: 'list',
|
|
232
236
|
name: 'configMethod',
|
|
233
|
-
message:
|
|
237
|
+
message: (0, i18n_1.t)('选择配置方式: {{hint}}', { hint: const_1.LIST_HINT }),
|
|
234
238
|
choices: [
|
|
235
|
-
{ name: '使用 CloudBase 服务,一键登录,无需配置', value: 'cloudbase' },
|
|
239
|
+
{ name: (0, i18n_1.t)('使用 CloudBase 服务,一键登录,无需配置'), value: 'cloudbase' },
|
|
236
240
|
{
|
|
237
|
-
name: '自配置 API KEY 和 Base URL,需要支持 Anthropic 协议的大模型',
|
|
241
|
+
name: (0, i18n_1.t)('自配置 API KEY 和 Base URL,需要支持 Anthropic 协议的大模型'),
|
|
238
242
|
value: 'custom'
|
|
239
243
|
},
|
|
240
|
-
{ name: '暂不配置,使用 Claude Code 内置鉴权方式(如 OAuth)', value: 'none' }
|
|
244
|
+
{ name: (0, i18n_1.t)('暂不配置,使用 Claude Code 内置鉴权方式(如 OAuth)'), value: 'none' }
|
|
241
245
|
],
|
|
242
246
|
default: 'cloudbase'
|
|
243
247
|
}
|
|
@@ -253,14 +257,14 @@ class AISetupWizard {
|
|
|
253
257
|
{
|
|
254
258
|
type: 'list',
|
|
255
259
|
name: 'baseUrlChoice',
|
|
256
|
-
message:
|
|
260
|
+
message: (0, i18n_1.t)('选择 API Base URL: {{hint}}', { hint: const_1.LIST_HINT }),
|
|
257
261
|
choices: [
|
|
258
262
|
{
|
|
259
263
|
name: 'Kimi - https://api.moonshot.cn/anthropic',
|
|
260
264
|
value: 'https://api.moonshot.cn/anthropic'
|
|
261
265
|
},
|
|
262
266
|
{
|
|
263
|
-
name: '智谱 - https://open.bigmodel.cn/api/anthropic
|
|
267
|
+
name: `${(0, i18n_1.t)('智谱')} - https://open.bigmodel.cn/api/anthropic`,
|
|
264
268
|
value: 'https://open.bigmodel.cn/api/anthropic'
|
|
265
269
|
},
|
|
266
270
|
{
|
|
@@ -275,7 +279,7 @@ class AISetupWizard {
|
|
|
275
279
|
name: 'LongCat - https://api.longcat.chat/anthropic',
|
|
276
280
|
value: 'https://api.longcat.chat/anthropic'
|
|
277
281
|
},
|
|
278
|
-
{ name: '🛠️ 自定义 URL', value: 'custom' }
|
|
282
|
+
{ name: (0, i18n_1.t)('🛠️ 自定义 URL'), value: 'custom' }
|
|
279
283
|
],
|
|
280
284
|
default: 'https://api.moonshot.cn/anthropic'
|
|
281
285
|
}
|
|
@@ -286,8 +290,8 @@ class AISetupWizard {
|
|
|
286
290
|
{
|
|
287
291
|
type: 'input',
|
|
288
292
|
name: 'customUrl',
|
|
289
|
-
message: '请输入自定义 API Base URL:',
|
|
290
|
-
validate: (input) => input.trim().length > 0 || '请输入有效的 Base URL'
|
|
293
|
+
message: (0, i18n_1.t)('请输入自定义 API Base URL:'),
|
|
294
|
+
validate: (input) => input.trim().length > 0 || (0, i18n_1.t)('请输入有效的 Base URL')
|
|
291
295
|
}
|
|
292
296
|
]);
|
|
293
297
|
baseUrl = customUrl;
|
|
@@ -300,7 +304,7 @@ class AISetupWizard {
|
|
|
300
304
|
type: 'password',
|
|
301
305
|
name: 'apiKey',
|
|
302
306
|
message: 'Auth Token:',
|
|
303
|
-
validate: (input) => input.length > 0 || '请输入有效的 Auth Token'
|
|
307
|
+
validate: (input) => input.length > 0 || (0, i18n_1.t)('请输入有效的 Auth Token')
|
|
304
308
|
}
|
|
305
309
|
]);
|
|
306
310
|
let defaultModel;
|
|
@@ -326,9 +330,9 @@ class AISetupWizard {
|
|
|
326
330
|
{
|
|
327
331
|
type: 'input',
|
|
328
332
|
name: 'model',
|
|
329
|
-
message: '模型名称:',
|
|
333
|
+
message: (0, i18n_1.t)('模型名称:'),
|
|
330
334
|
default: defaultModel,
|
|
331
|
-
validate: (input) => input.trim().length > 0 || '请输入有效的模型名称'
|
|
335
|
+
validate: (input) => input.trim().length > 0 || (0, i18n_1.t)('请输入有效的模型名称')
|
|
332
336
|
}
|
|
333
337
|
]);
|
|
334
338
|
yield this.aiConfigManager.updateClaudeConfig('custom', {
|
|
@@ -344,16 +348,16 @@ class AISetupWizard {
|
|
|
344
348
|
}
|
|
345
349
|
configureQwenAgent(log) {
|
|
346
350
|
return __awaiter(this, void 0, void 0, function* () {
|
|
347
|
-
log.info(
|
|
351
|
+
log.info((0, i18n_1.t)('配置说明可参考 {{link}}', { link: (0, output_1.genClickableLink)('https://docs.cloudbase.net/cli-v1/ai/qwen') }));
|
|
348
352
|
const { configMethod } = yield inquirer_1.default.prompt([
|
|
349
353
|
{
|
|
350
354
|
type: 'list',
|
|
351
355
|
name: 'configMethod',
|
|
352
|
-
message:
|
|
356
|
+
message: (0, i18n_1.t)('选择配置方式: {{hint}}', { hint: const_1.LIST_HINT }),
|
|
353
357
|
choices: [
|
|
354
|
-
{ name: '使用 CloudBase 服务,一键登录,无需配置', value: 'cloudbase' },
|
|
355
|
-
{ name: '自配置 API KEY 和 Base URL', value: 'custom' },
|
|
356
|
-
{ name: '暂不配置,使用 Qwen Code 内置鉴权方式(如 OAuth)', value: 'none' }
|
|
358
|
+
{ name: (0, i18n_1.t)('使用 CloudBase 服务,一键登录,无需配置'), value: 'cloudbase' },
|
|
359
|
+
{ name: (0, i18n_1.t)('自配置 API KEY 和 Base URL'), value: 'custom' },
|
|
360
|
+
{ name: (0, i18n_1.t)('暂不配置,使用 Qwen Code 内置鉴权方式(如 OAuth)'), value: 'none' }
|
|
357
361
|
],
|
|
358
362
|
default: 'cloudbase'
|
|
359
363
|
}
|
|
@@ -371,19 +375,19 @@ class AISetupWizard {
|
|
|
371
375
|
{
|
|
372
376
|
type: 'input',
|
|
373
377
|
name: 'baseUrl',
|
|
374
|
-
message: 'API Base URL (留空使用默认):',
|
|
378
|
+
message: (0, i18n_1.t)('API Base URL (留空使用默认):'),
|
|
375
379
|
default: 'https://dashscope.aliyuncs.com/compatible-mode/v1'
|
|
376
380
|
},
|
|
377
381
|
{
|
|
378
382
|
type: 'password',
|
|
379
383
|
name: 'apiKey',
|
|
380
384
|
message: 'API Key:',
|
|
381
|
-
validate: (input) => input.length > 0 || '请输入有效的 API Key'
|
|
385
|
+
validate: (input) => input.length > 0 || (0, i18n_1.t)('请输入有效的 API Key')
|
|
382
386
|
},
|
|
383
387
|
{
|
|
384
388
|
type: 'input',
|
|
385
389
|
name: 'model',
|
|
386
|
-
message: '模型名称 (留空使用默认):',
|
|
390
|
+
message: (0, i18n_1.t)('模型名称 (留空使用默认):'),
|
|
387
391
|
default: 'qwen-turbo'
|
|
388
392
|
}
|
|
389
393
|
]);
|
|
@@ -396,16 +400,16 @@ class AISetupWizard {
|
|
|
396
400
|
}
|
|
397
401
|
configureCodexAgent(log) {
|
|
398
402
|
return __awaiter(this, void 0, void 0, function* () {
|
|
399
|
-
log.info(
|
|
403
|
+
log.info((0, i18n_1.t)('配置说明可参考 {{link}}', { link: (0, output_1.genClickableLink)('https://docs.cloudbase.net/cli-v1/ai/codex') }));
|
|
400
404
|
const { configMethod } = yield inquirer_1.default.prompt([
|
|
401
405
|
{
|
|
402
406
|
type: 'list',
|
|
403
407
|
name: 'configMethod',
|
|
404
|
-
message:
|
|
408
|
+
message: (0, i18n_1.t)('选择配置方式: {{hint}}', { hint: const_1.LIST_HINT }),
|
|
405
409
|
choices: [
|
|
406
|
-
{ name: '使用 CloudBase 服务,一键登录,无需配置', value: 'cloudbase' },
|
|
407
|
-
{ name: '自配置 API KEY 和 Base URL', value: 'custom' },
|
|
408
|
-
{ name: '暂不配置,使用 OpenAI Codex 内置鉴权方式(如 OAuth)', value: 'none' }
|
|
410
|
+
{ name: (0, i18n_1.t)('使用 CloudBase 服务,一键登录,无需配置'), value: 'cloudbase' },
|
|
411
|
+
{ name: (0, i18n_1.t)('自配置 API KEY 和 Base URL'), value: 'custom' },
|
|
412
|
+
{ name: (0, i18n_1.t)('暂不配置,使用 OpenAI Codex 内置鉴权方式(如 OAuth)'), value: 'none' }
|
|
409
413
|
],
|
|
410
414
|
default: 'cloudbase'
|
|
411
415
|
}
|
|
@@ -423,21 +427,21 @@ class AISetupWizard {
|
|
|
423
427
|
{
|
|
424
428
|
type: 'list',
|
|
425
429
|
name: 'baseUrlChoice',
|
|
426
|
-
message:
|
|
430
|
+
message: (0, i18n_1.t)('选择 API Base URL: {{hint}}', { hint: const_1.LIST_HINT }),
|
|
427
431
|
choices: [
|
|
428
432
|
{
|
|
429
433
|
name: 'Kimi - https://api.moonshot.cn/v1',
|
|
430
434
|
value: 'https://api.moonshot.cn/v1'
|
|
431
435
|
},
|
|
432
436
|
{
|
|
433
|
-
name: '智谱 - https://open.bigmodel.cn/api/paas/v4
|
|
437
|
+
name: `${(0, i18n_1.t)('智谱')} - https://open.bigmodel.cn/api/paas/v4`,
|
|
434
438
|
value: 'https://open.bigmodel.cn/api/paas/v4'
|
|
435
439
|
},
|
|
436
440
|
{
|
|
437
441
|
name: 'LongCat - https://api.longcat.chat/openai',
|
|
438
442
|
value: 'https://api.longcat.chat/openai'
|
|
439
443
|
},
|
|
440
|
-
{ name: '🛠️ 自定义 URL', value: 'custom' }
|
|
444
|
+
{ name: (0, i18n_1.t)('🛠️ 自定义 URL'), value: 'custom' }
|
|
441
445
|
],
|
|
442
446
|
default: 'https://api.moonshot.cn/v1'
|
|
443
447
|
}
|
|
@@ -448,8 +452,8 @@ class AISetupWizard {
|
|
|
448
452
|
{
|
|
449
453
|
type: 'input',
|
|
450
454
|
name: 'customUrl',
|
|
451
|
-
message: '请输入自定义 API Base URL:',
|
|
452
|
-
validate: (input) => input.trim().length > 0 || '请输入有效的 Base URL'
|
|
455
|
+
message: (0, i18n_1.t)('请输入自定义 API Base URL:'),
|
|
456
|
+
validate: (input) => input.trim().length > 0 || (0, i18n_1.t)('请输入有效的 Base URL')
|
|
453
457
|
}
|
|
454
458
|
]);
|
|
455
459
|
baseUrl = customUrl;
|
|
@@ -461,13 +465,13 @@ class AISetupWizard {
|
|
|
461
465
|
{
|
|
462
466
|
type: 'password',
|
|
463
467
|
name: 'apiKey',
|
|
464
|
-
message: 'API Key:',
|
|
465
|
-
validate: (input) => input.length > 0 || '请输入有效的 API Key'
|
|
468
|
+
message: (0, i18n_1.t)('API Key:'),
|
|
469
|
+
validate: (input) => input.length > 0 || (0, i18n_1.t)('请输入有效的 API Key')
|
|
466
470
|
},
|
|
467
471
|
{
|
|
468
472
|
type: 'input',
|
|
469
473
|
name: 'model',
|
|
470
|
-
message: '模型名称 (留空使用默认):',
|
|
474
|
+
message: (0, i18n_1.t)('模型名称 (留空使用默认):'),
|
|
471
475
|
default: (0, const_1.getDefaultModelByBaseUrl)(baseUrl)
|
|
472
476
|
}
|
|
473
477
|
]);
|
|
@@ -480,15 +484,15 @@ class AISetupWizard {
|
|
|
480
484
|
}
|
|
481
485
|
configureAiderAgent(log) {
|
|
482
486
|
return __awaiter(this, void 0, void 0, function* () {
|
|
483
|
-
log.info(
|
|
487
|
+
log.info((0, i18n_1.t)('配置说明可参考 {{link}}', { link: (0, output_1.genClickableLink)('https://docs.cloudbase.net/cli-v1/ai/aider') }));
|
|
484
488
|
const { configMethod } = yield inquirer_1.default.prompt([
|
|
485
489
|
{
|
|
486
490
|
type: 'list',
|
|
487
491
|
name: 'configMethod',
|
|
488
|
-
message:
|
|
492
|
+
message: (0, i18n_1.t)('选择配置方式: {{hint}}', { hint: const_1.LIST_HINT }),
|
|
489
493
|
choices: [
|
|
490
|
-
{ name: '使用 CloudBase 服务,一键登录,无需配置', value: 'cloudbase' },
|
|
491
|
-
{ name: '自配置 API KEY 和 Base URL', value: 'custom' }
|
|
494
|
+
{ name: (0, i18n_1.t)('使用 CloudBase 服务,一键登录,无需配置'), value: 'cloudbase' },
|
|
495
|
+
{ name: (0, i18n_1.t)('自配置 API KEY 和 Base URL'), value: 'custom' }
|
|
492
496
|
],
|
|
493
497
|
default: 'cloudbase'
|
|
494
498
|
}
|
|
@@ -506,21 +510,21 @@ class AISetupWizard {
|
|
|
506
510
|
{
|
|
507
511
|
type: 'list',
|
|
508
512
|
name: 'baseUrlChoice',
|
|
509
|
-
message:
|
|
513
|
+
message: (0, i18n_1.t)('选择 API Base URL: {{hint}}', { hint: const_1.LIST_HINT }),
|
|
510
514
|
choices: [
|
|
511
515
|
{
|
|
512
516
|
name: 'Kimi - https://api.moonshot.cn/v1',
|
|
513
517
|
value: 'https://api.moonshot.cn/v1'
|
|
514
518
|
},
|
|
515
519
|
{
|
|
516
|
-
name: '智谱 - https://open.bigmodel.cn/api/paas/v4
|
|
520
|
+
name: `${(0, i18n_1.t)('智谱')} - https://open.bigmodel.cn/api/paas/v4`,
|
|
517
521
|
value: 'https://open.bigmodel.cn/api/paas/v4'
|
|
518
522
|
},
|
|
519
523
|
{
|
|
520
524
|
name: 'LongCat - https://api.longcat.chat/openai',
|
|
521
525
|
value: 'https://api.longcat.chat/openai'
|
|
522
526
|
},
|
|
523
|
-
{ name: '🛠️ 自定义 URL', value: 'custom' }
|
|
527
|
+
{ name: (0, i18n_1.t)('🛠️ 自定义 URL'), value: 'custom' }
|
|
524
528
|
],
|
|
525
529
|
default: 'https://api.moonshot.cn/v1'
|
|
526
530
|
}
|
|
@@ -531,8 +535,8 @@ class AISetupWizard {
|
|
|
531
535
|
{
|
|
532
536
|
type: 'input',
|
|
533
537
|
name: 'customUrl',
|
|
534
|
-
message: '请输入自定义 API Base URL:',
|
|
535
|
-
validate: (input) => input.trim().length > 0 || '请输入有效的 Base URL'
|
|
538
|
+
message: (0, i18n_1.t)('请输入自定义 API Base URL:'),
|
|
539
|
+
validate: (input) => input.trim().length > 0 || (0, i18n_1.t)('请输入有效的 Base URL')
|
|
536
540
|
}
|
|
537
541
|
]);
|
|
538
542
|
baseUrl = customUrl;
|
|
@@ -545,14 +549,14 @@ class AISetupWizard {
|
|
|
545
549
|
type: 'password',
|
|
546
550
|
name: 'apiKey',
|
|
547
551
|
message: 'API Key:',
|
|
548
|
-
validate: (input) => input.length > 0 || '请输入有效的 API Key'
|
|
552
|
+
validate: (input) => input.length > 0 || (0, i18n_1.t)('请输入有效的 API Key')
|
|
549
553
|
},
|
|
550
554
|
{
|
|
551
555
|
type: 'input',
|
|
552
556
|
name: 'model',
|
|
553
|
-
message: '模型名称:',
|
|
557
|
+
message: (0, i18n_1.t)('模型名称:'),
|
|
554
558
|
default: (0, const_1.getDefaultModelByBaseUrl)(baseUrl),
|
|
555
|
-
validate: (input) => input.length > 0 || '请输入有效的模型名称'
|
|
559
|
+
validate: (input) => input.length > 0 || (0, i18n_1.t)('请输入有效的模型名称')
|
|
556
560
|
}
|
|
557
561
|
]);
|
|
558
562
|
yield this.aiConfigManager.updateAiderConfig('custom', { baseUrl, apiKey, model });
|
|
@@ -561,7 +565,7 @@ class AISetupWizard {
|
|
|
561
565
|
}
|
|
562
566
|
configureCursorAgent(log) {
|
|
563
567
|
return __awaiter(this, void 0, void 0, function* () {
|
|
564
|
-
log.info(
|
|
568
|
+
log.info((0, i18n_1.t)('配置说明可参考 {{link}}', { link: (0, output_1.genClickableLink)('https://docs.cloudbase.net/cli-v1/ai/cursor') }));
|
|
565
569
|
yield this.aiConfigManager.updateCursorConfig('none');
|
|
566
570
|
});
|
|
567
571
|
}
|
|
@@ -598,7 +602,7 @@ class AISetupWizard {
|
|
|
598
602
|
{
|
|
599
603
|
type: 'list',
|
|
600
604
|
name: 'selectedProvider',
|
|
601
|
-
message:
|
|
605
|
+
message: (0, i18n_1.t)('选择大模型供应商: {{hint}}', { hint: const_1.LIST_HINT }),
|
|
602
606
|
choices: const_1.CLOUDBASE_PROVIDERS.map((p) => ({ name: p.name, value: p.value })),
|
|
603
607
|
default: 'kimi-exp'
|
|
604
608
|
}
|
|
@@ -608,14 +612,14 @@ class AISetupWizard {
|
|
|
608
612
|
{
|
|
609
613
|
type: 'input',
|
|
610
614
|
name: 'provider',
|
|
611
|
-
message: '请输入自定义供应商名称:',
|
|
612
|
-
validate: (input) => input.trim().length > 0 || '供应商名称不能为空'
|
|
615
|
+
message: (0, i18n_1.t)('请输入自定义供应商名称:'),
|
|
616
|
+
validate: (input) => input.trim().length > 0 || (0, i18n_1.t)('供应商名称不能为空')
|
|
613
617
|
},
|
|
614
618
|
{
|
|
615
619
|
type: 'input',
|
|
616
620
|
name: 'model',
|
|
617
|
-
message: '请输入模型名称:',
|
|
618
|
-
validate: (input) => input.trim().length > 0 || '模型名称不能为空'
|
|
621
|
+
message: (0, i18n_1.t)('请输入模型名称:'),
|
|
622
|
+
validate: (input) => input.trim().length > 0 || (0, i18n_1.t)('模型名称不能为空')
|
|
619
623
|
}
|
|
620
624
|
]);
|
|
621
625
|
return { provider, model, isCustom: true, transformer: undefined };
|
|
@@ -629,7 +633,7 @@ class AISetupWizard {
|
|
|
629
633
|
{
|
|
630
634
|
type: 'list',
|
|
631
635
|
name: 'selectedModel',
|
|
632
|
-
message:
|
|
636
|
+
message: (0, i18n_1.t)('选择模型: {{hint}}', { hint: const_1.LIST_HINT }),
|
|
633
637
|
choices: modelChoices,
|
|
634
638
|
default: selectedConfig.models[0]
|
|
635
639
|
}
|
|
@@ -640,8 +644,8 @@ class AISetupWizard {
|
|
|
640
644
|
{
|
|
641
645
|
type: 'input',
|
|
642
646
|
name: 'customModel',
|
|
643
|
-
message: '请输入自定义模型名称:',
|
|
644
|
-
validate: (input) => input.trim().length > 0 || '模型名称不能为空'
|
|
647
|
+
message: (0, i18n_1.t)('请输入自定义模型名称:'),
|
|
648
|
+
validate: (input) => input.trim().length > 0 || (0, i18n_1.t)('模型名称不能为空')
|
|
645
649
|
}
|
|
646
650
|
]);
|
|
647
651
|
model = customModel;
|
|
@@ -660,19 +664,19 @@ class AISetupWizard {
|
|
|
660
664
|
}
|
|
661
665
|
configureCodebuddyAgent(log) {
|
|
662
666
|
return __awaiter(this, void 0, void 0, function* () {
|
|
663
|
-
log.info(
|
|
667
|
+
log.info((0, i18n_1.t)('配置说明可参考 {{link}}', { link: (0, output_1.genClickableLink)('https://cnb.cool/codebuddy/codebuddy-code/-/blob/main/docs/cli-reference.md') }));
|
|
664
668
|
const { configMethod } = yield inquirer_1.default.prompt([
|
|
665
669
|
{
|
|
666
670
|
type: 'list',
|
|
667
671
|
name: 'configMethod',
|
|
668
|
-
message:
|
|
672
|
+
message: (0, i18n_1.t)('选择配置方式: {{hint}}', { hint: const_1.LIST_HINT }),
|
|
669
673
|
choices: [
|
|
670
674
|
{
|
|
671
|
-
name: '使用 CodeBuddy 账号登录',
|
|
675
|
+
name: (0, i18n_1.t)('使用 CodeBuddy 账号登录'),
|
|
672
676
|
value: 'none'
|
|
673
677
|
},
|
|
674
678
|
{
|
|
675
|
-
name: '配置 CodeBuddy API KEY(用于无交互环境)',
|
|
679
|
+
name: (0, i18n_1.t)('配置 CodeBuddy API KEY(用于无交互环境)'),
|
|
676
680
|
value: 'custom'
|
|
677
681
|
}
|
|
678
682
|
],
|
|
@@ -685,7 +689,7 @@ class AISetupWizard {
|
|
|
685
689
|
type: 'password',
|
|
686
690
|
name: 'apiKey',
|
|
687
691
|
message: 'API Key:',
|
|
688
|
-
validate: (input) => input.trim().length > 0 || '请输入有效的 API Key'
|
|
692
|
+
validate: (input) => input.trim().length > 0 || (0, i18n_1.t)('请输入有效的 API Key')
|
|
689
693
|
}
|
|
690
694
|
]);
|
|
691
695
|
yield this.aiConfigManager.updateCodebuddyConfig('custom', {
|
|
@@ -695,8 +699,8 @@ class AISetupWizard {
|
|
|
695
699
|
else {
|
|
696
700
|
yield this.aiConfigManager.updateCodebuddyConfig('none', {});
|
|
697
701
|
}
|
|
698
|
-
log.info('✅ CodeBuddy Code 配置完成');
|
|
699
|
-
log.info('💡 提示:首次使用时会自动打开浏览器进行 OAuth 身份验证');
|
|
702
|
+
log.info((0, i18n_1.t)('✅ CodeBuddy Code 配置完成'));
|
|
703
|
+
log.info((0, i18n_1.t)('💡 提示:首次使用时会自动打开浏览器进行 OAuth 身份验证'));
|
|
700
704
|
});
|
|
701
705
|
}
|
|
702
706
|
}
|
|
@@ -16,33 +16,34 @@ exports.logEnvCheck = exports.checkTcbrEnv = void 0;
|
|
|
16
16
|
const chalk_1 = __importDefault(require("chalk"));
|
|
17
17
|
const error_1 = require("../error");
|
|
18
18
|
const tcbrApi_1 = require("./tcbrApi");
|
|
19
|
+
const i18n_1 = require("../i18n");
|
|
19
20
|
const oldCmdSet = `
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
21
|
+
${(0, i18n_1.t)('服务列表')}:tcb run:deprecated list --envId <envId>
|
|
22
|
+
${(0, i18n_1.t)('创建服务')}:tcb run:deprecated create --envId <envId> --name <name>
|
|
23
|
+
${(0, i18n_1.t)('删除服务')}:tcb run:deprecated delete --envId <envId> --serviceName <serviceName>
|
|
23
24
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
25
|
+
${(0, i18n_1.t)('版本列表')}:tcb run:deprecated version list --envId <envId> --serviceName <serviceName>
|
|
26
|
+
${(0, i18n_1.t)('创建版本')}:tcb run:deprecated version create --envId <envId> --serviceName <serviceName>
|
|
27
|
+
${(0, i18n_1.t)('分配流量')}:tcb run:deprecated version modify --envId <envId> --serviceName <serviceName>
|
|
28
|
+
${(0, i18n_1.t)('滚动更新')}:tcb run:deprecated version update --envId <envId> --serviceName <serviceName> --versionName <versionName>
|
|
29
|
+
${(0, i18n_1.t)('删除版本')}:tcb run:deprecated version delete --envId <envId> --serviceName <serviceName> --versionName <versionName>
|
|
29
30
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
${(0, i18n_1.t)('查看镜像')}:tcb run:deprecated image list --envId <envId> --serviceName <serviceName>
|
|
32
|
+
${(0, i18n_1.t)('上传镜像')}:tcb run:deprecated image upload --envId <envId> --serviceName <serviceName> --imageId <imageId> --imageTag <imageTag>
|
|
33
|
+
${(0, i18n_1.t)('下载镜像')}:tcb run:deprecated image download --envId <envId> --serviceName <serviceName> --imageTag <imageTag>
|
|
34
|
+
${(0, i18n_1.t)('删除镜像')}:tcb run:deprecated image delete --envId <envId> --serviceName <serviceName> --imageTag <imageTag>
|
|
34
35
|
`;
|
|
35
36
|
const newCmdSet = `
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
${(0, i18n_1.t)('查看环境下服务')}:tcb run service:list --envId <envId>
|
|
38
|
+
${(0, i18n_1.t)('创建云托管服务')}:tcb run service:create --envId <envId> --serviceName <serviceName> --containerPort <containerPort>
|
|
39
|
+
${(0, i18n_1.t)('更新云托管服务')}:tcb run service:update --envId <envId> --serviceName <serviceName> --containerPort <containerPort>
|
|
40
|
+
${(0, i18n_1.t)('部署云托管服务')}:tcb run deploy --envId <envId> --serviceName <serviceName> --containerPort <containerPort>
|
|
41
|
+
${(0, i18n_1.t)('更新服务基础配置')}:tcb run service:config --envId <envId> --serviceName <serviceName>
|
|
41
42
|
`;
|
|
42
43
|
function checkTcbrEnv(envId, isTcbr) {
|
|
43
44
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
45
|
if (envId === undefined) {
|
|
45
|
-
throw new error_1.CloudBaseError('请使用 -e 或 --envId 指定环境 ID');
|
|
46
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('请使用 -e 或 --envId 指定环境 ID'));
|
|
46
47
|
}
|
|
47
48
|
const { data: res } = yield (0, tcbrApi_1.callTcbrApi)('DescribeCloudRunEnvs', {
|
|
48
49
|
EnvId: envId
|
|
@@ -50,7 +51,7 @@ function checkTcbrEnv(envId, isTcbr) {
|
|
|
50
51
|
const { EnvList } = res;
|
|
51
52
|
const envInfo = EnvList === null || EnvList === void 0 ? void 0 : EnvList.find((item) => (item === null || item === void 0 ? void 0 : item.EnvId) === envId);
|
|
52
53
|
if (envInfo === undefined) {
|
|
53
|
-
throw new error_1.CloudBaseError(
|
|
54
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('无法读取到有效的环境信息,请检查环境 ID 是否正确\nrequestId: {{requestId}}', { requestId: res === null || res === void 0 ? void 0 : res.RequestId }));
|
|
54
55
|
}
|
|
55
56
|
if ((envInfo.EnvType === 'tcbr' && isTcbr) || (envInfo.EnvType !== 'tcbr' && !isTcbr)) {
|
|
56
57
|
return 0;
|
|
@@ -66,10 +67,10 @@ function checkTcbrEnv(envId, isTcbr) {
|
|
|
66
67
|
exports.checkTcbrEnv = checkTcbrEnv;
|
|
67
68
|
function logEnvCheck(envId, warningType) {
|
|
68
69
|
if (warningType === 1) {
|
|
69
|
-
throw new error_1.CloudBaseError(
|
|
70
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('当前能力不支持 {{envId}} 环境,请使用如下操作集:{{cmdSet}}', { envId, cmdSet: chalk_1.default.grey(newCmdSet) }));
|
|
70
71
|
}
|
|
71
72
|
else if (warningType === 2) {
|
|
72
|
-
throw new error_1.CloudBaseError(
|
|
73
|
+
throw new error_1.CloudBaseError((0, i18n_1.t)('当前能力不支持 {{envId}} 环境,请使用如下操作集:{{cmdSet}}', { envId, cmdSet: chalk_1.default.grey(oldCmdSet) }));
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
76
|
exports.logEnvCheck = logEnvCheck;
|