diff --git a/auto-setup.ps1 b/auto-setup.ps1 index 20f35ff..016c62d 100644 --- a/auto-setup.ps1 +++ b/auto-setup.ps1 @@ -16,7 +16,7 @@ param( $ErrorActionPreference = "Stop" # ─── 版本号 (每次更新递增, build.ps1 自动读取) ────── -$BWVersion = "2.2.2" +$BWVersion = "2.2.3" # ─── B4: 单实例保护 (防止双击两次导致竞态) ───────── $mutexCreated = $false @@ -1522,14 +1522,21 @@ if ($allOK -and $env:ANTHROPIC_API_KEY) { $splash.Close() $splash.Dispose() - # 启动 Bookworm — 通过桌面快捷方式的 bat (含自动 git pull) + # 启动 Bookworm — 优先 Windows Terminal > pwsh > cmd.exe if (-not $SkipLaunch) { $startBat = Join-Path $BootDir "启动Bookworm.bat" if (Test-Path $startBat) { Start-Process -FilePath $startBat -WorkingDirectory $BootDir } else { - $launchCmd = "title Bookworm Smart Assistant v$BWVersion && cd /d `"$BootDir`" && claude --dangerously-skip-permissions" - Start-Process -FilePath "cmd.exe" -ArgumentList "/k", $launchCmd + $claudeCmd = "claude --dangerously-skip-permissions" + if (Get-Command wt.exe -ErrorAction SilentlyContinue) { + # Windows Terminal: 现代 UI, 支持全屏/标签页 + Start-Process wt.exe -ArgumentList "new-tab", "-d", $BootDir, "--title", "Bookworm v$BWVersion", "cmd", "/k", $claudeCmd + } elseif ($PwshPath -and (Test-Path $PwshPath)) { + Start-Process $PwshPath -ArgumentList "-NoExit", "-Command", "cd '$BootDir'; $claudeCmd" -WorkingDirectory $BootDir + } else { + Start-Process cmd.exe -ArgumentList "/k", "title Bookworm v$BWVersion && cd /d `"$BootDir`" && $claudeCmd" + } } } @@ -1543,6 +1550,11 @@ if ($allOK -and $env:ANTHROPIC_API_KEY) { $launchResult = Show-MsgBox "安装完成, 但存在以下问题:`n$issueText`n`n是否仍然启动 Claude Code?`n(将以受限模式运行)`n`n日志: $BWLogFile" "安装警告" "YesNo" "Warning" if ($launchResult -eq "Yes" -and -not $SkipLaunch) { - Start-Process -FilePath "cmd.exe" -ArgumentList "/k", "claude --dangerously-skip-permissions" + $claudeCmd = "claude --dangerously-skip-permissions" + if (Get-Command wt.exe -ErrorAction SilentlyContinue) { + Start-Process wt.exe -ArgumentList "new-tab", "--title", "Bookworm", "cmd", "/k", $claudeCmd + } else { + Start-Process cmd.exe -ArgumentList "/k", $claudeCmd + } } }