@cloudbase/cloudbase-mcp 2.17.0 → 2.18.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/README.md +13 -6
- package/dist/341.index.js +92 -2
- package/dist/602.index.cjs +92 -2
- package/dist/cli.cjs +3 -3
- package/dist/index.cjs +257 -432
- package/dist/index.d.ts +3 -0
- package/dist/index.js +256 -430
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -38,7 +38,6 @@ const auth_js_1 = __webpack_require__(7291);
|
|
|
38
38
|
const cloudbase_manager_js_1 = __webpack_require__(3431);
|
|
39
39
|
const logger_js_1 = __webpack_require__(3039);
|
|
40
40
|
const tool_result_js_1 = __webpack_require__(9835);
|
|
41
|
-
const rag_js_1 = __webpack_require__(4215);
|
|
42
41
|
const env_setup_js_1 = __webpack_require__(6978);
|
|
43
42
|
/**
|
|
44
43
|
* Simplify environment list data by keeping only essential fields for AI assistant
|
|
@@ -172,6 +171,7 @@ function formatDeviceAuthHint(deviceAuthInfo) {
|
|
|
172
171
|
if (!deviceAuthInfo) {
|
|
173
172
|
return "";
|
|
174
173
|
}
|
|
174
|
+
const verificationUriComplete = (0, auth_js_1.buildVerificationUriComplete)(deviceAuthInfo);
|
|
175
175
|
const lines = [
|
|
176
176
|
"",
|
|
177
177
|
"### Device Flow 授权信息",
|
|
@@ -180,8 +180,11 @@ function formatDeviceAuthHint(deviceAuthInfo) {
|
|
|
180
180
|
if (deviceAuthInfo.verification_uri) {
|
|
181
181
|
lines.push(`- verification_uri: ${deviceAuthInfo.verification_uri}`);
|
|
182
182
|
}
|
|
183
|
+
if (verificationUriComplete) {
|
|
184
|
+
lines.push(`- verification_uri_complete: ${verificationUriComplete}`);
|
|
185
|
+
}
|
|
183
186
|
lines.push(`- expires_in: ${deviceAuthInfo.expires_in}s`);
|
|
184
|
-
lines.push("", "
|
|
187
|
+
lines.push("", "请优先向用户展示完整的 `verification_uri_complete`,不要截断或改写 URL。");
|
|
185
188
|
return lines.join("\n");
|
|
186
189
|
}
|
|
187
190
|
function emitDeviceAuthNotice(server, deviceAuthInfo) {
|
|
@@ -495,19 +498,6 @@ async function enrichEnvInfoWithBilling(params) {
|
|
|
495
498
|
return params.result;
|
|
496
499
|
}
|
|
497
500
|
}
|
|
498
|
-
async function getGuidePrompt(server) {
|
|
499
|
-
if (getCurrentIde(server) === "CodeBuddy" ||
|
|
500
|
-
process.env.CLOUDBASE_GUIDE_PROMPT === "false") {
|
|
501
|
-
return "";
|
|
502
|
-
}
|
|
503
|
-
try {
|
|
504
|
-
return await (0, rag_js_1.getClaudePrompt)();
|
|
505
|
-
}
|
|
506
|
-
catch (promptError) {
|
|
507
|
-
(0, logger_js_1.debug)("Failed to get CLAUDE prompt", { error: promptError });
|
|
508
|
-
return "";
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
501
|
function normalizeOptionalToolString(value) {
|
|
512
502
|
return typeof value === "string" && value.trim().length > 0
|
|
513
503
|
? value.trim()
|
|
@@ -620,13 +610,7 @@ function registerEnvTools(server) {
|
|
|
620
610
|
(0, auth_js_1.setPendingAuthProgressState)(info, "device");
|
|
621
611
|
// emitDeviceAuthNotice(server, info);
|
|
622
612
|
};
|
|
623
|
-
const authChallenge = () => deviceAuthInfo
|
|
624
|
-
? {
|
|
625
|
-
user_code: deviceAuthInfo.user_code,
|
|
626
|
-
verification_uri: deviceAuthInfo.verification_uri,
|
|
627
|
-
expires_in: deviceAuthInfo.expires_in,
|
|
628
|
-
}
|
|
629
|
-
: undefined;
|
|
613
|
+
const authChallenge = () => (0, auth_js_1.buildDeviceAuthChallengePayload)(deviceAuthInfo);
|
|
630
614
|
try {
|
|
631
615
|
if (!supportedAuthActions.includes(action)) {
|
|
632
616
|
return (0, tool_result_js_1.buildJsonToolResult)({
|
|
@@ -673,12 +657,8 @@ function registerEnvTools(server) {
|
|
|
673
657
|
current_env_id: null,
|
|
674
658
|
...buildEnvCandidatePayload([]),
|
|
675
659
|
}),
|
|
676
|
-
auth_challenge: authFlowState.status === "PENDING"
|
|
677
|
-
?
|
|
678
|
-
user_code: authFlowState.authChallenge.user_code,
|
|
679
|
-
verification_uri: authFlowState.authChallenge.verification_uri,
|
|
680
|
-
expires_in: authFlowState.authChallenge.expires_in,
|
|
681
|
-
}
|
|
660
|
+
auth_challenge: authFlowState.status === "PENDING"
|
|
661
|
+
? (0, auth_js_1.buildDeviceAuthChallengePayload)(authFlowState.authChallenge)
|
|
682
662
|
: undefined,
|
|
683
663
|
message,
|
|
684
664
|
next_step: authStatus === "REQUIRED"
|
|
@@ -699,11 +679,7 @@ function registerEnvTools(server) {
|
|
|
699
679
|
ok: true,
|
|
700
680
|
code: "AUTH_PENDING",
|
|
701
681
|
message: "设备码授权进行中,请在浏览器中打开 verification_uri 并输入 user_code 完成授权。",
|
|
702
|
-
auth_challenge:
|
|
703
|
-
user_code: authFlowState.authChallenge.user_code,
|
|
704
|
-
verification_uri: authFlowState.authChallenge.verification_uri,
|
|
705
|
-
expires_in: authFlowState.authChallenge.expires_in,
|
|
706
|
-
},
|
|
682
|
+
auth_challenge: (0, auth_js_1.buildDeviceAuthChallengePayload)(authFlowState.authChallenge),
|
|
707
683
|
next_step: (0, tool_result_js_1.buildAuthNextStep)("status", {
|
|
708
684
|
suggestedArgs: { action: "status" },
|
|
709
685
|
}),
|
|
@@ -1166,23 +1142,7 @@ function registerEnvTools(server) {
|
|
|
1166
1142
|
default:
|
|
1167
1143
|
throw new Error(`不支持的查询类型: ${action}`);
|
|
1168
1144
|
}
|
|
1169
|
-
|
|
1170
|
-
// For info action, append CLAUDE.md prompt content (skip for CodeBuddy IDE)
|
|
1171
|
-
const currentIde = server.ide || process.env.INTEGRATION_IDE;
|
|
1172
|
-
if (action === "info" && currentIde !== "CodeBuddy" && process.env.CLOUDBASE_GUIDE_PROMPT !== "false") {
|
|
1173
|
-
try {
|
|
1174
|
-
const promptContent = await (0, rag_js_1.getClaudePrompt)();
|
|
1175
|
-
if (promptContent) {
|
|
1176
|
-
responseText += `\n\n⚠️ 重要提示:后续所有云开发相关的开发工作必须严格遵循以下开发规范和最佳实践:\n\n${promptContent}`;
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
catch (promptError) {
|
|
1180
|
-
(0, logger_js_1.debug)("Failed to get CLAUDE prompt in envQuery", {
|
|
1181
|
-
error: promptError,
|
|
1182
|
-
});
|
|
1183
|
-
// Continue without prompt if fetch fails
|
|
1184
|
-
}
|
|
1185
|
-
}
|
|
1145
|
+
const responseText = JSON.stringify(result, null, 2);
|
|
1186
1146
|
return {
|
|
1187
1147
|
content: [
|
|
1188
1148
|
{
|
|
@@ -1572,7 +1532,7 @@ ${envIdSection}
|
|
|
1572
1532
|
## 环境信息
|
|
1573
1533
|
- 操作系统: ${os_1.default.type()} ${os_1.default.release()}
|
|
1574
1534
|
- Node.js版本: ${process.version}
|
|
1575
|
-
- MCP 版本:${process.env.npm_package_version || "2.
|
|
1535
|
+
- MCP 版本:${process.env.npm_package_version || "2.18.0" || 0}
|
|
1576
1536
|
- 系统架构: ${os_1.default.arch()}
|
|
1577
1537
|
- 时间: ${new Date().toISOString()}
|
|
1578
1538
|
- 请求ID: ${requestId}
|
|
@@ -3279,13 +3239,7 @@ async function throwPendingAuthError() {
|
|
|
3279
3239
|
ok: false,
|
|
3280
3240
|
code: "AUTH_PENDING",
|
|
3281
3241
|
message: authState.lastError || "设备码授权进行中,请先完成登录后再重试当前工具。",
|
|
3282
|
-
auth_challenge: authState.authChallenge
|
|
3283
|
-
? {
|
|
3284
|
-
user_code: authState.authChallenge.user_code,
|
|
3285
|
-
verification_uri: authState.authChallenge.verification_uri,
|
|
3286
|
-
expires_in: authState.authChallenge.expires_in,
|
|
3287
|
-
}
|
|
3288
|
-
: undefined,
|
|
3242
|
+
auth_challenge: (0, auth_js_1.buildDeviceAuthChallengePayload)(authState.authChallenge),
|
|
3289
3243
|
next_step: (0, tool_result_js_1.buildAuthNextStep)("status", {
|
|
3290
3244
|
suggestedArgs: {
|
|
3291
3245
|
action: "status",
|
|
@@ -4291,7 +4245,7 @@ deleteCollection: 删除集合`),
|
|
|
4291
4245
|
// writeNoSqlDatabaseContent
|
|
4292
4246
|
server.registerTool?.("writeNoSqlDatabaseContent", {
|
|
4293
4247
|
title: "修改 NoSQL 数据库数据记录",
|
|
4294
|
-
description: "修改 NoSQL 数据库数据记录。可按 MongoDB updateOne/updateMany 的心智模型理解:部分更新必须使用
|
|
4248
|
+
description: "修改 NoSQL 数据库数据记录。可按 MongoDB updateOne/updateMany 的心智模型理解:部分更新必须使用 `$set`、`$inc`、`$push` 等更新操作符;如果直接传“字段到值的普通对象”这类内容,底层会把它当作替换内容,存在覆盖整条文档的风险。更新嵌套对象中的某个字段时必须使用点号路径,例如把 `address.city` 设为 `shenzhen`;如果把整个 `address` 对象作为 `$set` 的值传入,则整个 `address` 对象会被替换,同级其他字段将丢失。若集合中的角色/档案文档会在前端通过 `db.collection(...).doc(uid)` 读取,请确保文档 `_id` 就是该 `uid`;不要用按 `uid` 条件查询再配合 `upsert=true` 的方式去更新 `users` / `profiles`,否则经常会生成一个不同的 `_id`,导致后续 `doc(uid)` 读取命中不到。",
|
|
4295
4249
|
inputSchema: {
|
|
4296
4250
|
action: zod_1.z
|
|
4297
4251
|
.enum(["insert", "update", "delete"])
|
|
@@ -4312,7 +4266,7 @@ deleteCollection: 删除集合`),
|
|
|
4312
4266
|
update: zod_1.z
|
|
4313
4267
|
.union([zod_1.z.object({}).passthrough(), zod_1.z.string()])
|
|
4314
4268
|
.optional()
|
|
4315
|
-
.describe("更新内容(对象或字符串,推荐对象)(update 操作必填)。按 MongoDB 更新语义传入 MgoUpdate:部分更新请使用
|
|
4269
|
+
.describe("更新内容(对象或字符串,推荐对象)(update 操作必填)。按 MongoDB 更新语义传入 MgoUpdate:部分更新请使用 `$set`、`$inc`、`$unset`、`$push` 等操作符,例如使用 `$set` 更新 `status`;不要直接传“字段到值的普通对象”,否则可能替换整条文档。更新嵌套字段时必须使用点号路径,例如通过 `$set` 更新 `address.city`;不要把整个 `address` 对象作为 `$set` 的值传入,否则会替换整个 `address` 对象。"),
|
|
4316
4270
|
isMulti: zod_1.z
|
|
4317
4271
|
.boolean()
|
|
4318
4272
|
.optional()
|
|
@@ -5363,10 +5317,10 @@ function registerDataModelTools(server) {
|
|
|
5363
5317
|
throw new Error(`不支持的操作类型: ${action}`);
|
|
5364
5318
|
}
|
|
5365
5319
|
});
|
|
5366
|
-
// modifyDataModel -
|
|
5320
|
+
// modifyDataModel - 数据模型写工具(兼容名称,当前仅支持创建)
|
|
5367
5321
|
server.registerTool?.("modifyDataModel", {
|
|
5368
|
-
title: "
|
|
5369
|
-
description: "基于Mermaid classDiagram
|
|
5322
|
+
title: "修改数据模型(当前仅支持创建)",
|
|
5323
|
+
description: "基于Mermaid classDiagram创建数据模型。为保持兼容性,工具名仍为 modifyDataModel;当前仅支持创建新模型,不支持更新现有模型结构。内置异步任务监控,自动轮询直至完成或超时。",
|
|
5370
5324
|
inputSchema: {
|
|
5371
5325
|
mermaidDiagram: zod_1.z.string()
|
|
5372
5326
|
.describe(`Mermaid classDiagram代码,描述数据模型结构。
|
|
@@ -5526,10 +5480,10 @@ classDiagram
|
|
|
5526
5480
|
status: status,
|
|
5527
5481
|
action: action,
|
|
5528
5482
|
message: status === "success"
|
|
5529
|
-
?
|
|
5483
|
+
? `数据模型创建成功,共处理${models.length}个模型`
|
|
5530
5484
|
: status === "init"
|
|
5531
5485
|
? `任务超时,任务ID: ${taskId},请稍后手动查询状态`
|
|
5532
|
-
:
|
|
5486
|
+
: `数据模型创建失败`,
|
|
5533
5487
|
taskResult: statusResult?.Data,
|
|
5534
5488
|
}, null, 2),
|
|
5535
5489
|
},
|
|
@@ -5583,7 +5537,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5583
5537
|
};
|
|
5584
5538
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
5585
5539
|
exports.resolveSkillSearchRoots = resolveSkillSearchRoots;
|
|
5586
|
-
exports.getClaudePrompt = getClaudePrompt;
|
|
5587
5540
|
exports.registerRagTools = registerRagTools;
|
|
5588
5541
|
const adm_zip_1 = __importDefault(__webpack_require__(2872));
|
|
5589
5542
|
const fs = __importStar(__webpack_require__(7932));
|
|
@@ -5592,7 +5545,6 @@ const os = __importStar(__webpack_require__(8116));
|
|
|
5592
5545
|
const path = __importStar(__webpack_require__(2521));
|
|
5593
5546
|
const zod_1 = __webpack_require__(2971);
|
|
5594
5547
|
const cloudbase_manager_js_1 = __webpack_require__(3431);
|
|
5595
|
-
const claude_prompt_js_1 = __webpack_require__(8359);
|
|
5596
5548
|
const json_content_js_1 = __webpack_require__(4365);
|
|
5597
5549
|
const logger_js_1 = __webpack_require__(3039);
|
|
5598
5550
|
// 1. 枚举定义
|
|
@@ -5958,34 +5910,6 @@ async function downloadResources() {
|
|
|
5958
5910
|
});
|
|
5959
5911
|
return resourceDownloadPromise;
|
|
5960
5912
|
}
|
|
5961
|
-
// Get CLAUDE.md prompt content
|
|
5962
|
-
// Priority: 1. From downloaded template, 2. Fallback to embedded constant
|
|
5963
|
-
async function getClaudePrompt() {
|
|
5964
|
-
try {
|
|
5965
|
-
// Try to get from downloaded template
|
|
5966
|
-
const extractDir = await downloadWebTemplate();
|
|
5967
|
-
const claudePath = path.join(extractDir, "CLAUDE.md");
|
|
5968
|
-
try {
|
|
5969
|
-
const content = await fs.readFile(claudePath, "utf8");
|
|
5970
|
-
return content;
|
|
5971
|
-
}
|
|
5972
|
-
catch (error) {
|
|
5973
|
-
// CLAUDE.md not found in template, use fallback
|
|
5974
|
-
(0, logger_js_1.warn)("[getClaudePrompt] CLAUDE.md not found in template, using fallback", {
|
|
5975
|
-
error,
|
|
5976
|
-
path: claudePath,
|
|
5977
|
-
});
|
|
5978
|
-
return claude_prompt_js_1.FALLBACK_CLAUDE_PROMPT;
|
|
5979
|
-
}
|
|
5980
|
-
}
|
|
5981
|
-
catch (error) {
|
|
5982
|
-
// Template download failed, use fallback
|
|
5983
|
-
(0, logger_js_1.warn)("[getClaudePrompt] Template download failed, using fallback", {
|
|
5984
|
-
error,
|
|
5985
|
-
});
|
|
5986
|
-
return claude_prompt_js_1.FALLBACK_CLAUDE_PROMPT;
|
|
5987
|
-
}
|
|
5988
|
-
}
|
|
5989
5913
|
async function registerRagTools(server) {
|
|
5990
5914
|
// 联网搜索
|
|
5991
5915
|
server.registerTool?.("searchWeb", {
|
|
@@ -7199,14 +7123,15 @@ exports.CLOUDRUN_SERVICE_TYPES = ['function', 'container'];
|
|
|
7199
7123
|
exports.CLOUDRUN_ACCESS_TYPES = ['OA', 'PUBLIC', 'MINIAPP', 'VPC'];
|
|
7200
7124
|
// Input schema for queryCloudRun tool
|
|
7201
7125
|
const queryCloudRunInputSchema = {
|
|
7202
|
-
action: zod_1.z.enum(['list', 'detail', 'templates']).describe('查询操作类型:list=获取云托管服务列表(支持分页和筛选),detail
|
|
7126
|
+
action: zod_1.z.enum(['list', 'detail', 'templates', 'getDeployLog']).describe('查询操作类型:list=获取云托管服务列表(支持分页和筛选),detail=查询指定服务的详细信息(包含服务配置和最新部署状态),templates=获取可用的项目模板列表(用于初始化新项目),getDeployLog=获取指定服务最近一次或指定构建的部署日志'),
|
|
7203
7127
|
// List operation parameters
|
|
7204
7128
|
pageSize: zod_1.z.number().min(1).max(100).optional().default(10).describe('分页大小,控制每页返回的服务数量。取值范围:1-100,默认值:10。建议根据网络性能和显示需求调整'),
|
|
7205
7129
|
pageNum: zod_1.z.number().min(1).optional().default(1).describe('页码,用于分页查询。从1开始,默认值:1。配合pageSize使用可实现分页浏览'),
|
|
7206
7130
|
serverName: zod_1.z.string().optional().describe('服务名称筛选条件,支持模糊匹配。例如:输入"test"可匹配"test-service"、"my-test-app"等服务名称。留空则查询所有服务'),
|
|
7207
7131
|
serverType: zod_1.z.enum(exports.CLOUDRUN_SERVICE_TYPES).optional().describe('服务类型筛选条件:function=函数型云托管(仅支持Node.js,有特殊的开发要求和限制,适合简单的API服务),container=容器型服务(推荐使用,支持任意语言和框架如Java/Go/Python/PHP/.NET等,适合大多数应用场景)'),
|
|
7208
|
-
// Detail operation parameters
|
|
7209
|
-
detailServerName: zod_1.z.string().optional().describe('
|
|
7132
|
+
// Detail and log operation parameters
|
|
7133
|
+
detailServerName: zod_1.z.string().optional().describe('要查询详细信息或部署日志的服务名称。当action为detail或getDeployLog时建议提供,必须是已存在的服务名称。可通过list操作获取可用的服务名称列表'),
|
|
7134
|
+
buildId: zod_1.z.number().optional().describe('构建ID,仅在action=getDeployLog时使用。不传时默认返回最近一次部署的构建日志'),
|
|
7210
7135
|
};
|
|
7211
7136
|
// Input schema for manageCloudRun tool
|
|
7212
7137
|
const ManageCloudRunInputSchema = {
|
|
@@ -7314,6 +7239,28 @@ function buildManageCloudRunErrorMessage(action, serverName, error) {
|
|
|
7314
7239
|
}
|
|
7315
7240
|
return `[manageCloudRun/${action}] ${baseMessage}\n建议:${suggestions.join(" ")}`;
|
|
7316
7241
|
}
|
|
7242
|
+
function getCloudRunQueryServerName(input) {
|
|
7243
|
+
return input.detailServerName || input.serverName;
|
|
7244
|
+
}
|
|
7245
|
+
function normalizeProcessLogText(logs) {
|
|
7246
|
+
return logs
|
|
7247
|
+
.map((log) => {
|
|
7248
|
+
if (typeof log === "string") {
|
|
7249
|
+
return log;
|
|
7250
|
+
}
|
|
7251
|
+
if (log && typeof log === "object") {
|
|
7252
|
+
if ("Log" in log && typeof log.Log === "string") {
|
|
7253
|
+
return log.Log;
|
|
7254
|
+
}
|
|
7255
|
+
if ("Text" in log && typeof log.Text === "string") {
|
|
7256
|
+
return log.Text;
|
|
7257
|
+
}
|
|
7258
|
+
return JSON.stringify(log);
|
|
7259
|
+
}
|
|
7260
|
+
return String(log);
|
|
7261
|
+
})
|
|
7262
|
+
.join("\n");
|
|
7263
|
+
}
|
|
7317
7264
|
/**
|
|
7318
7265
|
* Format CloudRun service info for display
|
|
7319
7266
|
*/
|
|
@@ -7328,7 +7275,7 @@ function registerCloudRunTools(server) {
|
|
|
7328
7275
|
// Tool 1: Get CloudRun service information (read operations)
|
|
7329
7276
|
server.registerTool("queryCloudRun", {
|
|
7330
7277
|
title: "查询 CloudRun 服务信息",
|
|
7331
|
-
description: "
|
|
7278
|
+
description: "查询云托管服务信息,支持获取服务列表、查询服务详情、获取可用模板列表和部署日志。返回的服务信息包括服务名称、状态、访问类型、配置详情以及最近部署上下文。",
|
|
7332
7279
|
inputSchema: queryCloudRunInputSchema,
|
|
7333
7280
|
annotations: {
|
|
7334
7281
|
readOnlyHint: true,
|
|
@@ -7377,7 +7324,21 @@ function registerCloudRunTools(server) {
|
|
|
7377
7324
|
};
|
|
7378
7325
|
}
|
|
7379
7326
|
case 'detail': {
|
|
7380
|
-
const serverName = input
|
|
7327
|
+
const serverName = getCloudRunQueryServerName(input);
|
|
7328
|
+
if (!serverName) {
|
|
7329
|
+
return {
|
|
7330
|
+
content: [
|
|
7331
|
+
{
|
|
7332
|
+
type: "text",
|
|
7333
|
+
text: JSON.stringify({
|
|
7334
|
+
success: false,
|
|
7335
|
+
error: "detailServerName or serverName is required for detail action",
|
|
7336
|
+
message: "Please provide detailServerName or serverName."
|
|
7337
|
+
}, null, 2)
|
|
7338
|
+
}
|
|
7339
|
+
]
|
|
7340
|
+
};
|
|
7341
|
+
}
|
|
7381
7342
|
const result = await cloudrunService.detail({ serverName });
|
|
7382
7343
|
if (!result) {
|
|
7383
7344
|
return {
|
|
@@ -7393,6 +7354,30 @@ function registerCloudRunTools(server) {
|
|
|
7393
7354
|
]
|
|
7394
7355
|
};
|
|
7395
7356
|
}
|
|
7357
|
+
let latestDeploy = null;
|
|
7358
|
+
let deployRecordsWarning;
|
|
7359
|
+
let message;
|
|
7360
|
+
try {
|
|
7361
|
+
const deployRecords = await cloudrunService.getDeployRecords({ serverName });
|
|
7362
|
+
latestDeploy = deployRecords?.DeployRecords?.[0] ?? null;
|
|
7363
|
+
if (!latestDeploy) {
|
|
7364
|
+
message = `Retrieved details for service '${serverName}'. No deploy records found yet.`;
|
|
7365
|
+
}
|
|
7366
|
+
else if (typeof latestDeploy.Status === 'string' && latestDeploy.Status.includes('failed')) {
|
|
7367
|
+
message = `Service '${serverName}' latest deploy failed. Please use queryCloudRun(action="getDeployLog") for details.`;
|
|
7368
|
+
}
|
|
7369
|
+
else if (typeof latestDeploy.Status === 'string' && latestDeploy.Status.includes('creating')) {
|
|
7370
|
+
message = `Service '${serverName}' latest deploy is still running. Please check again later or query the deploy log for progress.`;
|
|
7371
|
+
}
|
|
7372
|
+
else {
|
|
7373
|
+
message = `Retrieved details for service '${serverName}'. Latest service status: ${result.BaseInfo?.Status || 'unknown'}, latest deploy status: ${latestDeploy.Status || 'unknown'}.`;
|
|
7374
|
+
}
|
|
7375
|
+
}
|
|
7376
|
+
catch (error) {
|
|
7377
|
+
const baseMessage = error instanceof Error ? error.message : String(error);
|
|
7378
|
+
deployRecordsWarning = `Failed to fetch deploy records: ${baseMessage}`;
|
|
7379
|
+
message = `Retrieved details for service '${serverName}', but deploy records are currently unavailable.`;
|
|
7380
|
+
}
|
|
7396
7381
|
return {
|
|
7397
7382
|
content: [
|
|
7398
7383
|
{
|
|
@@ -7400,9 +7385,11 @@ function registerCloudRunTools(server) {
|
|
|
7400
7385
|
text: JSON.stringify({
|
|
7401
7386
|
success: true,
|
|
7402
7387
|
data: {
|
|
7403
|
-
service: result
|
|
7388
|
+
service: result,
|
|
7389
|
+
latestDeploy,
|
|
7390
|
+
...(deployRecordsWarning ? { deployRecordsWarning } : {})
|
|
7404
7391
|
},
|
|
7405
|
-
message
|
|
7392
|
+
message
|
|
7406
7393
|
}, null, 2)
|
|
7407
7394
|
}
|
|
7408
7395
|
]
|
|
@@ -7425,6 +7412,79 @@ function registerCloudRunTools(server) {
|
|
|
7425
7412
|
]
|
|
7426
7413
|
};
|
|
7427
7414
|
}
|
|
7415
|
+
case 'getDeployLog': {
|
|
7416
|
+
const serverName = getCloudRunQueryServerName(input);
|
|
7417
|
+
if (!serverName) {
|
|
7418
|
+
return {
|
|
7419
|
+
content: [
|
|
7420
|
+
{
|
|
7421
|
+
type: "text",
|
|
7422
|
+
text: JSON.stringify({
|
|
7423
|
+
success: false,
|
|
7424
|
+
error: "detailServerName or serverName is required for getDeployLog action",
|
|
7425
|
+
message: "Please provide detailServerName or serverName."
|
|
7426
|
+
}, null, 2)
|
|
7427
|
+
}
|
|
7428
|
+
]
|
|
7429
|
+
};
|
|
7430
|
+
}
|
|
7431
|
+
const deployRecords = await cloudrunService.getDeployRecords({ serverName });
|
|
7432
|
+
const latestDeploy = deployRecords?.DeployRecords?.[0];
|
|
7433
|
+
if (!latestDeploy) {
|
|
7434
|
+
return {
|
|
7435
|
+
content: [
|
|
7436
|
+
{
|
|
7437
|
+
type: "text",
|
|
7438
|
+
text: JSON.stringify({
|
|
7439
|
+
success: false,
|
|
7440
|
+
error: `Service '${serverName}' has no deploy records.`,
|
|
7441
|
+
message: "Please deploy the service first, then query the deploy log again."
|
|
7442
|
+
}, null, 2)
|
|
7443
|
+
}
|
|
7444
|
+
]
|
|
7445
|
+
};
|
|
7446
|
+
}
|
|
7447
|
+
const buildId = input.buildId ?? latestDeploy.BuildId;
|
|
7448
|
+
const buildLogResult = await cloudrunService.getBuildLog({
|
|
7449
|
+
serverName,
|
|
7450
|
+
buildId,
|
|
7451
|
+
});
|
|
7452
|
+
let processLogs = [];
|
|
7453
|
+
let processLogsWarning;
|
|
7454
|
+
if (latestDeploy.RunId && typeof cloudrunService.getProcessLog === 'function') {
|
|
7455
|
+
try {
|
|
7456
|
+
const processLogResult = await cloudrunService.getProcessLog({
|
|
7457
|
+
RunId: latestDeploy.RunId,
|
|
7458
|
+
});
|
|
7459
|
+
processLogs = processLogResult?.Logs || [];
|
|
7460
|
+
}
|
|
7461
|
+
catch (error) {
|
|
7462
|
+
processLogsWarning = error instanceof Error ? error.message : String(error);
|
|
7463
|
+
}
|
|
7464
|
+
}
|
|
7465
|
+
const buildLogText = typeof buildLogResult?.Log?.Text === 'string' ? buildLogResult.Log.Text : '';
|
|
7466
|
+
const processLogText = Array.isArray(processLogs) && processLogs.length > 0 ? normalizeProcessLogText(processLogs) : '';
|
|
7467
|
+
const combinedLogText = [buildLogText, processLogText].filter(Boolean).join('\n');
|
|
7468
|
+
return {
|
|
7469
|
+
content: [
|
|
7470
|
+
{
|
|
7471
|
+
type: "text",
|
|
7472
|
+
text: JSON.stringify({
|
|
7473
|
+
success: true,
|
|
7474
|
+
data: {
|
|
7475
|
+
buildId,
|
|
7476
|
+
deployRecord: latestDeploy,
|
|
7477
|
+
buildLog: buildLogResult?.Log || null,
|
|
7478
|
+
processLogs,
|
|
7479
|
+
combinedLogText,
|
|
7480
|
+
...(processLogsWarning ? { processLogsWarning } : {})
|
|
7481
|
+
},
|
|
7482
|
+
message: `Retrieved deploy log for service '${serverName}'`
|
|
7483
|
+
}, null, 2)
|
|
7484
|
+
}
|
|
7485
|
+
]
|
|
7486
|
+
};
|
|
7487
|
+
}
|
|
7428
7488
|
default:
|
|
7429
7489
|
throw new Error(`Unsupported action: ${input.action}`);
|
|
7430
7490
|
}
|
|
@@ -7692,6 +7752,7 @@ for await (let x of res.textStream) {
|
|
|
7692
7752
|
name: input.serverName
|
|
7693
7753
|
}
|
|
7694
7754
|
};
|
|
7755
|
+
const consoleUrl = `https://tcb.cloud.tencent.com/dev?envId=${currentEnvId}#/platform-run/service/detail?serverName=${input.serverName}&tabId=overview&envId=${currentEnvId}`;
|
|
7695
7756
|
try {
|
|
7696
7757
|
fs_1.default.writeFileSync(cloudbasercPath, JSON.stringify(cloudbasercContent, null, 2));
|
|
7697
7758
|
}
|
|
@@ -7735,8 +7796,6 @@ for await (let x of res.textStream) {
|
|
|
7735
7796
|
}
|
|
7736
7797
|
// Extract project name from targetPath
|
|
7737
7798
|
const projectName = path_1.default.basename(targetPath);
|
|
7738
|
-
// Build console URL
|
|
7739
|
-
const consoleUrl = `https://tcb.cloud.tencent.com/dev?envId=${currentEnvId}#/platform-run/service/detail?serverName=${input.serverName}&tabId=overview&envId=${currentEnvId}`;
|
|
7740
7799
|
// Send notification
|
|
7741
7800
|
await (0, notification_js_1.sendDeployNotification)(server, {
|
|
7742
7801
|
deployType: 'cloudrun',
|
|
@@ -7758,12 +7817,13 @@ for await (let x of res.textStream) {
|
|
|
7758
7817
|
success: true,
|
|
7759
7818
|
data: {
|
|
7760
7819
|
serviceName: input.serverName,
|
|
7761
|
-
status: '
|
|
7820
|
+
status: 'deploying',
|
|
7762
7821
|
deployPath: targetPath,
|
|
7763
7822
|
serverType: serverType,
|
|
7764
|
-
cloudbasercGenerated: true
|
|
7823
|
+
cloudbasercGenerated: true,
|
|
7824
|
+
consoleUrl
|
|
7765
7825
|
},
|
|
7766
|
-
message: `
|
|
7826
|
+
message: `Triggered deployment for ${serverType} service '${input.serverName}' from ${targetPath}. You can follow the progress in ${consoleUrl}`
|
|
7767
7827
|
}, null, 2)
|
|
7768
7828
|
}
|
|
7769
7829
|
]
|
|
@@ -8671,7 +8731,7 @@ class TelemetryReporter {
|
|
|
8671
8731
|
const nodeVersion = process.version; // Node.js版本
|
|
8672
8732
|
const arch = os_1.default.arch(); // 系统架构
|
|
8673
8733
|
// 从构建时注入的版本号获取MCP版本信息
|
|
8674
|
-
const mcpVersion = process.env.npm_package_version || "2.
|
|
8734
|
+
const mcpVersion = process.env.npm_package_version || "2.18.0" || 0;
|
|
8675
8735
|
return {
|
|
8676
8736
|
userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
|
|
8677
8737
|
deviceId: this.deviceId,
|
|
@@ -8962,6 +9022,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
8962
9022
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
8963
9023
|
exports.MANAGE_FUNCTION_ACTIONS = exports.QUERY_FUNCTION_ACTIONS = exports.TRIGGER_CONFIG_EXAMPLES = exports.SUPPORTED_TRIGGER_TYPES = exports.DEFAULT_NODEJS_RUNTIME = exports.SUPPORTED_NODEJS_RUNTIMES = exports.RECOMMENDED_RUNTIMES = exports.DEFAULT_RUNTIME = exports.ALL_SUPPORTED_RUNTIMES = exports.SUPPORTED_RUNTIMES = void 0;
|
|
8964
9024
|
exports.formatRuntimeList = formatRuntimeList;
|
|
9025
|
+
exports.validateTimerCron = validateTimerCron;
|
|
8965
9026
|
exports.shouldInstallDependencyForFunction = shouldInstallDependencyForFunction;
|
|
8966
9027
|
exports.resolveEventFunctionRuntime = resolveEventFunctionRuntime;
|
|
8967
9028
|
exports.buildFunctionOperationErrorMessage = buildFunctionOperationErrorMessage;
|
|
@@ -9065,12 +9126,32 @@ const VPC_SCHEMA = zod_1.z.object({
|
|
|
9065
9126
|
vpcId: zod_1.z.string(),
|
|
9066
9127
|
subnetId: zod_1.z.string(),
|
|
9067
9128
|
});
|
|
9129
|
+
const SEVEN_FIELD_CRON_REGEX = /^\s*\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s+\S+\s*$/;
|
|
9130
|
+
function validateTimerCron(config) {
|
|
9131
|
+
const trimmed = config.trim();
|
|
9132
|
+
const fields = trimmed.split(/\s+/);
|
|
9133
|
+
if (fields.length === 5) {
|
|
9134
|
+
throw new Error(`timer 触发器的 cron 表达式必须使用 7 段格式(秒 分 时 日 月 星期 年),不支持标准 5 段格式。` +
|
|
9135
|
+
`\n收到 5 段: "${trimmed}"` +
|
|
9136
|
+
`\n正确示例: "0 */5 * * * * *"(每 5 分钟执行),"0 0 2 1 * * *"(每月 1 号 2 点)`);
|
|
9137
|
+
}
|
|
9138
|
+
if (fields.length < 7) {
|
|
9139
|
+
throw new Error(`timer 触发器的 cron 表达式必须使用 7 段格式(秒 分 时 日 月 星期 年),当前只有 ${fields.length} 段。` +
|
|
9140
|
+
`\n正确示例: "0 */5 * * * * *"(每 5 分钟执行),"0 0 2 1 * * *"(每月 1 号 2 点)`);
|
|
9141
|
+
}
|
|
9142
|
+
return trimmed;
|
|
9143
|
+
}
|
|
9068
9144
|
const TRIGGER_SCHEMA = zod_1.z.object({
|
|
9069
9145
|
name: zod_1.z.string().describe("触发器名称"),
|
|
9070
9146
|
type: zod_1.z.enum(exports.SUPPORTED_TRIGGER_TYPES).describe("触发器类型"),
|
|
9071
9147
|
config: zod_1.z
|
|
9072
9148
|
.string()
|
|
9073
|
-
.describe("
|
|
9149
|
+
.describe("触发器配置。timer 必须使用 CloudBase 7 段 cron 格式:秒 分 时 日 月 星期 年。" +
|
|
9150
|
+
"⚠️ 不支持标准 5 段 cron(如 */5 * * * * 是错误的)。" +
|
|
9151
|
+
"正确示例:0 */5 * * * * *(每5分钟)、0 0 2 1 * * *(每月1号2点)、0 30 9 * * * *(每天9:30)")
|
|
9152
|
+
.refine((val) => SEVEN_FIELD_CRON_REGEX.test(val), {
|
|
9153
|
+
message: "timer 触发器的 cron 表达式必须使用 7 段格式(秒 分 时 日 月 星期 年),不支持 5 段格式。正确示例:0 */5 * * * * *",
|
|
9154
|
+
}),
|
|
9074
9155
|
});
|
|
9075
9156
|
const CREATE_FUNCTION_SCHEMA = zod_1.z.object({
|
|
9076
9157
|
name: zod_1.z.string().describe("函数名称"),
|
|
@@ -9733,6 +9814,12 @@ function registerFunctionTools(server) {
|
|
|
9733
9814
|
if (!input.triggers?.length) {
|
|
9734
9815
|
throw new Error("createFunctionTrigger 操作时,triggers 参数是必需的");
|
|
9735
9816
|
}
|
|
9817
|
+
// Validate timer cron format before sending to CloudBase
|
|
9818
|
+
for (const trigger of input.triggers) {
|
|
9819
|
+
if (trigger.type === "timer") {
|
|
9820
|
+
validateTimerCron(trigger.config);
|
|
9821
|
+
}
|
|
9822
|
+
}
|
|
9736
9823
|
const cloudbase = await getManager();
|
|
9737
9824
|
const result = await cloudbase.functions.createFunctionTriggers(input.functionName, input.triggers);
|
|
9738
9825
|
(0, cloudbase_manager_js_1.logCloudBaseResult)(server.logger, result);
|
|
@@ -9964,10 +10051,13 @@ function registerFunctionTools(server) {
|
|
|
9964
10051
|
.enum(exports.MANAGE_FUNCTION_ACTIONS)
|
|
9965
10052
|
.describe("写操作类型,例如 createFunction、invokeFunction、attachLayer"),
|
|
9966
10053
|
func: CREATE_FUNCTION_SCHEMA.optional().describe("createFunction 操作的函数配置"),
|
|
9967
|
-
functionRootPath: zod_1.z.string().optional().describe("
|
|
10054
|
+
functionRootPath: zod_1.z.string().optional().describe("创建或更新函数代码时默认推荐的本地目录方式。函数根目录(父目录绝对路径)。" +
|
|
10055
|
+
"本地应按 cloudfunctions/<functionName>/index.js 布局," +
|
|
10056
|
+
"此参数传 cloudfunctions 目录的绝对路径(如 /abs/path/cloudfunctions),不要传到函数名子目录。" +
|
|
10057
|
+
"SDK 会自动拼接函数名子目录,无需预先压缩 zip 或 base64 编码。"),
|
|
9968
10058
|
force: zod_1.z.boolean().optional().describe("createFunction 时是否覆盖"),
|
|
9969
10059
|
functionName: zod_1.z.string().optional().describe("函数名称。大多数 action 使用该字段作为统一目标"),
|
|
9970
|
-
zipFile: zod_1.z.string().optional().describe("
|
|
10060
|
+
zipFile: zod_1.z.string().optional().describe("仅兼容特殊场景:预先准备好的代码包 base64 编码。普通 createFunction/updateFunctionCode 默认不要先压缩 zip,优先使用 functionRootPath。"),
|
|
9971
10061
|
handler: zod_1.z.string().optional().describe("函数入口"),
|
|
9972
10062
|
timeout: zod_1.z.number().optional().describe("配置更新时的超时时间"),
|
|
9973
10063
|
envVariables: zod_1.z.record(zod_1.z.string()).optional().describe("配置更新时要合并的环境变量"),
|
|
@@ -11040,7 +11130,7 @@ function registerSetupTools(server) {
|
|
|
11040
11130
|
title: "下载项目模板",
|
|
11041
11131
|
description: `自动下载并部署CloudBase项目模板。⚠️ **MANDATORY FOR NEW PROJECTS** ⚠️
|
|
11042
11132
|
|
|
11043
|
-
**CRITICAL**: This tool MUST be called FIRST when starting a new project.\n\n支持的模板:\n- react: React + CloudBase 全栈应用模板\n- vue: Vue + CloudBase 全栈应用模板\n- miniprogram: 微信小程序 + 云开发模板 \n- uniapp: UniApp + CloudBase 跨端应用模板\n- rules: 只包含AI编辑器配置文件(包含Cursor、WindSurf、CodeBuddy等所有主流编辑器配置),适合在已有项目中补充AI编辑器配置\n\n支持的IDE类型:\n- all: 下载所有IDE配置\n- cursor: Cursor AI编辑器\n- 其他IDE类型见下方列表\n\n注意:如果未传入 ide 参数且无法从环境变量检测到 IDE,将提示错误并要求传入 ide 参数\n- windsurf: WindSurf AI编辑器\n- codebuddy: CodeBuddy AI编辑器\n- claude-code: Claude Code AI编辑器\n- cline: Cline AI编辑器\n- gemini-cli: Gemini CLI\n- opencode: OpenCode AI编辑器\n- qwen-code: 通义灵码\n- baidu-comate: 百度Comate\n- openai-codex-cli: OpenAI Codex CLI\n- augment-code: Augment Code\n- github-copilot: GitHub Copilot\n- roocode: RooCode AI编辑器\n- tongyi-lingma: 通义灵码\n- trae: Trae AI编辑器\n- qoder: Qoder AI编辑器\n- antigravity: Google Antigravity AI编辑器\n- vscode: Visual Studio Code\n- kiro: Kiro AI编辑器\n- aider: Aider AI编辑器\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "2.
|
|
11133
|
+
**CRITICAL**: This tool MUST be called FIRST when starting a new project.\n\n支持的模板:\n- react: React + CloudBase 全栈应用模板\n- vue: Vue + CloudBase 全栈应用模板\n- miniprogram: 微信小程序 + 云开发模板 \n- uniapp: UniApp + CloudBase 跨端应用模板\n- rules: 只包含AI编辑器配置文件(包含Cursor、WindSurf、CodeBuddy等所有主流编辑器配置),适合在已有项目中补充AI编辑器配置\n\n支持的IDE类型:\n- all: 下载所有IDE配置\n- cursor: Cursor AI编辑器\n- 其他IDE类型见下方列表\n\n注意:如果未传入 ide 参数且无法从环境变量检测到 IDE,将提示错误并要求传入 ide 参数\n- windsurf: WindSurf AI编辑器\n- codebuddy: CodeBuddy AI编辑器\n- claude-code: Claude Code AI编辑器\n- cline: Cline AI编辑器\n- gemini-cli: Gemini CLI\n- opencode: OpenCode AI编辑器\n- qwen-code: 通义灵码\n- baidu-comate: 百度Comate\n- openai-codex-cli: OpenAI Codex CLI\n- augment-code: Augment Code\n- github-copilot: GitHub Copilot\n- roocode: RooCode AI编辑器\n- tongyi-lingma: 通义灵码\n- trae: Trae AI编辑器\n- qoder: Qoder AI编辑器\n- antigravity: Google Antigravity AI编辑器\n- vscode: Visual Studio Code\n- kiro: Kiro AI编辑器\n- aider: Aider AI编辑器\n\n特别说明:\n- rules 模板会自动包含当前 mcp 版本号信息(版本号:${ true ? "2.18.0" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
|
|
11044
11134
|
inputSchema: {
|
|
11045
11135
|
template: zod_1.z
|
|
11046
11136
|
.enum(["react", "vue", "miniprogram", "uniapp", "rules"])
|
|
@@ -12253,6 +12343,8 @@ function registerHostingTools(server) {
|
|
|
12253
12343
|
|
|
12254
12344
|
|
|
12255
12345
|
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
12346
|
+
exports.buildVerificationUriComplete = buildVerificationUriComplete;
|
|
12347
|
+
exports.buildDeviceAuthChallengePayload = buildDeviceAuthChallengePayload;
|
|
12256
12348
|
exports.getAuthProgressStateSync = getAuthProgressStateSync;
|
|
12257
12349
|
exports.getAuthProgressState = getAuthProgressState;
|
|
12258
12350
|
exports.resolveAuthOptions = resolveAuthOptions;
|
|
@@ -12281,6 +12373,54 @@ function normalizeOptionalString(value) {
|
|
|
12281
12373
|
const trimmed = value.trim();
|
|
12282
12374
|
return trimmed.length > 0 ? trimmed : undefined;
|
|
12283
12375
|
}
|
|
12376
|
+
function buildVerificationUriComplete(deviceAuthInfo) {
|
|
12377
|
+
const explicitComplete = normalizeOptionalString(deviceAuthInfo?.verification_uri_complete);
|
|
12378
|
+
if (explicitComplete) {
|
|
12379
|
+
return explicitComplete;
|
|
12380
|
+
}
|
|
12381
|
+
const verificationUri = normalizeOptionalString(deviceAuthInfo?.verification_uri);
|
|
12382
|
+
const userCode = normalizeOptionalString(deviceAuthInfo?.user_code);
|
|
12383
|
+
if (!verificationUri || !userCode) {
|
|
12384
|
+
return undefined;
|
|
12385
|
+
}
|
|
12386
|
+
try {
|
|
12387
|
+
const url = new URL(verificationUri);
|
|
12388
|
+
const hash = url.hash.startsWith("#") ? url.hash.slice(1) : url.hash;
|
|
12389
|
+
if (hash) {
|
|
12390
|
+
const [hashPath, hashQuery = ""] = hash.split("?");
|
|
12391
|
+
const hashParams = new URLSearchParams(hashQuery);
|
|
12392
|
+
if (!hashParams.has("user_code")) {
|
|
12393
|
+
hashParams.set("user_code", userCode);
|
|
12394
|
+
}
|
|
12395
|
+
url.hash = hashParams.toString()
|
|
12396
|
+
? `#${hashPath}?${hashParams.toString()}`
|
|
12397
|
+
: `#${hashPath}`;
|
|
12398
|
+
return url.toString();
|
|
12399
|
+
}
|
|
12400
|
+
if (!url.searchParams.has("user_code")) {
|
|
12401
|
+
url.searchParams.set("user_code", userCode);
|
|
12402
|
+
}
|
|
12403
|
+
return url.toString();
|
|
12404
|
+
}
|
|
12405
|
+
catch {
|
|
12406
|
+
if (verificationUri.includes("user_code=")) {
|
|
12407
|
+
return verificationUri;
|
|
12408
|
+
}
|
|
12409
|
+
const separator = verificationUri.includes("?") ? "&" : "?";
|
|
12410
|
+
return `${verificationUri}${separator}user_code=${encodeURIComponent(userCode)}`;
|
|
12411
|
+
}
|
|
12412
|
+
}
|
|
12413
|
+
function buildDeviceAuthChallengePayload(deviceAuthInfo) {
|
|
12414
|
+
if (!deviceAuthInfo) {
|
|
12415
|
+
return undefined;
|
|
12416
|
+
}
|
|
12417
|
+
return {
|
|
12418
|
+
user_code: deviceAuthInfo.user_code,
|
|
12419
|
+
verification_uri: deviceAuthInfo.verification_uri,
|
|
12420
|
+
verification_uri_complete: buildVerificationUriComplete(deviceAuthInfo),
|
|
12421
|
+
expires_in: deviceAuthInfo.expires_in,
|
|
12422
|
+
};
|
|
12423
|
+
}
|
|
12284
12424
|
function normalizeAuthMode(value) {
|
|
12285
12425
|
return value === "web" || value === "device" ? value : undefined;
|
|
12286
12426
|
}
|
|
@@ -12567,322 +12707,6 @@ module.exports = __WEBPACK_EXTERNAL_MODULE_fs_promises_f8dae9d1__;
|
|
|
12567
12707
|
|
|
12568
12708
|
module.exports = __WEBPACK_EXTERNAL_MODULE_os__;
|
|
12569
12709
|
|
|
12570
|
-
/***/ }),
|
|
12571
|
-
|
|
12572
|
-
/***/ 8359:
|
|
12573
|
-
/***/ ((__unused_webpack_module, exports) => {
|
|
12574
|
-
|
|
12575
|
-
|
|
12576
|
-
Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|
12577
|
-
exports.FALLBACK_CLAUDE_PROMPT = void 0;
|
|
12578
|
-
// Fallback CLAUDE.md prompt content
|
|
12579
|
-
// This is used when template download fails or CLAUDE.md is not found in the template
|
|
12580
|
-
exports.FALLBACK_CLAUDE_PROMPT = `---
|
|
12581
|
-
description: CloudBase AI Development Rules Guide - Provides scenario-based best practices to ensure development quality
|
|
12582
|
-
globs: *
|
|
12583
|
-
alwaysApply: true
|
|
12584
|
-
---
|
|
12585
|
-
|
|
12586
|
-
# CloudBase AI Development Rules Guide
|
|
12587
|
-
|
|
12588
|
-
## Quick Reference for AI
|
|
12589
|
-
|
|
12590
|
-
**⚠️ CRITICAL: Read this section first based on your project type**
|
|
12591
|
-
|
|
12592
|
-
### When Developing a Web Project:
|
|
12593
|
-
1. **Environment Check**: Query environment info only when the task actually needs environment metadata, deployment, or an env ID. For existing applications with active TODOs or unfinished handlers, do not spend turns on hosting or domain queries unless the user explicitly asks for deployment.
|
|
12594
|
-
1. **Execution Mode for Existing-Code Tasks**: If the task is to complete an existing application, wire TODO logic, or repair a broken flow, do **not** enter design-only, brainstorming-only, or spec-only flows first. Gather only the minimum context needed, then implement directly. Do not stop after “project exploration complete”.
|
|
12595
|
-
1. **Existing File Focus (MANDATORY)**: For an existing Web app with active pages or TODO-bearing files, do not broad-scan the whole repo before coding. First inspect only the task-critical files: \`src/lib/backend.*\`, \`src/lib/auth.*\`, \`src/lib/cms-service.*\`, \`src/lib/storage-service.*\`, and the page/components that already consume those APIs. Then implement those TODOs before doing any wide repo exploration.
|
|
12596
|
-
1. **Task Tool Discipline**: For targeted repair tasks, do not spend many turns in \`TaskCreate\`, \`TaskUpdate\`, or project-management loops. At most keep one short checklist. After that, write code. Do not let task-management consume the turn budget.
|
|
12597
|
-
1. **No README / UI-Design Detour For Existing Apps**: If the repo already contains the target pages and only backend TODOs are missing, skip README-driven discovery and skip UI-design workflows unless the task explicitly asks for a visual redesign. Backend wiring is the priority.
|
|
12598
|
-
1. **No Broad Grep / Glob Sweep**: In targeted repair tasks, do not recursively Grep / Glob the whole repo for long periods. Open the known TODO-bearing files directly and start editing.
|
|
12599
|
-
3. **⚠️ UI Design (CRITICAL)**: **MUST read \`rules/ui-design/rule.md\` FIRST before generating any page, interface, component, or style** - This is NOT optional. You MUST explicitly read this file and output the design specification before writing any UI code.
|
|
12600
|
-
4. **Core Capabilities**: Read Core Capabilities section below (especially UI Design and Database + Authentication for Web)
|
|
12601
|
-
5. **Platform Rules**: Read \`rules/web-development/rule.md\` for platform-specific rules (SDK integration, static hosting, build configuration)
|
|
12602
|
-
6. **Authentication**: Read \`rules/auth-web/rule.md\` - **MUST use Web SDK built-in authentication**
|
|
12603
|
-
- \`accessKey\` can only be a real Publishable Key obtained from CloudBase auth/app config. Never use \`envId\`, a username, or any placeholder string as \`accessKey\`.
|
|
12604
|
-
- If you do not have a real Publishable Key yet, do not fabricate one. First query or configure auth readiness, or initialize without \`accessKey\` if the login flow itself is what will establish end-user identity.
|
|
12605
|
-
7. **Cloud Storage (when files are uploaded from browser code)**: Read \`rules/cloud-storage-web/rule.md\` before implementing upload / preview / temp URL flows. For local dev origins (for example Vite on \`127.0.0.1\` / \`localhost\`), query current security domains first and compare against the returned whitelist entry format (usually \`host:port\`, such as \`127.0.0.1:4173\` or \`localhost:5173\`). If \`envQuery(action="domains")\` reports missing local entries or returns a \`next_step\`, execute that \`envDomainManagement\` step before relying on \`app.uploadFile()\`. After upload, do not handcraft a storage URL from \`envId\`, bucket domain, or \`cloudPath\`; resolve an actual browser-usable URL through \`app.getTempFileURL()\` using the returned \`fileID\`.
|
|
12606
|
-
7. **Database**:
|
|
12607
|
-
- NoSQL: \`rules/no-sql-web-sdk/rule.md\`
|
|
12608
|
-
- MySQL: \`rules/relational-database-web/rule.md\` + \`rules/relational-database-mcp/rule.md\`
|
|
12609
|
-
|
|
12610
|
-
### When Developing a Mini Program Project:
|
|
12611
|
-
1. **Environment Check**: Call \`envQuery\` tool first (applies to all interactions)
|
|
12612
|
-
2. **⚠️ UI Design (CRITICAL)**: **MUST read \`rules/ui-design/rule.md\` FIRST before generating any page, interface, component, or style** - This is NOT optional. You MUST explicitly read this file and output the design specification before writing any UI code.
|
|
12613
|
-
3. **Core Capabilities**: Read Core Capabilities section below (especially UI Design and Database + Authentication for Mini Program)
|
|
12614
|
-
4. **Platform Rules**: Read \`rules/miniprogram-development/rule.md\` for platform-specific rules (project structure, WeChat Developer Tools, wx.cloud usage)
|
|
12615
|
-
5. **Authentication**: Read \`rules/auth-wechat/rule.md\` - **Naturally login-free, get OPENID in cloud functions**
|
|
12616
|
-
6. **Database**:
|
|
12617
|
-
- NoSQL: \`rules/no-sql-wx-mp-sdk/rule.md\`
|
|
12618
|
-
- MySQL: \`rules/relational-database-mcp/rule.md\` (via MCP tools)
|
|
12619
|
-
|
|
12620
|
-
---
|
|
12621
|
-
|
|
12622
|
-
## Core Capabilities (Must Be Done Well)
|
|
12623
|
-
|
|
12624
|
-
As the most important part of application development, the following four core capabilities must be done well, without needing to read different rules for different platforms:
|
|
12625
|
-
|
|
12626
|
-
### 1. ⚠️ UI Design (CRITICAL - Highest Priority)
|
|
12627
|
-
**⚠️ MANDATORY: Must strictly follow \`rules/ui-design/rule.md\` rules for ALL design work**
|
|
12628
|
-
|
|
12629
|
-
**🚨 CRITICAL ENFORCEMENT: You MUST explicitly read the file \`rules/ui-design/rule.md\` before generating ANY UI code. This is NOT a suggestion - it is a MANDATORY requirement.**
|
|
12630
|
-
|
|
12631
|
-
**Before generating ANY page, interface, component, or style:**
|
|
12632
|
-
1. **MUST FIRST explicitly read \`rules/ui-design/rule.md\` file** - Use file reading tools to read this file, do NOT skip this step
|
|
12633
|
-
2. **MUST complete design specification output** before writing any code:
|
|
12634
|
-
- Purpose Statement
|
|
12635
|
-
- Aesthetic Direction (choose from specific options, NOT generic terms)
|
|
12636
|
-
- Color Palette (with hex codes, avoid forbidden colors)
|
|
12637
|
-
- Typography (specific font names, avoid forbidden fonts)
|
|
12638
|
-
- Layout Strategy (asymmetric/creative approach, avoid centered templates)
|
|
12639
|
-
3. **MUST ensure** generated interfaces have distinctive aesthetic styles and high-quality visual design
|
|
12640
|
-
4. **MUST avoid** generic AI aesthetics (common fonts, clichéd color schemes, templated designs)
|
|
12641
|
-
|
|
12642
|
-
**This applies to ALL tasks involving:**
|
|
12643
|
-
- Page generation
|
|
12644
|
-
- Interface creation
|
|
12645
|
-
- Component design
|
|
12646
|
-
- Style/visual effects
|
|
12647
|
-
- Any frontend visual elements
|
|
12648
|
-
|
|
12649
|
-
**⚠️ VIOLATION DETECTION: If you find yourself writing UI code without first reading \`rules/ui-design/rule.md\`, STOP immediately and read the file first.**
|
|
12650
|
-
|
|
12651
|
-
### 2. Database + Authentication
|
|
12652
|
-
**Strengthen database and authentication capabilities**
|
|
12653
|
-
|
|
12654
|
-
**Authentication**:
|
|
12655
|
-
- **Web Projects**:
|
|
12656
|
-
- Must use CloudBase Web SDK built-in authentication, refer to \`rules/auth-web/rule.md\`
|
|
12657
|
-
- For username-style accounts, use \`auth.signUp({ username, password })\` and \`auth.signInWithPassword({ username, password })\`
|
|
12658
|
-
- Do not use email-only helpers or email-only input semantics when the account identifier is a plain username string
|
|
12659
|
-
- When an existing schema or fixture already provides role/profile metadata in \`users\`, \`profiles\`, or \`user_roles\`, reuse that collection instead of inventing yet another one. In role-based content-management flows, a \`user_roles\` collection keyed by \`uid\` is an acceptable and validated pattern.
|
|
12660
|
-
- For browser-side file upload / preview flows, read \`rules/cloud-storage-web/rule.md\`; on local dev origins, verify the required local host entries (for example \`127.0.0.1:4173\`, \`localhost:5173\`) are already in the environment security-domain whitelist before depending on \`app.uploadFile()\`. If \`envQuery(action="domains")\` returns missing local entries or a \`next_step\`, execute that \`envDomainManagement\` action first. After upload, use \`app.getTempFileURL()\` to resolve the preview/download URL instead of constructing a URL string manually.
|
|
12661
|
-
- Platform development rules: Refer to \`rules/web-development/rule.md\` for Web SDK integration, static hosting deployment, and build configuration
|
|
12662
|
-
- **Mini Program Projects**:
|
|
12663
|
-
- Naturally login-free, get \`wxContext.OPENID\` in cloud functions, refer to \`rules/auth-wechat/rule.md\`
|
|
12664
|
-
- Platform development rules: Refer to \`rules/miniprogram-development/rule.md\` for mini program project structure, WeChat Developer Tools integration, and CloudBase capabilities
|
|
12665
|
-
- **Node.js Backend**: Refer to \`rules/auth-nodejs/rule.md\`
|
|
12666
|
-
|
|
12667
|
-
**Database Operations**:
|
|
12668
|
-
- **Web Projects**:
|
|
12669
|
-
- NoSQL Database: Refer to \`rules/no-sql-web-sdk/rule.md\`
|
|
12670
|
-
- For content collections that only need owner-only writes, simple permissions such as \`READONLY\` can be a good fit. But for CMS-style collections that require **app-level admin users** to edit/delete any record while editors can only edit/delete their own records, a \`CUSTOM\` rule is expected.
|
|
12671
|
-
- A validated CMS article rule shape is: \`{"read":"auth.uid != null","create":"auth.uid != null","update":"auth.uid != null && (get('database.user_roles.' + auth.uid).role == 'admin' || doc.authorId == auth.uid)","delete":"auth.uid != null && (get('database.user_roles.' + auth.uid).role == 'admin' || doc.authorId == auth.uid)"}\`.
|
|
12672
|
-
- For that CMS pattern, frontend writes can stay on \`.doc(id).update()\` / \`.doc(id).remove()\`. Do not force a \`where(...)\` rewrite unless the task explicitly requires a different rule design.
|
|
12673
|
-
- MySQL Relational Database: Refer to \`rules/relational-database-web/rule.md\` (Web application development) and \`rules/relational-database-mcp/rule.md\` (Management via MCP tools)
|
|
12674
|
-
- Platform development rules: Refer to \`rules/web-development/rule.md\` for Web SDK database integration patterns
|
|
12675
|
-
- **Mini Program Projects**:
|
|
12676
|
-
- NoSQL Database: Refer to \`rules/no-sql-wx-mp-sdk/rule.md\`
|
|
12677
|
-
- MySQL Relational Database: Refer to \`rules/relational-database-mcp/rule.md\` (via MCP tools)
|
|
12678
|
-
- Platform development rules: Refer to \`rules/miniprogram-development/rule.md\` for mini program database integration and wx.cloud usage
|
|
12679
|
-
- **Data Model Creation** (Universal): Refer to \`rules/data-model-creation/rule.md\`
|
|
12680
|
-
|
|
12681
|
-
### 3. Static Hosting Deployment (Web)
|
|
12682
|
-
**Refer to deployment process in \`rules/web-development/rule.md\`**
|
|
12683
|
-
- Use CloudBase static hosting after build completion
|
|
12684
|
-
- Deploy using \`uploadFiles\` tool
|
|
12685
|
-
- \`uploadFiles\` is only for static hosting deployment; do not use it for COS / cloud storage uploads. For storage objects, use \`manageStorage(action="upload")\`
|
|
12686
|
-
- If the task is local verification or an unfinished application repair with a dev server workflow, skip static hosting deployment unless the user explicitly asks for a deployed URL
|
|
12687
|
-
- Remind users that CDN has a few minutes of cache after deployment
|
|
12688
|
-
- Generate markdown format access links with random queryString
|
|
12689
|
-
|
|
12690
|
-
### 4. Backend Deployment (Cloud Functions or CloudRun)
|
|
12691
|
-
**Refer to \`rules/cloudrun-development/rule.md\`**
|
|
12692
|
-
- **Cloud Function Deployment**: Prefer \`queryFunctions\` to inspect current state, then use \`manageFunctions\` with \`action="createFunction"\` or \`action="updateFunctionCode"\`.
|
|
12693
|
-
- In agent / non-interactive runs, treat \`manageFunctions\` as the default deployment path for both Event and HTTP functions; do not fall back to CLI login flows unless MCP tools are unavailable.
|
|
12694
|
-
- For HTTP functions, create or update them through \`manageFunctions\` with \`func.type="HTTP"\` instead of relying on \`tcb fn deploy\` as the primary path.
|
|
12695
|
-
- **CloudRun Deployment**: Use \`manageCloudRun\` tool for containerized deployment
|
|
12696
|
-
- Ensure backend code supports CORS, prepare Dockerfile (for container type)
|
|
12697
|
-
|
|
12698
|
-
## Development Process Standards
|
|
12699
|
-
|
|
12700
|
-
**Important: To ensure development quality, AI must complete the following steps before starting work:**
|
|
12701
|
-
|
|
12702
|
-
### 0. Environment Check (First Step)
|
|
12703
|
-
After user inputs any content, first check CloudBase environment status:
|
|
12704
|
-
- Ensure current CloudBase environment ID is known
|
|
12705
|
-
- If not present in conversation history and the task needs env metadata or deployment, call \`envQuery\` tool with parameter \`action=info\` to query current environment information and environment ID
|
|
12706
|
-
- **Important**: When environment ID configuration is involved in code later, automatically use the queried environment ID, no need for manual user input
|
|
12707
|
-
|
|
12708
|
-
### 1. Scenario Identification
|
|
12709
|
-
Identify current development scenario type, mainly for understanding project type, but core capabilities apply to all projects:
|
|
12710
|
-
- **Web Projects**: React/Vue/native JS frontend projects
|
|
12711
|
-
- **WeChat Mini Programs**: Mini program CloudBase projects
|
|
12712
|
-
- **CloudRun Projects**: CloudBase Run backend service projects (supports any language: Java/Go/Python/Node.js/PHP/.NET, etc.)
|
|
12713
|
-
- **Database Related**: Projects involving data operations
|
|
12714
|
-
- **UI Design/Interface Generation**: Projects requiring interface design, page generation, prototype creation, component design, etc.
|
|
12715
|
-
|
|
12716
|
-
### 2. Platform-Specific Quick Guide
|
|
12717
|
-
|
|
12718
|
-
**Web Projects - Required Rule Files:**
|
|
12719
|
-
- \`rules/web-development/rule.md\` - Platform development rules (SDK integration, static hosting, build configuration)
|
|
12720
|
-
- \`rules/auth-web/rule.md\` - Authentication (MUST use Web SDK built-in authentication)
|
|
12721
|
-
- \`rules/no-sql-web-sdk/rule.md\` - NoSQL database operations
|
|
12722
|
-
- \`rules/relational-database-web/rule.md\` - MySQL database operations (Web)
|
|
12723
|
-
- \`rules/relational-database-mcp/rule.md\` - MySQL database management (MCP tools)
|
|
12724
|
-
- \`rules/cloudbase-platform/rule.md\` - Universal CloudBase platform knowledge
|
|
12725
|
-
|
|
12726
|
-
**Mini Program Projects - Required Rule Files:**
|
|
12727
|
-
- \`rules/miniprogram-development/rule.md\` - Platform development rules (project structure, WeChat Developer Tools, wx.cloud)
|
|
12728
|
-
- \`rules/auth-wechat/rule.md\` - Authentication (naturally login-free, get OPENID in cloud functions)
|
|
12729
|
-
- \`rules/no-sql-wx-mp-sdk/rule.md\` - NoSQL database operations
|
|
12730
|
-
- \`rules/relational-database-mcp/rule.md\` - MySQL database operations (via MCP tools)
|
|
12731
|
-
- \`rules/cloudbase-platform/rule.md\` - Universal CloudBase platform knowledge
|
|
12732
|
-
|
|
12733
|
-
**Universal Rule Files (All Projects):**
|
|
12734
|
-
- **⚠️ \`rules/ui-design/rule.md\`** - **MANDATORY - HIGHEST PRIORITY** - Must read FIRST before any UI/page/component/style generation
|
|
12735
|
-
- \`rules/data-model-creation/rule.md\` - Data model creation and MySQL modeling
|
|
12736
|
-
- \`rules/spec-workflow/rule.md\` - Standard software engineering process (if needed)
|
|
12737
|
-
|
|
12738
|
-
### 3. Development Confirmation
|
|
12739
|
-
Before starting work, suggest confirming with user:
|
|
12740
|
-
1. "I identify this as a [scenario type] project"
|
|
12741
|
-
2. "I will strictly follow core capability requirements and refer to relevant rule files"
|
|
12742
|
-
3. "Please confirm if my understanding is correct"
|
|
12743
|
-
|
|
12744
|
-
## Core Behavior Rules
|
|
12745
|
-
0. **Existing-Code Completion Bias**: For existing applications with TODOs or broken flows, implementation is the goal. Do not hand off to a design-only phase, do not stop at exploration, and do not treat a summary of findings as task completion. After minimal context gathering, write code and wire the real backend flow.
|
|
12746
|
-
0. **No Broad Exploration For TODO Apps**: When the repo already exposes TODO markers in backend integration files, do not keep globbing, summarizing, or reading unrelated files. Open the TODO-bearing files and implement them.
|
|
12747
|
-
0. **No Task-Loop Derailment**: In targeted repair tasks, avoid repeated \`TaskCreate\` / \`TaskUpdate\` cycles. One minimal checklist is enough; the rest of the budget should go to file edits, tool calls, and verification.
|
|
12748
|
-
0. **Do Not Delegate Or Defer**: In targeted repair tasks, do not invoke design copilots, brainstorming helpers, or delegated agent flows before the core TODO files are implemented. Finish the direct file edits first.
|
|
12749
|
-
1. **Tool Priority**: For Tencent CloudBase operations, must prioritize using CloudBase MCP tools
|
|
12750
|
-
2. **Project Understanding**: First read current project's README.md, follow project instructions for development. Exception: for existing applications where the missing work is clearly in known backend integration files, skip README-first and go straight to those files.
|
|
12751
|
-
4. **Directory Standards**: Before outputting project code in current directory, first check current directory files
|
|
12752
|
-
5. **Development Order**: When developing, prioritize frontend first, then backend, ensuring frontend interface and interaction logic are completed first, then implement backend business logic
|
|
12753
|
-
6. **⚠️ UI Design Rules Mandatory Application**: When tasks involve generating pages, interfaces, components, styles, or any frontend visual elements, **MUST FIRST explicitly read the file \`rules/ui-design/rule.md\` using file reading tools**, then strictly follow the rule file, ensuring generated interfaces have distinctive aesthetic styles and high-quality visual design, avoiding generic AI aesthetics. **You MUST output the design specification before writing any UI code.** Exception: for existing applications where page structure is already fixed and only backend integration is missing, do not trigger the UI-design workflow.
|
|
12754
|
-
7. **Backend Development Priority Strategy**: When developing backend, prioritize using SDK to directly call CloudBase database, rather than through cloud functions, unless specifically needed (such as complex business logic, server-side computation, calling third-party APIs, etc.)
|
|
12755
|
-
8. **Deployment Order**: When there are backend dependencies, prioritize deploying backend before previewing frontend
|
|
12756
|
-
9. **Interactive Confirmation**: Clarify requirements when needed, and confirm before executing high-risk operations
|
|
12757
|
-
10. **Real-time Communication**: Use CloudBase real-time database watch capability
|
|
12758
|
-
11. **⚠️ Authentication Rules**: When users develop projects, if user login authentication is needed, must use built-in authentication functions, must strictly distinguish authentication methods by platform
|
|
12759
|
-
- **Web Projects**: **MUST use CloudBase Web SDK built-in authentication** (e.g., \`auth.toDefaultLoginPage()\`), refer to \`rules/auth-web/rule.md\`
|
|
12760
|
-
- **Username-style Web accounts**: Use \`auth.signUp({ username, password })\` for registration and \`auth.signInWithPassword({ username, password })\` for login. Do not use \`signInWithEmailAndPassword\` / \`signUpWithEmailAndPassword\` when the identifier is not an email address.
|
|
12761
|
-
- **Web initialization**: Only set \`accessKey\` when you have a real Publishable Key. Never set \`accessKey: envId\` or any made-up string.
|
|
12762
|
-
- **Mini Program Projects**: **Naturally login-free**, get \`wxContext.OPENID\` in cloud functions, refer to \`rules/auth-wechat/rule.md\`
|
|
12763
|
-
|
|
12764
|
-
## Development Workflow
|
|
12765
|
-
|
|
12766
|
-
### Development
|
|
12767
|
-
|
|
12768
|
-
1. **Project Bootstrap Discipline**:
|
|
12769
|
-
- Prefer the existing project structure and scripts when they already exist
|
|
12770
|
-
- For new projects, keep the initial structure consistent and avoid mixing unrelated frameworks in one workspace
|
|
12771
|
-
- If you bootstrap or copy an existing starter manually, hidden files and project config must be carried over as well
|
|
12772
|
-
|
|
12773
|
-
2. **⚠️ UI Design Document Reading (MANDATORY)**:
|
|
12774
|
-
- **Before generating ANY page, interface, component, or style, MUST FIRST explicitly read the file \`rules/ui-design/rule.md\` using file reading tools**
|
|
12775
|
-
- **MUST output the design specification** (Purpose Statement, Aesthetic Direction, Color Palette, Typography, Layout Strategy) before writing any UI code
|
|
12776
|
-
- This is NOT optional - you MUST read the file and follow the design thinking framework and frontend aesthetics guidelines
|
|
12777
|
-
- Avoid generating generic AI aesthetic style interfaces
|
|
12778
|
-
|
|
12779
|
-
3. **Mini Program TabBar Material Download - Download Remote Material Links**: Mini program Tabbar and other material images must use **png** format, must use downloadRemoteFile tool to download files locally. Can select from Unsplash, wikimedia (generally choose 500 size), Pexels, Apple official UI and other resources
|
|
12780
|
-
|
|
12781
|
-
If remote links are needed in the application, can continue to call uploadFile to upload and obtain temporary access links and cloud storage cloudId
|
|
12782
|
-
|
|
12783
|
-
3. **Query Professional Knowledge from Knowledge Base**: If uncertain about any CloudBase knowledge, can use searchKnowledgeBase tool to intelligently search CloudBase knowledge base (supports CloudBase and cloud functions, mini program frontend knowledge, etc.), quickly obtain professional documents and answers through vector search
|
|
12784
|
-
|
|
12785
|
-
4. **WeChat Developer Tools Open Project Workflow**:
|
|
12786
|
-
- When detecting current project is a mini program project, suggest user to use WeChat Developer Tools for preview, debugging, and publishing
|
|
12787
|
-
- Before opening, confirm project.config.json has appid field configured. If not configured, must ask user to provide it
|
|
12788
|
-
- Use WeChat Developer built-in CLI command to open project (pointing to directory containing project.config.json):
|
|
12789
|
-
- Windows: \`"C:\\Program Files (x86)\\Tencent\\微信web开发者工具\\cli.bat" open --project "项目根目录路径"\`
|
|
12790
|
-
- macOS: \`/Applications/wechatwebdevtools.app/Contents/MacOS/cli open --project "/path/to/project/root"\`
|
|
12791
|
-
- Project root directory path is the directory containing project.config.json file
|
|
12792
|
-
|
|
12793
|
-
### Deployment Process
|
|
12794
|
-
|
|
12795
|
-
1. **Cloud Function Deployment Process**: Prefer \`queryFunctions\` to query current functions, then call \`manageFunctions\` with \`action="createFunction"\` or \`action="updateFunctionCode"\` to deploy cloud function code. In agent / non-interactive runs, keep deployment on MCP tools instead of CLI login flows. For HTTP functions, set \`func.type="HTTP"\` when creating them. Only need to point \`functionRootPath\` to the parent directory of the cloud function directory (for example, the absolute path of the \`cloudfunctions\` directory). No need for code compression or other preprocessing.
|
|
12796
|
-
|
|
12797
|
-
2. **CloudRun Deployment Process**: For non-cloud function backend services (Java, Go, PHP, Python, Node.js, etc.), use manageCloudRun tool for deployment. Ensure backend code supports CORS, prepare Dockerfile, then call manageCloudRun for containerized deployment. For details, refer to \`rules/cloudrun-development/rule.md\`
|
|
12798
|
-
|
|
12799
|
-
3. **Static Hosting Deployment Process**: Deploy using uploadFiles tool for static hosting only. If the task needs a COS object that must be queried or polled with the storage SDK, use \`manageStorage\` / \`queryStorage\` instead. For local verification or unfinished application repairs, do not deploy hosting unless the user explicitly asks for deployment. After deployment, remind users that CDN has a few minutes of cache. Can generate markdown format access links with random queryString. For details, refer to \`rules/web-development/rule.md\`
|
|
12800
|
-
|
|
12801
|
-
### Documentation Generation Rules
|
|
12802
|
-
|
|
12803
|
-
1. You will generate a README.md file after generating the project, containing basic project information, such as project name, project description. Most importantly, clearly explain the project architecture and involved CloudBase resources, so maintainers can refer to it for modification and maintenance
|
|
12804
|
-
2. After deployment, if it's a web project, can write the official deployment access address in the documentation
|
|
12805
|
-
|
|
12806
|
-
### Configuration File Rules
|
|
12807
|
-
|
|
12808
|
-
1. To help others who don't use AI understand what resources are available, can generate a cloudbaserc.json file after generation
|
|
12809
|
-
|
|
12810
|
-
### MCP Interface Call Rules
|
|
12811
|
-
When calling MCP services, you need to fully understand the data types of all interfaces to be called, as well as return value types. If you're not sure which interface to call, first check the documentation and tool descriptions, then determine which interface and parameters to call based on the documentation and tool descriptions. Do not have incorrect method parameters or parameter type errors.
|
|
12812
|
-
|
|
12813
|
-
For example, many interfaces require a confirm parameter, which is a boolean type. If you don't provide this parameter, or provide incorrect data type, the interface will return an error.
|
|
12814
|
-
|
|
12815
|
-
### Environment ID Auto-Configuration Rules
|
|
12816
|
-
- When generating project configuration files (such as \`cloudbaserc.json\`, \`project.config.json\`, etc.), automatically use the environment ID queried by \`envQuery\`
|
|
12817
|
-
- In code examples involving environment ID, automatically fill in current environment ID, no need for manual user replacement
|
|
12818
|
-
- In deployment and preview related operations, prioritize using already queried environment information
|
|
12819
|
-
|
|
12820
|
-
## Professional Rule File Reference
|
|
12821
|
-
|
|
12822
|
-
**Note**: For detailed information, refer to the specific skill files. This section provides quick reference only.
|
|
12823
|
-
|
|
12824
|
-
### Platform Development Skills
|
|
12825
|
-
- **Web**: \`rules/web-development/rule.md\` - SDK integration, static hosting, build configuration
|
|
12826
|
-
- **Mini Program**: \`rules/miniprogram-development/rule.md\` - Project structure, WeChat Developer Tools, wx.cloud
|
|
12827
|
-
- **CloudRun**: \`rules/cloudrun-development/rule.md\` - Backend deployment (functions/containers)
|
|
12828
|
-
- **Platform (Universal)**: \`rules/cloudbase-platform/rule.md\` - Environment, authentication, services
|
|
12829
|
-
|
|
12830
|
-
### Authentication Skills
|
|
12831
|
-
- **Web**: \`rules/auth-web/rule.md\` - **MUST use Web SDK built-in authentication**
|
|
12832
|
-
- **Mini Program**: \`rules/auth-wechat/rule.md\` - **Naturally login-free, get OPENID in cloud functions**
|
|
12833
|
-
- **Node.js**: \`rules/auth-nodejs/rule.md\`
|
|
12834
|
-
- **HTTP API**: \`rules/auth-http-api/rule.md\`
|
|
12835
|
-
|
|
12836
|
-
### Database Skills
|
|
12837
|
-
- **NoSQL (Web)**: \`rules/no-sql-web-sdk/rule.md\`
|
|
12838
|
-
- **NoSQL (Mini Program)**: \`rules/no-sql-wx-mp-sdk/rule.md\`
|
|
12839
|
-
- **MySQL (Web)**: \`rules/relational-database-web/rule.md\`
|
|
12840
|
-
- **MySQL (MCP)**: \`rules/relational-database-mcp/rule.md\`
|
|
12841
|
-
- **Data Model Creation**: \`rules/data-model-creation/rule.md\`
|
|
12842
|
-
|
|
12843
|
-
### 🎨 ⚠️ UI Design Skill (CRITICAL - Read FIRST)
|
|
12844
|
-
- **\`rules/ui-design/rule.md\`** - **MANDATORY - HIGHEST PRIORITY**
|
|
12845
|
-
- **MUST read FIRST before generating ANY interface/page/component/style**
|
|
12846
|
-
- Design thinking framework, complete design process, frontend aesthetics guidelines
|
|
12847
|
-
- **NO EXCEPTIONS**: All UI work requires reading this file first
|
|
12848
|
-
|
|
12849
|
-
### Workflow Skills
|
|
12850
|
-
- **Spec Workflow**: \`rules/spec-workflow/rule.md\` - Standard software engineering process (requirements, design, tasks)
|
|
12851
|
-
|
|
12852
|
-
## Development Quality Checklist
|
|
12853
|
-
|
|
12854
|
-
To ensure development quality, recommend completing the following checks before starting tasks:
|
|
12855
|
-
|
|
12856
|
-
### Recommended Steps
|
|
12857
|
-
0. **[ ] Environment Check**: Call \`envQuery\` tool to check CloudBase environment status (applies to all interactions)
|
|
12858
|
-
1. **[ ] Scenario Identification**: Clearly identify what type of project this is (Web/Mini Program/Database/UI)
|
|
12859
|
-
3. **[ ] Core Capability Confirmation**: Confirm all four core capabilities have been considered
|
|
12860
|
-
- UI Design: Have you explicitly read the file \`rules/ui-design/rule.md\` using file reading tools?
|
|
12861
|
-
- Database + Authentication: Have you referred to corresponding authentication and database skills?
|
|
12862
|
-
- Static Hosting Deployment: Have you understood the deployment process?
|
|
12863
|
-
- Backend Deployment: Have you understood cloud function or CloudRun deployment process?
|
|
12864
|
-
4. **[ ] UI Design Rules Check (MANDATORY)**: If task involves generating pages, interfaces, components, or styles:
|
|
12865
|
-
- Have you explicitly read the file \`rules/ui-design/rule.md\` using file reading tools? (Required: YES)
|
|
12866
|
-
- Have you output the design specification before writing code? (Required: YES)
|
|
12867
|
-
- Have you understood and will follow the design thinking framework? (Required: YES)
|
|
12868
|
-
5. **[ ] User Confirmation**: Confirm with user whether scenario identification and core capability understanding are correct
|
|
12869
|
-
6. **[ ] Rule Execution**: Strictly follow core capability requirements and relevant rule files for development
|
|
12870
|
-
|
|
12871
|
-
### ⚠️ Common Issues to Avoid
|
|
12872
|
-
- **❌ DO NOT skip reading UI design document** - Must explicitly read \`rules/ui-design/rule.md\` file before generating any UI code
|
|
12873
|
-
- Avoid skipping core capabilities and starting development directly
|
|
12874
|
-
- Avoid mixing APIs and authentication methods from different platforms
|
|
12875
|
-
- Avoid ignoring UI design rules: All tasks involving interfaces, pages, components, styles must explicitly read and strictly follow \`rules/ui-design/rule.md\`
|
|
12876
|
-
- Avoid ignoring database and authentication standards: Must use correct authentication methods and database operation methods
|
|
12877
|
-
- Important technical solutions should be confirmed with users
|
|
12878
|
-
|
|
12879
|
-
### Quality Assurance
|
|
12880
|
-
If development is found to not comply with standards, can:
|
|
12881
|
-
- Point out specific issues
|
|
12882
|
-
- Require re-execution of rule check process
|
|
12883
|
-
- Clearly specify rule files that need to be followed`;
|
|
12884
|
-
|
|
12885
|
-
|
|
12886
12710
|
/***/ }),
|
|
12887
12711
|
|
|
12888
12712
|
/***/ 9097:
|
|
@@ -14785,7 +14609,7 @@ var __webpack_exports__ = {};
|
|
|
14785
14609
|
var exports = __webpack_exports__;
|
|
14786
14610
|
|
|
14787
14611
|
Object.defineProperty(exports, "BJ", ({ value: true }));
|
|
14788
|
-
exports.j8 = exports.fO = exports.gk = exports.Yh = exports.JA = exports.xz = exports.RX = exports.pk = exports.ZS = exports.vY = exports.q8 = exports.bM = exports.fW = exports._k = exports.T$ = exports.$n = exports.S = exports.bT = exports.ri = exports.BS = exports.R8 = exports.z3 = exports.pq = exports.R4 = exports.ps = exports.v7 = exports.S7 = exports.dD = exports.Gh = void 0;
|
|
14612
|
+
exports.Os = exports.j8 = exports.fO = exports.gk = exports.Yh = exports.JA = exports.xz = exports.RX = exports.pk = exports.ZS = exports.vY = exports.q8 = exports.bM = exports.fW = exports._k = exports.T$ = exports.$n = exports.S = exports.bT = exports.ri = exports.BS = exports.R8 = exports.z3 = exports.pq = exports.R4 = exports.ps = exports.v7 = exports.S7 = exports.dD = exports.Gh = void 0;
|
|
14789
14613
|
exports.SJ = getInteractiveServerAsync;
|
|
14790
14614
|
// CloudBase MCP Server Library
|
|
14791
14615
|
var server_js_1 = __webpack_require__(1422);
|
|
@@ -14825,6 +14649,7 @@ Object.defineProperty(exports, "Yh", ({ enumerable: true, get: function () { ret
|
|
|
14825
14649
|
Object.defineProperty(exports, "gk", ({ enumerable: true, get: function () { return functions_js_1.formatRuntimeList; } }));
|
|
14826
14650
|
Object.defineProperty(exports, "fO", ({ enumerable: true, get: function () { return functions_js_1.SUPPORTED_NODEJS_RUNTIMES; } }));
|
|
14827
14651
|
Object.defineProperty(exports, "j8", ({ enumerable: true, get: function () { return functions_js_1.DEFAULT_NODEJS_RUNTIME; } }));
|
|
14652
|
+
Object.defineProperty(exports, "Os", ({ enumerable: true, get: function () { return functions_js_1.validateTimerCron; } }));
|
|
14828
14653
|
/**
|
|
14829
14654
|
* Get interactive server instance (CommonJS compatible)
|
|
14830
14655
|
*/
|
|
@@ -14867,5 +14692,6 @@ const __webpack_exports__resetCloudBaseManagerCache = __webpack_exports__.bM;
|
|
|
14867
14692
|
const __webpack_exports__shouldRegisterTool = __webpack_exports__.T$;
|
|
14868
14693
|
const __webpack_exports__simplifyEnvList = __webpack_exports__.ZS;
|
|
14869
14694
|
const __webpack_exports__telemetryReporter = __webpack_exports__.v7;
|
|
14695
|
+
const __webpack_exports__validateTimerCron = __webpack_exports__.Os;
|
|
14870
14696
|
const __webpack_exports__warn = __webpack_exports__.R8;
|
|
14871
|
-
export { __webpack_exports__ALL_SUPPORTED_RUNTIMES as ALL_SUPPORTED_RUNTIMES, __webpack_exports__DEFAULT_NODEJS_RUNTIME as DEFAULT_NODEJS_RUNTIME, __webpack_exports__DEFAULT_RUNTIME as DEFAULT_RUNTIME, __webpack_exports__RAW_IDE_FILE_MAPPINGS as RAW_IDE_FILE_MAPPINGS, __webpack_exports__RECOMMENDED_RUNTIMES as RECOMMENDED_RUNTIMES, __webpack_exports__SUPPORTED_NODEJS_RUNTIMES as SUPPORTED_NODEJS_RUNTIMES, __webpack_exports__SUPPORTED_RUNTIMES as SUPPORTED_RUNTIMES, __webpack_exports__StdioServerTransport as StdioServerTransport, __webpack_exports___esModule as __esModule, __webpack_exports__createCloudBaseManagerWithOptions as createCloudBaseManagerWithOptions, __webpack_exports__createCloudBaseMcpServer as createCloudBaseMcpServer, __webpack_exports__enableCloudMode as enableCloudMode, __webpack_exports__envManager as envManager, __webpack_exports__error as error, __webpack_exports__formatRuntimeList as formatRuntimeList, __webpack_exports__getCloudBaseManager as getCloudBaseManager, __webpack_exports__getCloudModeStatus as getCloudModeStatus, __webpack_exports__getDefaultServer as getDefaultServer, __webpack_exports__getEnvId as getEnvId, __webpack_exports__getInteractiveServerAsync as getInteractiveServerAsync, __webpack_exports__getLoginState as getLoginState, __webpack_exports__info as info, __webpack_exports__isCloudMode as isCloudMode, __webpack_exports__logout as logout, __webpack_exports__reportToolCall as reportToolCall, __webpack_exports__reportToolkitLifecycle as reportToolkitLifecycle, __webpack_exports__resetCloudBaseManagerCache as resetCloudBaseManagerCache, __webpack_exports__shouldRegisterTool as shouldRegisterTool, __webpack_exports__simplifyEnvList as simplifyEnvList, __webpack_exports__telemetryReporter as telemetryReporter, __webpack_exports__warn as warn };
|
|
14697
|
+
export { __webpack_exports__ALL_SUPPORTED_RUNTIMES as ALL_SUPPORTED_RUNTIMES, __webpack_exports__DEFAULT_NODEJS_RUNTIME as DEFAULT_NODEJS_RUNTIME, __webpack_exports__DEFAULT_RUNTIME as DEFAULT_RUNTIME, __webpack_exports__RAW_IDE_FILE_MAPPINGS as RAW_IDE_FILE_MAPPINGS, __webpack_exports__RECOMMENDED_RUNTIMES as RECOMMENDED_RUNTIMES, __webpack_exports__SUPPORTED_NODEJS_RUNTIMES as SUPPORTED_NODEJS_RUNTIMES, __webpack_exports__SUPPORTED_RUNTIMES as SUPPORTED_RUNTIMES, __webpack_exports__StdioServerTransport as StdioServerTransport, __webpack_exports___esModule as __esModule, __webpack_exports__createCloudBaseManagerWithOptions as createCloudBaseManagerWithOptions, __webpack_exports__createCloudBaseMcpServer as createCloudBaseMcpServer, __webpack_exports__enableCloudMode as enableCloudMode, __webpack_exports__envManager as envManager, __webpack_exports__error as error, __webpack_exports__formatRuntimeList as formatRuntimeList, __webpack_exports__getCloudBaseManager as getCloudBaseManager, __webpack_exports__getCloudModeStatus as getCloudModeStatus, __webpack_exports__getDefaultServer as getDefaultServer, __webpack_exports__getEnvId as getEnvId, __webpack_exports__getInteractiveServerAsync as getInteractiveServerAsync, __webpack_exports__getLoginState as getLoginState, __webpack_exports__info as info, __webpack_exports__isCloudMode as isCloudMode, __webpack_exports__logout as logout, __webpack_exports__reportToolCall as reportToolCall, __webpack_exports__reportToolkitLifecycle as reportToolkitLifecycle, __webpack_exports__resetCloudBaseManagerCache as resetCloudBaseManagerCache, __webpack_exports__shouldRegisterTool as shouldRegisterTool, __webpack_exports__simplifyEnvList as simplifyEnvList, __webpack_exports__telemetryReporter as telemetryReporter, __webpack_exports__validateTimerCron as validateTimerCron, __webpack_exports__warn as warn };
|