Commit is a command-line tool that leverages AI (Claude and Gemini) to generate meaningful, conventional commit messages by analyzing your git diffs. It helps maintain consistent commit message formatting across your projects while saving time and ensuring clarity.
- Generate conventional commit messages using AI (Claude or Gemini)
- Interactive mode enabled by default with multiple commit message suggestions
- Auto-staging of changes enabled by default
- Smart analysis of repository context and recent commit history
- Beautiful CLI interface with color-coded output
- Follows Conventional Commits specification
- Detailed analysis of changes and their impact
- Seamless integration with your git workflow
- Ability to cancel interactive commits with empty messages
- Clean process exit after successful commits
- Bun runtime installed
- Git initialized repository
- Anthropic API key (for Claude AI) or Google API key (for Gemini AI)
- Clone the repository:
git clone https://github.com/muhammedsamal/commit.git
cd commit
- Install dependencies:
bun install
- Set up your environment variables:
# Create .env.local file
# For Claude AI
echo "ANTHROPIC_API_KEY=your_api_key_here" > .env.local
# For Gemini AI
echo "GOOGLE_API_KEY=your_api_key_here" >> .env.local
- Build and install globally:
bun run build
# Generate commit message (interactive mode and auto-staging enabled by default)
commit
# Use only staged changes without auto-staging
commit -s
# Change AI model to Gemini
commit --model gemini
Options:
-s, --staged Use staged changes only (default: false)
-n, --non-interactive Disable interactive mode
--model <model> Choose AI model (claude/gemini)
-h, --help Display help information
-v, --version Display version information
Interactive mode is now enabled by default and provides:
- Multiple commit message suggestions
- Detailed analysis of changes
- Option to review changes
- Confirmation before committing
- Ability to cancel commit with empty message
- Clean exit after successful commit
- When you run the command, the tool:
- Auto-stages all changes by default
- Collects git diff information
- Gathers repository context and recent commit history
- Sends information to selected AI model (Claude or Gemini)
- Generates multiple commit message options
- Handles the commit process interactively
- Exits cleanly after successful commit
[Rest of the README remains the same from "The generated messages follow..." section onwards]
Environment variables:
ANTHROPIC_API_KEY
: Your Anthropic API key (for Claude AI)GOOGLE_API_KEY
: Your Google API key (for Gemini AI)
[Rest of the sections remain the same]
The tool provides helpful error messages for common issues:
- Not a git repository
- No staged changes
- Git user not configured
- API key missing
- Network issues
- Invalid commands
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the Project
- Create your Feature Branch:
git checkout -b feature/amazing-feature
- Commit your Changes:
git commit -am 'feat: add amazing feature'
- Push to the Branch:
git push origin feature/amazing-feature
- Open a Pull Request
To start development:
# Install dependencies
bun install
# Run in development mode
bun run start
# Build the project
bun run build
This project is licensed under the MIT License - see the LICENSE file for details.
- Anthropic's Claude for AI capabilities
- Conventional Commits for commit message specification
- Commander.js for CLI framework
If you encounter any issues or have questions:
- Check the error messages for helpful suggestions
- Review the documentation above
- File an issue on the GitHub repository