Skip to content

About

Lazy doing conventional commits? Let the LLM do the hard work for you!

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🚀 LazyCommit

AI-powered git commit orchestrator that intelligently sequences commits based on dependencies.

Features

  • 🧠 Dependency Analysis - Automatically analyzes file dependencies across multiple languages
  • 🤖 AI-Powered - Uses Claude or GPT-4 to group related changes and generate commit messages
  • 📝 Conventional Commits - Generates proper commit messages following standards
  • 🛡️ Safe by Default - Dry-run mode, backups, and rollback support
  • ⚡ Fast - Single binary, no runtime dependencies

Installation

Prerequisites

Build from source

git clone https://github.com/dvictor357/lazy-commit.git
cd lazy-commit
bun install
bun run compile

This creates a lazy-commit binary. Move it to your PATH:

sudo mv lazy-commit /usr/local/bin/

Quick Start

  1. Initialize configuration:

    lazy-commit init
  2. Set your API key (choose one):

    Option A: Edit ~/.config/lazy-commit/settings.json:

    {
      "ai": {
        "primary": "anthropic",
        "anthropicApiKey": "sk-ant-..."
      }
    }

    Option B: Set environment variable in ~/.zshrc:

    export ANTHROPIC_API_KEY="sk-ant-..."
  3. Make changes to your code, then:

    # Preview what would be committed
    lazy-commit commit --dry-run
    
    # Create intelligent commits
    lazy-commit commit

Usage

Commands

lazy-commit commit [options]    # Create intelligent commits with AI analysis
lazy-commit plan [options]      # Generate commit plan without executing
lazy-commit analyze [options]   # Analyze dependencies in current changes
lazy-commit validate            # Validate current changes
lazy-commit status              # Show git status and config info
lazy-commit init                # Initialize configuration
lazy-commit config show         # Show current configuration
lazy-commit config reset        # Reset to default configuration
lazy-commit cache list          # List all cached plans
lazy-commit cache show [id]     # Show a cached plan (defaults to latest)
lazy-commit cache execute [id]  # Execute a cached plan
lazy-commit cache clear         # Clear all cached plans
lazy-commit cache delete <id>   # Delete a specific cached plan

Options

--dry-run              # Preview without executing (no changes made)
-y, --yes              # Skip confirmation prompt (auto-confirm)
-i, --interactive      # Interactive mode with confirmations
--max-commits <n>      # Maximum number of commits to create
-c, --config <path>    # Use custom config file
-v, --verbose          # Verbose output
-q, --quiet            # Suppress output

Examples

# Preview commit plan (no changes made)
lazy-commit --dry-run commit

# Execute with confirmation prompt (default)
lazy-commit commit

# Skip confirmation prompt
lazy-commit commit -y

# Interactive mode
lazy-commit commit -i

# Limit to 3 commits
lazy-commit commit --max-commits 3

# Save analysis to file
lazy-commit analyze -o analysis.json

Note: By default, lazy-commit commit will show a plan summary and ask for confirmation before executing. Use --yes or -y to skip the prompt, or --dry-run to preview without any changes.

Caching

Commit plans are automatically cached after analysis. This allows you to:

  • Review plans before executing
  • Re-execute a plan without re-analyzing
  • Share plans across sessions
# List all cached plans
lazy-commit cache list

# Show the latest cached plan
lazy-commit cache show

# Show a specific plan
lazy-commit cache show plan-1234567890

# Execute the latest cached plan
lazy-commit cache execute

# Execute with dry-run
lazy-commit cache execute --dry-run

# Clear all cached plans
lazy-commit cache clear

Cache location: ~/.config/lazy-commit/cache/

Configuration

Config file location: ~/.config/lazy-commit/settings.json

{
  "ai": {
    "primary": "openai",
    "fallback": ["anthropic"],
    "maxTokens": 4000,
    "temperature": 0.1,
    "timeout": 30000,
    "retryAttempts": 3,
    "anthropic": {
      "apiKey": "sk-ant-...",
      "baseUrl": null,
      "model": "claude-haiku-4-5-20251001"
    },
    "openai": {
      "apiKey": "sk-...",
      "baseUrl": null,
      "model": "gpt-5-nano-2025-08-07"
    }
  },
  "commit": {
    "style": "conventional",
    "autoStage": true,
    "autoPush": false,
    "requireValidation": true,
    "maxFilesPerCommit": 10
  },
  "safety": {
    "enableDryRun": true,
    "enableRollback": true,
    "requireConfirmation": false,
    "backupBeforeCommit": true
  },
  "validation": {
    "enablePreCommit": true,
    "enableBuildCheck": true,
    "enableTestCheck": true,
    "enableLintCheck": false
  }
}

AI Providers

Anthropic (default):

{
  "ai": {
    "primary": "anthropic",
    "anthropic": {
      "apiKey": "sk-ant-..."
    }
  }
}

OpenAI:

{
  "ai": {
    "primary": "openai",
    "openai": {
      "apiKey": "sk-..."
    }
  }
}

OpenRouter:

{
  "ai": {
    "primary": "openrouter",
    "openrouter": {
      "apiKey": "sk-or-v1-...",
      "model": "anthropic/claude-sonnet-4-20250514"
    }
  }
}

Or set via environment variable:

export OPENROUTER_API_KEY="sk-or-v1-..."

Popular OpenRouter models:

  • anthropic/claude-sonnet-4-20250514
  • anthropic/claude-3.5-sonnet
  • openai/gpt-4-turbo
  • openai/gpt-4o
  • google/gemini-pro-1.5
  • meta-llama/llama-3.1-70b-instruct

Custom endpoint (OpenAI-compatible):

Use alternative providers like Azure OpenAI, LiteLLM, Ollama, or any OpenAI-compatible API:

{
  "ai": {
    "primary": "openai",
    "openai": {
      "apiKey": "your-api-key",
      "baseUrl": "http://localhost:11434/v1",
      "model": "llama3"
    }
  }
}

Custom endpoint (Anthropic-compatible):

{
  "ai": {
    "primary": "anthropic",
    "anthropic": {
      "apiKey": "your-api-key",
      "baseUrl": "https://your-proxy.com/v1",
      "model": "claude-3-haiku-20240307"
    }
  }
}

API keys are checked in this order:

  1. Config file (settings.json)
  2. Environment variable (ANTHROPIC_API_KEY / OPENAI_API_KEY)

Supported Languages

  • TypeScript / JavaScript
  • Python
  • Rust
  • Java
  • Go
  • CSS / SCSS
  • JSON / YAML

Development

# Run directly
bun run start

# Run tests
bun test

# Type check
bun run typecheck

# Build binary
bun run compile

# Clean build artifacts
bun run clean

License

MIT © Dimas Victor

About

Lazy doing conventional commits? Let the LLM do the hard work for you!

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages