|
| 1 | +# Development Guide |
| 2 | + |
| 3 | +## Setup |
| 4 | + |
| 5 | +```bash |
| 6 | +# Clone the repo |
| 7 | +git clone https://github.com/aperepel/claude-mlx-tts.git |
| 8 | +cd claude-mlx-tts |
| 9 | +``` |
| 10 | + |
| 11 | +## Uninstall Marketplace Version (if installed) |
| 12 | + |
| 13 | +```bash |
| 14 | +claude plugin uninstall claude-mlx-tts |
| 15 | +``` |
| 16 | + |
| 17 | +## Run from Local Checkout |
| 18 | + |
| 19 | +Use `--plugin-dir` to load the plugin from your local directory: |
| 20 | + |
| 21 | +```bash |
| 22 | +claude --plugin-dir /path/to/claude-mlx-tts |
| 23 | +``` |
| 24 | + |
| 25 | +Or use a relative path from the repo: |
| 26 | + |
| 27 | +```bash |
| 28 | +cd claude-mlx-tts |
| 29 | +claude --plugin-dir . |
| 30 | +``` |
| 31 | + |
| 32 | +## Iteration Workflow |
| 33 | + |
| 34 | +1. **Edit code** - modify `scripts/tts-notify.py` |
| 35 | +2. **Restart Claude** - changes take effect on new session |
| 36 | +3. **Trigger TTS** - use `think about...` to test |
| 37 | + |
| 38 | +No build step needed. The hook runs your local script directly. |
| 39 | + |
| 40 | +## Test TTS Manually |
| 41 | + |
| 42 | +```bash |
| 43 | +# Test the detection logic |
| 44 | +echo '{"transcript_path": "/path/to/transcript.jsonl"}' | \ |
| 45 | + uv run --with mlx-audio --isolated python scripts/tts-notify.py |
| 46 | + |
| 47 | +# Test MLX audio directly |
| 48 | +uv run --with mlx-audio --isolated python -c " |
| 49 | +import mlx_audio |
| 50 | +print('MLX audio loaded OK') |
| 51 | +" |
| 52 | + |
| 53 | +# Test voice cloning |
| 54 | +uv run --with mlx-audio --isolated python -m mlx_audio.tts.generate \ |
| 55 | + --model mlx-community/chatterbox-turbo-fp16 \ |
| 56 | + --text 'Testing voice cloning' \ |
| 57 | + --ref_audio assets/default_voice.wav \ |
| 58 | + --ref_text '.' \ |
| 59 | + --speed 1.6 \ |
| 60 | + --play |
| 61 | +``` |
| 62 | + |
| 63 | +## Debug Hook Execution |
| 64 | + |
| 65 | +Add print statements to `scripts/tts-notify.py` - output goes to Claude's hook log. |
| 66 | + |
| 67 | +Or run the full pipeline manually: |
| 68 | + |
| 69 | +```bash |
| 70 | +# Find latest transcript |
| 71 | +TRANSCRIPT=$(ls -t ~/.claude/projects/*/agent-*.jsonl 2>/dev/null | head -1) |
| 72 | + |
| 73 | +# Run hook with it |
| 74 | +echo "{\"transcript_path\": \"$TRANSCRIPT\"}" | \ |
| 75 | + uv run --with mlx-audio --isolated python scripts/tts-notify.py |
| 76 | +``` |
| 77 | + |
| 78 | +## Project Structure |
| 79 | + |
| 80 | +``` |
| 81 | +claude-mlx-tts/ |
| 82 | +├── .claude-plugin/ |
| 83 | +│ ├── plugin.json # Plugin metadata |
| 84 | +│ └── marketplace.json # Marketplace listing |
| 85 | +├── hooks/ |
| 86 | +│ └── hooks.json # Hook registration (Stop hook) |
| 87 | +├── scripts/ |
| 88 | +│ └── tts-notify.py # Main TTS logic |
| 89 | +├── assets/ |
| 90 | +│ └── default_voice.wav # Bundled voice reference |
| 91 | +├── README.md # User docs |
| 92 | +├── RECORDING.md # Custom voice guide |
| 93 | +└── DEV.md # This file |
| 94 | +``` |
| 95 | + |
| 96 | +## Key Files |
| 97 | + |
| 98 | +- **hooks/hooks.json** - Registers the Stop hook, runs on every Claude response |
| 99 | +- **scripts/tts-notify.py** - All logic: threshold detection, summarization, TTS |
| 100 | +- **assets/default_voice.wav** - Bundled voice for zero-config experience |
| 101 | + |
| 102 | +## Configuration |
| 103 | + |
| 104 | +Edit `scripts/tts-notify.py`: |
| 105 | + |
| 106 | +```python |
| 107 | +MIN_DURATION_SECS = 15 # Lower for testing (e.g., 5) |
| 108 | +MIN_TOOL_CALLS = 2 # Lower for testing (e.g., 1) |
| 109 | +``` |
| 110 | + |
| 111 | +## Publishing Changes |
| 112 | + |
| 113 | +```bash |
| 114 | +git add -A |
| 115 | +git commit -m "Description of changes" |
| 116 | +git push |
| 117 | +``` |
| 118 | + |
| 119 | +Users update via: |
| 120 | +```bash |
| 121 | +cd ~/.claude/plugins/marketplaces/claude-mlx-tts |
| 122 | +git pull |
| 123 | +``` |
0 commit comments