Description AI Commit is a command-line tool that automates the process of generating commit messages based on changes made to a Git repository using OpenAI's language models. It uses the Git diff command to get the changes, sends them to the OpenAI API, and receives a commit message suggestion in response. The script then amends the most recent Git commit with the generated commit message. This can save time and effort when committing changes to a Git repository, as it removes the need to manually write commit messages for each change.
aicommit: Show the commit message and exit.aicommit commit: Commit using an AI-generated commit message.
-h, --help: Show this help message and exit.--prefix: Specify the type of commit (i.e. fix, feat, refactor, ticket number) to override the auto type. Default: auto.--max_tokens: Controls the maximum number of tokens to generate in the text completion task. Default: 100.-p, --prompt: Shows the prompt. "-r, --response: Shows the response from OpenAI in json format. "-d, --debug: Debug.--language: Language for generated commit messages. Overrides the value of the system localLANGenvironment variable. Default:<system local>.
- Clone the repository:
git clone https://github.com/username/aicommit.git - Navigate to the directory:
cd aicommit - Make the script executable:
chmod +x aicommit - Add a PATH to your .bashrc or .bash_profile file:
echo "export PATH=\$PATH:$(pwd)" >> ~/.zshrc - Run the following command in your terminal, replacing yourkey with your API key
echo "export OPENAI_API_KEY='yourkey'" >> ~/.zshrc - Refresh your shell environment:
source ~/.zshrc - Run the script:
./aicommit --help
Congratulations, you've successfully installed AI Commit! You can now run the aicommit command from anywhere in your terminal.