Skip to content

Add ports command for instances and nodes - #441

Open
callen-bot wants to merge 1 commit into
mainfrom
agent/list-instance-ports
Open

Add ports command for instances and nodes#441
callen-bot wants to merge 1 commit into
mainfrom
agent/list-instance-ports

Conversation

@callen-bot

@callen-bot callen-bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Summary

  • add brev ports <instance-or-node> for Skybridge-managed environments and registered nodes
  • display HTTP applications and raw network mappings in human-readable tables, with a documented stable --json contract for automation
  • resolve registered nodes by exact ID or case-insensitive name, with exact IDs taking precedence and caller cancellation propagated to node lookup

Why

Skybridge port mappings available in the Brev console were not exposed through the CLI, making endpoint and access details harder to inspect from scripts and terminal workflows.

Impact

Users can now inspect each mapping's real port_id, endpoint, authorization or IP restrictions, public port, destination port, protocol, and type without leaving the CLI. The JSON output can be passed to later port-management commands without parsing the human tables.

Compatibility

For managed instances, this command reads the Skybridge network member returned by GetNetworkInfo. It intentionally does not synthesize the console's legacy secure-link or firewall fallback rows: those rows use UI-only IDs and cannot be targeted by the CLI's update or delete APIs.

If no Skybridge network member is available, the command returns an actionable error explaining that the instance may still be provisioning or may use legacy network access, and directs the user to the console. A connected or disconnected Skybridge member with zero mappings remains a valid empty result ([] with --json).

Validation

  • go test -race ./pkg/cmd/ports ./pkg/cmd/util ./pkg/cmd
  • go test ./pkg/... -run '^$'
  • make fmtcheck vet lint
  • go build -o /tmp/brev-port-stack .
  • command-help smoke tests for ports, ports close, and ports update on the fully stacked branch

go test -race ./... was also attempted. All package tests completed except existing environment-dependent failures on macOS in e2etest/setup, pkg/ssh, and pkg/store (hard-coded Linux workspace path, missing JetBrains Gateway installation, and Windows/WSL assumptions).

@callen-bot
callen-bot marked this pull request as ready for review August 10, 2026 21:33
@callen-bot
callen-bot requested a review from a team as a code owner August 10, 2026 21:33
@callen-bot
callen-bot force-pushed the agent/list-instance-ports branch from 4035dbd to 14be7cd Compare August 14, 2026 20:20
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