Skip to content

fix(scripts): validate gh flag values - #83999

Open
RerankerGuo wants to merge 1 commit into
anthropics:mainfrom
RerankerGuo:fix/validate-gh-flag-values
Open

fix(scripts): validate gh flag values#83999
RerankerGuo wants to merge 1 commit into
anthropics:mainfrom
RerankerGuo:fix/validate-gh-flag-values

Conversation

@RerankerGuo

Copy link
Copy Markdown

Summary

Reject value-taking flags that are missing their value in the restricted gh wrapper.

The parser previously left skip_next=true at end of input and forwarded incomplete commands such as gh issue list --limit. This bypassed the wrapper's argument validation and delegated the failure to gh.

Changes

  • Track which flag is waiting for a value.
  • Fail before invoking gh if input ends while a value is pending.
  • Name the incomplete flag in the error message.

Verification

  • Missing --state, --limit, and --label values each exit 1 before the gh shim is called.
  • issue list --state open --limit 20 preserves its original argv.
  • search issues bug --label=bug --limit=10 preserves --flag=value arguments.
  • issue view 123 --comments remains valid.
  • Ran bash -n scripts/gh.sh.
  • Ran git diff --check.

Scope

This PR only validates flags that require values. It does not change the allowed command or flag set.

Track value-taking flags while parsing wrapper arguments and fail with an actionable error instead of forwarding an incomplete command to gh.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant