An AI-powered git commit message generator!
Project description
Description
AICommits is a Python script that generates a git commit message using OpenAI's GPT-3 language model. The script takes the git diff of the staged changes and generates a commit message using GPT-3.
The generated commit message is presented to the user who has the option to accept or reject it. If the user accepts the commit message, the script commits the changes using the generated message.
The script requires an OpenAI API key, which can be obtained from the OpenAI website.
Dependencies
Python 3.6 or higher
openai 0.10.2
inquirer 3.7.0
python-dotenv 0.19.1
Shortcomings
The script has the following shortcomings:
-
The generated commit message may not always be suitable for the changes being committed.
-
The script depends on an external service (OpenAI) and requires an API key.
-
The generated commit message may not be human-readable or make sense in the context of the changes being committed.
-
The script may generate commit messages that do not follow the best practices for writing commit messages.
However, these shortcomings can be addressed by improving the script and the model used to generate the commit messages.
Installation and Usage
To use AICommits, do the following:
- Export your OpenAI API key as an environment variable by running:
export OPENAI_API_KEY=YOUR_API_KEY
- install aicommit from pypi by running:
pip install ai_commits
Then, run the script using the command aicommit
.
The script will prompt you to confirm the generated commit message. If you accept the message, the changes will be committed using the generated message.
Install from Source
To install AICommits from source, follow these steps:
-
Clone the repository using the command git clone https://github.com/nneji123/aicommit.git.
-
Navigate to the project directory using the command
cd aicommit
. -
Install the required dependencies by running pip install -r requirements.txt.
-
Set your OpenAI API key as an environment variable by running export OPENAI_API_KEY=YOUR_API_KEY.
-
Run the script using the command
python "src/ai_commits.py"
.
The script will prompt you to confirm the generated commit message. If you accept the message, the changes will be committed using the generated message.
Changelog
v1.0.0 (2023-02-16)
-
Added support for generating commit messages in multiple languages
-
Improved performance when generating commit messages for large diffs
-
Added ability to select from multiple generated commit messages using the inquirer library
-
Fixed various bugs and improved error handling
v0.0.5 (2023-02-15)
- Fixed a bug that caused the script to fail when no changes were staged
v0.0.4 [Initial Release] (2023-02-15)
- Initial release of aicommits
- Supports generating conventional commit messages
- Supports generating commit messages based on the changes in the staged files
- Uses OpenAI's GPT-3 to generate commit messages
Contributing
Open an issue or submit a pull request if you want to contribute to the project.
License
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for ai_commits-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b3cfcf08407007d7fd105c7878ec5e138a84f4f644b05567261ca5a8909ff8af |
|
MD5 | 94434983e27f51d9ef7a15e995c23245 |
|
BLAKE2b-256 | 63a4a4a0132305fcddc0d80a83e3e5a3b84a6051ed1498162882a17e9bdfb60e |