1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 23:40:09 +00:00
Commit Graph

111 Commits

Author SHA1 Message Date
Tw93
b8f3a0ecd3 fix(clean): avoid container cache scan stalls
Add a lightweight top-level entry cap to Containers and Group
Containers scanning.  When a cache directory exceeds the threshold,
skip the expensive per-item du/find size scan and take a partial-size
/ "cleaned" output path instead.  Replace find-piped-to-read loops
with pure-bash glob iteration to cut external process overhead.

Closes #586
2026-03-18 14:49:12 +08:00
Tw93
e1f427c9aa fix: stop cleaning aerial wallpaper assets by default 2026-03-17 16:35:10 +08:00
Tw93
ea4cd9d0e3 fix(tests): prevent permission dialogs during test runs
Add MOLE_TEST_MODE=1 checks to skip AppleScript osascript calls
and sudo operations that trigger system permission dialogs during tests:

- lib/check/all.sh: Skip login items listing
- lib/clean/apps.sh: Skip running app detection
- lib/clean/user.sh: Skip Finder trash operations and sudo test calls
- lib/core/log.sh: Skip sudo status check in debug log
- lib/uninstall/batch.sh: Skip login item removal

Also add MOLE_TEST_MODE=1 export to all test files that load
these modules to ensure consistent test isolation.
2026-03-16 20:43:35 +08:00
Tw93
cfa0a82057 fix: skip incomplete downloads that are actively in use
Before deleting .download/.crdownload/.part files, check lsof to
detect open file handles. Files held by an active browser process
are skipped with a warning instead of being deleted.

Fixes a case where a 12GB IPSW being downloaded in Safari was
removed mid-download because the .download bundle matched the glob.
2026-03-16 07:39:41 +08:00
Tw93
7a0b4cf07e fix: move logs to ~/Library/Logs/mole, add system idle assets cleanup
- Move log files from ~/.config/mole/ to ~/Library/Logs/mole/ per
     macOS convention. Fixes #569.
   - Add safe_sudo_find_delete for /Library/Application Support/
     com.apple.idleassetsd/Customer/ screensaver videos. Closes #570.
   - Update tests to reflect new log file paths.
2026-03-15 11:38:18 +08:00
c5d923cd48 fix(appli-support):using whitelist in application_support clean (#562)
* fix(appli-support):using whitelist in application_support clean

* fix: harden clash verge app support protection

---------

Co-authored-by: Tw93 <hitw93@gmail.com>
2026-03-13 11:38:37 +08:00
tw93
300aded07b fix(clean): avoid stalls in app support scan 2026-03-07 18:35:19 +08:00
tw93
2578d0a920 chore: Bump version to 1.29.0 2026-03-05 15:16:55 +08:00
tw93
8e4b8a5e0d Improve update checks and cleanup UX, add timeout regressions 2026-03-05 12:00:07 +08:00
tw93
fbee8da9f7 feat: add Helium Browser cleanup support
Add cleanup support for Helium Browser (Chromium-based) on macOS.

Helium paths added:
- ~/Library/Caches/net.imput.helium/*
- ~/Library/Application Support/net.imput.helium/*/GPUCache/*
- ~/Library/Application Support/net.imput.helium/component_crx_cache/*
- ~/Library/Application Support/net.imput.helium/extensions_crx_cache/*
- ~/Library/Application Support/net.imput.helium/GrShaderCache/*
- ~/Library/Application Support/net.imput.helium/GraphiteDawnCache/*
- ~/Library/Application Support/net.imput.helium/ShaderCache/*
- ~/Library/Application Support/net.imput.helium/*/Application Cache/*

Also added "Helium" to the browser process detection list in optimize/tasks.sh.

Closes #534
2026-03-04 19:40:35 +08:00
tw93
c19a0276b8 refactor: Update shell arithmetic increment syntax from ((var++)) || true to var=$((var + 1)) across various scripts. 2026-02-28 11:10:18 +08:00
tw93
7d70889ad4 chore: auto format code 2026-02-28 11:03:16 +08:00
Tw93
61cf5271eb chore: auto format code 2026-02-28 01:50:15 +00:00
tw93
5710679809 fix: skip Time Machine checks when not configured, close #510
Use a fast `defaults read` pre-check before spawning any tmutil
process. On machines without Time Machine configured the check
returns instantly, avoiding the spinner and the 2-3s tmutil timeout.

Affected locations:
- lib/clean/system.sh: clean_time_machine_failed_backups()
- lib/clean/system.sh: clean_local_snapshots()
- lib/clean/user.sh: local snapshot hint in system hints
2026-02-28 09:35:08 +08:00
Tw93
922f5f1fc9 feat: add cleanup for aerial wallpaper videos
Add support for cleaning old aerial wallpaper videos in:
/Users/user/Library/Application Support/com.apple.wallpaper/aerials/videos

These video files can consume significant disk space (up to 50GB+) and
are safe to remove - macOS will re-download them on demand.

Uses MOLE_SUPPORT_CACHE_AGE_DAYS (default 30 days) to avoid removing
recently used wallpapers.

Closes #508
2026-02-27 23:46:40 +08:00
Tw93
a8065dfbae fix(application_support_logs): prevent process substitution failures by temporarily disabling pipefail 2026-02-27 23:20:04 +08:00
Tw93
013549ad25 fix: temporarily disable pipefail to prevent process substitution failures during cleanup operations 2026-02-27 22:52:38 +08:00
tw93
aa1a436862 fix(clean): improve loading feedback and spinner output 2026-02-26 16:36:06 +08:00
Tw93
b3f023b5e6 chore: auto format code 2026-02-26 03:54:50 +00:00
tw93
ceac7957aa fix(clean): correct Messages check logic and improve Application Support scanning
- Fix Messages running check to not skip CrashReporter/idleassetsd cleanup
- Add proper spacing between function definitions
- Add app_support_item_size_bytes() for accurate size calculation
- Improve progress reporting during Application Support scan
2026-02-26 11:47:28 +08:00
tw93
5d69968ac0 perf: improve Application Support scan progress and size accounting 2026-02-26 10:33:19 +08:00
诺亚Q
dc7380d5b2 fix: avoid hang on large Application Support directories (#495) (#496)
Replace du traversal + double find with single find -print0 + stat -f%z
to eliminate 8+ minute hang on directories with 392K files. Add progress
feedback via update_progress_if_needed in the outer loop.
2026-02-26 10:29:46 +08:00
tw93
3112673ed3 feat(clean): add storage clues after large files 2026-02-23 11:34:04 +08:00
tw93
fd5ceea743 feat(clean): expand conservative cache cleanup coverage
- add conservative support/app/system cache targets\n- fix dry-run + success logging behavior for memory exception cleanup\n- add regression tests for new cleanup paths and safeguards\n\nRefs #477
2026-02-22 11:06:48 +08:00
tw93
dc8d1bd948 refactor(clean): merge app cache/user essentials flow
- reorganize perform_cleanup sections and naming

- merge macOS + sandbox caches into clean_app_caches

- move recent items and mail downloads into user essentials

- update core/user tests for renamed internal helpers
2026-02-21 23:35:53 +08:00
tw93
ef0e34a214 refactor(clean): optimize Group Containers directory check
- Replace ls with find -maxdepth 1 to reduce IO and permission noise
- Keep same behavior: silently skip if directory is empty or inaccessible

Addresses: user.sh (line 484)
2026-02-21 20:22:06 +08:00
tw93
68b0b601a4 feat(clean): add Group Containers logs/caches cleanup
Add clean_group_container_caches() to safely clean Group Containers:
- Skip Apple-owned containers (com.apple.*, group.com.apple.*, systemgroup.com.apple.*)
- For protected apps: only clean Logs directories
- For non-protected apps: clean Logs, tmp, and Caches
- Add symlink checks to prevent path traversal
- Respect whitelist and should_protect_path checks
- Integrate with clean_sandboxed_app_caches flow

Also add symlink checks in process_container_cache() for consistency.

Includes 4 BATS tests covering protected apps, whitelist,
system containers, and empty results handling.
2026-02-20 10:44:09 +08:00
tw93
573f55e79e feat(clean): add Google Chrome/Updater cache cleanup support
Add cleanup for:
- Chrome component_crx_cache
- GoogleUpdater crx_cache
- GoogleUpdater *.old files

Closes #460
2026-02-16 16:09:24 +08:00
tw93
d0a95f5e31 fix: enhance performance of application support log cleanup using find -delete 2026-01-31 20:22:52 +08:00
tw93
7d62fa5e65 fix: improve performance of cache cleanup using find -delete 2026-01-31 20:19:38 +08:00
tw93
aa6f6c503f refactor: add feedback for fallback Trash cleanup
Improve user experience when osascript fails to empty Trash:
- Count successfully cleaned items
- Display cleanup confirmation message
- Only show message if items were actually cleaned
- Call note_activity to record the cleanup

This ensures users get consistent feedback regardless of which
cleanup method is used (osascript vs find fallback).
2026-01-31 17:40:07 +08:00
tw93
82df7abc35 Merge branch 'main' into dev 2026-01-31 17:37:46 +08:00
dekran
dcac6a3391 fix: handle dotfiles in Trash cleanup (#395)
Replace glob pattern with find command to properly clean dotfiles
in Trash when osascript fallback is used. The old pattern
~/.Trash/* does not match files starting with "." in bash.

This fix ensures that hidden files like .DS_Store, .hidden_file,
etc. are properly removed when cleaning the Trash.
2026-01-31 17:37:22 +08:00
tw93
89dcb0c3b5 fix: Use du -P for accurate size calculation and add timeouts to channel sends to prevent blocking. 2026-01-30 15:06:30 +08:00
tw93
0a46bf2077 fix: improve status icons and fix spinner cleanup
- Show ✓ for empty trash and discovered versions (normal states)
- Fix inline spinner not stopping, causing residual display artifacts
2026-01-28 20:15:26 +08:00
tw93
37e6994c34 feat(clean): add Yandex Browser cache cleanup support 2026-01-27 11:34:21 +08:00
tw93
e966838c82 style: standardize punctuation across codebase
- Replace parentheses with commas for supplementary info
- Use commas instead of em-dashes for separators
- Update bullet points from - to * in some contexts
- Improve version extraction regex with fallback logic
2026-01-26 14:36:06 +08:00
tw93
b8c25e4056 fix: improve cleanup code and fix Edge test isolation
- Refactor JetBrains Toolbox cleanup with _restore_whitelist helper
- Add MOLE_EDGE_APP_PATHS env var for test isolation
- Fix Edge old versions tests to avoid scanning system Edge installation
2026-01-26 11:09:38 +08:00
Tw93
5a29f506dc chore: auto format code 2026-01-26 02:46:32 +00:00
tw93
ee32a63673 Merge branch 'main' of https://github.com/tw93/Mole 2026-01-26 10:45:32 +08:00
tw93
e803c46304 style: unify DRY_RUN variable check in trash cleanup 2026-01-26 10:44:36 +08:00
Tw93
4bacba7fec chore: auto format code 2026-01-26 02:28:41 +00:00
Andrei Murariu
89eb442866 bug-fix: add automatic trash emptying to clean command (#363)
- Empty trash using macOS Finder API (osascript) for proper permission handling
- Respects whitelist protection (skips if Trash is whitelisted)
- Shows item count when emptying trash
- Fallback to direct cleanup if Finder API fails
- Supports dry-run mode

Issue: #362
2026-01-26 10:28:03 +08:00
Tw93
d7a0d480bc fix: improve dry-run mode and error handling
- Export MOLE_DRY_RUN env var for subprocess visibility
- Add || true to grep commands to prevent pipeline failures
- Add dry-run test for clean_orphaned_system_services
- Simplify clean_local_snapshots tests
2026-01-23 18:05:09 +08:00
Tw93
1ad7d7e79b refactor: simplify Puppeteer cache cleanup to match browser cache pattern
- Replace 48-line custom function with one-line safe_clean call
- Remove unnecessary interactive confirmation (consistent with other browser caches)
- Simplify tests to verify Puppeteer cache is in clean_browsers output
- Net: -93 lines of code for same functionality
2026-01-23 09:56:14 +08:00
Shakeel Mohamed
5a8d766667 Add Puppeteer cache cleanup (#353) 2026-01-23 09:55:02 +08:00
Tw93
cde39aaeb2 feat(clean): add large file review and unify warnings 2026-01-22 20:15:13 +08:00
Tw93
3f85c8238f Use gray color for warning icons to reduce visual noise 2026-01-20 15:07:37 +08:00
Tw93
46472bc86e chore: auto format code 2026-01-17 02:13:54 +00:00
Tw93
e6fc0613d5 perf: improve cleanup UI responsiveness and reduce visual flicker
- Speed up spinner animation from 100ms to 50ms for smoother visuals
- Fix spinner flicker by deferring stop until output is ready
- Remove unnecessary 'Preparing...' spinner at section start
- Hide whitelist-protected items from output (Trash, Finder metadata)
- Add spinner feedback for system diagnostic log cleanup
- Remove redundant stop_section_spinner calls in cleanup modules

The cleanup process now feels significantly faster and more polished,
with continuous visual feedback and no jarring gaps between operations.
2026-01-17 10:12:23 +08:00