Add tmux support to brev open command#243
Merged
Merged
Conversation
- Add EditorTmux constant and update all validation functions - Implement openTmux() with session management (brev-<workspace> naming) - Add ensureTmuxInstalled() for automatic tmux installation - Follow same patterns as VSCode/Cursor/Windsurf implementations - Support session reconnection and creation with proper working directory - Handle tmux-specific error cases and installation requirements - Use interactive SSH execution for seamless tmux session access Co-Authored-By: Alec Fong <alecsanf@usc.edu>
Contributor
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
Member
|
for the tmux session lets just call it "brev" no alias. That way if we change the name in the future we always connect to the same session. |
- Change session name from 'brev-<workspace>' to just 'brev' - Ensures users always connect to same session regardless of workspace name changes - Addresses PR feedback from @theFong Co-Authored-By: Alec Fong <alecsanf@usc.edu>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add tmux support to brev open command
Summary
This PR extends the
brev opencommand to support tmux as a new editor type alongside VSCode, Cursor, and Windsurf. Users can now runbrev open <instance> tmuxto connect to a persistent tmux session on their remote workspace.Key features added:
EditorTmuxconstant and validation across all editor type checksopenTmux()function with intelligent session management (reconnects to existing sessions or creates new ones)ensureTmuxInstalled()for automatic tmux installation on remote instancesbrev-<workspace-identifier>for predictable, conflict-free sessionsImplementation follows existing patterns:
Review & Testing Checklist for Human
openTmux()andensureTmuxInstalled()is safe from injection attacks, especially with user-controlledsshAliasandpathparametersbrev open <instance> tmuxwith a real workspace to verify session creation, reconnection, and working directory handlingbrev-<workspace>session naming works correctly and doesn't conflict with existing user tmux sessionsRecommended test plan:
brev-<workspace>sessionDiagram
%%{ init : { "theme" : "default" }}%% graph TD CLI["brev open <instance> tmux"] OpenCmd["pkg/cmd/open/open.go<br/>runOpenCommand()"] Determine["determineEditorType()"] OpenByType["openEditorByType()"] OpenTmux["openTmux()"]:::major-edit EnsureTmux["ensureTmuxInstalled()"]:::major-edit SSH["Interactive SSH<br/>exec.Command()"] CLI --> OpenCmd OpenCmd --> Determine Determine --> OpenByType OpenByType --> OpenTmux OpenTmux --> EnsureTmux OpenTmux --> SSH Constants["Editor Constants<br/>EditorTmux = 'tmux'"]:::major-edit Validation["Validation Functions<br/>handleSetDefault()<br/>determineEditorType()"]:::major-edit HelpText["Help Text & Examples"]:::minor-edit OpenCmd --> Constants OpenCmd --> Validation OpenCmd --> HelpText subgraph Legend L1["Major Edit"]:::major-edit L2["Minor Edit"]:::minor-edit L3["Context/No Edit"]:::context end classDef major-edit fill:#90EE90 classDef minor-edit fill:#87CEEB classDef context fill:#FFFFFFNotes
Architectural differences from other editors:
vscode-remote://ssh-remote+URIs and local editor executionssh -t <alias> 'tmux ...')Session management strategy:
brev-<workspace-identifier>(predictable and discoverable)Platform considerations:
apt-getLink to Devin run: https://app.devin.ai/sessions/2735e7dbd59c4a90ae870a0e00f46668
Requested by: Alec Fong (@theFong)