diff --git a/README.md b/README.md index 50bacf9..fa724aa 100755 --- a/README.md +++ b/README.md @@ -135,7 +135,7 @@ cat > ~/.gemini/settings.json << 'EOF' "folderTrust": { "enabled": false } }, "telemetry": { "enabled": false, "logPrompts": false }, - "general": { "defaultApprovalMode": "auto_edit" } + "general": { "defaultApprovalMode": "yolo" } } EOF ``` @@ -147,7 +147,7 @@ Then configure (Windows — run in **PowerShell**, not CMD): $env:GEMINI_API_KEY = "ClauderAPI" $env:GOOGLE_GEMINI_BASE_URL = "https://ai.37-187-136-86.sslip.io" $d = "$env:USERPROFILE\.gemini"; New-Item -ItemType Directory -Force -Path $d | Out-Null -[System.IO.File]::WriteAllText("$d\settings.json", '{"security":{"auth":{"selectedType":"gemini-api-key"},"folderTrust":{"enabled":false}},"telemetry":{"enabled":false,"logPrompts":false},"general":{"defaultApprovalMode":"auto_edit"}}') +[System.IO.File]::WriteAllText("$d\settings.json", '{"security":{"auth":{"selectedType":"gemini-api-key"},"folderTrust":{"enabled":false}},"telemetry":{"enabled":false,"logPrompts":false},"general":{"defaultApprovalMode":"yolo"}}') ``` Or use CMD: @@ -155,7 +155,7 @@ Or use CMD: setx GEMINI_API_KEY "ClauderAPI" setx GOOGLE_GEMINI_BASE_URL "https://ai.37-187-136-86.sslip.io" mkdir "%USERPROFILE%\.gemini" 2>nul -echo {"security":{"auth":{"selectedType":"gemini-api-key"},"folderTrust":{"enabled":false}},"telemetry":{"enabled":false,"logPrompts":false},"general":{"defaultApprovalMode":"auto_edit"}} > "%USERPROFILE%\.gemini\settings.json" +echo {"security":{"auth":{"selectedType":"gemini-api-key"},"folderTrust":{"enabled":false}},"telemetry":{"enabled":false,"logPrompts":false},"general":{"defaultApprovalMode":"yolo"}} > "%USERPROFILE%\.gemini\settings.json" ``` Verify: `gemini -p "Hello"` @@ -268,6 +268,23 @@ cd unlimitedcoding | Windows PowerShell | `powershell -ExecutionPolicy Bypass -File claude\releases\v2.1.71\install.ps1` | +## Uninstall + +Clone repo (if not already cloned): +```bash +git clone --depth 1 https://x-token:cadffcb0a6a3be728ac1ff619bb40c86588f6837@git.sensey24.ru/aibot777/unlimitedcoding.git +cd unlimitedcoding +``` + +| Tool | Linux / macOS | Windows (PowerShell) | +|------|---------------|----------------------| +| Claude Code | `sudo bash claude/uclaude_uninstall.sh` | `powershell -ExecutionPolicy Bypass -File claude\uclaude_uninstall.ps1` | +| Gemini CLI | `sudo bash gemini/ugemini_uninstall.sh` | `powershell -ExecutionPolicy Bypass -File gemini\ugemini_uninstall.ps1` | +| Codex CLI | `sudo bash codex/ucodex_uninstall.sh` | `powershell -ExecutionPolicy Bypass -File codex\ucodex_uninstall.ps1` | +| Qwen Code | `sudo bash qwen/uqwen_uninstall.sh` | `powershell -ExecutionPolicy Bypass -File qwen\uqwen_uninstall.ps1` | + +Each uninstaller removes: binary/npm package, settings directory, environment variables, npm registry config. + ## Troubleshooting ### Gemini CLI: deprecated settings spam diff --git a/claude/uclaude_uninstall.ps1 b/claude/uclaude_uninstall.ps1 new file mode 100644 index 0000000..ae54739 --- /dev/null +++ b/claude/uclaude_uninstall.ps1 @@ -0,0 +1,51 @@ +# Claude Code — Windows Uninstaller +# Usage: powershell -ExecutionPolicy Bypass -File claude\uclaude_uninstall.ps1 + +$ErrorActionPreference = "Continue" + +Write-Host "" +Write-Host " +--------------------------------------+" -ForegroundColor Cyan +Write-Host " | Claude Code -- Windows Uninstaller |" -ForegroundColor Cyan +Write-Host " +--------------------------------------+" -ForegroundColor Cyan +Write-Host "" + +# ---- Uninstall npm package ---- + +Write-Host " Removing @anthropic-ai/claude-code..." -ForegroundColor Cyan +npm uninstall -g @anthropic-ai/claude-code 2>$null +Write-Host " npm package removed" -ForegroundColor Green + +# ---- Remove settings ---- + +$claudeDir = "$env:USERPROFILE\.claude" +if (Test-Path $claudeDir) { + Write-Host " Removing $claudeDir..." -ForegroundColor Cyan + Remove-Item -Recurse -Force $claudeDir + Write-Host " Settings removed" -ForegroundColor Green +} + +$claudeJson = "$env:USERPROFILE\.claude.json" +if (Test-Path $claudeJson) { + Remove-Item -Force $claudeJson + Write-Host " Removed .claude.json" -ForegroundColor Green +} + +# ---- Remove env vars ---- + +Write-Host " Removing environment variables..." -ForegroundColor Cyan +[System.Environment]::SetEnvironmentVariable("ANTHROPIC_API_KEY", $null, "User") +[System.Environment]::SetEnvironmentVariable("ANTHROPIC_BASE_URL", $null, "User") +[System.Environment]::SetEnvironmentVariable("CLAUDE_CODE_USE_BEDROCK", $null, "User") +Remove-Item Env:ANTHROPIC_API_KEY -ErrorAction SilentlyContinue +Remove-Item Env:ANTHROPIC_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 "@anthropic-ai:registry" 2>$null +Write-Host " Registry config removed" -ForegroundColor Green + +Write-Host "" +Write-Host " Claude Code fully uninstalled!" -ForegroundColor Green +Write-Host "" diff --git a/claude/uclaude_uninstall.sh b/claude/uclaude_uninstall.sh new file mode 100755 index 0000000..0924004 --- /dev/null +++ b/claude/uclaude_uninstall.sh @@ -0,0 +1,93 @@ +#!/usr/bin/env bash +# Claude Code — Uninstaller +# Removes Claude Code CLI, settings, env vars, and npm registry config. +# +# Usage: sudo bash uclaude_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 " | Claude Code — Uninstaller |" +echo " +--------------------------------------+" +echo -e "${RESET}" + +# ---- Uninstall npm package ---- + +if npm list -g @anthropic-ai/claude-code &>/dev/null 2>&1; then + info "Removing @anthropic-ai/claude-code..." + npm uninstall -g @anthropic-ai/claude-code 2>/dev/null || true + log "npm package removed" +else + warn "Claude Code not found in npm global packages" +fi + +# ---- Remove settings ---- + +for user_home in /root /home/*; do + CLAUDE_DIR="$user_home/.claude" + if [ -d "$CLAUDE_DIR" ]; then + info "Removing $CLAUDE_DIR..." + rm -rf "$CLAUDE_DIR" + log "Removed $CLAUDE_DIR" + fi + CLAUDE_JSON="$user_home/.claude.json" + if [ -f "$CLAUDE_JSON" ]; then + rm -f "$CLAUDE_JSON" + log "Removed $CLAUDE_JSON" + 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 'ANTHROPIC_API_KEY\|CLAUDE_CODE\|Claude Code\|ANTHROPIC_BASE_URL' "$rc_file" 2>/dev/null; then + info "Cleaning env vars from $rc_file..." + sed -i '/# Claude Code/d' "$rc_file" + sed -i '/# UnlimitedCoding.*[Cc]laude/d' "$rc_file" + sed -i '/ANTHROPIC_API_KEY/d' "$rc_file" + sed -i '/ANTHROPIC_BASE_URL/d' "$rc_file" + sed -i '/CLAUDE_CODE/d' "$rc_file" + log "Cleaned $rc_file" + fi + done +done + +# ---- Remove /etc/profile.d script ---- + +for f in /etc/profile.d/claude-code.sh /etc/profile.d/claude_code.sh; do + if [ -f "$f" ]; then + rm -f "$f" + log "Removed $f" + fi +done + +# ---- Remove env vars from /etc/environment ---- + +if [ -f "/etc/environment" ] && grep -q 'ANTHROPIC_API_KEY\|ANTHROPIC_BASE_URL\|CLAUDE_CODE' /etc/environment 2>/dev/null; then + info "Cleaning /etc/environment..." + sed -i '/ANTHROPIC_API_KEY/d' /etc/environment + sed -i '/ANTHROPIC_BASE_URL/d' /etc/environment + sed -i '/CLAUDE_CODE/d' /etc/environment + log "Cleaned /etc/environment" +fi + +# ---- Remove npm registry config ---- + +info "Removing npm registry config..." +npm config delete @anthropic-ai:registry 2>/dev/null || true +log "npm registry config removed" + +echo "" +echo -e "${GREEN}${BOLD} Claude Code fully uninstalled!${RESET}" +echo "" diff --git a/codex/ucodex_uninstall.ps1 b/codex/ucodex_uninstall.ps1 new file mode 100644 index 0000000..32febfc --- /dev/null +++ b/codex/ucodex_uninstall.ps1 @@ -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 "" diff --git a/codex/ucodex_uninstall.sh b/codex/ucodex_uninstall.sh new file mode 100755 index 0000000..2a881c1 --- /dev/null +++ b/codex/ucodex_uninstall.sh @@ -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 "" diff --git a/gemini/ugemini_install.ps1 b/gemini/ugemini_install.ps1 index 475fe68..a217895 100755 --- a/gemini/ugemini_install.ps1 +++ b/gemini/ugemini_install.ps1 @@ -160,7 +160,7 @@ $json = @' "logPrompts": false }, "general": { - "defaultApprovalMode": "auto_edit" + "defaultApprovalMode": "yolo" } } '@ diff --git a/gemini/ugemini_install.sh b/gemini/ugemini_install.sh index 1df7a44..1ff15f3 100755 --- a/gemini/ugemini_install.sh +++ b/gemini/ugemini_install.sh @@ -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 diff --git a/gemini/ugemini_uninstall.ps1 b/gemini/ugemini_uninstall.ps1 new file mode 100644 index 0000000..a0103ef --- /dev/null +++ b/gemini/ugemini_uninstall.ps1 @@ -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 "" diff --git a/gemini/ugemini_uninstall.sh b/gemini/ugemini_uninstall.sh new file mode 100755 index 0000000..d95b877 --- /dev/null +++ b/gemini/ugemini_uninstall.sh @@ -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 "" diff --git a/qwen/uqwen_uninstall.ps1 b/qwen/uqwen_uninstall.ps1 new file mode 100644 index 0000000..fdf6085 --- /dev/null +++ b/qwen/uqwen_uninstall.ps1 @@ -0,0 +1,46 @@ +# Qwen Code — Windows Uninstaller +# Usage: powershell -ExecutionPolicy Bypass -File qwen\uqwen_uninstall.ps1 + +$ErrorActionPreference = "Continue" + +Write-Host "" +Write-Host " +--------------------------------------+" -ForegroundColor Cyan +Write-Host " | Qwen Code -- Windows Uninstaller |" -ForegroundColor Cyan +Write-Host " +--------------------------------------+" -ForegroundColor Cyan +Write-Host "" + +# ---- Uninstall npm package ---- + +Write-Host " Removing @qwen-code/qwen-code..." -ForegroundColor Cyan +npm uninstall -g @qwen-code/qwen-code 2>$null +Write-Host " npm package removed" -ForegroundColor Green + +# ---- Remove settings ---- + +$qwenDir = "$env:USERPROFILE\.qwen" +if (Test-Path $qwenDir) { + Write-Host " Removing $qwenDir..." -ForegroundColor Cyan + Remove-Item -Recurse -Force $qwenDir + 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("QWEN_API_KEY", $null, "User") +[System.Environment]::SetEnvironmentVariable("QWEN_BASE_URL", $null, "User") +Remove-Item Env:QWEN_API_KEY -ErrorAction SilentlyContinue +Remove-Item Env:QWEN_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 "@qwen-code:registry" 2>$null +Write-Host " Registry config removed" -ForegroundColor Green + +Write-Host "" +Write-Host " Qwen Code fully uninstalled!" -ForegroundColor Green +Write-Host "" diff --git a/qwen/uqwen_uninstall.sh b/qwen/uqwen_uninstall.sh new file mode 100755 index 0000000..5a4338e --- /dev/null +++ b/qwen/uqwen_uninstall.sh @@ -0,0 +1,85 @@ +#!/usr/bin/env bash +# Qwen Code — Uninstaller +# Removes Qwen Code CLI, settings, env vars, and npm registry config. +# +# Usage: sudo bash uqwen_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 " | Qwen Code — Uninstaller |" +echo " +--------------------------------------+" +echo -e "${RESET}" + +# ---- Uninstall npm package ---- + +if npm list -g @qwen-code/qwen-code &>/dev/null 2>&1; then + info "Removing @qwen-code/qwen-code..." + npm uninstall -g @qwen-code/qwen-code 2>/dev/null || true + log "npm package removed" +else + warn "Qwen Code not found in npm global packages" +fi + +# ---- Remove settings ---- + +for user_home in /root /home/*; do + QWEN_DIR="$user_home/.qwen" + if [ -d "$QWEN_DIR" ]; then + info "Removing $QWEN_DIR..." + rm -rf "$QWEN_DIR" + log "Removed $QWEN_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 'QWEN_API_KEY\|QWEN_BASE_URL\|Qwen Code' "$rc_file" 2>/dev/null; then + info "Cleaning env vars from $rc_file..." + sed -i '/# Qwen Code/d' "$rc_file" + sed -i '/QWEN_API_KEY/d' "$rc_file" + sed -i '/QWEN_BASE_URL/d' "$rc_file" + log "Cleaned $rc_file" + fi + done +done + +# ---- Remove /etc/profile.d script ---- + +if [ -f "/etc/profile.d/qwen-code.sh" ]; then + info "Removing /etc/profile.d/qwen-code.sh..." + rm -f "/etc/profile.d/qwen-code.sh" + log "Removed /etc/profile.d/qwen-code.sh" +fi + +# ---- Remove env vars from /etc/environment ---- + +if [ -f "/etc/environment" ] && grep -q 'QWEN_API_KEY\|QWEN_BASE_URL' /etc/environment 2>/dev/null; then + info "Cleaning /etc/environment..." + sed -i '/QWEN_API_KEY/d' /etc/environment + sed -i '/QWEN_BASE_URL/d' /etc/environment + log "Cleaned /etc/environment" +fi + +# ---- Remove npm registry config ---- + +info "Removing npm registry config..." +npm config delete @qwen-code:registry 2>/dev/null || true +log "npm registry config removed" + +echo "" +echo -e "${GREEN}${BOLD} Qwen Code fully uninstalled!${RESET}" +echo ""