Skip to content

Commit 272bf99

Browse files
authored
feat(create): add gpu-create command with retry and fallback logic (#281)
* feat(create): add gpu-create command with retry and fallback logic Add `brev create` command (aliases: provision, gpu-create) to create GPU instances with automatic retry across multiple instance types. Features: - Smart defaults: auto-selects cheapest GPU meeting minimum specs - Fallback chain: tries each type until all instances succeed - Startup scripts: inline or @filepath syntax - Parallel creation: --parallel flag for faster cluster creation - Pipeable: reads types from stdin, outputs instance names Examples: brev create my-instance brev search --gpu-name A100 | brev create my-box brev create my-cluster --count 3 --type g5.xlarge brev create my-instance --startup-script @setup.sh * style: fix gofumpt formatting in workspace.go Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(cmd): remove duplicate create command from help output * feat(create): add search filter flags to create command Allow users to filter GPU instances directly in create (e.g. brev create my-instance -g a100) instead of piping from brev search. Adds 12 filter flags matching search: --gpu-name, --provider, --min-vram, --min-total-vram, --min-capability, --min-disk, --max-boot-time, --stoppable, --rebootable, --flex-ports, --sort, --desc. Defaults are preserved when no filters set. * feat(create): add --dry-run flag to preview matching instance types * refactor(create): simplify gpucreate with shared utilities and reduced duplication - Deduplicate isStdoutPiped() by exporting from gpusearch - Convert createWorkspaceWithType to createContext method (8 params → 2) - Convert pollUntilReady to createContext method (6 params → 1) - Add colorize() helper to eliminate piped-vs-colored branching - Extract registerCreateFlags to fix funlen lint violation - Wrap external DisplayResults error to fix wrapcheck lint - Fix test to call parseTableInput directly instead of reimplementing - Trim help examples from 15+ to 6 focused patterns - Simplify resolveWorkspaceUserOptions branching ---------
1 parent a53c504 commit 272bf99

5 files changed

Lines changed: 1292 additions & 10 deletions

File tree

pkg/cmd/cmd.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@ import (
1010
"github.com/brevdev/brev-cli/pkg/cmd/configureenvvars"
1111
"github.com/brevdev/brev-cli/pkg/cmd/connect"
1212
"github.com/brevdev/brev-cli/pkg/cmd/copy"
13-
"github.com/brevdev/brev-cli/pkg/cmd/create"
1413
"github.com/brevdev/brev-cli/pkg/cmd/delete"
1514
"github.com/brevdev/brev-cli/pkg/cmd/envvars"
1615
"github.com/brevdev/brev-cli/pkg/cmd/fu"
16+
"github.com/brevdev/brev-cli/pkg/cmd/gpucreate"
1717
"github.com/brevdev/brev-cli/pkg/cmd/gpusearch"
1818
"github.com/brevdev/brev-cli/pkg/cmd/healthcheck"
1919
"github.com/brevdev/brev-cli/pkg/cmd/hello"
@@ -272,6 +272,7 @@ func createCmdTree(cmd *cobra.Command, t *terminal.Terminal, loginCmdStore *stor
272272
cmd.AddCommand(workspacegroups.NewCmdWorkspaceGroups(t, loginCmdStore))
273273
cmd.AddCommand(scale.NewCmdScale(t, noLoginCmdStore))
274274
cmd.AddCommand(gpusearch.NewCmdGPUSearch(t, noLoginCmdStore))
275+
cmd.AddCommand(gpucreate.NewCmdGPUCreate(t, loginCmdStore))
275276
cmd.AddCommand(configureenvvars.NewCmdConfigureEnvVars(t, loginCmdStore))
276277
cmd.AddCommand(importideconfig.NewCmdImportIDEConfig(t, noLoginCmdStore))
277278
cmd.AddCommand(shell.NewCmdShell(t, loginCmdStore, noLoginCmdStore))
@@ -283,7 +284,6 @@ func createCmdTree(cmd *cobra.Command, t *terminal.Terminal, loginCmdStore *stor
283284
cmd.AddCommand(secret.NewCmdSecret(loginCmdStore, t))
284285
cmd.AddCommand(sshkeys.NewCmdSSHKeys(t, loginCmdStore))
285286
cmd.AddCommand(start.NewCmdStart(t, loginCmdStore, noLoginCmdStore))
286-
cmd.AddCommand(create.NewCmdCreate(t, loginCmdStore))
287287
cmd.AddCommand(stop.NewCmdStop(t, loginCmdStore, noLoginCmdStore))
288288
cmd.AddCommand(delete.NewCmdDelete(t, loginCmdStore, noLoginCmdStore))
289289
cmd.AddCommand(reset.NewCmdReset(t, loginCmdStore, noLoginCmdStore))

0 commit comments

Comments
 (0)