diff --git a/README.md b/README.md index 22f85cc..da1e9c0 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,8 @@ mole update # Update Mole mole --help # Show help ``` -> ๐Ÿ’ก New to terminal? Check [ๅฐ็™ฝไฝฟ็”จๆŒ‡ๅ—](./GUIDE.md) ยท Homebrew users: `brew upgrade mole` to update +> ๐Ÿ’ก New to terminal? Check [ๅฐ็™ฝไฝฟ็”จๆŒ‡ๅ—](./GUIDE.md) ยท Homebrew users: `brew upgrade mole` to update +> โš ๏ธ **Recommended:** Always run `mole clean --dry-run` first to preview changes before cleanup ## Features @@ -60,19 +61,19 @@ mole --help # Show help $ mole clean โ–ถ System essentials - โœ“ User app cache (45.2GB) # Caches, logs, trash (20-50GB) + โœ“ User app cache (45.2GB) # Caches, logs, trash 20-50GB typical โœ“ User app logs (2.1GB) โœ“ Trash (12.3GB) -โ–ถ Browser cleanup # Chrome, Safari, Arc (5-15GB) +โ–ถ Browser cleanup # Chrome, Safari, Arc 5-15GB typical โœ“ Chrome cache (8.4GB) โœ“ Safari cache (2.1GB) -โ–ถ Developer tools # npm, Docker, Xcode (15-40GB) +โ–ถ Developer tools # npm, Docker, Xcode 15-40GB typical โœ“ Xcode derived data (9.1GB) โœ“ Node.js cache (14.2GB) -โ–ถ Others # Cloud, Office, Media (10-40GB) +โ–ถ Others # Cloud, Office, Media 10-40GB typical โœ“ Dropbox cache (5.2GB) โœ“ Spotify cache (3.1GB) @@ -105,12 +106,12 @@ $ mole uninstall ๐Ÿ—‘๏ธ Uninstalling: Adobe Creative Cloud โœ“ Removed application # /Applications/ - โœ“ Cleaned 52 related files # ~/Library/ (12 locations) + โœ“ Cleaned 52 related files # ~/Library/ across 12 locations - Support files & caches # Application Support, Caches - Preferences & logs # Preferences, Logs - WebKit storage & cookies # WebKit, HTTPStorages - Extensions & plugins # Internet Plug-Ins, Services - - System files (sudo) # /Library/, Launch daemons + - System files with sudo # /Library/, Launch daemons ==================================================================== ๐ŸŽ‰ UNINSTALLATION COMPLETE! @@ -145,10 +146,14 @@ Total: 156.8GB ## FAQ -1. **Will Mole delete important files?** - No. Mole has built-in protection and skips system-critical files. -2. **Can I undo cleanup operations?** - Cache files are safe to delete and will regenerate automatically. +1. **Will Mole delete important files?** - No. Mole has built-in protection for: + - System-critical files like Input Methods, Dock, and System Preferences + - User data from IDEs like JetBrains DataGrip and VS Code, plus database tools + - License data from paid apps like 1Password and Adobe products + - App settings are only removed when you explicitly uninstall the app +2. **Can I undo cleanup operations?** - Cache files are safe to delete and will regenerate automatically. For important data protection, use the whitelist feature via `mole clean --whitelist`. 3. **How often should I run cleanup?** - Once a month is sufficient. Run when disk space is low. -4. **Is it safe to use?** - Yes. The tool previews what will be deleted before any action (`--dry-run`). +4. **Is it safe to use?** - Yes. **Always run `mole clean --dry-run` first** to preview what will be deleted before any action. ## Support diff --git a/bin/clean.sh b/bin/clean.sh index 30743c8..6ba83d8 100755 --- a/bin/clean.sh +++ b/bin/clean.sh @@ -819,6 +819,29 @@ perform_cleanup() { fi done fi + # Also check for non-com.* folders that may contain user data + for support_dir in ~/Library/Application\ Support/*; do + [[ -d "$support_dir" ]] || continue + local dir_name=$(basename "$support_dir") + # Skip if it starts with com. (already processed) or is in dot directories + [[ "$dir_name" == com.* || "$dir_name" == .* ]] && continue + # CRITICAL: Protect important data folders (JetBrains, database tools, etc.) + if should_protect_data "$dir_name"; then + continue + fi + # Only clean if significant size and looks like app data, but be conservative + # Skip common system/user folders + case "$dir_name" in + "CrashReporter"|"AddressBook"|"CallHistoryDB"|"CallHistoryTransactions"|\ + "CloudDocs"|"icdd"|"IdentityServices"|"Mail"|"CallServices"|\ + "com.apple."*|"Adobe"|"Google"|"Mozilla"|"Netscape"|"Yahoo"|\ + "AddressBook"|"iCloud"|"iLifeMediaBrowser"|"MobileSync"|\ + "CallHistory"|"FaceTime"|"Twitter") + # System or commonly used folders, skip + continue + ;; + esac + done echo " ${GREEN}โœ“${NC} Complete ($data_count removed)" # Check for orphaned preferences (with protection for critical system settings) diff --git a/lib/common.sh b/lib/common.sh index 4a30971..346edf5 100755 --- a/lib/common.sh +++ b/lib/common.sh @@ -332,12 +332,16 @@ readonly DATA_PROTECTED_BUNDLES=( "com.dashlane.*" # Dashlane "com.bitwarden.*" # Bitwarden "com.keepassx.*" # KeePassXC - "com.jetbrains.*" # JetBrains IDEs (dev tools) + "com.jetbrains.*" # JetBrains IDEs (dev tools with user data) + "JetBrains*" # JetBrains Application Support folders "com.sublimetext.*" # Sublime Text (paid) "com.panic.transmit*" # Transmit (paid) "com.sequelpro.*" # Database tools "com.sequel-ace.*" "com.tinyapp.*" # TablePlus (paid) + "com.dbeaver.*" # DBeaver (database tool) + "com.navicat.*" # Navicat (database tool) + "com.mongodb.compass" # MongoDB Compass "com.adobe.*" # Adobe Creative Suite (design tools) "com.bohemiancoding.*" # Sketch "com.figma.*" # Figma