github-trending-repos-cli
v1.0.0
Published
Fetch trending GitHub repositories by duration
Maintainers
Readme
GitHub Trending Repos CLI
A simple command-line tool to fetch and display trending GitHub repositories using GitHub Search API filters for duration, language, and result limit.
Inspiration
This project is inspired by the Github-Trending-CLI from roadmap.sh.
Features
- Query GitHub repositories sorted by stars
- Filter by creation date range:
day,week,monthoryear - Filter by programming language
- Limit the number of results returned
- View output in a clean table format
Install
pnpm installThe project is written in TypeScript and runs with
tsxfor development.
Usage
Run the CLI with the available options:
pnpm dev -- -d <duration> -L <language> -l <limit>Options
-d, --duration <duration>:day | week | month | year(default:week)-L, --language <language>: programming language filter (default:all)-l, --limit <number>: number of repositories to return (default:10)
Example
Fetch the top 3 trending TypeScript repositories created in the last week:
pnpm dev -- -d week -L ts -l 3Fetch the top 5 trending repositories across all languages created within the past day:
pnpm dev -- -d day -l 5How it works
The CLI builds a GitHub search query using:
created:>DATEto filter repositories by creation datelanguage:LANGUAGEwhen a language is providedsort=stars&order=descto return the most-starred results
The tool uses axios to request GitHub Search API and renders results in a table.
Development
Start the CLI locally with:
pnpm dev -- -d week -L js -l 10Project structure
src/cli.ts— command-line options and output formattingsrc/index.ts— CLI entry pointsrc/commands/trending.command.ts— trending repository fetch logicsrc/services/github.service.ts— GitHub API integrationsrc/utils/formatter.ts— helper functions
License
This project is licensed under MIT.
