Metadata-Version: 2.4
Name: ai-git-commit-gen
Version: 0.1.2
Summary: AI-powered git commit message generator
Project-URL: Homepage, https://github.com/yogichoudhari/ai-git-commit-gen
Project-URL: Repository, https://github.com/yogichoudhari/ai-git-commit-gen
Project-URL: Issues, https://github.com/yogichoudhari/ai-git-commit-gen/issues
Author-email: Yogesh Choudhari <yogigurjar73542@gmail.com>
License-Expression: MIT
License-File: LICENSE
Keywords: ai,cli,commit,developer-tools,git
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Version Control :: Git
Requires-Python: >=3.9
Requires-Dist: gitpython>=3.1.0
Requires-Dist: httpx>=0.25.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: rich>=13.0.0
Requires-Dist: typer>=0.9.0
Description-Content-Type: text/markdown

# 🚀 ai-git-commit-gen

> **AI-powered git commit message generator** - Zero configuration, instant intelligent commits

[![PyPI version](https://badge.fury.io/py/ai-git-commit-gen.svg)](https://badge.fury.io/py/ai-git-commit-gen)
[![Python](https://img.shields.io/pypi/pyversions/ai-git-commit-gen.svg)](https://pypi.org/project/ai-git-commit-gen/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

Generate meaningful git commit messages instantly using AI. No API keys required - works right out of the box with free HuggingFace models.

## ✨ Features

- **🔑 Zero Configuration** - No API keys or setup required
- **🤖 AI-Powered** - Uses state-of-the-art language models
- **🎨 Multiple Styles** - Conventional commits, Gitmoji, or simple format
- **⚡ Lightning Fast** - Smart caching for instant repeated suggestions
- **🎯 Context Aware** - Analyzes your actual code changes
- **📝 Interactive CLI** - Beautiful terminal UI with rich formatting
- **🔄 Regenerate** - Don't like the suggestions? Generate new ones instantly
- **✏️ Edit Mode** - Fine-tune messages before committing

## 📦 Installation

```bash
pip install ai-git-commit-gen
```

That's it! No configuration needed.

## 🚀 Quick Start

1. Stage your changes:
```bash
git add .
```

2. Generate commit message:
```bash
gcai generate
```

3. Select from AI-generated suggestions or regenerate for new options!

## 📖 Usage

### Basic Commands

```bash
# Generate commit message suggestions
gcai generate
gcai g  # Short alias

# Auto-commit with first suggestion
gcai generate --auto

# Generate more suggestions
gcai generate --num 5

# Use different commit styles
gcai generate --style conventional  # Default
gcai generate --style gitmoji       # With emojis 🎨
gcai generate --style simple        # Simple format

# Dry run - see what would be committed
gcai generate --dry-run

# Check if ready to generate
gcai check
```

### Interactive Mode

When you run `gcai generate`, you'll see:

```
🔍 Analyzing staged changes...

📁 Files changed:
   📝 src/auth/jwt.py (modified)
   ✨ src/auth/refresh.py (added)
   📝 tests/test_auth.py (modified)

✨ Suggested commit messages:

  [1] feat(auth): implement JWT refresh token rotation
  [2] fix(auth): add automatic token refresh mechanism
  [3] feat(auth): add refresh token support with rotation

Select [1-3], [r]egenerate, [e]dit, or [q]uit:
```

Choose an option:
- **1-3**: Select a suggestion
- **r**: Generate new suggestions
- **e**: Edit selected message before committing
- **q**: Quit without committing

## 🎨 Commit Styles

### Conventional Commits (Default)
```
feat(auth): add JWT refresh token rotation
fix(api): handle null response in user endpoint
docs(readme): update installation instructions
```

### Gitmoji
```
✨ feat(auth): add JWT refresh token rotation
🐛 fix(api): handle null response in user endpoint
📝 docs(readme): update installation instructions
```

### Simple
```
Add JWT refresh token rotation
Fix null response handling in user endpoint
Update readme installation instructions
```

## 🛠️ Advanced Features

### Caching
git-commit-ai intelligently caches suggestions for identical changes, making repeated operations instant.

### Smart Diff Handling
Large diffs are automatically truncated while preserving the most important context.

### Fallback Mechanisms
- Primary model unavailable? Automatically switches to backup model
- No internet? Generates basic but functional commit messages
- Rate limited? Implements smart exponential backoff

## 🧪 Development

### Setup Development Environment

```bash
# Clone the repository
git clone https://github.com/yourusername/git-commit-ai.git
cd git-commit-ai

# Install in development mode
pip install -e .

# Install development dependencies
pip install pytest pytest-asyncio pytest-cov
```

### Running Tests

```bash
# Run all tests
pytest

# Run with coverage
pytest --cov=git_commit_ai --cov-report=html

# Run specific test file
pytest tests/test_cli.py
```

### Code Quality

```bash
# Format code
ruff format src tests

# Lint
ruff check src tests

# Type checking (optional, if using mypy)
mypy src
```

## 🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.

1. Fork the repository
2. Create your feature branch (`git checkout -b feature/AmazingFeature`)
3. Commit your changes (using git-commit-ai of course! 😄)
4. Push to the branch (`git push origin feature/AmazingFeature`)
5. Open a Pull Request

## 📄 License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

## 🙏 Acknowledgments

- Built with [Typer](https://typer.tiangolo.com/) for the amazing CLI experience
- Powered by [HuggingFace](https://huggingface.co/) free inference API
- Beautiful terminal output with [Rich](https://rich.readthedocs.io/)
- Git operations via [GitPython](https://gitpython.readthedocs.io/)

## 🐛 Troubleshooting

### "Not a git repository"
Make sure you're in a git repository. Initialize one with:
```bash
git init
```

### "No staged changes found"
Stage your changes first:
```bash
git add .
```

### "API is busy, retrying..."
The free HuggingFace API may be under load. The tool will automatically retry with exponential backoff.

### Network Issues
Check your internet connection. The tool will fallback to basic commit messages if the API is unreachable.

## 📊 Stats

- ⚡ Average response time: 2-3 seconds
- 🎯 Suggestion accuracy: High
- 💾 Cache hit rate: ~30% in typical usage
- 🔄 API reliability: 99%+ with fallback

## 🚗 Roadmap

- [ ] Support for commit body generation
- [ ] Custom prompt templates
- [ ] Git hooks integration
- [ ] Multiple language support
- [ ] Team-specific style guides
- [ ] VSCode extension
- [ ] Pre-commit integration

---

Made with ❤️ by developers, for developers

Report Bug (https://github.com/yourusername/git-commit-ai/issues) •
Request Feature (https://github.com/yourusername/git-commit-ai/issues)

