gai-tool


Namegai-tool JSON
Version 0.5.3 PyPI version JSON
download
home_pageNone
SummaryAI-Powered Automation Tool for Git 🚀
upload_time2025-07-16 06:43:50
maintainerNone
docs_urlNone
authorDaniel Ratmiroff
requires_python<4.0,>=3.12
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            ![codecov](https://codecov.io/gh/Danielratmiroff/gai/branch/master/graph/badge.svg)
[![PyPI version](https://badge.fury.io/py/gai-tool.svg)](https://badge.fury.io/py/gai-tool)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

# Gai is a CLI Automation Tool for Git 🚀

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

![Demo](resources/video_demo.gif)

## ✨ Features

- Generate commit messages based on code diffs.
- Create merge requests with AI-generated titles and descriptions.
- Works with both GitHub and GitLab.

## 📦 Installation

Install gai-tool via pip:

```bash
pip install gai-tool
```

## 🚀 Getting Started

1. **Set API Tokens as Environment Variables**:

   ```bash
   # 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 (GEMINI_API_KEY or GOOGLE_API_KEY) -- Gemini takes precedence when both are set.
- Ollama (OLLAMA_API_KEY)

2. **Navigate to your git repository**:

   ```bash
   cd /path/to/your/git/repo
   ```

3. **Start Using gai-tool**:

   ```bash
   # 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:

```bash
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:

```yaml
interface: huggingface
temperature: 0.7
target_branch: master
```

### Customizing AI Behavior

You can customize the AI's behavior by editing the `your-project-name/.gai/gai-rules.md` file, which is created when you run `gai init`. These rules are injected into the AI's system prompt.

For a detailed guide, see [Customizing AI Behavior with Rules](./docs/customizing-ai-rules.md).

## 📖 Usage

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

### 📝 Commit Messages

Generate an commit message:

```bash
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**:

```bash
# Simply
gai commit -a
# Or
gai commit -a -i huggingface
```

### 🔀 Merge Requests

Create a merge request:

```bash
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**:

```bash
# Simply
gai merge -p
# Or
gai merge origin --push --target-branch develop -interface groq
```

## 🛠 Build Instructions

Build gai-tool from source:

1. **Clone the Repository**:

   ```bash
   git clone https://github.com/Danielratmiroff/gai.git
   ```

2. **Navigate to the Project Directory**:

   ```bash
   cd gai
   ```

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

   ```bash
   python -m venv venv
   source venv/bin/activate  # On Windows use venv\Scripts\activate
   ```

4. **Install Build Tools and Dependencies**:

   ```bash
   pip install build
   pip install -r requirements.txt
   ```

5. **Build the Package**:

   ```bash
   python -m build
   ```

   This will generate distribution files in the `dist/` directory.

6. **Install the Built Package**:

   ```bash
   pip install dist/gai_tool-<VERSION>-py3-none-any.whl
   ```

## 🤝 Contributing

Contributions are welcome!

## 📄 License

MIT License - [LICENSE](LICENSE).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "gai-tool",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.12",
    "maintainer_email": null,
    "keywords": null,
    "author": "Daniel Ratmiroff",
    "author_email": "danielratmiroff@pm.me",
    "download_url": "https://files.pythonhosted.org/packages/19/98/408f7aa13017122e46fc327c8f6bf09dadd238bf2cc5c764d0fbcbc10b1a/gai_tool-0.5.3.tar.gz",
    "platform": null,
    "description": "![codecov](https://codecov.io/gh/Danielratmiroff/gai/branch/master/graph/badge.svg)\n[![PyPI version](https://badge.fury.io/py/gai-tool.svg)](https://badge.fury.io/py/gai-tool)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n\n# Gai is a CLI Automation Tool for Git \ud83d\ude80\n\ncommand-line application that automates git commit messages and merge requests using AI.\n\n![Demo](resources/video_demo.gif)\n\n## \u2728 Features\n\n- Generate commit messages based on code diffs.\n- Create merge requests with AI-generated titles and descriptions.\n- Works with both GitHub and GitLab.\n\n## \ud83d\udce6 Installation\n\nInstall gai-tool via pip:\n\n```bash\npip install gai-tool\n```\n\n## \ud83d\ude80 Getting Started\n\n1. **Set API Tokens as Environment Variables**:\n\n   ```bash\n   # Ensure you have your AI interface and GitHub/GitLab API tokens set:\n   export HUGGINGFACE_API_TOKEN='your_hf_api_token'    # If you want to use Hugging Face's API\n   export GITHUB_TOKEN='your_github_token'             # If using GitHub\n   export GITLAB_TOKEN='your_gitlab_token'             # If using GitLab\n   ```\n\nSupported interfaces:\n\n- Groq (GROQ_API_KEY)\n- Hugging Face (HUGGINGFACE_API_TOKEN)\n- Gemini (GEMINI_API_KEY or GOOGLE_API_KEY) -- Gemini takes precedence when both are set.\n- Ollama (OLLAMA_API_KEY)\n\n2. **Navigate to your git repository**:\n\n   ```bash\n   cd /path/to/your/git/repo\n   ```\n\n3. **Start Using gai-tool**:\n\n   ```bash\n   # Generate an AI-powered commit message:\n   gai commit -a\n   ```\n\n## \u2699\ufe0f Configuration\n\nConfiguration file is located at `~/.config/gai/config.yaml`. Customize settings like the AI interface, temperature, and target branch.\n\nYou can also initialize a local configuration file in your project directory:\n\n```bash\ngai init\n```\n\nThis will create a `.gai.yaml` file in your current directory with your current settings. Local configuration takes precedence over global configuration.\n\nExample configuration:\n\n```yaml\ninterface: huggingface\ntemperature: 0.7\ntarget_branch: master\n```\n\n### Customizing AI Behavior\n\nYou can customize the AI's behavior by editing the `your-project-name/.gai/gai-rules.md` file, which is created when you run `gai init`. These rules are injected into the AI's system prompt.\n\nFor a detailed guide, see [Customizing AI Behavior with Rules](./docs/customizing-ai-rules.md).\n\n## \ud83d\udcd6 Usage\n\ngai-tool provides two main commands: `commit` and `merge`.\n\n### \ud83d\udcdd Commit Messages\n\nGenerate an commit message:\n\n```bash\ngai commit\n```\n\nOptions:\n\n- `-a`, `--all`: Stage all changes before committing.\n- `-t`, `--temperature`: Override the temperature specified in the config.\n- `-i`, `--interface`: Specify and override the AI client API to use (`groq` or `huggingface`).\n\n**Example**:\n\n```bash\n# Simply\ngai commit -a\n# Or\ngai commit -a -i huggingface\n```\n\n### \ud83d\udd00 Merge Requests\n\nCreate a merge request:\n\n```bash\ngai merge\n```\n\nOptions:\n\n- `[remote]`: Specify the remote git repository (default is `origin`).\n- `--push`, `-p`: Push changes to remote before creating a merge request.\n- `--target-branch`, `-tb`: Specify the target branch for the merge request (default is `master`).\n- `-t`, `--temperature`: Override the temperature specified in the config.\n- `-i`, `--interface`: Specify and override the AI client API to use (`groq` or `huggingface`).\n\n**Example**:\n\n```bash\n# Simply\ngai merge -p\n# Or\ngai merge origin --push --target-branch develop -interface groq\n```\n\n## \ud83d\udee0 Build Instructions\n\nBuild gai-tool from source:\n\n1. **Clone the Repository**:\n\n   ```bash\n   git clone https://github.com/Danielratmiroff/gai.git\n   ```\n\n2. **Navigate to the Project Directory**:\n\n   ```bash\n   cd gai\n   ```\n\n3. **Create a Virtual Environment (Optional but Recommended)**:\n\n   ```bash\n   python -m venv venv\n   source venv/bin/activate  # On Windows use venv\\Scripts\\activate\n   ```\n\n4. **Install Build Tools and Dependencies**:\n\n   ```bash\n   pip install build\n   pip install -r requirements.txt\n   ```\n\n5. **Build the Package**:\n\n   ```bash\n   python -m build\n   ```\n\n   This will generate distribution files in the `dist/` directory.\n\n6. **Install the Built Package**:\n\n   ```bash\n   pip install dist/gai_tool-<VERSION>-py3-none-any.whl\n   ```\n\n## \ud83e\udd1d Contributing\n\nContributions are welcome!\n\n## \ud83d\udcc4 License\n\nMIT License - [LICENSE](LICENSE).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "AI-Powered Automation Tool for Git \ud83d\ude80",
    "version": "0.5.3",
    "project_urls": {
        "documentation": "https://github.com/Danielratmiroff/gai#readme",
        "homepage": "https://github.com/Danielratmiroff/gai",
        "issues": "https://github.com/Danielratmiroff/gai/issues",
        "repository": "https://github.com/Danielratmiroff/gai"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "47f1db156beaf79681dd93801c8bc21c21945af008fe45e9174d4d34c998ba56",
                "md5": "1e6404b009d02cfb285bb4634b56f202",
                "sha256": "aa945fd5d27f888646c1635e140ac0b2d7a476e7223d2fc106e1accbd57ebae3"
            },
            "downloads": -1,
            "filename": "gai_tool-0.5.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "1e6404b009d02cfb285bb4634b56f202",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.12",
            "size": 24549,
            "upload_time": "2025-07-16T06:43:48",
            "upload_time_iso_8601": "2025-07-16T06:43:48.215218Z",
            "url": "https://files.pythonhosted.org/packages/47/f1/db156beaf79681dd93801c8bc21c21945af008fe45e9174d4d34c998ba56/gai_tool-0.5.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "1998408f7aa13017122e46fc327c8f6bf09dadd238bf2cc5c764d0fbcbc10b1a",
                "md5": "08dc192d2915e0462e0d62fdd1331bc0",
                "sha256": "423c16b929e7ac352422ac5162ea90b82ae2e5e6676e9d33069ded47b7f84b47"
            },
            "downloads": -1,
            "filename": "gai_tool-0.5.3.tar.gz",
            "has_sig": false,
            "md5_digest": "08dc192d2915e0462e0d62fdd1331bc0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.12",
            "size": 18454,
            "upload_time": "2025-07-16T06:43:50",
            "upload_time_iso_8601": "2025-07-16T06:43:50.049177Z",
            "url": "https://files.pythonhosted.org/packages/19/98/408f7aa13017122e46fc327c8f6bf09dadd238bf2cc5c764d0fbcbc10b1a/gai_tool-0.5.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-16 06:43:50",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Danielratmiroff",
    "github_project": "gai#readme",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "gai-tool"
}
        
Elapsed time: 1.96171s