| Crates.io | gcop-rs |
| lib.rs | gcop-rs |
| version | 0.7.2 |
| created_at | 2025-12-16 20:27:38.277395+00 |
| updated_at | 2026-01-22 01:57:49.895243+00 |
| description | AI-powered Git commit message generator and code reviewer |
| homepage | https://github.com/AptS-1547/gcop-rs |
| repository | https://github.com/AptS-1547/gcop-rs |
| max_upload_size | |
| id | 1988632 |
| size | 694,993 |
AI-powered Git commit message generator and code reviewer, written in Rust.
Note: This project is a Rust rewrite inspired by gcop, the original Python implementation by Undertone0809. The Rust version aims to build upon that foundation with improved performance and reliability.
git c, git r, git acp for streamlined workflowinit command for quick configuration# Homebrew (macOS/Linux)
brew tap AptS-1547/tap
brew install gcop-rs
# pipx (Python users)
pipx install gcop-rs
# cargo-binstall (no compilation required)
cargo binstall gcop-rs
# cargo install (from source)
cargo install gcop-rs
For other installation methods, see docs/guide/installation.md.
Option 1: Quick setup (recommended)
gcop-rs init
This interactive wizard will:
Option 2: Manual setup
Use gcop-rs config edit to open config file in your system editor, or create manually at:
~/.config/gcop/config.toml~/Library/Application Support/gcop/config.toml%APPDATA%\gcop\config.toml[llm]
default_provider = "claude"
[llm.providers.claude]
api_key = "sk-ant-your-key-here"
model = "claude-sonnet-4-5-20250929"
Or use environment variables:
export ANTHROPIC_API_KEY="sk-ant-your-key"
See docs/guide/configuration.md for all options.
# Generate commit message
git add .
gcop-rs commit
# Or use the alias: git c
# Review uncommitted changes
gcop-rs review
# Or use the alias: git r
# Complete workflow
git acp # Add all, commit with AI, and push
# Use different provider
gcop-rs --provider openai commit
gcop-rs provides convenient git aliases for streamlined workflow.
# Install all aliases
gcop-rs alias
# Or during initial setup
gcop-rs init # Will prompt to install aliases
After installation, you can use these shortcuts:
git c # AI commit message and commit
git r # AI review uncommitted changes
git s # Show repository statistics
git ac # Add all changes and commit with AI
git cp # Commit with AI and push
git acp # Add all, commit with AI, and push
git gconfig # Edit gcop-rs configuration
git p # Push to remote
git pf # Force push (safer with --force-with-lease)
git undo # Undo last commit (keep changes staged)
# List all available aliases
gcop-rs alias --list
# Reinstall (overwrite conflicts)
gcop-rs alias --force
# Remove all gcop-rs aliases
gcop-rs alias --remove --force
See docs/guide/aliases.md for detailed information on each alias.
gcop-rs initInitialize gcop-rs configuration.
gcop-rs init
Interactive setup wizard that:
gcop-rs commitGenerate AI-powered commit message for staged changes.
gcop-rs commit # Generate, review, and commit
gcop-rs commit --no-edit # Skip editor
gcop-rs commit --yes # Skip confirmation
gcop-rs commit --dry-run # Only print message, do not commit
gcop-rs -v commit # Verbose mode
Interactive workflow:
After generating a commit message, you can choose:
Example:
$ git add .
$ gcop-rs commit
βΉ Generated commit message:
feat(auth): implement JWT token validation
Choose next action:
> Accept
Edit
Retry
Retry with feedback
Quit
gcop-rs reviewReview code changes with AI.
gcop-rs review # Review uncommitted changes
gcop-rs review --commit <hash> # Review a commit
gcop-rs review --range main..dev # Review commit range
gcop-rs review --file src/main.rs # Review a file
Output formats: --format text|json|markdown
gcop-rs configManage configuration.
# Edit config file in your default editor (with validation)
gcop-rs config edit
# Validate configuration and test provider connection
gcop-rs config validate
# Show current configuration
gcop-rs config show
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 aliasManage git aliases.
gcop-rs alias # Install all aliases
gcop-rs alias --list # List available aliases
gcop-rs alias --force # Overwrite conflicts
gcop-rs alias --remove --force # Remove all aliases
Provides convenient shortcuts like git c, git r, git acp, etc.
See docs/guide/aliases.md for details.
gcop-rs statsShow repository commit statistics.
gcop-rs stats # Show statistics (text format)
gcop-rs stats --format json # Output as JSON
gcop-rs stats --format markdown # Output as Markdown
gcop-rs stats --author "name" # Filter by author
Displays:
Config file location (platform-specific):
~/.config/gcop/config.toml~/Library/Application Support/gcop/config.toml%APPDATA%\gcop\config.tomlExample configuration with Claude API:
[llm]
default_provider = "claude"
[llm.providers.claude]
api_key = "sk-ant-your-key"
model = "claude-sonnet-4-5-20250929"
temperature = 0.3
[commit]
show_diff_preview = true
allow_edit = true
[review]
min_severity = "info"
[ui]
colored = true
For complete configuration reference, see docs/guide/configuration.md.
Add any OpenAI or Claude compatible API:
[llm.providers.deepseek]
api_style = "openai"
api_key = "sk-your-deepseek-key"
endpoint = "https://api.deepseek.com/v1/chat/completions"
model = "deepseek-chat"
See docs/guide/providers.md for more examples.
Customize commit message or review prompts:
[commit]
custom_prompt = """
Generate a commit message in Chinese for:
{diff}
Files: {files_changed}
Stats: +{insertions} -{deletions}
"""
See docs/guide/prompts.md for template variables and examples.
Use --verbose to see detailed logs:
gcop-rs -v commit # Shows API requests, responses, and prompts
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.
MIT License - see LICENSE file for details.
Undertone0809 - Creator of gcop (Python)
AptS:1547 (Yuhan Bian / ει¨ζΆ΅) apts-1547@esaps.net
This project would not exist without the original gcop by Undertone0809. The core concept of using AI to generate meaningful commit messages originated from that project.
Special thanks to:
Tip: Run gcop-rs --help to see all commands, or use git c after installing aliases for quick commits!