Add Jupyter support to brev open command #246
Open
+41
−7
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 Jupyter support to brev open command
Summary
This PR extends the
brev opencommand to support Jupyter notebooks by addingbrev open <instance-id> jupyter. The implementation:EditorJupyterconstant and updates all validation logic to include "jupyter" as a valid editor typeopenJupyter()function that starts port forwarding on port 8888 and opens browser to localhost:8888OpenStoreinterface to includeutil.MakeWorkspaceWithMetaStorefor port forwarding compatibilitybrev notebookcommand for Jupyter integrationThe implementation reuses existing port forwarding infrastructure and browser opening utilities, maintaining consistency with the current codebase architecture.
Review & Testing Checklist for Human
brev open <instance-id> jupyteractually works with a real Brev workspaceRecommended Test Plan:
brev open <workspace> jupyterbrev open <workspace> codeDiagram
%%{ init : { "theme" : "default" }}%% graph TD OpenCmd["pkg/cmd/open/open.go<br/>Main open command logic"]:::major-edit PortForward["pkg/cmd/portforward/portforward.go<br/>Port forwarding utilities"]:::context Browser["github.com/pkg/browser<br/>Browser opening library"]:::context UtilStore["pkg/cmd/util/util.go<br/>MakeWorkspaceWithMetaStore interface"]:::context OpenCmd -->|"Uses RunPortforward()"| PortForward OpenCmd -->|"Uses OpenURL()"| Browser OpenCmd -->|"Extends interface with"| UtilStore 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
openJupyter()function blocks indefinitely withselect {}following the pattern from the notebook commandportforward.PortforwardStorerequirementsLink to Devin run: https://app.devin.ai/sessions/fd9c4f3f8e0648e0ade8845094dbb8ef
Requested by: @theFong