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

659 Commits

Author SHA1 Message Date
tw93
88b0fe6af3 refactor(base): extract get_lsregister_path as shared utility
Move get_lsregister_path() to base.sh to avoid duplication across
optimize and uninstall modules. Adds macOS 14+ compatibility with
fallback paths.
2026-02-26 11:53:39 +08:00
tw93
980bbcd3c3 fix(uninstall): improve LaunchServices path detection for macOS 14+
- Add fallback paths for lsregister tool
- Check executable permission before using path
2026-02-26 11:47:46 +08:00
tw93
3bd3e400b6 style: improve code consistency and formatting
- Rename _MOLE_HINTS_DIR to mole_hints_dir (naming convention)
- Split local variable declaration and assignment
- Add ICON_INFO constant to base.sh
- Remove redundant has_cached_sudo function (use has_sudo_session)
2026-02-26 11:47:41 +08:00
tw93
3c3c976b5b fix(optimize): use ICON constants and improve LaunchServices path detection
- Replace Unicode characters with ICON_SUCCESS and ICON_INFO constants
- Add fallback paths for lsregister tool (macOS 14+ compatibility)
2026-02-26 11:47:33 +08: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
258d78991a fix: refresh launchservices after app uninstall 2026-02-24 14:26:33 +08:00
tw93
db602a0022 fix: skip font cache rebuild when browsers are running 2026-02-24 14:23:00 +08:00
tw93
8bd257a9c2 refactor(purge): reuse shared size formatter in header 2026-02-24 14:20:25 +08:00
Angelk90
ae5e81722b Fix (#486) 2026-02-24 14:17:20 +08:00
tw93
3e3594dc58 fix(clean): avoid false success for third-party log cleanup 2026-02-23 13:39:27 +08:00
tw93
ff00e9ba9c refactor(clean): extract shared purge hint helpers 2026-02-23 13:39:22 +08:00
tw93
4c9a71315f refactor(ui): unify action and list hints across commands 2026-02-23 11:34:22 +08:00
tw93
3112673ed3 feat(clean): add storage clues after large files 2026-02-23 11:34:04 +08:00
tw93
1169cbf198 fix(purge): avoid command find in fallback scan (#478) 2026-02-23 08:15:47 +08:00
tw93
8f5b70457e fix(purge): normalize search roots for scan filtering (#478) 2026-02-22 22:06:19 +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
894c81bb9a fix(purge): detect artifacts when search path is project root 2026-02-22 10:08:20 +08:00
tw93
ec3affe882 chore(clean): reduce noisy clean output messages
- remove redundant project cache scanning line

- align xcode runtime empty result message to already clean
2026-02-21 23:48:07 +08:00
tw93
16a8bcafde chore(dev-clean): streamline runtime volume reporting
- reduce noisy scan output outside debug mode

- consolidate final result messaging

- run xcode/code editor stages explicitly in developer flow

- update dev cache tests for new stage calls
2026-02-21 23:36:05 +08:00
tw93
c95a4ec5a8 fix(system): enforce safe sudo cleanup paths
- replace direct delete patterns with safe_sudo_find_delete/safe_sudo_remove

- keep log/temp/diagnostic cleanup behavior with guarded scans

- align system maintenance tests with safe deletion flow
2026-02-21 23:35:58 +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
9440d9e52a fix(dev): normalize npm cache paths and add maven function guard
- Normalize npm cache paths with pwd -P to handle symlinks and
  trailing slashes, preventing duplicate scans of same directory
- Add declare -f check before calling clean_maven_repository for
  robustness when dynamic source fails
- Add test for trailing slash handling

Addresses: dev.sh (line 27, 48, 602)
2026-02-21 20:22:01 +08:00
tw93
0597021fd4 fix(purge): save and restore caller traps to prevent state leak
- Save caller's INT/TERM traps before installing local cleanup trap
- Restore original traps after clean_project_artifacts completes
- Add test to verify trap restoration behavior

Fixes P3 issue: project.sh (line 825, 870)
2026-02-21 20:21:54 +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
7c974bf351 fix(purge): prevent hangs during size calculation 2026-02-19 22:52:27 +08:00
tw93
abd9791cd7 feat(clean): add Maven local repository cleanup support 2026-02-16 18:54:19 +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
f21794d3d9 fix(clean): fix find -maxdepth position for BSD/macOS compatibility
On macOS (BSD find), -maxdepth must be placed before -name to work
correctly. When placed after, it was ignored causing find to scan
the entire home directory indefinitely on large directories.

Fixes #463
2026-02-16 16:05:22 +08:00
tw93
a29cadbfd0 fix(purge): resolve trap conflict between purge.sh and project.sh
- Add guard flag in cleanup_monitor to prevent duplicate execution
- Check for existing trap in project.sh before setting new one
- Prevents crash when user presses Ctrl-C or scan process fails
2026-02-16 15:54:16 +08:00
tw93
1a63b992c6 refactor(clean): simplify npm residual directories cleanup
Use loops instead of duplicated safe_clean calls for npm cache
directories (_cacache, _npx, _logs, _prebuilds). Add comments
explaining these are not removed by npm cache clean --force.
2026-02-16 15:53:32 +08:00
tw93
a61a427f88 feat(clean): add Expo cache cleanup support
Clean Expo/React Native caches in ~/.expo while preserving state.json
which contains authentication tokens.

Caches cleaned:
- expo-go/
- android-apk-cache/
- ios-simulator-app-cache/
- native-modules-cache/
- schema-cache/
- template-cache/
- versions-cache/

Closes #462
2026-02-16 15:45:21 +08:00
tw93
679ca2f30c Merge branch 'main' of https://github.com/tw93/Mole 2026-02-16 15:40:38 +08:00
Michael Aristarco
ab83bd1ed9 fix: deep clean npm residual caches (#457)
Fixes #454
2026-02-16 15:40:13 +08:00
tw93
685aa8b970 refactor(purge): improve React Native targets safety and clarity
- Clarify .cxx comment to indicate React Native NDK build cache
- Add protection for Xcode global DerivedData in ~/Library/Developer/Xcode/
  to prevent accidental deletion of shared build artifacts

Refs: #461
2026-02-16 15:39:00 +08:00
Dimitar Nestorov
a7c9b8d6ec feat(purge): add common React Native targets (#461) 2026-02-16 15:37:07 +08:00
tw93
950af1a5ed Improve clean progress visibility for dev runtime scans 2026-02-15 08:45:47 +08:00
tw93
c896163d4b fix(clean): ensure flutter .dart_tool caches are discovered 2026-02-15 08:03:38 +08:00
tw93
744ecec4ba fix(clean): use sudo-safe cleanup for Xcode documentation cache 2026-02-15 07:52:43 +08:00
tw93
7d193526c3 fix(purge): support vim j/k navigation in selector 2026-02-15 07:48:35 +08:00
yamamel
0cde1041f9 feat(clean): add interactive Xcode simulator runtime volumes cleanup (#444)
* feat(clean): add interactive Xcode simulator runtime volumes cleanup

Scan CoreSimulator Volumes/Cryptex directories, detect IN_USE/UNUSED
status via mount points, and let users interactively select items to
clean. Also show size info for unavailable simulator cleanup.


* refactor(clean): auto-clean Xcode simulator runtime volumes

Remove interactive selector, now automatically cleans all UNUSED
runtime volumes while skipping IN_USE and protected paths.
2026-02-13 10:41:28 +08:00
Paul
2ee95f963e Add '$HOME/Developer' to common development paths (#447)
Add '$HOME/Developer' as it is a convention-based workspace directory on macOS
2026-02-13 10:30:33 +08:00
Mario Vtor
a73a739b02 feat: add generic flutter clean support (#450)
* fix: re-apply flutter clean logic after branch switch

* fix(caches): unify hidden directory exclusion pattern

Restore */.* pattern to exclude all hidden directories consistently
across Next.js, Python, and Flutter scans. This prevents scanning
into .venv, .idea, .DS_Store and other hidden directories.

---------

Co-authored-by: tw93 <tw93@qq.com>
2026-02-13 10:28:12 +08:00
NeedmeFordev
85cd0253d5 feat(uninstall): remove app diagnostic reports from /Library/Logs/DiagnosticReports (fixes #441) (#443)
* Implement deleting files from DiagnosticReports

* fix(uninstall): avoid diagnostic size double-count and set -e exit

---------

Co-authored-by: tw93 <tw93@qq.com>
2026-02-11 14:35:45 +08:00
tw93
4c60fcca73 fix(uninstall): show full preview paths and add regression tests 2026-02-11 14:22:22 +08:00
NeedmeFordev
42893381e3 fix silent exit on permission denied during App State Cleanup (#440) 2026-02-11 10:40:34 +08:00
tw93
7ab04035a5 fix(clean-dev): keep mtime variable local in doc cache cleanup 2026-02-10 16:33:17 +08:00
tw93
7d8bfbc9d9 improve uninstall scan metadata and list refresh UX 2026-02-10 16:23:15 +08:00