disk-cleaner

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Disk Cleaner - Mac 智能磁盘清理助手

Disk Cleaner - Smart Disk Cleaner for Mac

基于 Mole (https://github.com/tw93/Mole) 的用户友好包装器,负责「安装 + 执行 + 解释 + 把关 + 指路 + 统计 + 分享」。
A user-friendly wrapper based on Mole (https://github.com/tw93/Mole), responsible for installation, execution, explanation, validation, guidance, statistics, and sharing.

Description

Description

Disk Cleaner 是对 tw93 开发的 Mole 清理工具的增强封装。它提供了更友好的中文界面、分类报告、三档清理策略(Air/Pro/Max)、CSV 完整清单、白名单配置,以及清理完成后的精美成就页面(包含省钱计算和趣味统计)。
Disk Cleaner is an enhanced wrapper for the Mole cleaning tool developed by tw93. It provides a more user-friendly Chinese interface, categorized reports, three-tier cleaning strategies (Air/Pro/Max), complete CSV lists, whitelist configuration, and a beautiful achievement page after cleaning (including cost-saving calculations and fun statistics).

When to Use

When to Use

Use this skill when users:
  • 说硬盘空间不够、磁盘满了、存储不足
  • 想清理 Mac 缓存或临时文件
  • 询问如何释放磁盘空间
  • 提到 Mole 工具
Use this skill when users:
  • Say their hard drive is full, disk space is insufficient, or storage is low
  • Want to clear Mac cache or temporary files
  • Ask how to free up disk space
  • Mention the Mole tool

Features

Features

  • 🔍 环境检测: 自动检测 Homebrew 和 Mole 安装状态
  • 📦 自动安装: 支持一键安装缺失依赖
  • 📊 分类报告: 按类别展示可清理项目,区分安全/谨慎
  • 🧭 三档策略: Air(最安全)/ Pro(推荐)/ Max(最大化)
  • 📋 CSV 清单: 生成完整文件清单,保存到桌面
  • ⚙️ 白名单配置: 预设模板 + 自定义路径保护
  • 🎉 成就页面: 清理后展示省钱计算、趣味统计、可分享
  • 🔒 安全保护: 显示已保护项目,支持确认机制
  • 🔍 Environment Detection: Automatically detects Homebrew and Mole installation status
  • 📦 Auto-installation: Supports one-click installation of missing dependencies
  • 📊 Categorized Reports: Displays cleanable items by category, distinguishing between safe/cautious
  • 🧭 Three-Tier Strategies: Air (Most Safe)/Pro (Recommended)/Max (Maximize)
  • 📋 CSV List: Generates complete file list, saved to desktop
  • ⚙️ Whitelist Configuration: Preset templates + custom path protection
  • 🎉 Achievement Page: Shows cost-saving calculations, fun statistics, and shareable content after cleaning
  • 🔒 Safety Protection: Displays protected items, supports confirmation mechanism

Usage

Usage

环境检查

Environment Check

bash
python scripts/mole_cleaner.py --check
bash
python scripts/mole_cleaner.py --check

预览清理内容

Preview Cleanable Content

bash
python scripts/mole_cleaner.py --preview          # 终端文本报告
python scripts/mole_cleaner.py --preview --html   # HTML 报告(自动打开浏览器)
python scripts/mole_cleaner.py --preview --csv    # CSV 完整清单(保存到桌面)
python scripts/mole_cleaner.py --preview --json   # JSON 格式输出
bash
python scripts/mole_cleaner.py --preview          # Terminal text report
python scripts/mole_cleaner.py --preview --html   # HTML report (auto-opens browser)
python scripts/mole_cleaner.py --preview --csv    # Complete CSV list (saved to desktop)
python scripts/mole_cleaner.py --preview --json   # JSON format output

执行清理(三档选择)

Execute Cleaning (Three Tiers)

bash
python scripts/mole_cleaner.py --clean --tier air --confirm   # Air: 最安全
python scripts/mole_cleaner.py --clean --tier pro --confirm   # Pro: 推荐
python scripts/mole_cleaner.py --clean --tier max --confirm   # Max: 最大化
python scripts/mole_cleaner.py --clean --confirm              # 默认全量清理
bash
python scripts/mole_cleaner.py --clean --tier air --confirm   # Air: Most safe
python scripts/mole_cleaner.py --clean --tier pro --confirm   # Pro: Recommended
python scripts/mole_cleaner.py --clean --tier max --confirm   # Max: Maximize
python scripts/mole_cleaner.py --clean --confirm              # Default full cleaning

白名单配置

Whitelist Configuration

bash
python scripts/mole_cleaner.py --whitelist --show                    # 查看当前白名单
python scripts/mole_cleaner.py --whitelist --preset office           # 添加白领办公预设
python scripts/mole_cleaner.py --whitelist --preset developer        # 添加开发者预设
python scripts/mole_cleaner.py --whitelist --add ~/Documents/重要项目  # 添加自定义路径
bash
python scripts/mole_cleaner.py --whitelist --show                    # View current whitelist
python scripts/mole_cleaner.py --whitelist --preset office           # Add white-collar office preset
python scripts/mole_cleaner.py --whitelist --preset developer        # Add developer preset
python scripts/mole_cleaner.py --whitelist --add ~/Documents/重要项目  # Add custom path

查看磁盘状态

Check Disk Status

bash
python scripts/mole_cleaner.py --status
bash
python scripts/mole_cleaner.py --status

显示成就页(测试)

Show Achievement Page (Test)

bash
python scripts/mole_cleaner.py --show-achievement
bash
python scripts/mole_cleaner.py --show-achievement

Workflow (Claude 交互流程)

Workflow (Claude Interaction Flow)

1. 环境检测与安装

1. Environment Detection and Installation

首先检查 Mole 是否已安装:
bash
python scripts/mole_cleaner.py --check
如果未安装,引导用户安装或使用
--auto-install
First check if Mole is installed:
bash
python scripts/mole_cleaner.py --check
If not installed, guide the user to install or use
--auto-install
.

2. 预览扫描

2. Preview Scan

运行预览获取分析报告:
bash
python scripts/mole_cleaner.py --preview
Run preview to get analysis report:
bash
python scripts/mole_cleaner.py --preview

3. 向用户展示选项

3. Show Options to User

根据预览结果,向用户展示清理方案:
请选择你想执行的方案:

1. 🌬️ Air - 最安全,只清浏览器和日志     → X.XX GB
2. ⚡ Pro - 推荐,平衡安全与空间          → X.XX GB
3. 🚀 Max - 最大化释放硬盘空间            → X.XX GB
4. 📋 先看完整清单 - 生成 CSV 详细列表
5. ⚙️ 配置白名单 - 保护特定路径
Based on preview results, present cleaning solutions to the user:
Please select the solution you want to execute:

1. 🌬️ Air - Most safe, only clears browser and logs     → X.XX GB
2. ⚡ Pro - Recommended, balances safety and space          → X.XX GB
3. 🚀 Max - Maximize hard drive space release            → X.XX GB
4. 📋 View complete list first - Generate CSV detailed list
5. ⚙️ Configure whitelist - Protect specific paths

4. 处理用户选择

4. Process User Selection

选择 1-3 (Air/Pro/Max):
bash
undefined
Select 1-3 (Air/Pro/Max):
bash
undefined

确认后执行

Execute after confirmation

python scripts/mole_cleaner.py --clean --tier air --confirm # 或 pro/max

**选择 4 (CSV 清单)**:
```bash
python scripts/mole_cleaner.py --preview --csv
告知用户文件已保存到桌面并自动打开。
选择 5 (白名单配置): 展示预设选项:
  • office
    : 白领办公 - 保护 .doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf 等
  • developer
    : 开发者 - 保护代码和配置文件
  • media
    : 媒体创作 - 保护视频、音频、图像项目
bash
python scripts/mole_cleaner.py --whitelist --preset office
python scripts/mole_cleaner.py --clean --tier air --confirm # Or pro/max

**Select 4 (CSV List)**:
```bash
python scripts/mole_cleaner.py --preview --csv
Inform the user the file has been saved to desktop and opened automatically.
Select 5 (Whitelist Configuration): Show preset options:
  • office
    : White-collar office - Protects .doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf, etc.
  • developer
    : Developer - Protects code and configuration files
  • media
    : Media creation - Protects video, audio, image projects
bash
python scripts/mole_cleaner.py --whitelist --preset office

或添加自定义路径

Or add custom path

python scripts/mole_cleaner.py --whitelist --add ~/Documents/重要项目
undefined
python scripts/mole_cleaner.py --whitelist --add ~/Documents/重要项目
undefined

5. 清理完成

5. Cleaning Completed

清理完成后自动生成成就页面,包含:
  • 释放空间大小
  • 省钱计算(基于 SSD 价格)
  • 趣味等价物(相当于多少张照片/首歌曲)
  • 随机 tw93 夸夸
  • GitHub 链接方便 Star
Automatically generates an achievement page after cleaning, including:
  • Released space size
  • Cost-saving calculation (based on SSD price)
  • Fun equivalents (equivalent to how many photos/songs)
  • Random compliments from tw93
  • GitHub link for easy Star

Safety Features

Safety Features

  • 预览优先: 默认只预览,需要
    --confirm
    才执行清理
  • 分档策略: Air/Pro/Max 让用户根据风险偏好选择
  • 白名单保护: 支持预设模板和自定义路径
  • 保护清单: 显示 Mole 的 whitelist 保护项目
  • 日志记录: 所有操作保存日志到
    ~/.config/mole-cleaner/logs/
  • Preview First: Only previews by default, requires
    --confirm
    to execute cleaning
  • Tiered Strategies: Air/Pro/Max allow users to choose based on risk preference
  • Whitelist Protection: Supports preset templates and custom paths
  • Protection List: Displays Mole's whitelist protected items
  • Log Recording: All operations are saved to
    ~/.config/mole-cleaner/logs/

Tier Definitions

Tier Definitions

档位清理范围风险等级
🌬️ Air浏览器缓存、系统日志低风险
⚡ ProAir + 用户应用缓存、包管理器缓存、废纸篓中等风险
🚀 Max所有可清理项目较高风险
TierCleaning ScopeRisk Level
🌬️ AirBrowser cache, system logsLow risk
⚡ ProAir + user application cache, package manager cache, trashMedium risk
🚀 MaxAll cleanable itemsHigher risk

Whitelist Presets

Whitelist Presets

预设保护内容
office办公文档 (.doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf, .pages, .numbers, .key)
developer代码和配置 (.py, .js, .ts, .go, .rs, .java, .swift, .json, .yaml, .toml)
media媒体项目 (.psd, .ai, .sketch, .fig, .aep, .prproj, .fcpx, .mov, .mp4)
PresetProtected Content
officeOffice documents (.doc, .docx, .xls, .xlsx, .ppt, .pptx, .pdf, .pages, .numbers, .key)
developerCode and configuration (.py, .js, .ts, .go, .rs, .java, .swift, .json, .yaml, .toml)
mediaMedia projects (.psd, .ai, .sketch, .fig, .aep, .prproj, .fcpx, .mov, .mp4)

Dependencies

Dependencies

  • macOS
  • Homebrew
  • Mole (
    brew install tw93/tap/mole
    )
  • Python:
    pip install jinja2
  • macOS
  • Homebrew
  • Mole (
    brew install tw93/tap/mole
    )
  • Python:
    pip install jinja2

Output Structure

Output Structure

~/.config/mole-cleaner/
├── logs/                    # 操作日志
├── reports/                 # HTML 报告
└── achievements/            # 成就页面

~/Desktop/
└── mole-clean-list-YYYYMMDD-HHMMSS.csv  # CSV 完整清单
~/.config/mole-cleaner/
├── logs/                    # Operation logs
├── reports/                 # HTML reports
└── achievements/            # Achievement pages

~/Desktop/
└── mole-clean-list-YYYYMMDD-HHMMSS.csv  # Complete CSV list

Credits

Credits