Skip to content

feat(git): add unified-diff token-reduction controls#16

Merged
mcarvin8 merged 2 commits into
mainfrom
unified-diff-token-controls
Apr 23, 2026
Merged

feat(git): add unified-diff token-reduction controls#16
mcarvin8 merged 2 commits into
mainfrom
unified-diff-token-controls

Conversation

@mcarvin8
Copy link
Copy Markdown
Owner

Adds opt-in shaping on summarizeGitDiff / getDiff to cut LLM token
cost while keeping the standard unified-diff format:

  • contextLines -> git diff -U
  • ignoreWhitespace -> git diff -w (also applied to --numstat/--name-status)
  • stripDiffPreamble -> drop diff --git/index/mode/similarity/rename/copy lines
  • maxHunkLines -> elide oversized hunk bodies, keep @@ header
  • excludeDefaultNoise -> merge DEFAULT_NOISE_EXCLUDES into excludeFolders

Exports DiffShapingOptions, buildDiffShapingGitArgs, shapeUnifiedDiff,
and DEFAULT_NOISE_EXCLUDES. No behavior change when options are omitted.

Adds opt-in shaping on summarizeGitDiff / getDiff to cut LLM token
cost while keeping the standard unified-diff format:

- contextLines  -> git diff -U<n>
- ignoreWhitespace -> git diff -w (also applied to --numstat/--name-status)
- stripDiffPreamble -> drop diff --git/index/mode/similarity/rename/copy lines
- maxHunkLines -> elide oversized hunk bodies, keep @@ header
- excludeDefaultNoise -> merge DEFAULT_NOISE_EXCLUDES into excludeFolders

Exports DiffShapingOptions, buildDiffShapingGitArgs, shapeUnifiedDiff,
and DEFAULT_NOISE_EXCLUDES. No behavior change when options are omitted.
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

Files with missing lines Coverage Δ
src/git/diffShaping.ts 100.00% <100.00%> (ø)
src/git/gitDiff.ts 100.00% <100.00%> (ø)
src/git/gitDiffOps.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mcarvin8 mcarvin8 merged commit cf90d99 into main Apr 23, 2026
3 of 5 checks passed
@mcarvin8 mcarvin8 deleted the unified-diff-token-controls branch April 23, 2026 20:59
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.

2 participants