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

1735 Commits

Author SHA1 Message Date
tw93
9fed092283 test: update bytes_to_human test inputs to use Base-10 values V1.28.1 2026-02-28 11:30:17 +08:00
tw93
9d89bab922 fix(uninstall): run LaunchServices refresh async so Press Enter prompt appears immediately 2026-02-28 11:28:03 +08:00
tw93
c1f25eb854 chore: Bump version to 1.28.1 2026-02-28 11:23:38 +08:00
tw93
297111aa1b chore: Delete test_rounding.sh script. 2026-02-28 11:23:17 +08:00
tw93
d2820eeb2e fix(uninstall): sync LaunchServices refresh for Spotlight update, remove background hint message, close #490 2026-02-28 11:22:41 +08:00
tw93
75dc9f01dc refactor(clean): use assignment form for arithmetic increments in safe_clean 2026-02-28 11:22:35 +08:00
Tw93
194e8ad29a chore: auto format code 2026-02-28 03:11:16 +00: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
1be71edc9d fix: use Base-10 sizes and mdls logical size to match macOS Finder
- 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
2026-02-28 10:02:34 +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
68c9e93219 docs: clarify update instructions for script vs homebrew testers 2026-02-28 09:49:21 +08:00
tw93
310abb2510 fix: clean aerial wallpaper videos directly without 30d limit and bypass app protection wildcard, close #508 2026-02-28 09:49:16 +08:00
tw93
e8e4f91bf0 fix: use xattr -c without -r flag for compatibility, close #509 2026-02-28 09:49:16 +08:00
github-actions[bot]
c7563351b9 chore: update contributors [skip ci] 2026-02-28 01:35:46 +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
c129591cf4 fix: remove redundant pipefail blocks and fix arithmetic bug
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
2026-02-27 23:44:10 +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
194fe871e5 chore(release): bump to 1.28.0 and refresh security audit V1.28.0 2026-02-27 10:07:49 +08:00
tw93
bbe3d3f284 fix(status): keep compact header single-line on tight widths 2026-02-27 10:07:44 +08:00
tw93
f4118dc883 fix(status): hide os and uptime in compact header 2026-02-27 10:02:47 +08:00
tw93
15f698c606 fix(status): hide swap size text when card is narrow 2026-02-27 10:02:06 +08:00
tw93
0341ae6648 perf(clean): speed up memory report size pre-scan 2026-02-27 09:53:27 +08:00
tw93
8436377922 test(status): add narrow-width rendering coverage 2026-02-27 09:53:24 +08:00
tw93
369d3b8840 fix(status): wrap header and card output on narrow terminals 2026-02-27 09:53:21 +08:00
tw93
9056ce5b38 fix(status): adapt single-column width calculation 2026-02-27 09:53:18 +08:00
tw93
2eb0f2b9b3 fix(log): generate summary divider width from terminal width
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.
2026-02-26 19:42:58 +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
7a6da7b419 fix(uninstall): auto-exit return-to-list prompt after configurable timeout
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).
2026-02-26 19:42:47 +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
837df390a5 fix(purge): rewrite spinner for /dev/tty reliability and fix cursor position
- 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
2026-02-26 19:42:34 +08:00
tw93
e17f35eb57 fix(uninstall): show next-step prompt without post-cleanup delay 2026-02-26 16:43:09 +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
3e47cdb39e refactor(uninstall): use shared get_lsregister_path from base.sh
Remove duplicate get_lsregister_path() implementation and use the
shared utility from base.sh instead.
2026-02-26 11:53:49 +08:00
tw93
d0e1a200d6 refactor(optimize): use shared get_lsregister_path from base.sh
Remove duplicate get_lsregister_path() implementation and use the
shared utility from base.sh instead.
2026-02-26 11:53:44 +08:00
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
github-actions[bot]
f394e7552c chore: update contributors [skip ci] 2026-02-26 03:48:32 +00:00
tw93
0b5ac830e5 test(clean): add test for Application Support size counting
- Add test for nested directory contents in dry-run size summary
2026-02-26 11:47:51 +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
44e1c61af3 Merge remote-tracking branch 'origin/main' into dev 2026-02-26 10:33:24 +08:00
tw93
5d69968ac0 perf: improve Application Support scan progress and size accounting 2026-02-26 10:33:19 +08:00