Add MOLE_TEST_MODE=1 checks to skip AppleScript osascript calls
and sudo operations that trigger system permission dialogs during tests:
- lib/check/all.sh: Skip login items listing
- lib/clean/apps.sh: Skip running app detection
- lib/clean/user.sh: Skip Finder trash operations and sudo test calls
- lib/core/log.sh: Skip sudo status check in debug log
- lib/uninstall/batch.sh: Skip login item removal
Also add MOLE_TEST_MODE=1 export to all test files that load
these modules to ensure consistent test isolation.
Allow users to press 'q' or 'Q' to quit the Touch ID setup menu,
in addition to ESC key. This fixes the "Invalid key" error when
users press Q as suggested by the prompt.
Fixes#575
Before deleting .download/.crdownload/.part files, check lsof to
detect open file handles. Files held by an active browser process
are skipped with a warning instead of being deleted.
Fixes a case where a 12GB IPSW being downloaded in Safari was
removed mid-download because the .download bundle matched the glob.
.githooks/pre-commit runs bash syntax check, shfmt format check,
shellcheck, and go vet against staged files on every commit.
Catches the same issues as check.yml before they reach GitHub.
Also update CONTRIBUTING.md setup instructions to include
`git config core.hooksPath .githooks`.
Add hint_is_system_binary() to short-circuit detection for plists that
use /bin/*, /usr/bin/*, /usr/libexec/* etc. as their program path.
These are custom scripts, not app-backed launch agents, so the stale
detection logic does not apply. Previously the function relied on the
absence of AssociatedBundleIdentifiers as an implicit skip, which could
fail on certain macOS plutil edge cases.
Also add teardown() in clean_hints.bats to explicitly remove the
LaunchAgents directory after each test, and add run_with_timeout mock
in the "skips custom shell wrappers" test to prevent mdfind from
influencing results. This eliminates the intermittent failure where
test 70 showed "Review:" in output without "Potential stale login item:".
Add ~/Library/HTTPStorages/<bundle-id>.binarycookies to targeted uninstall
cleanup. WKWebView creates both a directory and a .binarycookies file under
HTTPStorages; only the directory was previously covered. Affected apps include
cmux (com.cmuxterm.app) and Tuna (com.brnbw.Tuna).
Also add ~/Library/Preferences/<bundle-id> directory detection for apps like
VLC (org.videolan.vlc) that store preferences in a directory rather than a
.plist file.
filepath.Abs resolves ".." components, so the existing validatePath call
on the resolved path could never catch traversal attempts. Move validation
before Abs to reject raw input with "..", keeping the post-Abs check as
defense-in-depth.
- 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>
- Add TestValidatePath covering Chinese, emoji, and special characters
- Add TestValidatePathWithChineseAndSpecialChars for filesystem tests
- Fix validatePath to detect .. components without rejecting valid paths
Ensures paths with $, ;, :, emoji, Chinese chars are not rejected
while still blocking path traversal attempts.
The path column in 'mo purge' selection was capped at 60 characters
regardless of terminal width. On wide terminals (120+ cols) this caused
long project paths like ~/GitHub/Ulama/transformer-project to be
truncated unnecessarily to ~17 visible characters.
Remove the hard 60-char cap and let the available terminal space be the
only upper bound, which is already computed as:
available_for_path = terminal_width - fixed_overhead
Paths now use as much space as the terminal allows while still keeping
the size and artifact-type columns readable.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
All files in cmd/analyze/ are macOS-only but several were missing the
//go:build darwin constraint. On Linux (e.g. CodeQL CI), Go compiled
these files without the types defined in main.go (which had the tag),
causing undefined symbol errors for dirEntry, fileEntry, scanResult,
cacheEntry, historyEntry and model.
- Add //go:build darwin to heap.go, cache.go, scanner.go, cleanable.go,
delete.go, format.go, constants.go and all *_test.go files
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sequential du calls with 15s timeout each meant N artifacts × 15s of potential
wait when paths are on slow storage (network mounts, Syncthing, large dirs).
Now all du processes are launched concurrently; total time is bounded by the
single longest call (≤ 15s) rather than N × 15s.
fix(protection): protect CoreAudio paths in should_protect_path (issue #553)
Add com.apple.coreaudio*, com.apple.audio.*, and coreaudiod* to the protected
path patterns so deep-clean cannot touch audio subsystem caches, reducing risk
of audio output loss on Intel Macs running macOS Sequoia.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
* 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>