- 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>
65 lines
2.4 KiB
PowerShell
65 lines
2.4 KiB
PowerShell
# Gemini CLI — Windows Updater
|
|
# Usage: powershell -ExecutionPolicy Bypass -File gemini\ugemini_update.ps1
|
|
|
|
$ErrorActionPreference = "Continue"
|
|
|
|
Write-Host ""
|
|
Write-Host " +--------------------------------------+" -ForegroundColor Cyan
|
|
Write-Host " | Gemini 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 gemini -ErrorAction SilentlyContinue) {
|
|
$oldVer = (gemini --version 2>$null) -replace '[\r\n]', ''
|
|
}
|
|
Write-Host " Current: $oldVer" -ForegroundColor Cyan
|
|
|
|
# ---- Configure registry ----
|
|
|
|
Write-Host " Configuring npm registry..." -ForegroundColor Cyan
|
|
npm config set "@google:registry" "https://npm.sensey24.ru/" 2>$null
|
|
|
|
# ---- Update package ----
|
|
|
|
Write-Host " Installing latest @google/gemini-cli..." -ForegroundColor Cyan
|
|
npm install -g @google/gemini-cli 2>&1
|
|
if ($LASTEXITCODE -ne 0) {
|
|
Write-Host " npm install failed." -ForegroundColor Red
|
|
exit 1
|
|
}
|
|
Refresh-Path
|
|
|
|
$newVer = "unknown"
|
|
if (Get-Command gemini -ErrorAction SilentlyContinue) {
|
|
$newVer = (gemini --version 2>$null) -replace '[\r\n]', ''
|
|
}
|
|
Write-Host " Updated: $oldVer -> $newVer" -ForegroundColor Green
|
|
|
|
# ---- Download and apply patches ----
|
|
|
|
$pyCmd = if (Get-Command python3 -ErrorAction SilentlyContinue) { "python3" } else { "python" }
|
|
$tempDir = Join-Path $env:TEMP "gemini-update-$(Get-Random)"
|
|
New-Item -ItemType Directory -Force -Path $tempDir | Out-Null
|
|
|
|
$repoRaw = "https://git.sensey24.ru/aibot777/unlimitedcoding/raw/branch/master/gemini"
|
|
Write-Host " Downloading patcher..." -ForegroundColor Cyan
|
|
Invoke-WebRequest -Uri "$repoRaw/gemini_patcher.py" -OutFile "$tempDir\gemini_patcher.py" -UseBasicParsing
|
|
Invoke-WebRequest -Uri "$repoRaw/gemini_config.json" -OutFile "$tempDir\gemini_config.json" -UseBasicParsing
|
|
|
|
Write-Host " Applying patches..." -ForegroundColor Cyan
|
|
& $pyCmd "$tempDir\gemini_patcher.py" --apply --config "$tempDir\gemini_config.json"
|
|
|
|
Remove-Item -Recurse -Force $tempDir -ErrorAction SilentlyContinue
|
|
|
|
Write-Host ""
|
|
Write-Host " Update complete!" -ForegroundColor Green
|
|
Write-Host ""
|