AI-powered git commit and PR creation tool
Project description
AI CLI ๐ค
AI-powered git commit and pull request creation tool using Google Gemini.
โจ Features
- ๐ค AI-Powered Commits: Generate conventional commit messages using Google Gemini (latest google.genai package)
- ๐ Smart Pull Requests: Create PR titles and descriptions automatically
- ๐ Auto Push: Automatically push commits to remote repository
- ๐ Smart Commit All: Commit all changes grouped by folder and context
- ๐ Branch-based PRs: Create PRs based on all changes in a branch
- ๐ฏ Conventional Commits: Follows the conventional commits specification
- ๐ก๏ธ Type Safety: Fully typed with mypy support
- ๐งช Well Tested: Comprehensive test suite with pytest
- ๐ฆ Professional Structure: Clean architecture with proper separation of concerns
- โ๏ธ Pydantic Settings: Modern configuration management with validation
- ๐ Taskipy Integration: Convenient task runner for development workflow
๐๏ธ Architecture
The project follows a clean architecture pattern with well-defined layers:
src/ai_cli/
โโโ core/ # Domain models, interfaces, and exceptions
โโโ services/ # Business logic and orchestration
โโโ infrastructure/ # External integrations (Git, AI, GitHub)
โโโ cli/ # Command-line interface
โโโ config/ # Configuration management
Layers Overview
- Core Layer: Domain models, business interfaces, and custom exceptions
- Services Layer: Business logic and workflow orchestration
- Infrastructure Layer: External service integrations (Git, AI APIs, GitHub CLI)
- CLI Layer: User interface and command handling
- Config Layer: Environment-based configuration management
๐ Installation
Requirements
- Python 3.13 or higher (recommended)
- Git
- GitHub CLI (optional, for PR creation)
- Google Gemini API key
Quick Setup
-
Install using uv (recommended):
# Clone and install git clone <repository-url> cd ai-cli uv sync # Install globally uv tool install .
-
Configure your API key:
# Interactive setup (easiest) ai-cli setup # Or set directly ai-cli setup --api-key YOUR_API_KEY
Get your API key from: https://makersuite.google.com/app/apikey
-
Start using:
ai-cli smart-commit # AI-powered commits ai-cli create-pr # Create PRs ai-cli --help # See all commands
Alternative Setup Methods
Manual .env configuration
# Generate .env file with all options
python scripts/env-gen.py --stdout # Preview
python scripts/env-gen.py # Generate local .env
python scripts/env-gen.py --global # Generate global config
Install GitHub CLI (optional, for PR creation)
# macOS
brew install gh
# Ubuntu/Debian
sudo apt install gh
# Windows
winget install GitHub.cli
-
Install globally (to use in other projects):
uv tool install .
Configuration is stored at
~/.config/ai-cli/.env
๐ Usage
Basic Usage
Stage your changes and run the smart commit:
git add .
ai-cli smart-commit
Available Commands
# Basic commit (with push)
ai-cli smart-commit
# Commit without pushing
ai-cli smart-commit --no-push
# Commit with automatic PR creation
ai-cli smart-commit --pr
# Auto-confirm all prompts
ai-cli smart-commit --yes
# Commit ALL changes with smart grouping by folder
ai-cli smart-commit-all
# Create PR based on current branch changes
ai-cli create-pr
# Create PR against specific base branch
ai-cli create-pr --base develop
# Create a new GitHub repository
ai-cli create-repo my-project --visibility public --description "My project"
# Show version
ai-cli version
Command Reference
| Command | Description |
|---|---|
setup |
Configure ai-cli with your API key (interactive or direct) |
config |
Show configuration status and manage models |
config -s |
Interactive model selection from history |
config -m MODEL |
Set model directly |
smart-commit |
Create AI-powered commit from staged changes |
smart-commit-all |
Commit all changes with smart grouping by folder |
create-pr |
Create PR based on current branch changes |
create-repo |
Create a new GitHub repository |
version |
Show version information |
๐ค Model Selection
Easily switch between AI models with the interactive selector:
ai-cli config --select # or -s
This shows a list of previously used models:
๐ค Select AI Model
โโโโโณโโโโโโโโโโโโโโโโโโโณโโโโโโโโโโโ
โ # โ Model โ Status โ
โกโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฉ
โ 1 โ gemini-2.0-flash โ โ currentโ
โ 2 โ gemini-1.5-flash โ โ
โ 3 โ gemini-1.5-pro โ โ
โโโโโดโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโ
Commands: [1-9] select | [n] new model | [d1-d9] delete | [q] quit
- Press a number to select a model
- Press n to add a new model
- Press d + number (e.g.,
d2) to delete a model from history - Press q to quit
Or set directly: ai-cli config -m gemini-2.0-flash
Environment Variables
| Variable | Description | Default |
|---|---|---|
GEMINI_API_KEY |
Google Gemini API key (required) | - |
GEMINI_MODEL |
Gemini model to use | gemini-2.5-flash |
GEMINI_SYSTEM_INSTRUCTION |
AI system instruction | Default DevOps instruction |
MAX_DIFF_SIZE |
Maximum diff size for AI analysis | 10000 |
DEFAULT_BRANCH |
Default git branch | main |
DEBUG |
Enable debug mode | false |
๐จ Customizing AI Prompts
You can customize all AI prompts by editing the prompts.json file. The tool looks for prompts in this order:
./prompts.json(project directory - highest priority)~/.config/ai-cli/prompts.json(global config)- Built-in defaults (fallback)
Available prompts:
| Key | Description |
|---|---|
commit_message |
Prompt for generating commit messages |
pull_request |
Prompt for generating PR title and description |
file_correlation |
Prompt for analyzing which files should be committed together |
system_instruction |
System instruction for the AI model |
Example prompts.json:
{
"commit_message": {
"description": "Prompt for generating commit messages",
"prompt": "Generate a commit message following Conventional Commits..."
},
"pull_request": {
"description": "Prompt for generating PR content",
"prompt": "Create a title and description for a Pull Request..."
}
}
This allows you to:
- Change the language of generated messages
- Modify the commit message format
- Customize PR templates
- Adjust AI behavior per project
๐ง Development
Setup Development Environment
# Install development dependencies
uv sync --group dev
# Install pre-commit hooks
pre-commit install
Code Quality
# Format code
uv run ruff format src tests
# Lint code
uv run ruff check src tests
# Fix lint issues automatically
uv run ruff check src tests --fix
# Type checking
mypy src
# Run all checks
uv run task check
Testing
# Run all tests
pytest
# Run with coverage
pytest --cov=src/ai_cli
# Run only unit tests
pytest tests/unit
# Run only integration tests
pytest tests/integration
Project Structure
ai-cli/
โโโ src/ai_cli/ # Main application code
โ โโโ core/ # Domain layer
โ โ โโโ models.py # Domain models
โ โ โโโ interfaces.py # Abstract interfaces
โ โ โโโ exceptions.py # Custom exceptions
โ โโโ services/ # Business logic layer
โ โ โโโ smart_commit_service.py
โ โโโ infrastructure/ # Infrastructure layer
โ โ โโโ git_repository.py # Git operations
โ โ โโโ ai_service.py # AI integration
โ โ โโโ pr_service.py # GitHub PR service
โ โโโ cli/ # Presentation layer
โ โ โโโ main.py # CLI interface
โ โโโ config/ # Configuration layer
โ โโโ settings.py # App configuration
โโโ tests/ # Test suite
โ โโโ unit/ # Unit tests
โ โโโ integration/ # Integration tests
โ โโโ conftest.py # Test fixtures
โโโ pyproject.toml # Project configuration
โโโ README.md # This file
โโโ .env.example # Environment template
๐ Workflow
The AI CLI follows this workflow:
- Analyze: Examines staged git changes
- Generate: Creates commit message using AI
- Review: Presents suggestion for user approval
- Commit: Creates git commit with the message
- Push: Pushes changes to remote (optional)
- PR: Creates pull request with AI-generated description (optional)
๐ฏ Conventional Commits
The tool generates commits following the Conventional Commits specification:
<type>(<scope>): <subject>
[optional body]
[optional footer]
Supported Types
feat: New featuresfix: Bug fixesdocs: Documentation changesstyle: Code style changesrefactor: Code refactoringtest: Test additions/modificationschore: Maintenance tasksbuild: Build system changesci: CI/CD changesperf: Performance improvementsrevert: Reverts previous commits
๐ค Contributing
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Make your changes
- Run tests and quality checks
- Commit using conventional commits
- Push to your branch
- Open a Pull Request
๐ License
This project is licensed under the MIT License - see the LICENSE file for details.
๐ Acknowledgments
- Google Gemini for AI capabilities (using latest google.genai package)
- Typer for CLI framework
- Rich for beautiful terminal output
- Ruff for fast linting and formatting
- Conventional Commits for commit standards
- Pydantic for settings management and validation
- Taskipy for task automation
๐ Support
If you encounter any issues or have questions:
- Check the Issues page
- Create a new issue with detailed information
- Include error messages and environment details
Made with โค๏ธ by developers, for developers.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file parcky_cli-2026.6.0a2.tar.gz.
File metadata
- Download URL: parcky_cli-2026.6.0a2.tar.gz
- Upload date:
- Size: 78.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5c898bd19fa6d0e9f04f4dc4ae8e78056d20c7eea4700a7def14e8dd02998bf7
|
|
| MD5 |
0115f344a820f68f738632d60cc54301
|
|
| BLAKE2b-256 |
e4dc41432189bc506d80cc47437f8a99e1524457586a677c31798c5b8f462c05
|
File details
Details for the file parcky_cli-2026.6.0a2-py3-none-any.whl.
File metadata
- Download URL: parcky_cli-2026.6.0a2-py3-none-any.whl
- Upload date:
- Size: 32.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.9 {"installer":{"name":"uv","version":"0.9.9"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"22.04","id":"jammy","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be44f40c2387b9736eda47d8a12e50a2838a83af0acc70f914220b7b426a39b2
|
|
| MD5 |
bf0e5a9d7919d8945f568b2367cef3fa
|
|
| BLAKE2b-256 |
1641abdde506922ad1b38af645574d238145f7d2e7adef2c510f97dc0dd03d2f
|