Repository navigation
feat: normalize CLI flag conventions (#40) - #42
Merged
Merged
Conversation
Suite-wide flag normalization for spawn (companion PRs done for truffle,
lagotto; spored follows).
JSON output — deprecate the remaining per-command --json bools in favor of
the root -o/--output selector (matches list/status/sweep-status, already
migrated). bot, list-sweeps, plugin, list-amis, pipeline (graph+list) now
honor root -o json and carry MarkDeprecated("json") aliases.
Confirmation — add --yes/-y + a confirmation prompt to every destructive
command via a shared confirmYes() helper (cmd/utils.go); confirmTerminate
now delegates to it. The flag-convention gate surfaced that the gap was
suite-wide, not just the 3 commands #40 named, so all are fixed:
cancel (sweep), team delete, team remove, fsx delete (added -y shorthand),
pipeline cancel, sweep cancel, autoscale terminate, alerts delete,
dns delete, schedule cancel, stage delete, plugin remove.
confirmYes treats EOF/piped stdin as "no", so unattended runs without --yes
abort rather than destroying silently.
Gate — TestFlagConventions walks the command tree in-process and fails on
any undeprecated --json or any destructive verb missing --yes, so the
conventions can't regress. confirmYes covered by TestConfirmYes.
Docs — docs/flag-conventions.md records the conventions (output, confirmation,
shorthand registry, region vs regions).
Closes #40
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
team delete gained a confirmation prompt in this PR; the Tier 0 test runs with a closed stdin (reads as 'no'), so it must pass -y to actually delete.
This was referenced Jun 3, 2026
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.
Closes #40. Core of the suite-wide flag normalization. (Companion PRs already merged for truffle #17 and lagotto #17; spored C1 cobra conversion follows.)
JSON output → root
-o/--outputDeprecates the remaining per-command
--jsonbools in favor of the root persistent-o/--outputselector (matchinglist/status/sweep status, which were already migrated). Each now honors root-o jsonand keeps--jsonas aMarkDeprecatedalias for one release:bot,list-sweeps,plugin,list-amis,pipeline graph,pipeline list.Confirmation on destructive commands →
--yes/-yAdds
--yes/-y+ a confirmation prompt to every destructive command via a sharedconfirmYes(skip, prompt)helper (cmd/utils.go);confirmTerminatenow delegates to it.The new convention gate revealed the gap was suite-wide, not just the 3 commands #40 named — so all are fixed:
team delete(was unguarded),team remove,fsx delete(added-yshorthand)cancel/sweep cancel,pipeline cancel,autoscale terminatealerts delete,dns delete,schedule cancel,stage delete,plugin removeconfirmYestreats EOF/piped stdin as "no", so an unattended run without--yesaborts rather than destroying silently (this is what lets nf-spawn etc. drive them safely).Regression gate
TestFlagConventions(cmd/flag_conventions_test.go) walks the command tree in-process and fails on any undeprecated--jsonor any destructive verb (cancel/terminate/delete/remove/destroy) missing--yes(--confirmaccepted fornotify ... destroy).confirmYescovered byTestConfirmYes.Docs
docs/flag-conventions.mdrecords the conventions: output selector, confirmation, shorthand registry, region vs regions.Verification
go build ./...,go vet ./...,go test ./cmd/all green.