A tool to generate commit messages and pull request descriptions using various AI providers
Project description
ZScribe 📝🤖
ZScribe is an intelligent tool that leverages AI to automatically generate meaningful commit messages and pull request descriptions. By analyzing git diffs, ZScribe provides concise and informative messages, saving developers time and improving the quality of version control documentation.
Table of Contents
Installation
To install ZScribe, use pip:
pip install zscribe
Configuration
ZScribe supports multiple AI providers through a plugin system.
Supported Models and Providers
Provider | Models |
---|---|
OpenAI | gpt-3.5-turbo , gpt-4 |
Anthropic | claude-3-5-sonnet-20240620 , claude-3-haiku-20240307 |
AWS Bedrock | anthropic.claude-v2 , ai21.j2-ultra-v1 , amazon.titan-text-express-v1 |
Ollama | llama2 , mistral-7b |
Note: Available models for AWS Bedrock may vary based on your access. Ollama models depend on your local installation.
API Keys and Configuration
OpenAI
- Go to OpenAI's website and sign up or log in.
- Navigate to the API section and create a new API key.
- Set the environment variable:
export OPENAI_API_KEY='your-api-key-here'
Anthropic
- Go to Anthropic's website and sign up for API access.
- Once approved, generate an API key from your account dashboard.
- Set the environment variable:
export ANTHROPIC_API_KEY='your-api-key-here'
AWS Bedrock
- Sign up for an AWS account if you don't have one.
- Request access to AWS Bedrock in your AWS console.
- Set up AWS CLI and configure it with your credentials:
aws configure
Or set environment variables:export AWS_ACCESS_KEY_ID='your-access-key' export AWS_SECRET_ACCESS_KEY='your-secret-key' export AWS_DEFAULT_REGION='your-preferred-region'
Ollama
- Install Ollama on your local machine following instructions from the Ollama website.
- No API key is required as Ollama runs locally.
Usage
ZScribe is designed to work automatically through git hooks, but also provides options for manual usage via the command-line interface.
Automatic Usage with Git Hooks
Once installed and configured, ZScribe can automatically generate commit messages and pull request descriptions using git hooks.
To set up the git hooks:
zscribe hooks install --type both --model <your-chosen-model>
This will install both commit and pull request hooks, using the specified model for both.
After installation, ZScribe will automatically:
- Generate a commit message when you make a commit (you can edit this message before finalizing the commit)
- Generate a pull request description when you create a new pull request
Manual Usage
While git hooks provide automatic functionality, you can also use ZScribe manually:
-
Generate a commit message:
zscribe commit <commit1> <commit2> [--refine]
-
Generate a pull request description:
zscribe pr <pr_number>
-
List available models:
zscribe models
Note: For manual invocations, you can use the
ZSCRIBE_MODEL
environment variable to specify the model:export ZSCRIBE_MODEL='gpt-4' zscribe commit HEAD~1 HEAD
Managing Models
It's important to note that the model used by git hooks is separate from the one used for manual invocations.
-
To update the model used by git hooks:
zscribe hooks update --type {commit|pr|both} --model <new-model>
-
The
ZSCRIBE_MODEL
environment variable is only used for manual invocations and does not affect git hooks.
Always use the command-line interface to update the model for hooks. The ZSCRIBE_MODEL
environment variable does not affect the model used by git hooks.
Examples
-
Install git hooks with a specific model:
zscribe hooks install --type both --model gpt-4
-
Update the model for the commit hook:
zscribe hooks update --type commit --model claude-3-5-sonnet-20240620
-
Manually generate a commit message for the last commit:
zscribe commit HEAD~1 HEAD
-
Manually generate a pull request description for PR #42:
zscribe pr 42
-
List all available models:
zscribe models
-
Manually generate a commit message using a specific model (does not affect git hooks):
ZSCRIBE_MODEL=gpt-4 zscribe commit HEAD~1 HEAD
Contributing
Contributions to ZScribe are welcome! Here's how you can contribute:
- Fork the repository
- Create a new branch:
git checkout -b feature-branch-name
- Make your changes and commit them:
git commit -m 'Add some feature'
- Push to the branch:
git push origin feature-branch-name
- Submit a pull request
Please make sure to update tests as appropriate and adhere to the project's coding standards.
Made with ❤️ by Zithco. Happy coding! 🚀
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.