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

https://github.com/sochiautoparts/gitmoji-ai

๐Ÿค– AI-powered commit messages & changelog generator. Never write a bad commit again. pip install gitmoji-ai
https://github.com/sochiautoparts/gitmoji-ai

ai automation changelog chatgpt cli commit conventional-commits developer-tools devtools git gitmoji gpt openai python

Last synced: 26 days ago
JSON representation

๐Ÿค– AI-powered commit messages & changelog generator. Never write a bad commit again. pip install gitmoji-ai

Awesome Lists containing this project

README

          

# ๐Ÿค– GitMoji AI

### AI-powered commit messages & changelog generator

**Never write a bad commit message again.**

[![PyPI](https://img.shields.io/pypi/v/gitmoji-ai?color=green&label=PyPI)](https://pypi.org/project/gitmoji-ai/)
[![Python](https://img.shields.io/pypi/pyversions/gitmoji-ai?label=Python)](https://pypi.org/project/gitmoji-ai/)
[![Tests](https://img.shields.io/github/actions/workflow/status/sochiautoparts/gitmoji-ai/ci.yml?label=Tests)](https://github.com/sochiautoparts/gitmoji-ai/actions)
[![License](https://img.shields.io/github/license/sochiautoparts/gitmoji-ai?label=License)](LICENSE)
[![Stars](https://img.shields.io/github/stars/sochiautoparts/gitmoji-ai?style=social)](https://github.com/sochiautoparts/gitmoji-ai)

[Installation](#-installation) โ€ข [Quick Start](#-quick-start) โ€ข [Features](#-features) โ€ข [GitHub Action](#-github-action) โ€ข [Pro](#-pro-version--starspay) โ€ข [Contributing](#-contributing)

---

## ๐ŸŽฌ Demo

```bash
$ gmai commit

๐Ÿ“Š Diff Analysis

Files changed: 3
Lines added: +47
Lines removed: -12
Summary: Changed 3 file(s): new feature, bug fix

๐Ÿค– Generating AI commit suggestions...

๐Ÿ’ก Commit Suggestions
โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”ณโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”“
โ”ƒ # โ”ƒ Message โ”ƒ Confidence โ”ƒ
โ”กโ”€โ”€โ”€โ•‡โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•‡โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฅ
โ”‚ 1 โ”‚ feat(auth): add JWT token validation โ”‚ 95% โ”‚
โ”‚ 2 โ”‚ โœจ add JWT token validation to auth โ”‚ 90% โ”‚
โ”‚ 3 โ”‚ feat(auth): implement JWT validation โ”‚ 85% โ”‚
โ”‚ โ”‚ with refresh token support and expiry โ”‚ โ”‚
โ”‚ โ”‚ checking for enhanced security โ”‚ โ”‚
โ””โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Select commit [1/2/3/e(q)dit/(q)uit]: 1

โœ… Committed! feat(auth): add JWT token validation
```

---

## โœจ Features

| Feature | Free | Pro |
|---------|:----:|:---:|
| AI commit messages | 50/month | โˆž |
| AI changelog generation | 3/month | โˆž |
| Conventional Commits | โœ… | โœ… |
| Emoji commits | โœ… | โœ… |
| Multi-language (7 languages) | โœ… | โœ… |
| Git hook integration | โœ… | โœ… |
| GitHub Action | โœ… | โœ… |
| No watermark | โŒ | โœ… |
| Custom commit styles | โœ… (3 styles) | โœ… (5 styles) |
| Semantic Release style | โŒ | โœ… |
| GitMoji Dictionary style | โŒ | โœ… |
| Team features | โŒ | โœ… |
| Priority support | โŒ | โœ… |

---

## ๐Ÿ“ฆ Installation

```bash
# With pip
pip install gitmoji-ai

# With pipx (recommended for CLI tools)
pipx install gitmoji-ai

# With uv
uv tool install gitmoji-ai
```

---

## ๐Ÿš€ Quick Start

### 1. Set your OpenAI API key

```bash
export GMAI_OPENAI_API_KEY="sk-your-key-here"
```

Get one at [platform.openai.com/api-keys](https://platform.openai.com/api-keys) โ€” costs ~$0.15 per 1M tokens.

### 2. Initialize in your repo

```bash
cd your-project
gmai init
```

This creates `.env` and installs a git hook that suggests commit messages automatically.

### 3. Make a commit

```bash
# Stage your changes
git add .

# Generate AI commit message and commit
gmai commit

# Or with auto-staging
gmai commit --stage

# Or just use git normally โ€” the hook will suggest!
git commit
```

### 4. Generate changelog

```bash
# Auto-generate from recent commits
gmai changelog --version v1.2.0

# Output to file
gmai changelog --version v1.2.0 --output CHANGELOG.md

# Spanish language
gmai changelog --version v1.2.0 --lang es
```

---

## ๐ŸŽฎ Commands

| Command | Description |
|---------|-------------|
| `gmai commit` | ๐Ÿค– Generate AI commit message and commit |
| `gmai changelog` | ๐Ÿ“ Generate AI changelog |
| `gmai init` | ๐Ÿ”ง Initialize GitMoji AI in repo |
| `gmai info` | ๐Ÿ“Š Show repo info & usage stats |
| `gmai suggest` | ๐Ÿ’ก Quick suggest (for hooks, non-interactive) |
| `gmai team init` | ๐Ÿ‘ฅ Create team config file |
| `gmai team check` | ๐Ÿ‘ฅ Check commits against team rules |
| `gmai support` | ๐Ÿ†˜ Create a support request with debug info |
| `gmai pro activate KEY` | โญ Activate Pro license |
| `gmai pro status` | ๐Ÿ” Check Pro license status |
| `gmai pro purchase` | ๐Ÿ’ณ Get Pro license |
| `gmai pro login` | ๐Ÿ” Login via GitHub Sponsors |

### Commit options

```bash
gmai commit --style conventional # Conventional: feat(auth): add login (default)
gmai commit --style emoji # Emoji-style: โœจ add login
gmai commit --style plain # Plain: Add login functionality
gmai commit --style semantic-release # Semantic Release: feat(api)!: change auth (Pro)
gmai commit --style gitmoji-dict # GitMoji Dictionary: ๐ŸŒ add Spanish translation (Pro)
gmai commit --lang ru # Russian: feat(auth): ะดะพะฑะฐะฒะธั‚ัŒ ะปะพะณะธะฝ
gmai commit --lang es # Spanish: feat(auth): aรฑadir login
gmai commit --lang de # German: feat(auth): login hinzufรผgen
gmai commit --lang fr # French: feat(auth): ajouter le login
gmai commit --lang ja # Japanese: feat(auth): ใƒญใ‚ฐใ‚คใƒณใ‚’่ฟฝๅŠ 
gmai commit --lang zh # Chinese: feat(auth): ๆทปๅŠ ็™ปๅฝ•
gmai commit --stage # Auto-stage all changes
gmai commit --sign # GPG-sign the commit
gmai commit --yes # Skip confirmation, use first suggestion
gmai commit --path ./my-repo # Specify repo path
```

### Changelog options

```bash
gmai changelog --version v2.0.0 # Version tag
gmai changelog --format angular # Angular format
gmai changelog --lang es # Spanish changelog
gmai changelog --since v1.0.0 # Only changes since tag
gmai changelog --no-ai # Manual grouping (no AI)
gmai changelog --output CHANGELOG.md # Write to file
```

### Team features

```bash
# Create team config
gmai team init

# Check if recent commits comply with team rules
gmai team check
```

The team config (`.gitmoji-ai-team.yml`) can be committed to the repo so all team members follow the same rules:

```yaml
# .gitmoji-ai-team.yml
required_types: [feat, fix, docs, chore] # Only these types allowed
required_scopes: [api, ui, auth] # Enforce scope usage
max_subject_length: 72 # Limit subject line
require_scope: true # Scope is mandatory
commit_style: conventional # Team-wide style
language: en # Team-wide language
disallowed_types: [poo] # Ban certain types
```

---

## ๐ŸŽจ Commit Styles

| Style | Format | Example | Pro Only |
|-------|--------|---------|:--------:|
| `conventional` | `type(scope): desc` | `feat(auth): add JWT validation` | โŒ |
| `emoji` | `emoji desc` | `โœจ add JWT validation` | โŒ |
| `plain` | `Description` | `Add JWT validation` | โŒ |
| `semantic-release` | `type(scope)!: desc` | `feat(api)!: change auth response` | โœ… |
| `gitmoji-dict` | `emoji desc` | `๐ŸŒ add Spanish translation` | โœ… |

### Semantic Release style (Pro)
Follows [semantic-release](https://semantic-release.gitbook.io/) conventions:
- `feat:` โ†’ triggers MINOR release
- `fix:` โ†’ triggers PATCH release
- `feat!:` or `fix!:` โ†’ triggers MAJOR release
- `BREAKING CHANGE:` in body

### GitMoji Dictionary style (Pro)
Uses the full [gitmoji](https://gitmoji.dev/) dictionary with 30+ specific emojis:
- ๐ŸŒ i18n/translations
- โ™ฟ accessibility
- ๐Ÿ“ˆ analytics
- ๐Ÿ”’ security
- ๐Ÿณ docker
- ๐Ÿ’„ UI/cosmetics
- And many more...

---

## ๐ŸŒ Multi-language Support

| Language | Flag | Example |
|----------|------|---------|
| English | ๐Ÿ‡ฌ๐Ÿ‡ง | `feat(auth): add login validation` |
| Russian | ๐Ÿ‡ท๐Ÿ‡บ | `feat(auth): ะดะพะฑะฐะฒะธั‚ัŒ ะฒะฐะปะธะดะฐั†ะธัŽ ะปะพะณะธะฝะฐ` |
| Spanish | ๐Ÿ‡ช๐Ÿ‡ธ | `feat(auth): aรฑadir validaciรณn de login` |
| German | ๐Ÿ‡ฉ๐Ÿ‡ช | `feat(auth): login-validierung hinzufรผgen` |
| French | ๐Ÿ‡ซ๐Ÿ‡ท | `feat(auth): ajouter la validation du login` |
| Japanese | ๐Ÿ‡ฏ๐Ÿ‡ต | `feat(auth): ใƒญใ‚ฐใ‚คใƒณๆคœ่จผใ‚’่ฟฝๅŠ ` |
| Chinese | ๐Ÿ‡จ๐Ÿ‡ณ | `feat(auth): ๆทปๅŠ ็™ปๅฝ•้ชŒ่ฏ` |

---

## ๐Ÿค– GitHub Action

Use GitMoji AI in your CI/CD pipeline:

```yaml
name: Auto Changelog

on:
push:
branches: [main]

jobs:
changelog:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: sochiautoparts/gitmoji-ai@v1
with:
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
license-key: ${{ secrets.LICENSE_KEY }}
generate-changelog: true
version: v1.2.0
language: en
```

Or use it as a PR checker:

```yaml
name: AI Commit Review

on:
pull_request:

jobs:
review:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: sochiautoparts/gitmoji-ai@v1
with:
openai-api-key: ${{ secrets.OPENAI_API_KEY }}
license-key: ${{ secrets.LICENSE_KEY }}
language: en
```

---

## โญ Pro Version & StarsPay

### Why upgrade?

- **โˆž Unlimited** AI commits and changelogs
- **No watermark** โ€” clean commit history
- **5 commit styles** โ€” including semantic-release and gitmoji-dict
- **Team features** โ€” shared settings via `.gitmoji-ai-team.yml`
- **7 languages** โ€” with proper native language prompts
- **Priority support** โ€” faster responses

### ๐Ÿ’ณ StarsPay โ€” Pay with Telegram Stars

Purchase directly in Telegram โ€” pay with Stars, get your license key in seconds!

- **Bot:** ๐Ÿ‘‰ [@allstarspay_bot](https://t.me/allstarspay_bot)

| Plan | Price | Best for |
|------|-------|----------|
| **Free** | $0 | Personal projects |
| **1 ะผะตััั†** | โญ 149/month | Try Pro features |
| **1 ะณะพะด** | โญ 999/year | Best value โ€” save 44% |
| **ะะฐะฒัะตะณะดะฐ** | โญ 2,999 | Pay once, use forever |

**3 steps to Pro:**

```bash
# 1. Open @allstarspay_bot in Telegram and pay with Stars
# ๐Ÿ‘‰ https://t.me/allstarspay_bot

# 2. Copy your license key (format: SP-GMA-xxxxxx)

# 3. Activate:
gmai pro activate SP-GMA-xxxxxxxx
```

**Or activate with an existing key:**

```bash
gmai pro activate YOUR-LICENSE-KEY
gmai pro status # Check your license
```

### ๐Ÿ” License Verification (No API Server Needed!)

GitMoji AI verifies Pro licenses **without requiring an API server**. The verification works in two tiers:

#### 1๏ธโƒฃ Primary: Public `licenses.json` on GitHub

The tool fetches a public JSON file from GitHub to verify licenses โ€” **no authentication, no rate limits, no API server needed**:

- **URL:** `https://raw.githubusercontent.com/sochiautoparts/stars-pay-bot/main/data/licenses.json`
- The JSON file contains license entries with a `key_hash` field (SHA-256 truncated to 16 hex characters)
- Verification: compute `hashlib.sha256(key.encode()).hexdigest()[:16]` and match against `key_hash`
- Also checks `active` field and `expires_at` (0 = lifetime)

#### 2๏ธโƒฃ Fallback: REST API (if `STARSPAY_API_URL` is set)

If the JSON method doesn't validate and `STARSPAY_API_URL` is configured, the tool falls back to a REST API call:

- **POST** to `{STARSPAY_API_URL}/api/v1/verify`
- **Header:** `X-API-Key: {STARSPAY_API_KEY}`
- **Body:** `{"key": ""}`

The `is_pro()` function caches verification results for 1 hour in memory and also saves to local SQLite for offline use (7-day max).

### Environment Variables for CI/CD

For automated environments (GitHub Actions, Docker, etc.):

```bash
LICENSE_KEY=SP-GMA-xxxxxxxx # Your license key (required for Pro)
STARSPAY_API_URL= # Optional: StarsPay API URL (empty = JSON-only verification)
STARSPAY_API_KEY= # Optional: StarsPay API key (only if using API fallback)
GITHUB_CLIENT_ID= # Optional: GitHub OAuth App client ID for device flow login
```

- **LICENSE_KEY** โ€” Your Pro license key. If set, the tool verifies it via the public JSON file (primary) or REST API (fallback).
- **STARSPAY_API_URL** โ€” Optional. If set, the REST API is used as a fallback when JSON verification doesn't find the key.
- **STARSPAY_API_KEY** โ€” Optional. API key for the REST API (only needed if `STARSPAY_API_URL` is set).
- **GITHUB_CLIENT_ID** โ€” Optional. If set, enables interactive GitHub Device Flow login via `gmai pro login`.
- If only `LICENSE_KEY` is set, verification uses the public GitHub JSON โ€” **no API server required!**

---

## ๐Ÿ”ง Configuration

Create `.env` in your project root (or set environment variables):

```bash
# Required
GMAI_OPENAI_API_KEY=sk-your-key-here

# Optional
GMAI_DEFAULT_LANGUAGE=en # Default commit language (en, ru, es, de, fr, ja, zh)
GMAI_COMMIT_STYLE=conventional # Default commit style (conventional, emoji, plain, semantic-release, gitmoji-dict)
GMAI_OPENAI_MODEL=gpt-4o-mini # AI model

# StarsPay license verification
LICENSE_KEY= # License key for Pro features (primary: verified via public GitHub JSON)
STARSPAY_API_URL= # Optional: StarsPay API URL (empty = JSON-only verification)
STARSPAY_API_KEY= # Optional: StarsPay API key

# GitHub Device Flow (optional, for interactive login)
GITHUB_CLIENT_ID= # GitHub OAuth App client ID
```

### Team Configuration

Create `.gitmoji-ai-team.yml` in your repo root:

```yaml
# .gitmoji-ai-team.yml โ€” commit this file to share team conventions
required_types: [feat, fix, docs, chore]
required_scopes: [api, ui, auth]
max_subject_length: 72
require_scope: false
disallowed_types: []
commit_style: conventional
language: en
changelog_format: keepachangelog
```

When this file exists, `gmai commit` will:
- Use team's default style and language
- Validate commit messages against team rules
- Warn about violations before committing

### Git Hook

After `gmai init`, every `git commit` will show AI suggestions in your editor:

```
# ๐Ÿค– GitMoji AI Suggestion:
# feat(auth): add JWT token validation
```

Just uncomment the line you like, save, and close the editor!

---

## ๐Ÿ—๏ธ Architecture

```
gitmoji-ai/
โ”œโ”€โ”€ src/gitmoji_ai/
โ”‚ โ”œโ”€โ”€ cli.py # Typer CLI interface
โ”‚ โ”œโ”€โ”€ ai_engine.py # AI commit generation (OpenAI) + 7 language prompts + 5 styles
โ”‚ โ”œโ”€โ”€ git_ops.py # Git operations (diff, commit)
โ”‚ โ”œโ”€โ”€ changelog.py # Changelog generator (7 languages)
โ”‚ โ”œโ”€โ”€ config.py # Configuration management
โ”‚ โ”œโ”€โ”€ usage.py # Usage tracking & license validation (JSON + API)
โ”‚ โ”œโ”€โ”€ suggest.py # Quick suggest (for hooks) with rate limiting
โ”‚ โ”œโ”€โ”€ sponsors.py # GitHub Sponsors + Device Flow auth
โ”‚ โ””โ”€โ”€ team.py # Team config (.gitmoji-ai-team.yml)
โ”œโ”€โ”€ action.yml # GitHub Action (canonical)
โ”œโ”€โ”€ .github/workflows/
โ”‚ โ”œโ”€โ”€ ci.yml # CI pipeline
โ”‚ โ””โ”€โ”€ changelog.yml # Auto changelog
โ”œโ”€โ”€ tests/
โ”‚ โ””โ”€โ”€ test_core.py # Test suite
โ””โ”€โ”€ pyproject.toml # Project config
```

---

## ๐Ÿค Contributing

Contributions are welcome! Please read our [Contributing Guide](CONTRIBUTING.md).

1. Fork the repository
2. Create your feature branch: `git checkout -b feat/amazing-feature`
3. Commit with GitMoji AI: `gmai commit` ๐Ÿ˜‰
4. Push: `git push origin feat/amazing-feature`
5. Open a Pull Request

---

## ๐Ÿ“„ License

MIT License โ€” see [LICENSE](LICENSE) for details.

---

**Made with ๐Ÿค– and โค๏ธ by [GitMoji AI](https://github.com/sochiautoparts/gitmoji-ai)**

[โญ Star on GitHub](https://github.com/sochiautoparts/gitmoji-ai) โ€ข [๐Ÿ› Report Bug](https://github.com/sochiautoparts/gitmoji-ai/issues) โ€ข [๐Ÿ’ก Request Feature](https://github.com/sochiautoparts/gitmoji-ai/issues) โ€ข [๐Ÿ’Ž Get Pro via StarsPay](https://t.me/allstarspay_bot)