Smart Token Budgeting & Large Diff Truncation for Large Commits
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 45/100
調査の方向性
Start by reading the staged-diff handling in internal/git and the configuration surfaces config.env and .git-commit-summary.yaml. Use mock large diff inputs to understand the required internal/git tests. Done means oversized diffs stay within configured limits, lockfiles and generated files are collapsed, and the related configuration or CLI option is covered by tests.
索引モデルが issue の本文から書いたものです。
説明
Problem Statement
When working on large commits (such as updating dependency lockfiles (go.sum, package-lock.json), large code refactors, or bulk file additions), the raw git diff can easily exceed LLM context windows or unnecessarily consume a large number of input tokens. Currently, git-commit-summary sends the entire raw diff to the LLM provider.
Proposed Feature: Smart Token Budgeting & Large Diff Truncation
Implement a preprocessing step for staged diffs that ensures large changes fit comfortably within LLM token limits while retaining the essential semantic summary of the changes.
Detailed Outline Plan
-
Diff Statistics & Token Estimation:
- Parse the git diff output into file-level chunks (
internal/git). - Implement a lightweight token estimator (e.g., character-to-token heuristic or using a tokenizer helper) to gauge the size of each file diff.
- Parse the git diff output into file-level chunks (
-
Diff Prioritization & Truncation Strategy:
- Lockfiles & Generated Files: Automatically collapse or omit full diffs for well-known generated files / lockfiles (
go.sum,package-lock.json,pnpm-lock.yaml, minified assets), replacing them with a summary line (e.g.,... (lockfile updated: X dependencies added, Y removed)). - Code Files: If total diff exceeds a configured threshold (e.g., max token limit or max line count):
- Prioritize core logic files over documentation or tests, or truncate individual file diffs after a maximum number of hunks/lines, appending a truncation notice (e.g.,
... [diff truncated for length]).
- Prioritize core logic files over documentation or tests, or truncate individual file diffs after a maximum number of hunks/lines, appending a truncation notice (e.g.,
- Lockfiles & Generated Files: Automatically collapse or omit full diffs for well-known generated files / lockfiles (
-
Configuration & Flags:
- Add configuration options (in
config.env/.git-commit-summary.yaml) for max diff tokens / size thresholds. - Add CLI flag support if needed (e.g.,
--max-diff-tokens).
- Add configuration options (in
-
Testing & Validation:
- Add unit tests in
internal/gitfor diff truncation and lockfile collapsing logic. - Verify behavior against mock large diff inputs.
- Add unit tests in
- 主要言語
- Go
- スター
- 0
- フォーク
- 0
- 平均マージ
- 18時間 49分
- マージ済み PR(30日)
- 13
環境構築
このプロジェクトの環境構築ファイルはまだ確認していません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
rm-hull/git-commit-summary のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
rm-hull/git-commit-summary#190 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
rm-hull/git-commit-summary#189 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
rm-hull/git-commit-summary#185 ·
メンテナーはふだん 1 日以内に返信
-
enhancement
難易度 5/5 1週間以上 初心者へのやさしさ 45/100
rm-hull/git-commit-summary#184 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 35/100
rm-hull/git-commit-summary#106 ·
メンテナーはふだん 1 日以内に返信
rm-hull/git-commit-summary の issue をすべて見る
似ている issue
-
security
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
cvss-severity:high devguard l3montree-cybersecurity/...ard-k8s-image-inventory pkg:oci/devguard-k8s-ima...ch=amd64&tag=main-amd64 pkg:oci/devguard-k8s-ima...ch=arm64&tag=main-arm64 risk:low state:open
難易度 1/5 1時間未満 初心者へのやさしさ 76/100
l3montree-dev/devguard#3094 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 84/100
JuliusBrussee/caveman#1127 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
enhancement low priority
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
eugenioenko/ttt#674 ·
メンテナーはふだん 1 日以内に返信
-
kind/bug
難易度 2/5 1〜3時間 初心者へのやさしさ 86/100
gpustack/gpustack-operator#640 ·
メンテナーはふだん 1 日以内に返信