Skip to content

feat(search): add gpu-search command to find GPU instance types#280

Merged
theFong merged 3 commits intomainfrom
pr/gpu-search
Feb 6, 2026
Merged

feat(search): add gpu-search command to find GPU instance types#280
theFong merged 3 commits intomainfrom
pr/gpu-search

Conversation

@theFong
Copy link
Member

@theFong theFong commented Feb 2, 2026

Summary

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 size, boot time
  • Sort by price, vram, boot-time, gpu-count, etc.
  • Show instance features (stoppable, rebootable, flex-ports)
  • JSON output support for scripting
  • Pipeable output for chaining with other commands

Examples

# Search all GPUs sorted by price
brev search

# Filter by GPU name
brev search --gpu-name A100

# Filter by specs
brev search --min-vram 40 --max-boot-time 5 --sort price

# JSON output for scripting
brev search --json | jq '.[] | select(.price < 2)'

# Pipe to create
brev search --gpu-name A100 | brev create my-instance

Test plan

  • brev search shows available GPUs
  • Filters work correctly (--gpu-name, --min-vram, etc.)
  • Sort options work (--sort price, --sort vram)
  • JSON output is valid JSON
  • Piped output works with downstream commands

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)'
@theFong
Copy link
Member Author

theFong commented Feb 3, 2026

Manual QA Results ✅

Build & Static Analysis:

  • ✅ Build passes
  • go vet passes
  • ✅ Unit tests pass (36.7% coverage on gpusearch package)

Test Plan Verification:

  • brev search shows available GPUs - Verified: Returns full table of GPU instances sorted by price
  • ✅ Filters work correctly - Verified: --gpu-name A100, --min-vram 40, --sort price all work as expected
  • ✅ Sort options work - Verified: Sorting by price shows cheapest first
  • ✅ JSON output is valid JSON - Verified: --json outputs valid JSON array
  • ✅ Piped output works with downstream commands - Verified: brev search | brev create successfully creates instance

Notes:

  • Comprehensive unit tests cover all filter and sort functionality
  • Pre-existing test failures on main (Darwin platform tests, Docker daemon) are unrelated to this PR

theFong and others added 2 commits February 5, 2026 22:55
- 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 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>
Copy link
Contributor

@tylerfong tylerfong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fire

@theFong theFong merged commit a53c504 into main Feb 6, 2026
9 checks passed
@theFong theFong deleted the pr/gpu-search branch February 6, 2026 07:14
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.

3 participants