Metadata-Version: 2.3
Name: claude-tts-hook
Version: 0.3.0
Summary: Claude Code hook that reads assistant messages aloud via a local TTS engine
Author: tanaka hideyuki
Author-email: tanaka hideyuki <thdyk.4.11@gmail.com>
License: MIT License
         
         Copyright (c) 2026 Tanaka Hideyuki
         
         Permission is hereby granted, free of charge, to any person obtaining a copy
         of this software and associated documentation files (the "Software"), to deal
         in the Software without restriction, including without limitation the rights
         to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         copies of the Software, and to permit persons to whom the Software is
         furnished to do so, subject to the following conditions:
         
         The above copyright notice and this permission notice shall be included in all
         copies or substantial portions of the Software.
         
         THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         SOFTWARE.
Requires-Dist: requests>=2.31
Requires-Dist: fugashi[unidic-lite]
Requires-Dist: e2k>=0.1
Requires-Python: >=3.12
Description-Content-Type: text/markdown

# claude-tts-hook

[Claude Code](https://claude.ai/code) hook that reads assistant messages aloud via a local TTS engine.

## Features

- Plugs into Claude Code's `MessageDisplay` hook — no polling, no transcript parsing needed
- Splits long responses into chunks and speaks them sequentially
- Cleans Markdown before speaking (strips code blocks, headings, links, etc.)
- Converts English words / camelCase identifiers to katakana for natural Japanese TTS
- Multi-backend: drop in your preferred local TTS engine

## Supported backends

| Backend | OS | Free | Notes |
|---|---|---|---|
| [Voisona Talk](https://voisona.com/talk/) | Win / Mac | ✓ | REST API on `localhost:32766` |
| [VoiceVox](https://voicevox.hiroshiba.jp/) | Win / Mac / Linux | ✓ | REST API on `localhost:50021` |

## Installation

```sh
uv tool install claude-tts-hook
```

Or run without installing:

```sh
uvx claude-tts-hook --help
```

## Setup

### 1. Create config

```sh
uvx claude-tts-hook init
```

This creates `~/.config/claude-tts-hook/config.json` (Windows: `%APPDATA%/claude-tts-hook/config.json`). Edit it to set your backend and credentials:

```json
{
  "backend": "voisona",
  "max_text_len": 500,
  "debug": false,
  "voisona": {
    "language": "ja_JP",
    "voice_name": null,
    "voice_version": null,
    "auth": "username:password",
    "poll_interval": 0.5,
    "poll_timeout": 60.0
  },
  "voicevox": {
    "speaker_id": null
  }
}
```

### 2. Pick a voice

```sh
uvx claude-tts-hook pick
```

### 3. Register as a Claude Code hook

```sh
uvx claude-tts-hook register
```

Or add manually to `~/.claude/settings.json`:

```json
{
  "hooks": {
    "MessageDisplay": [
      {
        "matcher": "",
        "hooks": [{ "type": "command", "command": "uvx claude-tts-hook" }]
      }
    ]
  }
}
```

## CLI

```sh
claude-tts-hook init [--force]          # create default config
claude-tts-hook show                    # show config (password masked)
claude-tts-hook set KEY VALUE           # update a config value
claude-tts-hook voices                  # list voices from the API
claude-tts-hook pick                    # interactive voice picker
claude-tts-hook register [--command …] # register as Claude Code hook
claude-tts-hook unregister [--command …] # remove hook registration
```

### Setting config values

Top-level keys (`backend`, `max_text_len`, `debug`) are set directly:

```sh
claude-tts-hook set backend voicevox
claude-tts-hook set debug true
```

Backend-specific keys use `backend.field` notation:

```sh
claude-tts-hook set voisona.auth "user:pass"
claude-tts-hook set voicevox.speaker_id 1
```

## License

MIT
