fix: reduce gh diff / git diff / gh api truncation (#354)#370
Merged
pszymkowiak merged 9 commits intomasterfrom Mar 6, 2026
Merged
fix: reduce gh diff / git diff / gh api truncation (#354)#370pszymkowiak merged 9 commits intomasterfrom
pszymkowiak merged 9 commits intomasterfrom
Conversation
There was a problem hiding this comment.
Pull request overview
This PR reduces over-aggressive output truncation for git diff/git show and GitHub CLI (gh) integrations, and fixes gh api output handling by switching it to passthrough so returned JSON values are preserved.
Changes:
- Increased
git::compact_diffdefaults/limits (total lines and per-hunk lines) to reduce unnecessary refetching. - Updated
rtk gh apito passthrough (removing the JSON→schema transformation that dropped values). - Improved
rtk gh pr diffandrtk gh pr viewbehavior: higher diff limit, new--no-compactpassthrough forpr diff, and passthrough forpr viewwhen users request--json/--jq/--web.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| src/git.rs | Raises diff compaction limits and adds unit tests covering the new thresholds. |
| src/gh_cmd.rs | Switches gh api to passthrough; adds gh pr diff --no-compact; respects user pr view flags by passthrough in those cases. |
| README.md | Updates the expected rtk --version example to 0.27.1. |
| CLAUDE.md | Updates the expected rtk --version example to 0.27.1. |
| ARCHITECTURE.md | Updates the documented RTK version to 0.27.1. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- compact_diff: increase max_hunk_lines 10→30, max_lines default 100→500 - gh api: passthrough instead of JSON→schema destruction - gh pr diff: add --no-compact flag + increase limit to 500 - gh pr view: passthrough when --json/--jq/--web provided by user Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
bc730f9 to
5db3c39
Compare
navidemad
pushed a commit
to navidemad/rtk
that referenced
this pull request
Mar 6, 2026
…ai#370) * fix: reduce gh diff / git diff / gh api truncation (rtk-ai#354) - compact_diff: increase max_hunk_lines 10→30, max_lines default 100→500 - gh api: passthrough instead of JSON→schema destruction - gh pr diff: add --no-compact flag + increase limit to 500 - gh pr view: passthrough when --json/--jq/--web provided by user Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * docs: update version reference 0.26.0→0.27.1 in README * docs: update version reference 0.26.0→0.27.1 in CLAUDE.md * docs: update version reference 0.26.0→0.27.1 in ARCHITECTURE.md * fix: resolve compile errors in gh_cmd.rs (type mismatches) * fix: use explicit .iter() in pr_diff loop (avoids &&[String] ambiguity) * docs: fix version reference 0.27.x→0.27.1 in README * fix: remove shadowed extra_args in view_pr (was &&[String] not iterator) --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Problem
RTK was too aggressively truncating
gh api,gh pr diff, andgit diffoutputs, forcing Claude to re-fetch multiple times and negating token savings. Two root causes:gh apiwas converting JSON to a schema (types without values), destroying all dataChanges
src/git.rscompact_diff:max_hunk_lines10 → 30compact_diff: defaultmax_lines100 → 500 (forgit diffandgit show)src/gh_cmd.rsgh api: replaced JSON→schema transformation with passthrough —gh apiis an explicit/advanced command, user knows what they asked forgh pr diff: increased limit 100 → 500; added--no-compactflag for full passthrough (gh CLI doesn't know this flag, it's stripped before forwarding)gh pr view: passthrough when user provides--json,--jq, or--web(previously forced its own--jsonfields and ignored user-requested fields)Testing
cargo test)Verification
🤖 Generated with Claude Code