Skip to content

Commit a53c504

Browse files
theFongclaude
andauthored
feat(search): add gpu-search command to find GPU instance types (#280)
* feat(search): add gpu-search command to find GPU instance types Add `brev search` command (aliases: gpu-search, gpu, gpus) to search and filter available GPU instance types across cloud providers. Features: - Filter by GPU name, provider, VRAM, compute capability, disk, boot time - Sort by price, vram, boot-time, etc. - Show instance features (stoppable, rebootable, flex-ports) - JSON output support for scripting - Pipeable output for chaining with other commands Examples: brev search --gpu-name A100 --sort price brev search --min-vram 40 --max-boot-time 5 brev search --json | jq '.[] | select(.price < 2)' * refactor(search): address PR review feedback - Add validation for --sort flag with clear error message for invalid options - Extract common formatInstanceFields helper to reduce code duplication - Move regex compilation to package level (compiled once, not per call) - Replace magic number 730 with hoursInMonth constant - Move public API URL to config.go as GetBrevPublicAPIURL() - Use NewRestyClient instead of resty.New() for consistency Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com> * fix(search): fix lint issues in gpu-search refactor - Fix gofumpt formatting (var block alignment, struct field alignment) - Reduce cyclomatic complexity in RunGPUSearch by extracting validateSortOption, displayEmptyResults, setTargetDisks, and displayResults helpers Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 564df67 commit a53c504

5 files changed

Lines changed: 1593 additions & 0 deletions

File tree

pkg/cmd/cmd.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"github.com/brevdev/brev-cli/pkg/cmd/delete"
1515
"github.com/brevdev/brev-cli/pkg/cmd/envvars"
1616
"github.com/brevdev/brev-cli/pkg/cmd/fu"
17+
"github.com/brevdev/brev-cli/pkg/cmd/gpusearch"
1718
"github.com/brevdev/brev-cli/pkg/cmd/healthcheck"
1819
"github.com/brevdev/brev-cli/pkg/cmd/hello"
1920
"github.com/brevdev/brev-cli/pkg/cmd/importideconfig"
@@ -270,6 +271,7 @@ func createCmdTree(cmd *cobra.Command, t *terminal.Terminal, loginCmdStore *stor
270271
}
271272
cmd.AddCommand(workspacegroups.NewCmdWorkspaceGroups(t, loginCmdStore))
272273
cmd.AddCommand(scale.NewCmdScale(t, noLoginCmdStore))
274+
cmd.AddCommand(gpusearch.NewCmdGPUSearch(t, noLoginCmdStore))
273275
cmd.AddCommand(configureenvvars.NewCmdConfigureEnvVars(t, loginCmdStore))
274276
cmd.AddCommand(importideconfig.NewCmdImportIDEConfig(t, noLoginCmdStore))
275277
cmd.AddCommand(shell.NewCmdShell(t, loginCmdStore, noLoginCmdStore))

0 commit comments

Comments
 (0)