[ ] If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
[ ] Docs have been updated if necessary
[ ] You've read through your own file changes for silly mistakes etc
This PR adds the ability to generate commit messages using AI, primarily through GitHub Copilot integration, with potential support for OpenAI-compatible APIs.
Background
This aims to implement #3763, adding AI-assisted commit message generation similar to VS Code's Copilot feature.
While the GitHub Copilot API is not officially public, the implementation doesn't appear to violate the terms of service. However, I understand introducing AI features like this may be a significant direction change for the project, so I'm open to discussion about whether this aligns with lazygit's goals.
This initial scope focuses solely on commit message generation to keep the implementation focused and manageable. Future possibilities like generating release notes, improving squash commit messages, or crafting PR descriptions could be considered later once this core functionality is proven.
The implementation is based on the flow from Zed and Copilot.lua.
I would appreciate some feedback on both the implementation approach and whether this feature could be added to the project.
Current Implementation Status
This is very much a work in progress. Just a proof of concept at the moment
[x] GitHub Copilot authentication via device codes
[x] Chat completion
[ ] Support for generic OpenAI-compatible APIs
[ ] Support for other providers (Antropic, Geminni, Ollama)
[ ] Diff extraction and processing
[ ] Commit message style consistency
[ ] Large diff handling (according to the model size)
[ ] Model selection configuration (UserConfig?)
Proposed configuration
git:
commitSuggestions:
enabled: true
provider: "github-copilot" # or "openai-compatible"
modelName: "gpt-4o" # for openai-compatible
maxDiffSize: 4096 # tokens
endpoint: "http://localhost:8080" # for self or openai compatible
Note: Tests and documentation will be added as the implementation progresses.
PR Description
Please check if the PR fulfills these requirements
[ ] Cheatsheets are up-to-date (run
go generate ./...
)[ ] Code has been formatted (see here)
[ ] Tests have been added/updated (see here for the integration test guide)
[ ] Text is internationalised (see here)
[ ] If a new UserConfig entry was added, make sure it can be hot-reloaded (see here)
[ ] Docs have been updated if necessary
[ ] You've read through your own file changes for silly mistakes etc
This PR adds the ability to generate commit messages using AI, primarily through GitHub Copilot integration, with potential support for OpenAI-compatible APIs.
Background
This aims to implement #3763, adding AI-assisted commit message generation similar to VS Code's Copilot feature.
While the GitHub Copilot API is not officially public, the implementation doesn't appear to violate the terms of service. However, I understand introducing AI features like this may be a significant direction change for the project, so I'm open to discussion about whether this aligns with lazygit's goals.
This initial scope focuses solely on commit message generation to keep the implementation focused and manageable. Future possibilities like generating release notes, improving squash commit messages, or crafting PR descriptions could be considered later once this core functionality is proven.
The implementation is based on the flow from
Zed
andCopilot.lua
.I would appreciate some feedback on both the implementation approach and whether this feature could be added to the project.
Current Implementation Status
This is very much a work in progress. Just a proof of concept at the moment
Proposed configuration