Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 21 additions & 25 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,54 +5,50 @@ on:
branches:
- main

permissions: {}

jobs:
changed-files:
common-checks:
name: Common Checks
permissions:
contents: read
pull-requests: read
uses: nownabe/workflows/.github/workflows/pr.yaml@95b6433077e235025af5d3d012aebf75e00354a4 # v1.0.2

filter:
name: Filter
runs-on: ubuntu-latest
timeout-minutes: 5
permissions:
contents: read
pull-requests: read
outputs:
github-actions: ${{ steps.changed-files.outputs.github-actions_any_changed }}
rust: ${{ steps.changed-files.outputs.rust_any_changed }}
changes: ${{ toJSON(steps.filter.outputs) }}
steps:
- name: Checkout
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
- id: filter
uses: dorny/paths-filter@fbd0ab8f3e69293af611ebaee6363fc25e6d187d # v3.0.2
with:
persist-credentials: false

- name: Detect changed files
id: changed-files
uses: tj-actions/changed-files@7dee1b0c1557f278e5c7dc244927139d78c0e22a # v47.0.4
with:
files_yaml: |
github-actions:
- .github/**
filters: |
rust:
- '**/*.rs'
- Cargo.toml
- Cargo.lock
- rust-toolchain.toml

check-github-actions:
needs: changed-files
if: needs.changed-files.outputs.github-actions == 'true'
uses: ./.github/workflows/reusable-check-github-actions.yaml
permissions:
contents: read

check-rust:
needs: changed-files
if: needs.changed-files.outputs.rust == 'true'
needs: filter
if: ${{ fromJSON(needs.filter.outputs.changes).rust == 'true' }}
uses: ./.github/workflows/reusable-check-rust.yaml
permissions:
contents: read

status:
result:
name: Pull Request Checks
runs-on: ubuntu-latest
timeout-minutes: 5
if: always()
needs:
- check-github-actions
- common-checks
- check-rust
permissions: {}
steps:
Expand Down
57 changes: 0 additions & 57 deletions .github/workflows/reusable-check-github-actions.yaml

This file was deleted.

48 changes: 25 additions & 23 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ src/

Single binary, three subcommands:

| Subcommand | Purpose |
|---|---|
| (none) | TUI mode — renders tree view, polls tmux, listens on IPC |
| `hook` | Hook mode — called by Claude Code hooks, sends AgentState via IPC |
| `notify` | Notify mode — called by tmux hooks, sends refresh signal via IPC |
| Subcommand | Purpose |
| ---------- | ----------------------------------------------------------------- |
| (none) | TUI mode — renders tree view, polls tmux, listens on IPC |
| `hook` | Hook mode — called by Claude Code hooks, sends AgentState via IPC |
| `notify` | Notify mode — called by tmux hooks, sends refresh signal via IPC |

### Data Flow

Expand All @@ -62,6 +62,7 @@ Anthropic API ──(usage, polling ~600s)─────←── chikuwa TUI
Unix domain socket at `$XDG_RUNTIME_DIR/chikuwa.sock` (fallback: `/tmp/chikuwa.sock`).

Two message types:

- AgentState JSON (one line) → `AppEvent::AgentStateUpdate`
- `"notify"` string → `AppEvent::TmuxChanged`

Expand All @@ -77,6 +78,7 @@ The TUI spawns four concurrent tasks:
### Agent State Merging

When an `AgentStateUpdate` arrives:

- `SessionEnd` → remove agent from state map
- Otherwise → merge with existing state:
- Preserve `session_id` if incoming is `None`
Expand All @@ -86,27 +88,27 @@ When an `AgentStateUpdate` arrives:

### Hook Event Mapping

| Claude Code Event | AgentStatus |
|---|---|
| `SessionStart` | `Started` |
| `UserPromptSubmit`, `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `SubagentStart`, `SubagentStop` | `Running` |
| `Stop` | `Waiting` |
| `PermissionRequest` | `Permission` |
| `Notification` (containing "permission_prompt") | `Permission` |
| `SessionEnd` | `Ended` |
| Claude Code Event | AgentStatus |
| ------------------------------------------------------------------------------------------------------ | ------------ |
| `SessionStart` | `Started` |
| `UserPromptSubmit`, `PreToolUse`, `PostToolUse`, `PostToolUseFailure`, `SubagentStart`, `SubagentStop` | `Running` |
| `Stop` | `Waiting` |
| `PermissionRequest` | `Permission` |
| `Notification` (containing "permission_prompt") | `Permission` |
| `SessionEnd` | `Ended` |

### Tool Detail Extraction (`hook.rs`)

| Tool | Detail Source |
|---|---|
| `Bash` | `tool_input.command` |
| `Read` | `tool_input.file_path` (+ `:offset` if present) |
| `Write`, `Edit` | `tool_input.file_path` |
| `NotebookEdit` | `tool_input.notebook_path` |
| `Grep`, `Glob` | `tool_input.pattern` |
| `WebFetch` | `tool_input.url` |
| `WebSearch` | `tool_input.query` |
| `Task` | `tool_input.description` |
| Tool | Detail Source |
| --------------- | ----------------------------------------------- |
| `Bash` | `tool_input.command` |
| `Read` | `tool_input.file_path` (+ `:offset` if present) |
| `Write`, `Edit` | `tool_input.file_path` |
| `NotebookEdit` | `tool_input.notebook_path` |
| `Grep`, `Glob` | `tool_input.pattern` |
| `WebFetch` | `tool_input.url` |
| `WebSearch` | `tool_input.query` |
| `Task` | `tool_input.description` |

## Key Types

Expand Down
50 changes: 25 additions & 25 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ A sidebar TUI for monitoring multiple AI agents (Claude Code, etc.) running in t

A single binary that operates in three modes:

| Mode | Command | Description |
|---|---|---|
| TUI | `chikuwa` | Displays tmux sessions/windows/panes as a tree with real-time agent status |
| Hook | `chikuwa hook` | Called from Claude Code hooks; reads event JSON from stdin to update agent status via IPC |
| Notify | `chikuwa notify` | Called from tmux hooks; signals the TUI to refresh immediately |
| Mode | Command | Description |
| ------ | ---------------- | ----------------------------------------------------------------------------------------- |
| TUI | `chikuwa` | Displays tmux sessions/windows/panes as a tree with real-time agent status |
| Hook | `chikuwa hook` | Called from Claude Code hooks; reads event JSON from stdin to update agent status via IPC |
| Notify | `chikuwa notify` | Called from tmux hooks; signals the TUI to refresh immediately |

```
Claude Code ──(hooks)──→ chikuwa hook ──(IPC)──→ chikuwa (TUI)
Expand Down Expand Up @@ -91,20 +91,20 @@ chikuwa

#### Options

| Flag | Description |
|---|---|
| Flag | Description |
| ---------------- | ------------------------------------------------------------------------------------- |
| `--store-events` | Log all received hook events to `$XDG_RUNTIME_DIR/chikuwa/events.jsonl` for debugging |

### Key Bindings

| Key | Action |
|---|---|
| `j` / `↓` | Move down |
| `k` / `↑` | Move up |
| Key | Action |
| ----------------- | ------------------------------------- |
| `j` / `↓` | Move down |
| `k` / `↑` | Move up |
| `Enter` / `Space` | Toggle session collapse / switch tmux |
| `g` | Jump to top |
| `G` | Jump to bottom |
| `q` / `Ctrl+C` | Quit |
| `g` | Jump to top |
| `G` | Jump to bottom |
| `q` / `Ctrl+C` | Quit |

Mouse clicks on tree items are also supported.

Expand All @@ -115,17 +115,17 @@ Add the following to `~/.claude/settings.json`:
```json
{
"hooks": {
"SessionStart": [{"hooks": [{"type": "command", "command": "chikuwa hook"}]}],
"UserPromptSubmit": [{"hooks": [{"type": "command", "command": "chikuwa hook"}]}],
"PreToolUse": [{"hooks": [{"type": "command", "command": "chikuwa hook"}]}],
"PostToolUse": [{"hooks": [{"type": "command", "command": "chikuwa hook"}]}],
"PostToolUseFailure": [{"hooks": [{"type": "command", "command": "chikuwa hook"}]}],
"PermissionRequest": [{"hooks": [{"type": "command", "command": "chikuwa hook"}]}],
"Notification": [{"hooks": [{"type": "command", "command": "chikuwa hook"}]}],
"Stop": [{"hooks": [{"type": "command", "command": "chikuwa hook"}]}],
"SubagentStart": [{"hooks": [{"type": "command", "command": "chikuwa hook"}]}],
"SubagentStop": [{"hooks": [{"type": "command", "command": "chikuwa hook"}]}],
"SessionEnd": [{"hooks": [{"type": "command", "command": "chikuwa hook"}]}]
"SessionStart": [{ "hooks": [{ "type": "command", "command": "chikuwa hook" }] }],
"UserPromptSubmit": [{ "hooks": [{ "type": "command", "command": "chikuwa hook" }] }],
"PreToolUse": [{ "hooks": [{ "type": "command", "command": "chikuwa hook" }] }],
"PostToolUse": [{ "hooks": [{ "type": "command", "command": "chikuwa hook" }] }],
"PostToolUseFailure": [{ "hooks": [{ "type": "command", "command": "chikuwa hook" }] }],
"PermissionRequest": [{ "hooks": [{ "type": "command", "command": "chikuwa hook" }] }],
"Notification": [{ "hooks": [{ "type": "command", "command": "chikuwa hook" }] }],
"Stop": [{ "hooks": [{ "type": "command", "command": "chikuwa hook" }] }],
"SubagentStart": [{ "hooks": [{ "type": "command", "command": "chikuwa hook" }] }],
"SubagentStop": [{ "hooks": [{ "type": "command", "command": "chikuwa hook" }] }],
"SessionEnd": [{ "hooks": [{ "type": "command", "command": "chikuwa hook" }] }]
}
}
```
Expand Down
18 changes: 9 additions & 9 deletions release-plz.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ git_release_draft = true

[changelog]
commit_parsers = [
{ message = "^feat", group = "Added" },
{ message = "^fix", group = "Fixed" },
{ message = "^perf", group = "Performance" },
{ message = "^refactor", skip = true },
{ message = "^doc", skip = true },
{ message = "^style", skip = true },
{ message = "^test", skip = true },
{ message = "^chore", skip = true },
{ message = "^ci", skip = true },
{ message = "^feat", group = "Added" },
{ message = "^fix", group = "Fixed" },
{ message = "^perf", group = "Performance" },
{ message = "^refactor", skip = true },
{ message = "^doc", skip = true },
{ message = "^style", skip = true },
{ message = "^test", skip = true },
{ message = "^chore", skip = true },
{ message = "^ci", skip = true },
]
Loading