feat: expose per-surface TTY in tree output - #2040
Conversation
Add tty field to surface items in system.tree JSON response, reading from existing surfaceTTYNames dictionary. Also show tty= in the CLI text tree output for terminals that have a registered TTY. This enables external tools (e.g. CodeV) to cross-reference claude process TTYs with cmux surfaces for accurate session detection when multiple sessions share the same working directory.
|
@grimmerk is attempting to deploy a commit to the Manaflow Team on Vercel. A member of the Team first needs to authorize it. |
📝 WalkthroughWalkthroughThe code adds a new Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryThis PR exposes the per-surface TTY device name (already tracked in Key changes:
Confidence Score: 5/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant Shell as Shell (cmux-init)
participant TC as TerminalController
participant WS as Workspace.surfaceTTYNames
participant API as system.tree (JSON)
participant CLI as tree --all (text)
Shell->>TC: report_tty <ttyName> [--panel=UUID]
TC->>WS: surfaceTTYNames[panelId] = ttyName
Note over TC,WS: TTY stored in-memory, no new collection
TC->>API: v2TreeWorkspaceNode()
API->>WS: surfaceTTYNames[panel.id]
WS-->>API: "ttys010" | nil
API-->>TC: { ..., "tty": "ttys010" | null }
TC->>CLI: treeSurfaceLabel()
CLI->>WS: surface["tty"] as? String
WS-->>CLI: "ttys010"
CLI-->>TC: "surface:1 [terminal] "title" [selected] ◀ active tty=ttys010"
Reviews (1): Last reviewed commit: "feat: expose per-surface TTY in tree out..." | Re-trigger Greptile |
|
Thank you for the contribution! |
Add tty field to surface items in system.tree JSON response, reading from existing surfaceTTYNames dictionary. Also show tty= in the CLI text tree output for terminals that have a registered TTY. This enables external tools (e.g. CodeV) to cross-reference claude process TTYs with cmux surfaces for accurate session detection when multiple sessions share the same working directory.
Summary
Expose per-surface TTY name in the
system.treeresponse. Reads from the existingsurfaceTTYNamesdictionary — no new data collection, just surfacing what's already tracked internally.Changes
TerminalController.swift — add
ttyfield to surface items inv2TreeWorkspaceNode:CLI/cmux.swift — show
tty=<value>in text tree output for surfaces with a registered TTY.Before / After
Before:
After:
Use case
Enables external tools to cross-reference process TTYs (
ps -o tty=) with cmux surfaces for identifying which terminal tab a specific process is running in. This is the cmux equivalent of iTerm2'stty of sessionAppleScript property.Test proof
Dev build (
reload.sh --tag codev-tty), runningtree --all:Surfaces without registered TTY (e.g. newly created, no shell integration) show no
tty=field — same output as before.🤖 On behalf of @grimmerk — generated with Claude Code