@simonyea/holysheep-cli 1.3.0 → 1.3.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/tools/openclaw.js +12 -12
package/package.json
CHANGED
package/src/tools/openclaw.js
CHANGED
|
@@ -84,10 +84,10 @@ module.exports = {
|
|
|
84
84
|
|
|
85
85
|
console.log(chalk.gray('\n ⚙️ 正在通过 OpenClaw 官方向导配置(约 30 秒)...'))
|
|
86
86
|
|
|
87
|
-
// Step 1:
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
87
|
+
// Step 1: 删除旧配置,避免 onboard 检测到现有配置后跳过重写
|
|
88
|
+
try {
|
|
89
|
+
if (fs.existsSync(CONFIG_FILE)) fs.unlinkSync(CONFIG_FILE)
|
|
90
|
+
} catch {}
|
|
91
91
|
|
|
92
92
|
// Step 2: 用官方 onboard 非交互式命令完成配置 + 安装系统服务
|
|
93
93
|
const r = run([
|
|
@@ -161,9 +161,7 @@ function _startGateway() {
|
|
|
161
161
|
const chalk = require('chalk')
|
|
162
162
|
const isWin = process.platform === 'win32'
|
|
163
163
|
|
|
164
|
-
//
|
|
165
|
-
run(['gateway', 'install'], { stdio: 'ignore', timeout: 20000 })
|
|
166
|
-
|
|
164
|
+
// 先尝试 gateway start(已有服务时生效)
|
|
167
165
|
const r = run(['gateway', 'start'], { timeout: 10000 })
|
|
168
166
|
if (r.status === 0) {
|
|
169
167
|
console.log(chalk.green(' ✓ OpenClaw Gateway 已启动'))
|
|
@@ -171,24 +169,26 @@ function _startGateway() {
|
|
|
171
169
|
return true
|
|
172
170
|
}
|
|
173
171
|
|
|
174
|
-
//
|
|
172
|
+
// gateway start 失败 → 直接后台运行进程(不依赖 schtasks/daemon)
|
|
173
|
+
const { spawn } = require('child_process')
|
|
175
174
|
if (isWin) {
|
|
175
|
+
// Windows: Start-Process 开隐藏窗口运行 npx openclaw gateway
|
|
176
176
|
spawnSync('powershell', [
|
|
177
177
|
'-NonInteractive', '-Command',
|
|
178
|
-
`Start-Process -
|
|
179
|
-
], { shell: false, timeout:
|
|
178
|
+
`Start-Process powershell -ArgumentList '-NonInteractive','-WindowStyle','Hidden','-Command','npx openclaw gateway --port 18789' -WindowStyle Hidden`
|
|
179
|
+
], { shell: false, timeout: 8000, stdio: 'ignore' })
|
|
180
180
|
} else {
|
|
181
|
-
const { spawn } = require('child_process')
|
|
182
181
|
const child = spawn('openclaw', ['gateway', '--port', '18789'], {
|
|
183
182
|
detached: true, stdio: 'ignore',
|
|
184
183
|
})
|
|
185
184
|
child.unref()
|
|
186
185
|
}
|
|
187
186
|
|
|
188
|
-
// 等 5
|
|
187
|
+
// 等 5 秒让 gateway 起来
|
|
189
188
|
const deadline = Date.now() + 5000
|
|
190
189
|
while (Date.now() < deadline) {}
|
|
191
190
|
|
|
191
|
+
// 验证
|
|
192
192
|
try {
|
|
193
193
|
const { execSync } = require('child_process')
|
|
194
194
|
execSync(
|