feat(cli): teams, regions, ips and operating-systems commands + SDK v1.15.0 (PD-6080)#86
Merged
Merged
Conversation
…ump SDK to v1.15.0 (PD-6080)
Collaborator
Author
|
@greptile review |
Collaborator
Author
|
@greptile review |
leandroh
approved these changes
Jun 10, 2026
|
Promptless prepared a documentation update related to this change. Triggered by PR #86 Added a changelog entry documenting the new CLI commands: Review: CLI: Teams, Regions, IPs, and Operating Systems Commands |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Extends CLI API coverage with admin and metadata commands (PD-6080): team & member
management plus the regions / IPs / operating-systems catalogs — with interactive
fallbacks for required input and an enter-to-details view on IP listings. Bumps the
Go SDK to
v1.15.1, which exposes these endpoints and consumes the fixed JSON:APIenvelope for
GET /ips/{id}.Commands added
lsh teamslist,create,updatelsh teams memberslist,add,removelsh regionslistlsh ipslist,get <ip-id>lsh operating-systemslist(aliasos)teams members add --role <name>takes the human role name (owner/administrator/collaborator/billing) and resolves it to the SDK enuminternally, with a clear error on an invalid value.
ips listis project-scoped (--project, or--all-projects) with--family,--type,--location,--serverfilters (case-insensitive enums);ips get <ip-id>is the single-record drill-down.Next()usingpage[size]=100, and show a stderr spinner while fetching (TTY only).Interactive UX (TTY only — scripts fail fast with actionable errors)
teams create,teams updateandteams members addopen a form when requiredflags are omitted;
teams members removewithout an argument lists the team'smembers for selection and asks for confirmation before deleting.
ips listrenders an interactive table where enter opens a details view ofthe selected IP (same pattern as
servers), via new reusableResourceTable/ResourceDetailsTUI components.--no-inputor non-TTY stdin (pipes, CI), every interactive fallback isreplaced by a fail-fast error naming the missing flag.
Behavior notes
teams updateoperates on the team the token belongs to (API tokens areteam-scoped). Passing another team's id fails fast with the shortest fix:
lsh profile use <name>when a profile for it exists,lsh loginotherwise,or a typo warning when the id is not one of your teams.
teams updaterefreshes the active profile's stored teamname/slug, keeping
profile list/auth statusin sync.--currencyis not available onteams update: the API only allows writingcurrency on create. The published spec still advertises it with a default, which
makes the generated SDK inject
currencyinto every PATCH — the CLI strips itfrom the wire until the spec is fixed (see workaround comment in
cli/teams.go).mfa_enabledis always present in members JSON output (noomitempty).isattyinstead of char-device sniffing, so pipedcommands get actionable errors instead of bubbletea TTY crashes.
Acceptance criteria
lsh teams members add --email new@example.com --role administratorinvites a memberlsh teams members remove <id>removes a memberlsh regions listlists every available regionlsh ips listlists IPs allocated to the projectSDK / toolchain
latitudesh-go-sdkv1.9.0→v1.15.1(exposes teams members, regions, IPs andOS endpoints;
v1.15.1consumes the correctedip_addressJSON:API envelope, soips getreturns data).go.modnow requiresgo 1.25.x;.github/workflows/release.ymlswitched from ahardcoded
go-version: \'1.22.0\'togo-version-file: go.mod.volume_*operations to the renamed SDK client(
client.Storage→client.BlockStorage) — mechanical rename, no logic changes.Test plan
Unit tests (no credentials needed):
go test ./...Manual validation — build, authenticate once with
lsh login, then run thecommands against the live API:
Notes
cli/cli.go, where both PRsonly append command registrations in distinct regions — additive, no logical overlap.
ip_addressenvelope fix landed in the API spec and SDKv1.15.1during thisPR's development; a remaining spec drift (PATCH
/teamadvertisingcurrency/referred_code, missingdescription) is tracked separately.Greptile Summary
Adds
teams,regions,ips, andoperating-systemsCLI commands backed by the bumped Go SDK v1.15.1, with interactive TTY fallbacks for required input and an enter-to-details view on IP listings.lsh teams {list,create,update},lsh teams members {list,add,remove},lsh regions list,lsh ips {list,get},lsh operating-systems list— all wired into the root command, paginated to exhaustion viaNext(), guarded by dry-run, and covered by unit tests.stripTeamPatchCurrencytransport: a customhttp.RoundTripperstrips the spec-injectedcurrencyfield from team PATCH bodies to work around an API spec bug; scoped to the single team-update client so other commands are unaffected.IsTTY()now usesterm.IsTerminalinstead ofModeCharDevice, preventing bubbletea crashes when stdin is piped to/dev/null.Confidence Score: 4/5
Safe to merge with one targeted fix:
parseIPFamilyrejectsIPV4andIPV6while the PR documents case-insensitive enum handling for all IP filters.The
--familyfilter silently produces a user-facing error for fully-uppercased input (IPV4,IPV6) becauseparseIPFamilyuses explicit case matching rather thanstrings.ToLower, inconsistent withparseIPTypeand the documented behavior. Every other new command and thestripTeamPatchCurrencyworkaround look correct and well-tested.cli/ips.go —
parseIPFamilycase normalizationFlowchart
%%{init: {'theme': 'neutral'}}%% flowchart TD A[CLI command invoked] --> B{DryRun?} B -- yes --> Z[Log dry-run, return] B -- no --> C{Interactive form needed?} C -- "flags provided" --> D[Build request struct] C -- "flags missing + TTY" --> E[Run TUI prompts] C -- "flags missing + no TTY" --> F[requiredFlagError, return] E --> D D --> G[lsh.NewClient + API call] G -- error --> H[PrintError, return] G -- empty --> I[renderer.Render nil] G -- data --> J{Paginated?} J -- "Next() available" --> K[Append page, call Next] K --> J J -- "Next() == nil" --> L[stopSpinner] L --> M{Output type?} M -- "IP data\nisIPData" --> N[tui.RunResourceTable\nenter-details loop] M -- "Server data\nisServerData" --> O[RunServersTable] M -- other --> P[Standard table/JSON render]Prompt To Fix All With AI
Reviews (3): Last reviewed commit: "feat(cli): interactive forms, details vi..." | Re-trigger Greptile