# tazuna

TUI tool for managing multiple Claude Code sessions in parallel.

## Features

- Multiple PTY-based Claude Code sessions
- git worktree integration
- Claude Code hooks-based notifications
- Tab/popup UI with ratatui

## Installation

```bash
cargo install --path .
```

## Plugin Setup

tazuna uses a Claude Code plugin for hooks integration (notifications, permission requests, etc.).

### Installation

1. Add tazuna marketplace:
   ```bash
   claude plugin marketplace add oshiteku/tazuna
   ```

2. Install the plugin:
   ```bash
   claude plugin install tazuna
   ```

3. Verify:
   ```bash
   claude plugin marketplace list
   ```

## Usage

### Key Bindings

#### Global

| Key | Action |
|-----|--------|
| `Ctrl+w` | Terminate current session |
| `Ctrl+n` / `Ctrl+p` | Switch to next/previous session |
| `Ctrl+s` | Display workspace popup |
| `Ctrl+q` | Exit tazuna |

#### Workspace Popup

| Key | Action |
|-----|--------|
| `Ctrl+n` | Next item (cross-section wrap) |
| `Ctrl+p` | Previous item (cross-section wrap) |
| `Ctrl+m` | Confirm selection (Enter) |
| `Ctrl+g` | Cancel (close popup) |
| `Tab` / `Shift+Tab` | Switch section |
| `↑` / `↓` | Navigate within section |
| `d` | Delete worktree (Worktrees section) |
| `p` | Pull worktree (Worktrees section) |

### Text Selection

Mouse events are captured by tazuna for tab switching and scrolling.
To select and copy text, use **Shift+drag** (standard terminal emulator behavior).

## Configuration

Config file location: `~/.config/tazuna/config.toml`

### Example

```toml
[session]
max_sessions = 10

[worktree]
auto_cleanup = false
branch_prefix = "tazuna/"
base_path = "~/.tazuna/worktrees"
pull_strategy = "merge"  # or "rebase"

[notification]
terminal_bell = true

[notification.webhook]
enabled = false
url = ""

[log]
directory = "~/.local/share/tazuna/logs"

[claude]
default_args = []
```

### Options

| Section | Key | Default | Description |
|---------|-----|---------|-------------|
| session | max_sessions | 10 | Maximum concurrent sessions |
| worktree | auto_cleanup | false | Auto-delete worktree on session end |
| worktree | branch_prefix | "tazuna/" | Prefix for auto-generated branches |
| worktree | base_path | ~/.tazuna/worktrees | Worktree storage location |
| worktree | pull_strategy | "merge" | Pull strategy: "merge" or "rebase" |
| notification | terminal_bell | true | Enable terminal bell |
| notification.webhook | enabled | false | Enable webhook notifications |
| notification.webhook | url | "" | Webhook URL (Slack, Discord, etc.) |
| log | directory | ~/.local/share/tazuna/logs | Session log directory |
| claude | default_args | [] | Default Claude Code CLI arguments |

## Development

### Pre-commit Hooks

```bash
# prek install
cargo install --locked prek
# or: brew install prek

# enable hooks
prek install
```

Hooks: `cargo fmt`, `cargo clippy`, `typos`, `trailing-whitespace`, etc.

## License

MIT OR Apache-2.0
