rusty-commit 1.0.24

Rust-powered AI commit message generator - Write impressive commits in seconds
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
<div align="center">

# 🦀 Rusty Commit (`rco`)

### **AI-powered commit message generator written in Rust**

**Generate conventional commits, GitMoji messages, and PR descriptions using 18+ AI providers**

[![CI](https://github.com/hongkongkiwi/rusty-commit/actions/workflows/ci.yml/badge.svg)](https://github.com/hongkongkiwi/rusty-commit/actions/workflows/ci.yml)
[![Crates.io](https://img.shields.io/crates/v/rusty-commit.svg)](https://crates.io/crates/rusty-commit)
[![Documentation](https://docs.rs/rusty-commit/badge.svg)](https://docs.rs/rusty-commit)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

**🚀 Fast · 🔒 Secure · 🏠 Local-first · 🔌 Editor integrations via MCP**

[Installation](#installation) · [Quick Start](#quick-start) · [Features](#features) · [Providers](#providers) · [Configuration](#configuration) · [Git Hooks](#git-hooks)

</div>

---

## ✨ Why Rusty Commit?

<table>
<tr>
<td width="50%">

**⚡ Blazing Fast**

Native Rust binary with instant startup time. No Node.js bloat, no waiting.

**🤖 18+ AI Providers**

Works with OpenAI, Claude, OpenRouter, Groq, DeepSeek, GitHub Copilot, Ollama, and more.

**🔐 Secure by Default**

Optional keychain storage keeps your API keys safe. OAuth support for major providers.

</td>
<td width="50%">

**🎨 Flexible Formats**

Conventional commits, GitMoji, or custom templates. Multi-language support.

**🔄 Multi-Account Support**

Seamlessly switch between work and personal accounts, different providers, or models.

**🔌 Editor Integration**

MCP server for Cursor, VS Code, Claude Code, and other AI-powered editors.

</td>
</tr>
</table>

---

## 📦 Installation

### One-liner (recommended)

```bash
curl -fsSL https://raw.githubusercontent.com/hongkongkiwi/rusty-commit/main/install.sh | bash
```

<details>
<summary>🔐 Security-conscious? Verify the install script first</summary>

```bash
# Download and inspect
curl -fsSL https://raw.githubusercontent.com/hongkongkiwi/rusty-commit/main/install.sh -o install.sh
# Verify with SHA256 checksums, Cosign, GPG, or GitHub attestations
# See: docs/INSTALL-SCRIPT-VERIFICATION.md
```

</details>

### Package Managers

| Platform | Command |
|----------|---------|
| **Homebrew** | `brew tap hongkongkiwi/tap && brew install rusty-commit` |
| **Cargo** | `cargo install rusty-commit --features secure-storage` |
| **Debian/Ubuntu** | `wget .../rusty-commit_amd64.deb && sudo dpkg -i rusty-commit_amd64.deb` |
| **Fedora/RHEL** | `sudo dnf install https://.../rusty-commit.x86_64.rpm` |
| **Alpine** | `wget .../rusty-commit-x86_64.apk && sudo apk add --allow-untrusted rusty-commit-x86_64.apk` |
| **Windows (Scoop)** | `scoop install rusty-commit` |
| **Windows (Binary)** | [Download from releases]https://github.com/hongkongkiwi/rusty-commit/releases |

---

## 🚀 Quick Start

### Interactive Setup Wizard

The easiest way to get started with Rusty Commit:

```bash
rco setup                   # Interactive wizard (recommended)
rco setup --advanced        # Full configuration with all options
rco setup --defaults        # Non-interactive with sensible defaults
```

**Quick Setup** will ask you:
1. **AI Provider** - Choose from 15+ providers (OpenAI, Anthropic, Gemini, Ollama, etc.)
2. **API Key** - Securely stored in your system's keychain
3. **Commit Format** - Conventional commits, GitMoji, or simple

**Advanced Setup** additionally includes:
- Custom model selection and API endpoints
- Commit message style (capitalization, max length, language)
- Behavior settings (auto-push, commit body, variations)
- Token limits and hook configuration

### Generate Your First Commit

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

# 2. Generate commit message
rco

# 3. Review, edit, or regenerate interactively
```

### Multi-Account Workflow (Recommended)

```bash
# Add multiple provider accounts
rco config add-provider    # Add work-openai
rco config add-provider    # Add personal-anthropic

# Switch between them
rco config use-account work-openai
git add . && rco

rco config use-account personal-anthropic
git add . && rco
```

---

## 🎯 Features

### 📝 Commit Message Generation

```bash
rco                         # Interactive mode with review
rco -y                      # Auto-commit without confirmation
rco -g 3                    # Generate 3 variations to choose from
rco -c "Fix OAuth flow"     # Add extra context
```

### 😄 GitMoji Support

```bash
rco --fgm                   # Full GitMoji specification
rco -fgm -y                 # GitMoji + auto-commit
```

**Output:**
```
✨ feat(auth): implement OAuth2 PKCE flow

🔐 Add secure authentication with automatic token refresh.
Supports GitHub, GitLab, and generic OAuth2 providers.
```

### 📋 Clipboard Mode

```bash
rco -C                      # Copy to clipboard instead of committing
```

### 🔍 Debug Tools

```bash
rco --show-prompt           # See the exact prompt sent to AI
rco --timing                # Show detailed timing information
RUST_LOG=debug rco          # Enable debug logging
```

---

## 🤖 Providers

Rusty Commit works with **18+ AI providers** out of the box. Configure them interactively with `rco setup` or manually as shown below:

> 💡 **Tip**: Use `rco setup` for interactive provider configuration with step-by-step guidance.

### 🔑 OAuth-Enabled (No API Key Required)

| Provider | Command |
|----------|---------|
| **Claude (Anthropic)** | `rco auth login` |
| **Claude Code** | `rco auth login` |
| **GitHub Copilot** | `rco auth login --provider github-copilot` |

### 🔐 API Key Providers

| Provider | Setup |
|----------|-------|
| **OpenAI** | `rco config set RCO_AI_PROVIDER=openai RCO_API_KEY=sk-... RCO_MODEL=gpt-4o-mini` |
| **Anthropic** | `rco config set RCO_AI_PROVIDER=anthropic RCO_API_KEY=sk-ant-... RCO_MODEL=claude-3-5-haiku-20241022` |
| **OpenRouter** | `rco config set RCO_AI_PROVIDER=openrouter RCO_API_KEY=sk-or-...` |
| **Groq** | `rco config set RCO_AI_PROVIDER=groq RCO_API_KEY=gsk_... RCO_MODEL=llama-3.1-70b-versatile` |
| **DeepSeek** | `rco config set RCO_AI_PROVIDER=deepseek RCO_API_KEY=sk-... RCO_MODEL=deepseek-chat` |
| **xAI/Grok** | `rco config set RCO_AI_PROVIDER=xai RCO_API_KEY=... RCO_MODEL=grok-beta` |
| **Mistral** | `rco config set RCO_AI_PROVIDER=mistral RCO_API_KEY=... RCO_MODEL=mistral-small-latest` |
| **Google Gemini** | `rco config set RCO_AI_PROVIDER=gemini RCO_API_KEY=... RCO_MODEL=gemini-pro` |
| **Azure OpenAI** | `rco config set RCO_AI_PROVIDER=azure RCO_API_KEY=... RCO_API_URL=https://<resource>.openai.azure.com` |
| **Perplexity** | `rco config set RCO_AI_PROVIDER=perplexity RCO_API_KEY=...` |
| **Ollama (Local)** | `rco config set RCO_AI_PROVIDER=ollama RCO_MODEL=mistral RCO_API_URL=http://localhost:11434` |
| **Fireworks** | `rco config set RCO_AI_PROVIDER=fireworks RCO_API_KEY=...` |
| **Moonshot/Kimi** | `rco config set RCO_AI_PROVIDER=moonshot RCO_API_KEY=... RCO_API_URL=https://api.moonshot.cn/v1 RCO_MODEL=kimi-k2` |
| **Alibaba Qwen** | `rco config set RCO_AI_PROVIDER=dashscope RCO_API_KEY=... RCO_API_URL=https://dashscope.aliyuncs.com/compatible-mode/v1 RCO_MODEL=qwen3-coder-32b-instruct` |
| **Together AI** | `rco config set RCO_AI_PROVIDER=together RCO_API_KEY=...` |
| **DeepInfra** | `rco config set RCO_AI_PROVIDER=deepinfra RCO_API_KEY=...` |

<details>
<summary>🔒 Secure Storage</summary>

When built with `--features secure-storage`:
- **macOS**: Keychain
- **Linux**: Secret Service (GNOME Keyring, KWallet, KeePassXC)
- **Windows**: Credential Manager

Falls back to config file if keychain is unavailable.

</details>

---

## ⚙️ Configuration

### Interactive Configuration

The easiest way to configure Rusty Commit is through the setup wizard:

```bash
rco setup                   # Quick setup (essential settings only)
rco setup --advanced        # Advanced setup (all settings)
```

### Configuration Priority

```
Per-repo config > Global config > Environment variables > Defaults
```

### Manual Config Commands

```bash
rco config status                          # Check secure storage status
rco config set RCO_AI_PROVIDER=anthropic   # Set provider
rco config set RCO_MODEL=claude-3-5-haiku  # Set model
rco config set RCO_COMMIT_TYPE=conventional # conventional or gitmoji
rco config set RCO_EMOJI=true              # Include emojis
rco config set RCO_LANGUAGE=en             # Output language
rco config get RCO_AI_PROVIDER             # Get current value
rco config describe                        # Show all options
rco config reset --all                     # Reset to defaults
```

### Common Options

| Key | Description | Default |
|-----|-------------|---------|
| `RCO_AI_PROVIDER` | AI backend | `anthropic` |
| `RCO_MODEL` | Model name | Provider-specific |
| `RCO_API_KEY` | API key | - |
| `RCO_API_URL` | Custom endpoint | - |
| `RCO_COMMIT_TYPE` | Commit format | `conventional` |
| `RCO_EMOJI` | Include emojis | `false` |
| `RCO_LANGUAGE` | Output language | `en` |
| `RCO_MAX_TOKENS` | Max response tokens | `1024` |
| `RCO_TEMPERATURE` | Response creativity | `0.7` |
| `RCO_ENABLE_COMMIT_BODY` | Add commit body with context | `false` |
| `RCO_LEARN_FROM_HISTORY` | Learn style from git history | `false` |
| `RCO_HISTORY_COMMITS_COUNT` | Commits to analyze for style | `50` |

---

## 🎣 Git Hooks

### Install/Uninstall

```bash
rco hook set    # Install prepare-commit-msg hook
rco hook unset  # Remove hook
```

Once installed, `git commit` (without `-m`) automatically generates commit messages!

### Advanced Hooks

```bash
# Pre-generation hook
rco config set RCO_PRE_GEN_HOOK="just lint; just test -q"

# Pre-commit hook
rco config set RCO_PRE_COMMIT_HOOK="./scripts/tweak_commit.sh"

# Post-commit hook
rco config set RCO_POST_COMMIT_HOOK="git push"

# Hook behavior
rco config set RCO_HOOK_STRICT=false       # Allow hook failures
rco config set RCO_HOOK_TIMEOUT_MS=60000   # Timeout in ms
```

### Skip Hooks (Per-Run)

```bash
rco --no-pre-hooks      # Skip pre-gen + pre-commit hooks
rco --no-post-hooks     # Skip post-commit hooks
```

---

## 🧠 Advanced Features

### Repository Context Awareness

Rusty Commit automatically detects and includes project context for better commit messages:

```bash
# Create custom context file
echo "Payment processing microservice using Stripe API" > .rco/context.txt
```

**Auto-detected context sources:**
- `.rco/context.txt` - Custom project description
- `README.md` - First paragraph
- `Cargo.toml` - Rust project description
- `package.json` - Node.js project description

### Commit Body Generation

Enable detailed commit messages with body explaining the "why":

```bash
rco config set RCO_ENABLE_COMMIT_BODY=true
```

**Output:**
```
feat(auth): implement OAuth2 PKCE flow

- Add secure token storage with automatic refresh
- Support GitHub, GitLab, and generic OAuth2 providers
- Handle token expiration gracefully
```

### Style Learning from History

Automatically learn and match your team's commit style:

```bash
rco config set RCO_LEARN_FROM_HISTORY=true
```

Analyzes last 50 commits to detect:
- Common commit types and scopes
- Average description length
- Capitalization preferences
- Gitmoji usage patterns

### Enhanced GitMoji Support

25+ emojis from [gitmoji.dev](https://gitmoji.dev) specification:

| Emoji | Meaning | Use Case |
|-------|---------|----------|
|| `:sparkles:` | New feature |
| 🐛 | `:bug:` | Bug fix |
| 📝 | `:memo:` | Documentation |
| 🎨 | `:art:` | Code structure/format |
| ♻️ | `:recycle:` | Refactoring |
|| `:zap:` | Performance |
|| `:white_check_mark:` | Tests |
| 🔒 | `:lock:` | Security fix |
| ⬆️ | `:arrow_up:` | Upgrade dependencies |
| 🔥 | `:fire:` | Remove code/files |
| 🚀 | `:rocket:` | Deployment |
| 💥 | `:boom:` | Breaking changes |

---

## 🎨 Custom Skills

Create reusable commit message templates and prompt customizations:

```bash
# List available skills
rco skills list

# Create a new skill
rco skills create conventional-with-scope --category template

# Create project-specific skill
rco skills create my-team-style --project

# Show skill details
rco skills show my-team-style

# Remove a skill
rco skills remove my-team-style
```

### Skill Structure

Skills are stored in `~/.config/rustycommit/skills/` (or `.rco/skills/` for project-specific):

```
my-skill/
├── skill.toml      # Skill manifest
├── prompt.md       # Custom prompt template
└── hooks/          # Optional hooks
    ├── pre_gen.sh
    └── post_gen.sh
```

### Custom Prompt Template

Create `prompt.md` with placeholders:

```markdown
# Custom Commit Prompt

Analyze this {language} code change:

{diff}

Context: {context}
Format: {commit_type}
Max length: {max_length}

Generate a commit message following our team conventions:
- Use present tense
- Include ticket number if obvious from branch name
- Reference related components
```

---

## 🔌 MCP Server

Rusty Commit includes an **MCP (Model Context Protocol)** server for editor integrations.

### Start the Server

```bash
# TCP Mode (Cursor, VS Code)
rco mcp server --port 3000

# STDIO Mode (Direct integration)
rco mcp stdio
```

### Editor Setup

**Cursor:**
```
Settings > Features > MCP > Add Server
Type: HTTP
URL: http://localhost:3000
```

**Claude Code:**
```bash
rco mcp stdio | claude-code connect stdio
```

### Available MCP Tools

- `generate_commit` - Generate commit from staged changes
- `get_config` / `set_config` - Manage configuration
- `list_accounts` / `use_account` - Switch accounts

---

## 🔄 Multi-Account Support

Perfect for switching between work and personal projects!

```bash
# Add accounts
rco config add-provider                    # Interactive wizard
rco config add-provider --provider openai --alias work-openai

# Manage accounts
rco config list-accounts                   # Show all accounts
rco config show-account work-openai        # Show account details
rco config use-account work-openai         # Switch to account
rco config remove-account work-openai      # Remove account
```

### Account Configuration

Accounts stored in `~/.config/rustycommit/accounts.toml`:

```toml
[accounts.work-openai]
provider = "openai"
model = "gpt-4o-mini"

[accounts.personal-anthropic]
provider = "anthropic"
model = "claude-3-5-haiku-20241022"

[active_account]
alias = "work-openai"
```

---

## 📋 PR Description Generation

```bash
rco pr generate             # Generate PR description for current branch
rco pr generate --base main # Compare against main branch
rco pr browse               # Generate and open PR creation page
```

Features:
- Analyzes all commits since base branch
- Groups changes by type (features, fixes, docs, etc.)
- Follows PR template conventions
- Includes breaking changes and deprecation notices

---

## 🚫 File Exclusion

Exclude files from AI analysis via `.rcoignore`:

```gitignore
# Dependencies
node_modules/
vendor/
Cargo.lock

# Build artifacts
*.min.js
*.map
dist/
build/

# IDE
.idea/
.vscode/

# OS
.DS_Store
Thumbs.db
```

Or via command line:

```bash
rco -x "package-lock.json" -x "*.lock" -x "*.min.js"
```

---

## 🔄 Updates

```bash
rco update --check          # Check for updates
rco update                  # Update to latest
rco update --force          # Force update
rco update --version 1.0.2  # Install specific version
```

---

## 🏃 GitHub Action

Use in CI/CD workflows:

```yaml
name: AI Commits
on: [push]

jobs:
  ai-commit:
    runs-on: ubuntu-latest
    permissions:
      contents: write
    steps:
      - uses: actions/checkout@v4
        with:
          fetch-depth: 0
      - uses: hongkongkiwi/action-rusty-commit@v1
        with:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
          RCO_API_KEY: ${{ secrets.RCO_API_KEY }}
          RCO_AI_PROVIDER: 'anthropic'
          RCO_MODEL: 'claude-3-5-haiku-20241022'
```

See [action-rusty-commit](https://github.com/hongkongkiwi/action-rusty-commit) for details.

---

## 🛠️ Troubleshooting

| Issue | Solution |
|-------|----------|
| **401 / Invalid API key** | Re-authenticate: `rco auth login` or set `RCO_API_KEY` |
| **429 Rate-limited** | Wait briefly; try lighter model or switch accounts |
| **Secure storage unavailable** | Falls back to file; check `rco config status` |
| **Hooks not running** | Ensure `.git/hooks/prepare-commit-msg` is executable |
| **OAuth browser not opening** | Use `rco auth login --no-browser` |
| **Large diff truncated** | Increase `RCO_DIFF_TOKENS` or use `.rcoignore` |
| **Reasoning model thinking tags** | Use `--strip-thinking` flag |

### Debug Mode

```bash
RUST_LOG=debug rco -y       # Enable debug logging
rco --show-prompt           # See exact prompt sent to AI
rco --timing                # Show timing breakdown
```

---

## 🧪 Development

```bash
# Build
cargo build
cargo build --release
cargo build --features secure-storage

# Test
cargo test
cargo test --all-features

# Lint
cargo clippy --all-features -- -D warnings
cargo fmt

# Just commands
just build
just test
just all    # fmt + clippy + test
```

---

## 🔒 Security & Verification

All releases are cryptographically signed with multiple methods:

### Automatic Verification

The install script automatically verifies downloads using the strongest available method.

### Manual Verification

```bash
# Cosign/Sigstore (modern)
cosign verify-blob \
  --bundle rustycommit-linux-x86_64.tar.gz.cosign.bundle \
  --certificate-identity-regexp "https://github.com/hongkongkiwi/rusty-commit/.github/workflows/release.yml@.*" \
  --certificate-oidc-issuer "https://token.actions.githubusercontent.com" \
  rustycommit-linux-x86_64.tar.gz

# GPG (traditional)
gpg --keyserver hkps://keys.openpgp.org --recv-keys 0EC2DFF577818B86BA38DA3F164E3F90E425B2AD
gpg --verify rustycommit-linux-x86_64.tar.gz.asc rustycommit-linux-x86_64.tar.gz

# GitHub attestations
gh attestation verify rustycommit-linux-x86_64.tar.gz --repo hongkongkiwi/rusty-commit
```

See [docs/VERIFICATION.md](docs/VERIFICATION.md) for details.

---

## 💖 Support the Project

If Rusty Commit saves you time, consider supporting ongoing development:

[![GitHub Sponsors](https://img.shields.io/badge/Sponsor-@hongkongkiwi-fd2e83?logo=github-sponsors&logoColor=white)](https://github.com/sponsors/hongkongkiwi)
[![Buy Me a Coffee](https://img.shields.io/badge/Buy%20Me%20a%20Coffee-support-ffdd00?logo=buymeacoffee&logoColor=black)](https://buymeacoffee.com/hongkongkiwi)

---

## 📄 License

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

---

<div align="center">

**Inspired by [OpenCommit](https://github.com/di-sukharev/opencommit)** · Built with 🦀 Rust

**Build faster. Commit smarter.**

</div>