rusty_commit/lib.rs
1#![allow(clippy::uninlined_format_args)]
2#![allow(clippy::bind_instead_of_map)]
3#![allow(clippy::manual_async_fn)]
4
5//! Rusty Commit - AI-powered commit message generator written in Rust
6//!
7//! This library provides the core functionality for generating commit messages
8//! using various AI providers. It supports multiple providers including OpenAI,
9//! Anthropic, Claude, Ollama, Gemini, and Azure.
10//!
11//! # Features
12//!
13//! - **Multiple AI Providers**: OpenAI, Anthropic, Ollama, Gemini, Azure, and more
14//! - **Conventional Commits**: Generate properly formatted conventional commits
15//! - **GitMoji Support**: Generate commits with GitMoji emojis
16//! - **MCP Server**: Use as a Model Context Protocol server for editor integration
17//! - **Secure Storage**: Optional keychain integration for API keys
18//!
19//! # Quick Start
20//!
21//! ```no_run
22//! use rusty_commit::config::Config;
23//! use rusty_commit::providers::create_provider;
24//!
25//! # async fn example() -> anyhow::Result<()> {
26//! let config = Config::load()?;
27//! let provider = create_provider(&config)?;
28//! let diff = "your git diff here";
29//! let message = provider.generate_commit_message(
30//! diff,
31//! None,
32//! false,
33//! &config
34//! ).await?;
35//! # Ok(())
36//! # }
37//! ```
38//!
39//! # Documentation
40//!
41//! ## Getting Started
42//!
43//! ```no_run
44//! // 1. Configure your AI provider
45//! // Use OAuth (recommended): rco auth login
46//! // Or set API key: rco config set RCO_API_KEY=sk-...
47//!
48//! // 2. Generate a commit
49//! // git add .
50//! // rco
51//! # fn main() {}
52//! ```
53//!
54//! ## Configuration
55//!
56//! Configuration can be set via environment variables or config files:
57//!
58//! - Global: `~/.config/rustycommit/config.toml`
59//! - Per-repo: `.rustycommit.toml`
60//!
61//! Common keys:
62//! - `RCO_AI_PROVIDER` - Provider name (e.g., `anthropic`, `openai`, `ollama`)
63//! - `RCO_MODEL` - Model name
64//! - `RCO_API_KEY` - API key
65//! - `RCO_COMMIT_TYPE` - `conventional` or `gitmoji`
66//!
67//! ## AI Providers
68//!
69//! Supported providers:
70//! - **Cloud**: OpenAI, Anthropic Claude, OpenRouter, Groq, DeepSeek, Gemini, Azure, Together AI, DeepInfra, Mistral, Perplexity, Fireworks, Moonshot, DashScope, XAI
71//! - **Local**: Ollama
72//!
73//! Use `rco auth login` for OAuth providers or `rco config set RCO_API_KEY=...` for API key providers.
74
75pub mod auth;
76pub mod cli;
77pub mod commands;
78pub mod config;
79pub mod git;
80pub mod output;
81pub mod providers;
82pub mod update;
83pub mod utils;