Skip to content

jlaportebot/gh-stats

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

29 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“Š gh-stats

A beautiful terminal dashboard for your GitHub activity β€” contribution heatmaps, activity timelines, and repo stats at a glance.

Python License Version

✨ Features

  • πŸ“Š Contribution Heatmap β€” GitHub-style contribution graph rendered right in your terminal with Unicode blocks and color gradients
  • πŸ• Activity Timeline β€” See your recent pushes, PRs, issues, reviews, releases, and more in a clean table
  • πŸ”€ Language Chart β€” Horizontal bar chart of your language distribution across repositories
  • πŸ† Top Repositories β€” Table of your most-starred repos with descriptions
  • πŸ“ˆ Activity Summary β€” Quick count of activities by type
  • πŸ‘€ Profile Card β€” At-a-glance profile with follower count and yearly contributions
  • πŸ” Side-by-Side Comparison β€” Compare two users or two organizations
  • ⏰ Time-Period Comparison β€” Compare the same user/org across different years
  • πŸ‘₯ Team Analytics β€” Organization-wide analytics: contributor rankings, bus factor, repo health, collaboration network, code review metrics, activity trends
  • πŸ“€ Export β€” JSON and HTML export for both single targets and comparisons/team analytics

πŸš€ Installation

# Install from PyPI (once published)
pip install gh-stats

# Or install from source
git clone https://github.com/jlaportebot/gh-stats.git
cd gh-stats
pip install -e .

Prerequisites

  • Python 3.9+
  • GitHub authentication via one of:
    • GitHub CLI (gh) β€” install and run gh auth login
    • GH_TOKEN or GITHUB_TOKEN environment variable

πŸ“– Usage

Single User/Org Dashboard

# Dashboard for the authenticated user
gh-stats

# Dashboard for a specific user
gh-stats --user octocat

# Dashboard for an organization
gh-stats --org github

# Contribution heatmap for a specific year
gh-stats --year 2025

# Show top repositories table
gh-stats --repos

# Limit activity timeline entries
gh-stats --limit 10

# Skip specific sections
gh-stats --no-heatmap
gh-stats --no-activity

Compare Two Users/Orgs

# Compare two users
gh-stats compare --user-a octocat --user-b torvalds

# Compare two organizations
gh-stats compare --org-a github --org-b microsoft

# Compare same user across years (time-period comparison)
gh-stats compare --user-a octocat --year-a 2023 --year-b 2024

# Compare same org across years
gh-stats compare --org-a github --year-a 2023 --year-b 2024

Team/Organization Analytics

# Team analytics for an organization
gh-stats team --org github

# Limit repositories analyzed
gh-stats team --org github --repo-limit 50

# Limit contributors shown
gh-stats team --org github --contributors 30

# Skip specific sections
gh-stats team --org github --no-health --no-bus-factor --no-collab --no-reviews

# Analyze specific year
gh-stats team --org github --year 2024

Export

# Export single dashboard as JSON
gh-stats --output dashboard.json

# Export single dashboard as HTML
gh-stats --output dashboard.html --format html

# Export comparison as JSON
gh-stats compare --user-a octocat --user-b torvalds --output compare.json

# Export comparison as HTML
gh-stats compare --user-a octocat --user-b torvalds --output compare.html --format html

# Export team analytics as JSON
gh-stats team --org github --output team.json

# Export team analytics as HTML
gh-stats team --org github --output team.html --format html

⌨️ Command Line Options

gh-stats (single target)

Option Short Description Default
--user -u GitHub username Authenticated user
--org -o GitHub organization name β€”
--year -y Year for heatmap Current year
--limit -l Activity entries to show 20
--repos Show top repositories off
--no-heatmap Skip contribution heatmap off
--no-activity Skip activity timeline off
--no-streaks Skip contribution streaks off
--output Export to file β€”
--format Export format (json/html) json

gh-stats compare (two targets)

Option Description Default
--user-a / --user-b Two users to compare β€”
--org-a / --org-b Two organizations to compare β€”
--year-a / --year-b Years for time-period comparison Current year
--limit Activity entries to show 20
--repos Show top repositories table off
--no-heatmap Skip heatmap off
--no-activity Skip activity timeline off
--no-streaks Skip streaks off
--output Export to file β€”
--format Export format (json/html) json

gh-stats team (organization analytics)

Option Short Description Default
--org -o GitHub organization name Required
--year -y Year for analysis Current year
--repo-limit Repositories to analyze 20
--contributors Top contributors to show 20
--no-health Skip repository health matrix off
--no-bus-factor Skip bus factor analysis off
--no-collab Skip collaboration network off
--no-reviews Skip code review analytics off
--output Export to file β€”
--format Export format (json/html) json

πŸ— Architecture

gh-stats/
β”œβ”€β”€ gh_stats/
β”‚   β”œβ”€β”€ __init__.py         # Package metadata
β”‚   β”œβ”€β”€ cli.py              # Click CLI entry point & orchestration
β”‚   β”œβ”€β”€ api.py              # GitHub API client (REST + GraphQL)
β”‚   β”œβ”€β”€ activity.py         # Event parsing & analysis logic
β”‚   β”œβ”€β”€ ui.py               # Rich terminal rendering components
β”‚   β”œβ”€β”€ team.py             # Team analytics (contributors, bus factor, health, collaboration, reviews)
β”‚   β”œβ”€β”€ team_trends.py      # Team activity trend computation
β”‚   β”œβ”€β”€ team_ui.py          # Team dashboard rendering
β”‚   β”œβ”€β”€ team_trends_ui.py   # Team trends rendering
β”‚   β”œβ”€β”€ html_export.py      # HTML report generation
β”‚   └── comparison.py       # Side-by-side & time-period comparison logic
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ test_api.py         # API client tests
β”‚   β”œβ”€β”€ test_activity.py    # Activity analysis tests
β”‚   β”œβ”€β”€ test_ui.py          # UI rendering tests
β”‚   β”œβ”€β”€ test_cli.py         # CLI tests
β”‚   β”œβ”€β”€ test_comparison.py  # Comparison tests
β”‚   β”œβ”€β”€ test_team.py        # Team analytics tests
β”‚   └── test_html_export.py # HTML export tests
β”œβ”€β”€ pyproject.toml          # Project config, deps, entry points
β”œβ”€β”€ LICENSE                 # MIT license
└── README.md               # This file

πŸ›  Development

# Clone and set up
git clone https://github.com/jlaportebot/gh-stats.git
cd gh-stats

# Create virtual environment
python -m venv .venv
source .venv/bin/activate

# Install with dev dependencies
pip install -e ".[dev]"

# Run tests
pytest

# Run linter
ruff check .

# Format code
ruff format .

🀝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'feat: add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

Commit Convention

This project follows Conventional Commits:

  • feat: β€” New features
  • fix: β€” Bug fixes
  • docs: β€” Documentation changes
  • refactor: β€” Code refactoring
  • test: β€” Test additions/changes
  • chore: β€” Build/maintenance changes

πŸ“ License

This project is licensed under the MIT License β€” see the LICENSE file for details.

πŸ™ Acknowledgments

  • Rich β€” Beautiful terminal formatting
  • Click β€” Command-line interface creation
  • httpx β€” Modern HTTP client for Python
  • GitHub CLI β€” Seamless auth integration

gh-stats β€” Built with 🦞 by Mister Lobster

About

πŸ“Š A beautiful terminal dashboard for your GitHub activity β€” contribution heatmaps, activity timelines, and repo stats at a glance.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages