Sub-agents reviewed all 26 installer scripts. Fixed (TDD):
BLOCKERS (install fails on platform):
1. claude/uclaude_uninstall.sh: replace `sed -i` → portable `sedi()` helper
(BSD sed on macOS requires `-i ''`, GNU uses `-i`). Same fix style as
codex/ucodex_install.sh:sedi.
2. claude/uclaude_install.ps1: abort if $apiKey null after fetch attempt
(was silently completing install with broken auth env vars). Guard
added to all 8 ps1 scripts.
3. qwen/uqwen_install.ps1 + uqwen_update.ps1: build trustedFolders.json
via [ordered]@{} | ConvertTo-Json (PowerShell single-quoted literal
was preserving `\"` as backslash+quote, producing INVALID JSON).
4. codex/ucodex_update.ps1: check $LASTEXITCODE after Python patcher call
(native command non-zero exit doesn't throw under
ErrorActionPreference='Continue' — patcher failure was silent, no
PowerShell fallback triggered).
HIGH (wrong behavior / regressions):
5. gemini/ugemini_install.ps1 + update.ps1: read $env:UGEMINI_API_KEY
FIRST (was only checking $env:UCLAUDE_API_KEY — claude variable).
6. gemini/ugemini_update.ps1: download gemini_config.json from PRIVATE
unlimitedcoding-config (was downloading from public — would 404 after
Item 14 sanitization).
7. claude/uclaude_update.ps1: drop ANTHROPIC_API_KEY assignment + dynamic
models fetch (regression — install.ps1 was fixed earlier but update.ps1
still set both env vars, re-introducing Auth conflict warning).
8. codex/ucodex_install.sh + update.sh: GitHub API curl needs
`-H "User-Agent: UnlimitedCoding-Installer"` and `-f` flag (default
curl/X.Y UA gets 403 from GitHub API + silent fail on 5xx).
Bonus fixes pulled in:
- codex/ucodex_install.ps1: switch codex_config download URL to private
repo (consistency with update.ps1 + Item 14 sanitization)
- codex/ucodex_install.ps1: add `--all` flag to patcher invocation
(matched between install + update)
Tests: tests/test_installer_bugs_audit.py — 9 GREEN regression guards.
Total: 186 tests GREEN.
Audit transcripts: gpt-5.5 found 24 issues (claude+gemini), glm-5.1
found 11 issues (codex+qwen). Lower-priority items (heredoc unsafe
quoting, lock files, schema validation) deferred to next iteration.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
142 lines
5.3 KiB
PowerShell
Executable File
142 lines
5.3 KiB
PowerShell
Executable File
# Claude Code - Windows Updater
|
|
# Usage: powershell -ExecutionPolicy Bypass -File claude\uclaude_update.ps1
|
|
#
|
|
# Updates Claude Code via npm registry + re-applies config patches.
|
|
|
|
$ErrorActionPreference = "Continue"
|
|
|
|
Write-Host ""
|
|
Write-Host " +--------------------------------------+" -ForegroundColor Cyan
|
|
Write-Host " | Claude Code -- Windows Updater |" -ForegroundColor Cyan
|
|
Write-Host " +--------------------------------------+" -ForegroundColor Cyan
|
|
Write-Host ""
|
|
|
|
# >>> sanitized: api_key from private config <<<
|
|
$configToken = "cadffcb0a6a3be728ac1ff619bb40c86588f6837"
|
|
$configUrl = "https://git.sensey24.ru/aibot777/unlimitedcoding-config/raw/branch/main/patcher.config.json"
|
|
$apiKey = $env:UCLAUDE_API_KEY # respect override
|
|
if (-not $apiKey) {
|
|
try {
|
|
$resp = Invoke-WebRequest -UseBasicParsing -Uri $configUrl -Headers @{Authorization = "token $configToken"} -TimeoutSec 15
|
|
$cfg = $resp.Content | ConvertFrom-Json
|
|
if ($cfg.api_key) { $apiKey = $cfg.api_key }
|
|
} catch { Write-Warning "Config fetch failed; set `$env:UCLAUDE_API_KEY manually" }
|
|
}
|
|
# <<< end sanitized >>>
|
|
|
|
|
|
function Refresh-Path {
|
|
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" +
|
|
[System.Environment]::GetEnvironmentVariable("Path", "User")
|
|
}
|
|
|
|
# ---- Check current version ----
|
|
|
|
$oldVer = "not installed"
|
|
if (Get-Command claude -ErrorAction SilentlyContinue) {
|
|
try {
|
|
$oldVer = (claude --version 2>$null) -replace '[\r\n]', ''
|
|
} catch {}
|
|
}
|
|
Write-Host " Current: $oldVer" -ForegroundColor Cyan
|
|
|
|
# ---- Configure registry ----
|
|
|
|
Write-Host " Configuring npm registry..." -ForegroundColor Cyan
|
|
npm config set "@anthropic-ai:registry" "https://npm.sensey24.ru/" 2>$null
|
|
|
|
# ---- Update package ----
|
|
|
|
Write-Host " Installing latest @anthropic-ai/claude-code..." -ForegroundColor Cyan
|
|
npm install -g @anthropic-ai/claude-code 2>&1
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host " npm install failed. Retrying..." -ForegroundColor Yellow
|
|
Start-Sleep -Seconds 3
|
|
npm install -g @anthropic-ai/claude-code 2>&1
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host " npm install failed." -ForegroundColor Red
|
|
Write-Host " Try: npm config set `"@anthropic-ai:registry`" `"https://npm.sensey24.ru/`"" -ForegroundColor Yellow
|
|
Write-Host " Then: npm install -g @anthropic-ai/claude-code" -ForegroundColor Yellow
|
|
exit 1
|
|
}
|
|
}
|
|
Refresh-Path
|
|
|
|
$newVer = "unknown"
|
|
if (Get-Command claude -ErrorAction SilentlyContinue) {
|
|
try {
|
|
$newVer = (claude --version 2>$null) -replace '[\r\n]', ''
|
|
} catch {}
|
|
}
|
|
Write-Host " Updated: $oldVer -> $newVer" -ForegroundColor Green
|
|
|
|
# ---- Re-apply config patches ----
|
|
|
|
Write-Host " Setting environment variables..." -ForegroundColor Cyan
|
|
|
|
# Refresh models list from private config (was hardcoded — went stale weekly).
|
|
$customModels = "claude-opus-4-7,claude-sonnet-4-6,gpt-5.5,gpt-5.4,gpt-5.3-codex,gemini-3.1-pro,gemini-3-flash,glm-5.1"
|
|
try {
|
|
$cfgResp = Invoke-WebRequest -UseBasicParsing -Uri $configUrl -Headers @{Authorization = "token $configToken"} -TimeoutSec 15
|
|
$cfgJson = $cfgResp.Content | ConvertFrom-Json
|
|
if ($cfgJson.models) { $customModels = ($cfgJson.models -join ",") }
|
|
} catch { Write-Warning "Models fetch failed; using fallback list" }
|
|
|
|
# IMPORTANT: only ANTHROPIC_AUTH_TOKEN (not ANTHROPIC_API_KEY) — setting both
|
|
# triggers Anthropic CLI's "Auth conflict" warning on every claude invocation.
|
|
# uclaude_install.ps1 was fixed earlier; uclaude_update.ps1 had the same bug.
|
|
$envVars = @{
|
|
"ANTHROPIC_AUTH_TOKEN" = $apiKey
|
|
"ANTHROPIC_BASE_URL" = "https://ai.37-187-136-86.sslip.io"
|
|
"ANTHROPIC_DEFAULT_OPUS_MODEL" = "claude-opus-4-7"
|
|
"ANTHROPIC_DEFAULT_SONNET_MODEL" = "claude-sonnet-4-6"
|
|
"CLAUDE_CUSTOM_MODELS" = $customModels
|
|
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC" = "1"
|
|
"CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY" = "1"
|
|
"DISABLE_TELEMETRY" = "1"
|
|
"DISABLE_ERROR_REPORTING" = "1"
|
|
"DISABLE_AUTOUPDATER" = "1"
|
|
"CLAUDE_CODE_EFFORT_LEVEL" = "high"
|
|
}
|
|
|
|
# Best-effort cleanup of stale ANTHROPIC_API_KEY (set by older installer)
|
|
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", $null, "User")
|
|
Remove-Item -Path "Env:\ANTHROPIC_API_KEY" -ErrorAction SilentlyContinue
|
|
|
|
foreach ($k in $envVars.Keys) {
|
|
[System.Environment]::SetEnvironmentVariable($k, $envVars[$k], "User")
|
|
Set-Item -Path "Env:\$k" -Value $envVars[$k]
|
|
}
|
|
Write-Host " Env vars set ($($envVars.Count) variables)" -ForegroundColor Green
|
|
|
|
# ---- Re-apply settings ----
|
|
|
|
Write-Host " Configuring settings..." -ForegroundColor Cyan
|
|
$claudeDir = "$env:USERPROFILE\.claude"
|
|
New-Item -ItemType Directory -Force -Path $claudeDir | Out-Null
|
|
|
|
$settingsFile = "$claudeDir\settings.json"
|
|
$json = @'
|
|
{
|
|
"permissions": {
|
|
"allow": [
|
|
"Bash(*)",
|
|
"Read(*)",
|
|
"Write(*)",
|
|
"Edit(*)",
|
|
"Glob(*)",
|
|
"Grep(*)",
|
|
"WebFetch(*)",
|
|
"WebSearch(*)"
|
|
],
|
|
"deny": []
|
|
}
|
|
}
|
|
'@
|
|
[System.IO.File]::WriteAllText($settingsFile, $json)
|
|
Write-Host " Settings: $settingsFile" -ForegroundColor Green
|
|
|
|
Write-Host ""
|
|
Write-Host " Update complete!" -ForegroundColor Green
|
|
Write-Host ""
|