From b93a5b7b13a1f3d34b4d76b831a46845f7085d91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B0=95=ED=8F=89=EC=8B=9D?= Date: Sat, 3 Oct 2026 09:57:43 +0900 Subject: [PATCH] feat(discord): notify on task done/blocked/failed, not just pr-ready Captain asked for a Discord ping on every completed task plus failures and auth/approval blockers, not just the existing merge-ready notification. --- bin/fm-discord-notify-status.sh | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/bin/fm-discord-notify-status.sh b/bin/fm-discord-notify-status.sh index fa03b7fd52f..efcacb4cd75 100755 --- a/bin/fm-discord-notify-status.sh +++ b/bin/fm-discord-notify-status.sh @@ -8,6 +8,22 @@ FM_ROOT="${FM_ROOT_OVERRIDE:-$(cd "$SCRIPT_DIR/.." && pwd)}" FM_HOME="${FM_HOME:-${FM_ROOT_OVERRIDE:-$FM_ROOT}}" # shellcheck source=bin/fm-classify-lib.sh . "$SCRIPT_DIR/fm-classify-lib.sh" +# shellcheck source=bin/fm-discord-lib.sh +. "$SCRIPT_DIR/fm-discord-lib.sh" + +# Push a plain one-line message to this home's configured Discord channel, +# reusing fm-discord-notify.sh --report's send path. Silent no-op when Discord +# is not configured (fm-discord-notify.sh --report already fails loudly only +# on a missing token, so the token check here keeps this path a quiet no-op +# instead of an error on a Discord-less home). +fm_discord_send_plain_report() { + local message=$1 channel_id + fm_discord_load_config + [ -n "${FM_DISCORD_TOKEN:-}" ] || return 0 + channel_id=$(fm_discord_trim "${FM_DISCORD_CHANNELS%%,*}") + case "$channel_id" in ''|*[!0-9]*) return 0 ;; esac + "$SCRIPT_DIR/fm-discord-notify.sh" --report "$channel_id" "$message" +} [ "$#" -eq 2 ] || exit 2 task_id=$1 @@ -61,5 +77,20 @@ case "$verb:$key" in "$SCRIPT_DIR/fm-discord-notify.sh" pr-ready "$route_task_id" "$key" \ "$summary" "병합|열어 두기" "$task_id" ;; + done:*) + note=$(status_line_note "$line") + note=$(printf '%s' "$note" | tr '\n\r' ' ') + fm_discord_send_plain_report "작업 완료 [$task_id]: ${note:-완료}" + ;; + blocked:*) + note=$(status_line_note "$line") + note=$(printf '%s' "$note" | tr '\n\r' ' ') + fm_discord_send_plain_report "확인 필요(막힘) [$task_id]: ${note:-원인 미기재}" + ;; + failed:*) + note=$(status_line_note "$line") + note=$(printf '%s' "$note" | tr '\n\r' ' ') + fm_discord_send_plain_report "작업 실패 [$task_id]: ${note:-원인 미기재}" + ;; *) exit 0 ;; esac