diff --git a/config/source/editor-config/guides/cloudbase-rules.mdc b/config/source/editor-config/guides/cloudbase-rules.mdc index 6833d457..791ed892 100644 --- a/config/source/editor-config/guides/cloudbase-rules.mdc +++ b/config/source/editor-config/guides/cloudbase-rules.mdc @@ -238,6 +238,7 @@ As the most important part of application development, the following four core c - Use CloudBase static hosting after build completion - Deploy using `uploadFiles` tool - `uploadFiles` is for static hosting only; use `manageStorage` / `queryStorage` when the task needs a COS object that must be queried by the storage SDK +- If the site should open from the hosting root domain, set `cloudPath` to `/`; if it should live under `/app` or another subpath, use that exact path and keep asset URLs relative - Remind users that CDN has a few minutes of cache after deployment - Generate markdown format access links with random queryString @@ -366,7 +367,7 @@ If remote links are needed in the application, can continue to call uploadFile t 3. **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` -4. **Static Hosting Deployment Process**: Deploy using uploadFiles tool. 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` +4. **Static Hosting Deployment Process**: Deploy using uploadFiles tool. Use `cloudPath=/` for root-domain deployment, or an explicit subpath such as `/app` when the site should live under a subdirectory; keep asset URLs relative for subpath deployments. 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` ### Documentation Generation Rules diff --git a/config/source/skills/cloudbase-platform/SKILL.md b/config/source/skills/cloudbase-platform/SKILL.md index a6bbfd77..6811642f 100644 --- a/config/source/skills/cloudbase-platform/SKILL.md +++ b/config/source/skills/cloudbase-platform/SKILL.md @@ -143,6 +143,7 @@ Example structure for operation recording: - Static hosting supports custom domain configuration (requires console operation) - Cloud storage is suitable for files with privacy requirements, can get temporary access addresses via temporary file URLs - If the task needs COS SDK polling, file metadata lookup, or temporary URLs for an uploaded object, use cloud storage tools (`manageStorage` / `queryStorage`), not `uploadFiles` + - When deploying a site with `uploadFiles`, set `cloudPath` to `/` if the site should open from the hosting root domain; use the exact subpath (for example `/app`) only when the site should live under that subdirectory, and keep asset URLs relative 2. **Static Hosting Domain**: - CloudBase static hosting domain can be obtained via `getWebsiteConfig` tool diff --git a/doc/mcp-tools.md b/doc/mcp-tools.md index fabbadab..d2431d54 100644 --- a/doc/mcp-tools.md +++ b/doc/mcp-tools.md @@ -1012,7 +1012,7 @@ Manage SQL database resources. Supports MySQL provisioning, MySQL destruction, w --- ### `uploadFiles` -上传文件到静态网站托管,仅用于 Web 站点部署,不用于云存储对象上传。部署前请先完成构建;如果站点会部署到子路径,请检查构建配置中的 publicPath、base、assetPrefix 等是否使用相对路径,避免静态资源加载失败。若需要上传 COS 云存储文件,请使用 manageStorage。对于本地评测、现有脚手架补全或仅需本地开发服务器验证的任务,通常不需要调用此工具,除非用户明确要求部署站点。 +上传文件到静态网站托管,仅用于 Web 站点部署,不用于云存储对象上传。若希望站点直接通过静态托管根域名访问,请将 `cloudPath` 设为 `/`;若部署到 `/app` 等子路径,请同步检查构建配置中的 publicPath、base、assetPrefix 等是否使用相对路径,避免静态资源加载失败。若需要上传 COS 云存储文件,请使用 manageStorage。对于本地评测、现有脚手架补全或仅需本地开发服务器验证的任务,通常不需要调用此工具,除非用户明确要求部署站点。 #### 参数 @@ -1026,7 +1026,7 @@ Manage SQL database resources. Supports MySQL provisioning, MySQL destruction, w { name: "cloudPath", type: "string", - description: `静态托管云端文件或文件夹路径,例如 files/data.txt。若部署到子路径,请同时检查构建配置中的 publicPath、base、assetPrefix 等是否为相对路径。云存储对象路径请改用 manageStorage。`, + description: `静态托管云端文件或文件夹路径,例如 `/`(部署到根域名)、`/app`(部署到子路径)或 `files/data.txt`(上传单文件)。若部署到子路径,请同时检查构建配置中的 publicPath、base、assetPrefix 等是否为相对路径。云存储对象路径请改用 manageStorage。`, }, { name: "files", diff --git a/doc/prompts/cloudbase-platform.mdx b/doc/prompts/cloudbase-platform.mdx index 5482ec98..9da5accc 100644 --- a/doc/prompts/cloudbase-platform.mdx +++ b/doc/prompts/cloudbase-platform.mdx @@ -181,6 +181,7 @@ Example structure for operation recording: - Static hosting supports custom domain configuration (requires console operation) - Cloud storage is suitable for files with privacy requirements, can get temporary access addresses via temporary file URLs - If the task needs COS SDK polling, file metadata lookup, or temporary URLs for an uploaded object, use cloud storage tools (`manageStorage` / `queryStorage`), not `uploadFiles` + - When deploying a site with `uploadFiles`, set `cloudPath` to `/` if the site should open from the hosting root domain; use the exact subpath (for example `/app`) only when the site should live under that subdirectory, and keep asset URLs relative 2. **Static Hosting Domain**: - CloudBase static hosting domain can be obtained via `getWebsiteConfig` tool diff --git a/mcp/AGENTS.md b/mcp/AGENTS.md index 987138f6..3e4a281f 100644 --- a/mcp/AGENTS.md +++ b/mcp/AGENTS.md @@ -226,6 +226,7 @@ As the most important part of application development, the following four core c - Use CloudBase static hosting after build completion - Deploy using `uploadFiles` tool - `uploadFiles` is for static hosting only; use `manageStorage` / `queryStorage` when the task needs a COS object that must be queried by the storage SDK +- If the site should open from the hosting root domain, set `cloudPath` to `/`; if it should live under `/app` or another subpath, use that exact path and keep asset URLs relative - Remind users that CDN has a few minutes of cache after deployment - Generate markdown format access links with random queryString @@ -363,7 +364,7 @@ If remote links are needed in the application, can continue to call uploadFile t 3. **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` -4. **Static Hosting Deployment Process**: Deploy using uploadFiles tool. 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` +4. **Static Hosting Deployment Process**: Deploy using uploadFiles tool. Use `cloudPath=/` for root-domain deployment, or an explicit subpath such as `/app` when the site should live under a subdirectory; keep asset URLs relative for subpath deployments. 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` ### Documentation Generation Rules diff --git a/mcp/CLAUDE.md b/mcp/CLAUDE.md index c3b6835e..23d35085 100644 --- a/mcp/CLAUDE.md +++ b/mcp/CLAUDE.md @@ -215,6 +215,7 @@ As the most important part of application development, the following four core c - Use CloudBase static hosting after build completion - Deploy using `uploadFiles` tool - `uploadFiles` is for static hosting only; use `manageStorage` / `queryStorage` when the task needs a COS object that must be queried by the storage SDK +- If the site should open from the hosting root domain, set `cloudPath` to `/`; if it should live under `/app` or another subpath, use that exact path and keep asset URLs relative - Remind users that CDN has a few minutes of cache after deployment - Generate markdown format access links with random queryString @@ -352,7 +353,7 @@ If remote links are needed in the application, can continue to call uploadFile t 3. **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` -4. **Static Hosting Deployment Process**: Deploy using uploadFiles tool. 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` +4. **Static Hosting Deployment Process**: Deploy using uploadFiles tool. Use `cloudPath=/` for root-domain deployment, or an explicit subpath such as `/app` when the site should live under a subdirectory; keep asset URLs relative for subpath deployments. 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` ### Documentation Generation Rules diff --git a/mcp/CODEBUDDY.md b/mcp/CODEBUDDY.md index 4e14d5f8..de312859 100644 --- a/mcp/CODEBUDDY.md +++ b/mcp/CODEBUDDY.md @@ -188,6 +188,8 @@ As the most important part of application development, the following four core c **Refer to deployment process in `rules/web-development/rule.md`** - Use CloudBase static hosting after build completion - Deploy using `uploadFiles` tool +- `uploadFiles` is for static hosting only; use `manageStorage` / `queryStorage` when the task needs a COS object that must be queried by the storage SDK +- If the site should open from the hosting root domain, set `cloudPath` to `/`; if it should live under `/app` or another subpath, use that exact path and keep asset URLs relative - Remind users that CDN has a few minutes of cache after deployment - Generate markdown format access links with random queryString @@ -319,7 +321,7 @@ If remote links are needed in the application, can continue to call uploadFile t 3. **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` -4. **Static Hosting Deployment Process**: Deploy using uploadFiles tool. 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` +4. **Static Hosting Deployment Process**: Deploy using uploadFiles tool. Use `cloudPath=/` for root-domain deployment, or an explicit subpath such as `/app` when the site should live under a subdirectory; keep asset URLs relative for subpath deployments. 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` ### Documentation Generation Rules diff --git a/mcp/DOC.md b/mcp/DOC.md index 1c478d0d..1d2b0a7a 100644 --- a/mcp/DOC.md +++ b/mcp/DOC.md @@ -13,7 +13,7 @@ - **💻 数据库集合管理**:支持创建、检查存在、更新、获取详细信息、列出集合、检查索引存在、查询数据分布等数据库集合相关操作。 - **📒 数据库文档操作**:可向集合中插入文档、查询文档、更新文档、删除文档。 - **🎯 数据模型查询**:数据模型查询工具,支持查询和列表数据模型(只读操作)。list操作返回基础信息,get操作返回详细信息含简化的Schema(字段列表、格式、关联关系等),docs操作生成SDK使用文档,提供低代码数据模型的查看和使用能力。 -- **🌍 静态托管管理**:实现上传文件到静态网站托管、获取文件列表、删除文件或文件夹、搜索文件、绑定和解绑自定义域名、获取静态网站配置、检查域名配置、修改域名配置等功能。 +- **🌍 静态托管管理**:实现将构建产物部署到静态网站托管(而非上传到 COS 云存储对象)、获取文件列表、删除文件或文件夹、搜索文件、绑定和解绑自定义域名、获取静态网站配置、检查域名配置、修改域名配置等功能。 - **💻临时文件管理**:能在临时目录创建文件,支持文本内容或 base64 编码的二进制内容;读取临时目录中的文件,支持文本和二进制文件。 ## 使用示例 @@ -105,7 +105,7 @@ | 工具标识 | 功能描述 | 核心参数 | |---------------------------|-----------------------------------------|---------------------------------------------------------------------------------------------| -| `uploadFiles` | 上传文件到静态网站托管 | `localPath`(选填,本地文件或文件夹路径),`cloudPath`(选填,云端文件或文件夹路径),`files`(选填,多文件上传配置),`ignore`(选填,忽略文件模式) | +| `uploadFiles` | 部署 Web 站点到静态网站托管(不用于 COS) | `localPath`(选填,本地文件或文件夹路径),`cloudPath`(选填,静态托管云端文件或文件夹路径;根域名部署用 `/`,子路径部署用 `/app`),`files`(选填,多文件上传配置),`ignore`(选填,忽略文件模式) | | `listFiles` | 获取静态网站托管的文件列表 | 无 | | `deleteFiles` | 删除静态网站托管的文件或文件夹 | `cloudPath`(必填,云端文件或文件夹路径),`isDir`(选填,是否为文件夹,默认为 `false`) | | `findFiles` | 搜索静态网站托管的文件 | `prefix`(必填,匹配前缀),`marker`(选填,起始对象键标记),`maxKeys`(选填,单次返回最大条目数) | diff --git a/mcp/IFLOW.md b/mcp/IFLOW.md index c3b6835e..23d35085 100644 --- a/mcp/IFLOW.md +++ b/mcp/IFLOW.md @@ -215,6 +215,7 @@ As the most important part of application development, the following four core c - Use CloudBase static hosting after build completion - Deploy using `uploadFiles` tool - `uploadFiles` is for static hosting only; use `manageStorage` / `queryStorage` when the task needs a COS object that must be queried by the storage SDK +- If the site should open from the hosting root domain, set `cloudPath` to `/`; if it should live under `/app` or another subpath, use that exact path and keep asset URLs relative - Remind users that CDN has a few minutes of cache after deployment - Generate markdown format access links with random queryString @@ -352,7 +353,7 @@ If remote links are needed in the application, can continue to call uploadFile t 3. **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` -4. **Static Hosting Deployment Process**: Deploy using uploadFiles tool. 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` +4. **Static Hosting Deployment Process**: Deploy using uploadFiles tool. Use `cloudPath=/` for root-domain deployment, or an explicit subpath such as `/app` when the site should live under a subdirectory; keep asset URLs relative for subpath deployments. 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` ### Documentation Generation Rules diff --git a/mcp/Intro.md b/mcp/Intro.md index 2468bec4..63422a49 100644 --- a/mcp/Intro.md +++ b/mcp/Intro.md @@ -13,7 +13,7 @@ - **💻 数据库集合管理**:支持创建、检查存在、更新、获取详细信息、列出集合、检查索引存在、查询数据分布等数据库集合相关操作。 - **📒 数据库文档操作**:可向集合中插入文档、查询文档、更新文档、删除文档。 - **🎯 数据模型查询**:数据模型查询工具,支持查询和列表数据模型(只读操作)。list操作返回基础信息,get操作返回详细信息含简化的Schema(字段列表、格式、关联关系等),docs操作生成SDK使用文档,提供低代码数据模型的查看和使用能力。 -- **🌍 静态托管管理**:实现上传文件到静态网站托管、获取文件列表、删除文件或文件夹、搜索文件、绑定和解绑自定义域名、获取静态网站配置、检查域名配置、修改域名配置等功能。 +- **🌍 静态托管管理**:实现将构建产物部署到静态网站托管(而非上传到 COS 云存储对象)、获取文件列表、删除文件或文件夹、搜索文件、绑定和解绑自定义域名、获取静态网站配置、检查域名配置、修改域名配置等功能。 - **💻临时文件管理**:能在临时目录创建文件,支持文本内容或 base64 编码的二进制内容;读取临时目录中的文件,支持文本和二进制文件。 ## 使用示例 @@ -105,7 +105,7 @@ | 工具标识 | 功能描述 | 核心参数 | |---------------------------|-----------------------------------------|---------------------------------------------------------------------------------------------| -| `uploadFiles` | 上传文件到静态网站托管 | `localPath`(选填,本地文件或文件夹路径),`cloudPath`(选填,云端文件或文件夹路径),`files`(选填,多文件上传配置),`ignore`(选填,忽略文件模式) | +| `uploadFiles` | 部署 Web 站点到静态网站托管(不用于 COS) | `localPath`(选填,本地文件或文件夹路径),`cloudPath`(选填,静态托管云端文件或文件夹路径;根域名部署用 `/`,子路径部署用 `/app`),`files`(选填,多文件上传配置),`ignore`(选填,忽略文件模式) | | `listFiles` | 获取静态网站托管的文件列表 | 无 | | `deleteFiles` | 删除静态网站托管的文件或文件夹 | `cloudPath`(必填,云端文件或文件夹路径),`isDir`(选填,是否为文件夹,默认为 `false`) | | `findFiles` | 搜索静态网站托管的文件 | `prefix`(必填,匹配前缀),`marker`(选填,起始对象键标记),`maxKeys`(选填,单次返回最大条目数) | diff --git a/mcp/manifest.json b/mcp/manifest.json index 35deafd9..a0ed0751 100644 --- a/mcp/manifest.json +++ b/mcp/manifest.json @@ -101,7 +101,7 @@ }, { "name": "uploadFiles", - "description": "Upload files to static hosting with CDN acceleration" + "description": "Deploy built Web assets to static hosting at / or a subpath; use manageStorage for COS object uploads" }, { "name": "getWebsiteConfig", diff --git a/mcp/src/tools/hosting.ts b/mcp/src/tools/hosting.ts index 9a68b50a..3116ddb7 100644 --- a/mcp/src/tools/hosting.ts +++ b/mcp/src/tools/hosting.ts @@ -67,7 +67,7 @@ function buildUploadFilesErrorMessage(error: unknown, localPath?: string): strin suggestions.push("请检查上传目录、文件权限和构建产物完整性后重试。"); } - return `[uploadFiles] ${baseMessage}\n建议:${suggestions.join(" ")}`; + return `[静态托管部署] ${baseMessage}\n建议:${suggestions.join(" ")}`; } function isRecord(value: unknown): value is Record { @@ -257,11 +257,11 @@ export function registerHostingTools(server: ExtendedMcpServer) { server.registerTool( "uploadFiles", { - title: "上传静态文件", - description: "上传文件到静态网站托管,仅用于 Web 站点部署,不用于云存储对象上传。部署前请先完成构建;如果站点会部署到子路径,请检查构建配置中的 publicPath、base、assetPrefix 等是否使用相对路径,避免静态资源加载失败。若需要上传 COS 云存储文件,请使用 manageStorage。对于本地评测、现有脚手架补全或仅需本地开发服务器验证的任务,通常不需要调用此工具,除非用户明确要求部署站点。", + title: "部署静态网站", + description: "上传文件到静态网站托管,仅用于 Web 站点部署,不用于云存储对象上传。若希望站点直接通过静态托管根域名访问,请将 `cloudPath` 设为 `/`;若部署到 `/app` 等子路径,请同步检查构建配置中的 publicPath、base、assetPrefix 等是否使用相对路径,避免静态资源加载失败。若需要上传 COS 云存储文件,请使用 manageStorage。对于本地评测、现有脚手架补全或仅需本地开发服务器验证的任务,通常不需要调用此工具,除非用户明确要求部署站点。", inputSchema: { localPath: z.string().optional().describe("本地文件或文件夹路径,需要是绝对路径,例如 /tmp/files/data.txt。"), - cloudPath: z.string().optional().describe("静态托管云端文件或文件夹路径,例如 files/data.txt。若部署到子路径,请同时检查构建配置中的 publicPath、base、assetPrefix 等是否为相对路径。云存储对象路径请改用 manageStorage。"), + cloudPath: z.string().optional().describe("静态托管云端文件或文件夹路径,例如 `/`(部署到根域名)、`/app`(部署到子路径)或 `files/data.txt`(上传单文件)。若部署到子路径,请同时检查构建配置中的 publicPath、base、assetPrefix 等是否为相对路径。云存储对象路径请改用 manageStorage。"), files: z.array(z.object({ localPath: z.string(), cloudPath: z.string() diff --git a/mcp/src/tools/storage-hosting-guidance.test.ts b/mcp/src/tools/storage-hosting-guidance.test.ts index 4ef1644e..7f6d4bea 100644 --- a/mcp/src/tools/storage-hosting-guidance.test.ts +++ b/mcp/src/tools/storage-hosting-guidance.test.ts @@ -104,8 +104,11 @@ describe("storage and hosting tool guidance", () => { const tools = createMockServer(); expect(tools.uploadFiles.meta.description).toContain("仅用于 Web 站点部署"); + expect(tools.uploadFiles.meta.description).toContain("cloudPath"); + expect(tools.uploadFiles.meta.description).toContain("设为 `/`"); expect(tools.uploadFiles.meta.description).toContain("manageStorage"); expect(tools.uploadFiles.meta.description).toContain("通常不需要调用此工具"); + expect(tools.uploadFiles.meta.inputSchema.cloudPath.description).toContain("`/`(部署到根域名)"); expect(tools.uploadFiles.meta.inputSchema.cloudPath.description).toContain("云存储对象路径请改用 manageStorage"); expect(tools.manageStorage.meta.description).toContain("仅用于 COS/Storage 对象"); expect(tools.manageStorage.meta.description).toContain("不用于静态网站托管"); diff --git a/scripts/tools.json b/scripts/tools.json index 25de23b4..a5d52537 100644 --- a/scripts/tools.json +++ b/scripts/tools.json @@ -1037,7 +1037,7 @@ }, { "name": "uploadFiles", - "description": "上传文件到静态网站托管,仅用于 Web 站点部署,不用于云存储对象上传。部署前请先完成构建;如果站点会部署到子路径,请检查构建配置中的 publicPath、base、assetPrefix 等是否使用相对路径,避免静态资源加载失败。若需要上传 COS 云存储文件,请使用 manageStorage。对于本地评测、现有脚手架补全或仅需本地开发服务器验证的任务,通常不需要调用此工具,除非用户明确要求部署站点。", + "description": "上传文件到静态网站托管,仅用于 Web 站点部署,不用于云存储对象上传。若希望站点直接通过静态托管根域名访问,请将 `cloudPath` 设为 `/`;若部署到 `/app` 等子路径,请同步检查构建配置中的 publicPath、base、assetPrefix 等是否使用相对路径,避免静态资源加载失败。若需要上传 COS 云存储文件,请使用 manageStorage。对于本地评测、现有脚手架补全或仅需本地开发服务器验证的任务,通常不需要调用此工具,除非用户明确要求部署站点。", "inputSchema": { "type": "object", "properties": { @@ -1047,7 +1047,7 @@ }, "cloudPath": { "type": "string", - "description": "静态托管云端文件或文件夹路径,例如 files/data.txt。若部署到子路径,请同时检查构建配置中的 publicPath、base、assetPrefix 等是否为相对路径。云存储对象路径请改用 manageStorage。" + "description": "静态托管云端文件或文件夹路径,例如 `/`(部署到根域名)、`/app`(部署到子路径)或 `files/data.txt`(上传单文件)。若部署到子路径,请同时检查构建配置中的 publicPath、base、assetPrefix 等是否为相对路径。云存储对象路径请改用 manageStorage。" }, "files": { "type": "array",