feat: add update scripts for all tools + Update section in README

- gemini/ugemini_update.sh + .ps1
- codex/ucodex_update.sh + .ps1
- qwen/uqwen_update.sh + .ps1
- README.md: added Update section with one-line and cloned-repo commands
- README.md: removed outdated Codex update instructions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
delta-cloud-208e
2026-03-08 07:44:38 +00:00
parent 1fa1dbae11
commit 9adb786bec
7 changed files with 557 additions and 7 deletions

124
codex/ucodex_update.ps1 Normal file
View File

@@ -0,0 +1,124 @@
# Codex CLI — Windows Updater
# Downloads latest binary from GitHub + re-applies config patches.
#
# Usage: powershell -ExecutionPolicy Bypass -File codex\ucodex_update.ps1
$ErrorActionPreference = "Continue"
Write-Host ""
Write-Host " +--------------------------------------+" -ForegroundColor Cyan
Write-Host " | Codex CLI -- 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 codex -ErrorAction SilentlyContinue) {
$oldVer = [regex]::Match((codex --version 2>$null), '\d+\.\d+\.\d+').Value
}
Write-Host " Current: $oldVer" -ForegroundColor Cyan
# ---- Get latest version ----
Write-Host " Checking latest version..." -ForegroundColor Cyan
try {
$release = Invoke-RestMethod -Uri "https://api.github.com/repos/openai/codex/releases/latest" -UseBasicParsing -TimeoutSec 15
$latestVer = ($release.tag_name -replace '^rust-v', '')
Write-Host " Latest: $latestVer" -ForegroundColor Green
} catch {
Write-Host " Could not fetch latest version from GitHub." -ForegroundColor Red
exit 1
}
if ($oldVer -eq $latestVer) {
Write-Host " Already up to date ($latestVer)" -ForegroundColor Green
} else {
# ---- Download binary ----
$arch = if ([System.Environment]::Is64BitOperatingSystem) { "x86_64" } else { "i686" }
$binarySuffix = "$arch-pc-windows-msvc"
$downloadUrl = "https://github.com/openai/codex/releases/download/rust-v$latestVer/codex-$binarySuffix.zip"
Write-Host " Downloading codex-$binarySuffix..." -ForegroundColor Cyan
$tempDir = Join-Path $env:TEMP "codex-update-$(Get-Random)"
New-Item -ItemType Directory -Force -Path $tempDir | Out-Null
$zipFile = Join-Path $tempDir "codex.zip"
try {
Invoke-WebRequest -Uri $downloadUrl -OutFile $zipFile -UseBasicParsing
} catch {
# Try tar.gz fallback
$downloadUrl = "https://github.com/openai/codex/releases/download/rust-v$latestVer/codex-$binarySuffix.tar.gz"
$tgzFile = Join-Path $tempDir "codex.tar.gz"
try {
Invoke-WebRequest -Uri $downloadUrl -OutFile $tgzFile -UseBasicParsing
tar -xzf $tgzFile -C $tempDir
} catch {
Write-Host " Download failed." -ForegroundColor Red
Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue
exit 1
}
}
if (Test-Path $zipFile) {
Expand-Archive -Path $zipFile -DestinationPath $tempDir -Force
}
$codexExe = Get-ChildItem -Path $tempDir -Recurse -Filter "codex.exe" | Select-Object -First 1
if (-not $codexExe) {
$codexExe = Get-ChildItem -Path $tempDir -Recurse -Filter "codex" | Where-Object { -not $_.PSIsContainer } | Select-Object -First 1
}
if (-not $codexExe) {
Write-Host " Binary not found in archive" -ForegroundColor Red
Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue
exit 1
}
Get-Process -Name "codex" -ErrorAction SilentlyContinue | Stop-Process -Force
$installDir = "$env:LOCALAPPDATA\Programs\codex"
New-Item -ItemType Directory -Force -Path $installDir | Out-Null
Copy-Item -Path $codexExe.FullName -Destination "$installDir\codex.exe" -Force
$userPath = [System.Environment]::GetEnvironmentVariable("Path", "User")
if ($userPath -notlike "*$installDir*") {
[System.Environment]::SetEnvironmentVariable("Path", "$userPath;$installDir", "User")
$env:Path = "$env:Path;$installDir"
}
Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue
Refresh-Path
$newVer = [regex]::Match((codex --version 2>$null), '\d+\.\d+\.\d+').Value
Write-Host " Updated: $oldVer -> $newVer" -ForegroundColor Green
}
# ---- Download and apply patches ----
$pyCmd = if (Get-Command python3 -ErrorAction SilentlyContinue) { "python3" } else { "python" }
$patchDir = Join-Path $env:TEMP "codex-patch-$(Get-Random)"
New-Item -ItemType Directory -Force -Path $patchDir | Out-Null
$repoRaw = "https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/codex"
$token = "cadffcb0a6a3be728ac1ff619bb40c86588f6837"
$headers = @{ "Authorization" = "token $token" }
Write-Host " Downloading patcher..." -ForegroundColor Cyan
Invoke-WebRequest -Uri "$repoRaw/codex_patcher.py" -OutFile "$patchDir\codex_patcher.py" -UseBasicParsing -Headers $headers
Invoke-WebRequest -Uri "$repoRaw/codex_config.json" -OutFile "$patchDir\codex_config.json" -UseBasicParsing -Headers $headers
Write-Host " Applying patches..." -ForegroundColor Cyan
& $pyCmd "$patchDir\codex_patcher.py" --apply --config "$patchDir\codex_config.json"
Remove-Item -Recurse -Force $patchDir -ErrorAction SilentlyContinue
Write-Host ""
Write-Host " Update complete!" -ForegroundColor Green
Write-Host ""