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
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:
- Go to https://github.com/settings/tokens
- Click Generate new token (classic)
- Select scope:
public_repo(for public repositories) - 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 Nor-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 โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโค
โ  โ
โ  โ
โ  โ
โ ... โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
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 togitpulse 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:
- Fork the repository
- Create a feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'feat: add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - 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
๐ Links
- Documentation: GitHub Wiki
- Issue Tracker: GitHub Issues
- PyPI Package: pypi.org/project/gh-pulse
- Changelog: CHANGELOG.md
Made with โค๏ธ by Ruslan
If you find this project useful, please consider giving it a โญ๏ธ
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
1a721b6c8fe6861fdeee88a95e9f10313d3789813716a41ac42cf81dec4aa4ec
|
|
| MD5 |
c851e7fa3cdf798348e79ddf70d4835c
|
|
| BLAKE2b-256 |
253b55db1e43ed3b6c8c5e7e11e9eb45a6dc45be869ffd4c2d5925ae480c4e97
|
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
56c1b465053d389816d02be6be00edcee3012518cdf6d01ed9e28cedba32d6b7
|
|
| MD5 |
43992e50237de98d5967092e260f4275
|
|
| BLAKE2b-256 |
9edbe6cd694b696f67b1a9ec653856057a1ac5512871dafde732c2fefddbf767
|