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

297 Commits

Author SHA1 Message Date
tw93
24da1e2ac1 fix(clean): speed up Python bytecode cache cleanup 2026-03-08 19:45:53 +08:00
tw93
2a36c662aa fix: tighten orphan cleanup retention windows 2026-03-08 15:33:30 +08:00
tw93
26b267c4a2 fix: harden orphan cleanup and lsregister fallback 2026-03-08 15:29:25 +08:00
tw93
50efe51565 fix(clean): guard empty Xcode DeviceSupport arrays 2026-03-07 23:10:41 +08:00
Onur Taşhan
dfedc029d1 fix: handle empty menu_options in mo purge to prevent unbound variable error (#547)
When no artifacts are found during scanning, `menu_options` remains an
empty array. With `set -euo pipefail` active, expanding `${menu_options[@]}`
on an empty array causes a fatal "unbound variable" error (line 1325).

Add an early-return guard after the spinner stops: if no items were found,
print a friendly "No artifacts found to purge" message and exit cleanly.

Fixes #546
2026-03-07 20:33:47 +08:00
tw93
300aded07b fix(clean): avoid stalls in app support scan 2026-03-07 18:35:19 +08:00
Tw93
92ad46a396 fix(clean): harden project cache scans
Refs #541
2026-03-06 07:49:44 +08:00
Tw93
7e69a4eb71 clean orphaned Claude VM bundle
Fixes #537
2026-03-06 07:36:08 +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
ff69504f89 fix: harden CI test stability and status collector resilience 2026-03-04 16:49:20 +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
241e6a7a34 fix(purge): avoid counting failed dry-run removals 2026-03-01 20:35:49 +08:00
陳德生
05446e0847 Add dry-run support across destructive commands (#516)
* chore: update contributors [skip ci]

* Add dry-run support across destructive commands

Implement dry-run for uninstall, purge, installer, touchid, completion, and remove flows.\nGuard side effects in uninstall path (launchctl, defaults writes, kill/brew actions), update help/README, and add coverage in CLI/Bats tests.\n\nValidation: ./scripts/check.sh and ./scripts/test.sh (452 tests, 0 failures, 8 skipped).

* test(purge): keep dev-compatible purge coverage

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Tw93 <hitw93@gmail.com>
2026-03-01 20:03:22 +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
2f1985ad6f fix(clean): clear spinner remnants after stopping
Add extra terminal clear to prevent spinner character remnants
when cleaning project caches.
2026-02-28 14:57:45 +08:00
tw93
60624f951b fix(clean): respect whitelist in Homebrew dry-run mode
Show "skipped whitelist" instead of "would cleanup" when Homebrew cache
is whitelisted, making dry-run behavior consistent with actual execution.
2026-02-28 14:57:44 +08:00
tw93
75dc9f01dc refactor(clean): use assignment form for arithmetic increments in safe_clean 2026-02-28 11:22: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
646ff72a96 fix(clean): resolve unbound variable 'mount_points[@]' error in empty array case (#511) 2026-02-28 09:53:07 +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
a9433e4acd fix: preserve interrupt semantics and restore purge traps 2026-02-27 11:18:53 +08:00
tw93
0341ae6648 perf(clean): speed up memory report size pre-scan 2026-02-27 09:53:27 +08:00
tw93
6c0aa87389 fix(clean): guard DRY_RUN against unbound variable in system.sh
Change "$DRY_RUN" to "${DRY_RUN:-}" so the check is safe under
set -euo pipefail when DRY_RUN is not exported by the caller (e.g.
unit tests that source lib/clean/system.sh directly without going
through bin/clean.sh which initialises the variable).
2026-02-26 19:42:52 +08:00
tw93
d13c0927a6 feat(purge): add confirm dialog, two-pass column alignment, adaptive footer
- Add confirm_purge_cleanup() to show item count + size and require
  explicit Enter/y confirmation before any deletion
- Two-pass layout in clean_project_artifacts: pass 1 collects data,
  pre-scan finds max path and artifact widths, pass 2 formats with
  consistent column alignment across all rows
- Adaptive footer hints in select_purge_categories degrade gracefully
  on narrow terminals (full → reduced → minimal)
- Use printf '\033[J' to clear stale content when list height shrinks
- Guard empty-array expansions with ${arr[*]-} for set -u safety
- Add BATS tests for confirm_purge_cleanup (Enter confirm, ESC cancel)
2026-02-26 19:42:42 +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
29ec8f7d43 style(clean): unify DRY_RUN variable check style
Use consistent "$DRY_RUN" check instead of "${DRY_RUN:-false}"
to match project conventions.
2026-02-26 11:53:54 +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
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
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
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