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 details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

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

Uploaded Python 3

File details

Details for the file zscribe-0.2.0.tar.gz.

File metadata

  • Download URL: zscribe-0.2.0.tar.gz
  • Upload date:
  • Size: 15.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for zscribe-0.2.0.tar.gz
Algorithm Hash digest
SHA256 80abeeb55217ff80fc3bcb92f9bd85c199854502b2cd46d72c76e1fd57b1aa93
MD5 da6120df674214de09a3d21f1ae2cf81
BLAKE2b-256 6de10e4c1f95150285c73e559f106314d7a718f01881195668a269ff8694ef72

See more details on using hashes here.

File details

Details for the file zscribe-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: zscribe-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 21.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for zscribe-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d7c1900b54d3cfb2490b3ad5dbefcdd2cbe07f738e38c2f99b9f3c28e5c7a0f9
MD5 62595dca3b06aecbb7b723f03c6c9ab2
BLAKE2b-256 369b96db19971d392418774fdcde993f1f33449a4b93dd9232c4db19b4c956f4

See more details on using hashes here.

Supported by

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