@simonyea/holysheep-cli 1.4.9 → 1.5.0

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simonyea/holysheep-cli",
3
- "version": "1.4.9",
3
+ "version": "1.5.0",
4
4
  "description": "一键配置所有 AI 编程工具接入 HolySheep API — Claude Code / Codex / Gemini CLI / OpenCode / OpenClaw / Aider / Cursor",
5
5
  "keywords": [
6
6
  "claude",
@@ -101,11 +101,8 @@ module.exports = {
101
101
  _writeFallbackConfig(apiKey, baseUrl)
102
102
  }
103
103
 
104
- // 4. 读取新 token(onboard 已写入,gateway 已停止,token 稳定)
105
- let token = ''
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 = token
121
- ? `http://127.0.0.1:18789/?token=${token}`
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: 'token', token },
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) {