From 4ac01b22606c315b89205cb64ef98b52df72d9a3 Mon Sep 17 00:00:00 2001 From: Tw93 Date: Sat, 4 Oct 2025 19:39:15 +0800 Subject: [PATCH] :art: Add cache whitelist for large models --- GUIDE.md | 12 ++++++++++++ README.md | 7 ++++--- bin/clean.sh | 5 ++++- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/GUIDE.md b/GUIDE.md index 5bf1d2a..e05f783 100644 --- a/GUIDE.md +++ b/GUIDE.md @@ -163,6 +163,18 @@ Mole 有智能保护机制: - 不会删除系统关键文件 - 会跳过正在运行的应用 - 清理前会显示即将删除的内容 +- 默认保护大型缓存(如 Playwright 浏览器、HuggingFace 模型等) + +如果你有其他需要保护的文件,可以添加到白名单: + +```bash +# 查看默认保护的文件 +mole clean --whitelist + +# 添加自定义保护 +mkdir -p ~/.config/mole +echo '~/我的重要缓存/*' >> ~/.config/mole/whitelist +``` --- diff --git a/README.md b/README.md index da1e9c0..f9a02d6 100644 --- a/README.md +++ b/README.md @@ -86,11 +86,11 @@ $ mole clean **Protect important files:** ```bash -# View whitelist +# View default whitelist (Playwright browsers, HuggingFace models, etc.) mole clean --whitelist -# Add protection -echo '~/Library/Caches/ms-playwright*' >> ~/.config/mole/whitelist +# Add custom protection +echo '~/my-important-cache/*' >> ~/.config/mole/whitelist ``` ### 🗑️ Smart App Uninstaller @@ -150,6 +150,7 @@ Total: 156.8GB - 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 + - Large downloaded caches like Playwright browsers and HuggingFace models - 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. diff --git a/bin/clean.sh b/bin/clean.sh index 6ba83d8..b6312ab 100755 --- a/bin/clean.sh +++ b/bin/clean.sh @@ -13,7 +13,10 @@ SYSTEM_CLEAN=false DRY_RUN=false IS_M_SERIES=$([ "$(uname -m)" = "arm64" ] && echo "true" || echo "false") # Default whitelist patterns to avoid removing critical caches (can be extended by user) -WHITELIST_PATTERNS=("$HOME/Library/Caches/ms-playwright*") +WHITELIST_PATTERNS=( + "$HOME/Library/Caches/ms-playwright*" + "$HOME/.cache/huggingface*" +) # Load user-defined whitelist file if present (~/.config/mole/whitelist) if [[ -f "$HOME/.config/mole/whitelist" ]]; then while IFS= read -r line; do