-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Feature Request: Auto-generate commit summary with AI integration (e.g., Cursor/opencode) #5461
Description
Description
Currently, when committing changes in Lazygit, users have to manually write commit messages. It would be great if Lazygit could integrate with AI services (like Cursor, opencode, or local LLMs) to auto-generate commit summaries based on the staged changes.
like Cursor:
Use Case
When commit code in Lazygit, a user could:
- Stage files as usual
- Press a key (e.g.,
Ctrl+Gor a dedicated button) to generate a commit message - Lazygit sends the staged diff to an AI service (or local model) and returns a suggested summary
- User can review, edit, and accept the message
This would save significant time, especially for:
- Developers who make frequent commits
- Teams requiring standardized commit message formats
- Users who struggle to write concise, descriptive commit messages
Suggested Implementation
Option A: External CLI Integration
Allow Lazygit to call an external command/script that:
- Receives the staged diff (or file list) as input
- Returns a commit message
- Example:
lazygit-commit-helpercould be user-configurable to callgit diff --staged | ai-summarize
Option B: Built-in AI Integration
Add optional configuration to Lazygit's config.yml:
ai:
provider: "openai" # or "anthropic", "local"
api_key: "your-key"
model: "gpt-4o-mini"
prompt_template: "Generate a concise commit message for these changes:"Option C: Simple LLM-friendly Output Mode
Add a flag/mode where Lazygit outputs the staged diff to stdout so it can be piped to an AI tool:
lazygit --print-staged-diff | ai-summarizeWhy This Matters
- Productivity: Reduces context switching between terminal and Lazygit
- Consistency: Helps enforce conventional commit formats
- Accessibility: Helps users who struggle with writing commit messages
Related
This is similar to features in other Git tools:
- GitLens (VS Code) has "AI Generate Commit Message"
- GitKraken has "AI Commit Message" (paid feature)
- Many CLI tools now offer AI-powered commit helpers
Potential Challenges
- API key management (should be user's responsibility)
- Network latency (could be optional/off by default)
- Cost concerns (should be opt-in)
Would the maintainers be open to this feature? Happy to help discuss implementation details or submit a PR if there's interest.