@cloudbase/cli 2.8.28 → 2.9.1
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/tcb.js +2 -1
- package/cloudbaserc.json +12 -2
- package/dist/standalone/cli.js +154 -46
- package/lib/commands/account/login.js +2 -6
- package/lib/commands/ai/index.js +2 -2
- package/lib/commands/pull/pull.js +9 -5
- package/lib/help.js +5 -17
- package/lib/utils/ai/banner.js +6 -3
- package/lib/utils/ai/config.js +16 -2
- package/lib/utils/ai/const.js +15 -2
- package/lib/utils/ai/router.js +52 -1
- package/lib/utils/ai/setup.js +45 -2
- package/package.json +2 -2
- package/specs/codebuddy-integration/design.md +152 -0
- package/specs/codebuddy-integration/requirements.md +53 -0
- package/specs/codebuddy-integration/tasks.md +159 -0
- package/types/commands/pull/pull.d.ts +1 -1
- package/types/utils/ai/config.d.ts +7 -3
- package/types/utils/ai/const.d.ts +39 -0
- package/types/utils/ai/router.d.ts +3 -0
- package/types/utils/ai/setup.d.ts +1 -0
package/bin/tcb.js
CHANGED
|
@@ -58,6 +58,7 @@ async function main() {
|
|
|
58
58
|
|
|
59
59
|
// 输出版本信息
|
|
60
60
|
console.log(chalk.gray(`CloudBase CLI ${pkg.version}`))
|
|
61
|
+
console.log(chalk.gray('试试 tcb ai 命令,开启 AI 全栈开发体验'))
|
|
61
62
|
|
|
62
63
|
const yargsParsedResult = yargsParser(process.argv.slice(2))
|
|
63
64
|
const config = await getCloudBaseConfig(yargsParsedResult.configFile)
|
|
@@ -88,7 +89,7 @@ async function main() {
|
|
|
88
89
|
// -v 时输出的版本信息,设置时避免影响其他命令使用 -v
|
|
89
90
|
if (isCommandEmpty) {
|
|
90
91
|
program.version(
|
|
91
|
-
`\nCLI: ${pkg.version}
|
|
92
|
+
`\nCLI: ${pkg.version}`,
|
|
92
93
|
'-v, --version',
|
|
93
94
|
'输出当前 CloudBase CLI 版本'
|
|
94
95
|
)
|
package/cloudbaserc.json
CHANGED
package/dist/standalone/cli.js
CHANGED
|
@@ -65,6 +65,7 @@ async function main() {
|
|
|
65
65
|
|
|
66
66
|
// 输出版本信息
|
|
67
67
|
console.log(chalk.gray(`CloudBase CLI ${pkg.version}`))
|
|
68
|
+
console.log(chalk.gray('试试 tcb ai 命令,开启 AI 全栈开发体验'))
|
|
68
69
|
|
|
69
70
|
const yargsParsedResult = yargsParser(process.argv.slice(2))
|
|
70
71
|
const config = await getCloudBaseConfig(yargsParsedResult.configFile)
|
|
@@ -95,7 +96,7 @@ async function main() {
|
|
|
95
96
|
// -v 时输出的版本信息,设置时避免影响其他命令使用 -v
|
|
96
97
|
if (isCommandEmpty) {
|
|
97
98
|
program.version(
|
|
98
|
-
`\nCLI: ${pkg.version}
|
|
99
|
+
`\nCLI: ${pkg.version}`,
|
|
99
100
|
'-v, --version',
|
|
100
101
|
'输出当前 CloudBase CLI 版本'
|
|
101
102
|
)
|
|
@@ -618,13 +619,9 @@ const utils_1 = __webpack_require__(82079);
|
|
|
618
619
|
function printSuggestion() {
|
|
619
620
|
const tips = `可使用下面命令继续操作:
|
|
620
621
|
|
|
621
|
-
${chalk_1.default.gray('–')}
|
|
622
|
+
${chalk_1.default.gray('–')} 一键开启 AI 开发体验
|
|
622
623
|
|
|
623
|
-
${chalk_1.default.cyan('$ tcb
|
|
624
|
-
|
|
625
|
-
${chalk_1.default.gray('–')} 部署云函数
|
|
626
|
-
|
|
627
|
-
${chalk_1.default.cyan('$ tcb fn deploy')}
|
|
624
|
+
${chalk_1.default.cyan('$ tcb ai')}
|
|
628
625
|
|
|
629
626
|
${chalk_1.default.gray('–')} 查看命令使用介绍
|
|
630
627
|
|
|
@@ -946,7 +943,7 @@ let AICommand = class AICommand extends common_1.Command {
|
|
|
946
943
|
options: [
|
|
947
944
|
{
|
|
948
945
|
flags: '-a, --agent <agent>',
|
|
949
|
-
desc: 'AI CLI 工具 (claude, qwen, codex, aider)'
|
|
946
|
+
desc: 'AI CLI 工具 (claude, qwen, codex, aider, codebuddy)'
|
|
950
947
|
},
|
|
951
948
|
{
|
|
952
949
|
flags: '-e, --envId <envId>',
|
|
@@ -973,7 +970,7 @@ let AICommand = class AICommand extends common_1.Command {
|
|
|
973
970
|
desc: '指定模板类型 (miniprogram, react, vue, uniapp, rules)'
|
|
974
971
|
}
|
|
975
972
|
],
|
|
976
|
-
desc: 'CloudBase AI ToolKit CLI - 快速启动和配置主流 AI 编程工具\n\n示例:\n tcb ai -a claude -- --continue\n\n说明:-- 后的参数会直接传递给目标 AI CLI。',
|
|
973
|
+
desc: 'CloudBase AI ToolKit CLI - 快速启动和配置主流 AI 编程工具\n\n示例:\n tcb ai -a claude -- --continue\n tcb ai -a codebuddy -- mcp list\n\n说明:-- 后的参数会直接传递给目标 AI CLI。',
|
|
977
974
|
requiredEnvId: false,
|
|
978
975
|
withoutAuth: true,
|
|
979
976
|
allowUnknownOption: true
|
|
@@ -10983,6 +10980,7 @@ let PullCommand = class PullCommand extends common_1.Command {
|
|
|
10983
10980
|
get options() {
|
|
10984
10981
|
return {
|
|
10985
10982
|
cmd: 'pull',
|
|
10983
|
+
childCmd: '<source>',
|
|
10986
10984
|
options: [
|
|
10987
10985
|
{
|
|
10988
10986
|
flags: '-o, --output <output>',
|
|
@@ -10998,10 +10996,10 @@ let PullCommand = class PullCommand extends common_1.Command {
|
|
|
10998
10996
|
withoutAuth: true
|
|
10999
10997
|
};
|
|
11000
10998
|
}
|
|
11001
|
-
execute(options, log) {
|
|
10999
|
+
execute(options, params, log) {
|
|
11002
11000
|
return __awaiter(this, void 0, void 0, function* () {
|
|
11003
11001
|
const { output, force } = options;
|
|
11004
|
-
const source =
|
|
11002
|
+
const [source] = params || [];
|
|
11005
11003
|
if (!source || typeof source !== 'string') {
|
|
11006
11004
|
throw new error_1.CloudBaseError('请指定要拉取的模板来源');
|
|
11007
11005
|
}
|
|
@@ -11041,9 +11039,10 @@ let PullCommand = class PullCommand extends common_1.Command {
|
|
|
11041
11039
|
__decorate([
|
|
11042
11040
|
(0, decorators_1.InjectParams)(),
|
|
11043
11041
|
__param(0, (0, decorators_1.ArgsOptions)()),
|
|
11044
|
-
__param(1, (0, decorators_1.
|
|
11042
|
+
__param(1, (0, decorators_1.ArgsParams)()),
|
|
11043
|
+
__param(2, (0, decorators_1.Log)()),
|
|
11045
11044
|
__metadata("design:type", Function),
|
|
11046
|
-
__metadata("design:paramtypes", [Object, log_1.Logger]),
|
|
11045
|
+
__metadata("design:paramtypes", [Object, Array, log_1.Logger]),
|
|
11047
11046
|
__metadata("design:returntype", Promise)
|
|
11048
11047
|
], PullCommand.prototype, "execute", null);
|
|
11049
11048
|
PullCommand = __decorate([
|
|
@@ -17223,20 +17222,15 @@ const chalk_1 = __importDefault(__webpack_require__(15896));
|
|
|
17223
17222
|
const outputHelpInfo = () => {
|
|
17224
17223
|
const commands = `
|
|
17225
17224
|
命令
|
|
17226
|
-
|
|
17225
|
+
ai -- [cmd] 开启 AI 全栈开发体验
|
|
17227
17226
|
login [options] 登录腾讯云账号
|
|
17228
17227
|
logout 登出腾讯云账号
|
|
17229
17228
|
env [cmd] 环境管理操作
|
|
17230
17229
|
fn [cmd] 操作函数
|
|
17231
|
-
framework [cmd] 云开发 Serverless 应用框架操作
|
|
17232
17230
|
hosting [cmd] 静态托管资源管理操作
|
|
17233
|
-
new [appName] [template] 创建新的云开发应用
|
|
17234
|
-
open [link] 在浏览器中打开云开发相关连接
|
|
17235
17231
|
storage [cmd] 云存储资源管理操作
|
|
17236
17232
|
service [cmd] HTTP 访问服务管理操作
|
|
17237
|
-
|
|
17238
|
-
run [cmd] 云托管环境管理操作 (TCBR 类型环境)
|
|
17239
|
-
cloudrun [cmd] 云托管服务管理操作(新版云开发平台)`;
|
|
17233
|
+
cloudrun [cmd] 云托管服务管理操作`;
|
|
17240
17234
|
const options = `
|
|
17241
17235
|
选项
|
|
17242
17236
|
|
|
@@ -17253,17 +17247,10 @@ const outputHelpInfo = () => {
|
|
|
17253
17247
|
|
|
17254
17248
|
${chalk_1.default.cyan('$ tcb login')}
|
|
17255
17249
|
|
|
17256
|
-
${chalk_1.default.gray('–')}
|
|
17257
|
-
|
|
17258
|
-
${chalk_1.default.cyan('$ tcb new appName')}
|
|
17259
|
-
|
|
17260
|
-
${chalk_1.default.gray('–')} 部署云函数
|
|
17250
|
+
${chalk_1.default.gray('–')} 使用 AI 全栈开发部署
|
|
17261
17251
|
|
|
17262
|
-
${chalk_1.default.cyan('$ tcb
|
|
17263
|
-
|
|
17264
|
-
${chalk_1.default.gray('–')} 查看命令使用介绍
|
|
17265
|
-
|
|
17266
|
-
${chalk_1.default.cyan('$ tcb fn -h')}`;
|
|
17252
|
+
${chalk_1.default.cyan('$ tcb ai')}
|
|
17253
|
+
`;
|
|
17267
17254
|
console.log(commands, '\n', options, '\n', tips);
|
|
17268
17255
|
};
|
|
17269
17256
|
exports.outputHelpInfo = outputHelpInfo;
|
|
@@ -19349,12 +19336,12 @@ AI ToolKit`, {
|
|
|
19349
19336
|
log.log(' 🎯 无需运维,极速上线你的创意 💫');
|
|
19350
19337
|
}
|
|
19351
19338
|
log.log('');
|
|
19339
|
+
log.log('Github:');
|
|
19340
|
+
log.log((0, output_1.genClickableLink)('https://github.com/TencentCloudBase/CloudBase-AI-ToolKit'));
|
|
19341
|
+
log.log('');
|
|
19352
19342
|
log.log('使用指引');
|
|
19353
19343
|
log.log((0, output_1.genClickableLink)('https://docs.cloudbase.net/cli-v1/ai/introduce'));
|
|
19354
19344
|
log.log('');
|
|
19355
|
-
log.log('Beta 能力,如遇问题可创建 issue:');
|
|
19356
|
-
log.log((0, output_1.genClickableLink)('https://cnb.cool/tencent/cloud/cloudbase/community/-/issues'));
|
|
19357
|
-
log.log('');
|
|
19358
19345
|
}
|
|
19359
19346
|
catch (e) {
|
|
19360
19347
|
log.log(chalk_1.default.bold.cyanBright('⛰︎'), chalk_1.default.bold.hex('#FFFFFF')(' CloudBase AI ToolKit CLI'));
|
|
@@ -19363,6 +19350,9 @@ AI ToolKit`, {
|
|
|
19363
19350
|
log.log(chalk_1.default.hex('#34495E')(' ⚡ 生成、部署和托管全栈 Web 应用与小程序、数据库和后端服务'));
|
|
19364
19351
|
log.log(chalk_1.default.hex('#34495E')(' 🎯 无需运维,极速上线你的创意 💫'));
|
|
19365
19352
|
log.log('');
|
|
19353
|
+
log.log('Github:');
|
|
19354
|
+
log.log((0, output_1.genClickableLink)('https://github.com/TencentCloudBase/CloudBase-AI-ToolKit'));
|
|
19355
|
+
log.log('');
|
|
19366
19356
|
log.log('使用指引');
|
|
19367
19357
|
log.log((0, output_1.genClickableLink)('https://docs.cloudbase.net/cli-v1/ai/introduce'));
|
|
19368
19358
|
log.log('');
|
|
@@ -19475,7 +19465,7 @@ const notFoundError = () => {
|
|
|
19475
19465
|
});
|
|
19476
19466
|
};
|
|
19477
19467
|
function isValidAgent(agent) {
|
|
19478
|
-
return [const_1.CLAUDE, const_1.QWEN, const_1.CODEX, const_1.AIDER, const_1.CURSOR].some((x) => x.value === agent);
|
|
19468
|
+
return [const_1.CLAUDE, const_1.QWEN, const_1.CODEX, const_1.AIDER, const_1.CURSOR, const_1.CODEBUDDY].some((x) => x.value === agent);
|
|
19479
19469
|
}
|
|
19480
19470
|
exports.isValidAgent = isValidAgent;
|
|
19481
19471
|
exports.TOOLKIT_CONFIGS = {
|
|
@@ -19483,6 +19473,9 @@ exports.TOOLKIT_CONFIGS = {
|
|
|
19483
19473
|
mcp: '.mcp.json',
|
|
19484
19474
|
rules: 'CLAUDE.md'
|
|
19485
19475
|
},
|
|
19476
|
+
[const_1.CODEBUDDY.value]: {
|
|
19477
|
+
config: '.env.local'
|
|
19478
|
+
},
|
|
19486
19479
|
[const_1.QWEN.value]: {
|
|
19487
19480
|
config: '.env.local',
|
|
19488
19481
|
rules: '.qwen/QWEN.md'
|
|
@@ -19495,7 +19488,7 @@ exports.TOOLKIT_CONFIGS = {
|
|
|
19495
19488
|
},
|
|
19496
19489
|
[const_1.CURSOR.value]: {
|
|
19497
19490
|
config: '.cursor/mcp.json'
|
|
19498
|
-
}
|
|
19491
|
+
},
|
|
19499
19492
|
};
|
|
19500
19493
|
function createConfigParser() {
|
|
19501
19494
|
return new toolbox_1.ConfigParser({ configPath: const_1.CONFIG_PATH });
|
|
@@ -19703,6 +19696,17 @@ class AIConfigManager {
|
|
|
19703
19696
|
yield this.updateConfig('ai.agents.cursor.type', type);
|
|
19704
19697
|
});
|
|
19705
19698
|
}
|
|
19699
|
+
updateCodebuddyConfig(type, config) {
|
|
19700
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
19701
|
+
yield this.updateConfig('ai.agents.codebuddy', {});
|
|
19702
|
+
yield this.updateConfig('ai.agents.codebuddy.type', type);
|
|
19703
|
+
if (type === 'custom') {
|
|
19704
|
+
if (config.apiKey) {
|
|
19705
|
+
yield this.updateConfig('ai.agents.codebuddy.apiKey', config.apiKey, 'CODEBUDDY_API_KEY');
|
|
19706
|
+
}
|
|
19707
|
+
}
|
|
19708
|
+
});
|
|
19709
|
+
}
|
|
19706
19710
|
updateConfig(key, value, env) {
|
|
19707
19711
|
return __awaiter(this, void 0, void 0, function* () {
|
|
19708
19712
|
const configParser = createConfigParser();
|
|
@@ -19730,7 +19734,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
19730
19734
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
19731
19735
|
};
|
|
19732
19736
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
19733
|
-
exports.LIST_HINT = exports.getBooleanHint = exports.getDefaultModelByBaseUrl = exports.BASE_URL_MODEL_MAPPING = exports.getAgentConfigValidator = exports.getDefaultConfig = exports.CLOUDBASE_PROVIDERS = exports.AGENTS = exports.NONE = exports.CURSOR = exports.AIDER = exports.CODEX = exports.QWEN = exports.CLAUDE = exports.DEFAULT_CONFIG = exports.CLOUDBASE_MCP_CONFIG_PATH = exports.CLAUDE_CODE_ROUTER_LOGS_DIR_PATH = exports.CLAUDE_CODE_ROUTER_LOG_PATH = exports.CLAUDE_CODE_ROUTER_CONFIG_PATH = exports.ENV_LOCAL_PATH = exports.CONFIG_PATH = void 0;
|
|
19737
|
+
exports.LIST_HINT = exports.getBooleanHint = exports.getDefaultModelByBaseUrl = exports.BASE_URL_MODEL_MAPPING = exports.getAgentConfigValidator = exports.getDefaultConfig = exports.CLOUDBASE_PROVIDERS = exports.AGENTS = exports.NONE = exports.CODEBUDDY = exports.CURSOR = exports.AIDER = exports.CODEX = exports.QWEN = exports.CLAUDE = exports.DEFAULT_CONFIG = exports.CLOUDBASE_MCP_CONFIG_PATH = exports.CLAUDE_CODE_ROUTER_LOGS_DIR_PATH = exports.CLAUDE_CODE_ROUTER_LOG_PATH = exports.CLAUDE_CODE_ROUTER_CONFIG_PATH = exports.ENV_LOCAL_PATH = exports.CONFIG_PATH = void 0;
|
|
19734
19738
|
const os_1 = __importDefault(__webpack_require__(70857));
|
|
19735
19739
|
const path_1 = __importDefault(__webpack_require__(16928));
|
|
19736
19740
|
const v3_1 = __importDefault(__webpack_require__(19164));
|
|
@@ -19828,11 +19832,24 @@ exports.CURSOR = {
|
|
|
19828
19832
|
type: v3_1.default.literal('none')
|
|
19829
19833
|
})
|
|
19830
19834
|
};
|
|
19835
|
+
exports.CODEBUDDY = {
|
|
19836
|
+
name: 'Codebuddy Code CLI',
|
|
19837
|
+
value: 'codebuddy',
|
|
19838
|
+
configSchema: v3_1.default.discriminatedUnion('type', [
|
|
19839
|
+
v3_1.default.object({
|
|
19840
|
+
type: v3_1.default.literal('none')
|
|
19841
|
+
}),
|
|
19842
|
+
v3_1.default.object({
|
|
19843
|
+
type: v3_1.default.literal('custom'),
|
|
19844
|
+
apiKey: v3_1.default.string().optional()
|
|
19845
|
+
})
|
|
19846
|
+
])
|
|
19847
|
+
};
|
|
19831
19848
|
exports.NONE = {
|
|
19832
19849
|
name: '暂不配置',
|
|
19833
19850
|
value: 'none'
|
|
19834
19851
|
};
|
|
19835
|
-
exports.AGENTS = [exports.CLAUDE, exports.QWEN, exports.CODEX, exports.AIDER, exports.CURSOR, exports.NONE];
|
|
19852
|
+
exports.AGENTS = [exports.CLAUDE, exports.QWEN, exports.CODEX, exports.AIDER, exports.CURSOR, exports.CODEBUDDY, exports.NONE];
|
|
19836
19853
|
exports.CLOUDBASE_PROVIDERS = [
|
|
19837
19854
|
{
|
|
19838
19855
|
name: 'Kimi',
|
|
@@ -20286,7 +20303,7 @@ class AICommandRouter {
|
|
|
20286
20303
|
if (missingFiles.length > 0) {
|
|
20287
20304
|
const skipTemplate = yield this.checkSkipTemplateConfig();
|
|
20288
20305
|
if (skipTemplate) {
|
|
20289
|
-
log.info('🚫
|
|
20306
|
+
log.info('🚫 已跳过模板下载,无法使用云开发 MCP 及 AI 规则。如需使用,请参考 tcb pull --help');
|
|
20290
20307
|
return;
|
|
20291
20308
|
}
|
|
20292
20309
|
log.log('');
|
|
@@ -20535,6 +20552,13 @@ class AICommandRouter {
|
|
|
20535
20552
|
args: ['install', '-g', '@google/gemini-cli'],
|
|
20536
20553
|
message: 'npm install -g @google/gemini-cli'
|
|
20537
20554
|
};
|
|
20555
|
+
case 'codebuddy':
|
|
20556
|
+
return {
|
|
20557
|
+
success: true,
|
|
20558
|
+
command: 'npm',
|
|
20559
|
+
args: ['install', '-g', '@tencent-ai/codebuddy-code@beta'],
|
|
20560
|
+
message: 'npm install -g @tencent-ai/codebuddy-code@beta'
|
|
20561
|
+
};
|
|
20538
20562
|
default:
|
|
20539
20563
|
return { success: false, message: `# 请查阅 ${agent} 的官方安装文档` };
|
|
20540
20564
|
}
|
|
@@ -20542,8 +20566,7 @@ class AICommandRouter {
|
|
|
20542
20566
|
executeCommand(command, args, env, log) {
|
|
20543
20567
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20544
20568
|
return new Promise((resolve, reject) => {
|
|
20545
|
-
const useShell = process.platform
|
|
20546
|
-
(process.env.WSL_DISTRO_NAME || process.env.MSYS2 || process.env.GIT_BASH);
|
|
20569
|
+
const useShell = process.platform === 'win32';
|
|
20547
20570
|
const child = (0, child_process_1.spawn)(command, args, {
|
|
20548
20571
|
stdio: 'inherit',
|
|
20549
20572
|
env,
|
|
@@ -20588,11 +20611,9 @@ class AICommandRouter {
|
|
|
20588
20611
|
isToolAvailable(command) {
|
|
20589
20612
|
return __awaiter(this, void 0, void 0, function* () {
|
|
20590
20613
|
return new Promise((resolve) => {
|
|
20591
|
-
const useShell = process.platform !== 'win32' ||
|
|
20592
|
-
(process.env.WSL_DISTRO_NAME || process.env.MSYS2 || process.env.GIT_BASH);
|
|
20593
20614
|
const child = (0, child_process_1.spawn)(command, ['--version'], {
|
|
20594
20615
|
stdio: 'pipe',
|
|
20595
|
-
shell:
|
|
20616
|
+
shell: true
|
|
20596
20617
|
});
|
|
20597
20618
|
child.on('close', (code) => {
|
|
20598
20619
|
resolve(code === 0);
|
|
@@ -20668,6 +20689,13 @@ class AICommandRouter {
|
|
|
20668
20689
|
}
|
|
20669
20690
|
case const_1.CURSOR.value:
|
|
20670
20691
|
return yield this.executeNoneCursorAgent(additionalArgs, log);
|
|
20692
|
+
case const_1.CODEBUDDY.value:
|
|
20693
|
+
if (agentConfig.type === 'custom') {
|
|
20694
|
+
return yield this.executeCodebuddyAgent(agentConfig, additionalArgs, log);
|
|
20695
|
+
}
|
|
20696
|
+
else {
|
|
20697
|
+
return yield this.executeNoneCodebuddyAgent(additionalArgs, log);
|
|
20698
|
+
}
|
|
20671
20699
|
default:
|
|
20672
20700
|
throw new Error(`不支持的 AI 工具: ${agent}`);
|
|
20673
20701
|
}
|
|
@@ -21347,6 +21375,43 @@ class AICommandRouter {
|
|
|
21347
21375
|
}
|
|
21348
21376
|
return lines.join('\n');
|
|
21349
21377
|
}
|
|
21378
|
+
executeCodebuddyAgent({ apiKey }, additionalArgs, log) {
|
|
21379
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21380
|
+
yield this.ensureCodebuddy(log);
|
|
21381
|
+
yield this.executeCommand('codebuddy', additionalArgs, Object.assign(Object.assign({}, process.env), (apiKey && { CODEBUDDY_API_KEY: apiKey })), log);
|
|
21382
|
+
});
|
|
21383
|
+
}
|
|
21384
|
+
executeNoneCodebuddyAgent(additionalArgs, log) {
|
|
21385
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21386
|
+
yield this.ensureCodebuddy(log);
|
|
21387
|
+
yield this.executeCommand('codebuddy', additionalArgs, Object.assign({}, process.env), log);
|
|
21388
|
+
});
|
|
21389
|
+
}
|
|
21390
|
+
ensureCodebuddy(log) {
|
|
21391
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
21392
|
+
if (yield this.isToolAvailable('codebuddy')) {
|
|
21393
|
+
log.debug('codebuddy 已安装!');
|
|
21394
|
+
}
|
|
21395
|
+
else {
|
|
21396
|
+
const { shouldInstall } = yield inquirer_1.default.prompt([
|
|
21397
|
+
{
|
|
21398
|
+
type: 'confirm',
|
|
21399
|
+
name: 'shouldInstall',
|
|
21400
|
+
message: `AI 开发缺少 codebuddy 依赖,是否安装? ${(0, const_1.getBooleanHint)(true)}`
|
|
21401
|
+
}
|
|
21402
|
+
]);
|
|
21403
|
+
if (shouldInstall) {
|
|
21404
|
+
yield this.executeCommand('npm', ['install', '-g', '@tencent-ai/codebuddy-code@beta'], process.env, log);
|
|
21405
|
+
log.info('✅ codebuddy 安装完成');
|
|
21406
|
+
}
|
|
21407
|
+
else {
|
|
21408
|
+
log.info('❌ codebuddy 未安装,请手动安装');
|
|
21409
|
+
log.info('📦 安装命令: npm install -g @tencent-ai/codebuddy-code@beta');
|
|
21410
|
+
process.exit(1);
|
|
21411
|
+
}
|
|
21412
|
+
}
|
|
21413
|
+
});
|
|
21414
|
+
}
|
|
21350
21415
|
}
|
|
21351
21416
|
exports.AICommandRouter = AICommandRouter;
|
|
21352
21417
|
function safeParseJson(json) {
|
|
@@ -21561,7 +21626,7 @@ class AISetupWizard {
|
|
|
21561
21626
|
type: 'list',
|
|
21562
21627
|
name: 'agent',
|
|
21563
21628
|
message: `${message} ${const_1.LIST_HINT}`,
|
|
21564
|
-
choices: [const_1.CLAUDE, const_1.QWEN, const_1.CODEX, const_1.CURSOR, const_1.AIDER, ...(includeNone ? [const_1.NONE] : [])],
|
|
21629
|
+
choices: [const_1.CLAUDE, const_1.QWEN, const_1.CODEX, const_1.CURSOR, const_1.AIDER, const_1.CODEBUDDY, ...(includeNone ? [const_1.NONE] : [])],
|
|
21565
21630
|
default: const_1.CLAUDE.value
|
|
21566
21631
|
}
|
|
21567
21632
|
]);
|
|
@@ -21570,7 +21635,7 @@ class AISetupWizard {
|
|
|
21570
21635
|
}
|
|
21571
21636
|
configureAgent(agent, log) {
|
|
21572
21637
|
return __awaiter(this, void 0, void 0, function* () {
|
|
21573
|
-
const agentInfo = [const_1.CLAUDE, const_1.QWEN, const_1.CODEX, const_1.AIDER, const_1.CURSOR].find((a) => a.value === agent);
|
|
21638
|
+
const agentInfo = [const_1.CLAUDE, const_1.QWEN, const_1.CODEX, const_1.AIDER, const_1.CURSOR, const_1.CODEBUDDY].find((a) => a.value === agent);
|
|
21574
21639
|
log.info(`\n📝 配置 ${(agentInfo === null || agentInfo === void 0 ? void 0 : agentInfo.name) || agent.toUpperCase()}:`);
|
|
21575
21640
|
switch (agent) {
|
|
21576
21641
|
case const_1.CLAUDE.value:
|
|
@@ -21583,6 +21648,8 @@ class AISetupWizard {
|
|
|
21583
21648
|
return yield this.configureAiderAgent(log);
|
|
21584
21649
|
case const_1.CURSOR.value:
|
|
21585
21650
|
return yield this.configureCursorAgent(log);
|
|
21651
|
+
case const_1.CODEBUDDY.value:
|
|
21652
|
+
return yield this.configureCodebuddyAgent(log);
|
|
21586
21653
|
default:
|
|
21587
21654
|
throw new Error(`不支持的 AI 工具: ${agent}`);
|
|
21588
21655
|
}
|
|
@@ -22008,6 +22075,47 @@ class AISetupWizard {
|
|
|
22008
22075
|
}
|
|
22009
22076
|
});
|
|
22010
22077
|
}
|
|
22078
|
+
configureCodebuddyAgent(log) {
|
|
22079
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
22080
|
+
log.info(`配置说明可参考 ${(0, output_1.genClickableLink)('https://cnb.woa.com/genie/genie/-/tree/main/docs')}`);
|
|
22081
|
+
const { configMethod } = yield inquirer_1.default.prompt([
|
|
22082
|
+
{
|
|
22083
|
+
type: 'list',
|
|
22084
|
+
name: 'configMethod',
|
|
22085
|
+
message: `选择配置方式: ${const_1.LIST_HINT}`,
|
|
22086
|
+
choices: [
|
|
22087
|
+
{
|
|
22088
|
+
name: '使用 Codebuddy Code CLI 内置鉴权方式(如 OAuth)',
|
|
22089
|
+
value: 'none'
|
|
22090
|
+
},
|
|
22091
|
+
{
|
|
22092
|
+
name: '配置 API KEY(用于无交互环境)',
|
|
22093
|
+
value: 'custom'
|
|
22094
|
+
}
|
|
22095
|
+
],
|
|
22096
|
+
default: 'none'
|
|
22097
|
+
}
|
|
22098
|
+
]);
|
|
22099
|
+
if (configMethod === 'custom') {
|
|
22100
|
+
const { apiKey } = yield inquirer_1.default.prompt([
|
|
22101
|
+
{
|
|
22102
|
+
type: 'password',
|
|
22103
|
+
name: 'apiKey',
|
|
22104
|
+
message: '请输入 Codebuddy API Key:',
|
|
22105
|
+
validate: (input) => input.trim().length > 0 || 'API Key 不能为空'
|
|
22106
|
+
}
|
|
22107
|
+
]);
|
|
22108
|
+
yield this.aiConfigManager.updateCodebuddyConfig('custom', {
|
|
22109
|
+
apiKey
|
|
22110
|
+
});
|
|
22111
|
+
}
|
|
22112
|
+
else {
|
|
22113
|
+
yield this.aiConfigManager.updateCodebuddyConfig('none', {});
|
|
22114
|
+
}
|
|
22115
|
+
log.info('✅ Codebuddy Code CLI 配置完成');
|
|
22116
|
+
log.info('💡 提示:首次使用时会自动打开浏览器进行 OAuth 身份验证');
|
|
22117
|
+
});
|
|
22118
|
+
}
|
|
22011
22119
|
}
|
|
22012
22120
|
exports.AISetupWizard = AISetupWizard;
|
|
22013
22121
|
|
|
@@ -623676,7 +623784,7 @@ module.exports = {"version":"3.13.1"};
|
|
|
623676
623784
|
/***/ ((module) => {
|
|
623677
623785
|
|
|
623678
623786
|
"use strict";
|
|
623679
|
-
module.exports = /*#__PURE__*/JSON.parse('{"name":"@cloudbase/cli","version":"2.
|
|
623787
|
+
module.exports = /*#__PURE__*/JSON.parse('{"name":"@cloudbase/cli","version":"2.9.0","description":"cli tool for cloudbase","main":"lib/index.js","scripts":{"build":"rimraf lib types && tsc --resolveJsonModule && cpx \\"src/**/*.html\\" lib","watch":"rimraf lib types && tsc -w","dev":"rimraf lib types && cpx \\"src/**/*.html\\" lib && tsc -w","eslint":"eslint \\"./**/*.ts\\"","test":"node --experimental-vm-modules node_modules/jest/bin/jest.js --runInBand --forceExit --detectOpenHandles --coverage --verbose --testTimeout=10000","tsc":"tsc","pkg":"pkg ./bin/cloudbase.js --out-path ./pkg","postinstall":"node ./post-install.js || exit 0 && patch-package","prepublishOnly":"npm run build","debug":"bin/tcb.js lowcode watch","build:bundle":"webpack --config build/webpack/cli.cjs && webpack --config build/webpack/ccr.cjs","package:darwin-arm64":"OS=darwin ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:darwin-x64":"OS=darwin ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:linux-arm64":"OS=linux ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:linux-x64":"OS=linux ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:all":"bash build/scripts/build-all.sh","node:fetch:one":"node -e \\"require(\'child_process\').execSync(\'bash build/scripts/fetch-node.sh\',{stdio:\'inherit\'})\\"","node:fetch:all":"NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh --all","node:fetch:win-x64":"OS=windows ARCH=x64 NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh","node:fetch:win-arm64":"OS=windows ARCH=arm64 NODE_VERSION=22.18.0 bash build/scripts/fetch-node.sh","package:windows-x64":"OS=windows ARCH=x64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:windows-arm64":"OS=windows ARCH=arm64 VERSION= node -e \\"require(\'child_process\').execSync(\'bash build/scripts/package.sh\',{stdio:\'inherit\'})\\"","package:windows-all":"npm run -s node:fetch:win-x64 && npm run -s node:fetch:win-arm64 && npm run -s package:windows-x64 && npm run -s package:windows-arm64","out:prune":"bash build/scripts/prune-out.sh"},"repository":{"type":"git","url":"https://github.com/TencentCloudBase/cloud-base-cli.git"},"bin":{"cloudbase":"bin/cloudbase.js","cloudbase-mcp":"bin/cloudbase-mcp.cjs","tcb":"bin/tcb.js","ccr":"bin/ccr.js"},"husky":{"hooks":{"pre-commit":"npm run build"}},"author":"cwuyiqing@gmail.com","license":"ISC","dependencies":{"@cloudbase/cloud-api":"^0.5.5","@cloudbase/cloudbase-mcp":"^1.8.40","@cloudbase/framework-core":"^1.9.7","@cloudbase/functions-framework":"1.16.0","@cloudbase/iac-core":"0.0.3-alpha.11","@cloudbase/lowcode-cli":"^0.22.2","@cloudbase/manager-node":"4.5.0","@cloudbase/toolbox":"^0.7.9","@dotenvx/dotenvx":"^1.48.3","@musistudio/claude-code-router":"1.0.36","address":"^1.1.2","camelcase-keys":"^7.0.2","chalk":"^2.4.2","cli-table3":"^0.5.1","commander":"7","del":"^5.1.0","didyoumean":"^1.2.2","enquirer":"^2.3.6","execa":"^4.0.3","figlet":"^1.7.0","fs-extra":"^8.1.0","gradient-string":"^2.0.2","https-proxy-agent":"^5.0.1","i":"^0.3.7","inquirer":"^6.5.0","json-schema-to-typescript":"^14.0.5","lodash":"^4.17.21","log-symbols":"^3.0.0","lowdb":"^1.0.0","make-dir":"^3.0.0","node-fetch":"^2.6.0","nodemon":"^3.1.4","npm":"^11.5.2","open":"^7.0.0","ora":"^4.0.2","patch-package":"^8.0.0","portfinder":"^1.0.28","progress":"^2.0.3","query-string":"^6.8.1","reflect-metadata":"^0.1.13","semver":"^7.3.7","simple-git":"^3.28.0","tar-fs":"^2.0.1","terminal-link":"^2.1.1","toml":"^3.0.0","unzipper":"^0.10.10","update-notifier":"^4.0.0","xdg-basedir":"^4.0.0","yargs":"^16.2.0","yargs-parser":"^21.0.1","zod":"^4.0.13"},"devDependencies":{"@types/fs-extra":"^11.0.4","@types/jest":"^27","@types/koa__router":"^8.0.11","@types/lodash":"^4.14.182","@types/node":"^12.12.38","@types/node-fetch":"^2.5.4","@types/react":"^17.0.37","@types/semver":"^7.3.9","@types/unzipper":"^0.10.11","@types/webpack-dev-server":"^3.11.1","@typescript-eslint/eslint-plugin":"^4.8.1","@typescript-eslint/parser":"^4.8.1","cpx":"^1.5.0","eslint":"^7.14.0","eslint-config-alloy":"^3.8.2","husky":"^3.0.9","jest":"^27","rimraf":"^3.0.2","ts-jest":"^27","typescript":"^4.7.2","webpack":"^5.92.0","webpack-cli":"^5.1.4"},"packageManager":"yarn@3.6.2+sha512.2c2f8b9615e6659773f65cdec7cf92ef773a98a99e611579601f61c7a91ec94c89c929aac86f1cee819421a9b0db7acfd53ec3ebb95af44f77f77634b08b9557"}');
|
|
623680
623788
|
|
|
623681
623789
|
/***/ })
|
|
623682
623790
|
|
|
@@ -37,13 +37,9 @@ const utils_1 = require("../../utils");
|
|
|
37
37
|
function printSuggestion() {
|
|
38
38
|
const tips = `可使用下面命令继续操作:
|
|
39
39
|
|
|
40
|
-
${chalk_1.default.gray('–')}
|
|
40
|
+
${chalk_1.default.gray('–')} 一键开启 AI 开发体验
|
|
41
41
|
|
|
42
|
-
${chalk_1.default.cyan('$ tcb
|
|
43
|
-
|
|
44
|
-
${chalk_1.default.gray('–')} 部署云函数
|
|
45
|
-
|
|
46
|
-
${chalk_1.default.cyan('$ tcb fn deploy')}
|
|
42
|
+
${chalk_1.default.cyan('$ tcb ai')}
|
|
47
43
|
|
|
48
44
|
${chalk_1.default.gray('–')} 查看命令使用介绍
|
|
49
45
|
|
package/lib/commands/ai/index.js
CHANGED
|
@@ -39,7 +39,7 @@ let AICommand = class AICommand extends common_1.Command {
|
|
|
39
39
|
options: [
|
|
40
40
|
{
|
|
41
41
|
flags: '-a, --agent <agent>',
|
|
42
|
-
desc: 'AI CLI 工具 (claude, qwen, codex, aider)'
|
|
42
|
+
desc: 'AI CLI 工具 (claude, qwen, codex, aider, codebuddy)'
|
|
43
43
|
},
|
|
44
44
|
{
|
|
45
45
|
flags: '-e, --envId <envId>',
|
|
@@ -66,7 +66,7 @@ let AICommand = class AICommand extends common_1.Command {
|
|
|
66
66
|
desc: '指定模板类型 (miniprogram, react, vue, uniapp, rules)'
|
|
67
67
|
}
|
|
68
68
|
],
|
|
69
|
-
desc: 'CloudBase AI ToolKit CLI - 快速启动和配置主流 AI 编程工具\n\n示例:\n tcb ai -a claude -- --continue\n\n说明:-- 后的参数会直接传递给目标 AI CLI。',
|
|
69
|
+
desc: 'CloudBase AI ToolKit CLI - 快速启动和配置主流 AI 编程工具\n\n示例:\n tcb ai -a claude -- --continue\n tcb ai -a codebuddy -- mcp list\n\n说明:-- 后的参数会直接传递给目标 AI CLI。',
|
|
70
70
|
requiredEnvId: false,
|
|
71
71
|
withoutAuth: true,
|
|
72
72
|
allowUnknownOption: true
|
|
@@ -32,6 +32,10 @@ let PullCommand = class PullCommand extends common_1.Command {
|
|
|
32
32
|
return {
|
|
33
33
|
cmd: 'pull',
|
|
34
34
|
options: [
|
|
35
|
+
{
|
|
36
|
+
flags: '-s, --source <source>',
|
|
37
|
+
desc: '模板来源'
|
|
38
|
+
},
|
|
35
39
|
{
|
|
36
40
|
flags: '-o, --output <output>',
|
|
37
41
|
desc: '指定输出目录'
|
|
@@ -46,10 +50,9 @@ let PullCommand = class PullCommand extends common_1.Command {
|
|
|
46
50
|
withoutAuth: true
|
|
47
51
|
};
|
|
48
52
|
}
|
|
49
|
-
execute(options, log) {
|
|
53
|
+
execute(options, params, log) {
|
|
50
54
|
return __awaiter(this, void 0, void 0, function* () {
|
|
51
|
-
const { output, force } = options;
|
|
52
|
-
const source = process.argv[3];
|
|
55
|
+
const { output, force, source } = options;
|
|
53
56
|
if (!source || typeof source !== 'string') {
|
|
54
57
|
throw new error_1.CloudBaseError('请指定要拉取的模板来源');
|
|
55
58
|
}
|
|
@@ -89,9 +92,10 @@ let PullCommand = class PullCommand extends common_1.Command {
|
|
|
89
92
|
__decorate([
|
|
90
93
|
(0, decorators_1.InjectParams)(),
|
|
91
94
|
__param(0, (0, decorators_1.ArgsOptions)()),
|
|
92
|
-
__param(1, (0, decorators_1.
|
|
95
|
+
__param(1, (0, decorators_1.ArgsParams)()),
|
|
96
|
+
__param(2, (0, decorators_1.Log)()),
|
|
93
97
|
__metadata("design:type", Function),
|
|
94
|
-
__metadata("design:paramtypes", [Object, log_1.Logger]),
|
|
98
|
+
__metadata("design:paramtypes", [Object, Array, log_1.Logger]),
|
|
95
99
|
__metadata("design:returntype", Promise)
|
|
96
100
|
], PullCommand.prototype, "execute", null);
|
|
97
101
|
PullCommand = __decorate([
|
package/lib/help.js
CHANGED
|
@@ -8,20 +8,15 @@ const chalk_1 = __importDefault(require("chalk"));
|
|
|
8
8
|
const outputHelpInfo = () => {
|
|
9
9
|
const commands = `
|
|
10
10
|
命令
|
|
11
|
-
|
|
11
|
+
ai -- [cmd] 开启 AI 全栈开发体验
|
|
12
12
|
login [options] 登录腾讯云账号
|
|
13
13
|
logout 登出腾讯云账号
|
|
14
14
|
env [cmd] 环境管理操作
|
|
15
15
|
fn [cmd] 操作函数
|
|
16
|
-
framework [cmd] 云开发 Serverless 应用框架操作
|
|
17
16
|
hosting [cmd] 静态托管资源管理操作
|
|
18
|
-
new [appName] [template] 创建新的云开发应用
|
|
19
|
-
open [link] 在浏览器中打开云开发相关连接
|
|
20
17
|
storage [cmd] 云存储资源管理操作
|
|
21
18
|
service [cmd] HTTP 访问服务管理操作
|
|
22
|
-
|
|
23
|
-
run [cmd] 云托管环境管理操作 (TCBR 类型环境)
|
|
24
|
-
cloudrun [cmd] 云托管服务管理操作(新版云开发平台)`;
|
|
19
|
+
cloudrun [cmd] 云托管服务管理操作`;
|
|
25
20
|
const options = `
|
|
26
21
|
选项
|
|
27
22
|
|
|
@@ -38,17 +33,10 @@ const outputHelpInfo = () => {
|
|
|
38
33
|
|
|
39
34
|
${chalk_1.default.cyan('$ tcb login')}
|
|
40
35
|
|
|
41
|
-
${chalk_1.default.gray('–')}
|
|
42
|
-
|
|
43
|
-
${chalk_1.default.cyan('$ tcb new appName')}
|
|
44
|
-
|
|
45
|
-
${chalk_1.default.gray('–')} 部署云函数
|
|
46
|
-
|
|
47
|
-
${chalk_1.default.cyan('$ tcb fn deploy')}
|
|
48
|
-
|
|
49
|
-
${chalk_1.default.gray('–')} 查看命令使用介绍
|
|
36
|
+
${chalk_1.default.gray('–')} 使用 AI 全栈开发部署
|
|
50
37
|
|
|
51
|
-
${chalk_1.default.cyan('$ tcb
|
|
38
|
+
${chalk_1.default.cyan('$ tcb ai')}
|
|
39
|
+
`;
|
|
52
40
|
console.log(commands, '\n', options, '\n', tips);
|
|
53
41
|
};
|
|
54
42
|
exports.outputHelpInfo = outputHelpInfo;
|
package/lib/utils/ai/banner.js
CHANGED
|
@@ -75,12 +75,12 @@ AI ToolKit`, {
|
|
|
75
75
|
log.log(' 🎯 无需运维,极速上线你的创意 💫');
|
|
76
76
|
}
|
|
77
77
|
log.log('');
|
|
78
|
+
log.log('Github:');
|
|
79
|
+
log.log((0, output_1.genClickableLink)('https://github.com/TencentCloudBase/CloudBase-AI-ToolKit'));
|
|
80
|
+
log.log('');
|
|
78
81
|
log.log('使用指引');
|
|
79
82
|
log.log((0, output_1.genClickableLink)('https://docs.cloudbase.net/cli-v1/ai/introduce'));
|
|
80
83
|
log.log('');
|
|
81
|
-
log.log('Beta 能力,如遇问题可创建 issue:');
|
|
82
|
-
log.log((0, output_1.genClickableLink)('https://cnb.cool/tencent/cloud/cloudbase/community/-/issues'));
|
|
83
|
-
log.log('');
|
|
84
84
|
}
|
|
85
85
|
catch (e) {
|
|
86
86
|
log.log(chalk_1.default.bold.cyanBright('⛰︎'), chalk_1.default.bold.hex('#FFFFFF')(' CloudBase AI ToolKit CLI'));
|
|
@@ -89,6 +89,9 @@ AI ToolKit`, {
|
|
|
89
89
|
log.log(chalk_1.default.hex('#34495E')(' ⚡ 生成、部署和托管全栈 Web 应用与小程序、数据库和后端服务'));
|
|
90
90
|
log.log(chalk_1.default.hex('#34495E')(' 🎯 无需运维,极速上线你的创意 💫'));
|
|
91
91
|
log.log('');
|
|
92
|
+
log.log('Github:');
|
|
93
|
+
log.log((0, output_1.genClickableLink)('https://github.com/TencentCloudBase/CloudBase-AI-ToolKit'));
|
|
94
|
+
log.log('');
|
|
92
95
|
log.log('使用指引');
|
|
93
96
|
log.log((0, output_1.genClickableLink)('https://docs.cloudbase.net/cli-v1/ai/introduce'));
|
|
94
97
|
log.log('');
|