Metadata-Version: 2.4
Name: xray-repo
Version: 0.1.0
Summary: X-ray any codebase in seconds. Fast local CLI to analyze repositories.
Author: repo-xray contributors
License-Expression: MIT
Project-URL: Homepage, https://github.com/user/repo-xray
Project-URL: Repository, https://github.com/user/repo-xray
Project-URL: Issues, https://github.com/user/repo-xray/issues
Keywords: cli,repository,analysis,codebase,developer-tools
Classifier: Development Status :: 3 - Alpha
Classifier: Environment :: Console
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: rich>=13.0
Requires-Dist: typer>=0.9
Provides-Extra: dev
Requires-Dist: pytest>=7.0; extra == "dev"
Requires-Dist: pytest-cov>=4.0; extra == "dev"
Dynamic: license-file

<p align="center">
  <h1 align="center"><strong>🔍 repo-xray</strong></h1>
  <p align="center"><em>X-ray any codebase in seconds.</em></p>
</p>

<p align="center">
  <a href="https://pypi.org/project/repo-xray/"><img src="https://img.shields.io/pypi/v/repo-xray" alt="PyPI"></a>
  <a href="https://pypi.org/project/repo-xray/"><img src="https://img.shields.io/pypi/pyversions/repo-xray" alt="Python Version"></a>
  <a href="https://github.com/user/repo-xray/blob/main/LICENSE"><img src="https://img.shields.io/github/license/user/repo-xray" alt="License"></a>
</p>

---

A fast, local CLI tool that analyzes any Git repository — local or public GitHub — and gives you an instant overview of the codebase. No accounts, no cloud, no telemetry. Just point it at a repo and get answers.

## ✨ What you get

```text
🔍 REPO XRAY
────────────────────────────────────────

📊 CODEBASE
Files:           312
Lines of code:   18,492
Languages:
  Python         71%  ██████████████░░░░░░
  JavaScript     19%  ████░░░░░░░░░░░░░░░░
  Other          10%  ██░░░░░░░░░░░░░░░░░░

🐘 LARGEST FILES
82.1 MB   data.json
41.3 MB   model.pkl
1.2 MB    src/generated.py

📦 DEPENDENCIES
42 dependencies found
requirements.txt
pyproject.toml
package.json

⚠️  POSSIBLE ISSUES
14 TODO/FIXME comments
3 empty exception handlers
4 unpinned Python dependencies
2 source files over 2,000 lines

🔐 POSSIBLE SECRETS
.env found
config.py:18 — API_KEY = "sk-****91x"

🧹 JUNK
__pycache__ directories: 14
.DS_Store files: 3
*.pyc files: 31

────────────────────────────────────────
X-Ray completed in 1.4s
```

## 📦 Installation

```bash
pip install repo-xray
```

Requires **Python 3.10+**.

## 🚀 Usage

### Analyze a local project

```bash
repo-xray .
repo-xray /path/to/project
```

### Analyze a public GitHub repository

```bash
repo-xray https://github.com/user/repo
```

The repository is cloned to a temporary directory, analyzed, and cleaned up automatically.

### Options

```bash
repo-xray . --largest 20      # Show top 20 largest files
repo-xray . --no-secrets      # Skip secret detection
repo-xray . --json            # Machine-readable JSON output
repo-xray . --verbose         # Verbose output
repo-xray --version           # Show version
```

## 🔧 Features

### Codebase Analysis
- Total files and lines of code
- Language breakdown with percentages
- Largest files and largest source files
- Deepest directory paths

### Dependency Detection
- Recognizes `requirements.txt`, `pyproject.toml`, `Pipfile`, `package.json`, `Cargo.toml`, `go.mod`, `Gemfile`, and more
- Counts dependencies where parsing is straightforward
- Flags unpinned Python dependencies

### Code Smell Detection
- `TODO`, `FIXME`, `HACK`, `XXX`, `WORKAROUND` comments
- Python `except: pass` patterns
- Source files over 2,000 lines
- Empty source files
- Duplicate filenames across directories

### Secret Detection
- `.env` files
- Private key headers (`-----BEGIN RSA PRIVATE KEY-----`)
- API keys, tokens, passwords
- AWS access keys, GitHub tokens, Bearer tokens
- All values are **masked** — never printed in full

### Junk Detection
- `.DS_Store`, `Thumbs.db`, `desktop.ini`
- `.pyc` files, `__pycache__` directories
- Log files
- Unusually large files (> 5 MB)

### Output Formats
- **Rich terminal output** with colors, bars, and tables
- **JSON mode** (`--json`) for piping into other tools

## 🔒 Privacy & Security

repo-xray runs **100% locally**. Your code never leaves your machine.

- No accounts or authentication required
- No telemetry or analytics
- No data uploaded anywhere
- Secret detection only shows **masked** values — full secrets are never displayed
- GitHub URL cloning uses `--depth 1` and cleans up temporary files immediately

**Important:** Secret detection finds *possible* secrets based on patterns. These are not confirmed vulnerabilities — always verify findings manually.

## 🗺️ Roadmap

- [ ] Cyclomatic complexity estimation
- [ ] Git history analysis (contributor count, commit frequency)
- [ ] License detection
- [ ] Framework detection (Django, React, FastAPI, etc.)
- [ ] Custom ignore patterns via CLI flag
- [ ] Export reports to HTML/Markdown
- [ ] Pre-commit hook integration

## 🤝 Contributing

Contributions are welcome! Here's how to get started:

```bash
git clone https://github.com/user/repo-xray.git
cd repo-xray
python -m venv .venv
source .venv/bin/activate  # Windows: .venv\Scripts\activate
pip install -e ".[dev]"
```

Run tests:

```bash
pytest
```

Run against the repo-xray codebase itself:

```bash
repo-xray .
```

### Guidelines
- Keep it fast — no heavy dependencies or network calls during analysis
- Low false-positive rate — prefer missing an edge case over spamming the user
- Clean terminal UX — output should be scannable in under 5 seconds
- Simple, maintainable Python — no over-engineering

## 📄 License

MIT — see [LICENSE](LICENSE).
