1.0.2 • Published 1 year ago
git-commit-groc v1.0.2
Git Commit Message Generator
This project provides a tool to automatically generate concise and informative commit messages for your Git repository using Groq SDK. It extracts the core modifications from the diff and formats them into a commit message following the Git conventional commits pattern.
Usage
- Install this lib with npm
npm install -g git-commit-groc. - Add your Groq API key to your environment variables as
GROQ_API_KEY. - Run with the following command:
aicommit. You can optionally specify a Groq model using the-mor--modelflag, e.g.,aicommit -m llama3-groq-70b-8192-tool-use-preview.
How it works
- The script checks if it's running inside a Git repository.
- It then fetches the staged changes using
git diff --staged. - A prompt is generated based on the diff, including guidelines for creating a good commit message.
- The prompt is sent to the Groq SDK for completion.
- The generated commit message is parsed from the Groq SDK response.
- Finally, the commit message is used to commit the changes using
git commit -m.
Dependencies
yargs: For parsing command line arguments.child_process: For executing Git commands.groq-sdk: For interacting with the Groq AI model to generate commit messages.jsonrepair: For repairing potentially malformed JSON responses from the Groq SDK.
Contributing
If you have any suggestions or improvements, feel free to open an issue or submit a pull request.