Skip to content

Enhance context for AI commit messages#11

Merged
PatrickRuddiman merged 4 commits intomainfrom
codex/implement-context-gathering-for-ai-commit-messages
Jul 7, 2025
Merged

Enhance context for AI commit messages#11
PatrickRuddiman merged 4 commits intomainfrom
codex/implement-context-gathering-for-ai-commit-messages

Conversation

@PatrickRuddiman
Copy link
Owner

Summary

  • provide extra context lines around small diffs
  • expose new GetStagedChangesWithContextAsync helper
  • mention context-aware behaviour in README

Testing

  • dotnet restore Write-Commit.sln
  • dotnet build Write-Commit.sln --no-restore

https://chatgpt.com/codex/tasks/task_e_686bd644abd8832aafc6716082708f2d

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR enhances the commit message generation tool by adding context-aware diff support, allowing small diffs to include surrounding lines for better AI summaries.

  • Expose a new GetStagedChangesWithContextAsync helper for adjustable unified context
  • Update Program.cs to detect small diffs and fetch extra context lines when needed
  • Update README.md to mention the new context-aware feature

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
Services/GitService.cs Added GetStagedChangesWithContextAsync and updated GetStagedChangesAsync to accept a verbose flag
README.md Documented the context-aware feature
Program.cs Detects small diffs (≤2 files, <20 lines) and invokes the new helper
Comments suppressed due to low confidence (2)

Services/GitService.cs:31

  • Add unit tests to cover GetStagedChangesWithContextAsync to ensure the new context-aware diff behavior is verified.
    public async Task<string> GetStagedChangesWithContextAsync(int contextLines, bool verbose = false)

README.md:14

  • [nitpick] Consider updating the Quick Start or Usage section to explain how to configure the number of context lines and how to enable context-aware behavior in the CLI.
- 🔍 **Context-aware** - Adds surrounding code lines when diffs are very small for better summaries

PatrickRuddiman and others added 3 commits July 7, 2025 10:25
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@PatrickRuddiman PatrickRuddiman merged commit 335b6c5 into main Jul 7, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments