Skip to main content

GitHub productivity CLI - analyze repos, generate badges, and automate README updates

Project description

๐Ÿš€ gh-pulse

GitHub Productivity CLI โ€” Analyze repositories, generate badges, and automate README updates

PyPI version Python Version License: MIT Downloads

CI codecov Code style: ruff Checked with mypy

GitHub Stars GitHub Forks GitHub Issues PRs Welcome

A powerful local analytics hub for your GitHub profile and repositories.

Pull data from GitHub API, cache it locally, display stats in terminal, and generate ready-to-use fragments for README and CI/CD workflows.

Installation โ€ข Quick Start โ€ข Documentation โ€ข Contributing


โœจ Features

  • ๐Ÿ“Š Repository Statistics โ€” stars, forks, issues, releases, and more
  • ๐Ÿ‘ค User Profile Analytics โ€” top repositories, overall activity metrics
  • ๐Ÿท๏ธ Badge Generation โ€” ready-to-use Markdown shields for your README
  • ๐Ÿ’พ Local Caching โ€” blazing fast repeated queries with smart cache
  • ๐Ÿ“ค Data Export โ€” JSON output for CI/CD integration and automation
  • ๐ŸŽจ Beautiful Terminal Output โ€” rich tables and panels with colors
  • ๐Ÿ”’ Secure Token Storage โ€” encrypted credential management with keyring
  • โšก High Performance โ€” async HTTP client with connection pooling

๐Ÿ“ฆ Installation

Install with pip

pip install gh-pulse

Install with uv (Recommended)

uv is a blazingly fast Python package installer and resolver.

# Install uv if you haven't already
curl -LsSf https://astral.sh/uv/install.sh | sh

# Install gh-pulse
uv pip install gh-pulse

# Or run without installation
uvx gh-pulse --help

Install from source

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

๐Ÿš€ Quick Start

1. Authenticate

Create a GitHub Personal Access Token:

  1. Go to https://github.com/settings/tokens
  2. Click Generate new token (classic)
  3. Select scope: public_repo (for public repositories)
  4. Copy the generated token

Save your token securely:

gh-pulse auth ghp_YOUR_TOKEN_HERE

Token will be stored in ~/.gitpulse/config with restricted permissions (600).

Alternative: Use environment variable

export GITHUB_TOKEN=ghp_YOUR_TOKEN_HERE

2. Analyze a Repository

gh-pulse repo ruslanlap/gitpulse

3. Generate Badges

gh-pulse badges ruslanlap/gitpulse

4. View User Profile

gh-pulse user ruslanlap --top 5

๐Ÿ“– Usage

Repository Statistics

Get comprehensive statistics for any GitHub repository:

gh-pulse repo owner/repository

Example output:

๐Ÿ“Š Repository: ruslanlap/PowerToysRun-QuickAi
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Metric           โ”‚      Value โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ โญ Stars         โ”‚        145 โ”‚
โ”‚ ๐Ÿด Forks         โ”‚         12 โ”‚
โ”‚ ๐Ÿ‘€ Watchers      โ”‚          8 โ”‚
โ”‚ ๐Ÿ“– Open Issues   โ”‚          3 โ”‚
โ”‚ ๐Ÿ’ป Language      โ”‚     C#     โ”‚
โ”‚ ๐Ÿ“ฆ Size          โ”‚   2341 KB  โ”‚
โ”‚ ๐ŸŒฟ Default Branchโ”‚     main   โ”‚
โ”‚ ๐Ÿ“… Created       โ”‚ 2024-01-15 โ”‚
โ”‚ ๐Ÿ”„ Last Updated  โ”‚ 2025-11-10 โ”‚
โ”‚ ๐Ÿ“ค Last Push     โ”‚ 2025-11-12 โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Options:

  • --no-cache โ€” Force refresh data from API (bypass cache)

User Profile

Analyze GitHub user profiles with top repositories:

gh-pulse user username
gh-pulse user username --top 5  # Show top 5 repositories

Example output:

๐Ÿ‘ค User: @ruslanlap
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Metric          โ”‚   Value โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ Name            โ”‚  Ruslan โ”‚
โ”‚ ๐Ÿ“š Public Repos โ”‚      42 โ”‚
โ”‚ ๐Ÿ“ Public Gists โ”‚       8 โ”‚
โ”‚ ๐Ÿ‘ฅ Followers    โ”‚     156 โ”‚
โ”‚ โžก๏ธ Following    โ”‚      89 โ”‚
โ”‚ ๐Ÿ“… Joined       โ”‚2020-03-15โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

โญ Top 3 Repositories by Stars
โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ฌโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Repository         โ”‚ Stars โ”‚ Language โ”‚ Description     โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ผโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ awesome-project    โ”‚  1.2k โ”‚   Python โ”‚ Cool tool       โ”‚
โ”‚ another-repo       โ”‚   345 โ”‚TypeScriptโ”‚ Web app         โ”‚
โ”‚ third-repo         โ”‚   123 โ”‚      Go  โ”‚ CLI utility     โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ดโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Total stars from top 3 repos: โญ 1,668

Options:

  • --top N or -n N โ€” Number of top repositories (default: 3)
  • --no-cache โ€” Force refresh data

Badge Generation

Generate beautiful Markdown badges for your README:

gh-pulse badges owner/repository

Example output:

โœ“ Badges generated!

โ”Œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”
โ”‚ Markdown Badges                          โ”‚
โ”œโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”ค
โ”‚ ![Stars](https://img.shields.io/...)    โ”‚
โ”‚ ![Forks](https://img.shields.io/...)    โ”‚
โ”‚ ![License](https://img.shields.io/...)  โ”‚
โ”‚ ...                                      โ”‚
โ””โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”˜

Copy and paste the above Markdown into your README.md

Custom badges:

# Select specific badges only
gh-pulse badges owner/repo --custom stars,forks,license

Available types: stars, forks, issues, license, release, language, downloads, commit

Data Export

Export data as JSON for automation and CI/CD workflows:

# Export repository statistics
gh-pulse export --repo owner/repository

# Export user profile
gh-pulse export --user username

# Save to file
gh-pulse export --repo owner/repo --output stats.json

# Export both
gh-pulse export --repo owner/repo --user username -o full.json

JSON format:

{
  "repository": {
    "name": "gitpulse",
    "full_name": "ruslanlap/gitpulse",
    "stats": {
      "stars": 123,
      "forks": 45,
      "watchers": 12,
      "open_issues": 3
    },
    "language": "Python",
    "releases": [...]
  },
  "user": {
    "login": "ruslanlap",
    "stats": {
      "public_repos": 42,
      "followers": 156
    },
    "top_repos": [...]
  }
}

Cache Management

Clear all cached data:

gh-pulse clear-cache

Cache is stored in ~/.gitpulse/cache/ with 1-hour TTL.

๐Ÿ”ง Configuration

File Structure

~/.gitpulse/
โ”œโ”€โ”€ config          # GitHub token (secure storage)
โ””โ”€โ”€ cache/          # Cached API responses
    โ”œโ”€โ”€ repo_owner_name.json
    โ””โ”€โ”€ user_username.json

Environment Variables

  • GITHUB_TOKEN โ€” GitHub API token (alternative to gitpulse auth)

๐ŸŽฏ CI/CD Integration

GitHub Actions โ€” Auto-Update Badges

name: Update README Badges

on:
    schedule:
        - cron: "0 0 * * 0" # Weekly on Sunday
    workflow_dispatch:

jobs:
    update-badges:
        runs-on: ubuntu-latest
        steps:
            - uses: actions/checkout@v4

            - name: Install uv
              run: curl -LsSf https://astral.sh/uv/install.sh | sh

            - name: Generate badges
              env:
                  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
              run: |
                  uvx gh-pulse badges ${{ github.repository }} > badges.md

            - name: Update README
              run: |
                  # Insert badges into README...
                  cat badges.md

            - name: Commit changes
              run: |
                  git config user.name "github-actions[bot]"
                  git config user.email "github-actions[bot]@users.noreply.github.com"
                  git add README.md
                  git commit -m "docs: update badges" || exit 0
                  git push

Export Metrics for Monitoring

- name: Export GitHub metrics
  env:
      GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
  run: |
      uvx gh-pulse export --repo ${{ github.repository }} -o metrics.json

- name: Upload metrics artifact
  uses: actions/upload-artifact@v4
  with:
      name: github-metrics
      path: metrics.json

๐Ÿ› ๏ธ Development

Setup Development Environment

# Clone the repository
git clone https://github.com/ruslanlap/gitpulse.git
cd gitpulse

# Install with development dependencies (using uv)
uv pip install -e ".[dev]"

# Or with pip
pip install -e ".[dev]"

Run Tests

# Run tests with pytest
pytest

# With coverage
pytest --cov=gitpulse --cov-report=html

# Using uv
uv run pytest

Code Quality

# Check with ruff
ruff check src/

# Auto-fix issues
ruff check src/ --fix

# Format code
ruff format src/

Project Structure

gitpulse/
โ”œโ”€โ”€ src/gitpulse/
โ”‚   โ”œโ”€โ”€ __init__.py       # Package version
โ”‚   โ”œโ”€โ”€ cli.py            # Typer CLI application
โ”‚   โ”œโ”€โ”€ github_api.py     # GitHub REST API client
โ”‚   โ”œโ”€โ”€ models.py         # Pydantic data models
โ”‚   โ”œโ”€โ”€ cache.py          # File-based caching
โ”‚   โ””โ”€โ”€ badges.py         # Badge generator
โ”œโ”€โ”€ tests/
โ”‚   โ”œโ”€โ”€ test_github_api.py
โ”‚   โ””โ”€โ”€ test_badges.py
โ”œโ”€โ”€ pyproject.toml
โ”œโ”€โ”€ README.md
โ””โ”€โ”€ LICENSE

๐Ÿ“š API Reference

GitHubClient

from gitpulse.github_api import GitHubClient

# Initialize client
with GitHubClient(token="ghp_xxx") as client:
    # Repository operations
    stats = client.get_repo_stats("owner/repo")
    releases = client.get_repo_releases("owner/repo", limit=5)

    # User operations
    user = client.get_user_stats("username")
    top_repos = client.get_top_repos("username", limit=3)

BadgeGenerator

from gitpulse.badges import BadgeGenerator

gen = BadgeGenerator()

# Generate individual badges
stars_badge = gen.stars("owner/repo", count=100)
forks_badge = gen.forks("owner/repo")

# Generate full badge set
all_badges = gen.generate_full_set("owner/repo")

# Generate custom badge set
custom_badges = gen.generate_custom("owner/repo", ["stars", "forks", "license"])

๐Ÿค Contributing

Contributions are welcome! Here's how you can help:

  1. Fork the repository
  2. Create a 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

Contribution Guidelines

  • Follow the existing code style (Ruff formatting)
  • Write tests for new features
  • Update documentation as needed
  • Use Conventional Commits for commit messages

๐Ÿ“ License

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

๐Ÿ™ Acknowledgments

Built with awesome open-source tools:

  • typer โ€” CLI framework with beautiful output
  • rich โ€” Terminal formatting and colors
  • httpx โ€” Modern async HTTP client
  • pydantic โ€” Data validation and settings management
  • keyring โ€” Secure credential storage
  • uv โ€” Lightning-fast Python package manager

๐Ÿ“Š Stats

Alt

๐Ÿ”— Links


Made with โค๏ธ by Ruslan

If you find this project useful, please consider giving it a โญ๏ธ

โฌ† Back to Top

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

gh_pulse-0.1.0.tar.gz (20.1 kB view details)

Uploaded Source

Built Distribution

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

gh_pulse-0.1.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file gh_pulse-0.1.0.tar.gz.

File metadata

  • Download URL: gh_pulse-0.1.0.tar.gz
  • Upload date:
  • Size: 20.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gh_pulse-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1a721b6c8fe6861fdeee88a95e9f10313d3789813716a41ac42cf81dec4aa4ec
MD5 c851e7fa3cdf798348e79ddf70d4835c
BLAKE2b-256 253b55db1e43ed3b6c8c5e7e11e9eb45a6dc45be869ffd4c2d5925ae480c4e97

See more details on using hashes here.

File details

Details for the file gh_pulse-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: gh_pulse-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for gh_pulse-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 56c1b465053d389816d02be6be00edcee3012518cdf6d01ed9e28cedba32d6b7
MD5 43992e50237de98d5967092e260f4275
BLAKE2b-256 9edbe6cd694b696f67b1a9ec653856057a1ac5512871dafde732c2fefddbf767

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