|
1 | 1 | # approval-hub |
2 | 2 |
|
3 | | -複数の Claude Code セッションの PreToolUse 許可プロンプトを 1 画面 (TUI) |
4 | | -に集約する broker daemon と、それを呼ぶ Claude Code plugin の組合せ。 |
5 | | - |
6 | | -実装は本リポ内 `0-draft/approval-hub/` 配下。完成時に以下へ分割する。 |
7 | | - |
8 | | -- 本体 (daemon + TUI + matcher 学習 store): 別リポ `kanywst/approval-hub` |
9 | | -- plugin wrapper: `../../plugins/approval-hub/` |
10 | | - |
11 | | -## 何を解くか |
12 | | - |
13 | | -複数の Claude Code セッション (別ターミナル / tmux pane) を並走させると、 |
14 | | -各セッションが個別に yes/no プロンプトを出して把握しきれない。これを 1 |
15 | | -画面に集約し、`y` / `n` / `a` (allow always + matcher 学習) / `d` |
16 | | -(deny always) で捌けるようにする。 |
17 | | - |
18 | | -## 技術メモ |
19 | | - |
20 | | -- PreToolUse hook の `type: "http"` で、各セッションから |
21 | | - `http://127.0.0.1:<port>/decide` に POST |
22 | | -- payload の `session_id` + `cwd` でセッション識別 |
23 | | -- broker が落ちてたら `"defer"` を返して従来の手動 prompt に escalate |
24 | | - (壊れない) |
25 | | -- TUI: Bubble Tea (Go) |
26 | | -- セキュリティ: 127.0.0.1 限定 listen、Bearer token は env var |
27 | | - (`APPROVAL_HUB_TOKEN`) を `allowedEnvVars` 経由で hook に渡す |
28 | | - |
29 | | -### 返却 JSON 例 |
30 | | - |
31 | | -```json |
32 | | -{ |
33 | | - "hookSpecificOutput": { |
34 | | - "hookEventName": "PreToolUse", |
35 | | - "permissionDecision": "allow|deny|ask|defer", |
36 | | - "permissionDecisionReason": "..." |
37 | | - } |
38 | | -} |
| 3 | +Aggregate Claude Code permission prompts from multiple sessions into one |
| 4 | +terminal UI. Pair with the [approval-hub plugin] for Claude Code; the |
| 5 | +plugin embeds the broker's bearer token into `hooks/hooks.json` at |
| 6 | +install time. |
| 7 | + |
| 8 | +## Install |
| 9 | + |
| 10 | +```bash |
| 11 | +brew install kanywst/tap/approval-hub |
| 12 | +# or |
| 13 | +go install github.com/kanywst/approval-hub/cmd/approval-hub@latest |
| 14 | +``` |
| 15 | + |
| 16 | +## Quick start |
| 17 | + |
| 18 | +```bash |
| 19 | +# 1. start the broker daemon (foreground) |
| 20 | +approval-hub serve |
| 21 | + |
| 22 | +# 2. in another terminal, attach the TUI |
| 23 | +approval-hub attach |
| 24 | + |
| 25 | +# 3. in any Claude Code session, install the plugin |
| 26 | +/plugin install kanywst-plugins/approval-hub |
| 27 | +/approval-hub:install |
39 | 28 | ``` |
40 | 29 |
|
41 | | -## 進捗 |
| 30 | +The plugin's PreToolUse hook now routes every permission prompt to the |
| 31 | +broker. The TUI shows them in one place; press `y` / `n` / `a` |
| 32 | +(allow + learn) / `d` (deny + learn) to resolve. Learned matchers |
| 33 | +follow Claude Code's permission rule syntax (`Bash(npm test:*)`) so they |
| 34 | +can be exported to `settings.json` later. |
| 35 | + |
| 36 | +## Commands |
| 37 | + |
| 38 | +- `approval-hub serve` — run the broker daemon in the foreground |
| 39 | +- `approval-hub attach` — open the TUI client |
| 40 | +- `approval-hub list` — list learned matcher rules |
| 41 | +- `approval-hub revoke <id>` — delete a learned rule |
| 42 | +- `approval-hub rotate` — rotate the bearer token |
| 43 | +- `approval-hub doctor` — diagnose the install |
| 44 | + |
| 45 | +## Architecture |
| 46 | + |
| 47 | +See [ARCHITECTURE.md](ARCHITECTURE.md) for the broker / TUI / plugin |
| 48 | +data flow and design rationale. |
| 49 | + |
| 50 | +## Security |
| 51 | + |
| 52 | +See [SECURITY.md](SECURITY.md) for the threat model and mitigations. |
| 53 | + |
| 54 | +## License |
| 55 | + |
| 56 | +MIT. See [LICENSE](LICENSE). |
42 | 57 |
|
43 | | -着手前。詳細仕様調査 → 設計ドキュメント → 実装計画分解 → 実装の順で進める。 |
| 58 | +[approval-hub plugin]: https://github.com/kanywst/claude-code-plugins/tree/main/plugins/approval-hub |
0 commit comments