feat: add uninstaller scripts for all tools + restore yolo mode

Uninstallers (.sh + .ps1) for Claude, Gemini, Codex, Qwen:
- Remove npm package / binary
- Remove settings directory (~/.gemini, ~/.qwen, ~/.codex, ~/.claude)
- Remove env vars from bashrc/zshrc, /etc/environment, /etc/profile.d
- Remove npm registry config

Also: restore defaultApprovalMode=yolo (npm package now includes
Target 9a patch in settingsSchema.js)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
delta-cloud-208e
2026-03-08 07:38:14 +00:00
parent 9de65c2151
commit a4632de6da
11 changed files with 567 additions and 5 deletions

View File

@@ -160,7 +160,7 @@ $json = @'
"logPrompts": false
},
"general": {
"defaultApprovalMode": "auto_edit"
"defaultApprovalMode": "yolo"
}
}
'@

View File

@@ -173,7 +173,7 @@ assert d.get('security',{}).get('auth',{}).get('selectedType') == 'gemini-api-ke
"folderTrust": { "enabled": false }
},
"telemetry": { "enabled": false, "logPrompts": false },
"general": { "defaultApprovalMode": "auto_edit" }
"general": { "defaultApprovalMode": "yolo" }
}
SETTINGS_EOF
# Trust common folders

View File

@@ -0,0 +1,46 @@
# Gemini CLI — Windows Uninstaller
# Usage: powershell -ExecutionPolicy Bypass -File gemini\ugemini_uninstall.ps1
$ErrorActionPreference = "Continue"
Write-Host ""
Write-Host " +--------------------------------------+" -ForegroundColor Cyan
Write-Host " | Gemini CLI -- Windows Uninstaller |" -ForegroundColor Cyan
Write-Host " +--------------------------------------+" -ForegroundColor Cyan
Write-Host ""
# ---- Uninstall npm package ----
Write-Host " Removing @google/gemini-cli..." -ForegroundColor Cyan
npm uninstall -g @google/gemini-cli 2>$null
Write-Host " npm package removed" -ForegroundColor Green
# ---- Remove settings ----
$geminiDir = "$env:USERPROFILE\.gemini"
if (Test-Path $geminiDir) {
Write-Host " Removing $geminiDir..." -ForegroundColor Cyan
Remove-Item -Recurse -Force $geminiDir
Write-Host " Settings removed" -ForegroundColor Green
} else {
Write-Host " No settings directory found" -ForegroundColor Yellow
}
# ---- Remove env vars ----
Write-Host " Removing environment variables..." -ForegroundColor Cyan
[System.Environment]::SetEnvironmentVariable("GEMINI_API_KEY", $null, "User")
[System.Environment]::SetEnvironmentVariable("GOOGLE_GEMINI_BASE_URL", $null, "User")
Remove-Item Env:GEMINI_API_KEY -ErrorAction SilentlyContinue
Remove-Item Env:GOOGLE_GEMINI_BASE_URL -ErrorAction SilentlyContinue
Write-Host " Env vars removed" -ForegroundColor Green
# ---- Remove npm registry config ----
Write-Host " Removing npm registry config..." -ForegroundColor Cyan
npm config delete "@google:registry" 2>$null
Write-Host " Registry config removed" -ForegroundColor Green
Write-Host ""
Write-Host " Gemini CLI fully uninstalled!" -ForegroundColor Green
Write-Host ""

85
gemini/ugemini_uninstall.sh Executable file
View File

@@ -0,0 +1,85 @@
#!/usr/bin/env bash
# Gemini CLI — Uninstaller
# Removes Gemini CLI, settings, env vars, and npm registry config.
#
# Usage: sudo bash ugemini_uninstall.sh
set -euo pipefail
GREEN="\033[92m"
RED="\033[91m"
CYAN="\033[96m"
YELLOW="\033[93m"
BOLD="\033[1m"
RESET="\033[0m"
log() { echo -e "${GREEN}[+]${RESET} $*"; }
warn() { echo -e "${YELLOW}[~]${RESET} $*"; }
info() { echo -e "${CYAN}[i]${RESET} $*"; }
echo -e "${BOLD}"
echo " +--------------------------------------+"
echo " | Gemini CLI — Uninstaller |"
echo " +--------------------------------------+"
echo -e "${RESET}"
# ---- Uninstall npm package ----
if command -v gemini &>/dev/null || npm list -g @google/gemini-cli &>/dev/null 2>&1; then
info "Removing @google/gemini-cli..."
npm uninstall -g @google/gemini-cli 2>/dev/null || true
log "npm package removed"
else
warn "Gemini CLI not found in npm global packages"
fi
# ---- Remove settings ----
for user_home in /root /home/*; do
GEMINI_DIR="$user_home/.gemini"
if [ -d "$GEMINI_DIR" ]; then
info "Removing $GEMINI_DIR..."
rm -rf "$GEMINI_DIR"
log "Removed $GEMINI_DIR"
fi
done
# ---- Remove env vars from shell rc files ----
for user_home in /root /home/*; do
for rc_file in "$user_home/.bashrc" "$user_home/.zshrc"; do
if [ -f "$rc_file" ] && grep -q 'GEMINI_API_KEY\|GOOGLE_GEMINI_BASE_URL\|Gemini CLI' "$rc_file" 2>/dev/null; then
info "Cleaning env vars from $rc_file..."
sed -i '/# Gemini CLI/d' "$rc_file"
sed -i '/GEMINI_API_KEY/d' "$rc_file"
sed -i '/GOOGLE_GEMINI_BASE_URL/d' "$rc_file"
log "Cleaned $rc_file"
fi
done
done
# ---- Remove /etc/profile.d script ----
if [ -f "/etc/profile.d/gemini-cli.sh" ]; then
info "Removing /etc/profile.d/gemini-cli.sh..."
rm -f "/etc/profile.d/gemini-cli.sh"
log "Removed /etc/profile.d/gemini-cli.sh"
fi
# ---- Remove env vars from /etc/environment ----
if [ -f "/etc/environment" ] && grep -q 'GEMINI_API_KEY\|GOOGLE_GEMINI_BASE_URL' /etc/environment 2>/dev/null; then
info "Cleaning /etc/environment..."
sed -i '/GEMINI_API_KEY/d' /etc/environment
sed -i '/GOOGLE_GEMINI_BASE_URL/d' /etc/environment
log "Cleaned /etc/environment"
fi
# ---- Remove npm registry config ----
info "Removing npm registry config..."
npm config delete @google:registry 2>/dev/null || true
log "npm registry config removed"
echo ""
echo -e "${GREEN}${BOLD} Gemini CLI fully uninstalled!${RESET}"
echo ""