From d67b7e4010c934148a4cb28f30f587b7840c49df Mon Sep 17 00:00:00 2001 From: y574444354 <574444354@qq.com> Date: Thu, 16 Apr 2026 20:38:26 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8D=20Windows=20nvm4w=20?= =?UTF-8?q?=E8=B7=AF=E5=BE=84=E4=B8=8B=20upgrade=20=E5=91=BD=E4=BB=A4?= =?UTF-8?q?=E8=AF=86=E5=88=AB=E4=B8=BA=20development=20=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - doctorDiagnostic: 增加 Windows nvm4w/nodejs 路径检测 - 路径比较时统一规范化分隔符,确保跨平台匹配 - chore: bump version to 4.0.8 --- package.json | 2 +- scripts/defines.ts | 2 +- src/utils/doctorDiagnostic.ts | 14 +++++++++++--- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 233c855a9..4504ad281 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@costrict/csc", - "version": "4.0.7", + "version": "4.0.8", "description": "CSC — CoStrict多模型终端 AI 编程助手,支持 Anthropic/OpenAI/Gemini/Grok 等多种 API 端点", "type": "module", diff --git a/scripts/defines.ts b/scripts/defines.ts index 3b90b0653..78619a072 100644 --- a/scripts/defines.ts +++ b/scripts/defines.ts @@ -7,7 +7,7 @@ */ export function getMacroDefines(): Record { return { - "MACRO.VERSION": JSON.stringify("4.0.7"), + "MACRO.VERSION": JSON.stringify("4.0.8"), "MACRO.BUILD_TIME": JSON.stringify(new Date().toISOString()), "MACRO.FEEDBACK_CHANNEL": JSON.stringify(""), "MACRO.ISSUES_EXPLAINER": JSON.stringify(""), diff --git a/src/utils/doctorDiagnostic.ts b/src/utils/doctorDiagnostic.ts index 065b20cb0..176dfa20c 100644 --- a/src/utils/doctorDiagnostic.ts +++ b/src/utils/doctorDiagnostic.ts @@ -113,17 +113,25 @@ export async function getCurrentInstallationType(): Promise { return 'npm-local' } - // Check if we're in a typical npm global location + // Check if we're in a typical npm global location (Unix + Windows) const npmGlobalPaths = [ '/usr/local/lib/node_modules', '/usr/lib/node_modules', '/opt/homebrew/lib/node_modules', '/opt/homebrew/bin', '/usr/local/bin', - '/.nvm/versions/node/', // nvm installations + '/.nvm/versions/node/', // nvm installations (Unix) + '\\nvm', // nvm4w installations (Windows, e.g. C:\nvm4w\nodejs) ] - if (npmGlobalPaths.some(path => invokedPath.includes(path))) { + // Normalize path separators for cross-platform matching + const normalizedPath = invokedPath.replace(/\\/g, '/') + if ( + npmGlobalPaths.some(path => invokedPath.includes(path)) || + normalizedPath.includes('/nvm') || + normalizedPath.includes('/nodejs/') || + normalizedPath.includes('/.nvm/') + ) { return 'npm-global' }