refactor: scope the access-token required-flag skip per command - #748
Open
ffantl-ld wants to merge 2 commits into
Open
refactor: scope the access-token required-flag skip per command#748ffantl-ld wants to merge 2 commits into
ffantl-ld wants to merge 2 commits into
Conversation
This was referenced Jul 22, 2026
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
ffantl-ld
force-pushed
the
ffantl/prerun-flag-skip
branch
from
July 23, 2026 15:15
3d1d7ad to
fcf935d
Compare
ffantl-ld
marked this pull request as ready for review
July 27, 2026 17:23
ffantl-ld
requested review from
a team,
Vadman97 and
erangeles
and removed request for
Vadman97
July 27, 2026 17:23
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.
Describe the solution you've provided
Commands that don't need an API token (
completion,config,help,login,signup,whoami) previously skipped the required--access-tokencheck by settingDisableFlagParsing = true. That also suppressed validation of the subcommand's own required flags.This clears the
--access-tokenrequired annotation on the specific flag instead, so those commands still parse and validate their own flags.Related issues
Groundwork for the guided
setupcommand (which also needs to run without a token). Split out so it can land and release on its own merit.Additional context
Behavior-only change to
cmd/root.go; no new packages.Note
Low Risk
Single-file CLI bootstrap change; behavior is narrower than before (more flag validation), with no auth or API logic changes.
Overview
Auth-exempt commands (
completion,config,help,login,signup,whoami) no longer skip flag handling withDisableFlagParsing. Instead,PersistentPreRuncallsclearAccessTokenRequirement, which walks the command chain and removes Cobra’s required annotation (BashCompOneRequiredFlag) from--access-tokenwhen an exempt command is in the path.That keeps those commands runnable without a token while subcommands still parse and validate their own required flags, which
DisableFlagParsingblocked.Reviewed by Cursor Bugbot for commit a266914. Bugbot is set up for automated code reviews on this repo. Configure here.