Skip to content

feat(session): add tmux windows mode#1

Open
ukanga wants to merge 14 commits intomainfrom
feat/tmux-windows-mode-v2
Open

feat(session): add tmux windows mode#1
ukanga wants to merge 14 commits intomainfrom
feat/tmux-windows-mode-v2

Conversation

@ukanga
Copy link
Copy Markdown
Owner

@ukanga ukanga commented Apr 22, 2026

Summary

  • add a windows-mode tmux layout with session.mode, session_prefix, layered config loading, and state-backed discovery/persistence for per-worktree sessions
  • move session command handling into src/session_cmd.rs, keeping panes and windows flows separate and improving cross-layout rm guidance
  • fix tmux window creation targeting, add unit and ignored tmux regression coverage, update session docs, and ignore local .codex metadata

Testing

  • cargo fmt --check
  • cargo clippy -- -D warnings
  • cargo test
  • cargo test test_tmux_create_window_uses_next_free_index --test tmux_test -- --ignored

ukanga and others added 14 commits April 22, 2026 06:25
Add session mode and session-prefix configuration so session
commands can target either panes or per-worktree windows. Layer
global and repo-local TOML files field-by-field and ignore malformed
files without dropping valid config.
Add enter, attachment, kill-session, live-session discovery, and
per-worktree window setup helpers so wt can manage panes and
per-worktree sessions through one tmux wrapper.
Move session command handling into a dedicated module and persist
windows-mode sessions so wt can add, list, attach, and remove
per-worktree tmux sessions without relying on name scanning.
Preserve windows-mode state when panes-mode sessions are cleaned
up.
Document the new --mode flow, state-backed windows discovery, and
the panes-only watch behavior so users can choose layouts without
guessing how session lookup works.
Use 'session:' when creating a new tmux window so tmux allocates
the next unused index instead of resolving the target to window 0.
Add a regression test for the target syntax to prevent 'index 0 in
use' when adding windows to an existing session.
Add an ignored tmux regression test that creates a session and then
adds a second window, covering the bug where new-window targeted
window 0 instead of the next free slot. Reuse a small cleanup
helper across the existing ignored tmux tests.
Clarify that --mode only applies to the command it is passed to so
README examples do not imply sticky windows-mode behavior. Also
explain that tmux window navigation in windows mode stays within one
worktree session and that switching worktrees uses wt session again.
Probe panes and windows session state before returning from rm so the
user sees when the chosen layout does not contain the target
worktree. Keep removal mode-specific, but suggest the correct command
for the other layout and make stale windows-mode cleanup explicit.
Centralize the windows-mode empty-state message and the load-plus-prune
flow so attach and ls share the same behavior. This removes duplicate
empty checks without changing session command behavior.
Extract shared panes-mode tmux setup so the command dispatcher and
panes add/remove flows stop rebuilding the same session wrapper and
status-window logic inline. This keeps the panes paths shorter without
changing behavior.
Drop unused probe state and split panes and windows hint generation
into focused helpers. This keeps the remove guidance logic easier to
follow while preserving the same user-facing advice and tests.
Factor the windows layout names and agent-window status lookup into
small helpers so windows-mode listing and persistence stop duplicating
role strings inline. Add a unit test for the layout-name helper.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants