abtop
abtop copied to clipboard
feat: jump to session via terminal adapter registry (cmux/tmux/iTerm2)
What
Enter "jump to session" worked only inside tmux. This refactors the inline tmux logic into a TerminalJumper registry under src/jump/ (one adapter per file) and adds two backends:
- cmux — read
CMUX_WORKSPACE_IDfrom the agent process env, thencmux select-workspace --workspace <uuid>. - iTerm2 — match the process's controlling tty to an iTerm2 session and focus it via AppleScript (select pane/tab/window + activate).
- tmux — existing behavior preserved (now an adapter; "PID not in any pane" became
NotApplicableso other backends can try).
How
resolve() walks jumpers() in order (cmux → tmux → iTerm2). The three-way JumpAttempt (NotApplicable / Jumped / Failed) makes adapters composable — first applicable wins, NotApplicable falls through. Backends are mutually exclusive by controlling tty.
Tests / verification
- 15 new unit tests for the registry loop and the parsing helpers.
- Live-tested on macOS / iTerm2 — focus lands on the correct pane/tab/window.
- Full CI gate green locally on rustc 1.96.0:
cargo clippy -- -D warnings,cargo test(180 passed),cargo build --release.
Notes
- iTerm2's first jump triggers a one-time macOS Automation permission prompt; until granted it surfaces as a status message, not a crash.
- Docs updated in
AGENTS.md(Key Bindings + new "Terminal Jump" section).
Closes #137