feat: add vmux setup and vmux hook for Claude Code integration
- vmux setup: idempotently adds hooks to ~/.claude/settings.json - vmux hook: receives Claude Code hook events via env vars and forwards to daemon - Daemon handles "hook" action on Unix socket (no HTTP server needed) - Hooks provide instant state detection (permission/question/idle)
This commit is contained in:
14
main.go
14
main.go
@@ -148,6 +148,18 @@ func main() {
|
||||
}
|
||||
runI3Bar(sockPath)
|
||||
|
||||
case "hook":
|
||||
event := parseHookEnv()
|
||||
if event.HookEventName == "" {
|
||||
os.Exit(0)
|
||||
}
|
||||
client := NewClient(sockPath)
|
||||
hookArgs, _ := json.Marshal(event)
|
||||
client.Send(Request{Action: "hook", Args: hookArgs})
|
||||
|
||||
case "setup":
|
||||
runSetup()
|
||||
|
||||
case "daemon":
|
||||
runDaemon(sockPath)
|
||||
|
||||
@@ -208,8 +220,8 @@ Commands:
|
||||
label <id> <text> Assign a label to a session
|
||||
focus <minutes> Suppress notifications for N minutes
|
||||
i3bar Output i3bar JSON (use as status_command in i3 config)
|
||||
setup Add vmux hooks to Claude Code settings (idempotent)
|
||||
stop Stop the vmux daemon
|
||||
daemon Run the daemon in foreground (used internally)
|
||||
|
||||
Flags:
|
||||
--no-color Disable colored output
|
||||
|
||||
Reference in New Issue
Block a user