A CLI tool for managing GitHub repos
Project description
ghops
A powerful, modular CLI tool for managing GitHub repositories at scale. Automate repository operations, track PyPI packages, manage licenses, and coordinate social media promotion for your open source projects.
๐ What's New in v0.6.0
- ๐๏ธ Complete Architecture Overhaul: Fully modular design with separated command modules
- ๐งช Comprehensive Testing: 138 tests with 86% coverage - robust and reliable
- โก Enhanced Performance: Optional API checks with
--no-pypi-checkand--no-pages-checkflags - ๐ฑ Social Media Automation: Template-driven posting for Twitter, LinkedIn, and Mastodon
- โ๏ธ Advanced Configuration: TOML/JSON support with environment variable overrides
- ๐ License Management: Full GitHub API integration with template customization
- ๐ GitHub Pages Detection: Multi-method detection for documentation sites
- ๐ง Error Resilience: Graceful handling of network failures and edge cases
โจ Features
๐๏ธ Robust Architecture
- Modular Design: Clean separation of concerns with dedicated command modules
- Extensible: Easy to add new commands and functionality
- Well-Tested: 86% test coverage with 138 comprehensive unit and integration tests
- Error Resilient: Graceful handling of network failures and edge cases
๐ฆ Repository Management
- Multi-Repository Operations: Clone, update, and monitor multiple repositories efficiently
- Intelligent Sync: Smart pull with rebase, conflict detection, and resolution strategies
- Progress Tracking: Real-time progress bars and detailed operation summaries
- Flexible Discovery: Recursive repository scanning with configurable ignore patterns
๐ PyPI Integration
- Smart Package Detection: Automatically detects Python packages from
pyproject.toml,setup.py, andsetup.cfg - Publishing Status: Real-time PyPI status checking with version comparison
- Package Analytics: Track which projects are published and their update status
- Performance Optimized: Optional PyPI checks for faster operations
๐ License Management
- GitHub Integration: Fetch license templates directly from GitHub API
- Bulk Operations: Add licenses to multiple repositories at once
- Template Customization: Automatic placeholder replacement for author details
- Multiple Formats: Support for all major open source licenses
๐ GitHub Pages Detection
- Multi-Method Detection: Scans for Jekyll, MkDocs, Sphinx, and custom configurations
- URL Construction: Automatically builds GitHub Pages URLs from repository metadata
- Documentation Tracking: Monitor which projects have active documentation sites
๐ฑ Social Media Automation
- Content Generation: Template-driven post creation for Twitter, LinkedIn, and Mastodon
- Smart Sampling: Random repository selection with configurable filters
- Dry Run Support: Preview posts before publishing
- Rate Limiting: Built-in posting frequency controls and daily limits
โ๏ธ Configuration Management
- Flexible Formats: Support for both JSON and TOML configuration files
- Environment Overrides: All settings can be controlled via environment variables
- Default Merging: Intelligent combination of defaults, file settings, and overrides
- Example Generation: Built-in config template generation
๐ Installation
You can install ghops via pip:
pip install ghops
Or from source:
git clone https://github.com/queelius/ghops.git
cd ghops
make install
โก Quick Start
# Generate a configuration file with examples
ghops config generate
# Clone all your repos
ghops get
# Update all repos in the current directory
ghops update -r
# Check the status of all repos (includes PyPI and GitHub Pages info)
ghops status -r
# Quick status check without PyPI detection
ghops status --no-pypi-check
# Sample repositories for social media posting
ghops social sample --size 3
# Create social media posts (dry run)
ghops social post --dry-run
๐ Commands
Repository Operations
-
ghops get [options]- Clone all repositories from your GitHub account--users USER [USER ...]- Specify GitHub usernames to clone from--dir DIRECTORY- Target directory for cloning--ignore REPO [REPO ...]- Skip specific repositories--license LICENSE- Add license files during cloning--dry-run- Preview operations without making changes
-
ghops update [options]- Update local repositories-r, --recursive- Search for repositories recursively--auto-commit- Commit changes before pulling--commit-message MESSAGE- Custom commit message--conflicts {abort,ours,theirs}- Conflict resolution strategy--prompt- Ask before pushing changes--license LICENSE- Add/update license files during update
-
ghops status [options]- Comprehensive repository status-r, --recursive- Search recursively--json- Output in JSON format for scripting--no-pypi-check- Skip PyPI status checks (faster)--no-pages-check- Skip GitHub Pages detection--summary- Show summary statistics
Configuration Management
ghops config generate- Create example configuration fileghops config show- Display current configuration with all merges applied
License Operations
ghops license list [--json]- Show available license templatesghops license show LICENSE [--json]- Display specific license template
Social Media Automation
-
ghops social sample [options]- Preview repository selection--size N- Number of repositories to sample--json- Output in JSON format
-
ghops social post [options]- Generate and post content--size N- Number of posts to create--dry-run- Preview posts without publishing--platforms PLATFORM [PLATFORM ...]- Target specific platforms
๐ง Advanced Configuration
ghops uses a configuration file located at ~/.ghopsrc (JSON or TOML format). Set custom location with GHOPS_CONFIG environment variable.
Key Configuration Sections
PyPI Settings
[pypi]
check_by_default = true # Include PyPI info in status command
timeout_seconds = 10 # API request timeout
include_test_pypi = false # Also check test.pypi.org
Social Media Platforms
[social_media.platforms.twitter]
enabled = false
api_key = "your_api_key"
api_secret = "your_api_secret"
access_token = "your_access_token"
access_token_secret = "your_access_token_secret"
[social_media.platforms.twitter.templates]
pypi_release = "๐ New release: {package_name} v{version} is now available on PyPI! {pypi_url} #{package_name} #python #opensource"
github_pages = "๐ Updated documentation for {repo_name}: {pages_url} #docs #opensource"
random_highlight = "โจ Working on {repo_name}: {description} {repo_url} #{language} #coding"
Posting Rules
[social_media.posting]
random_sample_size = 3 # Number of repos to randomly highlight
daily_limit = 5 # Maximum posts per day
min_hours_between_posts = 2 # Minimum time between posts
exclude_private = true # Don't post about private repos
exclude_forks = true # Don't post about forked repos
๐ก Examples
Check Repository Status
# Full status with PyPI and GitHub Pages
ghops status -r
# Fast status check
ghops status --no-pypi-check
# JSON output for scripting
ghops status --json
Social Media Promotion
# See what repositories would be selected
ghops social sample --size 5
# Preview social media posts
ghops social post --dry-run --size 3
# Actually post (requires configured API credentials)
ghops social post --size 2
Repository Management
# Clone all your repositories
ghops get --dir ~/projects
# Update repositories recursively
ghops update -r --dir ~/projects
# Add MIT license to repositories during update
ghops update -r --license mit --license-name "Your Name" --license-email "you@example.com"
โก Performance & Advanced Usage
Performance Options
- Use
--no-pypi-checkfor faster status checks when you don't need PyPI information - Use
--no-pages-checkto skip GitHub Pages detection - Configure
max_concurrent_operationsin config for better performance
PyPI Package Detection
The tool automatically detects Python packages by scanning for:
pyproject.tomlfilessetup.pyfilessetup.cfgfiles
It then checks PyPI to see if packages are published and shows version information.
๐งช Testing & Quality
- 138 comprehensive tests covering all major functionality
- 86% test coverage with unit and integration testing
- Continuous integration with automated testing
- Error handling for network failures and edge cases
- Performance benchmarks for large repository sets
- Mock testing for reliable external API testing
Test Coverage by Module
- CLI & Commands: Complete argument parsing and execution testing
- Configuration System: All file formats and environment override scenarios
- PyPI Integration: Package detection, API calls, and error conditions
- Social Media: Content generation, platform integration, and rate limiting
- License Management: GitHub API integration and template processing
- Status Reporting: Repository scanning, progress tracking, and output formatting
๐๏ธ Architecture
ghops follows a clean, modular architecture designed for maintainability and extensibility:
ghops/
โโโ cli.py # Main CLI entry point with argparse
โโโ __main__.py # Python module execution entry
โโโ commands/ # Modular command implementations
โ โโโ get.py # Repository cloning logic
โ โโโ update.py # Repository updating and syncing
โ โโโ status.py # Status reporting and analytics
โ โโโ license.py # License management operations
โโโ config.py # Configuration loading and merging
โโโ utils.py # Shared utilities and helpers
โโโ pypi.py # PyPI package detection and API
โโโ social.py # Social media content generation
Design Principles
- Separation of Concerns: Each module has a single, well-defined responsibility
- Error Resilience: Graceful handling of network failures and edge cases
- Performance: Optional API checks and concurrent operations
- Extensibility: Easy to add new commands and features
- Testability: Comprehensive test coverage with mocking for external services
๐ค Contributing
Contributions are welcome! Please see the Contributing Guide for more details.
๐ License
This project is licensed under the MIT License. See the LICENSE file for details.
ยฉ 2025 Alex Towell
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 ghops-0.6.0.tar.gz.
File metadata
- Download URL: ghops-0.6.0.tar.gz
- Upload date:
- Size: 48.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a1fc32deb1e8dc1b9e2a2ce42702af3185e003d379b7a0b2f05589695b0bf1d0
|
|
| MD5 |
2546ce1d5d74fc8909f765728c3424e6
|
|
| BLAKE2b-256 |
76e16b445cf93f0f62b3dbfd34e3eed8256fdb23bb7d8ed207ba8c5633761c4d
|
File details
Details for the file ghops-0.6.0-py3-none-any.whl.
File metadata
- Download URL: ghops-0.6.0-py3-none-any.whl
- Upload date:
- Size: 26.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
40f103a2f4f98d7fe3f38f01e8737c127d09204e806c4cd87ac51c1c9f9bd825
|
|
| MD5 |
060c5ffc20030fe64891b6ecd4f05b20
|
|
| BLAKE2b-256 |
dc14f291b2b054cc74659860a732e69fb7812f38e7d2d8c7735d8bbbd2023e7d
|