Added comprehensive documentation for text-to-speech integration via Agent Vibes MCP server. New files (8): - examples/integrations/agent-vibes/README.md - Quick start guide - examples/integrations/agent-vibes/installation.md - 18-minute setup procedure - examples/integrations/agent-vibes/voice-catalog.md - 15 voices (4 FR models, 128 speakers) - examples/integrations/agent-vibes/troubleshooting.md - 7 common issues solved - guide/workflows/tts-setup.md - Step-by-step workflow - examples/hooks/bash/tts-selective.sh - Custom selective TTS hook - examples/claude-md/tts-enabled.md - Project template Documentation: - guide/ai-ecosystem.md (section 5.1) - TTS tools overview - guide/README.md - Added TTS workflow reference - machine-readable/reference.yaml - 8 TTS entries Version updates: - VERSION: 3.11.0 → 3.11.1 - README.md: Template count 71 → 83 - CHANGELOG.md: Added v3.11.1 entry - Synced version across all docs (cheatsheet, ultimate-guide, reference.yaml) Other: - .gitignore: Added audio file exclusions (*.wav, *.mp3, *.onnx) Context: Tested Agent Vibes v3.0.0 + Piper TTS with French voices. Works offline, no cloud dependency. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
80 lines
3 KiB
Bash
80 lines
3 KiB
Bash
#!/opt/homebrew/bin/bash
|
|
#
|
|
# File: tts-selective.sh
|
|
# Purpose: Selective TTS hook - Speak only specific types of messages
|
|
#
|
|
# Usage: Replace .claude/hooks/play-tts.sh with this script for selective TTS
|
|
#
|
|
# Example configurations:
|
|
# - Errors only: Speak only when "error" or "failed" detected
|
|
# - Success only: Speak only when "success" or "completed" detected
|
|
# - Important only: Speak only high-priority notifications
|
|
#
|
|
# Installation:
|
|
# 1. Copy this file to .claude/hooks/
|
|
# 2. chmod +x .claude/hooks/tts-selective.sh
|
|
# 3. Backup original: cp .claude/hooks/play-tts.sh .claude/hooks/play-tts.sh.backup
|
|
# 4. Replace: cp .claude/hooks/tts-selective.sh .claude/hooks/play-tts.sh
|
|
#
|
|
# Restore original:
|
|
# cp .claude/hooks/play-tts.sh.backup .claude/hooks/play-tts.sh
|
|
#
|
|
|
|
set -e
|
|
|
|
# Get script directory
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
|
|
# Read input from stdin
|
|
INPUT=$(cat)
|
|
BODY=$(echo "$INPUT" | jq -r '.notification.body // empty')
|
|
|
|
# Exit if no body
|
|
if [[ -z "$BODY" ]]; then
|
|
exit 0
|
|
fi
|
|
|
|
# ═══════════════════════════════════════════════════════════════
|
|
# CONFIGURATION: Customize trigger patterns below
|
|
# ═══════════════════════════════════════════════════════════════
|
|
|
|
# Option 1: Errors Only
|
|
# Speak only when message contains error keywords
|
|
TRIGGER_PATTERN="(error|Error|ERROR|failed|Failed|FAILED|exception|Exception)"
|
|
|
|
# Option 2: Success Only (uncomment to use)
|
|
# TRIGGER_PATTERN="(success|Success|completed|Completed|done|Done|✓|✅)"
|
|
|
|
# Option 3: Important Only (uncomment to use)
|
|
# TRIGGER_PATTERN="(CRITICAL|WARNING|ERROR|FAILURE|BREAKING)"
|
|
|
|
# Option 4: Code-related Only (uncomment to use)
|
|
# TRIGGER_PATTERN="(test|tests|build|compile|deploy|commit|push|merge)"
|
|
|
|
# Option 5: Custom Keywords (uncomment and edit)
|
|
# TRIGGER_PATTERN="(production|deploy|release|urgent|critical)"
|
|
|
|
# ═══════════════════════════════════════════════════════════════
|
|
# LOGIC: Check if message matches trigger pattern
|
|
# ═══════════════════════════════════════════════════════════════
|
|
|
|
if [[ "$BODY" =~ $TRIGGER_PATTERN ]]; then
|
|
# Message matches trigger - speak it
|
|
|
|
# Call original TTS hook (or Agent Vibes play-tts.sh)
|
|
if [[ -f "$SCRIPT_DIR/play-tts.sh.backup" ]]; then
|
|
# Use backup if exists
|
|
"$SCRIPT_DIR/play-tts.sh.backup" "$BODY"
|
|
elif [[ -f ~/.claude/hooks/play-tts.sh ]]; then
|
|
# Use global Agent Vibes hook
|
|
~/.claude/hooks/play-tts.sh "$BODY"
|
|
else
|
|
# Fallback: macOS Say
|
|
say "$BODY" &
|
|
fi
|
|
else
|
|
# Message doesn't match trigger - silent exit
|
|
exit 0
|
|
fi
|
|
|
|
exit 0
|