diff --git a/.claude-plugin/marketplace.json b/.claude-plugin/marketplace.json index fa353178..f0445058 100644 --- a/.claude-plugin/marketplace.json +++ b/.claude-plugin/marketplace.json @@ -80,6 +80,19 @@ ], "version": "5.2.0" }, + { + "name": "notify-user-input", + "description": "macOS desktop notifications when Claude Code asks for user input", + "source": "./plugins/notify-user-input", + "category": "productivity", + "tags": [ + "notification", + "macos", + "desktop", + "hooks" + ], + "version": "5.2.0" + }, { "name": "ralph-loop", "description": "Continuous self-referential AI loops for interactive iterative development, implementing the Ralph Wiggum technique", diff --git a/plugins/notify-user-input/.claude-plugin/plugin.json b/plugins/notify-user-input/.claude-plugin/plugin.json new file mode 100644 index 00000000..699c7cb3 --- /dev/null +++ b/plugins/notify-user-input/.claude-plugin/plugin.json @@ -0,0 +1,9 @@ +{ + "name": "notify-user-input", + "version": "5.2.0", + "description": "macOS notification when Claude waits for user input", + "author": { + "name": "jito", + "email": "git@baleen.me" + } +} diff --git a/plugins/notify-user-input/README.md b/plugins/notify-user-input/README.md new file mode 100644 index 00000000..73ab9716 --- /dev/null +++ b/plugins/notify-user-input/README.md @@ -0,0 +1,11 @@ +# notify-user-input + +macOS notifications when Claude Code asks for user input. + +## Installation + +Part of baleen-plugins marketplace. + +## Testing + +Ask Claude something that requires confirmation - notification should appear. diff --git a/plugins/notify-user-input/hooks/ask-user-question.sh b/plugins/notify-user-input/hooks/ask-user-question.sh new file mode 100755 index 00000000..c0bde4cc --- /dev/null +++ b/plugins/notify-user-input/hooks/ask-user-question.sh @@ -0,0 +1,28 @@ +#!/bin/bash +set -euo pipefail + +INPUT=$(cat) +TOOL_NAME=$(echo "$INPUT" | jq -r '.tool_name // empty') + +# Only process AskUserQuestion +if [[ "$TOOL_NAME" != "AskUserQuestion" ]]; then + exit 0 +fi + +# Extract question text +QUESTION_TEXT=$(echo "$INPUT" | jq -r '.questions[0].text // empty') + +if [[ -z "$QUESTION_TEXT" ]]; then + exit 0 +fi + +# Truncate if too long +MAX_LENGTH=100 +if [[ ${#QUESTION_TEXT} -gt $MAX_LENGTH ]]; then + QUESTION_TEXT="${QUESTION_TEXT:0:$MAX_LENGTH}..." +fi + +# Send macOS notification +osascript -e "display notification \"$QUESTION_TEXT\" with title \"Claude Code\" sound name \"Glass\"" 2>/dev/null || true + +exit 0 diff --git a/plugins/notify-user-input/hooks/hooks.json b/plugins/notify-user-input/hooks/hooks.json new file mode 100644 index 00000000..36a9c56d --- /dev/null +++ b/plugins/notify-user-input/hooks/hooks.json @@ -0,0 +1,17 @@ +{ + "$schema": "../../../schemas/hooks-schema.json", + "description": "Notify when Claude asks for user input", + "hooks": { + "PreToolUse": [ + { + "matcher": "AskUserQuestion", + "hooks": [ + { + "type": "command", + "command": "bash ${CLAUDE_PLUGIN_ROOT}/hooks/ask-user-question.sh" + } + ] + } + ] + } +}