Skip to main content

AI-powered tool to analyze Git commits for bugs and issues

Project description

CommitGuard

AI-powered CLI that analyzes Git commits for bugs, security issues, and code quality problems. Uses OpenRouter for access to GPT-4, Claude, Gemini, and 100+ other models.

GitHub · PyPI

Features

  • Analyze commits – Detect bugs, security issues, and code quality problems
  • Pre-commit check – Review staged changes before committing
  • Multi-model – Use any model on OpenRouter (GPT-4, Claude, Gemini, etc.)
  • Chronological batch analysisanalyze -n processes commits oldest to newest
  • Quiet base command – Update checks run only when a subcommand is invoked
  • Simple CLI – One command, clear output

Requirements

Installation

pip install commitguard-cli

From source:

git clone https://github.com/PierrunoYT/commitguard.git
cd commitguard
pip install -e .

Configuration

Get an API key at openrouter.ai/keys:

# Linux / macOS
export OPENROUTER_API_KEY=sk-or-...

# Windows (PowerShell)
$env:OPENROUTER_API_KEY = "sk-or-..."

Optional – default model (otherwise openai/gpt-4o-mini):

export OPENROUTER_MODEL=anthropic/claude-3.5-sonnet   # Linux/macOS
$env:OPENROUTER_MODEL = "anthropic/claude-3.5-sonnet" # Windows

Usage

# Analyze last commit
commitguard analyze

# Analyze specific commit
commitguard analyze abc123

# Analyze last 5 commits
commitguard analyze -n 5

# Analyze staged changes (before commit)
commitguard check

# Use a different model
commitguard analyze --model anthropic/claude-3.5-sonnet
commitguard analyze -m google/gemini-pro

When using analyze -n, commits are analyzed in chronological order (oldest to newest).

Options

Option Description
-r, --repo PATH Path to Git repository (default: current dir)
--api-key KEY OpenRouter API key (or OPENROUTER_API_KEY env)
-m, --model MODEL Model to use (default: openai/gpt-4o-mini or OPENROUTER_MODEL env)

Model examples

Model Use case
openai/gpt-4o-mini Fast, cheap (default)
openai/gpt-4o Higher quality
anthropic/claude-3.5-sonnet Strong code analysis
google/gemini-pro Alternative option

See OpenRouter models for the full list.

Troubleshooting

Error Solution
Invalid or missing API key Set OPENROUTER_API_KEY or use --api-key. Get a key at openrouter.ai/keys
Model not found Use the full model ID (e.g. openai/gpt-4o-mini). Check openrouter.ai/models
Rate limit exceeded Wait and retry, or switch to a different model
Service unavailable OpenRouter may be down; try again later

Security: Never commit your API key. Use environment variables or --api-key at runtime.

License

MIT

Changelog

CHANGELOG.md

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

commitguard_cli-0.1.2.tar.gz (6.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

commitguard_cli-0.1.2-py3-none-any.whl (7.7 kB view details)

Uploaded Python 3

File details

Details for the file commitguard_cli-0.1.2.tar.gz.

File metadata

  • Download URL: commitguard_cli-0.1.2.tar.gz
  • Upload date:
  • Size: 6.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.12

File hashes

Hashes for commitguard_cli-0.1.2.tar.gz
Algorithm Hash digest
SHA256 44d15098b5cea3700a81ccd80ef709553c27041df1176d9d5b4475a692bf094f
MD5 2a67146459170c01c29bdd1e1ef0db83
BLAKE2b-256 7774789a31b7ec88ae7f4ad5062028f57bf7514cf67756bc45f5020eead37d2e

See more details on using hashes here.

File details

Details for the file commitguard_cli-0.1.2-py3-none-any.whl.

File metadata

File hashes

Hashes for commitguard_cli-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 d31d17e558c20fa46e4d726dd5e9a7d007b160c427d5d12fd422f3bb257ecebf
MD5 633045bb4b103726bad579c1fd1aa47a
BLAKE2b-256 bcd72462af3e0a2937c83003883bbc636fc49426bd285e3957de24f8359fd5be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page