feat:Add 3 new LLM providers and optimize the readme.

This commit is contained in:
2026-01-30 16:47:19 +08:00
parent f610c0af8b
commit 2a57946421
13 changed files with 1483 additions and 377 deletions

314
README.md
View File

@@ -1,49 +1,40 @@
# QuiCommit
A powerful AI-powered Git assistant for generating conventional commits, tags, and changelogs. Manage multiple Git profiles for different work contexts seamlessly.
A powerful AI-powered Git assistant for generating conventional commits, tags, and changelogs. Manage multiple Git profiles for different work contexts.
![Rust](https://img.shields.io/badge/rust-%23000000.svg?style=for-the-badge&logo=rust&logoColor=white)
![License](https://img.shields.io/badge/license-MIT%2FApache--2.0-blue.svg)
![License](https://img.shields.io/badge/license-MIT-blue.svg)
## Features
- 🤖 **AI-Powered Generation**: Generate commit messages, tag annotations, and changelog entries using LLM APIs (OpenAI, Anthropic) or local Ollama models
- 📝 **Conventional Commits**: Full support for Conventional Commits and @commitlint formats
- 👤 **Profile Management**: Save and switch between multiple Git profiles (user info, SSH keys, GPG signing)
- 🏷️ **Smart Tagging**: Semantic version bumping with auto-generated release notes
- 📜 **Changelog Generation**: Automatic changelog generation in Keep a Changelog or GitHub Releases format
- 🔐 **Security**: Encrypt sensitive data like SSH passphrases and API keys
- 🎨 **Interactive UI**: Beautiful CLI with interactive prompts and previews
- **AI-Powered Generation**: Generate commits, tags, and changelogs using LLM APIs (Ollama, OpenAI, Anthropic, Kimi, DeepSeek, OpenRouter) or local models
- **Conventional Commits**: Full support for Conventional Commits and commitlint formats
- **Profile Management**: Manage multiple Git identities with SSH keys and GPG signing support
- **Smart Tagging**: Semantic version bumping with AI-generated release notes
- **Changelog Generation**: Automatic changelog generation in Keep a Changelog format
- **Security**: Encrypt sensitive data
- **Interactive UI**: Beautiful CLI with previews and confirmations
## Installation
### From Source
```bash
git clone https://github.com/yourusername/quicommit.git
cd quicommit
cargo build --release
cargo install --path .
```
The binary will be available at `target/release/quicommit`.
### Prerequisites
- Rust 1.70 or later
- Git 2.0 or later
- For AI features: Ollama (local) or API keys for OpenAI/Anthropic
Requirements: Rust 1.70+, Git 2.0+
## Quick Start
### 1. Initialize Configuration
### Initialize
```bash
quicommit init
```
This will guide you through setting up your first profile and LLM configuration.
### 2. Generate a Commit
### Generate Commit
```bash
# AI-generated commit (default)
@@ -52,27 +43,27 @@ quicommit commit
# Manual commit
quicommit commit --manual -t feat -m "add new feature"
# Date-based commit
quicommit commit --date
# Stage all and commit
quicommit commit -a
# Skip confirmation
quicommit commit --yes
```
### 3. Create a Tag
### Create Tag
```bash
# Auto-detect version bump from commits
# Auto-detect version bump
quicommit tag
# Bump specific version
# Specify bump type
quicommit tag --bump minor
# Custom tag name
quicommit tag -n v1.0.0
```
### 4. Generate Changelog
### Generate Changelog
```bash
# Generate for unreleased changes
@@ -80,19 +71,12 @@ quicommit changelog
# Generate for specific version
quicommit changelog -v 1.0.0
# Initialize new changelog
quicommit changelog --init
```
## Configuration
### Profiles
Manage multiple Git identities for different contexts:
### Manage Profiles
```bash
# Add a new profile
# Add new profile
quicommit profile add
# List profiles
@@ -101,133 +85,86 @@ quicommit profile list
# Switch profile
quicommit profile switch
# Apply profile to current repo
quicommit profile apply
# Set profile for current repo
quicommit profile set-repo personal
```
### LLM Providers
#### Ollama (Local - Recommended)
### Configure LLM
```bash
# Configure Ollama
# Configure Ollama (local)
quicommit config set-llm ollama
# Or with specific settings
quicommit config set-ollama --url http://localhost:11434 --model llama2
```
#### OpenAI
```bash
# Configure OpenAI
quicommit config set-llm openai
quicommit config set-openai-key YOUR_API_KEY
```
#### Anthropic Claude
```bash
# Configure Anthropic Claude
quicommit config set-llm anthropic
quicommit config set-anthropic-key YOUR_API_KEY
# Configure Kimi (Moonshot AI)
quicommit config set-llm kimi
quicommit config set-kimi-key YOUR_API_KEY
# Configure DeepSeek
quicommit config set-llm deepseek
quicommit config set-deepseek-key YOUR_API_KEY
# Configure OpenRouter
quicommit config set-llm openrouter
quicommit config set-openrouter-key YOUR_API_KEY
# Test LLM connection
quicommit config test-llm
```
### Commit Format
## Command Reference
```bash
# Use conventional commits (default)
quicommit config set-commit-format conventional
| Command | Alias | Description |
|---------|-------|-------------|
| `quicommit init` | `i` | Initialize configuration |
| `quicommit commit` | `c` | Generate and create commit |
| `quicommit tag` | `t` | Generate and create tag |
| `quicommit changelog` | `cl` | Generate changelog |
| `quicommit profile` | `p` | Manage Git profiles |
| `quicommit config` | `cfg` | Manage settings |
# Use commitlint format
quicommit config set-commit-format commitlint
```
### Commit Options
## Usage Examples
| Option | Description |
|--------|-------------|
| `-t, --commit-type` | Commit type (feat, fix, etc.) |
| `-s, --scope` | Commit scope |
| `-m, --message` | Commit description |
| `--body` | Commit body |
| `--breaking` | Mark as breaking change |
| `--manual` | Manual input, skip AI |
| `-a, --all` | Stage all changes |
| `-S, --sign` | GPG sign commit |
| `--amend` | Amend previous commit |
| `--dry-run` | Show without committing |
| `-y, --yes` | Skip confirmation |
### Interactive Commit Flow
### Tag Options
```bash
$ quicommit commit
Staged files (3):
• src/main.rs
• src/lib.rs
• Cargo.toml
🤖 AI is analyzing your changes...
────────────────────────────────────────────────────────────
Generated commit message:
────────────────────────────────────────────────────────────
feat: add user authentication module
Implement OAuth2 authentication with support for GitHub
and Google providers.
────────────────────────────────────────────────────────────
What would you like to do?
> ✓ Accept and commit
🔄 Regenerate
✏️ Edit
❌ Cancel
```
### Profile Management
```bash
# Create work profile
$ quicommit profile add
Profile name: work
Git user name: John Doe
Git user email: john@company.com
Is this a work profile? yes
Organization: Acme Corp
# Set for current repository
$ quicommit profile set-repo work
✓ Set 'work' for current repository
```
### Smart Tagging
```bash
$ quicommit tag
Latest version: v0.1.0
Version selection:
> Auto-detect bump from commits
Bump major version
Bump minor version
Bump patch version
🤖 AI is generating tag message from 15 commits...
Tag preview:
Name: v0.2.0
Message:
## What's Changed
### 🚀 Features
- Add user authentication
- Implement dashboard
### 🐛 Bug Fixes
- Fix login redirect issue
Create this tag? yes
✓ Created tag v0.2.0
```
| Option | Description |
|--------|-------------|
| `-n, --name` | Tag name |
| `-b, --bump` | Version bump (major/minor/patch) |
| `-m, --message` | Tag message |
| `-g, --generate` | AI-generate message |
| `-S, --sign` | GPG sign tag |
| `--lightweight` | Create lightweight tag |
| `--push` | Push to remote |
| `-y, --yes` | Skip confirmation |
## Configuration File
Configuration is stored at:
- **Linux**: `~/.config/quicommit/config.toml`
- **macOS**: `~/Library/Application Support/quicommit/config.toml`
- **Windows**: `%APPDATA%\quicommit\config.toml`
Example configuration:
Location:
- Linux/macOS: `~/.config/quicommit/config.toml`
- Windows: `%APPDATA%\quicommit\config.toml`
```toml
version = "1"
@@ -249,11 +186,16 @@ organization = "Acme Corp"
provider = "ollama"
max_tokens = 500
temperature = 0.7
timeout = 30
[llm.ollama]
url = "http://localhost:11434"
model = "llama2"
[llm.openai]
model = "gpt-4"
base_url = "https://api.openai.com/v1"
[commit]
format = "conventional"
auto_generate = true
@@ -262,7 +204,6 @@ max_subject_length = 100
[tag]
version_prefix = "v"
auto_generate = true
include_changelog = true
[changelog]
path = "CHANGELOG.md"
@@ -274,62 +215,81 @@ group_by_type = true
| Variable | Description |
|----------|-------------|
| `QUICOMMIT_CONFIG` | Path to configuration file |
| `EDITOR` | Default editor for interactive input |
| `QUICOMMIT_CONFIG` | Configuration file path |
| `EDITOR` | Default editor |
| `NO_COLOR` | Disable colored output |
## Shell Completions
### Bash
```bash
quicommit completions bash > /etc/bash_completion.d/quicommit
```
### Zsh
```bash
quicommit completions zsh > /usr/local/share/zsh/site-functions/_quicommit
```
### Fish
```bash
quicommit completions fish > ~/.config/fish/completions/quicommit.fish
```
## Troubleshooting
### LLM Connection Issues
```bash
# View current configuration
quicommit config list
# Test LLM connection
quicommit config test-llm
# List available models
quicommit config list-models
```
### Git Operations
```bash
# Check current profile
quicommit profile show
# Apply profile to fix git config
quicommit profile apply
# Edit configuration
quicommit config edit
```
## Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
Contributions are welcome! Please follow these steps:
### Submit a Pull Request
1. Fork the repository
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
3. Commit your changes (`git commit -m 'feat: add amazing feature'`)
4. Push to the branch (`git push origin feature/amazing-feature`)
2. Create a feature branch: `git checkout -b feature/your-feature`
3. Commit changes: `git commit -m 'feat: add new feature'`
4. Push branch: `git push origin feature/your-feature`
5. Open a Pull Request
### Development Setup
```bash
# Clone repository
git clone https://github.com/YOUR_USERNAME/quicommit.git
cd quicommit
# Fetch dependencies
cargo fetch
# Run in development mode
cargo run -- commit --help
# Run tests
cargo test
# Code quality checks
cargo clippy
cargo fmt --check
```
### Code Standards
- Follow Rust formatting (run `cargo fmt`)
- Use Conventional Commits for commit messages
- Add tests for new features
- Ensure `cargo clippy` passes with no warnings
### Project Structure
```
src/
├── commands/ # CLI command implementations
├── config/ # Configuration management
├── generator/ # AI content generation
├── git/ # Git operations
├── llm/ # LLM provider implementations
└── utils/ # Utility functions
```
## License
This project is licensed under the MIT OR Apache-2.0 license.
MIT License
## Acknowledgments