Metadata-Version: 2.4
Name: repo-analyzer
Version: 5.0.0
Summary: Analyze any GitHub repository from the command line — language breakdown, contributors, health score, and more.
Author: Khodor El Hajj Moussa
License: MIT
Project-URL: Homepage, https://github.com/Khorrrr/Github-Repo-Analyzer-Cli-Tool
Project-URL: Repository, https://github.com/Khorrrr/Github-Repo-Analyzer-Cli-Tool
Project-URL: Issues, https://github.com/Khorrrr/Github-Repo-Analyzer-Cli-Tool/issues
Keywords: github,repository,analyzer,cli,devtools
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Quality Assurance
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: click>=8.1.0
Requires-Dist: rich>=13.0.0
Requires-Dist: requests>=2.31.0
Requires-Dist: requests-cache>=1.1.0
Requires-Dist: fpdf2>=2.7.0
Requires-Dist: python-dotenv>=1.0.0
Provides-Extra: dev
Requires-Dist: pytest>=7.4.0; extra == "dev"
Requires-Dist: pytest-cov>=4.1.0; extra == "dev"
Requires-Dist: responses>=0.23.0; extra == "dev"
Dynamic: license-file

# repo-analyzer

A fast CLI tool to analyze any GitHub repository. Get language breakdowns, top contributors, activity stats, code quality signals, and a health score — all from your terminal.

```
$ repo-analyzer https://github.com/facebook/react

facebook/react (main)
A declarative, efficient, and flexible JavaScript library for building user...
─────────────────────────────────────────────
stars 228.9K  forks 46.8K  issues 892  prs 234  commits/mo 47
─────────────────────────────────────────────
langs
  ● JavaScript     ████████████████░░░░ 78.5%
  ● TypeScript     ███░░░░░░░░░░░░░░░░░ 14.2%
  ● HTML           █░░░░░░░░░░░░░░░░░░░  4.1%
  ● CSS            ░░░░░░░░░░░░░░░░░░░░  2.0%
  ● CoffeeScript   ░░░░░░░░░░░░░░░░░░░░  1.2%
─────────────────────────────────────────────
contributors
  > acdlite — 1,245 commits
  > poteto — 987 commits
  > gaearon — 654 commits
    sebmarkbage — 432 commits
    tyao1 — 321 commits
─────────────────────────────────────────────
quality
  ci/cd yes  tests yes  readme yes  license MIT
  last push 2d ago
─────────────────────────────────────────────
health ████████████████████ 9.2/10
```

## Install

```bash
pip install repo-analyzer
```

Or clone and install locally:

```bash
git clone https://github.com/Khorrrr/Github-Repo-Analyzer-Cli-Tool.git
cd Github-Repo-Analyzer-Cli-Tool
pip install -e .
```

## Usage

### Analyze a repo

```bash
repo-analyzer https://github.com/pallets/flask
```

### Compare two repos

```bash
repo-analyzer compare https://github.com/pallets/flask https://github.com/django/django
```

### Export to JSON

```bash
repo-analyzer https://github.com/torvalds/linux --export json
```

### Export to PDF

```bash
repo-analyzer https://github.com/torvalds/linux --export pdf -o report.pdf
```

### Skip cache

```bash
repo-analyzer https://github.com/pallets/flask --no-cache
```

## GitHub Token (optional but recommended)

Without a token you're limited to 60 API requests/hour. With one you get 5,000/hour.

Create a `.env` file in the project root:

```
GITHUB_TOKEN=ghp_your_token_here
```

Or export it:

```bash
export GITHUB_TOKEN=ghp_your_token_here
```

## What it does

- **Language breakdown** — shows what the repo is written in, with visual bars
- **Top contributors** — who's doing the most work
- **Activity stats** — stars, forks, issues, PRs, monthly commits
- **Code quality signals** — checks for CI/CD, tests, README, license, last push date
- **Health score** — weighted 0-10 score based on activity, community, maintenance, quality, and documentation
- **Comparison mode** — compare any two repos side by side
- **Export** — save results as JSON or PDF
- **Caching** — results are cached for 5 minutes so you don't burn through API limits

## Health Score

The health score is a weighted average of five factors:

| Factor        | Weight | What it looks at                      |
| ------------- | ------ | ------------------------------------- |
| Activity      | 2.0    | Recent commits, days since last push  |
| Community     | 2.0    | Stars, forks, number of contributors  |
| Maintenance   | 2.0    | Open issues/PRs ratio, responsiveness |
| Quality       | 2.5    | CI/CD, tests, README, license         |
| Documentation | 1.5    | README quality, description, topics   |

## Project Structure

```
repo_analyzer/
├── cli.py          # Click CLI entry point
├── api.py          # GitHub REST API client
├── analyzer.py     # Core analysis logic
├── health.py       # Health score algorithm
├── display.py      # Rich terminal output
├── cache.py        # File-based caching
├── compare.py      # Repo comparison
└── export.py       # JSON/PDF export
tests/
├── test_api.py
├── test_analyzer.py
├── test_cache.py
├── test_cli.py
├── test_compare.py
├── test_display.py
├── test_export.py
├── test_health.py
├── test_api_integration.py
└── test_e2e.py
```

## Running Tests

```bash
pip install -e ".[dev]"
pytest
```

133 tests covering unit, integration, and end-to-end scenarios.

## Built With

- [Click](https://click.palletsprojects.com/) — CLI framework
- [Rich](https://rich.readthedocs.io/) — terminal formatting
- [Requests](https://requests.readthedocs.io/) — HTTP client
- [fpdf2](https://py-pdf.github.io/fpdf2/) — PDF generation
- [pytest](https://docs.pytest.org/) — testing

## License

MIT — see [LICENSE](LICENSE) for details.
