Skip to content

fix(gh): passthrough --help/-h on pr subcommands (#1474)#1661

Open
season179 wants to merge 15 commits intortk-ai:developfrom
season179:fix/gh-pr-help-passthrough-1474
Open

fix(gh): passthrough --help/-h on pr subcommands (#1474)#1661
season179 wants to merge 15 commits intortk-ai:developfrom
season179:fix/gh-pr-help-passthrough-1474

Conversation

@season179
Copy link
Copy Markdown

Closes #1474.

rtk gh pr comment --help returns ok commented, pr edit --help returns ok edited, and pr create --help stitches ok created onto mangled help text. pr view/checks/diff --help are also broken — they error with PR number required or drop output silently. Six of nine gh pr subcommands corrupt their help output.

Cause: pr_action and pr_create fabricate confirmations from ok_confirmation() regardless of stdout; view_pr/pr_checks require a positional PR number; pr_diff runs compact_diff over non-diff text. None of them check for --help/-h.

Fix: add a has_help_flag helper next to the existing has_json_flag, and short-circuit run_pr to passthrough when the flag is present. Same family as #720 / #730 — flag-aware passthrough at the dispatcher.

Verified locally on macOS / rtk 0.38.0:

subcommand before after
comment / edit ok commented / ok edited real help
create ok created + mangled help real help
view / checks PR number required real help
diff empty stdout real help
status / merge / list ✓ already worked ✓ unchanged

-h short flag also works. Filter path for non-help calls is unaffected (rtk gh pr list -L 3 still shows the compact format).

Test plan

  • 5 unit tests on has_help_flag (long, short, absent, substring resistance, --body=--help value form)
  • cargo fmt --all && cargo clippy --all-targets -- -D unsafe_code && cargo test --all — 1691 + 5 new pass
  • Live binary check across all 9 gh pr subcommands
  • Regression sanity: filtered rtk gh pr list output unchanged

aeppling and others added 15 commits April 17, 2026 09:44
…master--components--rtk

chore(master): release 0.37.0
…master--components--rtk

chore(master): release 0.37.1
…master--components--rtk

chore(master): release 0.37.2
hotfix(cicd): add git app for release please token
hotfix(cicd): github app token for write actions
…master--components--rtk

chore(master): release 0.38.0
pr_action and pr_create fabricate ok confirmations regardless of stdout,
and view_pr/pr_checks/pr_diff assume specific output formats — all six
mangle gh's help text. Add a has_help_flag check at the top of run_pr
so --help/-h short-circuits to passthrough.
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented May 1, 2026

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
2 out of 4 committers have signed the CLA.

✅ season179
✅ aeppling
❌ rtk-release-bot[bot]
❌ github-actions[bot]
You have signed the CLA already but the status is still pending? Let us recheck it.

@pszymkowiak pszymkowiak added bug Something isn't working effort-small Quelques heures, 1 fichier filter-quality Filter produces incorrect/truncated signal good first issue Good for newcomers labels May 1, 2026
@pszymkowiak
Copy link
Copy Markdown
Collaborator

[w] wshm · Automated triage by AI

📊 Automated PR Analysis

🐛 Type bug-fix
🟢 Risk low

Summary

Fixes six of nine gh pr subcommands whose --help/-h output was corrupted by rtk filters fabricating confirmations or requiring positional args. Adds a has_help_flag helper and short-circuits run_pr to passthrough when the flag is present, letting gh print its native help text.

Review Checklist

  • Tests present
  • Breaking change
  • Docs updated

Linked issues: #1474


Analyzed automatically by wshm · This is an automated analysis, not a human review.

@dergachoff
Copy link
Copy Markdown

bumping this pr since issue is very annoying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working effort-small Quelques heures, 1 fichier filter-quality Filter produces incorrect/truncated signal good first issue Good for newcomers

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants