From 71ce23590465acef85f8e45dfa75d34154362e59 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=98=BF=E7=A5=96?= <80613496+Cen-Yaozu@users.noreply.github.com> Date: Tue, 1 Jul 2025 10:00:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E4=B8=AD=E6=96=87=E8=B7=AF?= =?UTF-8?q?=E5=BE=84URL=E7=BC=96=E7=A0=81=E9=97=AE=E9=A2=98=20(#100)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 在InitCommand中添加decodeURIComponent()处理中文路径 - 解决MCP传入URL编码路径导致验证失败的问题 - 支持类似 /home/azu/%E6%A1%8C%E9%9D%A2/PromptX 的编码路径 Co-authored-by: Cen-Yaozu --- src/lib/core/pouch/commands/InitCommand.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/lib/core/pouch/commands/InitCommand.js b/src/lib/core/pouch/commands/InitCommand.js index df2ced7..ed75983 100644 --- a/src/lib/core/pouch/commands/InitCommand.js +++ b/src/lib/core/pouch/commands/InitCommand.js @@ -45,8 +45,9 @@ class InitCommand extends BasePouchCommand { let projectPath if (workingDirectory) { - // AI提供了工作目录,使用AI提供的路径 - projectPath = path.resolve(workingDirectory) + // AI提供了工作目录,先解码中文路径,然后使用 + const decodedWorkingDirectory = decodeURIComponent(workingDirectory) + projectPath = path.resolve(decodedWorkingDirectory) // 验证AI提供的路径是否有效 if (!await this.currentProjectManager.validateProjectPath(projectPath)) { @@ -153,7 +154,7 @@ ${registryStats.message} if (registryData.size === 0) { return { message: `✅ 项目资源目录已创建,注册表已初始化 - 📂 目录: ${path.relative(process.cwd(), domainDir)} + 📂 目录: ${path.relative(process.cwd(), resourceDir)} 💾 注册表: ${path.relative(process.cwd(), registryPath)} 💡 现在可以在 domain 目录下创建角色资源了`, totalResources: 0