openclawsetup 2.8.0 → 2.8.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 +1 -1
- package/bin/cli.mjs +32 -10
- package/package.json +1 -1
- package//344/275/277/347/224/250/350/257/264/346/230/216.md +1 -1
package/README.md
CHANGED
package/bin/cli.mjs
CHANGED
|
@@ -2338,24 +2338,46 @@ async function showStatusInfo(cliName) {
|
|
|
2338
2338
|
|
|
2339
2339
|
console.log(colors.bold(colors.cyan('\n📊 OpenClaw 状态信息\n')));
|
|
2340
2340
|
|
|
2341
|
-
//
|
|
2342
|
-
const
|
|
2343
|
-
|
|
2344
|
-
|
|
2341
|
+
// 服务状态(兼容不同 CLI 版本,避免 Windows 下误判)
|
|
2342
|
+
const statusAttempts = [
|
|
2343
|
+
{ cmd: `${cliName} status`, label: 'status' },
|
|
2344
|
+
{ cmd: `${cliName} gateway status`, label: 'gateway status' },
|
|
2345
|
+
];
|
|
2346
|
+
let statusState = 'unknown';
|
|
2347
|
+
let statusOutput = '';
|
|
2348
|
+
|
|
2349
|
+
for (const attempt of statusAttempts) {
|
|
2350
|
+
const statusResult = safeExec(attempt.cmd);
|
|
2351
|
+
if (!statusResult.ok || !statusResult.output) continue;
|
|
2352
|
+
statusOutput = statusResult.output;
|
|
2353
|
+
const parsed = parseStatusOutput(statusResult.output);
|
|
2354
|
+
if (parsed === 'running') {
|
|
2355
|
+
statusState = 'running';
|
|
2356
|
+
break;
|
|
2357
|
+
}
|
|
2358
|
+
if (parsed === 'stopped') {
|
|
2359
|
+
statusState = 'stopped';
|
|
2360
|
+
}
|
|
2361
|
+
}
|
|
2362
|
+
|
|
2363
|
+
// 端口检查(作为状态命令兜底)
|
|
2364
|
+
const portResult = getPortCheckOutput(port);
|
|
2365
|
+
const portListening = Boolean(portResult.ok && portResult.output);
|
|
2345
2366
|
|
|
2346
|
-
if (
|
|
2367
|
+
if (statusState === 'running') {
|
|
2347
2368
|
console.log(colors.green(' ✓ Gateway 服务正在运行'));
|
|
2369
|
+
} else if (portListening) {
|
|
2370
|
+
console.log(colors.yellow(' ⚠ 状态命令显示未运行,但端口可访问'));
|
|
2371
|
+
console.log(colors.gray(' 兼容模式判定:Gateway 可能正在运行(常见于旧版/Windows)'));
|
|
2348
2372
|
} else {
|
|
2349
2373
|
console.log(colors.red(' ✗ Gateway 服务未运行'));
|
|
2374
|
+
if (statusOutput) {
|
|
2375
|
+
console.log(colors.gray(` 状态输出: ${statusOutput.split('\n')[0].slice(0, 100)}`));
|
|
2376
|
+
}
|
|
2350
2377
|
console.log(colors.yellow(' → 请先选择「检查修复」自动修复此问题\n'));
|
|
2351
2378
|
return;
|
|
2352
2379
|
}
|
|
2353
2380
|
|
|
2354
|
-
// 端口检查
|
|
2355
|
-
const portCmd = platform() === 'win32'
|
|
2356
|
-
? `netstat -an | findstr :${port}`
|
|
2357
|
-
: `lsof -i :${port} 2>/dev/null || netstat -tlnp 2>/dev/null | grep :${port}`;
|
|
2358
|
-
const portResult = safeExec(portCmd);
|
|
2359
2381
|
if (portResult.ok && portResult.output) {
|
|
2360
2382
|
console.log(colors.green(` ✓ 端口 ${port} 正在监听`));
|
|
2361
2383
|
} else {
|
package/package.json
CHANGED