Per user demand after data loss incident: never trust mode flags alone.
Previously only `full` mode created tar.gz backup. Now `safe` and
`settings-only` also create full tar.gz of ~/.claude (resp .codex,
.gemini, .qwen) BEFORE any mutation. If backup fails, refuse to
proceed for that user — skip to next.
Restore is always one command:
tar -xzf ~/.<tool>.uninstall-backup.<TS>.tar.gz -C ~
Applies to all 4 scripts: uclaude, ucodex, ugemini, uqwen.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
After user lost 6 months of work to `rm -rf ~/.claude`, ALL 4 uninstall
scripts (claude, codex, gemini, qwen) now require explicit choice:
Modes:
1) safe (default) — remove binary + env + settings.json
KEEP projects, history, commands(skills),
plans, file-history, plugins
2) settings-only — clear settings.json only, keep binary + data
3) full — wipe everything (tar backup first, requires
typing 'WIPE' to confirm)
4) cancel — exit, do nothing
Default flow:
- Interactive prompt with PREVIEW of user data (size, project count,
command count, history line count) before any destructive op
- Cancel option always available
- Each file backed up to *.uninstall.bak.<TS> before removal
- /etc/environment + .bashrc + /etc/profile.d backed up before sed
Non-interactive (CI / scripts):
UCLAUDE_MODE=safe sudo bash uclaude_uninstall.sh
UCLAUDE_MODE=full sudo bash uclaude_uninstall.sh # creates tar backup
UCLAUDE_YES=1 # skip prompt, default to safe mode
NEVER again should an uninstaller silently destroy user data.
Per-tool env vars: UCLAUDE_MODE / UCODEX_MODE / UGEMINI_MODE / UQWEN_MODE.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
User reported losing 6 months of accumulated work — projects, plans,
custom commands/skills, file-history, history.jsonl — because
uclaude_uninstall.sh did `rm -rf ~/.claude` without warning or backup.
Same destruction risk in codex/gemini/qwen uninstallers (each has its
own ~/.tool-name/ dir with user data).
Fix:
- claude/uclaude_uninstall.sh: DEFAULT preserves projects/, history.jsonl,
commands/, plans/, file-history/, plugins/. Only removes settings.json
+ cache/ (which Claude regenerates). settings.json backed up first.
- Explicit opt-in to wipe everything: UCLAUDE_PURGE_USER_DATA=1
(and even then creates a tar backup before delete)
- README guidance updated
NEVER again should an uninstaller silently destroy user data.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>