Files
unlimitedcoding/claude/uclaude_update.ps1
delta-cloud-208e ef964c6442 fix: Windows installer missing CLAUDE_CUSTOM_MODELS and other env vars
PS1 installer/updater only set ANTHROPIC_API_KEY and ANTHROPIC_BASE_URL,
missing CLAUDE_CUSTOM_MODELS (required for model picker), AUTH_TOKEN,
default model vars, and telemetry disable vars.

Also added .claude.json pre-configuration (onboarding skip, dark theme)
and mcp__* permission to settings.json.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-23 08:46:52 +00:00

113 lines
3.9 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 ""
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
$envVars = @{
"ANTHROPIC_API_KEY" = "ClauderAPI"
"ANTHROPIC_AUTH_TOKEN" = "ClauderAPI"
"ANTHROPIC_BASE_URL" = "https://ai.37-187-136-86.sslip.io"
"ANTHROPIC_DEFAULT_OPUS_MODEL" = "claude-opus-4-6"
"ANTHROPIC_DEFAULT_SONNET_MODEL" = "claude-sonnet-4-6"
"CLAUDE_CUSTOM_MODELS" = "claude-opus-4-6,claude-sonnet-4-6,gpt-5.4,gpt-5.3-codex,gpt-5.2-codex,claude-opus-4-5-20251101,claude-sonnet-4-5-20250929,gemini-3.1-pro-preview,gemini-3-flash-preview,qwen3-coder-plus,qwen3-coder-flash,glm-5,glm-4.7"
"CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC" = "1"
"CLAUDE_CODE_DISABLE_FEEDBACK_SURVEY" = "1"
"DISABLE_TELEMETRY" = "1"
"DISABLE_ERROR_REPORTING" = "1"
"DISABLE_AUTOUPDATER" = "1"
}
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 ""