Skip to content

IbrahimBagalwa/commit_msg_generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Commit Message Suggester CLI

A simple Rust CLI tool that suggests helpful, AI-generated commit messages based on your current git diff. Built with clap, git2, and OpenAI.


Features

  • Analyze staged changes in your Git repo
  • Generate clear, concise commit messages
  • Fully local CLI usage

How it works

This tool reads the git diff from your working directory and sends it to the OpenAI API. The AI then generates commit message suggestions based on the changes.


Installation

1. Clone the Repo

git clone https://github.com/IbrahimBagalwa/commit_msg_generator.git
cd commit_msg_generator

2. Set Up Environment

Create a .env file with your OpenAI API key:

OPENAI_API_KEY=<your-openai-key>
OPENAI_API_ENDPOINT=<your-openai-endpoint>

3. Build the Binary

cargo build --release

4. Use it Globally (optional)

sudo cp target/release/commit_msg_generator /usr/local/bin/msg-suggest

Now you can use it anywhere with:

msg-suggest --path .

Usage

  1. Make changes in your project.
  2. Stage your files:
git add .
  1. Run the CLI:
cargo run -- --path .

Or if installed globally:

msg-suggest --path .

Example Output:

Suggested Commit Messages:
1. Add user authentication check in login flow
2. Refactor login handler to improve error handling
3. Update user model with new validation rules

Pick your favorite and commit:

git commit -m "Add user authentication check in login flow"

Contributing

Feel free to contribute to the project by submitting bug reports, feature requests, or even code enhancements. Fork the repository, make your changes, and submit a pull request. Your contributions are highly appreciated.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages