Skip to content

feat(clean): expand cleanup coverage for 20+ uncovered app caches#921

Closed
yhy0 wants to merge 5 commits into
tw93:mainfrom
yhy0:main
Closed

feat(clean): expand cleanup coverage for 20+ uncovered app caches#921
yhy0 wants to merge 5 commits into
tw93:mainfrom
yhy0:main

Conversation

@yhy0
Copy link
Copy Markdown
Contributor

@yhy0 yhy0 commented May 18, 2026

Summary

Scanned a real macOS system against Mole's current cleanup modules and found ~10.7GB of cacheable/cleanable data across 20+ apps that Mole did not cover. This PR adds safe cleanup for all verified items.

  • 3 files changed, 334 insertions
  • All items verified via mo clean --dry-run with no regressions
  • Tests pass: ./scripts/test.sh

What's New

App Caches (lib/clean/app_caches.sh)

App Type Size Found Notes
CodeBuddy Extension Electron cache + logs 833MB VS Code fork, same pattern as Cursor/Qoder
CodeBuddy CN Electron cache/data/GPU/logs 496MB Same as above
QQ Music Mac Streaming cache, logs, temp 326MB Offline music (iDownloadProxy) protected
Tencent Video Old installer + native cache 1.0GB Stale .dmg/.zip from completed upgrades
Neat Download Manager Stale incomplete segments 2.18GB Age-gated >30 days, history DB untouched
Spacedrive Thumbnail cache (.webp) 434MB Regenerated on next browse

Developer Tools (lib/clean/dev.sh)

Tool Type Size Found Notes
Podman Review-only hint Same pattern as Docker (skipped by default)
GitKraken CLI Old version cleanup 96MB Keeps active symlink + most recent version
Chrome DevTools MCP Browser profile cache 908MB Headless Chrome for MCP, not user profile
Playwright Go Browser cache 127MB Complements existing ms-playwright
Solana CLI Orphan platform-tools 1.78GB CLI not installed, pure orphan cache
PyInstaller Bootloader binary cache 60MB Auto-rebuilt on next package
virtualenv Seed wheel/unzip cache 31MB Existing venvs unaffected
Chromium snapshots Standalone download 340MB Not referenced by any running app
CodeNexus Cache + logs (orphan) 507MB Guarded: only cleans if binary NOT in PATH
ScmClient (iOA) Logs 31MB Tencent iOA client logs
ChromaDB Review-only hint 174MB Large ML model, user decides
OpenCode Review-only hint 1.39GB Chat history, user decides

Browsers (lib/clean/user.sh)

Browser Fix Size Found
Arc (new layout) Add User Data/ paths for new Arc versions 342MB
Arc Add extensions_crx_cache + component_crx_cache 214MB
QQ Browser 3 Full Chromium cache cleanup 4MB

Other (lib/clean/user.sh)

Item Size Found Notes
WebKit app caches 70MB New function: scans ~/Library/WebKit/<non-apple>/WebsiteData/
Office FontCache 117MB Regenerable font rendering cache
Large file hints OpenCode + ChromaDB added to review-only section

Safety Design

  • QQ Music offline music (iDownloadProxy): explicitly not in cleanup scope
  • NeatDM history (NeatDB.db): root-level file, never matched by */ glob
  • GitKraken active version: symlink target always skipped, mtime-sorted fallback
  • CodeNexus: command -v guard — only cleaned when tool is uninstalled
  • WebKit: skips com.apple.*, uses is_critical_system_component + should_protect_data
  • Arc/QQBrowser/Chrome: running-process checks (pgrep -x) prevent cache deletion while in use
  • version-fox: deliberately NOT cleaned (.cache/ is actually the SDK install directory)

Test plan

  • mo clean --dry-run shows all new items correctly
  • mo clean --dry-run --debug shows detailed paths
  • ./scripts/test.sh passes (Go tests, module loading, integration)
  • No shellcheck violations in modified files
  • Dry-run total: 10.71GB identified across 707 items, 60 categories

🤖 Generated with Claude Code

Scanned a real macOS system against Mole's cleanup modules and found ~10GB
of cacheable data across apps that Mole did not cover. This commit adds
safe cleanup for all verified items.

New app coverage:
- CodeBuddy Extension / CodeBuddy CN: Electron cache + logs (1.3GB)
- QQ Music Mac: streaming cache, logs, temp (protect offline downloads)
- Tencent Video: old installer residue, native cache, document cache
- Neat Download Manager: stale incomplete downloads >30 days (age-gated)
- Spacedrive: regenerable thumbnail cache
- QQ Browser 3: Chromium cache/shader/CRX/crashpad
- Microsoft Office: font cache in Group Containers

Developer tools:
- Podman: review-only hint (same pattern as Docker)
- GitKraken CLI: old version cleanup (keep active + most recent)
- Chrome DevTools MCP: browser profile cache
- Playwright Go: browser cache (complements existing ms-playwright)
- Solana CLI: orphan platform-tools cache
- PyInstaller: bootloader binary cache
- virtualenv: seed wheel/unzip download cache
- Chromium browser snapshots: standalone download residue
- CodeNexus: cache + logs (guarded by command existence check)
- ScmClient (Tencent iOA): logs
- ChromaDB: review-only hint for large ML model cache
- OpenCode: review-only hint for session storage data

Browser fixes:
- Arc Browser: add User Data/ layout paths (new Arc versions moved
  profiles under User Data/ subdirectory, old glob paths missed them)
- Arc Browser: add extensions_crx_cache + component_crx_cache cleanup

New feature:
- WebKit app cache cleanup: scan ~/Library/WebKit/<bundle_id>/WebsiteData
  for non-Apple apps (was known to uninstall module but not mo clean)

Large file hints:
- OpenCode session data and ChromaDB model cache added to review-only
  large file candidates section

Safety:
- QQ Music offline downloads (iDownloadProxy) explicitly protected
- NeatDM history database (NeatDB.db) never touched, only stale segments
- GitKraken active symlink target always preserved
- CodeNexus only cleaned when binary is NOT in PATH (orphan guard)
- WebKit cleanup skips com.apple.* and uses existing protection guards
- All items verified via dry-run with no regressions

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@yhy0 yhy0 requested a review from tw93 as a code owner May 18, 2026 06:14
yhy0 and others added 4 commits May 18, 2026 14:25
CodeNexus is an AI code indexing daemon that runs from ~/.codenexus/bin/
(not in PATH). The previous guard using `command -v` would incorrectly
treat it as orphaned. The cache is only ~3MB and rebuilding indexes has
a time cost, so it's not worth cleaning automatically.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The chrome-devtools-mcp profile directory is actively used by the MCP
server's headless Chrome instances. Deleting it while the server is
running would crash all active browser sessions.

Add pgrep guard to skip cleanup when chrome-devtools-mcp is running,
matching the same pattern used for other browser process checks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@tw93
Copy link
Copy Markdown
Owner

tw93 commented May 22, 2026

@yhy0 Thanks for the broad cache audit. There are useful observations in here, but I am going to close this PR because it is too large and too risky to merge as one change.

This mixes 20+ cleanup rules, a generated CONTRIBUTORS.svg update, no focused regression tests, and the branch now conflicts with main. Some targets also need more review before Mole can safely clean them by default, especially WebKit WebsiteData, Solana cache, and Chromium snapshot directories.

The path I would accept is to split this into small PRs with one clearly rebuildable cache family at a time, each with focused tests. Good candidates would be narrower fixes like Arc’s newer profile layout or QQ Browser cache cleanup. Please leave generated contributor churn out of those PRs.

@tw93 tw93 closed this May 22, 2026
tw93 added a commit that referenced this pull request May 22, 2026
Derived from #921 by yhy0, narrowed to low-risk browser cache paths with focused tests.

Co-authored-by: yhy0 <31311038+yhy0@users.noreply.github.com>
@tw93
Copy link
Copy Markdown
Owner

tw93 commented May 22, 2026

@yhy0 Thanks for the cache audit. I took the narrower path from this PR and landed the low-risk Arc User Data and QQ Browser cache coverage on main in 23eaea0, with focused tests and co-author credit for your original work.

I left the broader cleanup targets out so they can be reviewed separately in smaller PRs. This will be included in the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants