Skip to main content

AI-powered automation tool for git

Project description

codecov PyPI version License: MIT

Gai is an AI-Powered Automation Tool for Git 🚀

command-line application that automates git commit messages and merge requests using AI.

Demo

✨ Features

  • Generate commit messages based on code diffs.
  • Create merge requests with AI-generated titles and descriptions.
  • Works with both GitHub and GitLab.
  • Supports Groq and Hugging Face AI interfaces.

📦 Installation

Install gai-tool via pip:

pip install gai-tool

🚀 Getting Started

  1. Navigate to your git repository:

    cd /path/to/your/git/repo
    
  2. Set API Tokens as Environment Variables:

    # Ensure you have your AI interface and GitHub/GitLab API tokens set:
    export GROQ_API_KEY='your_groq_api_key'             # If you want to use Groq's API
    export HUGGINGFACE_API_TOKEN='your_hf_api_token'    # If you want to use Hugging Face's API
    export GITHUB_TOKEN='your_github_token'             # If using GitHub
    export GITLAB_TOKEN='your_gitlab_token'             # If using GitLab
    
  3. Start Using gai-tool:

    # Generate an AI-powered commit message:
    gai commit -a
    

⚙️ Configuration

Configuration file is located at ~/.config/gai/config.yaml. Customize settings like the AI interface, temperature, and target branch.

Example configuration:

interface: huggingface
temperature: 0.7
target_branch: master

📖 Usage

gai-tool provides two main commands: commit and merge.

📝 Commit Messages

Generate an commit message:

gai commit

Options:

  • -a, --all: Stage all changes before committing.
  • -t, --temperature: Override the temperature specified in the config.
  • -i, --interface: Specify and override the AI client API to use (groq or huggingface).

Example:

# Simply
gai commit -a
# Or
gai commit -a -t 0.5 -i huggingface

🔀 Merge Requests

Create a merge request:

gai merge

Options:

  • [remote]: Specify the remote git repository (default is origin).
  • --push, -p: Push changes to remote before creating a merge request.
  • --target-branch, -tb: Specify the target branch for the merge request (default is master).
  • -t, --temperature: Override the temperature specified in the config.
  • -i, --interface: Specify and override the AI client API to use (groq or huggingface).

Example:

# Simply
gai merge -p
# Or
gai merge origin -p -tb develop -t 0.8 -i groq

🛠 Build Instructions

Build gai-tool from source:

  1. Clone the Repository:

    git clone https://github.com/Danielratmiroff/gai.git
    
  2. Navigate to the Project Directory:

    cd gai
    
  3. Create a Virtual Environment (Optional but Recommended):

    python -m venv venv
    source venv/bin/activate  # On Windows use venv\Scripts\activate
    
  4. Install Build Tools and Dependencies:

    pip install build
    pip install -r requirements.txt
    
  5. Build the Package:

    python -m build
    

    This will generate distribution files in the dist/ directory.

  6. Install the Built Package:

    pip install dist/gai_tool-0.1.0-py3-none-any.whl
    

🤝 Contributing

Contributions are welcome!

📄 License

MIT License - LICENSE.

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

gai_tool-0.2.2.tar.gz (19.1 kB view details)

Uploaded Source

Built Distribution

gai_tool-0.2.2-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file gai_tool-0.2.2.tar.gz.

File metadata

  • Download URL: gai_tool-0.2.2.tar.gz
  • Upload date:
  • Size: 19.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for gai_tool-0.2.2.tar.gz
Algorithm Hash digest
SHA256 5a3e0dc8258c35a27c2b4048c0bc29a1b75fdc351c722a83efecdef6114dd9c4
MD5 3a980dab8728ba593480f2f1a7c2d7c7
BLAKE2b-256 2cbbd9b9ab8dab07296b3919e1ed938e1ab98e99e1ab85446088e076b3c14fd9

See more details on using hashes here.

File details

Details for the file gai_tool-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: gai_tool-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 21.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for gai_tool-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 88fa02593154af482f1bd380c2ebf3d0563f340a8ebf5ed90f72868f1e7afa59
MD5 0650522d3932fd0e9f56fca645388aaa
BLAKE2b-256 ae4e88ff5a3aee590f61b1780cb4cdd7459c2ee36a9774259ed062947ac62f71

See more details on using hashes here.

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