Skip to content

feat: pass current git branch into commit LLM context - #145

Merged
anjerodev merged 1 commit into
mainfrom
cursor/branch-context-commit-llm-da31
Sep 11, 2026
Merged

anjerodev merged 1 commit into
mainfrom
cursor/branch-context-commit-llm-da31

Conversation

@anjerodev

Copy link
Copy Markdown
Owner

Closes #126.

Summary

Commit-message generation now includes the current git branch name as optional LLM context (from repo.state.HEAD?.name).

Changes

  • Thread branch name from createCommitMessage through getCommitMessage / generateStructuredCommit
  • Include branch in the chat user message (wrapped as untrusted); note detached/unnamed HEAD when missing
  • Prompt rules: branch may inform ticket/feature naming, but messages must still be grounded in staged summaries
  • Tests cover branch wrapping, detached HEAD, and end-to-end payload plumbing

No version bump / Release label — feature-only change; release can follow existing version-bump workflow when desired.

Test plan

  • pnpm lint
  • pnpm test (48 passing)
  • Focused --grep branch (5 passing)
Open in Web Open in Cursor 

Pass HEAD branch name into commit-message generation so the model can use
ticket/feature cues while still grounding messages in staged summaries.
Handles detached HEAD and wraps branch names as untrusted prompt content.

Co-authored-by: Antonio Jesús <hello@anjero.dev>
@anjerodev
anjerodev marked this pull request as ready for review September 11, 2026 07:14
@anjerodev
anjerodev merged commit 4442fdc into main Sep 11, 2026
1 check passed
@anjerodev
anjerodev deleted the cursor/branch-context-commit-llm-da31 branch September 11, 2026 07:14
@anjerodev anjerodev mentioned this pull request Sep 11, 2026
5 tasks
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.

Does LLM has current branch name as a context for generating messages?

2 participants