abtop icon indicating copy to clipboard operation
abtop copied to clipboard

feat: jump to session via terminal adapter registry (cmux/tmux/iTerm2)

Open Valgard opened this issue 5 months ago • 0 comments

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_ID from the agent process env, then cmux 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 NotApplicable so 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

Valgard avatar Jun 11 '26 22:06 Valgard