A Ruby gem for analyzing GitHub repository issues with statistics and visualizations.
gh-issues-stats is a command-line tool that helps you analyze and understand the issues lifecycle in any GitHub repository. It provides detailed statistics, visualizations, and insights about issues including:
- Issue creation trends over time (yearly/monthly breakdowns)
- Closing time statistics (average and median)
- Label-based filtering and analysis
- Visual charts and tables for data representation
- Cached data for faster subsequent queries
gem install gh-issues-statsgit clone https://github.com/tschaefer/gh-issues-stats.git
cd gh-issues-stats
bundle install
rake install- Ruby >= 3.3.0
- A GitHub account (optional, but recommended for higher API rate limits)
Important
Initial data fetching may take some time and consume a significant amount of memory depending on the number of issues in the repository.
Display yearly statistics for a repository:
gh-issues-stats yearly owner/repositoryExample:
gh-issues-stats yearly rails/railsOptions:
--format FORMAT- Specify output format (table, chart, json). (default: table)--label LABEL- Filter by specific label (can be used multiple times; prefix with!to exclude)--[no-]finished- Show finished stats (default: false)--[no-]legend- Toggle legend display (default: true)--[no-]pager- Toggle output paging (default: false)
Display monthly statistics for a specific year:
gh-issues-stats monthly YEAR owner/repositoryExample:
gh-issues-stats monthly 2023 rails/railsOptions: Same as yearly command
Display all labels used in a repository:
gh-issues-stats labels owner/repository--configuration-file FILE- Specify a configuration file (default: ~/.config/gh-issues-stats.json)--cache-path PATH- Specify cache directory (default: ~/.cache/gh-issues-stats)--refresh INTERVAL- Set refresh interval (e.g., 30minutes, 2.5hours, 1day) (default: 24hours)-v, --version- Show version information-m, --man- Show manual page
Filter issues by multiple labels:
gh-issues-stats yearly --label bug --label '!enhancement' rails/railsShow monthly breakdown with chart visualization:
gh-issues-stats monthly --format chart 2023 rails/railsUse with custom refresh interval:
gh-issues-stats --refresh 2hours yearly rails/railsFor higher API rate limits, you can provide GitHub credentials through the configuration file. See Octokit Authentication for supported authentication methods.
Issue data is cached locally in to improve performance on subsequent queries. The cache is automatically refreshed on call based on the refresh interval (default: 24 hours).
- Statistical Analysis: Calculate average and median closing times for issues
- Time-based Grouping: View issues grouped by year or month
- Label Filtering: Filter issues by one or more labels
- Multiple Output Formats: Choose between tables and charts
- Smart Caching: Local SQLite database for fast repeated queries
- Flexible Refresh: Configurable data refresh intervals
- Pagination Support: Built-in pager for large datasets
- Issue Detection: Skips draft issues and pull requests
git clone https://github.com/tschaefer/gh-issues-stats.git
cd gh-issues-stats
bundle installbundle exec rspec# Run RuboCop
bundle exec rubocop
# Run with auto-correct
bundle exec rubocop -aThe gem is structured around several key components:
- Database Layer: SQLite-based storage for issue data
- Fetch Module: Retrieves issues from GitHub API using Octokit
- Statistics Module: Calculates various metrics (average, median, etc.)
- Group Module: Organizes issues by time periods
- App Layer: CLI interface built with Clamp
clamp- Command-line parsingfaraday-retry- HTTP request retrieshashie- Enhanced Hash functionalityoctokit- GitHub API clientpastel- Terminal color outputsqlite3- Local data cachingtty-pager- Output paginationtty-table- Table renderingunicode_plot- Chart visualization
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -am 'Add some amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
Please ensure:
- All tests pass
- Code follows RuboCop style guidelines
- New features include appropriate tests
This project is licensed under the MIT License - see the LICENSE file for details.