fix: 修复 Windows nvm4w 路径下 upgrade 命令识别为 development 的问题
- doctorDiagnostic: 增加 Windows nvm4w/nodejs 路径检测 - 路径比较时统一规范化分隔符,确保跨平台匹配 - chore: bump version to 4.0.8
This commit is contained in:
parent
928afd355d
commit
d67b7e4010
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@
|
|||
*/
|
||||
export function getMacroDefines(): Record<string, string> {
|
||||
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(""),
|
||||
|
|
|
|||
|
|
@ -113,17 +113,25 @@ export async function getCurrentInstallationType(): Promise<InstallationType> {
|
|||
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'
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user