- 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
- 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
- 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
- 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)
- 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)
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.
Performance improvements:
- Merge 3 separate find operations into 1 for /Library/Caches
- Combine *.cache, *.tmp, *.log patterns in single scan
- Reduces filesystem traversal overhead
- Merge 2 find operations into 1 for /private/var/log
- Combine *.log and *.gz patterns
- Optimize diagnostics cleanup with single combined scan
- Merge Special, Persist, and tracev3 patterns
- Reduces redundant directory traversal
- Use find -delete for batch removal of memory exception reports
- More efficient than iterative removal for large file counts
- Add summary logging to operations.log
UI improvements:
- Add granular spinner messages for each cleanup stage
- Separate diagnostic logs and power logs output for clarity
- Add progress feedback during Time Machine status check
Tests:
- Update sudo mock functions to support new combined find patterns
- Verify find -delete usage for memory exception cleanup
- Update assertions to match optimized implementation
New features:
- Add orphaned LaunchAgent/LaunchDaemon detection with 5-layer verification
- Layer 1: Check if program path exists
- Layer 2: Verify AssociatedBundleIdentifiers via mdfind
- Layer 3: Check Application Support directory activity (7 days)
- Layer 4: Fuzzy match app name in /Applications
- Layer 5: Special handling for PrivilegedHelperTools
- Only process user-level ~/Library/LaunchAgents (safer than system-level)
- Unload agent before removal using launchctl
Bug fixes:
- Handle paths with spaces correctly in orphaned_app_data cleanup
- Add nullglob state management to prevent word splitting
- Use IFS=$'\n' for proper array iteration
- Only count successful deletions (check safe_clean return value)
Tests:
- Add 4 new tests for is_launch_item_orphaned edge cases
- Add tests for space handling and deletion count accuracy
Uninstalling mole with Zap will automatically remove also the directories that brew creates for it. -> More complete uninstallation
Also updated the test about uninstalling
Replace glob pattern with find command to properly clean dotfiles
in Trash when osascript fallback is used. The old pattern
~/.Trash/* does not match files starting with "." in bash.
This fix ensures that hidden files like .DS_Store, .hidden_file,
etc. are properly removed when cleaning the Trash.
- Change Rosetta 2 status from warning to info
- Remove auto-fix suggestion for missing Rosetta 2
- Update tests to reflect new behavior (3 -> 2 expected fixes)
- Replace parentheses with commas for supplementary info
- Use commas instead of em-dashes for separators
- Update bullet points from - to * in some contexts
- Improve version extraction regex with fallback logic
- Refactor JetBrains Toolbox cleanup with _restore_whitelist helper
- Add MOLE_EDGE_APP_PATHS env var for test isolation
- Fix Edge old versions tests to avoid scanning system Edge installation
- Test install.sh success message with version
- Test fallback version when no success message
- Test empty output handling
- Test avoiding wrong parentheses content extraction
- Export MOLE_DRY_RUN env var for subprocess visibility
- Add || true to grep commands to prevent pipeline failures
- Add dry-run test for clean_orphaned_system_services
- Simplify clean_local_snapshots tests
- Replace 48-line custom function with one-line safe_clean call
- Remove unnecessary interactive confirmation (consistent with other browser caches)
- Simplify tests to verify Puppeteer cache is in clean_browsers output
- Net: -93 lines of code for same functionality
The clean_empty_library_items function intentionally skips empty file cleanup
to avoid removing app sentinel files (as noted in lib/clean/user.sh:77).
Updated the test to only verify empty folder cleanup, matching current behavior.