From 4dc5f8e0f88a7696fa31c13013876a3d66848f60 Mon Sep 17 00:00:00 2001 From: bookworm Date: Mon, 13 Apr 2026 17:39:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20v2.2.3=20-=20=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E7=BB=88=E7=AB=AF=E4=BC=98=E5=85=88=20Windows=20Terminal=20>?= =?UTF-8?q?=20pwsh=20>=20cmd?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 检测 wt.exe (Windows Terminal) 可用则优先使用 (现代UI/全屏/标签页), 其次 pwsh (PowerShell 7), 最后降级 cmd.exe。 解决 Win10 用户只能看到老旧蓝色终端的问题。 Co-Authored-By: Claude Opus 4.6 (1M context) --- auto-setup.ps1 | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) 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 + } } }