A VS Code extension that generates commit messages using AI based on your current changes.
Features
Adds a button in the Source Control view to generate commit messages
Uses OpenRouter AI to analyze your changes and generate meaningful commit messages
Automatically fills the commit message input
Configurable AI model selection
Customizable prompt template for generating commit messages
Follows conventional commit format by default
Requirements
You need an OpenRouter API key to use this extension. Get one at OpenRouter.
Extension Settings
This extension contributes the following settings:
aiCommit.openRouterApiKey: Your OpenRouter API key
aiCommit.model: The AI model to use (e.g., "anthropic/claude-3-sonnet", "mistralai/mistral-7b-instruct")
aiCommit.prompt: Custom prompt template for generating commit messages. Uses {changes} as a placeholder for the git diff.
Default Prompt
The default prompt is configured to generate conventional commit messages:
Given these staged changes:
{changes}
Generate a commit message that follows these rules:
1. Start with a type (feat/fix/docs)
2. Keep it under 50 characters
3. Use imperative mood
You can customize this prompt in the settings to match your team's commit message style.
Setup
Install the extension
Get an API key from OpenRouter
Open VS Code Settings
Search for "AI Commit"
Enter your OpenRouter API key
(Optional) Customize the AI model and prompt template
Usage
Make changes to your code
Stage your changes in Git
Click the "Generate Commit Message" button above the commit message input
The AI-generated message will automatically fill the commit message input
Edit the message if needed and commit as usual
Development
Clone the repository
Run npm install
Open in VS Code
Press F5 to start debugging
License
This project is licensed under the MIT License - see the LICENSE file for details.