fix(v3.2.0): git proxy bypass + clone 完整性验证加固
1. git http.proxy="" 强制 code.letcareme.com 直连 (VPN 环境 clone 失败根因) 2. clone 验证从只检查 CLAUDE.md 升级为 CLAUDE.md + skills/ + hooks/ 三项 3. remote URL 自动修正 (旧仓库 → bookworm-smart-assistant) 确保 VPN 用户一键安装体验完整 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
1f90b933c2
commit
5ca772ebbe
Binary file not shown.
@ -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 "克隆失败"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user