Skip to content

san0808/commitcraft

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

32 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎨 CommitCraft

Crates.io Downloads License: MIT CI

A fast, intelligent CLI tool that generates conventional commit messages using AI. Built in Rust for performance and reliability.

πŸŽ‰ What's New in v1.1.0: Updated to the latest AI models for 75% faster responses and 75% cost savings! Now featuring GPT-4.1 Nano and Claude 3.5 Haiku as defaults.

✨ Features

  • πŸ€– Multi-AI Provider Support: Works with OpenAI, Google Gemini, and Anthropic Claude
  • πŸ“‹ Conventional Commits: Follows Conventional Commits v1.0.0 specification
  • βš™οΈ Smart Configuration: Interactive setup with TOML configuration file
  • 🎯 Context-Aware: Analyzes staged files and repository context
  • πŸ”§ Developer-Friendly: Built for fast iteration with dry-run, review, and verbose modes
  • πŸ“± Model Aliases: Quick switching between models with custom aliases

πŸš€ Quick Start

Installation

Option 1: Quick Install (Linux/macOS)

curl -sSL https://raw.githubusercontent.com/san0808/commitcraft/main/install.sh | bash

Option 2: Install via Cargo

cargo install commitcraft

Option 3: Download Binary

Download the latest binary from GitHub Releases

Option 4: Build from Source

git clone https://github.com/san0808/commitcraft
cd commitcraft
cargo build --release
sudo cp target/release/commitcraft /usr/local/bin/commitcraft

Setup

# Run interactive setup
commitcraft setup

# Check your configuration
commitcraft config

# List available providers and models
commitcraft list

πŸ“– Usage

✨ New Interactive Mode (Default)

# Stage your changes
git add .

# Generate and edit commit command interactively
commitcraft
βœ“ Message generated successfully!

πŸ“ Generated commit message:
──────────────────────────────────────────────────
feat(auth): add OAuth2 login support

Implement OAuth2 authentication flow with Google and GitHub providers.
Includes token refresh logic and secure storage.
──────────────────────────────────────────────────

Edit the command below (or press Enter to execute):
$ git commit -m "feat(auth): add OAuth2 login support"β–ˆ
# ↑ You can edit this command or just press Enter to execute

πŸš€ Quick Modes

# Skip interactive editing, commit immediately
commitcraft -y

# Just show the git command (no execution)
commitcraft --show-command

# Dry run (generate message without committing)
commitcraft --dry-run

# Use legacy confirmation flow
commitcraft --legacy

πŸ”§ Advanced Usage

# Use specific provider and model
commitcraft --provider openai --model gpt-4o

# Use model alias
commitcraft --model smart

# Include verbose output and file context
commitcraft --verbose --include-files

# Review in editor before committing
commitcraft --review

# Combine options
commitcraft --provider anthropic --model fast --verbose --yes

πŸ› οΈ Configuration

Configuration is stored at ~/.config/commitcraft/config.toml:

default_provider = "gemini"

[api_keys]
openai = "sk-..."
gemini = "your-api-key"
anthropic = "your-api-key"

[models]
openai = "gpt-4.1-nano"                    # Latest: 75% faster & cheaper
gemini = "gemini-1.5-flash-latest"         # Unchanged: Already optimal  
anthropic = "claude-3-5-haiku-20241022"    # Latest: Superior performance

[aliases]
fast = "gemini-1.5-flash-latest"
smart = "gpt-4o"

🎯 Conventional Commits

This tool generates commit messages following the Conventional Commits specification:

<type>[optional scope]: <description>

[optional body]

[optional footer(s)]

Supported Types

  • feat: New features
  • fix: Bug fixes
  • docs: Documentation changes
  • style: Code formatting
  • refactor: Code restructuring
  • test: Adding tests
  • chore: Maintenance tasks
  • perf: Performance improvements
  • ci: CI/CD changes
  • build: Build system changes

Examples

feat(auth): add OAuth2 login support

Implement OAuth2 authentication flow with Google and GitHub providers.
Includes token refresh logic and secure storage.

feat!: remove deprecated API endpoints

BREAKING CHANGE: The v1 API endpoints have been removed. Use v2 instead.

πŸ—οΈ Project Structure

src/
β”œβ”€β”€ main.rs           # Main application entry point
β”œβ”€β”€ cli.rs            # Command-line interface definitions
β”œβ”€β”€ config.rs         # Configuration management
β”œβ”€β”€ git.rs            # Git operations (diff, commit, repo info)
└── providers/        # AI provider implementations
    β”œβ”€β”€ mod.rs        # Common traits and structures
    β”œβ”€β”€ openai.rs     # OpenAI GPT integration
    β”œβ”€β”€ gemini.rs     # Google Gemini integration
    └── anthropic.rs  # Anthropic Claude integration

🎬 Demos & Recordings

Watch CommitCraft in Action

Experience CommitCraft's power through our professional demo videos:

🎯 Quick Demo (3 minutes)

Perfect for social media and quick showcases:

./demo/quick-demo.sh

🎨 Full Cinematic Demo (8-10 minutes)

Complete feature walkthrough for presentations:

./demo/cinematic-demo.sh

Automatic Features:

  • βœ… Generates MP4, GIF, WebM formats for any platform
  • βœ… Professional quality with realistic typing effects
  • βœ… Upload guides for YouTube, Twitter, LinkedIn, GitHub

See demo/README.md for complete documentation.

πŸ§ͺ Development

Building

cargo build --release

Testing

cargo test

Manual Testing Checklist

  1. Setup Flow

    cargo run -- setup
  2. Basic Generation

    git add some-file.rs
    cargo run -- --dry-run
  3. Provider Testing

    cargo run -- --provider openai --dry-run
    cargo run -- --provider gemini --dry-run
    cargo run -- --provider anthropic --dry-run
  4. Advanced Features

    cargo run -- --verbose --include-files --dry-run
    cargo run -- config
    cargo run -- list

πŸ”§ Troubleshooting

Common Issues

"Not inside a git repository"

  • Make sure you're in a git repository
  • Run git init if needed

"No staged files to commit"

  • Stage your changes with git add . or git add <file>

"API key not found"

  • Run commitcraft setup to configure API keys
  • Check your configuration with commitcraft config

Build errors

  • Ensure you have Rust 1.70+ installed
  • Run rustup update to update your toolchain

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch
  3. Make your changes
  4. Add tests
  5. Submit a pull request

πŸ“„ License

MIT License - see LICENSE file for details.

πŸ™ Acknowledgments

  • Conventional Commits specification
  • Rust community for excellent crates
  • AI providers (OpenAI, Google, Anthropic) for powerful models

About

A fast, intelligent CLI tool that generates conventional commit messages using AI

Resources

License

Contributing

Stars

Watchers

Forks

Packages

No packages published