Skip to main content

Git Analytics CLI

Tests PyPI version License: MIT

Git Analytics is a powerful, AI-driven command-line tool that transforms your Git repository history into insightful, easy-to-read reports. It intelligently summarizes commits, groups them by theme, and provides high-level executive summaries, helping you understand project progress at a glance.


Features

  • 🤖 AI-Powered Summaries: Uses advanced AI models to generate detailed, code-aware summaries for each commit.
  • 🧩 Thematic Analysis: Automatically categorizes commits into themes like Features, Bug Fixes, Documentation, and Refactoring.
  • 📄 Executive Summaries: Generates a high-level, multi-sentence summary of the entire analysis period, perfect for reports and stakeholder updates.
  • 📊 Contributor Analysis: Generate reports summarizing work by author to see who is contributing what.
  • 🩺 Code Health Insights: Identify high-churn files and analyze their complexity to flag potential technical debt.
  • 🌿 Branch Selection: Analyze any branch in your repository, not just the one you have checked out, using the --branch option.
  • ⚡️ Smart Caching: Caches results to provide near-instantaneous reports on subsequent runs and to minimize API calls.
  • 💰 Cost Monitoring: Tracks API token usage and provides an estimated cost for each analysis run, giving you full visibility.
  • 📝 Multiple Formats: Generate reports in both Markdown and JSON formats.

Installation

This project is managed with uv, a fast and modern Python package manager.

  1. Clone the repository:

    git clone https://github.com/your-username/gitanalytics.git
    cd gitanalytics
    
  2. Create and activate a virtual environment:

    uv venv
    source .venv/bin/activate  # On Windows, use `.venv\Scripts\activate`
    
  3. Install the package:

    uv pip install -e .
    

    The tool is now available as the gitanalytics command.

Configuration

The tool requires an API key from an OpenAI-compatible service like OpenRouter.

  1. Create a .env file in the root of the project by copying the example file:

    cp .env.example .env
    
  2. Edit the .env file and add your API key:

    # .env
    OPENROUTER_API_KEY="your-secret-key-goes-here"
    OPENROUTER_MODEL_NAME="qwen/qwen-2.5-72b-chat"
    

Usage

The main command is analyze. It analyzes the repository in the current directory by default.

gitanalytics analyze [OPTIONS] [REPO_PATH]

Examples

  • Analyze the current repository:

    gitanalytics analyze
    
  • Analyze a specific repository path:

    gitanalytics analyze /path/to/your/repo
    
  • Analyze a specific branch:

    gitanalytics analyze --branch feature/new-login
    
  • Analyze commits within a date range:

    gitanalytics analyze --start-date 2023-01-01 --end-date 2023-01-31
    
  • Generate a JSON report:

    gitanalytics analyze --output json
    
  • Force a fresh analysis by ignoring the cache:

    gitanalytics analyze --no-cache
    
  • Generate a report summarized by author:

    gitanalytics analyze --by-author
    
  • Include a code health summary in the report:

    gitanalytics analyze --code-health
    

Development

To set up a development environment with all testing dependencies, run:

uv pip install -e ".[dev]"

To run the automated test suite:

pytest

Metadata

Release files for ai-gitanalytics-cli 0.5.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ai-gitanalytics-cli 0.5.0
File Size Uploaded Provenance Actions
ai_gitanalytics_cli-0.5.0.tar.gz 525.1 kB Without provenance Details for ai_gitanalytics_cli-0.5.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for ai-gitanalytics-cli 0.5.0
File Interpreter ABI Platform Actions
ai_gitanalytics_cli-0.5.0-py3-none-any.whl Python 3 none any Details for ai_gitanalytics_cli-0.5.0-py3-none-any.whl

Total release size: 548.9 kB

Release files / ai_gitanalytics_cli-0.5.0.tar.gz

Download URL ai_gitanalytics_cli-0.5.0.tar.gz
Size 525.1 kB
Tags Source
SHA-256 checksum
How to use checksums
0ae6a594ddf7d6b5d7db70333aefc5a1c3e43b27f7832513e9feaee209b4c0df
BLAKE2b-256 checksum
How to use checksums
4583d6544855ec2485262341e8dc5e37ee5c383dd4892af999a0717452b45602
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Release files / ai_gitanalytics_cli-0.5.0-py3-none-any.whl

Download URL ai_gitanalytics_cli-0.5.0-py3-none-any.whl
Size 23.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
64721151ab675bb6dd45b68cb89b873c576d14db36486278185982c0c90a1d78
BLAKE2b-256 checksum
How to use checksums
8107b8508ac94a91dd2c2fdf6d401957236c9989c4cae49a2013c876df686db2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.2

Security for ai-gitanalytics-cli 0.5.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.5.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page