$git clone https://github.com/ShinChven/git-gptGit-GPT is a versatile CLI tool designed to auto-generate git commit messages, issues, and perform various code quality checks using multiple AI providers. It supports OpenAI, Azure OpenAI, Ollama, Claude, and Google Generative AI, giving you the flexibility to choose the best mo
| 1 | # Git-GPT |
| 2 | |
| 3 | Git-GPT is a versatile CLI tool designed to auto-generate git commit messages, issues, and perform various code quality checks using multiple AI providers. It supports OpenAI, Azure OpenAI, Ollama, Claude, and Google Generative AI, giving you the flexibility to choose the best model for your needs. |
| 4 | |
| 5 |  |
| 6 | |
| 7 | ## Installation |
| 8 | |
| 9 | Install `git-gpt` via pip: |
| 10 | |
| 11 | ```bash |
| 12 | pip install git+https://github.com/ShinChven/git-gpt.git |
| 13 | ``` |
| 14 | |
| 15 | Upgrade: |
| 16 | |
| 17 | ```bash |
| 18 | pip install --upgrade git+https://github.com/ShinChven/git-gpt.git |
| 19 | ``` |
| 20 | |
| 21 | ## Development |
| 22 | |
| 23 | To set up the development environment: |
| 24 | |
| 25 | ```bash |
| 26 | git clone https://github.com/ShinChven/git-gpt.git |
| 27 | cd git-gpt |
| 28 | python -m venv venv |
| 29 | source venv/bin/activate |
| 30 | pip install -e . |
| 31 | ``` |
| 32 | |
| 33 | ### Project Structure |
| 34 | |
| 35 | The project is organized as follows: |
| 36 | |
| 37 | - `git_gpt/main.py`: The main entry point of the CLI application. |
| 38 | - `git_gpt/__init__.py`: Initializes the package and defines the version. |
| 39 | - `git_gpt/config_command.py`: Handles the configuration command. |
| 40 | - `git_gpt/commit_command.py`: Implements the commit message generation. |
| 41 | - `git_gpt/issue_command.py`: Manages the issue creation functionality. |
| 42 | - `git_gpt/quality_command.py`: Performs quality checks on code changes. |
| 43 | - `git_gpt/changelog_command.py`: Generates changelogs based on commits. |
| 44 | - `git_gpt/ask_command.py`: Allows asking custom questions about code diffs. |
| 45 | - `git_gpt/ai_client.py`: Handles API requests to multiple AI providers. |
| 46 | |
| 47 | Each command is implemented in its own file for better organization and maintainability. |
| 48 | |
| 49 | ## Configuration |
| 50 | |
| 51 | Before using `git-gpt`, you'll need to configure it with your API settings. For a step-by-step guided configuration, use the following command: |
| 52 | |
| 53 | ```bash |
| 54 | git-gpt config |
| 55 | ``` |
| 56 | |
| 57 | This command will prompt you for each configuration setting, making the process easier and more user-friendly. |
| 58 | |
| 59 | To configure a new model or update an existing one using a single command (all options are mandatory): |
| 60 | |
| 61 | ```bash |
| 62 | git-gpt config --alias MODEL_ALIAS --model_name MODEL_NAME --provider PROVIDER --key API_KEY --api_base API_BASE |
| 63 | ``` |
| 64 | |
| 65 | - `--alias`: A unique name for the model configuration |
| 66 | - `--model_name`: The name of the model (e.g., "gpt-4" for OpenAI, "claude-3-sonnet-20240229" for Claude, "gemini-1.5-pro" for Google Generative AI) |
| 67 | - `--provider`: The provider of the model (e.g., "openai", "azure-openai", "ollama", "claude", or "google-generativeai") |
| 68 | - `--key`: The API key (optional, depending on the provider) |
| 69 | - `--api_base`: The API base URL (optional, defaults to https://api.anthropic.com for Claude) |
| 70 | |
| 71 | If you don't provide all options using the single command method, you'll be prompted to enter the missing information. |
| 72 | |
| 73 | ### Setting the Default Model |
| 74 | |
| 75 | To set the default model: |
| 76 | |
| 77 | ```bash |
| 78 | git-gpt set-default MODEL_ALIAS |
| 79 | ``` |
| 80 | |
| 81 | ### Deleting a Model Configuration |
| 82 | |
| 83 | To delete a model configuration: |
| 84 | |
| 85 | ```bash |
| 86 | git-gpt delete-model MODEL_ALIAS |
| 87 | ``` |
| 88 | |
| 89 | ### Showing All Configured Models |
| 90 | |
| 91 | To display all configured models with their provider and masked API key: |
| 92 | |
| 93 | ```bash |
| 94 | git-gpt show-models |
| 95 | ``` |
| 96 | |
| 97 | ## Supported AI Providers |
| 98 | |
| 99 | Git-GPT supports multiple AI providers, allowing you to choose the one that best fits your needs. The supported providers are: |
| 100 | |
| 101 | 1. **OpenAI**: Use models like GPT-3 and GPT-4. |
| 102 | 2. **Azure OpenAI**: Access OpenAI models through Microsoft's Azure platform. |
| 103 | 3. **Ollama**: An open-source, locally hosted language model. |
| 104 | 4. **Claude (Anthropic)**: Use models like Claude-3. |
| 105 | 5. **Google Generative AI**: Access models like Gemini. |
| 106 | |
| 107 | Each provider may have specific requirements for model names and API configurations. When configuring a new model, make sure to use the correct provider name and follow any provider-specific instructions. |
| 108 | |
| 109 | ## Ollama Support |
| 110 | |
| 111 | Git-GPT now supports Ollama, an open-source, locally hosted language model. This allows you to use Git-GPT without relying on external API services. |
| 112 | |
| 113 | ### Setting up Ollama: |
| 114 | |
| 115 | 1. Install and set up Ollama on your local machine (visit [Ollama's website](h |