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

645 Commits

Author SHA1 Message Date
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
tw93
8b025dd640 feat: clean duplicate Xcode documentation indexes safely 2026-02-10 15:51:28 +08:00
tw93
172afa83af refactor: centralize subcommand help handlers 2026-02-10 15:06:14 +08:00
tw93
7813124f33 refactor: Extract com.clash.app pattern to avoid ShellCheck redundancy warning 2026-02-09 20:25:10 +08:00
tw93
c8b4b085c6 feat: Add com.clash.app to the list of recognized proxy application patterns. 2026-02-09 20:13:59 +08:00
tw93
b2987b0bb9 feat: add VS Code ShipIt cache directories to cleanup list #427 2026-02-09 19:47:50 +08:00
tw93
f8ff6d54cd fix(purge): dynamically limit path display width to 70% of terminal, fixing issue #433 2026-02-09 19:34:15 +08:00
tw93
e6829b9a5d fix: improve cache freshness fallback and proxy detection 2026-02-07 17:48:55 +08:00
tw93
361d0dda05 fix: P1/P2 issues in file ops, menu state, and logging
- Fix safe_sudo_remove early exit on error (P1)
- Fix menu filter state leakage in paginated menu (P2)
- Fix cleanup of MOLE_MENU_FILTER_NAMES in app selector (P2)
- Correct log_operation signature for memory dumps (P2)
- Apply minor formatting fixes to dev cleanup module
2026-02-07 11:21:37 +08:00
tw93
6f8f16ce48 optimize Xcode simulator cleanup feedback/count (#418) 2026-02-07 11:17:07 +08:00
tw93
5cdfcf2479 fix(uninstall): detect Maestro Studio .mobiledev and add regression test (#421) 2026-02-07 10:44:10 +08:00
tw93
500ab2f568 fix(uninstall): detect Zed HTTPStorages channel variants (#422) 2026-02-07 10:38:17 +08:00
tw93
a2afb786af fix(ui): standardize spacing in terminal control functions and improve readability 2026-02-07 10:31:15 +08:00
tw93
02843dee74 feat(ui): add Ctrl+U support and optimize paginated menu performance 2026-02-07 10:28:41 +08:00
tw93
337f526021 fix(uninstall): fix error in batch uninstallation logic 2026-02-07 10:26:53 +08:00