diff --git a/Bookworm-Setup.exe b/Bookworm-Setup.exe index c1b5fac..7e88ccf 100644 Binary files a/Bookworm-Setup.exe and b/Bookworm-Setup.exe differ diff --git a/auto-setup.ps1 b/auto-setup.ps1 index 6010eb3..c99ac6b 100644 --- a/auto-setup.ps1 +++ b/auto-setup.ps1 @@ -1593,9 +1593,12 @@ if (Is-DryRun "net") { Log-OK "[DryRun=net] 网络诊断完成, 退出"; exit 0 # ======================================================================== Log-Phase 3 "同步 Bookworm 配置" if (Is-DryRun "repo") { Log-Info "[DryRun=repo] 测试 git clone 完成后退出, 不做凭证解密/配置渲染" } +function Test-CloneComplete { (Test-Path (Join-Path $ClaudeDir "CLAUDE.md")) -and (Test-Path (Join-Path $ClaudeDir "skills")) -and (Test-Path (Join-Path $ClaudeDir "hooks")) } # B3: 使用 Windows Credential Manager (DPAPI 加密) 替代明文 store git config --global credential.helper manager 2>$null +# v3.2.0: 强制 git 对国内仓库直连 (VPN 开启时 git 可能走代理导致 clone 失败) +git config --global "http.https://code.letcareme.com/.proxy" "" 2>$null # 克隆/更新 config 仓库 (.claude/) — 使用 Run-CmdWithUI 防止 UI 冻结 # 辅助函数: clone 后缓存凭证到 Windows Credential Manager @@ -1652,16 +1655,16 @@ elseif (Test-Path $ClaudeDir) { # v3.0.1 先匿名克隆 (repos 已 public + REQUIRE_SIGNIN_VIEW=false), 失败才弹凭证 $r = Run-CmdWithUI "git" @("clone", "--depth", "1", $GitUrl, $ClaudeDir) "克隆配置仓库 (匿名)" 180000 - if (-not (Test-Path (Join-Path $ClaudeDir "CLAUDE.md"))) { + if (-not (Test-CloneComplete)) { Log-Warn "匿名克隆失败, 弹凭证对话框重试..." $cred = Show-GiteaCredentialDialog if ($cred) { $cloneUrl = $GitUrl -replace '://', "://$([System.Uri]::EscapeDataString($cred.User)):$([System.Uri]::EscapeDataString($cred.Pass))@" $r = Run-CmdWithUI "git" @("clone", "--depth", "1", $cloneUrl, $ClaudeDir) "克隆配置仓库 (认证)" 180000 - if (Test-Path (Join-Path $ClaudeDir "CLAUDE.md")) { Cache-GitCredentials $cred } + if (Test-CloneComplete) { Cache-GitCredentials $cred } } } - if (Test-Path (Join-Path $ClaudeDir "CLAUDE.md")) { + if (Test-CloneComplete) { Log-OK "配置仓库克隆成功 (旧目录已备份)" } else { Log-Fail "克隆失败" @@ -1674,16 +1677,16 @@ else { Log-Info "首次安装, 匿名克隆配置仓库..." # v3.0.1 先匿名, 失败才弹凭证 $r = Run-CmdWithUI "git" @("clone", "--depth", "1", $GitUrl, $ClaudeDir) "克隆配置仓库 (匿名)" 180000 - if (-not (Test-Path (Join-Path $ClaudeDir "CLAUDE.md"))) { + if (-not (Test-CloneComplete)) { Log-Warn "匿名克隆失败, 弹凭证对话框重试..." $cred = Show-GiteaCredentialDialog if ($cred) { $cloneUrl = $GitUrl -replace '://', "://$([System.Uri]::EscapeDataString($cred.User)):$([System.Uri]::EscapeDataString($cred.Pass))@" $r = Run-CmdWithUI "git" @("clone", "--depth", "1", $cloneUrl, $ClaudeDir) "克隆配置仓库 (认证)" 180000 - if (Test-Path (Join-Path $ClaudeDir "CLAUDE.md")) { Cache-GitCredentials $cred } + if (Test-CloneComplete) { Cache-GitCredentials $cred } } } - if (Test-Path (Join-Path $ClaudeDir "CLAUDE.md")) { + if (Test-CloneComplete) { Log-OK "配置仓库克隆成功" } else { Log-Fail "克隆失败"