fix: passthrough gh commands when --json flag is present#325
Closed
rursache wants to merge 1 commit intortk-ai:masterfrom
Closed
fix: passthrough gh commands when --json flag is present#325rursache wants to merge 1 commit intortk-ai:masterfrom
rursache wants to merge 1 commit intortk-ai:masterfrom
Conversation
When users run `rtk gh pr view --json number,url`, RTK was interpreting `--json` as a PR number and then adding its own `--json` with hardcoded fields, causing "Unknown JSON field" errors. Now detect `--json` in args early and passthrough to gh directly, since the user explicitly wants specific JSON fields rather than RTK's filtered output. Fixes #313
5 tasks
Collaborator
|
Hi @jackfreem, @rursache! We have several PRs tackling gh flag passthrough (#196, #217, #319, #325, #328) — they all touch |
This was referenced Mar 5, 2026
Contributor
Author
|
Closing in favor of #328, which already includes the |
This was referenced Mar 5, 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.
Summary
--jsonis present in args to anyrtk ghsubcommand (pr,issue,run,repo), passthrough directly toghinstead of applying RTK filteringrtk gh pr view --json number,urlwould interpret--jsonas the PR number and then add its own--jsonwith hardcoded fields, causingUnknown JSON field: "--json"errorsrun(), so it covers all gh subcommands uniformlyFixes #313
Test plan
test_has_json_flag_present— verifies--jsonis detected in argstest_has_json_flag_absent— verifies no false positivestest_has_json_flag_in_pr_args— verifies detection with mixed argsrtk gh pr view --json number,urlno longer errors