Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Smart Token Budgeting & Large Diff Truncation for Large Commits

Đang mở
#183 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
5/5
Thời gian dự kiến
Hơn một tuần
Mức phù hợp với người mới
45/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
git, go
Lĩnh vực
ai, cli, tooling

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement

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
  1. 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.
  2. 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]).
  3. 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).
  4. Testing & Validation:

    • Add unit tests in internal/git for diff truncation and lockfile collapsing logic.
    • Verify behavior against mock large diff inputs.
Ngôn ngữ chính
Go
Star
0
Fork
0
Merge trung bình
7 giờ 59 phút
Pull request đã merge (30 ngày)
9

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của rm-hull/git-commit-summary

Tất cả issue của rm-hull/git-commit-summary

Issue tương tự

Thêm issue về Go

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.