Start sudo keepalive after authorization and clean it up on all failure/success paths to avoid repeated password prompts and overlapping update UI output. Closes#514.
Cache Homebrew formula output and use shell string matching to prevent pipefail SIGPIPE races that could misreport script installs as manual. Closes#513.
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
Remove unused functions from base.sh and ui.sh:
- base.sh: is_interactive, spinner stack management, get_terminal_info, validate_terminal_environment
- ui.sh: with_spinner
Net reduction: ~166 lines of dead code
- Switch bytes_to_human (shell) and humanizeBytes (Go) from Base-2
(1024) to Base-10 (1000) to match Apple's storage calculation
standard since Snow Leopard
- Add proper decimal rounding instead of truncation
- Use mdls kMDItemLogicalSize for .app bundles to avoid APFS clone
file undercounting by du
Fixes#511
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
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
This commit addresses the issue #506 where mole would exit prematurely
during application support scanning.
Changes:
1. Remove 4 redundant pipefail disable/restore blocks:
- safe_find_delete() in lib/core/file_ops.sh
- safe_sudo_find_delete() in lib/core/file_ops.sh
- fix_broken_preferences() in lib/optimize/maintenance.sh
- opt_saved_state_cleanup() in lib/optimize/tasks.sh
These were unnecessary because process substitution (< <(cmd)) is not
affected by pipefail - only real pipelines (cmd1 | cmd2) are.
2. Fix real bug in fix_broken_preferences():
- Add || true to ((broken_count++)) on lines 35 and 55
- This prevents set -e from exiting when broken_count starts at 0
Fixes#506
Replace hardcoded 70-char string with a dynamically generated divider
capped at terminal width (max 70) so the separator fits narrow terminals
instead of overflowing them.
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).
Replace blocking read with a timed read (default 3 s) so the prompt
exits automatically instead of waiting forever. Timeout is configurable
via MOLE_UNINSTALL_RETURN_PROMPT_TIMEOUT_SEC. Use a read_ok flag to
distinguish timeout (exit) from Enter (return to list).
- 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)
- Capture terminal width in parent before forking; avoids unreliable
tput calls inside the background subshell
- Write spinner output directly to /dev/tty to prevent stdout state
contention between parent and background processes
- Use \033[2K (erase entire line) instead of \033[K (erase to EOL)
- Add handle_interrupt() so Ctrl-C cleanly stops spinner, restores
cursor, and exits 130
- cleanup_monitor now writes \r\033[2K\n so subsequent output starts
on a clean line rather than on the cleared spinner line