Metadata-Version: 2.4
Name: repotoire
Version: 0.1.41
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Quality Assurance
Requires-Dist: kuzu>=0.8.0
Requires-Dist: falkordb>=1.0.0
Requires-Dist: openai>=1.0.0
Requires-Dist: spacy>=3.7.0
Requires-Dist: click>=8.1.0
Requires-Dist: rich>=13.0.0
Requires-Dist: pydantic>=2.0.0
Requires-Dist: networkx>=3.2.0
Requires-Dist: jinja2>=3.1.0
Requires-Dist: detect-secrets>=1.4.0
Requires-Dist: gitpython>=3.1.40
Requires-Dist: fastapi>=0.121.3
Requires-Dist: uvicorn>=0.38.0
Requires-Dist: mcp>=1.22.0
Requires-Dist: python-dotenv>=1.2.1
Requires-Dist: clerk-backend-api>=4.2.0
Requires-Dist: httpx[http2]>=0.27.0
Requires-Dist: pyjwt[crypto]>=2.8.0
Requires-Dist: cryptography>=41.0.0
Requires-Dist: svix>=1.0.0
Requires-Dist: keyring>=24.0.0
Requires-Dist: sqlalchemy>=2.0.0
Requires-Dist: alembic>=1.13.0
Requires-Dist: psycopg2-binary>=2.9.9
Requires-Dist: asyncpg>=0.29.0
Requires-Dist: stripe>=7.0.0
Requires-Dist: celery>=5.3.0
Requires-Dist: redis>=5.0.0
Requires-Dist: structlog>=24.0.0
Requires-Dist: psutil>=5.9.0
Requires-Dist: sentry-sdk[fastapi,celery,sqlalchemy]>=2.0.0
Requires-Dist: resend>=0.5.0
Requires-Dist: aioboto3>=13.0.0
Requires-Dist: email-validator>=2.0.0
Requires-Dist: python-slugify>=8.0.0
Requires-Dist: bleach>=6.0.0
Requires-Dist: slowapi>=0.1.9
Requires-Dist: uv-secure>=0.15.0
Requires-Dist: ruff>=0.1.0
Requires-Dist: mypy>=1.7.0
Requires-Dist: pylint>=3.0.0
Requires-Dist: bandit>=1.7.0
Requires-Dist: radon>=6.0.0
Requires-Dist: vulture>=2.0.0
Requires-Dist: semgrep>=1.0.0
Requires-Dist: tree-sitter>=0.20.0 ; extra == 'all-languages'
Requires-Dist: tree-sitter-python>=0.20.0 ; extra == 'all-languages'
Requires-Dist: tree-sitter-javascript>=0.20.0 ; extra == 'all-languages'
Requires-Dist: tree-sitter-typescript>=0.20.0 ; extra == 'all-languages'
Requires-Dist: tree-sitter-java>=0.23.0 ; extra == 'all-languages'
Requires-Dist: tree-sitter-go>=0.23.0 ; extra == 'all-languages'
Requires-Dist: anthropic>=0.40.0 ; extra == 'anthropic'
Requires-Dist: pyyaml>=6.0 ; extra == 'config'
Requires-Dist: pytest>=7.4.0 ; extra == 'dev'
Requires-Dist: pytest-cov>=4.1.0 ; extra == 'dev'
Requires-Dist: pytest-xdist>=3.5.0 ; extra == 'dev'
Requires-Dist: pytest-benchmark>=4.0.0 ; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.23.0 ; extra == 'dev'
Requires-Dist: pytest-timeout>=2.2.0 ; extra == 'dev'
Requires-Dist: hypothesis>=6.100.0 ; extra == 'dev'
Requires-Dist: factory-boy>=3.3.0 ; extra == 'dev'
Requires-Dist: aiosqlite>=0.20.0 ; extra == 'dev'
Requires-Dist: black>=23.0.0 ; extra == 'dev'
Requires-Dist: ruff>=0.1.0 ; extra == 'dev'
Requires-Dist: pyyaml>=6.0 ; extra == 'dev'
Requires-Dist: tomli>=2.0.0 ; extra == 'dev'
Requires-Dist: tenacity>=8.2.0 ; extra == 'dev'
Requires-Dist: lancedb>=0.4.0 ; extra == 'lancedb'
Requires-Dist: pyarrow>=14.0.0 ; extra == 'lancedb'
Requires-Dist: datasets>=2.14.0 ; extra == 'local-embeddings'
Requires-Dist: sentence-transformers>=2.2.0 ; extra == 'local-embeddings'
Requires-Dist: accelerate>=0.26.0 ; extra == 'local-embeddings'
Requires-Dist: questionary>=2.0.0 ; extra == 'ml'
Requires-Dist: scikit-learn>=1.3.0 ; extra == 'ml'
Requires-Dist: joblib>=1.3.0 ; extra == 'ml'
Requires-Dist: torch>=2.5.0,<2.9.0 ; extra == 'ml'
Requires-Dist: torch-geometric>=2.6.0 ; extra == 'ml'
Requires-Dist: gensim>=4.3.0 ; extra == 'ml'
Requires-Dist: prometheus-client>=0.19.0 ; extra == 'observability'
Requires-Dist: opentelemetry-api>=1.20.0 ; extra == 'observability'
Requires-Dist: opentelemetry-sdk>=1.20.0 ; extra == 'observability'
Requires-Dist: opentelemetry-exporter-otlp>=1.20.0 ; extra == 'observability'
Requires-Dist: e2b-code-interpreter>=1.0.0 ; extra == 'sandbox'
Requires-Dist: pip-audit>=2.6.0 ; extra == 'security'
Requires-Dist: cyclonedx-bom>=4.0.0 ; extra == 'security'
Requires-Dist: voyageai>=0.3.0 ; extra == 'voyage'
Provides-Extra: all-languages
Provides-Extra: anthropic
Provides-Extra: config
Provides-Extra: dev
Provides-Extra: lancedb
Provides-Extra: local-embeddings
Provides-Extra: ml
Provides-Extra: observability
Provides-Extra: sandbox
Provides-Extra: security
Provides-Extra: timescale
Provides-Extra: voyage
License-File: LICENSE
Summary: Graph-Powered Code Health Platform
Keywords: code-analysis,knowledge-graph,technical-debt,falkordb,static-analysis
Author: Repotoire Team
License-Expression: MIT
Requires-Python: >=3.11
Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
Project-URL: Documentation, https://repotoire.readthedocs.io
Project-URL: Homepage, https://github.com/yourusername/repotoire
Project-URL: Issues, https://github.com/yourusername/repotoire/issues
Project-URL: Repository, https://github.com/yourusername/repotoire

# Repotoire 🎼

**Graph-Powered Code Health Analysis — Local-First, No Docker Required**

Repotoire builds a knowledge graph of your codebase to detect architectural issues, code smells, and security vulnerabilities that traditional linters miss.

[![PyPI](https://img.shields.io/pypi/v/repotoire.svg)](https://pypi.org/project/repotoire/)
[![Python 3.10+](https://img.shields.io/badge/python-3.10+-blue.svg)](https://www.python.org/downloads/)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

## Why Repotoire?

Most linters analyze files in isolation. Repotoire sees the **whole picture**:

```
Traditional Linters          Repotoire
─────────────────────        ─────────────────────
file1.py ✓                   file1.py ──┐
file2.py ✓                   file2.py ──┼── Knowledge Graph
file3.py ✓                   file3.py ──┘
                                  │
                             Circular deps?
                             God classes?
                             Dead code?
                             Coupling hotspots?
```

## Quick Start

```bash
pip install repotoire
repotoire analyze .
```

That's it. No API keys, no Docker, no cloud account required.

**First run builds the graph (~1 min). Subsequent runs use incremental caching (~30s).**

## What It Finds

**47 detectors** across 4 categories:

### 🏗️ Architecture
- Circular dependencies (Tarjan's SCC)
- Architectural bottlenecks (betweenness centrality)
- Hub dependencies (fragile central nodes)
- Module cohesion problems

### 🔍 Code Smells
- God classes (too many responsibilities)
- Dead code (unreachable functions)
- Feature envy (methods using wrong class)
- Shotgun surgery (changes ripple everywhere)
- Middle man, lazy class, data clumps...

### 🔒 Security
- SQL injection patterns
- Hardcoded secrets (API keys, passwords)
- Unsafe deserialization (pickle, yaml.load)
- Eval/exec with user input
- GitHub Actions injection

### 📊 Quality
- Complexity hotspots
- Type hint coverage gaps
- Duplicate code blocks
- Test smells

## Sample Output

```
╔═══════════════════════ 🎼 Repotoire Health Report ═══════════════════════╗
║  Grade: B                                                                 ║
║  Score: 82.5/100                                                          ║
║  Good - Minor improvements recommended                                    ║
╚═══════════════════════════════════════════════════════════════════════════╝

┌─────────────────────┬────────┬───────────┐
│ Category            │ Weight │ Score     │
├─────────────────────┼────────┼───────────┤
│ Graph Structure     │  40%   │ 85.0/100  │
│ Code Quality        │  30%   │ 78.3/100  │
│ Architecture Health │  30%   │ 84.2/100  │
└─────────────────────┴────────┴───────────┘

🔍 Findings Summary (23 total)
┌─────────────┬───────┐
│ 🔴 Critical │     2 │
│ 🟠 High     │     5 │
│ 🟡 Medium   │    12 │
│ 🔵 Low      │     4 │
└─────────────┴───────┘
```

## Performance

| Metric | Time |
|--------|------|
| First run (build graph) | ~60s |
| Incremental (unchanged) | ~30s |
| Incremental (few changes) | ~45s |

Tested on a 50k LOC Python codebase. YMMV.

## CLI Reference

```bash
repotoire analyze .                    # Analyze current directory
repotoire analyze . --offline          # Skip cloud sync
repotoire analyze . --thorough         # Include slow external tools
repotoire analyze . --output report.json
repotoire analyze . --output report.html --format html

repotoire ingest .                     # Just build graph (no analysis)
repotoire ask "what calls UserService" # Natural language queries
```

## Configuration

Create `.repotoirerc` or `repotoire.toml`:

```toml
[analysis]
patterns = ["**/*.py", "**/*.ts"]
exclude = ["**/node_modules/**", "**/venv/**"]

[detectors.god_class]
threshold_methods = 20
threshold_lines = 500
```

Or use environment variables:

```bash
export REPOTOIRE_API_KEY=ak_...        # For cloud features
export DEEPINFRA_API_KEY=...           # For AI-powered fixes (optional)
```

## How It Works

1. **Parse** — Tree-sitter extracts AST from Python/TypeScript
2. **Build Graph** — Kuzu (embedded graph DB) stores entities + relationships
3. **Analyze** — 47 detectors run graph algorithms (SCC, betweenness, community detection)
4. **Report** — Findings ranked by severity with fix suggestions

```
┌──────────┐    ┌───────────┐    ┌──────────────┐    ┌──────────┐
│  Source  │───▶│  Parser   │───▶│  Kuzu Graph  │───▶│ Detectors│
│  Files   │    │(tree-sitter)   │  (embedded)  │    │ (47)     │
└──────────┘    └───────────┘    └──────────────┘    └──────────┘
                                        │
                                        ▼
                                 ┌──────────────┐
                                 │   Reports    │
                                 │ CLI/HTML/JSON│
                                 └──────────────┘
```

## CI/CD Integration

### GitHub Actions

```yaml
- name: Code Health Check
  run: |
    pip install repotoire
    repotoire analyze . --output report.json
    
- name: Fail if critical issues
  run: |
    CRITICAL=$(jq '.findings | map(select(.severity == "critical")) | length' report.json)
    if [ "$CRITICAL" -gt 0 ]; then exit 1; fi
```

### Pre-commit Hook

```yaml
# .pre-commit-config.yaml
repos:
  - repo: local
    hooks:
      - id: repotoire
        name: repotoire
        entry: repotoire analyze . --offline
        language: system
        pass_filenames: false
```

## Cloud Features (Optional)

For team dashboards and PR checks, create a free account at [repotoire.com](https://repotoire.com):

```bash
repotoire login                        # OAuth via browser
repotoire analyze .                    # Results sync to dashboard
repotoire sync                         # Manual sync
```

## Comparison

| Feature | Repotoire | SonarQube | CodeClimate |
|---------|-----------|-----------|-------------|
| Local-first | ✅ | ❌ | ❌ |
| No Docker | ✅ | ❌ | ✅ |
| Graph analysis | ✅ | Partial | ❌ |
| Circular deps | ✅ | ✅ | ❌ |
| Dead code | ✅ | ✅ | ✅ |
| Architectural metrics | ✅ | Partial | ❌ |
| Free tier | ✅ | Limited | Limited |

## Supported Languages

- **Python** — Full support (AST + type hints)
- **TypeScript/JavaScript** — Full support
- **More coming** — Rust, Go, Java planned

## Contributing

```bash
git clone https://github.com/repotoire/repotoire
cd repotoire
pip install -e ".[dev]"
pytest
```

See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines.

## License

MIT — see [LICENSE](LICENSE)

---

**[Try it now →](https://pypi.org/project/repotoire/)** `pip install repotoire && repotoire analyze .`

