@simonyea/holysheep-cli 1.4.9 → 1.5.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/README.md +56 -28
- package/package.json +1 -1
- package/src/commands/setup.js +1 -1
- package/src/tools/openclaw.js +12 -16
package/README.md
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
[](https://www.npmjs.com/package/@simonyea/holysheep-cli)
|
|
8
8
|
[](https://www.npmjs.com/package/@simonyea/holysheep-cli)
|
|
9
9
|
[](LICENSE)
|
|
10
|
-
[](https://github.com/holysheep123/holysheep-cli)
|
|
11
10
|
|
|
12
11
|
<br/>
|
|
13
12
|
|
|
@@ -41,14 +40,10 @@ Instead of manually editing config files for each tool, run one command and you'
|
|
|
41
40
|
| [Aider](https://aider.chat) | `~/.aider.conf.yml` | ✅ Auto |
|
|
42
41
|
| [Continue.dev](https://continue.dev) | `~/.continue/config.yaml` | ✅ Auto |
|
|
43
42
|
| [OpenCode](https://github.com/anomalyco/opencode) | `~/.config/opencode/opencode.json` | ✅ Auto |
|
|
44
|
-
| [OpenClaw](https://
|
|
43
|
+
| [OpenClaw](https://openclaw.ai) | `~/.openclaw/openclaw.json` | ✅ Auto |
|
|
45
44
|
| [Cursor](https://cursor.sh) | GUI (encrypted storage) | ⚠️ Manual |
|
|
46
45
|
| [Gemini CLI](https://github.com/google-gemini/gemini-cli) | Google protocol only | ❌ Not supported |
|
|
47
46
|
|
|
48
|
-
> **Cursor**: API keys are stored in encrypted secret storage. Configure manually via `Settings → Models → Override OpenAI Base URL`.
|
|
49
|
-
>
|
|
50
|
-
> **Gemini CLI**: Uses Google's proprietary protocol and does not support custom relay endpoints.
|
|
51
|
-
|
|
52
47
|
### Quick Start
|
|
53
48
|
|
|
54
49
|
```bash
|
|
@@ -62,15 +57,30 @@ npm install -g @simonyea/holysheep-cli
|
|
|
62
57
|
hs setup
|
|
63
58
|
```
|
|
64
59
|
|
|
65
|
-
You'll be prompted for your API Key (`cr_xxx`), then the
|
|
60
|
+
You'll be prompted for your API Key (`cr_xxx`), then select the tools to configure. Done!
|
|
61
|
+
|
|
62
|
+
### OpenClaw Setup
|
|
63
|
+
|
|
64
|
+
[OpenClaw](https://openclaw.ai) is a powerful AI agent gateway with a web dashboard. After running `hs setup`:
|
|
65
|
+
|
|
66
|
+
1. A new terminal window opens running the OpenClaw Gateway
|
|
67
|
+
2. Open your browser: **http://127.0.0.1:18789/**
|
|
68
|
+
3. Start chatting — no token required
|
|
69
|
+
|
|
70
|
+
> **Keep the gateway window open** while using OpenClaw. The gateway must be running for the browser UI to work.
|
|
71
|
+
|
|
72
|
+
To restart the gateway later:
|
|
73
|
+
```bash
|
|
74
|
+
npx openclaw gateway --port 18789
|
|
75
|
+
```
|
|
66
76
|
|
|
67
77
|
### Commands
|
|
68
78
|
|
|
69
79
|
| Command | Description |
|
|
70
80
|
|---------|-------------|
|
|
71
|
-
| `hs setup` | Configure
|
|
81
|
+
| `hs setup` | Configure AI tools interactively |
|
|
72
82
|
| `hs login` | Save your API Key locally |
|
|
73
|
-
| `hs doctor` | Check configuration
|
|
83
|
+
| `hs doctor` | Check configuration & connectivity |
|
|
74
84
|
| `hs balance` | View account balance |
|
|
75
85
|
| `hs tools` | List all supported tools |
|
|
76
86
|
| `hs reset` | Remove all HolySheep configuration |
|
|
@@ -92,24 +102,20 @@ You'll be prompted for your API Key (`cr_xxx`), then the tool will auto-detect i
|
|
|
92
102
|
|
|
93
103
|
**HolySheep CLI**(命令 `hs`)是一个命令行工具,帮你一键配置所有主流 AI 编程助手接入 [HolySheep API](https://holysheep.ai)。
|
|
94
104
|
|
|
95
|
-
|
|
105
|
+
无需 VPN,无需手动改配置文件,运行一条命令即可接入 Claude、GPT、Gemini。
|
|
96
106
|
|
|
97
107
|
### 支持的工具
|
|
98
108
|
|
|
99
|
-
| 工具 |
|
|
100
|
-
|
|
101
|
-
| [Claude Code](https://docs.anthropic.com/claude-code) |
|
|
102
|
-
| [Codex CLI](https://github.com/openai/codex) |
|
|
103
|
-
| [Aider](https://aider.chat) |
|
|
104
|
-
| [Continue.dev](https://continue.dev) |
|
|
105
|
-
| [OpenCode](https://github.com/anomalyco/opencode) |
|
|
106
|
-
| [OpenClaw](https://
|
|
107
|
-
| [Cursor](https://cursor.sh) |
|
|
108
|
-
| [Gemini CLI](https://github.com/google-gemini/gemini-cli) | 仅支持 Google 官方协议 |
|
|
109
|
-
|
|
110
|
-
> **Cursor**:API Key 存储在加密区域,CLI 无法写入。登录后在 `Settings → Models → Override OpenAI Base URL` 手动填入。
|
|
111
|
-
>
|
|
112
|
-
> **Gemini CLI**:使用 Google 专有协议,不支持自定义中转地址。
|
|
109
|
+
| 工具 | 状态 | 说明 |
|
|
110
|
+
|------|------|------|
|
|
111
|
+
| [Claude Code](https://docs.anthropic.com/claude-code) | ✅ 自动 | Anthropic 官方 CLI |
|
|
112
|
+
| [Codex CLI](https://github.com/openai/codex) | ✅ 自动 | OpenAI 官方 CLI |
|
|
113
|
+
| [Aider](https://aider.chat) | ✅ 自动 | AI 结对编程 |
|
|
114
|
+
| [Continue.dev](https://continue.dev) | ✅ 自动 | VS Code/JetBrains 插件 |
|
|
115
|
+
| [OpenCode](https://github.com/anomalyco/opencode) | ✅ 自动 | 终端 AI 编程助手 |
|
|
116
|
+
| [OpenClaw](https://openclaw.ai) | ✅ 自动 | AI 智能体网关 + Web 界面 |
|
|
117
|
+
| [Cursor](https://cursor.sh) | ⚠️ 手动 | 需在 GUI 中手动配置 |
|
|
118
|
+
| [Gemini CLI](https://github.com/google-gemini/gemini-cli) | ❌ 不支持 | 仅支持 Google 官方协议 |
|
|
113
119
|
|
|
114
120
|
### 快速开始
|
|
115
121
|
|
|
@@ -124,14 +130,33 @@ npm install -g @simonyea/holysheep-cli
|
|
|
124
130
|
hs setup
|
|
125
131
|
```
|
|
126
132
|
|
|
127
|
-
按提示输入 API Key(`cr_xxx
|
|
133
|
+
按提示输入 API Key(`cr_xxx`),选择要配置的工具,完成!
|
|
134
|
+
|
|
135
|
+
### OpenClaw 使用说明
|
|
136
|
+
|
|
137
|
+
[OpenClaw](https://openclaw.ai) 是一个 AI 智能体网关,提供浏览器 Web 界面,支持聊天、任务、工具调用等功能。
|
|
138
|
+
|
|
139
|
+
**`hs setup` 配置完成后:**
|
|
140
|
+
|
|
141
|
+
1. 自动弹出一个新终端窗口,运行 OpenClaw Gateway
|
|
142
|
+
2. 打开浏览器访问:**http://127.0.0.1:18789/**
|
|
143
|
+
3. 直接开始聊天,无需填写 token
|
|
144
|
+
|
|
145
|
+
> ⚠️ **保持 Gateway 窗口开启**,关闭后 Gateway 停止,浏览器界面无法使用。
|
|
146
|
+
|
|
147
|
+
**下次启动 Gateway:**
|
|
148
|
+
```bash
|
|
149
|
+
npx openclaw gateway --port 18789
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
**使用的模型:** `claude-sonnet-4-6`(通过 HolySheep 中转)
|
|
128
153
|
|
|
129
154
|
### 命令说明
|
|
130
155
|
|
|
131
156
|
| 命令 | 说明 |
|
|
132
157
|
|------|------|
|
|
133
|
-
| `hs setup` |
|
|
134
|
-
| `hs login` |
|
|
158
|
+
| `hs setup` | 交互式配置 AI 工具 |
|
|
159
|
+
| `hs login` | 保存 API Key 到本地 |
|
|
135
160
|
| `hs doctor` | 检查配置状态和连通性 |
|
|
136
161
|
| `hs balance` | 查看账户余额 |
|
|
137
162
|
| `hs tools` | 列出所有支持的工具 |
|
|
@@ -152,11 +177,14 @@ A: 在 [holysheep.ai](https://holysheep.ai) 注册后,在「API 密钥」页
|
|
|
152
177
|
**Q: 支持 Windows 吗?**
|
|
153
178
|
A: 支持,需要 Node.js 16+。如果 `hs` 命令找不到,请重启终端,或直接用 `npx @simonyea/holysheep-cli@latest setup`。
|
|
154
179
|
|
|
180
|
+
**Q: OpenClaw Gateway 窗口可以最小化吗?**
|
|
181
|
+
A: 可以最小化,但不能关闭。关闭后 Gateway 停止,需重新运行 `npx openclaw gateway --port 18789`。
|
|
182
|
+
|
|
155
183
|
**Q: 如何恢复原来的配置?**
|
|
156
184
|
A: 运行 `hs reset` 清除所有 HolySheep 相关配置。
|
|
157
185
|
|
|
158
186
|
**Q: OpenClaw 安装失败?**
|
|
159
|
-
A: OpenClaw 需要 Node.js
|
|
187
|
+
A: OpenClaw 需要 Node.js 20+,运行 `node --version` 确认版本后重试。
|
|
160
188
|
|
|
161
189
|
---
|
|
162
190
|
|
package/package.json
CHANGED
package/src/commands/setup.js
CHANGED
|
@@ -15,7 +15,7 @@ const AUTO_INSTALL = {
|
|
|
15
15
|
'codex': { cmd: 'npm install -g @openai/codex', mgr: 'npm' },
|
|
16
16
|
'gemini-cli': { cmd: 'npm install -g @google/gemini-cli', mgr: 'npm' },
|
|
17
17
|
'opencode': { cmd: 'npm install -g opencode-ai', mgr: 'npm' },
|
|
18
|
-
'openclaw': { cmd: 'npm install -g openclaw@latest',
|
|
18
|
+
'openclaw': { cmd: 'npm install -g openclaw@latest --ignore-scripts', mgr: 'npm' },
|
|
19
19
|
'aider': { cmd: 'pip install aider-chat', mgr: 'pip' },
|
|
20
20
|
}
|
|
21
21
|
|
package/src/tools/openclaw.js
CHANGED
|
@@ -101,11 +101,8 @@ module.exports = {
|
|
|
101
101
|
_writeFallbackConfig(apiKey, baseUrl)
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
-
// 4.
|
|
105
|
-
|
|
106
|
-
try {
|
|
107
|
-
token = readConfig()?.gateway?.auth?.token || ''
|
|
108
|
-
} catch {}
|
|
104
|
+
// 4. 关闭 gateway token 认证(直接打开浏览器无需 token)
|
|
105
|
+
_disableGatewayAuth()
|
|
109
106
|
|
|
110
107
|
// 5. 启动 Gateway
|
|
111
108
|
console.log(chalk.gray(' → 正在启动 Gateway...'))
|
|
@@ -117,10 +114,8 @@ module.exports = {
|
|
|
117
114
|
console.log(chalk.yellow(' ⚠️ Gateway 启动中,稍等几秒后刷新浏览器'))
|
|
118
115
|
}
|
|
119
116
|
|
|
120
|
-
const dashUrl =
|
|
121
|
-
|
|
122
|
-
: 'http://127.0.0.1:18789/'
|
|
123
|
-
console.log(chalk.cyan('\n → 浏览器打开(含 token,直接可用):'))
|
|
117
|
+
const dashUrl = 'http://127.0.0.1:18789/'
|
|
118
|
+
console.log(chalk.cyan('\n → 浏览器打开(无需 token):'))
|
|
124
119
|
console.log(chalk.bold.cyan(` ${dashUrl}`))
|
|
125
120
|
|
|
126
121
|
return { file: CONFIG_FILE, hot: false }
|
|
@@ -134,10 +129,6 @@ module.exports = {
|
|
|
134
129
|
hint: 'Gateway 已启动,打开浏览器即可使用',
|
|
135
130
|
launchCmd: null,
|
|
136
131
|
get launchNote() {
|
|
137
|
-
try {
|
|
138
|
-
const token = readConfig()?.gateway?.auth?.token
|
|
139
|
-
if (token) return `🌐 复制此链接到浏览器(含 token):\n http://127.0.0.1:18789/?token=${token}`
|
|
140
|
-
} catch {}
|
|
141
132
|
return '🌐 打开浏览器: http://127.0.0.1:18789/'
|
|
142
133
|
},
|
|
143
134
|
installCmd: 'npm install -g openclaw@latest',
|
|
@@ -146,12 +137,10 @@ module.exports = {
|
|
|
146
137
|
|
|
147
138
|
/** onboard 失败时的备用配置(基于实测的正确格式) */
|
|
148
139
|
function _writeFallbackConfig(apiKey, baseUrl) {
|
|
149
|
-
const { randomBytes } = require('crypto')
|
|
150
140
|
fs.mkdirSync(OPENCLAW_DIR, { recursive: true })
|
|
151
141
|
|
|
152
142
|
const hostname = new URL(baseUrl).hostname.replace(/\./g, '-')
|
|
153
143
|
const providerName = `custom-api-${hostname}`
|
|
154
|
-
const token = randomBytes(24).toString('hex')
|
|
155
144
|
|
|
156
145
|
const config = {
|
|
157
146
|
models: {
|
|
@@ -181,13 +170,20 @@ function _writeFallbackConfig(apiKey, baseUrl) {
|
|
|
181
170
|
mode: 'local',
|
|
182
171
|
port: 18789,
|
|
183
172
|
bind: 'loopback',
|
|
184
|
-
auth: { mode: '
|
|
173
|
+
auth: { mode: 'none' }, // 无需 token,本地访问直接打开
|
|
185
174
|
}
|
|
186
175
|
}
|
|
187
176
|
|
|
188
177
|
fs.writeFileSync(CONFIG_FILE, JSON.stringify(config, null, 2), 'utf8')
|
|
189
178
|
}
|
|
190
179
|
|
|
180
|
+
/** 用 openclaw config set 把 gateway auth 改成 none */
|
|
181
|
+
function _disableGatewayAuth() {
|
|
182
|
+
try {
|
|
183
|
+
npx('config', 'set', 'gateway.auth.mode', 'none')
|
|
184
|
+
} catch {}
|
|
185
|
+
}
|
|
186
|
+
|
|
191
187
|
/** 启动 Gateway 后台进程 */
|
|
192
188
|
function _startGateway() {
|
|
193
189
|
if (isWin) {
|