1
0
mirror of https://github.com/tw93/Mole.git synced 2026-03-22 16:45:07 +00:00
Commit Graph

69 Commits

Author SHA1 Message Date
Tw93
0c71ee9363 fix(main): preserve versioned app names and clean mise cache 2026-03-22 14:45:21 +08:00
Nour
65b0db4e1c feat(clean): add opt-in Docker unused data pruning (#554)
* feat(clean): add opt-in Docker unused data pruning

* fix(clean): make docker prune default

---------

Co-authored-by: Tw93 <hitw93@gmail.com>
2026-03-10 16:20:40 +08:00
tw93
50efe51565 fix(clean): guard empty Xcode DeviceSupport arrays 2026-03-07 23:10:41 +08:00
tw93
8e4b8a5e0d Improve update checks and cleanup UX, add timeout regressions 2026-03-05 12:00:07 +08:00
tw93
25cba0cf38 refactor(clean): simplify Xcode DeviceSupport cleanup logic
- Use array slicing instead of manual loop for splitting dirs
- Remove redundant early returns with duplicated safe_clean calls
- Consolidate cache/logs cleanup to single location at function end
2026-03-03 16:16:52 +08:00
Nour
607073c333 feat(clean): clean old Xcode DeviceSupport versions instead of just their caches (#519) 2026-03-03 16:05:29 +08:00
tw93
677077818e refactor(clean): simplify Go cache whitelist logic
- Fix undefined ICON_SKIP, use ICON_SUCCESS instead
- Reduce code from 46 to 27 lines with early return pattern
- Consistent styling with other whitelist skip messages
2026-03-03 16:02:39 +08:00
Noah Qin
5d4c304797 fix(clean): respect whitelist when cleaning Go caches (#530)
- Add whitelist checking to clean_dev_go() function
- Check both GOCACHE and GOMODCACHE before cleaning
- Show appropriate messages for protected caches
- Fix whitelist pattern from ~/go/pkg/mod/cache/* to ~/go/pkg/mod/*
- Split Go cache into separate build and module entries

Fixes #521
2026-03-03 15:57:45 +08:00
tw93
d0e5e3618e Merge branch 'main' into dev 2026-03-03 15:42:13 +08:00
tw93
abb0b2b688 fix(clean): use defined ICON_WARNING instead of undefined ICON_SKIP
Ref #531
2026-03-03 15:39:45 +08:00
Noah Qin
0da3d4ab23 fix(clean): enhance Xcode simulator cleanup with fallback mechanism (#531)
- Add simctl availability check before attempting cleanup
- Capture and analyze error output for better diagnostics
- Implement fallback: manual deletion when simctl fails
- Provide specific error hints (permission, in-use, service issues)
- Skip early when no unavailable simulators exist
- Show partial success status when some deletions fail

Error scenarios now handled:
- simctl not available → skip with friendly message
- Permission denied → show hint and try manual deletion
- Device in use → show hint and try manual deletion
- CoreSimulator service issues → show hint
- Partial failures → show "partially cleaned X/Y"

Fixes #520
2026-03-03 15:38:01 +08:00
tw93
3b5707b078 fix(clean): skip pip cache cleanup when pip3 is macOS stub
On macOS 15+, /usr/bin/pip3 exists as a stub that triggers Command Line
Tools installation dialog. The previous check only verified command
existence, causing false "pip cache · would clean" output for users
without actual pip3 installed.

Now verifies pip3 is functional by checking `pip3 --version` before
attempting cleanup.

Fixes #512
2026-02-28 20:19:30 +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
646ff72a96 fix(clean): resolve unbound variable 'mount_points[@]' error in empty array case (#511) 2026-02-28 09:53:07 +08:00
tw93
aa1a436862 fix(clean): improve loading feedback and spinner output 2026-02-26 16:36:06 +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
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
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
Michael Aristarco
ab83bd1ed9 fix: deep clean npm residual caches (#457)
Fixes #454
2026-02-16 15:40:13 +08:00
tw93
950af1a5ed Improve clean progress visibility for dev runtime scans 2026-02-15 08:45:47 +08:00
tw93
744ecec4ba fix(clean): use sudo-safe cleanup for Xcode documentation cache 2026-02-15 07:52:43 +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
tw93
7ab04035a5 fix(clean-dev): keep mtime variable local in doc cache cleanup 2026-02-10 16:33:17 +08:00
tw93
8b025dd640 feat: clean duplicate Xcode documentation indexes safely 2026-02-10 15:51:28 +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
bad1c71231 fix: protect Gradle cache from cleanup by default
Gradle build cache (~/.gradle/caches) is now protected by default whitelist,
similar to Maven repository. This prevents unintentional deletion of large
dependency caches that take time and bandwidth to re-download.

- Add ~/.gradle/caches/* and ~/.gradle/daemon/* to DEFAULT_WHITELIST_PATTERNS
- Remove Gradle cleanup from clean_dev_jvm() function
- Users can disable protection via 'mo clean --whitelist' if needed

Fixes #408
2026-02-03 16:37:33 +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
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
TomP0
61723e8d86 fix: handle empty arrays in clean_dev_jetbrains_toolbox (#361)
Add checks for empty product_dirs and version_dirs arrays before
iterating to prevent "unbound variable" errors when running with
set -u (pipefail) and the JetBrains Toolbox directory doesn't exist
or contains no products.
2026-01-26 10:49:30 +08:00
Tw93
500b6dc554 fix(clean): silence ShellCheck SC2053 2026-01-23 18:32:33 +08:00
Tw93
8c9cd1f90c feat(clean): add JetBrains Toolbox old IDE cleanup with whitelist-safe handling 2026-01-23 17:37:37 +08:00
Tw93
3f85c8238f Use gray color for warning icons to reduce visual noise 2026-01-20 15:07:37 +08:00
Tw93
acdf40dd2c Unify output format for multiple versions check 2026-01-20 14:44:11 +08:00
Tw93
2d5ccf5d71 fix: exclude Flutter/CocoaPods/Pub caches from cleanup (#334)
Prevent forced re-downloads and re-installations by not cleaning:
- ~/Library/Caches/CocoaPods (spec repo cache)
- ~/.cache/flutter (engine/artifacts cache)
- ~/.pub-cache (Dart package cache)

Also standardize redirection syntax to '> /dev/null' for consistency.

Fixes #334
2026-01-19 17:08:35 +08:00
Tw93
421cdd09dc feat: enhance safe cache cleaning for Electron apps and VS Code
- Add safe cleanup for Antigravity, Filo, and Claude caches in Application Support (Cache, GPUCache, Code Cache only).
- Enhance VS Code cleanup to include deep rendering caches (GPU, Dawn) and extension installers.
- Validated to ensure no user data or pnpm/yarn executables are touched.
2026-01-13 19:04:54 +08:00
Tw93
0bd30955a2 feat: detect multiple NDK and Rust toolchain versions (#234)
Add report-only detection for multiple Android NDK and Rust toolchain
installations. Users receive helpful guidance for manual cleanup via
Android Studio SDK Manager or rustup commands.

- Add check_android_ndk() and check_rust_toolchains()
- Extract check_multiple_versions() helper (DRY)
- Add 4 test cases, optimize test performance
- Fix shellcheck warnings

All 393 tests passing.
2026-01-13 15:59:43 +08:00
Tw93
1a40875b80 refactor: improve code quality and test coverage
This commit addresses several code quality issues identified in the
recent bash 3.2 compatibility fixes:

1. Remove redundant array length check in is_whitelisted()
   - The second check for array length > 0 is unnecessary after
     already checking for length == 0

2. Clean up commented dangerous cleanup code in dev.sh
   - Replace commented-out code with clear documentation
   - Add explicit notes explaining why certain paths are excluded
   - Improves maintainability by preventing confusion

3. Enhance test coverage for excluded paths
   - Add tests to verify Mix archives are NOT cleaned
   - Add tests to verify Stack programs are NOT cleaned
   - Add tests to verify VS Code workspace storage is NOT cleaned
   - These tests ensure critical data remains protected

All changes pass ShellCheck, syntax validation, and formatting checks.
2026-01-12 10:09:02 +08:00
Tw93
54be4e30a2 fix: global optimization for safe_clean and doc update 2026-01-11 09:55:18 +08:00
Tw93
413b2c8f98 fix: disable aggressive cleanup and optimize directory checks 2026-01-11 09:27:12 +08:00
biplavbarua
096c0ca73f feat: add cleanup support for Elixir, Haskell, OCaml, and Editors 2026-01-10 01:22:43 +05:30
Tw93
f5a8adb97e feat: implement empty Library directory cleanup and Android NDK version check. 2026-01-03 09:41:05 +08:00
Tw93
d701519310 refactor: simplify pnpm environment variable handling in clean script 2026-01-02 19:10:20 +08:00
Tw93
910e79df4e feat: Improve clean command's regex handling and pnpm cache cleaning, enhance test output, update completion descriptions, and clarify installation instructions. 2026-01-02 18:50:42 +08:00
Tw93
9aa569cbb6 feat: Enhance clean, optimize, analyze, and status commands, and update security audit documentation. 2025-12-31 16:23:31 +08:00
Tw93
6c1fcd23d7 feat: optimize clean operation performance by pre-expanding whitelist patterns, improving size calculation, and adapting parallel processing based on file types, alongside test suite enhancements. 2025-12-30 17:13:43 +08:00
Tw93
694c55f73b fix: implement layered error tolerance and accurate cleanup reporting (#175 #176 #180)
- Fix safe_remove set -e trap in command substitution
  - Fix has_full_disk_access false positives and unknown state handling
  - Use set +e in perform_cleanup for graceful degradation
  - Track removal failures and only count actually deleted items (#180)
  - Add "Skipped X items (permission denied or in use)" notification
  - Improve spinner reliability with cooperative stop mechanism (#175)
2025-12-29 14:27:47 +08:00