feat(dashboard): spawn claude in new tmux window when $TMUX is set #48

Closed
didericis wants to merge 1 commits from tmux-spawn-window into main

1 Commits

Author SHA1 Message Date
didericis 62ceab7485 feat(dashboard): spawn claude in new tmux window when \$TMUX is set
test / unit (pull_request) Successful in 18s
test / integration (pull_request) Successful in 1m10s
Option 3 from `docs/research/claude-code-pane-in-dashboard.md`,
opt-in by environment. When the dashboard runs inside tmux
(\$TMUX is set), both the new-agent (`n`) attach AND the
re-attach (Enter) paths spawn claude with
`tmux new-window -n <slug> docker exec -it … claude …` instead
of taking over the terminal via `curses.endwin`. The dashboard
keeps rendering in its current tmux pane; the operator switches
to the new window via tmux's normal nav.

Outside tmux the existing handoff path is unchanged — the
dispatch is a single `_in_tmux()` check per attach.

Mechanics:

  - `DockerBottle.claude_docker_argv` extracted from `exec_claude`,
    so both subprocess.run AND `tmux new-window` can build on the
    same docker-exec argv (preserving `--append-system-prompt-file`).
  - `_attach_via_tmux` in dashboard.py wraps the docker argv with
    `tmux new-window -n <slug> …` and returns immediately. Status
    line: `[slug] opened in new tmux window`.
  - `_build_tmux_attach_argv` split out as a pure helper so the
    wrapping shape is unit-tested without shelling out.

467 unit tests pass (2 new for `_build_tmux_attach_argv`).
2026-05-26 14:04:45 -04:00