Repository navigation
feat(cli): pick the wallet, organization, or environment to show on a terminal - #126
Draft
thebrandonlucas wants to merge 1 commit into
Conversation
… terminal On a terminal, a wallet read without WALLET_ID or --wallet (wallets get, wallets ledger list, wallets policies get, wallets payments summary) opens the wallet picker and shows the wallet picked. New organizations get and environments get show the organization or environment the scope selects, and pick it on a terminal when none is selected. Wallet changes still name their wallet. Off a terminal, with --json, --output json|ndjson, or --no-input, nothing is asked and a missing ID fails before any request, as before.
thebrandonlucas
marked this pull request as draft
October 27, 2026 14:35
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.
Fixes DEV-2903
Problem
#22 made a missing
--org,--env, or--walletopen a picker, but only when a command could not run without it. You still could not browse:voltage wallets getwithout an ID failed withwallets get needs a wallet ID … voltage wallets list shows the IDs, and there was no way to look at one organization or environment at all. You still had to copy UUIDs out of a list by hand.Behavior
On a terminal, a read that names one resource but has no ID now picks it with the existing picker, then shows it:
wallets get,wallets ledger list,wallets policies get,wallets payments summarywithoutWALLET_ID/--walletneeds a wallet IDWallet:, then shows that walletorganizations get(new)--orgor the profile selects, or asksOrganization:environments get(new)--envor the profile selects, or asksOrganization:/Environment:wallets update/deletewithout an IDAfter a pick, the CLI prints the usual
Next time, pass --wallet ID …notice. Esc ends with the same error as before.Nothing changes for scripts (DEV-2871). Off a terminal, with
--json,--output json|ndjson, or--no-input, nothing is asked. A wallet read without an ID still fails with exit 2 and the same message and hint, before any credential is resolved or request is sent.organizations getandenvironments getwithout a selection report the usual--org is requiredandExactly one --env is requirederrors.Why this design
get. Every command that needs scope already picks it, and the one command that failed for a missing ID with a "go copy it from the list" hint was a wallet read. So I extended that rather than makinglistinteractive or adding a copy-to-clipboard step. A list stays a list, which is safe to pipe.update,delete) still has to name its wallet. That keeps the existing rule that a delete is never aimed by ambient state, and keeps a picker out of the path of a change.organizations getandenvironments gettake no positional ID. They show the organization or environment the scope selects, so--org,--env, and profiles work as they do in every other command. The pickers then come for free frompick::needs. The auth service has no single-resource route, sogetfinds the item in the same listing thatlistuses, and reportsOrganization ID is not visible to this loginwhen it is not there.VOLTAGE_WALLET_ID. Same rule as feat(cli): pick a missing organization, environment, or wallet #22's--walletchange. The picked wallet goes into the command's own ID, not the scope (pick::Picked.wallet).Code
cli.rs: a wallet operation without an ID now parses toresource_id: Noneinstead of failing in clap validation. The error moves tocli::missing_wallet, whichpickraises.ListCommandbecomesDiscoveryCommand { List, Get }, with help examples for the new commands and forwallets get.pick.rs:wallet_targetdecides between picking and stopping (stopping for a change, off a terminal, or for JSON).asknow returnsPicked { flags, wallet }, sofillcan put the wallet in the scope or in the command's own ID.startup.rs:discoverserveslistandget.auth::Resolver::discovernames the subcommand in its API-key error (organizations get needs a browser login …).guides/login-and-profiles.md(pickers browse),guides/wallets.md, generatedcommands.md, and a CHANGELOG line.Checks
cargo fmt --check,cargo clippy --locked --all-targets -- -D warnings,cargo machete --with-metadata,cargo test --locked(198 unit, 152 integration),python3 scripts/check-coverage.py: all pass.--jsonand--no-input(no prompt, no request);wallets delete(no prompt); pick an org fororganizations get; pick an env forenvironments get;--jsonwith no env (no prompt, no request).wallets ledger listwith no ID;organizations getwith a visible org, an org that is not visible, and no org; the API-key error fororganizations get.wallet_targetfor each read, change, and terminal/script case, and the newneeds.scripts/crap-report.sh): 0 of 847 measured functions at or above 20. Highest changed:pick::ask14.00 andpick::fill13.00, both 100% covered. Line coverage 97.97%.origin/masterwithvoltage-pr-reviewand the Rust style checklist.Try it on staging
Expect: an
Organization:picker. Type to filter, press Enter. The organization's fields follow, and thenNext time, pass --org ORG_ID …. With only one organization, it is taken without asking.Expect: an
Environment:picker, then the environment. Then aWallet:picker (name CURRENCY UUID), then the wallet card with balance and activity, as forwallets get WALLET_ID.Expect: no picker in any of these.
wallets get needs a wallet ID(orwallets delete needs a wallet ID), with the hint, and exit code 2.Open questions
wallets update/delete) pick too? They are describe-only without--execute, but I kept them explicit to stay conservative.payments get,webhooks get,quotes get) could pick the same way. I left them out: their lists can be long and paginated, and they have no names to filter on.