gity v0.1.2
Gity
AI-powered Git commit message generator using various LLM providers.
Overview
Gity is a command-line tool that uses Large Language Models to automatically generate meaningful Git commit messages based on your staged changes. It analyzes the diff of your staged files and suggests a concise, descriptive commit message following best practices.
Features
- 🔍 Analyzes your staged Git changes
- 💡 Generates meaningful commit messages using LLM models
- 🔄 Support for multiple LLM providers (OpenAI, Anthropic, etc.)
- ✏️ Allows editing the suggested message in your preferred editor
- 🔄 Option to regenerate a new message
- 🌐 Open your repository in the browser with a simple command
- ✅ Simple and intuitive CLI interface
Installation
Using npx (recommended)
npx gityGlobal Installation
npm install -g gityThen use it in any Git repository:
gityPrerequisites
- Node.js 16 or higher
- Git
- API key for your chosen LLM provider (OpenAI by default)
Setup
OpenAI (Default)
- Get an OpenAI API key from OpenAI's platform
- Set your API key as an environment variable:
export OPENAI_API_KEY=your_api_key_hereAnthropic Claude
- Get an Anthropic API key from Anthropic's console
- Set your API key as an environment variable:
export ANTHROPIC_API_KEY=your_api_key_here
export LLM_PROVIDER=anthropicEnvironment Variables
You can configure Gity using the following environment variables:
OPENAI_API_KEY: API key for OpenAI (required when using OpenAI provider)ANTHROPIC_API_KEY: API key for Anthropic (required when using Anthropic provider)LLM_PROVIDER: LLM provider to use (default: "openai", options: "openai", "anthropic")LLM_MODEL: Model to use with the provider (optional)LLM_MAX_TOKENS: Maximum tokens for the response (optional)
Alternatively, you can create a .env file in your project root with these variables.
Usage
Generate Commit Message
- Stage your changes with
git add - Run
gity - Choose an option:
- Press Enter to accept and commit the suggested message
- Press
eto edit the message in your default editor - Press
rto regenerate a new message - Press
qto quit without committing
Open Repository in Browser
To open the current repository in your default web browser:
gity openThis command parses your .git/config file, extracts the repository URL, and opens it in your default browser. It supports both SSH and HTTPS remote URL formats.
Development
# Clone the repository
git clone https://github.com/mk0y/gity.git
cd gity
# Install dependencies
npm install
# Build the project
npm run build
# Run locally
npm startExtending with New LLM Providers
Gity is designed to be easily extended with new LLM providers. To add a new provider:
- Implement the
LLMProviderinterface inservices/llm-service.ts - Add your provider to the
getLLMProviderfactory function - Update the
getApiKeyfunction ingit-sage.tsto handle your provider's API key
License
ISC
Contributing
Contributions are welcome! Feel free to open issues or submit pull requests.
9 months ago
8 months ago
8 months ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago
11 years ago