fix(codex): fix Windows download URLs — binary is .exe not .zip

GitHub releases use codex-x86_64-pc-windows-msvc.exe (not .zip).
Fixed both install and update PS1 scripts.
Also added patched settingsSchema.js to gemini releases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
delta-cloud-208e
2026-03-08 08:01:38 +00:00
parent 9b6d0ebeb7
commit 9f26c53ece
3 changed files with 2430 additions and 51 deletions

View File

@@ -96,26 +96,26 @@ if ($currentVersion -eq $latestVersion) {
}
# Determine architecture
$arch = if ([System.Environment]::Is64BitOperatingSystem) { "x86_64" } else { "i686" }
$arch = if ([System.Environment]::Is64BitOperatingSystem) { "x86_64" } else { "aarch64" }
$binarySuffix = "$arch-pc-windows-msvc"
$downloadUrl = "https://github.com/openai/codex/releases/download/rust-v$latestVersion/codex-$binarySuffix.zip"
$downloadUrl = "https://github.com/openai/codex/releases/download/rust-v$latestVersion/codex-$binarySuffix.exe"
Write-Host " Downloading: codex-$binarySuffix.zip" -ForegroundColor Cyan
Write-Host " Downloading: codex-$binarySuffix.exe" -ForegroundColor Cyan
$tempDir = Join-Path $env:TEMP "codex-install-$(Get-Random)"
New-Item -ItemType Directory -Force -Path $tempDir | Out-Null
$zipFile = Join-Path $tempDir "codex.zip"
$exeFile = Join-Path $tempDir "codex.exe"
try {
Invoke-WebRequest -Uri $downloadUrl -OutFile $zipFile -UseBasicParsing
Invoke-WebRequest -Uri $downloadUrl -OutFile $exeFile -UseBasicParsing
} catch {
Write-Host " Download failed: $_" -ForegroundColor Red
# Try tar.gz fallback
$downloadUrl = "https://github.com/openai/codex/releases/download/rust-v$latestVersion/codex-$binarySuffix.tar.gz"
Write-Host " Trying tar.gz: $downloadUrl" -ForegroundColor Yellow
$tgzFile = Join-Path $tempDir "codex.tar.gz"
Write-Host " Direct exe download failed, trying zip..." -ForegroundColor Yellow
$zipUrl = "$downloadUrl.zip"
$zipFile = Join-Path $tempDir "codex.zip"
try {
Invoke-WebRequest -Uri $downloadUrl -OutFile $tgzFile -UseBasicParsing
tar -xzf $tgzFile -C $tempDir
Invoke-WebRequest -Uri $zipUrl -OutFile $zipFile -UseBasicParsing
Expand-Archive -Path $zipFile -DestinationPath $tempDir -Force
$found = Get-ChildItem -Path $tempDir -Recurse -Filter "codex*.exe" | Where-Object { $_.Name -notlike "*setup*" -and $_.Name -notlike "*proxy*" -and $_.Name -notlike "*runner*" } | Select-Object -First 1
if ($found) { Copy-Item $found.FullName $exeFile -Force }
} catch {
Write-Host " Download failed. Check https://github.com/openai/codex/releases" -ForegroundColor Red
Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue
@@ -123,22 +123,8 @@ if ($currentVersion -eq $latestVersion) {
}
}
# Extract zip if downloaded
if (Test-Path $zipFile) {
Expand-Archive -Path $zipFile -DestinationPath $tempDir -Force
}
# Find codex.exe
$codexExe = Get-ChildItem -Path $tempDir -Recurse -Filter "codex.exe" | Select-Object -First 1
if (-not $codexExe) {
# Try codex without extension
$codexExe = Get-ChildItem -Path $tempDir -Recurse -Filter "codex" | Where-Object { -not $_.PSIsContainer } | Select-Object -First 1
}
if (-not $codexExe) {
Write-Host " codex binary not found in archive" -ForegroundColor Red
Write-Host " Contents:" -ForegroundColor Yellow
Get-ChildItem -Path $tempDir -Recurse | ForEach-Object { Write-Host " $($_.FullName)" }
if (-not (Test-Path $exeFile)) {
Write-Host " Binary not found after download" -ForegroundColor Red
Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue
exit 1
}
@@ -151,7 +137,7 @@ if ($currentVersion -eq $latestVersion) {
# Kill running codex processes
Get-Process -Name "codex" -ErrorAction SilentlyContinue | Stop-Process -Force
Copy-Item -Path $codexExe.FullName -Destination $destPath -Force
Copy-Item -Path $exeFile -Destination $destPath -Force
Write-Host " Installed: $destPath" -ForegroundColor Green
# Add to PATH if not already there

View File

@@ -41,24 +41,26 @@ if ($oldVer -eq $latestVer) {
} else {
# ---- Download binary ----
$arch = if ([System.Environment]::Is64BitOperatingSystem) { "x86_64" } else { "i686" }
$arch = if ([System.Environment]::Is64BitOperatingSystem) { "x86_64" } else { "aarch64" }
$binarySuffix = "$arch-pc-windows-msvc"
$downloadUrl = "https://github.com/openai/codex/releases/download/rust-v$latestVer/codex-$binarySuffix.zip"
$downloadUrl = "https://github.com/openai/codex/releases/download/rust-v$latestVer/codex-$binarySuffix.exe"
Write-Host " Downloading codex-$binarySuffix..." -ForegroundColor Cyan
Write-Host " Downloading codex-$binarySuffix.exe..." -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"
$exeFile = Join-Path $tempDir "codex.exe"
try {
Invoke-WebRequest -Uri $downloadUrl -OutFile $zipFile -UseBasicParsing
Invoke-WebRequest -Uri $downloadUrl -OutFile $exeFile -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"
Write-Host " Direct exe download failed, trying zip..." -ForegroundColor Yellow
$zipUrl = "$downloadUrl.zip"
$zipFile = Join-Path $tempDir "codex.zip"
try {
Invoke-WebRequest -Uri $downloadUrl -OutFile $tgzFile -UseBasicParsing
tar -xzf $tgzFile -C $tempDir
Invoke-WebRequest -Uri $zipUrl -OutFile $zipFile -UseBasicParsing
Expand-Archive -Path $zipFile -DestinationPath $tempDir -Force
$found = Get-ChildItem -Path $tempDir -Recurse -Filter "codex*.exe" | Where-Object { $_.Name -notlike "*setup*" -and $_.Name -notlike "*proxy*" -and $_.Name -notlike "*runner*" } | Select-Object -First 1
if ($found) { Copy-Item $found.FullName $exeFile -Force }
} catch {
Write-Host " Download failed." -ForegroundColor Red
Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue
@@ -66,17 +68,8 @@ if ($oldVer -eq $latestVer) {
}
}
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
if (-not (Test-Path $exeFile)) {
Write-Host " Binary not found after download" -ForegroundColor Red
Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue
exit 1
}
@@ -85,7 +78,7 @@ if ($oldVer -eq $latestVer) {
$installDir = "$env:LOCALAPPDATA\Programs\codex"
New-Item -ItemType Directory -Force -Path $installDir | Out-Null
Copy-Item -Path $codexExe.FullName -Destination "$installDir\codex.exe" -Force
Copy-Item -Path $exeFile -Destination "$installDir\codex.exe" -Force
$userPath = [System.Environment]::GetEnvironmentVariable("Path", "User")
if ($userPath -notlike "*$installDir*") {

File diff suppressed because it is too large Load Diff