Closed
Conversation
Add ParseNumstat to parse git numstat output and StagedDiffWithSummary to generate diffs that include full content for regular files but only line count summaries for lock files. This reduces noise in commit diffs when lock files have many changes.
Add tests for when only lock files are staged and when no lock files are present in the diff. These tests verify that lock file summaries are generated correctly and that regular files show their full content without lock file markers.
…t entries Removed lock files that match common suffixes (.lock, .yaml, -lock.json) to eliminate duplication. The suffix-based detection already covers these files, so maintaining them in the explicit map is unnecessary.
Add a configurable threshold (LockFileSummaryThreshold = 200 lines) to only summarize lock files with significant changes. Lock files below the threshold are now shown in full diff, improving visibility for small updates while keeping large lock file diffs manageable.
… collection Changes the lock file summary threshold from a line-count metric to a byte-size metric (150KB) that better aligns with LLM context limits. Optimizes the diff collection logic to fetch diffs once and reuse them when determining whether a file exceeds the threshold, eliminating redundant git diff calls and improving performance.
Author
|
Closing this PR as I just noticed #7 already addresses the same issue. I wasn't aware of the existing work. Thank you! |
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
[Lock file: +500 -200 lines, 153600 bytes, content omitted]This prevents token limit issues when staging large auto-generated files.
Motivation
When staging large lock files like uv.lock with thousands of lines, the LLM agent can fail due to token limits.
Lock file contents are auto-generated and not useful for commit message generation, so summarizing them reduces token usage without losing meaningful context.
Threshold
Lock files are only summarized when their diff exceeds 150KB. Smaller changes (e.g., adding a single package) retain full diff so the LLM can generate
accurate commit messages.
150KB was chosen based on:
Lock file detection
Detected by suffix pattern:
Special case: