Skip to main content

AI-Powered Automation Tool for Git 🚀

Project description

codecov PyPI version License: MIT

Gai is a CLI 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. Set API Tokens as Environment Variables:

    # Ensure you have your AI interface and GitHub/GitLab API tokens set:
    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
    

Supported interfaces:

  • Groq (GROQ_API_KEY)
  • Hugging Face (HUGGINGFACE_API_TOKEN)
  • Gemini (GOOGLE_API_KEY)
  • Ollama (OLLAMA_API_KEY)
  1. Navigate to your git repository:

    cd /path/to/your/git/repo
    
  2. 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.

You can also initialize a local configuration file in your project directory:

gai init

This will create a .gai.yaml file in your current directory with your current settings. Local configuration takes precedence over global configuration.

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 -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 -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-<VERSION>-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.4.0.tar.gz (17.9 kB view details)

Uploaded Source

Built Distribution

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

gai_tool-0.4.0-py3-none-any.whl (23.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: gai_tool-0.4.0.tar.gz
  • Upload date:
  • Size: 17.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.3 Linux/6.8.0-60-generic

File hashes

Hashes for gai_tool-0.4.0.tar.gz
Algorithm Hash digest
SHA256 15c550b7bb08e384c3072f27b1f12509edec2af0e44306b52393ff96a9c25c21
MD5 12c06105de2cbf926a1ad23649b525c5
BLAKE2b-256 beb684bd1a9079db33fa9c6f7ba0c0ff87a8626d6dd42c5d818d4fa61bd9f136

See more details on using hashes here.

File details

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

File metadata

  • Download URL: gai_tool-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 23.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/2.1.3 CPython/3.12.3 Linux/6.8.0-60-generic

File hashes

Hashes for gai_tool-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d6fe18be3171b46b993c428a2ecf8ebf5c50e495f486b9d33d9239d4ebeb4e1c
MD5 226b97cb4dfb5e33017dcf2ec4370eef
BLAKE2b-256 453d104e4969ae225f35546c05c7aeed13cb06cb33855a7ecb4823b4794ef76c

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