@simonyea/holysheep-cli 1.7.30 → 1.7.32

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.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/utils/shell.js +8 -10
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simonyea/holysheep-cli",
3
- "version": "1.7.30",
3
+ "version": "1.7.32",
4
4
  "description": "Claude Code/Cursor/Cline API relay for China — ¥1=$1, WeChat/Alipay payment, no credit card, no VPN. One command setup for all AI coding tools.",
5
5
  "keywords": [
6
6
  "openai-china",
@@ -125,17 +125,16 @@ function installWindowsCliShims() {
125
125
  const npmBin = path.join(appData, 'npm')
126
126
  fs.mkdirSync(npmBin, { recursive: true })
127
127
 
128
- // npm install -g:npm 自己生成的 hs.cmd 已可用,不覆盖
129
- const globalEntry = path.join(npmBin, 'node_modules', '@simonyea', 'holysheep-cli', 'bin', 'hs.js')
130
- if (fs.existsSync(globalEntry)) return []
128
+ // 如果 hs.cmd 已存在(npm install -g 生成的),不覆盖
129
+ if (fs.existsSync(path.join(npmBin, 'hs.cmd'))) return []
131
130
 
132
131
  const cliSpec = `@simonyea/holysheep-cli@${pkg.version}`
133
- // 优先使用本地安装的包(npm install -g 场景),避免依赖 PATH 中的 hs 命令
132
+ // %APPDATA% 展开路径(比 %~dp0 cmd.exe 里更可靠)
134
133
  const cmdContent = [
135
134
  '@echo off',
136
135
  'setlocal',
137
- 'if exist "%~dp0node_modules\\@simonyea\\holysheep-cli\\bin\\hs.js" (',
138
- ' node "%~dp0node_modules\\@simonyea\\holysheep-cli\\bin\\hs.js" %*',
136
+ 'if exist "%APPDATA%\\npm\\node_modules\\@simonyea\\holysheep-cli\\bin\\hs.js" (',
137
+ ' node "%APPDATA%\\npm\\node_modules\\@simonyea\\holysheep-cli\\bin\\hs.js" %*',
139
138
  ') else if exist "%~dp0npx.cmd" (',
140
139
  ` call "%~dp0npx.cmd" ${cliSpec} %*`,
141
140
  ') else (',
@@ -145,12 +144,11 @@ function installWindowsCliShims() {
145
144
  ].join('\r\n')
146
145
 
147
146
  const ps1Content = [
148
- '$dir = $PSScriptRoot',
149
- '$localPkg = Join-Path $dir "node_modules\\@simonyea\\holysheep-cli\\bin\\hs.js"',
147
+ '$localPkg = "$env:APPDATA\\npm\\node_modules\\@simonyea\\holysheep-cli\\bin\\hs.js"',
150
148
  'if (Test-Path $localPkg) {',
151
149
  ' & node $localPkg @args',
152
- '} elseif (Test-Path (Join-Path $dir "npx.cmd")) {',
153
- ` & (Join-Path $dir "npx.cmd") "${cliSpec}" @args`,
150
+ '} elseif (Test-Path (Join-Path $PSScriptRoot "npx.cmd")) {',
151
+ ` & (Join-Path $PSScriptRoot "npx.cmd") "${cliSpec}" @args`,
154
152
  '} else {',
155
153
  ` & npx "${cliSpec}" @args`,
156
154
  '}',