@cloudbase/cli 2.8.0-beta.3 → 2.8.0-beta.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/bin/tcb.js +2 -0
  2. package/lib/commands/cloudrun/base.js +2 -2
  3. package/lib/commands/index.js +0 -1
  4. package/lib/commands/utils.js +4 -10
  5. package/package.json +2 -8
  6. package/types/commands/index.d.ts +0 -1
  7. package/types/commands/utils.d.ts +0 -6
  8. package/types/utils/config.d.ts +0 -1
  9. package/.augment-guidelines +0 -119
  10. package/.claude/settings.local.json +0 -6
  11. package/.clinerules/cloudbase-rules.mdc +0 -119
  12. package/.cursor/rules/cloudbase-rules.mdc +0 -119
  13. package/.mcp.json +0 -11
  14. package/CLAUDE.md +0 -119
  15. package/lib/commands/ai/index.js +0 -172
  16. package/lib/utils/ai/banner.js +0 -88
  17. package/lib/utils/ai/config.js +0 -228
  18. package/lib/utils/ai/const.js +0 -107
  19. package/lib/utils/ai/ensureFiles.js +0 -26
  20. package/lib/utils/ai/envLocalManager.js +0 -144
  21. package/lib/utils/ai/router.js +0 -812
  22. package/lib/utils/ai/setup.js +0 -419
  23. package/rules/cloudbase-platform.mdc +0 -44
  24. package/rules/database.mdc +0 -25
  25. package/rules/miniprogram-development.mdc +0 -61
  26. package/rules/ui-design.mdc +0 -24
  27. package/rules/web-development.mdc +0 -44
  28. package/rules/workflows.mdc +0 -30
  29. package/specs/ai-cli-bootstrap/QWEN.md +0 -196
  30. package/specs/ai-cli-bootstrap/design.md +0 -185
  31. package/specs/ai-cli-bootstrap/requirements.md +0 -51
  32. package/specs/ai-cli-bootstrap/tasks.md +0 -70
  33. package/specs/ai-cli-bootstrap/technical-docs.md +0 -421
  34. package/types/commands/ai/index.d.ts +0 -23
  35. package/types/utils/ai/banner.d.ts +0 -2
  36. package/types/utils/ai/config.d.ts +0 -68
  37. package/types/utils/ai/const.d.ts +0 -238
  38. package/types/utils/ai/ensureFiles.d.ts +0 -1
  39. package/types/utils/ai/envLocalManager.d.ts +0 -23
  40. package/types/utils/ai/router.d.ts +0 -38
  41. package/types/utils/ai/setup.d.ts +0 -21
@@ -1,144 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- var __importDefault = (this && this.__importDefault) || function (mod) {
35
- return (mod && mod.__esModule) ? mod : { "default": mod };
36
- };
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.EnvLocalManager = void 0;
39
- const fs_extra_1 = __importDefault(require("fs-extra"));
40
- const error_1 = require("../../error");
41
- const dotenvx = __importStar(require("@dotenvx/dotenvx"));
42
- const const_1 = require("./const");
43
- dotenvx.setLogLevel({
44
- logLevel: 'error'
45
- });
46
- class EnvLocalManager {
47
- updateEnvId(envId) {
48
- this.setEnvLocal('ENV_ID', envId);
49
- }
50
- parseEnvFile() {
51
- return __awaiter(this, void 0, void 0, function* () {
52
- const content = yield fs_extra_1.default.readFile(const_1.ENV_LOCAL_PATH, 'utf8');
53
- return dotenvx.parse(content);
54
- });
55
- }
56
- updateAIConfig(aiConfig) {
57
- return __awaiter(this, void 0, void 0, function* () {
58
- try {
59
- yield this.addAIConfigToEnv(aiConfig);
60
- }
61
- catch (error) {
62
- throw new error_1.CloudBaseError(`更新 AI 配置失败: ${error.message}`, { original: error });
63
- }
64
- });
65
- }
66
- removeAIConfig(agentName) {
67
- return __awaiter(this, void 0, void 0, function* () {
68
- try {
69
- const envMap = yield this.parseEnvFile();
70
- if (agentName) {
71
- this.removeSpecificAgentConfig(envMap, agentName);
72
- }
73
- else {
74
- this.removeAIConfigFromMap(envMap);
75
- }
76
- }
77
- catch (error) {
78
- throw new error_1.CloudBaseError(`移除 AI 配置失败: ${error.message}`, { original: error });
79
- }
80
- });
81
- }
82
- validateAIConfig(aiConfig) {
83
- const errors = [];
84
- if (!aiConfig.defaultAgent) {
85
- errors.push('默认 AI 工具不能为空');
86
- }
87
- Object.entries(aiConfig.agents).forEach(([agentName, config]) => {
88
- if (!config.apiKey) {
89
- errors.push(`${agentName} 必须配置 API Key`);
90
- }
91
- if (config.baseUrl && !isValidUrl(config.baseUrl)) {
92
- errors.push(`${agentName} 的 Base URL 格式不正确`);
93
- }
94
- });
95
- return errors;
96
- }
97
- updateDefaultAgent(agent) {
98
- this.setEnvLocal('AI_DEFAULT_AGENT', agent);
99
- }
100
- setEnvLocal(key, value) {
101
- dotenvx.set(key, value, { path: const_1.ENV_LOCAL_PATH, encrypt: false });
102
- }
103
- removeEnvLocal(key) {
104
- dotenvx.set(key, '', { path: const_1.ENV_LOCAL_PATH, encrypt: false });
105
- }
106
- removeAIConfigFromMap(envMap) {
107
- Object.keys(envMap)
108
- .filter((x) => x.startsWith('AI_'))
109
- .forEach((x) => this.removeEnvLocal(x));
110
- }
111
- removeSpecificAgentConfig(envMap, agentName) {
112
- const agentPrefix = `AI_${agentName.toUpperCase()}_`;
113
- Object.keys(envMap)
114
- .filter((x) => x.startsWith(agentPrefix))
115
- .forEach((x) => this.removeEnvLocal(x));
116
- }
117
- addAIConfigToEnv(aiConfig) {
118
- return __awaiter(this, void 0, void 0, function* () {
119
- this.setEnvLocal('AI_DEFAULT_AGENT', aiConfig.defaultAgent);
120
- Object.entries(aiConfig.agents).forEach(([agentName, agentConfig]) => {
121
- const upperAgentName = agentName.toUpperCase();
122
- if (agentConfig.apiKey) {
123
- this.setEnvLocal(`AI_${upperAgentName}_API_KEY`, agentConfig.apiKey);
124
- }
125
- if (agentConfig.baseUrl) {
126
- this.setEnvLocal(`AI_${upperAgentName}_BASE_URL`, agentConfig.baseUrl);
127
- }
128
- if (agentConfig.model) {
129
- this.setEnvLocal(`AI_${upperAgentName}_MODEL`, agentConfig.model);
130
- }
131
- });
132
- });
133
- }
134
- }
135
- exports.EnvLocalManager = EnvLocalManager;
136
- function isValidUrl(url) {
137
- try {
138
- new URL(url);
139
- return true;
140
- }
141
- catch (_a) {
142
- return false;
143
- }
144
- }