@cloudbase/cli 2.8.25 → 2.8.26
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/.env.local +1 -1
- package/dist/standalone/cli.js +65 -24
- package/lib/utils/ai/setup.js +7 -0
- package/package.json +5 -3
package/.env.local
CHANGED
package/dist/standalone/cli.js
CHANGED
|
@@ -19429,6 +19429,9 @@ class AIConfigManager {
|
|
|
19429
19429
|
if (config.apiKey) {
|
|
19430
19430
|
yield this.updateConfig('ai.agents.claude.apiKey', config.apiKey, 'AI_CLAUDE_API_KEY');
|
|
19431
19431
|
}
|
|
19432
|
+
if (config.model) {
|
|
19433
|
+
yield this.updateConfig('ai.agents.claude.model', config.model, 'ANTHROPIC_MODEL');
|
|
19434
|
+
}
|
|
19432
19435
|
}
|
|
19433
19436
|
else if (type === 'cloudbase') {
|
|
19434
19437
|
if (config.provider) {
|
|
@@ -19573,7 +19576,8 @@ exports.CLAUDE = {
|
|
|
19573
19576
|
v3_1.default.object({
|
|
19574
19577
|
type: v3_1.default.literal('custom'),
|
|
19575
19578
|
baseUrl: v3_1.default.string(),
|
|
19576
|
-
apiKey: v3_1.default.string()
|
|
19579
|
+
apiKey: v3_1.default.string(),
|
|
19580
|
+
model: v3_1.default.string()
|
|
19577
19581
|
}),
|
|
19578
19582
|
v3_1.default.object({
|
|
19579
19583
|
type: v3_1.default.literal('cloudbase'),
|
|
@@ -19758,18 +19762,25 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
|
19758
19762
|
exports.ensureValidEnv = void 0;
|
|
19759
19763
|
const env_1 = __webpack_require__(90337);
|
|
19760
19764
|
const constants_1 = __webpack_require__(34409);
|
|
19761
|
-
|
|
19765
|
+
const utils_1 = __webpack_require__(75213);
|
|
19766
|
+
const config_1 = __webpack_require__(96614);
|
|
19767
|
+
function ensureValidEnv(_envId, log) {
|
|
19762
19768
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19763
19769
|
const envs = yield (0, env_1.listEnvs)({ source: [constants_1.EnvSource.MINIAPP, constants_1.EnvSource.QCLOUD] });
|
|
19764
|
-
const validEnv = envs.find((env) => env.EnvId ===
|
|
19770
|
+
const validEnv = envs.find((env) => env.EnvId === _envId);
|
|
19765
19771
|
if (!validEnv) {
|
|
19766
|
-
log.error(`❌ 环境 ${
|
|
19767
|
-
|
|
19772
|
+
log.error(`❌ 环境 ${_envId} 与当前账号不匹配,请重新选择`);
|
|
19773
|
+
const envId = yield (0, utils_1.selectEnv)({ source: [constants_1.EnvSource.MINIAPP, constants_1.EnvSource.QCLOUD] });
|
|
19774
|
+
new config_1.AIConfigManager().updateEnvId(envId);
|
|
19775
|
+
return envId;
|
|
19768
19776
|
}
|
|
19769
19777
|
if (validEnv.Status !== constants_1.EnvStatus.NORMAL) {
|
|
19770
|
-
log.error(`❌ 环境 ${
|
|
19771
|
-
|
|
19778
|
+
log.error(`❌ 环境 ${_envId} 不可用,请重新选择`);
|
|
19779
|
+
const envId = yield (0, utils_1.selectEnv)({ source: [constants_1.EnvSource.MINIAPP, constants_1.EnvSource.QCLOUD] });
|
|
19780
|
+
new config_1.AIConfigManager().updateEnvId(envId);
|
|
19781
|
+
return envId;
|
|
19772
19782
|
}
|
|
19783
|
+
return _envId;
|
|
19773
19784
|
});
|
|
19774
19785
|
}
|
|
19775
19786
|
exports.ensureValidEnv = ensureValidEnv;
|
|
@@ -20442,11 +20453,11 @@ class AICommandRouter {
|
|
|
20442
20453
|
}
|
|
20443
20454
|
});
|
|
20444
20455
|
}
|
|
20445
|
-
executeClaudeAgent({ apiKey, baseUrl }, additionalArgs, log) {
|
|
20456
|
+
executeClaudeAgent({ apiKey, baseUrl, model }, additionalArgs, log) {
|
|
20446
20457
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20447
20458
|
(0, nodeVersion_1.ensureNodeVersion)('v18.0.0', log);
|
|
20448
20459
|
yield this.ensureClaudeCode(log);
|
|
20449
|
-
yield this.executeCommand('claude', additionalArgs, Object.assign(Object.assign({}, process.env), { ANTHROPIC_AUTH_TOKEN: apiKey, ANTHROPIC_BASE_URL: baseUrl }), log);
|
|
20460
|
+
yield this.executeCommand('claude', additionalArgs, Object.assign(Object.assign({}, process.env), { ANTHROPIC_AUTH_TOKEN: apiKey, ANTHROPIC_BASE_URL: baseUrl, ANTHROPIC_MODEL: model }), log);
|
|
20450
20461
|
});
|
|
20451
20462
|
}
|
|
20452
20463
|
executeNoneClaudeAgent(additionalArgs, log) {
|
|
@@ -20472,10 +20483,10 @@ class AICommandRouter {
|
|
|
20472
20483
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20473
20484
|
(0, nodeVersion_1.ensureNodeVersion)('v20.0.0', log);
|
|
20474
20485
|
yield this.ensureQwenCode(log);
|
|
20475
|
-
const
|
|
20486
|
+
const _envId = yield (0, config_1.createConfigParser)().get('envId');
|
|
20476
20487
|
yield (0, auth_1.checkLogin)();
|
|
20477
20488
|
const credential = yield (0, utils_1.getCredential)({}, {});
|
|
20478
|
-
yield (0, env_1.ensureValidEnv)(
|
|
20489
|
+
const envId = yield (0, env_1.ensureValidEnv)(_envId, log);
|
|
20479
20490
|
const accessToken = yield (0, utils_1.rawFetchAccessToken)({
|
|
20480
20491
|
envId,
|
|
20481
20492
|
secretId: credential.secretId,
|
|
@@ -20552,10 +20563,10 @@ class AICommandRouter {
|
|
|
20552
20563
|
configureClaudeCodeRouter(provider, model, transformer, log) {
|
|
20553
20564
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20554
20565
|
const fs = yield Promise.resolve().then(() => __importStar(__webpack_require__(21605)));
|
|
20555
|
-
const
|
|
20566
|
+
const _envId = yield (0, config_1.createConfigParser)().get('envId');
|
|
20556
20567
|
yield (0, auth_1.checkLogin)();
|
|
20557
20568
|
const credential = yield (0, utils_1.getCredential)({}, {});
|
|
20558
|
-
yield (0, env_1.ensureValidEnv)(
|
|
20569
|
+
const envId = yield (0, env_1.ensureValidEnv)(_envId, log);
|
|
20559
20570
|
const accessToken = yield (0, utils_1.rawFetchAccessToken)({
|
|
20560
20571
|
envId,
|
|
20561
20572
|
secretId: credential.secretId,
|
|
@@ -20771,10 +20782,10 @@ class AICommandRouter {
|
|
|
20771
20782
|
executeCodexCloudbaseAgent({ provider, model }, additionalArgs, log) {
|
|
20772
20783
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20773
20784
|
yield this.ensureCodexCode(log);
|
|
20774
|
-
const
|
|
20785
|
+
const _envId = yield (0, config_1.createConfigParser)().get('envId');
|
|
20775
20786
|
yield (0, auth_1.checkLogin)();
|
|
20776
20787
|
const credential = yield (0, utils_1.getCredential)({}, {});
|
|
20777
|
-
yield (0, env_1.ensureValidEnv)(
|
|
20788
|
+
const envId = yield (0, env_1.ensureValidEnv)(_envId, log);
|
|
20778
20789
|
const accessToken = yield (0, utils_1.rawFetchAccessToken)({
|
|
20779
20790
|
envId,
|
|
20780
20791
|
secretId: credential.secretId,
|
|
@@ -20871,10 +20882,10 @@ class AICommandRouter {
|
|
|
20871
20882
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20872
20883
|
yield this.ensureAider(log);
|
|
20873
20884
|
const { provider, model } = config;
|
|
20874
|
-
const
|
|
20885
|
+
const _envId = yield (0, config_1.createConfigParser)().get('envId');
|
|
20875
20886
|
yield (0, auth_1.checkLogin)();
|
|
20876
20887
|
const credential = yield (0, utils_1.getCredential)({}, {});
|
|
20877
|
-
yield (0, env_1.ensureValidEnv)(
|
|
20888
|
+
const envId = yield (0, env_1.ensureValidEnv)(_envId, log);
|
|
20878
20889
|
const accessToken = yield (0, utils_1.rawFetchAccessToken)({
|
|
20879
20890
|
envId,
|
|
20880
20891
|
secretId: credential.secretId,
|
|
@@ -21367,7 +21378,10 @@ class AISetupWizard {
|
|
|
21367
21378
|
message: `选择配置方式: ${const_1.LIST_HINT}`,
|
|
21368
21379
|
choices: [
|
|
21369
21380
|
{ name: '使用 CloudBase 服务,一键登录,无需配置', value: 'cloudbase' },
|
|
21370
|
-
{
|
|
21381
|
+
{
|
|
21382
|
+
name: '自配置 API KEY 和 Base URL,需要支持 Anthropic 协议的大模型',
|
|
21383
|
+
value: 'custom'
|
|
21384
|
+
},
|
|
21371
21385
|
{ name: '暂不配置,使用 Claude Code 内置鉴权方式(如 OAuth)', value: 'none' }
|
|
21372
21386
|
],
|
|
21373
21387
|
default: 'cloudbase'
|
|
@@ -21418,15 +21432,41 @@ class AISetupWizard {
|
|
|
21418
21432
|
else {
|
|
21419
21433
|
baseUrl = baseUrlChoice;
|
|
21420
21434
|
}
|
|
21421
|
-
const {
|
|
21435
|
+
const { apiKey } = yield inquirer_1.default.prompt([
|
|
21422
21436
|
{
|
|
21423
21437
|
type: 'password',
|
|
21424
|
-
name: '
|
|
21438
|
+
name: 'apiKey',
|
|
21425
21439
|
message: 'Claude Auth Token:',
|
|
21426
21440
|
validate: (input) => input.length > 0 || '请输入有效的 Auth Token'
|
|
21427
21441
|
}
|
|
21428
21442
|
]);
|
|
21429
|
-
|
|
21443
|
+
let defaultModel;
|
|
21444
|
+
if (baseUrl === 'https://api.anthropic.com') {
|
|
21445
|
+
defaultModel = 'sonnet';
|
|
21446
|
+
}
|
|
21447
|
+
else if (baseUrl === 'https://api.moonshot.cn/anthropic') {
|
|
21448
|
+
defaultModel = 'kimi-k2-turbo-preview';
|
|
21449
|
+
}
|
|
21450
|
+
else if (baseUrl === 'https://open.bigmodel.cn/api/anthropic') {
|
|
21451
|
+
defaultModel = 'glm-4.5';
|
|
21452
|
+
}
|
|
21453
|
+
else {
|
|
21454
|
+
defaultModel = '';
|
|
21455
|
+
}
|
|
21456
|
+
const { model } = yield inquirer_1.default.prompt([
|
|
21457
|
+
{
|
|
21458
|
+
type: 'input',
|
|
21459
|
+
name: 'model',
|
|
21460
|
+
message: '模型名称:',
|
|
21461
|
+
default: defaultModel,
|
|
21462
|
+
validate: (input) => input.trim().length > 0 || '请输入有效的模型名称'
|
|
21463
|
+
}
|
|
21464
|
+
]);
|
|
21465
|
+
yield this.aiConfigManager.updateClaudeConfig('custom', {
|
|
21466
|
+
baseUrl,
|
|
21467
|
+
apiKey,
|
|
21468
|
+
model
|
|
21469
|
+
});
|
|
21430
21470
|
}
|
|
21431
21471
|
else {
|
|
21432
21472
|
yield this.aiConfigManager.updateClaudeConfig('none', {});
|
|
@@ -193445,7 +193485,7 @@ function resolveCredential(data) {
|
|
|
193445
193485
|
}
|
|
193446
193486
|
exports.resolveCredential = resolveCredential;
|
|
193447
193487
|
function resolveWebCredential(credential) {
|
|
193448
|
-
const { secretId, secretKey, token, accessTokenExpired, expired, authTime, refreshToken, uin, hash } = credential;
|
|
193488
|
+
const { secretId, secretKey, token, accessTokenExpired, expired, authTime, refreshToken, uin, hash, envId } = credential;
|
|
193449
193489
|
const webCredential = {
|
|
193450
193490
|
tmpSecretId: secretId,
|
|
193451
193491
|
tmpSecretKey: secretKey,
|
|
@@ -193455,7 +193495,8 @@ function resolveWebCredential(credential) {
|
|
|
193455
193495
|
authTime,
|
|
193456
193496
|
refreshToken,
|
|
193457
193497
|
uin,
|
|
193458
|
-
hash
|
|
193498
|
+
hash,
|
|
193499
|
+
envId
|
|
193459
193500
|
};
|
|
193460
193501
|
return webCredential;
|
|
193461
193502
|
}
|
|
@@ -617800,7 +617841,7 @@ module.exports = {"version":"3.13.1"};
|
|
|
617800
617841
|
/***/ ((module) => {
|
|
617801
617842
|
|
|
617802
617843
|
"use strict";
|
|
617803
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@cloudbase/cli","version":"2.8.
|
|
617844
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@cloudbase/cli","version":"2.8.25","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.35","@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.4.4","@cloudbase/toolbox":"^0.7.8","@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","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","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","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"}');
|
|
617804
617845
|
|
|
617805
617846
|
/***/ })
|
|
617806
617847
|
|
package/lib/utils/ai/setup.js
CHANGED
|
@@ -265,6 +265,10 @@ class AISetupWizard {
|
|
|
265
265
|
name: 'Anthropic - https://api.anthropic.com',
|
|
266
266
|
value: 'https://api.anthropic.com'
|
|
267
267
|
},
|
|
268
|
+
{
|
|
269
|
+
name: 'DeepSeek - https://api.deepseek.com/anthropic',
|
|
270
|
+
value: 'https://api.deepseek.com/anthropic'
|
|
271
|
+
},
|
|
268
272
|
{ name: '🛠️ 自定义 URL', value: 'custom' }
|
|
269
273
|
],
|
|
270
274
|
default: 'https://api.moonshot.cn/anthropic'
|
|
@@ -303,6 +307,9 @@ class AISetupWizard {
|
|
|
303
307
|
else if (baseUrl === 'https://open.bigmodel.cn/api/anthropic') {
|
|
304
308
|
defaultModel = 'glm-4.5';
|
|
305
309
|
}
|
|
310
|
+
else if (baseUrl === 'https://api.deepseek.com/anthropic') {
|
|
311
|
+
defaultModel = 'deepseek-chat';
|
|
312
|
+
}
|
|
306
313
|
else {
|
|
307
314
|
defaultModel = '';
|
|
308
315
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cloudbase/cli",
|
|
3
|
-
"version": "2.8.
|
|
3
|
+
"version": "2.8.26",
|
|
4
4
|
"description": "cli tool for cloudbase",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
"license": "ISC",
|
|
49
49
|
"dependencies": {
|
|
50
50
|
"@cloudbase/cloud-api": "^0.5.5",
|
|
51
|
-
"@cloudbase/cloudbase-mcp": "^1.8.
|
|
51
|
+
"@cloudbase/cloudbase-mcp": "^1.8.37",
|
|
52
52
|
"@cloudbase/framework-core": "^1.9.7",
|
|
53
53
|
"@cloudbase/functions-framework": "1.16.0",
|
|
54
54
|
"@cloudbase/iac-core": "0.0.3-alpha.11",
|
|
55
55
|
"@cloudbase/lowcode-cli": "^0.22.2",
|
|
56
56
|
"@cloudbase/manager-node": "4.4.4",
|
|
57
|
-
"@cloudbase/toolbox": "^0.7.
|
|
57
|
+
"@cloudbase/toolbox": "^0.7.9",
|
|
58
58
|
"@dotenvx/dotenvx": "^1.48.3",
|
|
59
59
|
"@musistudio/claude-code-router": "1.0.36",
|
|
60
60
|
"address": "^1.1.2",
|
|
@@ -70,6 +70,7 @@
|
|
|
70
70
|
"fs-extra": "^8.1.0",
|
|
71
71
|
"gradient-string": "^2.0.2",
|
|
72
72
|
"https-proxy-agent": "^5.0.1",
|
|
73
|
+
"i": "^0.3.7",
|
|
73
74
|
"inquirer": "^6.5.0",
|
|
74
75
|
"json-schema-to-typescript": "^14.0.5",
|
|
75
76
|
"lodash": "^4.17.21",
|
|
@@ -78,6 +79,7 @@
|
|
|
78
79
|
"make-dir": "^3.0.0",
|
|
79
80
|
"node-fetch": "^2.6.0",
|
|
80
81
|
"nodemon": "^3.1.4",
|
|
82
|
+
"npm": "^11.5.2",
|
|
81
83
|
"open": "^7.0.0",
|
|
82
84
|
"ora": "^4.0.2",
|
|
83
85
|
"patch-package": "^8.0.0",
|