@simonyea/holysheep-cli 1.7.30 → 1.7.31

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 +6 -11
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.31",
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,13 @@ 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 []
131
-
132
128
  const cliSpec = `@simonyea/holysheep-cli@${pkg.version}`
133
- // 优先使用本地安装的包(npm install -g 场景),避免依赖 PATH 中的 hs 命令
129
+ // %APPDATA% 展开路径(比 %~dp0 cmd.exe 里更可靠)
134
130
  const cmdContent = [
135
131
  '@echo off',
136
132
  'setlocal',
137
- 'if exist "%~dp0node_modules\\@simonyea\\holysheep-cli\\bin\\hs.js" (',
138
- ' node "%~dp0node_modules\\@simonyea\\holysheep-cli\\bin\\hs.js" %*',
133
+ 'if exist "%APPDATA%\\npm\\node_modules\\@simonyea\\holysheep-cli\\bin\\hs.js" (',
134
+ ' node "%APPDATA%\\npm\\node_modules\\@simonyea\\holysheep-cli\\bin\\hs.js" %*',
139
135
  ') else if exist "%~dp0npx.cmd" (',
140
136
  ` call "%~dp0npx.cmd" ${cliSpec} %*`,
141
137
  ') else (',
@@ -145,12 +141,11 @@ function installWindowsCliShims() {
145
141
  ].join('\r\n')
146
142
 
147
143
  const ps1Content = [
148
- '$dir = $PSScriptRoot',
149
- '$localPkg = Join-Path $dir "node_modules\\@simonyea\\holysheep-cli\\bin\\hs.js"',
144
+ '$localPkg = "$env:APPDATA\\npm\\node_modules\\@simonyea\\holysheep-cli\\bin\\hs.js"',
150
145
  'if (Test-Path $localPkg) {',
151
146
  ' & node $localPkg @args',
152
- '} elseif (Test-Path (Join-Path $dir "npx.cmd")) {',
153
- ` & (Join-Path $dir "npx.cmd") "${cliSpec}" @args`,
147
+ '} elseif (Test-Path (Join-Path $PSScriptRoot "npx.cmd")) {',
148
+ ` & (Join-Path $PSScriptRoot "npx.cmd") "${cliSpec}" @args`,
154
149
  '} else {',
155
150
  ` & npx "${cliSpec}" @args`,
156
151
  '}',