An open API service indexing awesome lists of open source software.

https://github.com/simongino/aicommit

🤖 AI-powered git commit message generator supporting multiple LLM providers (OpenAI, Azure OpenAI). Generate meaningful commit messages from your staged changes with a beautiful CLI interface.
https://github.com/simongino/aicommit

azure-openai cli git git-tools golang llm openai

Last synced: 3 months ago
JSON representation

🤖 AI-powered git commit message generator supporting multiple LLM providers (OpenAI, Azure OpenAI). Generate meaningful commit messages from your staged changes with a beautiful CLI interface.

Awesome Lists containing this project

README

          

# AI Commit

English | [įŽ€äŊ“中文](README.md)

An AI-powered Git commit message generator that automatically creates commit messages following the Conventional Commits specification.

## Features

- 🤖 **AI-Powered** - Automatically analyzes code changes and generates standardized commit messages
- đŸŽ¯ **Interactive** - Keyboard shortcuts for quick operation selection
- 📁 **Flexible File Selection** - Choose from staged files, select manually, or stage all
- âœī¸ **Message Editing** - Edit generated messages or regenerate them
- 🔧 **Config Check** - Built-in `check` command to verify configuration and API connectivity
- 🌍 **Multi-Language** - English, Simplified Chinese, Traditional Chinese
- â˜ī¸ **Multi-Platform** - Supports OpenAI and Azure OpenAI
- 📊 **Daily Reports** - Generate work reports from Git commit history

## Quick Start

### Installation

```bash
# Linux/macOS
curl -fsSL https://raw.githubusercontent.com/SimonGino/aicommit/main/scripts/install.sh | sudo bash

# Windows (Run PowerShell as Administrator)
iwr -useb https://raw.githubusercontent.com/SimonGino/aicommit/main/scripts/install.ps1 | iex
```

### Configuration

```bash
# Configure OpenAI API key
aicommit config --api-key your-openai-api-key

# Verify configuration
aicommit check
```

### Usage

```bash
# Interactive commit (recommended)
aicommit

# Use custom message
aicommit -m "feat: add new feature"
```

## Interactive Flow

Running `aicommit` displays an interactive interface:

```
Detected changes:

Staged:
✓ src/main.go

Modified (unstaged):
â€ĸ config.json

Select an action:
[a] Use current staged content to generate commit message
[s] Select files to stage
[A] Stage all changes (git add .)
[c] Cancel

Press key to select: a

Generating commit message...

✔ Generated commit message:
┌────────────────────────────────────────────────────────────┐
│ feat(main): add user authentication │
│ │
│ - Implement JWT token validation │
│ - Add user login endpoint │
└────────────────────────────────────────────────────────────┘

Select an action:
[a] Accept and commit
[e] Edit before commit
[r] Regenerate
[c] Cancel

Press key to select: a

✓ Changes committed
```

## Commands

| Command | Description |
|---------|-------------|
| `aicommit` | Interactive generate and commit |
| `aicommit -m "msg"` | Commit with specified message |
| `aicommit check` | Check configuration and API connectivity |
| `aicommit config` | Configure settings |
| `aicommit report` | Generate daily report |

## Configuration

Configuration file location: `~/.config/aicommit/config.json`

### OpenAI

#### Command Line Configuration

```bash
aicommit config --provider openai
aicommit config --api-key sk-your-api-key
aicommit config --model gpt-4o # optional, default: gpt-4o
aicommit config --language en # optional, default: en
```

#### Standard Config File Example

```json
{
"api_key": "sk-your-api-key-here",
"base_url": "",
"model": "gpt-4o",
"language": "en",
"provider": "openai",
"azure_api_version": ""
}
```

### Azure OpenAI

#### Command Line Configuration

```bash
aicommit config --provider azure
aicommit config --api-key your-azure-api-key
aicommit config --base-url https://your-resource.openai.azure.com
aicommit config --model your-deployment-name
aicommit config --azure-api-version 2024-02-15-preview
aicommit config --language en # optional
```

**Important Notes:**
- `--base-url` should be the base URL only (e.g., `https://your-resource.openai.azure.com`), NOT the full API path
- `--model` should be your Azure OpenAI deployment name
- `--azure-api-version` is required for Azure OpenAI

#### Standard Config File Example

```json
{
"api_key": "your-azure-api-key-here",
"base_url": "https://your-resource.openai.azure.com",
"model": "gpt-4o-mini",
"language": "en",
"provider": "azure",
"azure_api_version": "2024-02-15-preview"
}
```

### Language Settings

```bash
aicommit config --language en # English (default)
aicommit config --language zh-CN # Simplified Chinese
aicommit config --language zh-TW # Traditional Chinese
```

## Daily Reports

```bash
# This week's report
aicommit report --this-week

# Last week's report
aicommit report --last-week

# Specific date range
aicommit report --since 2024-01-01 --until 2024-01-31
```

## Commit Message Format

Follows the [Conventional Commits](https://www.conventionalcommits.org/) specification:

```
():

```

Supported types: `feat` | `fix` | `refactor` | `docs` | `style` | `test` | `chore`

## Development

```bash
git clone https://github.com/SimonGino/aicommit.git
cd aicommit
go mod download
go test ./...
go build -o aicommit ./cmd/aicommit
```

## Uninstallation

```bash
# Linux/macOS
sudo bash -c "$(curl -fsSL https://raw.githubusercontent.com/SimonGino/aicommit/main/scripts/uninstall.sh)"

# Windows (Run PowerShell as Administrator)
iwr -useb https://raw.githubusercontent.com/SimonGino/aicommit/main/scripts/uninstall.ps1 | iex
```

## License

MIT