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

195 Commits

Author SHA1 Message Date
Tw93
ba01cb7f43 test: fix parallel test flakiness and bash 3.2 empty-array expansion
- Fix 'bats_opts[@]: unbound variable' under set -u + bash 3.2: empty
  arrays must use ${arr[@]+"${arr[@]}"} idiom, not "${arr[@]}"
- Split core_performance.bats out of the parallel batch; run it after
  all parallel workers finish so wall-clock timing assertions aren't
  skewed by CPU contention from concurrent bats processes
- Raise MOLE_PERF_GET_INVOKING_USER_LIMIT_MS default 500→2000ms and
  add MOLE_PERF_SECTION_LIMIT_MS (default 2000ms) to give sufficient
  headroom without masking real regressions

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
2026-03-14 10:16:42 +08:00
Tw93
7697acb711 test: speed up bats execution 2026-03-14 09:19:54 +08:00
Dylan Joss
7350547458 feat: add JSON output tests and README docs for analyze and status (#556)
* feat: add JSON output tests and README docs for analyze and status

Add 7 BATS tests covering `--json` output for `mo analyze` and `mo status`:
- schema structure
- field types
- pipe auto-detection.

Also document the `--json` flag in a new "Machine-Readable Output" README section, including the auto-detection behavior when piped.

* chore: use waitgroup go in status collector

---------

Co-authored-by: Tw93 <hitw93@gmail.com>
2026-03-13 11:40:41 +08:00
c5d923cd48 fix(appli-support):using whitelist in application_support clean (#562)
* fix(appli-support):using whitelist in application_support clean

* fix: harden clash verge app support protection

---------

Co-authored-by: Tw93 <hitw93@gmail.com>
2026-03-13 11:38:37 +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
af84d6f4be docs: strengthen public security signals 2026-03-10 15:31:07 +08:00
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
Tw93
42cc50d0fd test(purge): cover empty menu options path 2026-03-07 20:36:47 +08:00
Tw93
faf29b05f1 Fix perl timeout fallback selection 2026-03-07 20:36:34 +08:00
tw93
d189e1b84f test: fix update and cache cleanup cases 2026-03-07 20:03:11 +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
423c424f52 fix: gate main menu update action on update availability
Follow-up to #540.
2026-03-06 07:19:10 +08:00
tw93
f91975e5be Refine update/uninstall UX and stabilize brew flows 2026-03-05 17:46:05 +08:00
tw93
8e4b8a5e0d Improve update checks and cleanup UX, add timeout regressions 2026-03-05 12:00:07 +08:00
tw93
27a2cc5927 feat: show nightly channel in version output
Refs #517
2026-03-02 10:55:36 +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
022b42687e test: mock defaults in tmutil tests to bypass early check added in #510 2026-02-28 11:45:26 +08:00
tw93
7568bfc579 test: update bytes_to_human performance test inputs to use Base-10 values 2026-02-28 11:38:49 +08:00
tw93
9fed092283 test: update bytes_to_human test inputs to use Base-10 values 2026-02-28 11:30:17 +08:00
tw93
a9433e4acd fix: preserve interrupt semantics and restore purge traps 2026-02-27 11:18:53 +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
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
5241b59ea9 refactor: reuse sudo cache checks in clean dry-run tests 2026-02-25 10:32:12 +08:00
Luke Bullimore
ee1f2bd372 Fix --dry-run hiding system cleanup preview (#493)
The dry-run mode hardcoded SYSTEM_CLEAN=false, which meant
the entire system section was silently skipped during preview.
Users had no way to see what /Library/Caches, /private/var/log,
diagnostics, or other sudo-required paths would be cleaned.

Now dry-run checks for a cached sudo session (sudo -n) and
includes the system preview when available. When sudo isn't
cached, a hint tells the user how to get the full preview
without running the whole script as root.
2026-02-25 10:22:56 +08:00
tw93
7dac5dc4e2 refactor quick launcher metadata and docs 2026-02-24 14:24:46 +08:00
Sky Slinger
98089eeba8 Fix(raycast) : Made mole script commands discoverable (#489) 2026-02-24 14:17:51 +08:00
tw93
b864b61891 test(update): cover nightly update flows 2026-02-23 13:39:31 +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
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
82366d8c5a test(perf): reduce get_file_size loop count in benchmark
- lower iterations from 100 to 50 to reduce flaky timing noise
2026-02-21 23:36:15 +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
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
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
91d0e5353a fix: handle cd failure in diagnostic report standalone test 2026-02-15 08:18:02 +08:00
tw93
c896163d4b fix(clean): ensure flutter .dart_tool caches are discovered 2026-02-15 08:03:38 +08:00