Add Windsurf IDE support to brev open command#242
Merged
Conversation
- Add EditorWindsurf constant and validation logic - Add Windsurf utility functions following Cursor pattern - Add openWindsurf function with vscode-remote URI support - Add Windsurf extension installation support - Update help text and examples to include Windsurf - Add Windows and macOS installation paths for Windsurf - Convert if-else chains to switch statements for better code quality 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
|
can you fix the lint issues? |
- Extract getEditorName helper to eliminate duplicated switch statements - Extract handlePathError helper to reduce repeated UpdateUser pattern - Extract openEditorByType helper to simplify editor opening logic - Extract validateRemoteWorkspace helper to reduce function complexity - Reduce openEditorWithSSH from 43 to ~35 statements - Reduce runOpenCommand cyclomatic complexity from 18 to ~12 - Maintain all existing Windsurf IDE functionality - Fix gofumpt formatting issues Fixes lint errors: - Function 'openEditorWithSSH' has too many statements (43 > 40) (funlen) - cyclomatic complexity 18 of func runOpenCommand is high (> 16) (gocyclo) 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 Windsurf IDE support to
brev opencommand and fix lint issuesSummary
This PR adds Windsurf IDE support to the
brev opencommand, following the existing pattern used for VS Code and Cursor. Users can now runbrev open instance windsurfto open their Brev instances in Windsurf IDE with automatic SSH remote connection setup.Additionally, this PR fixes lint issues in the codebase by refactoring two functions that exceeded complexity limits:
openEditorWithSSHfunction was reduced from 43 to ~35 statements by extracting helper functionsrunOpenCommandcyclomatic complexity was reduced from 18 to ~12 by consolidating repeated error handlingKey additions:
EditorWindsurfconstant and Windsurf support in editor type validationms-vscode-remote.remote-ssh,ms-toolsai.jupyter-keymap,ms-python.python)Refactoring improvements:
getEditorName()helper to eliminate duplicated switch statementshandlePathError()helper to reduce repeated UpdateUser patternopenEditorByType()helper to simplify editor opening logicvalidateRemoteWorkspace()helper to reduce function complexityReview & Testing Checklist for Human
brev open instance windsurfworks correctly on Windows/macOS/Linuxbrev open instance codeandbrev open instance cursorstill work as expected after refactoringwindsurfexecutable is not in PATH and confirm error messages are helpfulRecommended test plan:
brev open instance windsurfDiagram
%%{ init : { "theme" : "default" }}%% graph TD CLI["brev open command<br/>pkg/cmd/open/open.go"]:::major-edit UTIL["Utility functions<br/>pkg/util/util.go"]:::major-edit CLI --> |"calls"| getEditorName["getEditorName()<br/>helper function"]:::major-edit CLI --> |"calls"| handlePathError["handlePathError()<br/>helper function"]:::major-edit CLI --> |"calls"| openEditorByType["openEditorByType()<br/>helper function"]:::major-edit CLI --> |"calls"| validateRemoteWorkspace["validateRemoteWorkspace()<br/>helper function"]:::major-edit openEditorByType --> |"windsurf case"| openWindsurf["openWindsurf()<br/>new function"]:::major-edit openEditorByType --> |"existing"| openVsCode["openVsCode()"]:::context openEditorByType --> |"existing"| openCursor["openCursor()"]:::context UTIL --> |"new"| TryRunWindsurfCommand["TryRunWindsurfCommand()"]:::major-edit UTIL --> |"new"| InstallWindsurfExtension["InstallWindsurfExtension()"]:::major-edit 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
vscode-remote://ssh-remote+URI scheme as VS Code and Cursor. This should be verified with actual Windsurf documentation.Session Info: