@simonyea/holysheep-cli 1.1.9 → 1.2.1
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 +8 -6
- package/src/tools/openclaw.js +13 -7
- package/src/utils/shell.js +11 -5
package/package.json
CHANGED
package/src/commands/setup.js
CHANGED
|
@@ -238,23 +238,25 @@ async function setup(options) {
|
|
|
238
238
|
console.log(` ✓ ${r.tool.name}${hot}`)
|
|
239
239
|
if (r.tool.hint) console.log(` ${chalk.gray('💡 ' + r.tool.hint)}`)
|
|
240
240
|
// 显示启动命令
|
|
241
|
-
if (r.tool.
|
|
241
|
+
if (r.tool.launchSteps) {
|
|
242
|
+
// 多步骤启动(如 openclaw)
|
|
243
|
+
console.log(` ${chalk.gray('▶ 启动步骤:')}`)
|
|
244
|
+
r.tool.launchSteps.forEach((s, i) => {
|
|
245
|
+
console.log(` ${chalk.gray(` ${i + 1}.`)} ${chalk.cyan.bold(s.cmd)} ${chalk.gray(s.note)}`)
|
|
246
|
+
})
|
|
247
|
+
} else if (r.tool.launchCmd) {
|
|
242
248
|
if (r.tool._winJustInstalled) {
|
|
243
|
-
// Windows 刚安装:PATH 未刷新,统一用 npx 运行
|
|
244
249
|
const cmdBin = r.tool.launchCmd.split(' ')[0]
|
|
245
250
|
const cmdArgs = r.tool.launchCmd.split(' ').slice(1).join(' ')
|
|
246
251
|
const npxCmd = 'npx ' + cmdBin + (cmdArgs ? ' ' + cmdArgs : '')
|
|
247
252
|
console.log(` ${chalk.gray('▶ 启动命令:')} ${chalk.cyan.bold(npxCmd)}`)
|
|
248
|
-
if (r.tool.launchNote) console.log(` ${chalk.gray(' ' + r.tool.launchNote)}`)
|
|
249
253
|
} else {
|
|
250
254
|
console.log(` ${chalk.gray('▶ 启动命令:')} ${chalk.cyan.bold(r.tool.launchCmd)}`)
|
|
251
255
|
}
|
|
256
|
+
if (r.tool.launchNote) console.log(` ${chalk.gray(' ' + r.tool.launchNote)}`)
|
|
252
257
|
} else if (r.tool.launchNote) {
|
|
253
258
|
console.log(` ${chalk.gray('▶ ' + r.tool.launchNote)}`)
|
|
254
259
|
}
|
|
255
|
-
if (r.tool.launchNote && r.tool.launchCmd && !r.tool._winJustInstalled) {
|
|
256
|
-
console.log(` ${chalk.gray(' ' + r.tool.launchNote)}`)
|
|
257
|
-
}
|
|
258
260
|
})
|
|
259
261
|
console.log()
|
|
260
262
|
}
|
package/src/tools/openclaw.js
CHANGED
|
@@ -59,7 +59,7 @@ module.exports = {
|
|
|
59
59
|
if (!config.agents) config.agents = {}
|
|
60
60
|
if (!config.agents.defaults) config.agents.defaults = {}
|
|
61
61
|
if (!config.agents.defaults.model) {
|
|
62
|
-
config.agents.defaults.model = { primary: 'anthropic/claude-sonnet-4-5' }
|
|
62
|
+
config.agents.defaults.model = { primary: 'anthropic/claude-sonnet-4-5-20250929' }
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
// 同时注册一个 holysheep 自定义 provider(支持所有模型)
|
|
@@ -71,10 +71,12 @@ module.exports = {
|
|
|
71
71
|
apiKey,
|
|
72
72
|
api: 'openai-completions',
|
|
73
73
|
models: [
|
|
74
|
-
{ id: 'claude-sonnet-4-5', name: 'Claude Sonnet 4.5 (HolySheep)' },
|
|
75
|
-
{ id: 'claude-
|
|
76
|
-
{ id: '
|
|
77
|
-
{ id: '
|
|
74
|
+
{ id: 'claude-sonnet-4-5-20250929', name: 'Claude Sonnet 4.5 (HolySheep)' },
|
|
75
|
+
{ id: 'claude-sonnet-4-20250514', name: 'Claude Sonnet 4 (HolySheep)' },
|
|
76
|
+
{ id: 'claude-opus-4-5-20251101', name: 'Claude Opus 4.5 (HolySheep)' },
|
|
77
|
+
{ id: 'claude-opus-4-20250514', name: 'Claude Opus 4 (HolySheep)' },
|
|
78
|
+
{ id: 'gpt-4o', name: 'GPT-4o (HolySheep)' },
|
|
79
|
+
{ id: 'gemini-2.5-pro', name: 'Gemini 2.5 Pro (HolySheep)' },
|
|
78
80
|
],
|
|
79
81
|
}
|
|
80
82
|
|
|
@@ -98,8 +100,12 @@ module.exports = {
|
|
|
98
100
|
},
|
|
99
101
|
getConfigPath() { return CONFIG_FILE },
|
|
100
102
|
hint: '切换后重启 OpenClaw 生效;支持 /model 命令切换模型',
|
|
101
|
-
launchCmd:
|
|
102
|
-
|
|
103
|
+
launchCmd: null,
|
|
104
|
+
launchSteps: [
|
|
105
|
+
{ cmd: 'npx openclaw onboard', note: '首次初始化(设置模型、鉴权等)' },
|
|
106
|
+
{ cmd: 'npx openclaw gateway start', note: '启动后台 Gateway 服务' },
|
|
107
|
+
{ cmd: 'npx openclaw dashboard', note: '打开 WebUI → http://127.0.0.1:18789/' },
|
|
108
|
+
],
|
|
103
109
|
installCmd: 'npm install -g openclaw@latest',
|
|
104
110
|
docsUrl: 'https://docs.openclaw.ai',
|
|
105
111
|
}
|
package/src/utils/shell.js
CHANGED
|
@@ -41,26 +41,31 @@ function removeHsBlock(content) {
|
|
|
41
41
|
return content.replace(re, '')
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
function buildEnvBlock(envVars) {
|
|
44
|
+
function buildEnvBlock(envVars, isFish = false) {
|
|
45
45
|
const lines = [MARKER_START]
|
|
46
46
|
for (const [k, v] of Object.entries(envVars)) {
|
|
47
|
-
|
|
47
|
+
// fish shell 用 set -gx,其他 shell 用 export
|
|
48
|
+
lines.push(isFish ? `set -gx ${k} "${v}"` : `export ${k}="${v}"`)
|
|
48
49
|
}
|
|
49
50
|
lines.push(MARKER_END)
|
|
50
51
|
return '\n' + lines.join('\n') + '\n'
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
function writeEnvToShell(envVars) {
|
|
54
|
-
// Windows: 用 setx
|
|
55
|
+
// Windows: 用 setx 写入用户级环境变量(需重启终端生效)
|
|
55
56
|
if (process.platform === 'win32') {
|
|
56
57
|
const { execSync } = require('child_process')
|
|
57
58
|
const written = []
|
|
58
59
|
for (const [k, v] of Object.entries(envVars)) {
|
|
59
60
|
try {
|
|
60
61
|
execSync(`setx ${k} "${v}"`, { stdio: 'ignore' })
|
|
61
|
-
written.push(`[
|
|
62
|
+
written.push(`[系统环境变量] ${k}`)
|
|
62
63
|
} catch {}
|
|
63
64
|
}
|
|
65
|
+
if (written.length > 0) {
|
|
66
|
+
const chalk = require('chalk')
|
|
67
|
+
console.log(chalk.yellow('\n ⚠️ Windows 环境变量已写入,需要重启终端后生效'))
|
|
68
|
+
}
|
|
64
69
|
return written
|
|
65
70
|
}
|
|
66
71
|
|
|
@@ -71,7 +76,8 @@ function writeEnvToShell(envVars) {
|
|
|
71
76
|
let content = ''
|
|
72
77
|
try { content = fs.readFileSync(file, 'utf8') } catch {}
|
|
73
78
|
content = removeHsBlock(content)
|
|
74
|
-
|
|
79
|
+
const isFish = file.endsWith('config.fish')
|
|
80
|
+
content += buildEnvBlock(envVars, isFish)
|
|
75
81
|
fs.writeFileSync(file, content, 'utf8')
|
|
76
82
|
written.push(file)
|
|
77
83
|
}
|