Files
innervoice/scripts/install-hook.sh
RichardDillman 0584ac6c5f feat: make /afk command and permission hook globally available
Changed from per-project to global installation by default, making
InnerVoice features available across all projects automatically.

Global Installation:
- /afk slash command now in ~/.claude/commands/afk.md
- Permission hook now in ~/.claude/hooks/PermissionRequest.sh
- Both work in ALL projects without per-project setup

Install Script Updates:
- Added --global flag for global installation (recommended)
- Still supports per-project installation if needed
- Clear scope indication in output messages
- Updated uninstall instructions for both scopes

Documentation:
- Updated README to recommend global installation
- Added examples for both global and per-project setup
- Clearer uninstall instructions for each scope

Benefits:
- Users install once, works everywhere
- No per-project configuration needed
- Easier maintenance and updates
- Consistent behavior across all projects

Breaking Changes: None
- Per-project installation still supported
- Existing installations continue to work

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-23 15:13:01 -05:00

49 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Install the InnerVoice permission notification hook globally or per-project
set -e
HOOK_NAME="PermissionRequest.sh"
INNERVOICE_DIR="$(cd "$(dirname "$0")/.." && pwd)"
SOURCE_HOOK="$INNERVOICE_DIR/hooks/$HOOK_NAME"
# 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 ""
# Validate source hook exists
if [ ! -f "$SOURCE_HOOK" ]; then
echo "❌ Error: Source hook not found at $SOURCE_HOOK"
exit 1
fi
# Create target directory if needed
mkdir -p "$TARGET_HOOK_DIR"
# Copy the hook
cp "$SOURCE_HOOK" "$TARGET_HOOK_DIR/$HOOK_NAME"
chmod +x "$TARGET_HOOK_DIR/$HOOK_NAME"
echo "✅ Hook installed successfully!"
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: $UNINSTALL_CMD"