diff --git a/README.md b/README.md index fb558a6..7bc916b 100644 --- a/README.md +++ b/README.md @@ -228,10 +228,14 @@ The toggle state is preserved while the bridge is running, and you'll get a Tele By default, AFK mode only sends notifications when Claude explicitly uses notification tools. If you want to receive Telegram alerts when **permission prompts** appear (so you know Claude is waiting for approval), install the permission hook: +**Recommended: Install Globally (works in all projects)** ```bash -# From the innervoice directory cd /path/to/innervoice +./scripts/install-hook.sh --global +``` +**Or install per-project:** +```bash # Install in a specific project ./scripts/install-hook.sh /path/to/your/project @@ -246,7 +250,9 @@ This will send you a Telegram message like: > **Action:** Check scraped sets files > Check your terminal to approve or deny. -**To uninstall:** Simply delete `.claude/hooks/PermissionRequest.sh` from your project. +**To uninstall:** +- Global: `rm ~/.claude/hooks/PermissionRequest.sh` +- Per-project: `rm .claude/hooks/PermissionRequest.sh` ### 8. Verify Global Setup diff --git a/scripts/install-hook.sh b/scripts/install-hook.sh index f436b86..4cf2adf 100755 --- a/scripts/install-hook.sh +++ b/scripts/install-hook.sh @@ -1,5 +1,5 @@ #!/bin/bash -# Install the InnerVoice permission notification hook in a project +# Install the InnerVoice permission notification hook globally or per-project set -e @@ -7,12 +7,22 @@ HOOK_NAME="PermissionRequest.sh" INNERVOICE_DIR="$(cd "$(dirname "$0")/.." && pwd)" SOURCE_HOOK="$INNERVOICE_DIR/hooks/$HOOK_NAME" -# Get target project directory (default to current directory) -TARGET_DIR="${1:-.}" -TARGET_HOOK_DIR="$TARGET_DIR/.claude/hooks" +# Check for --global flag +if [ "$1" = "--global" ] || [ "$1" = "-g" ]; then + TARGET_HOOK_DIR="$HOME/.claude/hooks" + SCOPE="globally (all projects)" + UNINSTALL_CMD="rm ~/.claude/hooks/$HOOK_NAME" +else + # Get target project directory (default to current directory) + TARGET_DIR="${1:-.}" + TARGET_HOOK_DIR="$TARGET_DIR/.claude/hooks" + SCOPE="in project: $TARGET_DIR" + UNINSTALL_CMD="rm $TARGET_HOOK_DIR/$HOOK_NAME" +fi echo "📦 Installing InnerVoice Permission Notification Hook" echo "" +echo "Scope: $SCOPE" echo "Source: $SOURCE_HOOK" echo "Target: $TARGET_HOOK_DIR/$HOOK_NAME" echo "" @@ -35,4 +45,4 @@ echo "" echo "🔔 Now when you're in AFK mode, you'll get Telegram notifications" echo " whenever Claude requests permission for a tool." echo "" -echo "To uninstall: rm $TARGET_HOOK_DIR/$HOOK_NAME" +echo "To uninstall: $UNINSTALL_CMD"