@simonyea/holysheep-cli 1.0.4 → 1.0.6
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.
- package/package.json +1 -1
- package/src/commands/setup.js +10 -1
- package/src/tools/aider.js +1 -4
- package/src/tools/claude-code.js +1 -7
- package/src/tools/codex.js +2 -10
- package/src/tools/gemini-cli.js +1 -4
- package/src/tools/openclaw.js +1 -4
- package/src/tools/opencode.js +1 -4
- package/src/utils/which.js +21 -0
package/package.json
CHANGED
package/src/commands/setup.js
CHANGED
|
@@ -36,10 +36,19 @@ async function tryAutoInstall(tool) {
|
|
|
36
36
|
|
|
37
37
|
const spinner = ora(`正在安装 ${tool.name}...`).start()
|
|
38
38
|
try {
|
|
39
|
-
spawnSync(info.cmd.split(' ')[0], info.cmd.split(' ').slice(1), {
|
|
39
|
+
const ret = spawnSync(info.cmd.split(' ')[0], info.cmd.split(' ').slice(1), {
|
|
40
40
|
stdio: 'inherit',
|
|
41
41
|
shell: true,
|
|
42
42
|
})
|
|
43
|
+
if (ret.status !== 0) {
|
|
44
|
+
spinner.fail(`安装失败,请手动运行: ${chalk.cyan(info.cmd)}`)
|
|
45
|
+
return false
|
|
46
|
+
}
|
|
47
|
+
// Windows PATH 在当前进程内不会刷新,安装成功即认为可用
|
|
48
|
+
if (process.platform === 'win32') {
|
|
49
|
+
spinner.succeed(`${tool.name} 安装完成(请重新开一个终端窗口后运行 hs setup 完成配置)`)
|
|
50
|
+
return false // 返回 false 跳过配置,让用户重开终端再来
|
|
51
|
+
}
|
|
43
52
|
// 安装后重新检测
|
|
44
53
|
if (tool.checkInstalled()) {
|
|
45
54
|
spinner.succeed(`${tool.name} 安装成功`)
|
package/src/tools/aider.js
CHANGED
|
@@ -38,10 +38,7 @@ module.exports = {
|
|
|
38
38
|
name: 'Aider',
|
|
39
39
|
id: 'aider',
|
|
40
40
|
checkInstalled() {
|
|
41
|
-
|
|
42
|
-
require('child_process').execSync('which aider', { stdio: 'ignore' })
|
|
43
|
-
return true
|
|
44
|
-
} catch { return false }
|
|
41
|
+
return require('../utils/which').commandExists('aider')
|
|
45
42
|
},
|
|
46
43
|
isConfigured() {
|
|
47
44
|
const content = readConfig()
|
package/src/tools/claude-code.js
CHANGED
|
@@ -34,13 +34,7 @@ module.exports = {
|
|
|
34
34
|
name: 'Claude Code',
|
|
35
35
|
id: 'claude-code',
|
|
36
36
|
checkInstalled() {
|
|
37
|
-
|
|
38
|
-
try {
|
|
39
|
-
require('child_process').execSync('which claude', { stdio: 'ignore' })
|
|
40
|
-
return true
|
|
41
|
-
} catch {
|
|
42
|
-
return false
|
|
43
|
-
}
|
|
37
|
+
return require('../utils/which').commandExists('claude')
|
|
44
38
|
},
|
|
45
39
|
isConfigured() {
|
|
46
40
|
const s = readSettings()
|
package/src/tools/codex.js
CHANGED
|
@@ -44,15 +44,7 @@ module.exports = {
|
|
|
44
44
|
name: 'Codex CLI',
|
|
45
45
|
id: 'codex',
|
|
46
46
|
checkInstalled() {
|
|
47
|
-
|
|
48
|
-
require('child_process').execSync('codex --version', { stdio: 'ignore' })
|
|
49
|
-
return true
|
|
50
|
-
} catch {
|
|
51
|
-
try {
|
|
52
|
-
require('child_process').execSync('npx @openai/codex --version', { stdio: 'ignore' })
|
|
53
|
-
return true
|
|
54
|
-
} catch { return false }
|
|
55
|
-
}
|
|
47
|
+
return require('../utils/which').commandExists('codex')
|
|
56
48
|
},
|
|
57
49
|
isConfigured() {
|
|
58
50
|
const c = readConfig()
|
|
@@ -64,7 +56,7 @@ module.exports = {
|
|
|
64
56
|
|
|
65
57
|
// 设置 HolySheep 为默认 provider
|
|
66
58
|
config.provider = 'holysheep'
|
|
67
|
-
config.model =
|
|
59
|
+
config.model = 'gpt-5.1-codex' // HolySheep 支持的 Codex 专属模型
|
|
68
60
|
|
|
69
61
|
if (!config.providers) config.providers = {}
|
|
70
62
|
config.providers.holysheep = {
|
package/src/tools/gemini-cli.js
CHANGED
|
@@ -38,10 +38,7 @@ module.exports = {
|
|
|
38
38
|
name: 'Gemini CLI',
|
|
39
39
|
id: 'gemini-cli',
|
|
40
40
|
checkInstalled() {
|
|
41
|
-
|
|
42
|
-
require('child_process').execSync('which gemini', { stdio: 'ignore' })
|
|
43
|
-
return true
|
|
44
|
-
} catch { return false }
|
|
41
|
+
return require('../utils/which').commandExists('gemini')
|
|
45
42
|
},
|
|
46
43
|
isConfigured() {
|
|
47
44
|
const s = readSettings()
|
package/src/tools/openclaw.js
CHANGED
|
@@ -44,10 +44,7 @@ module.exports = {
|
|
|
44
44
|
name: 'OpenClaw',
|
|
45
45
|
id: 'openclaw',
|
|
46
46
|
checkInstalled() {
|
|
47
|
-
|
|
48
|
-
require('child_process').execSync('which openclaw', { stdio: 'ignore' })
|
|
49
|
-
return true
|
|
50
|
-
} catch { return false }
|
|
47
|
+
return require('../utils/which').commandExists('openclaw')
|
|
51
48
|
},
|
|
52
49
|
isConfigured() {
|
|
53
50
|
const file = getSettingsFile()
|
package/src/tools/opencode.js
CHANGED
|
@@ -53,10 +53,7 @@ module.exports = {
|
|
|
53
53
|
name: 'OpenCode',
|
|
54
54
|
id: 'opencode',
|
|
55
55
|
checkInstalled() {
|
|
56
|
-
|
|
57
|
-
require('child_process').execSync('which opencode', { stdio: 'ignore' })
|
|
58
|
-
return true
|
|
59
|
-
} catch { return false }
|
|
56
|
+
return require('../utils/which').commandExists('opencode')
|
|
60
57
|
},
|
|
61
58
|
isConfigured() {
|
|
62
59
|
const c = readConfig()
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 跨平台检测命令是否存在
|
|
3
|
+
* Windows 用 where,Unix 用 which,兜底用 --version
|
|
4
|
+
*/
|
|
5
|
+
const { execSync } = require('child_process')
|
|
6
|
+
|
|
7
|
+
function commandExists(cmd) {
|
|
8
|
+
const finder = process.platform === 'win32' ? `where ${cmd}` : `which ${cmd}`
|
|
9
|
+
try {
|
|
10
|
+
execSync(finder, { stdio: 'ignore' })
|
|
11
|
+
return true
|
|
12
|
+
} catch {
|
|
13
|
+
// 兜底:直接跑 --version
|
|
14
|
+
try {
|
|
15
|
+
execSync(`${cmd} --version`, { stdio: 'ignore', timeout: 3000 })
|
|
16
|
+
return true
|
|
17
|
+
} catch { return false }
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = { commandExists }
|