/askrobots_commitgen

AI-Powered Git Commit Message Generator

Primary LanguagePythonMIT LicenseMIT

AskRobotsCommitGen

Overview

AskRobotsCommitGen is an AI-powered tool designed to generate meaningful git commit messages. It leverages OpenAI's GPT model to analyze your git diffs and suggest concise, relevant commit messages. The tool can now automatically commit changes with the generated message.

Additionally, it includes a command to modify existing files with AI, running like ar-ai-modify notes.txt "Make a list of the most common git commands used by django devs". This offers an effective method to edit files for Django developers streamlining their workflow with common git commands.

Features

  • AI-powered commit message generation.
  • Easy integration with existing git workflows.
  • Option to automatically commit changes with the AI-generated message.
  • AI-powered file modification with specific instructions.
  • Customizable message formats.

Prerequisites

  • Python 3.7 or higher
  • Git

Installation

Clone the repository:

git clone https://github.com/yourusername/askrobots_commitgen.git
cd askrobots_commitgen

Install the required dependencies:

pip install -r requirements.txt

Configuration

Set up your OpenAI API key in an environment variable:

export OPENAI_API_KEY='your-api-key'

Option alias in .zshrc to give a shortcut for running instead of "python path-to-commitgen/main.py" you run "commitgen"

alias commitgen='python ~/IdeaProjects/askrobots_commitgen/main.py'

Usage

Run the script in your git repository:

To automatically commit changes with the AI-generated message:

python main.py

To only display the generated commit message without committing:

python main.py --show-only

To modify a file with AI, run the following command:

ar-ai-modify notes.txt "Make a list of the most common git commands used by django devs"

Contributing

Contributions to AskRobotsCommitGen are welcome! Please read our contributing guidelines for details on how to contribute.

License

AskRobotsCommitGen is open-sourced software licensed under the MIT license.

Contact

For questions or feedback, please reach out to dan@quellhorst.com.

Acknowledgments

  • This project is inspired by aicommit.
  • Thanks to OpenAI for providing the GPT API.