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

@@ -0,0 +1,60 @@
# Codex CLI — Windows Uninstaller
# Usage: powershell -ExecutionPolicy Bypass -File codex\ucodex_uninstall.ps1
$ErrorActionPreference = "Continue"
Write-Host ""
Write-Host " +--------------------------------------+" -ForegroundColor Cyan
Write-Host " | Codex CLI -- Windows Uninstaller |" -ForegroundColor Cyan
Write-Host " +--------------------------------------+" -ForegroundColor Cyan
Write-Host ""
# ---- Remove binary ----
$installDir = "$env:LOCALAPPDATA\Programs\codex"
if (Test-Path "$installDir\codex.exe") {
Write-Host " Stopping codex processes..." -ForegroundColor Cyan
Get-Process -Name "codex" -ErrorAction SilentlyContinue | Stop-Process -Force
Write-Host " Removing $installDir..." -ForegroundColor Cyan
Remove-Item -Recurse -Force $installDir
Write-Host " Binary removed" -ForegroundColor Green
# Remove from PATH
$userPath = [System.Environment]::GetEnvironmentVariable("Path", "User")
if ($userPath -like "*$installDir*") {
$newPath = ($userPath -split ";" | Where-Object { $_ -ne $installDir }) -join ";"
[System.Environment]::SetEnvironmentVariable("Path", $newPath, "User")
Write-Host " Removed from PATH" -ForegroundColor Green
}
} else {
Write-Host " Codex binary not found at $installDir" -ForegroundColor Yellow
# Check other common locations
$altPath = (Get-Command codex -ErrorAction SilentlyContinue).Source
if ($altPath) {
Write-Host " Found at: $altPath — remove manually" -ForegroundColor Yellow
}
}
# ---- Remove config ----
$codexDir = "$env:USERPROFILE\.codex"
if (Test-Path $codexDir) {
Write-Host " Removing $codexDir..." -ForegroundColor Cyan
Remove-Item -Recurse -Force $codexDir
Write-Host " Config removed" -ForegroundColor Green
} else {
Write-Host " No config directory found" -ForegroundColor Yellow
}
# ---- Remove env vars ----
Write-Host " Removing environment variables..." -ForegroundColor Cyan
[System.Environment]::SetEnvironmentVariable("OPENAI_API_KEY", $null, "User")
[System.Environment]::SetEnvironmentVariable("OPENAI_BASE_URL", $null, "User")
Remove-Item Env:OPENAI_API_KEY -ErrorAction SilentlyContinue
Remove-Item Env:OPENAI_BASE_URL -ErrorAction SilentlyContinue
Write-Host " Env vars removed" -ForegroundColor Green
Write-Host ""
Write-Host " Codex CLI fully uninstalled!" -ForegroundColor Green
Write-Host ""

79
codex/ucodex_uninstall.sh Executable file
View File

@@ -0,0 +1,79 @@
#!/usr/bin/env bash
# Codex CLI — Uninstaller
# Removes Codex CLI binary, config, env vars.
#
# Usage: sudo bash ucodex_uninstall.sh
set -euo pipefail
GREEN="\033[92m"
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 " | Codex CLI — Uninstaller |"
echo " +--------------------------------------+"
echo -e "${RESET}"
# ---- Remove binary ----
CODEX_PATH=$(which codex 2>/dev/null || echo "")
if [ -n "$CODEX_PATH" ]; then
info "Removing binary: $CODEX_PATH"
rm -f "$CODEX_PATH"
log "Binary removed"
else
warn "Codex binary not found in PATH"
fi
# ---- Remove config ----
for user_home in /root /home/*; do
CODEX_DIR="$user_home/.codex"
if [ -d "$CODEX_DIR" ]; then
info "Removing $CODEX_DIR..."
rm -rf "$CODEX_DIR"
log "Removed $CODEX_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 'OPENAI_API_KEY\|OPENAI_BASE_URL\|Codex' "$rc_file" 2>/dev/null; then
info "Cleaning env vars from $rc_file..."
sed -i '/# Codex/d' "$rc_file"
sed -i '/# UnlimitedCoding.*[Cc]odex/d' "$rc_file"
sed -i '/OPENAI_API_KEY/d' "$rc_file"
sed -i '/OPENAI_BASE_URL/d' "$rc_file"
log "Cleaned $rc_file"
fi
done
done
# ---- Remove env vars from /etc/environment ----
if [ -f "/etc/environment" ] && grep -q 'OPENAI_API_KEY\|OPENAI_BASE_URL' /etc/environment 2>/dev/null; then
info "Cleaning /etc/environment..."
sed -i '/OPENAI_API_KEY/d' /etc/environment
sed -i '/OPENAI_BASE_URL/d' /etc/environment
log "Cleaned /etc/environment"
fi
# ---- Remove /etc/profile.d script ----
if [ -f "/etc/profile.d/codex-cli.sh" ]; then
rm -f "/etc/profile.d/codex-cli.sh"
log "Removed /etc/profile.d/codex-cli.sh"
fi
echo ""
echo -e "${GREEN}${BOLD} Codex CLI fully uninstalled!${RESET}"
echo ""