gcop-rs
AI-powered Git commit message generator and code reviewer, written in Rust.
Note: This is a Rust rewrite of the original gcop project (Python). Since the original project is no longer actively maintained, this version was created to provide better performance, reliability, and maintainability.
Features
- 🤖 AI Commit Messages - Generate conventional commit messages using Claude, OpenAI, or Ollama
- 🔍 Code Review - Get AI-powered code reviews with security and performance insights
- 🎯 Git Aliases - Convenient shortcuts like
git c,git r,git acpfor streamlined workflow - 🚀 Easy Setup - Interactive
initcommand for quick configuration - 🔧 Custom Providers - Support any OpenAI/Claude compatible API (DeepSeek, custom endpoints, etc.)
- 📝 Custom Prompts - Customize generation and review prompts with template variables
- ⚙️ Flexible Config - Configure via file or environment variables
- 🎨 Beautiful CLI - Spinner animations, colored output, and interactive prompts
- 🐛 Debug Mode - Verbose logging with full request/response inspection
- 🔐 GPG Signing - Full support for GPG commit signing via native git
Requirements
- Rust 1.92.0 or later (Rust 2024 edition)
- Git 2.0 or later
Quick Start
1. Installation
# Homebrew (macOS/Linux)
# pipx (Python users)
# cargo-binstall (no compilation required)
# cargo install (from source)
For other installation methods, see docs/guide/installation.md.
2. Configure
Option 1: Quick setup (recommended)
This interactive wizard will:
- Create config directory and file at the platform-specific location
- Set secure file permissions (Unix/Linux/macOS)
- Optionally install convenient git aliases
Option 2: Manual setup
Use gcop-rs config edit to open config file in your system editor, or create manually at:
- Linux:
~/.config/gcop/config.toml - macOS:
~/Library/Application Support/gcop/config.toml - Windows:
%APPDATA%\gcop\config.toml
[]
= "claude"
[]
= "sk-ant-your-key-here"
= "claude-sonnet-4-5-20250929"
Or use environment variables:
See docs/guide/configuration.md for all options.
3. Use
# Generate commit message
# Or use the alias: git c
# Review uncommitted changes
# Or use the alias: git r
# Complete workflow
# Use different provider
Git Aliases
gcop-rs provides convenient git aliases for streamlined workflow.
Installation
# Install all aliases
# Or during initial setup
Usage
After installation, you can use these shortcuts:
Management
# List all available aliases
# Reinstall (overwrite conflicts)
# Remove all gcop-rs aliases
See docs/guide/aliases.md for detailed information on each alias.
Commands
gcop-rs init
Initialize gcop-rs configuration.
Interactive setup wizard that:
- Creates config directory
- Copies example configuration
- Sets secure file permissions
- Optionally installs git aliases
gcop-rs commit
Generate AI-powered commit message for staged changes.
Interactive workflow:
After generating a commit message, you can choose:
- Accept - Use the generated message
- Edit - Open editor to manually modify (returns to menu after editing)
- Retry - Regenerate without feedback
- Retry with feedback - Provide custom instructions (e.g., "use Chinese", "be more concise"). Feedback accumulates across retries for refined results
- Quit - Cancel commit
Example:
)
> Accept
gcop-rs review
Review code changes with AI.
Output formats: --format text|json|markdown
gcop-rs config
Manage configuration.
# Edit config file in your default editor (with validation)
# Validate configuration and test provider connection
# Show current configuration
config edit validates your config after saving (like visudo) and works even when config is corrupted.
Tip: Always use
gcop-rs config editinstead of editing the config file directly to avoid syntax errors.
gcop-rs alias
Manage git aliases.
Provides convenient shortcuts like git c, git r, git acp, etc.
See docs/guide/aliases.md for details.
gcop-rs stats
Show repository commit statistics.
Displays:
- Total commits and contributors
- Repository time span
- Top contributors with commit counts
- Recent activity (last 4 weeks) with ASCII bar chart
Configuration
Config file location (platform-specific):
- Linux:
~/.config/gcop/config.toml - macOS:
~/Library/Application Support/gcop/config.toml - Windows:
%APPDATA%\gcop\config.toml
Example configuration with Claude API:
[]
= "claude"
[]
= "sk-ant-your-key"
= "claude-sonnet-4-5-20250929"
= 0.3
[]
= true
= true
[]
= "info"
[]
= true
For complete configuration reference, see docs/guide/configuration.md.
Advanced Features
Custom Providers
Add any OpenAI or Claude compatible API:
[]
= "openai"
= "sk-your-deepseek-key"
= "https://api.deepseek.com/v1/chat/completions"
= "deepseek-chat"
See docs/guide/providers.md for more examples.
Custom Prompts
Customize commit message or review prompts:
[]
= """
Generate a commit message in Chinese for:
{diff}
Files: {files_changed}
Stats: +{insertions} -{deletions}
"""
See docs/guide/prompts.md for template variables and examples.
Debug Mode
Use --verbose to see detailed logs:
Security Notice: Verbose mode (
-vorRUST_LOG=debug) logs full API requests and responses, which may include:
- Your code diffs and changes
- Partial API keys in error messages
- Generated commit messages
Do not share verbose logs publicly or commit them to version control.
Documentation
- Installation Guide - Detailed installation instructions
- Git Aliases Guide - Complete guide to git aliases
- Command Reference - Detailed command documentation
- Configuration Reference - Complete configuration guide
- Provider Setup - Configure LLM providers
- Custom Prompts - Customize AI prompts
- Troubleshooting - Common issues and solutions
Requirements
- Rust 1.70 or higher
- Git
- API key for at least one provider (Claude, OpenAI, or local Ollama)
License
MIT License - see LICENSE file for details.
Author
AptS:1547 (Yuhan Bian / 卞雨涵) apts-1547@esaps.net
Tip: Run gcop-rs --help to see all commands, or use git c after installing aliases for quick commits!