Skip to main content

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.

ko-fi

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
  1. Go to OpenAI's website and sign up or log in.
  2. Navigate to the API section and create a new API key.
  3. Set the environment variable:
    export OPENAI_API_KEY='your-api-key-here'
    
Anthropic
  1. Go to Anthropic's website and sign up for API access.
  2. Once approved, generate an API key from your account dashboard.
  3. Set the environment variable:
    export ANTHROPIC_API_KEY='your-api-key-here'
    
AWS Bedrock
  1. Sign up for an AWS account if you don't have one.
  2. Request access to AWS Bedrock in your AWS console.
  3. 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
  1. Install Ollama on your local machine following instructions from the Ollama website.
  2. 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:

  1. Generate a commit message:

    zscribe commit <commit1> <commit2> [--refine]
    
  2. Generate a pull request description:

    zscribe pr <pr_number>
    
  3. 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

  1. Install git hooks with a specific model:

    zscribe hooks install --type both --model gpt-4
    
  2. Update the model for the commit hook:

    zscribe hooks update --type commit --model claude-3-5-sonnet-20240620
    
  3. Manually generate a commit message for the last commit:

    zscribe commit HEAD~1 HEAD
    
  4. Manually generate a pull request description for PR #42:

    zscribe pr 42
    
  5. List all available models:

    zscribe models
    
  6. 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:

  1. Fork the repository
  2. Create a new branch: git checkout -b feature-branch-name
  3. Make your changes and commit them: git commit -m 'Add some feature'
  4. Push to the branch: git push origin feature-branch-name
  5. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zscribe-0.2.0.tar.gz (15.4 kB view hashes)

Uploaded Source

Built Distribution

zscribe-0.2.0-py3-none-any.whl (21.5 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page