Skip to content

AI-powered Git summarizer that analyzes repo history, major changes, risky files, and developer hotspots — all from the terminal.

License

Notifications You must be signed in to change notification settings

JustInCache/gitsum-cli

Repository files navigation

🔍 Git Summarizer CLI

╔═══════════════════════════════════════════════════════════════╗
║                                                               ║
║   ██████╗ ██╗████████╗███████╗██╗   ██╗███╗   ███╗           ║
║  ██╔════╝ ██║╚══██╔══╝██╔════╝██║   ██║████╗ ████║           ║
║  ██║  ███╗██║   ██║   ███████╗██║   ██║██╔████╔██║           ║
║  ██║   ██║██║   ██║   ╚════██║██║   ██║██║╚██╔╝██║           ║
║  ╚██████╔╝██║   ██║   ███████║╚██████╔╝██║ ╚═╝ ██║           ║
║   ╚═════╝ ╚═╝   ╚═╝   ╚══════╝ ╚═════╝ ╚═╝     ╚═╝           ║
║                                                               ║
║          Git Repository Intelligence & Insights               ║
╚═══════════════════════════════════════════════════════════════╝

Analyze any Git repository and generate intelligent summaries with LLM-powered insights.

Python 3.9+ License: MIT Code style: black

FeaturesInstallationUsageExamplesArchitectureContributingSupport


✨ Why Git Summarizer?

Ever joined a new project and wondered:

  • 🤔 "What's the commit history like?"
  • ⚠️ "Which files are the riskiest?"
  • 👥 "Who knows what in this codebase?"
  • 📊 "What patterns do the commits follow?"

Git Summarizer answers all these questions in seconds, providing actionable insights through beautiful terminal output and optional LLM-powered summaries.


🚀 Features

📜 Git History Analysis

  • Total commits, authors, and timeline
  • Commit tempo (daily/weekly/monthly averages)
  • Longest inactive periods
  • Code churn statistics

🔥 Major Change Detection

  • Identify high-impact commits
  • Track large diffs and refactors
  • Calculate commit "impact scores"

⚠️ Riskiest Files Identification

Score files by:

  • Change frequency
  • Total lines modified
  • Number of contributors
  • Recency of changes
  • Estimated complexity

👥 Developer Hotspots

  • Top contributors by commits and lines
  • File ownership mapping
  • Knowledge concentration analysis
  • Bus factor calculation

📝 Commit Pattern Analysis

  • Detect keywords: fix, feat, refactor, docs, etc.
  • Generate frequency tables
  • Identify team conventions

🔍 Anomaly Detection

  • Unusually large commits
  • Commit spikes
  • Suspicious patterns

🤖 LLM-Powered Summaries

  • Executive summaries for leadership
  • Technical deep-dives for engineers
  • Risk-focused reports
  • Comprehensive analysis

📦 Installation

Using pip

pip install git-summarizer

From Source

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

Development Setup

pip install -e ".[dev]"

🎯 Usage

Basic Analysis

# Analyze current directory
gitsum summarize .

# Analyze a specific repository
gitsum summarize ~/projects/my-repo

# Analyze with commit limit
gitsum summarize . --limit-commits 500

🌐 Remote Repository Analysis

Analyze any public Git repository directly by URL:

# GitHub repositories
gitsum summarize https://github.com/fastapi/fastapi

# GitLab repositories
gitsum summarize https://gitlab.com/gitlab-org/gitlab

# BitBucket repositories
gitsum summarize https://bitbucket.org/user/repo

# Shallow clone for faster analysis (last 100 commits)
gitsum summarize https://github.com/user/repo --shallow

# Custom clone depth
gitsum summarize https://github.com/user/repo --clone-depth 500

Advanced Options

# Use different LLM provider
gitsum summarize . --provider openai

# Choose summary style
gitsum summarize . --style executive    # For leadership
gitsum summarize . --style technical    # For engineers
gitsum summarize . --style risk         # Risk-focused
gitsum summarize . --style comprehensive  # Everything (default)

# Export to JSON
gitsum summarize . --json output.json

# Skip LLM summarization
gitsum summarize . --no-llm

# Enable debug mode
gitsum summarize . --debug

Environment Variables

# Set OpenAI API key for LLM summaries
export OPENAI_API_KEY=sk-your-key-here

📋 Examples

Quick Start

$ gitsum summarize .

Output:

╔═══════════════════════════════════════════════════════════════╗
║   ██████╗ ██╗████████╗███████╗██╗   ██╗███╗   ███╗           ║
║  ██╔════╝ ██║╚══██╔══╝██╔════╝██║   ██║████╗ ████║           ║
║  ...                                                          ║
╚═══════════════════════════════════════════════════════════════╝

Analyzing repository: /home/user/my-project
✓ Loaded 1,247 commits

═════════════════════════════════════════════════════════════════

╭──────────────────── 📜 Git History Summary ────────────────────╮
│ ╭────────────────────┬─────────────────────────────────╮       │
│ │ 📊 Total Commits   │ 1,247                           │       │
│ │ 👥 Contributors    │ 23                              │       │
│ │ 📅 First Commit    │ 2021-03-15                      │       │
│ │ 📅 Last Commit     │ 2024-11-24                      │       │
│ │ 📈 Daily Avg       │ 0.93 commits                    │       │
│ │ 📈 Weekly Avg      │ 6.5 commits                     │       │
│ │ ⏸️  Longest Gap     │ 45 days                         │       │
│ │ ➕ Lines Added     │ 156,234                         │       │
│ │ ➖ Lines Deleted   │ 89,102                          │       │
│ ╰────────────────────┴─────────────────────────────────╯       │
╰────────────────────────────────────────────────────────────────╯

            ⚠️ Riskiest Files
┏━━━━━━━━━━━━━━━━━━━━━━━━━━┳━━━━━━┳━━━━━━━━━┳━━━━━━━━━━┓
┃ File                     ┃ Risk ┃ Changes ┃ Authors  ┃
┡━━━━━━━━━━━━━━━━━━━━━━━━━━╇━━━━━━╇━━━━━━━━━╇━━━━━━━━━━┩
│ src/core/engine.py       │ 87.3 │ 156     │ 8        │
│ src/api/handlers.py      │ 72.1 │ 89      │ 6        │
│ src/utils/helpers.py     │ 65.4 │ 67      │ 5        │
└──────────────────────────┴──────┴─────────┴──────────┘

            📝 Commit Message Patterns

  fix          ████████████████████░░░░░░░░░░   312  (25.0%)
  feat         █████████████░░░░░░░░░░░░░░░░░   198  (15.9%)
  refactor     ████████░░░░░░░░░░░░░░░░░░░░░░   124  (9.9%)
  docs         ██████░░░░░░░░░░░░░░░░░░░░░░░░    89  (7.1%)
  test         █████░░░░░░░░░░░░░░░░░░░░░░░░░    78  (6.3%)

  🚌 Bus Factor: 3

See EXAMPLES.md for more detailed examples.


🏗️ Architecture

┌─────────────────────────────────────────────────────────────┐
│                         CLI Layer                            │
│                    (Typer + Rich UI)                         │
├─────────────────────────────────────────────────────────────┤
│                      Core Analyzers                          │
│  ┌─────────────┐  ┌──────────────┐  ┌──────────────────┐    │
│  │ GitAnalyzer │  │ RiskAnalyzer │  │ ContributorAnalyzer│   │
│  └─────────────┘  └──────────────┘  └──────────────────┘    │
├─────────────────────────────────────────────────────────────┤
│                     LLM Provider Layer                       │
│  ┌─────────────────┐  ┌──────────────────────────────┐      │
│  │  BaseProvider   │  │  OpenAIProvider              │      │
│  │  (Abstract)     │  │  (GPT-4o-mini)               │      │
│  └─────────────────┘  └──────────────────────────────┘      │
├─────────────────────────────────────────────────────────────┤
│                      Data Models                             │
│        (Pydantic: CommitInfo, RiskFile, etc.)               │
├─────────────────────────────────────────────────────────────┤
│                      Git Backend                             │
│                      (GitPython)                             │
└─────────────────────────────────────────────────────────────┘

See ARCHITECTURE.md for detailed design documentation.


🔌 Provider System

Git Summarizer uses a pluggable provider system for LLM integration:

Built-in Providers

Provider Model Description
openai gpt-4o-mini Default, high-quality summaries

Adding Custom Providers

from gitsum.providers.base import BaseProvider, SummaryStyle

class MyProvider(BaseProvider):
    def generate_summary(self, sections: dict, style: SummaryStyle) -> str:
        # Your implementation
        pass
    
    def is_available(self) -> bool:
        # Check if provider is configured
        return True

🧪 Testing

# Run all tests
pytest

# Run with coverage
pytest --cov=gitsum

# Run specific test file
pytest tests/test_analyzer.py

🤝 Contributing

We welcome contributions! Here's how to get started:

  1. Fork the repository
  2. Create a feature branch
    git checkout -b feature/amazing-feature
  3. Make your changes
  4. Run tests
    pytest
  5. Submit a pull request

Development Guidelines

  • Follow PEP 8 style guide
  • Use Black for formatting
  • Add tests for new features
  • Update documentation as needed

☕ Support the Project

If this repo saved you time or sparked an idea, consider buying me a coffee to keep the prompts flowing. ❤️

Buy Me a Coffee

https://buymeacoffee.com/connectankush

Your support and feedback are valuable in maintaining and improving the extension.

Buy Me a Coffee QR

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.


🙏 Acknowledgments

  • GitPython for Git repository access
  • Typer for CLI framework
  • Rich for beautiful terminal output
  • OpenAI for LLM capabilities

Made with ❤️ by Ankush

Report BugRequest Feature

About

AI-powered Git summarizer that analyzes repo history, major changes, risky files, and developer hotspots — all from the terminal.

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

Packages

No packages published

Languages