Skip to content

AI-powered CLI tool that generates conventional commit messages using Cohere or Deepseek API. Analyzes git changes to create standardized, meaningful commit messages.

Notifications You must be signed in to change notification settings

VassoD/commit-message-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Commit Message Generator

An AI-powered CLI tool for generating concise, meaningful, and conventional git commit messages based on your staged changes. This tool supports both Cohere AI (free tier available) and Deepseek AI (paid, better performance) to analyze your changes and output standardized commit messages that follow the conventional commit format.

Note: All commits in this repository are currently AI-generated using this tool, serving as a real-world demonstration of its capabilities and performance history.

Features ✨

  • AI-powered commit message generation with choice of providers:
    • Cohere AI (free tier available, default)
    • Deepseek AI (paid, better performance)
  • Adheres to the conventional commits format
  • Provides detailed change statistics
  • Works seamlessly with any git repository

Prerequisites 📋

  • Node.js >= 16
  • Git installed and configured
  • One of the following API keys:

Installation 🚀

  1. Clone the repository:

    git clone https://github.com/yourusername/commit-message-generator.git
  2. Install dependencies:

    cd commit-message-generator
    npm install
  3. Set up your API keys:

    # Create a .env file and add your API key(s)
    # For Cohere (free tier, default)
    echo "COHERE_API_KEY=your-cohere-key-here" > .env
    # For Deepseek (paid, optional)
    echo "DEEPSEEK_API_KEY=your-deepseek-key-here" >> .env
  4. Install globally:

    npm install -g .

Usage 🛠️

First, stage your changes:

git add .  # or specific files

Then, generate a commit message using one of these options:

  1. Basic usage (uses Cohere by default):
commit-gen
  1. Using Deepseek provider:
commit-gen --provider deepseek
# or shorter
commit-gen -p deepseek
  1. With detailed statistics:
# With Cohere (default)
commit-gen --detailed

# With Deepseek
commit-gen --detailed --provider deepseek

Example outputs:

$ commit-gen
Suggested commit message:
feat(auth): add user authentication

$ commit-gen --detailed --provider deepseek
Suggested commit message:
fix(api): resolve bugs in endpoint validation
Change statistics:
Files changed: 3
Lines added: 45
Lines deleted: 12

Development 👩‍💻

  1. Clone the repo
  2. Install dependencies:
npm install
  1. Create your .env file with at least one provider:
# For Cohere (free tier, default)
echo "COHERE_API_KEY=your-cohere-key" > .env
# For Deepseek (paid, optional)
echo "DEEPSEEK_API_KEY=your-deepseek-key" >> .env
  1. Link the package locally:
npm link
  1. Make your changes
  2. Test with:
commit-gen  # for Cohere
# or
commit-gen --provider deepseek  # for Deepseek

Contributing 🤝

  1. Fork the repository
  2. Create your feature branch
  3. Make your changes
  4. Submit a pull request

License 📄

MIT

Support 💬

If you have any questions or run into issues, please open an issue in the GitHub repository.

Tips 💡

  • Stage related changes together for more coherent commit messages
  • Use git add -p to stage specific chunks for more focused commits
  • If you don't like a generated message, just run the command again
  • The more context in your changes, the better the message will be
  • Try both providers to see which gives better results for your use case

About

AI-powered CLI tool that generates conventional commit messages using Cohere or Deepseek API. Analyzes git changes to create standardized, meaningful commit messages.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published