diff --git a/Bookworm-Setup.exe b/Bookworm-Setup.exe index c8cf5cf..c1b5fac 100644 Binary files a/Bookworm-Setup.exe and b/Bookworm-Setup.exe differ diff --git a/auto-setup.ps1 b/auto-setup.ps1 index 19b30e9..6010eb3 100644 --- a/auto-setup.ps1 +++ b/auto-setup.ps1 @@ -1613,9 +1613,22 @@ if (Test-Path (Join-Path $ClaudeDir ".git")) { # 设置 git 身份 (auto-resolve commit 需要) & git -C $ClaudeDir config user.email "bookworm@auto.local" 2>$null & git -C $ClaudeDir config user.name "Bookworm" 2>$null + # v3.2.0: 校验 remote URL, 旧仓库自动切换到新仓库 + try { + $currentRemote = (& git -C $ClaudeDir remote get-url origin 2>$null) -replace '\.git$', '' + $expectedBase = ($GitUrl -replace '\.git$', '') + if ($currentRemote -and $currentRemote -notmatch 'bookworm-smart-assistant') { + Log-Warn "配置仓库 remote 指向旧源: $currentRemote, 切换到 $GitUrl" + & git -C $ClaudeDir remote set-url origin $GitUrl 2>$null + Log-OK "remote 已切换到 bookworm-smart-assistant" + } + } catch {} try { # 强制清除冲突状态 (运行时文件不重要, Phase 5 会重新渲染) & git -C $ClaudeDir reset --hard HEAD 2>&1 | Out-Null + # 如果 remote 已切换, 需要 fetch 新仓库再 reset + & git -C $ClaudeDir fetch origin 2>&1 | Out-Null + & git -C $ClaudeDir reset --hard origin/main 2>&1 | Out-Null $r = Run-CmdWithUI "git" @("-C", $ClaudeDir, "pull", "--rebase", "--autostash") "同步配置仓库" 120000 if ($r.OK) { Log-OK "配置仓库已更新"