@cloudbase/cli 2.9.6 → 2.9.8

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.
@@ -393,8 +393,8 @@ class AICommandRouter {
393
393
  return {
394
394
  success: true,
395
395
  command: 'npm',
396
- args: ['install', '-g', '@tencent-ai/codebuddy-code@beta'],
397
- message: 'npm install -g @tencent-ai/codebuddy-code@beta'
396
+ args: ['install', '-g', '@tencent-ai/codebuddy-code'],
397
+ message: 'npm install -g @tencent-ai/codebuddy-code'
398
398
  };
399
399
  default:
400
400
  return { success: false, message: `# 请查阅 ${agent} 的官方安装文档` };
@@ -1238,12 +1238,12 @@ class AICommandRouter {
1238
1238
  }
1239
1239
  ]);
1240
1240
  if (shouldInstall) {
1241
- yield this.executeCommand('npm', ['install', '-g', '@tencent-ai/codebuddy-code@beta'], process.env, log);
1241
+ yield this.executeCommand('npm', ['install', '-g', '@tencent-ai/codebuddy-code'], process.env, log);
1242
1242
  log.info('✅ codebuddy 安装完成');
1243
1243
  }
1244
1244
  else {
1245
1245
  log.info('❌ codebuddy 未安装,请手动安装');
1246
- log.info('📦 安装命令: npm install -g @tencent-ai/codebuddy-code@beta');
1246
+ log.info('📦 安装命令: npm install -g @tencent-ai/codebuddy-code');
1247
1247
  process.exit(1);
1248
1248
  }
1249
1249
  }
@@ -660,7 +660,7 @@ class AISetupWizard {
660
660
  }
661
661
  configureCodebuddyAgent(log) {
662
662
  return __awaiter(this, void 0, void 0, function* () {
663
- log.info(`配置说明可参考 ${(0, output_1.genClickableLink)('https://cnb.woa.com/genie/genie/-/tree/main/docs')}`);
663
+ log.info(`配置说明可参考 ${(0, output_1.genClickableLink)('https://cnb.cool/codebuddy/codebuddy-code/-/blob/main/docs/cli-reference.md')}`);
664
664
  const { configMethod } = yield inquirer_1.default.prompt([
665
665
  {
666
666
  type: 'list',
@@ -78,6 +78,9 @@ class TemplateManager {
78
78
  if (this.isBuiltinTemplate(source)) {
79
79
  yield this.downloadBuiltinTemplateToTemp(source, tempDir, log);
80
80
  }
81
+ else if (this.isZipUrl(source)) {
82
+ yield this.downloadZipTemplateToTemp(source, tempDir, log);
83
+ }
81
84
  else if (this.isGitUrl(source)) {
82
85
  const gitInfo = this.parseGitUrl(source);
83
86
  yield this.downloadGitTemplateToTemp(gitInfo, tempDir, log);
@@ -96,6 +99,23 @@ class TemplateManager {
96
99
  isBuiltinTemplate(source) {
97
100
  return Object.keys(BUILTIN_TEMPLATES).includes(source);
98
101
  }
102
+ isZipUrl(source) {
103
+ console.log("zip source", source);
104
+ if (!source || typeof source !== 'string') {
105
+ return false;
106
+ }
107
+ if (!(source.startsWith('http://') || source.startsWith('https://'))) {
108
+ return false;
109
+ }
110
+ try {
111
+ const url = new URL(source);
112
+ const pathname = url.pathname.toLowerCase();
113
+ return pathname.endsWith('.zip');
114
+ }
115
+ catch (error) {
116
+ return source.toLowerCase().endsWith('.zip');
117
+ }
118
+ }
99
119
  isGitUrl(source) {
100
120
  if (!source || typeof source !== 'string') {
101
121
  return false;
@@ -251,6 +271,19 @@ class TemplateManager {
251
271
  }
252
272
  });
253
273
  }
274
+ downloadZipTemplateToTemp(zipUrl, tempDir, log) {
275
+ return __awaiter(this, void 0, void 0, function* () {
276
+ log.info(`📦 正在下载 zip 文件模板到临时目录: ${zipUrl}`);
277
+ try {
278
+ const { downloadAndExtractRemoteZip } = yield Promise.resolve().then(() => __importStar(require('./tools/common')));
279
+ yield downloadAndExtractRemoteZip(zipUrl, tempDir);
280
+ log.info(`✅ zip 文件模板下载完成到临时目录`);
281
+ }
282
+ catch (error) {
283
+ throw new error_1.CloudBaseError(`下载 zip 文件模板失败: ${error.message}`, { original: error });
284
+ }
285
+ });
286
+ }
254
287
  downloadGitTemplateToTemp(gitInfo, tempDir, log) {
255
288
  return __awaiter(this, void 0, void 0, function* () {
256
289
  const gitUrl = this.buildGitUrl(gitInfo);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cloudbase/cli",
3
- "version": "2.9.6",
3
+ "version": "2.9.8",
4
4
  "description": "cli tool for cloudbase",
5
5
  "main": "lib/index.js",
6
6
  "scripts": {
@@ -48,7 +48,7 @@
48
48
  "license": "ISC",
49
49
  "dependencies": {
50
50
  "@cloudbase/cloud-api": "^0.5.5",
51
- "@cloudbase/cloudbase-mcp": "^1.8.41",
51
+ "@cloudbase/cloudbase-mcp": "^1.8.44",
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",
@@ -132,3 +132,6 @@ if (gitInfo.platform === 'cnb') {
132
132
 
133
133
 
134
134
 
135
+
136
+
137
+
@@ -51,3 +51,6 @@ tcb pull https://cnb.cool/username/repo --output ./my-project
51
51
 
52
52
 
53
53
 
54
+
55
+
56
+
@@ -9,12 +9,14 @@ export declare class TemplateManager {
9
9
  constructor();
10
10
  pullTemplate(source: string, options: PullOptions, log: Logger): Promise<void>;
11
11
  private isBuiltinTemplate;
12
+ private isZipUrl;
12
13
  private isGitUrl;
13
14
  private parseGitUrl;
14
15
  private buildGitUrl;
15
16
  private cloneWithSubpathOptimized;
16
17
  private cloneWithSubpath;
17
18
  private downloadBuiltinTemplateToTemp;
19
+ private downloadZipTemplateToTemp;
18
20
  private downloadGitTemplateToTemp;
19
21
  private copyFromTempToTarget;
20
22
  private copyFilesWithOverwrite;
Binary file