@cloudbase/cloudbase-mcp 2.17.1 → 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/dist/index.cjs CHANGED
@@ -1902,6 +1902,7 @@ function formatDeviceAuthHint(deviceAuthInfo) {
1902
1902
  if (!deviceAuthInfo) {
1903
1903
  return "";
1904
1904
  }
1905
+ const verificationUriComplete = (0, auth_js_1.buildVerificationUriComplete)(deviceAuthInfo);
1905
1906
  const lines = [
1906
1907
  "",
1907
1908
  "### Device Flow 授权信息",
@@ -1910,8 +1911,11 @@ function formatDeviceAuthHint(deviceAuthInfo) {
1910
1911
  if (deviceAuthInfo.verification_uri) {
1911
1912
  lines.push(`- verification_uri: ${deviceAuthInfo.verification_uri}`);
1912
1913
  }
1914
+ if (verificationUriComplete) {
1915
+ lines.push(`- verification_uri_complete: ${verificationUriComplete}`);
1916
+ }
1913
1917
  lines.push(`- expires_in: ${deviceAuthInfo.expires_in}s`);
1914
- lines.push("", "请在另一台可用浏览器设备打开 `verification_uri` 并输入 `user_code` 完成授权。");
1918
+ lines.push("", "请优先向用户展示完整的 `verification_uri_complete`,不要截断或改写 URL。");
1915
1919
  return lines.join("\n");
1916
1920
  }
1917
1921
  function emitDeviceAuthNotice(server, deviceAuthInfo) {
@@ -2337,13 +2341,7 @@ function registerEnvTools(server) {
2337
2341
  (0, auth_js_1.setPendingAuthProgressState)(info, "device");
2338
2342
  // emitDeviceAuthNotice(server, info);
2339
2343
  };
2340
- const authChallenge = () => deviceAuthInfo
2341
- ? {
2342
- user_code: deviceAuthInfo.user_code,
2343
- verification_uri: deviceAuthInfo.verification_uri,
2344
- expires_in: deviceAuthInfo.expires_in,
2345
- }
2346
- : undefined;
2344
+ const authChallenge = () => (0, auth_js_1.buildDeviceAuthChallengePayload)(deviceAuthInfo);
2347
2345
  try {
2348
2346
  if (!supportedAuthActions.includes(action)) {
2349
2347
  return (0, tool_result_js_1.buildJsonToolResult)({
@@ -2390,12 +2388,8 @@ function registerEnvTools(server) {
2390
2388
  current_env_id: null,
2391
2389
  ...buildEnvCandidatePayload([]),
2392
2390
  }),
2393
- auth_challenge: authFlowState.status === "PENDING" && authFlowState.authChallenge
2394
- ? {
2395
- user_code: authFlowState.authChallenge.user_code,
2396
- verification_uri: authFlowState.authChallenge.verification_uri,
2397
- expires_in: authFlowState.authChallenge.expires_in,
2398
- }
2391
+ auth_challenge: authFlowState.status === "PENDING"
2392
+ ? (0, auth_js_1.buildDeviceAuthChallengePayload)(authFlowState.authChallenge)
2399
2393
  : undefined,
2400
2394
  message,
2401
2395
  next_step: authStatus === "REQUIRED"
@@ -2416,11 +2410,7 @@ function registerEnvTools(server) {
2416
2410
  ok: true,
2417
2411
  code: "AUTH_PENDING",
2418
2412
  message: "设备码授权进行中,请在浏览器中打开 verification_uri 并输入 user_code 完成授权。",
2419
- auth_challenge: {
2420
- user_code: authFlowState.authChallenge.user_code,
2421
- verification_uri: authFlowState.authChallenge.verification_uri,
2422
- expires_in: authFlowState.authChallenge.expires_in,
2423
- },
2413
+ auth_challenge: (0, auth_js_1.buildDeviceAuthChallengePayload)(authFlowState.authChallenge),
2424
2414
  next_step: (0, tool_result_js_1.buildAuthNextStep)("status", {
2425
2415
  suggestedArgs: { action: "status" },
2426
2416
  }),
@@ -24602,13 +24592,7 @@ async function throwPendingAuthError() {
24602
24592
  ok: false,
24603
24593
  code: "AUTH_PENDING",
24604
24594
  message: authState.lastError || "设备码授权进行中,请先完成登录后再重试当前工具。",
24605
- auth_challenge: authState.authChallenge
24606
- ? {
24607
- user_code: authState.authChallenge.user_code,
24608
- verification_uri: authState.authChallenge.verification_uri,
24609
- expires_in: authState.authChallenge.expires_in,
24610
- }
24611
- : undefined,
24595
+ auth_challenge: (0, auth_js_1.buildDeviceAuthChallengePayload)(authState.authChallenge),
24612
24596
  next_step: (0, tool_result_js_1.buildAuthNextStep)("status", {
24613
24597
  suggestedArgs: {
24614
24598
  action: "status",
@@ -89374,13 +89358,13 @@ function registerFunctionTools(server) {
89374
89358
  .enum(exports.MANAGE_FUNCTION_ACTIONS)
89375
89359
  .describe("写操作类型,例如 createFunction、invokeFunction、attachLayer"),
89376
89360
  func: CREATE_FUNCTION_SCHEMA.optional().describe("createFunction 操作的函数配置"),
89377
- functionRootPath: zod_1.z.string().optional().describe("函数根目录(父目录绝对路径)。" +
89361
+ functionRootPath: zod_1.z.string().optional().describe("创建或更新函数代码时默认推荐的本地目录方式。函数根目录(父目录绝对路径)。" +
89378
89362
  "本地应按 cloudfunctions/<functionName>/index.js 布局," +
89379
89363
  "此参数传 cloudfunctions 目录的绝对路径(如 /abs/path/cloudfunctions),不要传到函数名子目录。" +
89380
- "SDK 会自动拼接函数名子目录。"),
89364
+ "SDK 会自动拼接函数名子目录,无需预先压缩 zip 或 base64 编码。"),
89381
89365
  force: zod_1.z.boolean().optional().describe("createFunction 时是否覆盖"),
89382
89366
  functionName: zod_1.z.string().optional().describe("函数名称。大多数 action 使用该字段作为统一目标"),
89383
- zipFile: zod_1.z.string().optional().describe("代码包的 base64 编码"),
89367
+ zipFile: zod_1.z.string().optional().describe("仅兼容特殊场景:预先准备好的代码包 base64 编码。普通 createFunction/updateFunctionCode 默认不要先压缩 zip,优先使用 functionRootPath。"),
89384
89368
  handler: zod_1.z.string().optional().describe("函数入口"),
89385
89369
  timeout: zod_1.z.number().optional().describe("配置更新时的超时时间"),
89386
89370
  envVariables: zod_1.z.record(zod_1.z.string()).optional().describe("配置更新时要合并的环境变量"),
@@ -108450,10 +108434,10 @@ function registerDataModelTools(server) {
108450
108434
  throw new Error(`不支持的操作类型: ${action}`);
108451
108435
  }
108452
108436
  });
108453
- // modifyDataModel - 数据模型修改工具(创建/更新)
108437
+ // modifyDataModel - 数据模型写工具(兼容名称,当前仅支持创建)
108454
108438
  server.registerTool?.("modifyDataModel", {
108455
- title: "修改数据模型",
108456
- description: "基于Mermaid classDiagram创建或更新数据模型。支持创建新模型和更新现有模型结构。内置异步任务监控,自动轮询直至完成或超时。",
108439
+ title: "修改数据模型(当前仅支持创建)",
108440
+ description: "基于Mermaid classDiagram创建数据模型。为保持兼容性,工具名仍为 modifyDataModel;当前仅支持创建新模型,不支持更新现有模型结构。内置异步任务监控,自动轮询直至完成或超时。",
108457
108441
  inputSchema: {
108458
108442
  mermaidDiagram: zod_1.z.string()
108459
108443
  .describe(`Mermaid classDiagram代码,描述数据模型结构。
@@ -108613,10 +108597,10 @@ classDiagram
108613
108597
  status: status,
108614
108598
  action: action,
108615
108599
  message: status === "success"
108616
- ? `数据模型${action === "create" ? "创建" : "更新"}成功,共处理${models.length}个模型`
108600
+ ? `数据模型创建成功,共处理${models.length}个模型`
108617
108601
  : status === "init"
108618
108602
  ? `任务超时,任务ID: ${taskId},请稍后手动查询状态`
108619
- : `数据模型${action === "create" ? "创建" : "更新"}失败`,
108603
+ : `数据模型创建失败`,
108620
108604
  taskResult: statusResult?.Data,
108621
108605
  }, null, 2),
108622
108606
  },
@@ -111843,14 +111827,15 @@ exports.CLOUDRUN_SERVICE_TYPES = ['function', 'container'];
111843
111827
  exports.CLOUDRUN_ACCESS_TYPES = ['OA', 'PUBLIC', 'MINIAPP', 'VPC'];
111844
111828
  // Input schema for queryCloudRun tool
111845
111829
  const queryCloudRunInputSchema = {
111846
- action: zod_1.z.enum(['list', 'detail', 'templates']).describe('查询操作类型:list=获取云托管服务列表(支持分页和筛选),detail=查询指定服务的详细信息(包括配置、版本、访问地址等),templates=获取可用的项目模板列表(用于初始化新项目)'),
111830
+ action: zod_1.z.enum(['list', 'detail', 'templates', 'getDeployLog']).describe('查询操作类型:list=获取云托管服务列表(支持分页和筛选),detail=查询指定服务的详细信息(包含服务配置和最新部署状态),templates=获取可用的项目模板列表(用于初始化新项目),getDeployLog=获取指定服务最近一次或指定构建的部署日志'),
111847
111831
  // List operation parameters
111848
111832
  pageSize: zod_1.z.number().min(1).max(100).optional().default(10).describe('分页大小,控制每页返回的服务数量。取值范围:1-100,默认值:10。建议根据网络性能和显示需求调整'),
111849
111833
  pageNum: zod_1.z.number().min(1).optional().default(1).describe('页码,用于分页查询。从1开始,默认值:1。配合pageSize使用可实现分页浏览'),
111850
111834
  serverName: zod_1.z.string().optional().describe('服务名称筛选条件,支持模糊匹配。例如:输入"test"可匹配"test-service"、"my-test-app"等服务名称。留空则查询所有服务'),
111851
111835
  serverType: zod_1.z.enum(exports.CLOUDRUN_SERVICE_TYPES).optional().describe('服务类型筛选条件:function=函数型云托管(仅支持Node.js,有特殊的开发要求和限制,适合简单的API服务),container=容器型服务(推荐使用,支持任意语言和框架如Java/Go/Python/PHP/.NET等,适合大多数应用场景)'),
111852
- // Detail operation parameters
111853
- detailServerName: zod_1.z.string().optional().describe('要查询详细信息的服务名称。当action为detail时必需提供,必须是已存在的服务名称。可通过list操作获取可用的服务名称列表'),
111836
+ // Detail and log operation parameters
111837
+ detailServerName: zod_1.z.string().optional().describe('要查询详细信息或部署日志的服务名称。当action为detail或getDeployLog时建议提供,必须是已存在的服务名称。可通过list操作获取可用的服务名称列表'),
111838
+ buildId: zod_1.z.number().optional().describe('构建ID,仅在action=getDeployLog时使用。不传时默认返回最近一次部署的构建日志'),
111854
111839
  };
111855
111840
  // Input schema for manageCloudRun tool
111856
111841
  const ManageCloudRunInputSchema = {
@@ -111958,6 +111943,28 @@ function buildManageCloudRunErrorMessage(action, serverName, error) {
111958
111943
  }
111959
111944
  return `[manageCloudRun/${action}] ${baseMessage}\n建议:${suggestions.join(" ")}`;
111960
111945
  }
111946
+ function getCloudRunQueryServerName(input) {
111947
+ return input.detailServerName || input.serverName;
111948
+ }
111949
+ function normalizeProcessLogText(logs) {
111950
+ return logs
111951
+ .map((log) => {
111952
+ if (typeof log === "string") {
111953
+ return log;
111954
+ }
111955
+ if (log && typeof log === "object") {
111956
+ if ("Log" in log && typeof log.Log === "string") {
111957
+ return log.Log;
111958
+ }
111959
+ if ("Text" in log && typeof log.Text === "string") {
111960
+ return log.Text;
111961
+ }
111962
+ return JSON.stringify(log);
111963
+ }
111964
+ return String(log);
111965
+ })
111966
+ .join("\n");
111967
+ }
111961
111968
  /**
111962
111969
  * Format CloudRun service info for display
111963
111970
  */
@@ -111972,7 +111979,7 @@ function registerCloudRunTools(server) {
111972
111979
  // Tool 1: Get CloudRun service information (read operations)
111973
111980
  server.registerTool("queryCloudRun", {
111974
111981
  title: "查询 CloudRun 服务信息",
111975
- description: "查询云托管服务信息,支持获取服务列表、查询服务详情和获取可用模板列表。返回的服务信息包括服务名称、状态、访问类型、配置详情等。",
111982
+ description: "查询云托管服务信息,支持获取服务列表、查询服务详情、获取可用模板列表和部署日志。返回的服务信息包括服务名称、状态、访问类型、配置详情以及最近部署上下文。",
111976
111983
  inputSchema: queryCloudRunInputSchema,
111977
111984
  annotations: {
111978
111985
  readOnlyHint: true,
@@ -112021,7 +112028,21 @@ function registerCloudRunTools(server) {
112021
112028
  };
112022
112029
  }
112023
112030
  case 'detail': {
112024
- const serverName = input.detailServerName || input.serverName;
112031
+ const serverName = getCloudRunQueryServerName(input);
112032
+ if (!serverName) {
112033
+ return {
112034
+ content: [
112035
+ {
112036
+ type: "text",
112037
+ text: JSON.stringify({
112038
+ success: false,
112039
+ error: "detailServerName or serverName is required for detail action",
112040
+ message: "Please provide detailServerName or serverName."
112041
+ }, null, 2)
112042
+ }
112043
+ ]
112044
+ };
112045
+ }
112025
112046
  const result = await cloudrunService.detail({ serverName });
112026
112047
  if (!result) {
112027
112048
  return {
@@ -112037,6 +112058,30 @@ function registerCloudRunTools(server) {
112037
112058
  ]
112038
112059
  };
112039
112060
  }
112061
+ let latestDeploy = null;
112062
+ let deployRecordsWarning;
112063
+ let message;
112064
+ try {
112065
+ const deployRecords = await cloudrunService.getDeployRecords({ serverName });
112066
+ latestDeploy = deployRecords?.DeployRecords?.[0] ?? null;
112067
+ if (!latestDeploy) {
112068
+ message = `Retrieved details for service '${serverName}'. No deploy records found yet.`;
112069
+ }
112070
+ else if (typeof latestDeploy.Status === 'string' && latestDeploy.Status.includes('failed')) {
112071
+ message = `Service '${serverName}' latest deploy failed. Please use queryCloudRun(action="getDeployLog") for details.`;
112072
+ }
112073
+ else if (typeof latestDeploy.Status === 'string' && latestDeploy.Status.includes('creating')) {
112074
+ message = `Service '${serverName}' latest deploy is still running. Please check again later or query the deploy log for progress.`;
112075
+ }
112076
+ else {
112077
+ message = `Retrieved details for service '${serverName}'. Latest service status: ${result.BaseInfo?.Status || 'unknown'}, latest deploy status: ${latestDeploy.Status || 'unknown'}.`;
112078
+ }
112079
+ }
112080
+ catch (error) {
112081
+ const baseMessage = error instanceof Error ? error.message : String(error);
112082
+ deployRecordsWarning = `Failed to fetch deploy records: ${baseMessage}`;
112083
+ message = `Retrieved details for service '${serverName}', but deploy records are currently unavailable.`;
112084
+ }
112040
112085
  return {
112041
112086
  content: [
112042
112087
  {
@@ -112044,9 +112089,11 @@ function registerCloudRunTools(server) {
112044
112089
  text: JSON.stringify({
112045
112090
  success: true,
112046
112091
  data: {
112047
- service: result
112092
+ service: result,
112093
+ latestDeploy,
112094
+ ...(deployRecordsWarning ? { deployRecordsWarning } : {})
112048
112095
  },
112049
- message: `Retrieved details for service '${serverName}'`
112096
+ message
112050
112097
  }, null, 2)
112051
112098
  }
112052
112099
  ]
@@ -112069,6 +112116,79 @@ function registerCloudRunTools(server) {
112069
112116
  ]
112070
112117
  };
112071
112118
  }
112119
+ case 'getDeployLog': {
112120
+ const serverName = getCloudRunQueryServerName(input);
112121
+ if (!serverName) {
112122
+ return {
112123
+ content: [
112124
+ {
112125
+ type: "text",
112126
+ text: JSON.stringify({
112127
+ success: false,
112128
+ error: "detailServerName or serverName is required for getDeployLog action",
112129
+ message: "Please provide detailServerName or serverName."
112130
+ }, null, 2)
112131
+ }
112132
+ ]
112133
+ };
112134
+ }
112135
+ const deployRecords = await cloudrunService.getDeployRecords({ serverName });
112136
+ const latestDeploy = deployRecords?.DeployRecords?.[0];
112137
+ if (!latestDeploy) {
112138
+ return {
112139
+ content: [
112140
+ {
112141
+ type: "text",
112142
+ text: JSON.stringify({
112143
+ success: false,
112144
+ error: `Service '${serverName}' has no deploy records.`,
112145
+ message: "Please deploy the service first, then query the deploy log again."
112146
+ }, null, 2)
112147
+ }
112148
+ ]
112149
+ };
112150
+ }
112151
+ const buildId = input.buildId ?? latestDeploy.BuildId;
112152
+ const buildLogResult = await cloudrunService.getBuildLog({
112153
+ serverName,
112154
+ buildId,
112155
+ });
112156
+ let processLogs = [];
112157
+ let processLogsWarning;
112158
+ if (latestDeploy.RunId && typeof cloudrunService.getProcessLog === 'function') {
112159
+ try {
112160
+ const processLogResult = await cloudrunService.getProcessLog({
112161
+ RunId: latestDeploy.RunId,
112162
+ });
112163
+ processLogs = processLogResult?.Logs || [];
112164
+ }
112165
+ catch (error) {
112166
+ processLogsWarning = error instanceof Error ? error.message : String(error);
112167
+ }
112168
+ }
112169
+ const buildLogText = typeof buildLogResult?.Log?.Text === 'string' ? buildLogResult.Log.Text : '';
112170
+ const processLogText = Array.isArray(processLogs) && processLogs.length > 0 ? normalizeProcessLogText(processLogs) : '';
112171
+ const combinedLogText = [buildLogText, processLogText].filter(Boolean).join('\n');
112172
+ return {
112173
+ content: [
112174
+ {
112175
+ type: "text",
112176
+ text: JSON.stringify({
112177
+ success: true,
112178
+ data: {
112179
+ buildId,
112180
+ deployRecord: latestDeploy,
112181
+ buildLog: buildLogResult?.Log || null,
112182
+ processLogs,
112183
+ combinedLogText,
112184
+ ...(processLogsWarning ? { processLogsWarning } : {})
112185
+ },
112186
+ message: `Retrieved deploy log for service '${serverName}'`
112187
+ }, null, 2)
112188
+ }
112189
+ ]
112190
+ };
112191
+ }
112072
112192
  default:
112073
112193
  throw new Error(`Unsupported action: ${input.action}`);
112074
112194
  }
@@ -112336,6 +112456,7 @@ for await (let x of res.textStream) {
112336
112456
  name: input.serverName
112337
112457
  }
112338
112458
  };
112459
+ const consoleUrl = `https://tcb.cloud.tencent.com/dev?envId=${currentEnvId}#/platform-run/service/detail?serverName=${input.serverName}&tabId=overview&envId=${currentEnvId}`;
112339
112460
  try {
112340
112461
  fs_1.default.writeFileSync(cloudbasercPath, JSON.stringify(cloudbasercContent, null, 2));
112341
112462
  }
@@ -112379,8 +112500,6 @@ for await (let x of res.textStream) {
112379
112500
  }
112380
112501
  // Extract project name from targetPath
112381
112502
  const projectName = path_1.default.basename(targetPath);
112382
- // Build console URL
112383
- const consoleUrl = `https://tcb.cloud.tencent.com/dev?envId=${currentEnvId}#/platform-run/service/detail?serverName=${input.serverName}&tabId=overview&envId=${currentEnvId}`;
112384
112503
  // Send notification
112385
112504
  await (0, notification_js_1.sendDeployNotification)(server, {
112386
112505
  deployType: 'cloudrun',
@@ -112402,12 +112521,13 @@ for await (let x of res.textStream) {
112402
112521
  success: true,
112403
112522
  data: {
112404
112523
  serviceName: input.serverName,
112405
- status: 'deployed',
112524
+ status: 'deploying',
112406
112525
  deployPath: targetPath,
112407
112526
  serverType: serverType,
112408
- cloudbasercGenerated: true
112527
+ cloudbasercGenerated: true,
112528
+ consoleUrl
112409
112529
  },
112410
- message: `Successfully deployed ${serverType} service '${input.serverName}' from ${targetPath}`
112530
+ message: `Triggered deployment for ${serverType} service '${input.serverName}' from ${targetPath}. You can follow the progress in ${consoleUrl}`
112411
112531
  }, null, 2)
112412
112532
  }
112413
112533
  ]
@@ -133564,7 +133684,7 @@ class TelemetryReporter {
133564
133684
  const nodeVersion = process.version; // Node.js版本
133565
133685
  const arch = os_1.default.arch(); // 系统架构
133566
133686
  // 从构建时注入的版本号获取MCP版本信息
133567
- const mcpVersion = process.env.npm_package_version || "2.17.1" || 0;
133687
+ const mcpVersion = process.env.npm_package_version || "2.18.0" || 0;
133568
133688
  return {
133569
133689
  userAgent: `${osType} ${osRelease} ${arch} ${nodeVersion} CloudBase-MCP/${mcpVersion}`,
133570
133690
  deviceId: this.deviceId,
@@ -191431,7 +191551,7 @@ ${envIdSection}
191431
191551
  ## 环境信息
191432
191552
  - 操作系统: ${os_1.default.type()} ${os_1.default.release()}
191433
191553
  - Node.js版本: ${process.version}
191434
- - MCP 版本:${process.env.npm_package_version || "2.17.1" || 0}
191554
+ - MCP 版本:${process.env.npm_package_version || "2.18.0" || 0}
191435
191555
  - 系统架构: ${os_1.default.arch()}
191436
191556
  - 时间: ${new Date().toISOString()}
191437
191557
  - 请求ID: ${requestId}
@@ -205973,7 +206093,7 @@ function registerSetupTools(server) {
205973
206093
  title: "下载项目模板",
205974
206094
  description: `自动下载并部署CloudBase项目模板。⚠️ **MANDATORY FOR NEW PROJECTS** ⚠️
205975
206095
 
205976
- **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.17.1" : 0}),便于后续维护和版本追踪\n- 下载 rules 模板时,如果项目中已存在 README.md 文件,系统会自动保护该文件不被覆盖(除非设置 overwrite=true)`,
206096
+ **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)`,
205977
206097
  inputSchema: {
205978
206098
  template: zod_1.z
205979
206099
  .enum(["react", "vue", "miniprogram", "uniapp", "rules"])
@@ -207265,6 +207385,8 @@ module.exports.sync = path => {
207265
207385
  "use strict";
207266
207386
 
207267
207387
  Object.defineProperty(exports, "__esModule", ({ value: true }));
207388
+ exports.buildVerificationUriComplete = buildVerificationUriComplete;
207389
+ exports.buildDeviceAuthChallengePayload = buildDeviceAuthChallengePayload;
207268
207390
  exports.getAuthProgressStateSync = getAuthProgressStateSync;
207269
207391
  exports.getAuthProgressState = getAuthProgressState;
207270
207392
  exports.resolveAuthOptions = resolveAuthOptions;
@@ -207293,6 +207415,54 @@ function normalizeOptionalString(value) {
207293
207415
  const trimmed = value.trim();
207294
207416
  return trimmed.length > 0 ? trimmed : undefined;
207295
207417
  }
207418
+ function buildVerificationUriComplete(deviceAuthInfo) {
207419
+ const explicitComplete = normalizeOptionalString(deviceAuthInfo?.verification_uri_complete);
207420
+ if (explicitComplete) {
207421
+ return explicitComplete;
207422
+ }
207423
+ const verificationUri = normalizeOptionalString(deviceAuthInfo?.verification_uri);
207424
+ const userCode = normalizeOptionalString(deviceAuthInfo?.user_code);
207425
+ if (!verificationUri || !userCode) {
207426
+ return undefined;
207427
+ }
207428
+ try {
207429
+ const url = new URL(verificationUri);
207430
+ const hash = url.hash.startsWith("#") ? url.hash.slice(1) : url.hash;
207431
+ if (hash) {
207432
+ const [hashPath, hashQuery = ""] = hash.split("?");
207433
+ const hashParams = new URLSearchParams(hashQuery);
207434
+ if (!hashParams.has("user_code")) {
207435
+ hashParams.set("user_code", userCode);
207436
+ }
207437
+ url.hash = hashParams.toString()
207438
+ ? `#${hashPath}?${hashParams.toString()}`
207439
+ : `#${hashPath}`;
207440
+ return url.toString();
207441
+ }
207442
+ if (!url.searchParams.has("user_code")) {
207443
+ url.searchParams.set("user_code", userCode);
207444
+ }
207445
+ return url.toString();
207446
+ }
207447
+ catch {
207448
+ if (verificationUri.includes("user_code=")) {
207449
+ return verificationUri;
207450
+ }
207451
+ const separator = verificationUri.includes("?") ? "&" : "?";
207452
+ return `${verificationUri}${separator}user_code=${encodeURIComponent(userCode)}`;
207453
+ }
207454
+ }
207455
+ function buildDeviceAuthChallengePayload(deviceAuthInfo) {
207456
+ if (!deviceAuthInfo) {
207457
+ return undefined;
207458
+ }
207459
+ return {
207460
+ user_code: deviceAuthInfo.user_code,
207461
+ verification_uri: deviceAuthInfo.verification_uri,
207462
+ verification_uri_complete: buildVerificationUriComplete(deviceAuthInfo),
207463
+ expires_in: deviceAuthInfo.expires_in,
207464
+ };
207465
+ }
207296
207466
  function normalizeAuthMode(value) {
207297
207467
  return value === "web" || value === "device" ? value : undefined;
207298
207468
  }
package/dist/index.d.ts CHANGED
@@ -104,6 +104,7 @@ export declare interface DeleteFileParams {
104
104
  export declare interface DeviceFlowAuthInfo {
105
105
  user_code: string;
106
106
  verification_uri?: string;
107
+ verification_uri_complete?: string;
107
108
  device_code: string;
108
109
  expires_in: number;
109
110
  }