diff --git a/lib/clean/hints.sh b/lib/clean/hints.sh index 0ac04dd..570b596 100644 --- a/lib/clean/hints.sh +++ b/lib/clean/hints.sh @@ -100,6 +100,19 @@ hint_is_app_scoped_launch_target() { return 1 } +# shellcheck disable=SC2329 +hint_is_system_binary() { + local program="$1" + + case "$program" in + /bin/* | /sbin/* | /usr/bin/* | /usr/sbin/* | /usr/libexec/*) + return 0 + ;; + esac + + return 1 +} + # shellcheck disable=SC2329 hint_launch_agent_bundle_exists() { local bundle_id="$1" @@ -433,6 +446,9 @@ show_user_launch_agent_hint_notice() { local associated="" program=$(hint_extract_launch_agent_program_path "$plist") + if [[ -n "$program" ]] && hint_is_system_binary "$program"; then + continue + fi if [[ -n "$program" ]] && hint_is_app_scoped_launch_target "$program" && [[ ! -e "$program" ]]; then reason="Missing app/helper target" target="${program/#$HOME/~}" diff --git a/tests/clean_hints.bats b/tests/clean_hints.bats index 928c76c..634ba39 100644 --- a/tests/clean_hints.bats +++ b/tests/clean_hints.bats @@ -23,6 +23,10 @@ setup() { mkdir -p "$HOME/.config/mole" } +teardown() { + rm -rf "$HOME/Library/LaunchAgents" +} + @test "probe_project_artifact_hints reuses purge targets and excludes noisy names" { local root="$HOME/hints-root" mkdir -p "$root/proj/node_modules" "$root/proj/vendor" "$root/proj/bin" @@ -153,6 +157,7 @@ set -euo pipefail source "$PROJECT_ROOT/lib/core/common.sh" source "$PROJECT_ROOT/lib/clean/hints.sh" note_activity() { :; } +run_with_timeout() { shift; "$@"; } show_user_launch_agent_hint_notice EOT5