openclawsetup 2.8.12 → 2.8.13
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/bin/cli.mjs +29 -14
- package/package.json +1 -1
package/bin/cli.mjs
CHANGED
|
@@ -521,7 +521,7 @@ async function collectEvidencePackage(options = {}) {
|
|
|
521
521
|
|
|
522
522
|
const snapshot = gatherEnvironmentSnapshot();
|
|
523
523
|
const tokenOptimizationPreview = createTokenOptimizationPlan();
|
|
524
|
-
const cliName = snapshot.openclaw.detectedInstall?.name || findWorkingCliName() || 'openclaw';
|
|
524
|
+
const cliName = snapshot.openclaw.detectedInstall?.name || findWorkingCliName(snapshot.openclaw.configDir?.includes('.clawdbot') ? 'clawdbot' : undefined) || 'openclaw';
|
|
525
525
|
|
|
526
526
|
const captures = {
|
|
527
527
|
doctor: runCmdCapture(`${cliName} doctor`, quick ? 20000 : 90000),
|
|
@@ -697,9 +697,9 @@ ${colors.cyan('安装后配置模型:')}
|
|
|
697
697
|
npx openclawapi@latest # 交互式配置
|
|
698
698
|
|
|
699
699
|
${colors.cyan('常见问题快速修复:')}
|
|
700
|
-
Gateway 未启动: openclaw gateway start
|
|
700
|
+
Gateway 未启动: openclaw gateway start (或 clawdbot gateway start)
|
|
701
701
|
端口被占用: openclaw config set gateway.port 18790
|
|
702
|
-
配置文件损坏:
|
|
702
|
+
配置文件损坏: 重新运行 npx openclawsetup@latest
|
|
703
703
|
`);
|
|
704
704
|
}
|
|
705
705
|
|
|
@@ -796,8 +796,17 @@ function isRealGatewayCli(name) {
|
|
|
796
796
|
return true;
|
|
797
797
|
}
|
|
798
798
|
|
|
799
|
-
function findWorkingCliName() {
|
|
800
|
-
|
|
799
|
+
function findWorkingCliName(preferredName) {
|
|
800
|
+
const candidates = ['openclaw', 'clawdbot', 'moltbot'];
|
|
801
|
+
// If a preferred name is given (e.g. matching the config dir), check it first
|
|
802
|
+
if (preferredName) {
|
|
803
|
+
const reordered = [preferredName, ...candidates.filter(n => n !== preferredName)];
|
|
804
|
+
for (const name of reordered) {
|
|
805
|
+
if (isRealGatewayCli(name)) return name;
|
|
806
|
+
}
|
|
807
|
+
return null;
|
|
808
|
+
}
|
|
809
|
+
for (const name of candidates) {
|
|
801
810
|
if (isRealGatewayCli(name)) return name;
|
|
802
811
|
}
|
|
803
812
|
return null;
|
|
@@ -809,13 +818,17 @@ function detectExistingInstall() {
|
|
|
809
818
|
const clawdbotDir = join(home, '.clawdbot');
|
|
810
819
|
|
|
811
820
|
if (existsSync(openclawDir) || existsSync(clawdbotDir)) {
|
|
821
|
+
// Prefer the CLI that matches the config directory to avoid cross-config issues
|
|
822
|
+
// e.g. if config is in ~/.clawdbot, prefer 'clawdbot' CLI (reads ~/.clawdbot/clawdbot.json)
|
|
823
|
+
// if config is in ~/.openclaw, prefer 'openclaw' CLI (reads ~/.openclaw/openclaw.json)
|
|
812
824
|
const configDir = existsSync(openclawDir) ? openclawDir : clawdbotDir;
|
|
813
|
-
const
|
|
825
|
+
const preferredCli = existsSync(openclawDir) ? 'openclaw' : 'clawdbot';
|
|
826
|
+
const cliName = findWorkingCliName(preferredCli);
|
|
814
827
|
if (cliName) {
|
|
815
828
|
return { installed: true, configDir, name: cliName };
|
|
816
829
|
}
|
|
817
830
|
// Config dir exists but no working CLI found
|
|
818
|
-
return { installed: true, configDir, name:
|
|
831
|
+
return { installed: true, configDir, name: preferredCli, cliMissing: true };
|
|
819
832
|
}
|
|
820
833
|
|
|
821
834
|
const cliName = findWorkingCliName();
|
|
@@ -1696,7 +1709,7 @@ function showInstallGuide() {
|
|
|
1696
1709
|
console.log(colors.bold(colors.cyan(' 📖 OpenClaw 安装指引')));
|
|
1697
1710
|
console.log(colors.bold(colors.cyan('='.repeat(60))));
|
|
1698
1711
|
|
|
1699
|
-
console.log(colors.yellow('\n接下来会运行官方
|
|
1712
|
+
console.log(colors.yellow('\n接下来会运行官方 onboard 命令'));
|
|
1700
1713
|
console.log(colors.yellow('自动模式会按以下推荐选择(可随时接管):\n'));
|
|
1701
1714
|
|
|
1702
1715
|
console.log(colors.cyan('┌─────────────────────────────────────────────────────────┐'));
|
|
@@ -1910,7 +1923,7 @@ async function runOnboard(cliName) {
|
|
|
1910
1923
|
console.log(colors.bold(colors.cyan('\n[2/2] 运行配置向导\n')));
|
|
1911
1924
|
|
|
1912
1925
|
console.log(colors.gray('-'.repeat(60)));
|
|
1913
|
-
console.log(colors.gray('以下是官方
|
|
1926
|
+
console.log(colors.gray('以下是官方 onboard 界面:'));
|
|
1914
1927
|
console.log(colors.gray('-'.repeat(60) + '\n'));
|
|
1915
1928
|
|
|
1916
1929
|
const manualResult = runOnboardManual(cliName);
|
|
@@ -2269,7 +2282,7 @@ function showCompletionInfo(cliName) {
|
|
|
2269
2282
|
console.log(colors.cyan('\n下一步 - 配置 AI 模型(必须):'));
|
|
2270
2283
|
console.log(` ${colors.yellow('npx openclawapi@latest preset-claude')}`);
|
|
2271
2284
|
|
|
2272
|
-
showDashboardAccessInfo();
|
|
2285
|
+
showDashboardAccessInfo(cliName);
|
|
2273
2286
|
|
|
2274
2287
|
console.log(colors.cyan('\n常用命令:'));
|
|
2275
2288
|
console.log(` 查看状态: ${colors.yellow(`${cliName} status`)}`);
|
|
@@ -2284,12 +2297,14 @@ function showCompletionInfo(cliName) {
|
|
|
2284
2297
|
console.log('');
|
|
2285
2298
|
}
|
|
2286
2299
|
|
|
2287
|
-
function showDashboardAccessInfo() {
|
|
2300
|
+
function showDashboardAccessInfo(cliName) {
|
|
2288
2301
|
const config = getConfigInfo();
|
|
2289
2302
|
const port = config.port || 18789;
|
|
2290
2303
|
const tokenRaw = getDashboardToken(config) || '<你的token>';
|
|
2291
2304
|
const tokenMasked = maskToken(tokenRaw);
|
|
2292
2305
|
const dashboardUrl = `http://127.0.0.1:${port}/?token=${tokenMasked}`;
|
|
2306
|
+
const activeCli = cliName || (config.configPath?.includes('.clawdbot') ? 'clawdbot' : 'openclaw');
|
|
2307
|
+
const configFileName = config.configPath || `~/.${activeCli}/${activeCli}.json`;
|
|
2293
2308
|
|
|
2294
2309
|
if (detectVps()) {
|
|
2295
2310
|
const serverIp = getServerIp() || '<服务器IP>';
|
|
@@ -2305,10 +2320,10 @@ function showDashboardAccessInfo() {
|
|
|
2305
2320
|
console.log(` ${colors.green(dashboardUrl)}`);
|
|
2306
2321
|
console.log('');
|
|
2307
2322
|
console.log(colors.yellow(' 方式二:直接暴露端口(不推荐,有安全风险)'));
|
|
2308
|
-
console.log(colors.gray(
|
|
2323
|
+
console.log(colors.gray(` 1. 修改配置文件 ${configFileName}`));
|
|
2309
2324
|
console.log(colors.gray(' 将 "bind": "loopback" 改为 "bind": "all"'));
|
|
2310
2325
|
console.log(colors.gray(` 2. 在云服务器控制台开放端口 ${port}`));
|
|
2311
|
-
console.log(colors.gray(
|
|
2326
|
+
console.log(colors.gray(` 3. 重启 Gateway:${activeCli} gateway restart`));
|
|
2312
2327
|
console.log(colors.gray(` 4. 访问:http://${serverIp}:${port}/?token=...`));
|
|
2313
2328
|
} else {
|
|
2314
2329
|
console.log(colors.cyan('\nDashboard 访问:'));
|
|
@@ -2960,7 +2975,7 @@ async function showInteractiveMenu(existing) {
|
|
|
2960
2975
|
console.log(colors.bold(colors.cyan(' 🦞 OpenClaw 管理菜单')));
|
|
2961
2976
|
console.log(colors.bold(colors.cyan('='.repeat(50))));
|
|
2962
2977
|
|
|
2963
|
-
showDashboardAccessInfo();
|
|
2978
|
+
showDashboardAccessInfo(cliName);
|
|
2964
2979
|
|
|
2965
2980
|
console.log(colors.cyan('\n请选择操作:'));
|
|
2966
2981
|
console.log(` ${colors.yellow('1')}. 状态信息`);
|