@simonyea/holysheep-cli 1.2.7 → 1.2.8
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 +19 -5
package/package.json
CHANGED
package/src/tools/openclaw.js
CHANGED
|
@@ -118,7 +118,15 @@ module.exports = {
|
|
|
118
118
|
id: 'openclaw',
|
|
119
119
|
|
|
120
120
|
checkInstalled() {
|
|
121
|
-
|
|
121
|
+
if (require('../utils/which').commandExists('openclaw')) return true
|
|
122
|
+
// Windows PATH 未刷新时,用 npx 探测
|
|
123
|
+
if (process.platform === 'win32') {
|
|
124
|
+
try {
|
|
125
|
+
require('child_process').execSync('npx openclaw --version', { stdio: 'ignore', timeout: 10000 })
|
|
126
|
+
return true
|
|
127
|
+
} catch {}
|
|
128
|
+
}
|
|
129
|
+
return false
|
|
122
130
|
},
|
|
123
131
|
|
|
124
132
|
isConfigured() {
|
|
@@ -162,7 +170,12 @@ module.exports = {
|
|
|
162
170
|
getConfigPath() { return CONFIG_FILE },
|
|
163
171
|
hint: 'Gateway 已自动在后台启动,打开浏览器即可使用',
|
|
164
172
|
launchCmd: null,
|
|
165
|
-
launchNote
|
|
173
|
+
get launchNote() {
|
|
174
|
+
const isWin = process.platform === 'win32'
|
|
175
|
+
return isWin
|
|
176
|
+
? '🌐 打开浏览器访问 http://127.0.0.1:18789/\n 如无法访问请运行: npx openclaw gateway start'
|
|
177
|
+
: '🌐 打开浏览器访问 http://127.0.0.1:18789/'
|
|
178
|
+
},
|
|
166
179
|
installCmd: 'npm install -g openclaw@latest',
|
|
167
180
|
docsUrl: 'https://docs.openclaw.ai',
|
|
168
181
|
}
|
|
@@ -179,7 +192,8 @@ module.exports = {
|
|
|
179
192
|
function _initAndStartGateway() {
|
|
180
193
|
const chalk = require('chalk')
|
|
181
194
|
const isWin = process.platform === 'win32'
|
|
182
|
-
|
|
195
|
+
// Windows 刚装完 npm 包,PATH 未刷新,用 npx 兜底
|
|
196
|
+
const bin = isWin ? 'npx openclaw' : 'openclaw'
|
|
183
197
|
|
|
184
198
|
console.log(chalk.gray('\n ⚙️ 正在启动 OpenClaw Gateway...'))
|
|
185
199
|
|
|
@@ -212,10 +226,10 @@ function _initAndStartGateway() {
|
|
|
212
226
|
// Step 3: fallback — 直接后台运行进程
|
|
213
227
|
console.log(chalk.gray(' → 以守护进程模式启动...'))
|
|
214
228
|
if (isWin) {
|
|
215
|
-
// Windows: PowerShell Start-Process
|
|
229
|
+
// Windows: PowerShell Start-Process 后台运行(用 npx 兜底 PATH 未刷新)
|
|
216
230
|
spawnSync('powershell', [
|
|
217
231
|
'-NonInteractive', '-WindowStyle', 'Hidden', '-Command',
|
|
218
|
-
`Start-Process -FilePath "
|
|
232
|
+
`Start-Process -FilePath "npx" -ArgumentList "openclaw","gateway","--port","18789" -WindowStyle Hidden`
|
|
219
233
|
], { shell: false, timeout: 5000, stdio: 'ignore' })
|
|
220
234
|
} else {
|
|
221
235
|
const { spawn } = require('child_process')
|