Skip to content

Conversation

@devin-ai-integration
Copy link
Contributor

@devin-ai-integration devin-ai-integration bot commented Jul 22, 2025

Separate concerns: remove creation logic from brev start command

Summary

This PR refactors the brev start command to focus solely on starting existing Brev instances, removing all workspace creation functionality. This separates concerns between brev start (for starting existing instances) and brev create (for creating new instances).

Key Changes:

  • Removed creation-related flags: --name, --cpu, --gpu, --setup-script, --setup-repo, --setup-path, --org, --empty
  • Kept only: --detached flag for non-blocking start operations
  • Removed creation functions: maybeStartEmpty, maybeStartFromGitURL, maybeStartWithLocalPath, createEmptyWorkspace, createNewWorkspaceFromGit, MakeNewWorkspaceFromURL, and related creation logic
  • Simplified interfaces: Updated StartStore to remove creation-related methods
  • Updated help text: Changed terminology from "machine" to "instance" and updated examples with instance_name placeholder
  • Fixed dependencies: Implemented makeGitRepoFromURL in profile.go to replace dependency on removed start.MakeNewWorkspaceFromURL

This is a breaking change - users attempting to create workspaces with brev start will now receive error messages directing them to use brev create.

Review & Testing Checklist for Human

  • Test existing functionality: Verify brev start <existing_instance_name> still works correctly for stopped instances
  • Test error handling: Try brev start <non_existent_instance> and brev start with no args to confirm error messages are helpful and direct users to brev create
  • Test detached flag: Verify brev start <instance> --detached works and doesn't block the shell
  • Verify create command unaffected: Test that brev create command still works properly for workspace creation
  • Check for hidden dependencies: Search codebase for any other references to removed functions like MakeNewWorkspaceFromURL, maybeStartEmpty, etc.

Recommended test plan: Create a test instance with brev create, stop it, then start it with brev start to verify the full workflow still works end-to-end.


Diagram

%%{ init : { "theme" : "default" }}%%
graph TD
    StartCmd["pkg/cmd/start/start.go<br/>NewCmdStart()"]:::major-edit
    StartStore["StartStore interface"]:::major-edit
    RunStart["runStartWorkspace()"]:::major-edit
    MaybeStart["maybeStartStoppedOrJoin()"]:::context
    
    StartTest["pkg/cmd/start/start_test.go"]:::minor-edit
    ProfileCmd["pkg/cmd/profile/profile.go"]:::minor-edit
    CreateCmd["pkg/cmd/create/create.go"]:::context
    
    StartCmd --> StartStore
    StartCmd --> RunStart
    RunStart --> MaybeStart
    
    StartTest -.-> StartCmd
    ProfileCmd -.-> StartCmd
    
    subgraph "Removed Functions" 
        RemovedFuncs["maybeStartEmpty()<br/>maybeStartFromGitURL()<br/>createEmptyWorkspace()<br/>MakeNewWorkspaceFromURL()"]:::removed
    end
    
    StartCmd -.->|"removed dependencies"| RemovedFuncs
    ProfileCmd -.->|"replaced with<br/>makeGitRepoFromURL()"| RemovedFuncs
    
    subgraph Legend
        L1[Major Edit]:::major-edit
        L2[Minor Edit]:::minor-edit  
        L3[Context/No Edit]:::context
        L4[Removed]:::removed
    end

    classDef major-edit fill:#90EE90
    classDef minor-edit fill:#87CEEB  
    classDef context fill:#FFFFFF
    classDef removed fill:#FFB6C1
Loading

Notes

  • All CI checks are passing (6/6) including lint, tests, and security scans
  • This change maintains backward compatibility for the core brev start functionality while removing the creation aspect
  • The --detached flag behavior is preserved for non-blocking operations
  • Error messages provide clear guidance to users about using brev create for workspace creation

Link to Devin run: https://app.devin.ai/sessions/8102944e41954c7b86d9860ea4b8adc4
Requested by: @theFong

- Remove creation-related flags (--name, --cpu, --gpu, --setup-script, --setup-repo, --setup-path, --org, --empty)
- Keep only --detached flag for non-blocking start operations
- Remove creation functions: maybeStartEmpty, maybeStartFromGitURL, maybeStartWithLocalPath
- Keep only maybeStartStoppedOrJoin for starting existing workspaces
- Simplify StartStore interface to remove creation-related methods
- Update command description and examples to reflect start-only functionality
- Add helpful error messages directing users to 'brev create' for new workspaces
- Fix profile.go dependency by implementing makeGitRepoFromURL function

Co-Authored-By: Alec Fong <[email protected]>
@devin-ai-integration
Copy link
Contributor Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

…'instance_name' placeholder

- Change startLong from 'Brev machine' to 'Brev instance'
- Change startExample placeholder from 'existing_ws_name' to 'instance_name'
- Maintain consistent instance-themed terminology throughout help text

Co-Authored-By: Alec Fong <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant