Changelog
- Performance breakthroughs across core paths: Homebrew detection optimized with fast-path symlink checks and Cellar pre-validation, delivering up to 10× faster startup in common setups. Application scanning now uses intelligent metadata caching with automatic invalidation, dramatically speeding up repeated analyze/cleanup runs.
- Smarter volume scanning: Added protocol-based detection to safely skip network volumes (SMB/NFS/AFP/WebDAV), combined with 1-second timeout protection to avoid slow hangs. External volume scans now run with significantly lower overhead.
- Hardened file safety & system stability: Restricted
chownoperations strictly to the user's home directory with multiple validation gates. Improved Darwin version detection with conservative fallbacks, and disabled risky LaunchServices rebuilds on macOS Sonoma/Sequoia to prevent System Settings corruption. Updated firewall management to usesocketfilterfwcommand for improved reliability on modern macOS. - Expanded cleanup & platform support: Introduced dedicated pnpm cache cleaning, streamlined cache path handling, added configurable depth control for project artifact cleanup, and included Legcord (Discord client) in the protected applications list. Added Trash whitelist protection for
~/.Trashand external volume Trash directories. - Polished terminal UX: Added ANSI capability checks for safe line clearing, eliminated spinner conflicts during sudo/Touch ID prompts, unified check icons and output structure, and improved visual hierarchy for clearer, more stable terminal interactions with section-level progress spinners.
- Codebase simplification & reliability: Extracted centralized
is_path_whitelisted()helper function, eliminating 47 lines of duplicate code across 3 files. Removed 301 lines of redundant logic from optimization tasks, consolidated spinner and logging helpers, strengthened shell array handling, and standardized BSDstatusage to avoid conflicts with GNU coreutils. - Major test suite expansion: Added 540+ new tests covering performance benchmarks, permission-safety validation, user file handling edge cases, uninstall robustness, and firewall management, ensuring consistent behavior across diverse macOS environments.
- Documentation & internal updates: Updated
SECURITY_AUDIT.mdwith the latest protection model, documented Trash whitelist mechanisms, rebuilt Go binaries (analyze-go,status-go) with recent improvements.
更新日志
- 核心性能显著提升:针对 Homebrew 安装场景引入快速路径检测与 Cellar 预校验,常见情况下启动速度提升 10 倍以上;应用扫描新增元数据缓存与自动失效机制,大幅加快 analyze / cleanup 的重复执行速度。
- 更智能的磁盘卷处理:通过协议识别自动跳过 SMB / NFS / AFP / WebDAV 等网络卷,并加入 1 秒超时保护,避免网络阻塞;外置磁盘扫描开销明显降低。
- 文件权限与系统稳定性全面加固:
chown操作严格限制在用户主目录内,增加多重校验防止误伤系统文件;改进 Darwin 版本识别策略;在 macOS Sonoma / Sequoia 上禁用高风险 LaunchServices 重建,防止系统设置异常;升级防火墙管理方式,使用socketfilterfw命令提高现代 macOS 系统上的可靠性。 - 清理能力与生态支持增强:新增 pnpm 缓存清理;项目构建产物清理支持可配置深度;将 Legcord(第三方 Discord 客户端)加入受保护应用列表;新增 回收站白名单保护,支持
~/.Trash及外置卷回收站目录。 - 终端交互体验打磨:增加 ANSI 能力检测,避免清屏异常;修复 sudo / Touch ID 场景下的视觉闪烁;统一状态图标与输出结构;添加分段级进度 spinner,整体显示更稳定、更清晰。
- 代码质量与可维护性提升:提取统一的
is_path_whitelisted()辅助函数,消除 47 行重复代码;精简优化任务模块 301 行冗余逻辑;统一 spinner 与日志处理;增强 shell 数组与 glob 边界处理;强制使用 BSDstat,避免与 GNU coreutils 冲突。 - 测试体系大幅扩展:新增 540+ 项测试,涵盖性能基准、权限安全校验、用户文件处理边界情况、卸载流程健壮性、防火墙管理等,覆盖更多真实 macOS 使用场景。
- 文档与内部更新:
SECURITY_AUDIT.md同步最新防护策略;补充回收站白名单机制说明;重建 Go 二进制(analyze-go、status-go)。
Thanks to everyone who provided feedback and reported bugs. Your input makes Mole better. If you find Mole useful, a Star is always appreciated.