stack: `stack destroy` should accept a list of stack ids
Affected area
Local development
Problem to solve
stack destroy takes one target. --stack-id is a single string (apps/cli/src/commands/experimental/stack/destroy/destroy.command.ts), and so is --stack.
stack list often shows several stacks (old dogfood scratches, temp projects, one project with more than one name). Cleaning a chosen subset means one destroy invocation per id, each with its own confirmation. There is no --all on destroy (stop has --all). --all would also be the wrong tool when only some of the listed ids should go.
Proposed solution
Accept more than one id in one destroy:
supabase stack destroy --stack-id <id> --stack-id <id> --yes
Repeatable --stack-id. One confirmation for the whole set, listing every resolved id. --yes skips that prompt once, as it does today for a single id.
If one id fails, report that failure and keep going through the rest, then exit non-zero. Do not stop the batch on the first miss.
--stack and --stack-id stay mutually exclusive, including when several ids are passed.
Alternatives considered
- A shell loop of
stack destroy --stack-id … --yes. Works, and repeats startup and confirmation once per id. --all, matchingstack stop --all. That destroys every readable stack, not a chosen subset.- A comma-separated
--stack-id a,b. Repeatable flags match the rest of the CLI better and do not need a new delimiter.
Additional context
Related: #6961. Text stack list currently prints an 8-character id that --stack-id rejects, so a batch flag is only usable with the full ids from --output-format json until that is fixed.
Hi @avallete, I'd like to take this one if it's open for contribution. My plan is a repeatable --stack-id, still mutually exclusive with --stack, with every id checked before anything is destroyed so the batch doesn't stop halfway on the first missing id. Does that match what you had in mind?
Hi @avallete, I've opened PR #--stack-id, single batch confirmation, and resilient batch deletion with integration tests.