Generate professional commit messages using AI (Google Gemini or AWS Bedrock) directly in VSCode.
Author: Duong Tran Quang (DTDucas) Contact: baymax.contact@gmail.com
- π€ Dual AI Support: Choose between Google Gemini or AWS Bedrock
- β¨ Smart Analysis: Analyzes staged git changes to generate appropriate commit messages
- π Strict Format: Follows conventional commit format with emojis and tags
- π― VSCode Integration: Button in Source Control panel + auto-fill commit input
- βοΈ JSON Configuration: Simple workspace-specific configuration
- π Retry Logic: Automatic retry with exponential backoff
- π¨ Format Validation: Ensures generated messages follow your exact format
The extension generates commits in this strict format:
<emoji> <type>(<scope>) [TAG]: <short message>
β¨ feat(auth) [FE]: add Google OAuth login
π fix(user) [API]: fix null response from endpoint
β»οΈ refactor(payment) [BE]: clean up retry logic
β test(button) [TEST]: add unit test for submit handler
- β¨
feat
- New features - π
fix
- Bug fixes - β»οΈ
refactor
- Code cleanup - π¦
build
- Build system - π
perf
- Performance improvements - π
docs
- Documentation - β
test
- Tests - π
style
- Code formatting - π₯
chore
- Removals - β¬οΈ
deps
- Dependency updates
[FE]
- Frontend[BE]
- Backend[API]
- API communication[DB]
- Database[DOCS]
- Documentation[CI]
- CI/CD[TEST]
- Testing
- Install the extension from VSCode Marketplace
- Create configuration file (see Configuration section)
- Stage your changes and click the sparkle button in Source Control panel
Create an ai-commit.json
file in your workspace root or .vscode/
folder:
{
"provider": "gemini",
"apis": {
"gemini": {
"apiKey": "your-gemini-api-key-here",
"model": "gemini-pro"
},
"bedrock": {
"region": "us-east-1",
"accessKeyId": "your-aws-access-key-id",
"secretAccessKey": "your-aws-secret-access-key",
"model": "anthropic.claude-3-sonnet-20240229-v1:0"
}
},
"settings": {
"autoFill": true,
"showPreview": false,
"maxRetries": 3,
"timeout": 30000
},
"customPrompt": "Focus on describing the business impact of changes when possible"
}
provider
: Choose"gemini"
or"bedrock"
- Gemini: Requires
apiKey
from Google AI Studio - Bedrock: Requires AWS
region
,accessKeyId
, andsecretAccessKey
autoFill
: Auto-fill commit message in Source Control (default:true
)showPreview
: Show preview dialog before filling (default:false
)maxRetries
: Number of retry attempts (default:3
)timeout
: Request timeout in milliseconds (default:30000
)customPrompt
: Additional instructions for the AI (optional)
- Stage your changes in the Source Control panel
- Click the sparkle β¨ button in the Source Control title bar
- The commit message will auto-fill in the input field
- Stage your changes
- Press
Ctrl+Shift+P
(orCmd+Shift+P
on Mac) - Type "Generate AI Commit" and press Enter
- Stage your changes
- Click "β¨ AI Commit" in the status bar
- VSCode 1.74.0 or higher
- Git repository
- API key for chosen provider (Gemini or Bedrock)
- Visit Google AI Studio
- Create a new API key
- Copy the key to your configuration
- Create an AWS account and enable Bedrock service
- Create IAM user with Bedrock permissions
- Generate access keys and configure your region
gemini-pro
(default)gemini-pro-vision
anthropic.claude-3-sonnet-20240229-v1:0
(default)anthropic.claude-3-haiku-20240307-v1:0
amazon.titan-text-express-v1
Make sure you have staged files before generating a commit message.
- Check your API keys and credentials
- Verify network connectivity
- Ensure your provider quotas aren't exceeded
The extension validates generated messages against the strict format. Minor issues are allowed but warned.
Run the "Open AI Commit Config" command to create a configuration file.
# Clone repository
git clone https://github.com/DTDucas/ai-commit
cd ai-commit-generator
# Install dependencies
npm install
# Compile TypeScript
npm run compile
# Watch for changes
npm run watch
- Fork the repository
- Create a feature branch
- Make your changes
- Follow the commit format used by this extension
- Submit a pull request
MIT License - see LICENSE file for details
- Initial release
- Support for Google Gemini and AWS Bedrock
- JSON configuration system
- Source Control integration
- Strict commit format validation