openclawsetup 2.4.9 → 2.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.
Files changed (2) hide show
  1. package/bin/cli.mjs +32 -48
  2. package/package.json +1 -1
package/bin/cli.mjs CHANGED
@@ -512,64 +512,48 @@ async function installOpenClaw() {
512
512
  async function runOnboard(cliName) {
513
513
  console.log(colors.bold(colors.cyan('\n[2/2] 运行配置向导\n')));
514
514
 
515
- // 显示指引
516
- showInstallGuide();
517
-
518
- await waitForEnter('准备好了吗?按回车开始配置...');
519
-
520
- console.log(colors.gray('\n' + '-'.repeat(60)));
521
- console.log(colors.gray('以下是官方 openclaw onboard 界面:'));
522
- console.log(colors.gray('-'.repeat(60) + '\n'));
523
-
524
515
  const options = parseArgs();
525
- const preferAuto = !options.manual;
526
- let usedAuto = false;
527
-
528
- if (preferAuto) {
529
- const flagResult = runOnboardFlags(cliName, options);
530
- if (flagResult.ran) {
531
- usedAuto = true;
532
- console.log(colors.gray('\n' + '-'.repeat(60)));
533
- if (!flagResult.ok) {
534
- log.warn(`onboard 退出码: ${flagResult.exitCode}`);
535
- log.hint('如果配置未完成,可以手动运行: ' + cliName + ' onboard');
536
- }
537
- } else {
538
- const autoResult = await runOnboardAuto(cliName, options);
539
- if (autoResult.ok) {
540
- usedAuto = true;
541
- console.log(colors.gray('\n' + '-'.repeat(60)));
542
- if (autoResult.exitCode !== 0) {
543
- log.warn(`onboard 退出码: ${autoResult.exitCode}`);
544
- log.hint('如果配置未完成,可以手动运行: ' + cliName + ' onboard');
545
- }
546
- } else if (options.auto) {
547
- exitWithError('PTY_UNAVAILABLE', `
548
- 原因: ${autoResult.reason || '未能启用自动应答'}
549
516
 
550
- 解决方案:
551
- 1. 使用手动模式:
552
- npx openclawsetup@latest --manual
553
- 2. 在 Linux 服务器上补齐编译依赖后再试:
554
- sudo apt-get install -y build-essential python3 make g++
555
- npx openclawsetup@latest --auto
556
- 3. 或直接运行官方命令:
557
- npm install -g openclaw@latest
558
- openclaw onboard --install-daemon`);
559
- } else {
560
- log.warn('自动模式不可用,已切换为手动模式');
561
- log.hint(autoResult.reason || '未能启用自动应答');
562
- }
563
- }
517
+ // 让用户选择安装模式
518
+ let mode = options.manual ? '2' : options.auto ? '1' : '';
519
+ if (!mode) {
520
+ console.log(colors.cyan('请选择安装模式:'));
521
+ console.log(` ${colors.yellow('1')}. 自动安装(跳过所有配置,后续单独配置模型和渠道)`);
522
+ console.log(` ${colors.yellow('2')}. 手动安装(走官方 onboard 完整流程)`);
523
+ mode = await askQuestion('\n请选择 (1/2): ');
564
524
  }
565
525
 
566
- if (!usedAuto) {
526
+ if (mode.trim() === '2') {
527
+ // 手动模式:直接运行官方 onboard
528
+ console.log(colors.gray('\n' + '-'.repeat(60)));
529
+ console.log(colors.gray('以下是官方 openclaw onboard 界面:'));
530
+ console.log(colors.gray('-'.repeat(60) + '\n'));
531
+
567
532
  const manualResult = runOnboardManual(cliName);
568
533
  console.log(colors.gray('\n' + '-'.repeat(60)));
569
534
  if (manualResult.status !== 0) {
570
535
  log.warn(`onboard 退出码: ${manualResult.status}`);
571
536
  log.hint('如果配置未完成,可以手动运行: ' + cliName + ' onboard');
572
537
  }
538
+ } else {
539
+ // 自动模式:只用最安全的参数
540
+ console.log(colors.gray('\n正在自动安装(跳过模型和渠道配置)...\n'));
541
+
542
+ const { file, args } = getOnboardCommand(cliName, ['onboard', '--install-daemon']);
543
+ const result = spawnSync(file, args, { stdio: 'inherit' });
544
+
545
+ if (result.status !== 0) {
546
+ // 自动模式失败,回退到手动
547
+ log.warn('自动安装未完成,切换到手动模式...');
548
+ console.log(colors.gray('\n' + '-'.repeat(60)));
549
+ console.log(colors.gray('以下是官方 openclaw onboard 界面:'));
550
+ console.log(colors.gray('-'.repeat(60) + '\n'));
551
+ const manualResult = runOnboardManual(cliName);
552
+ if (manualResult.status !== 0) {
553
+ log.warn(`onboard 退出码: ${manualResult.status}`);
554
+ log.hint('如果配置未完成,可以手动运行: ' + cliName + ' onboard');
555
+ }
556
+ }
573
557
  }
574
558
  }
575
559
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openclawsetup",
3
- "version": "2.4.9",
3
+ "version": "2.5.0",
4
4
  "description": "OpenClaw 安装向导 - 智能安装、诊断、自动修复",
5
5
  "type": "module",
6
6
  "bin": {