Metadata-Version: 2.4
Name: deeprepo
Version: 1.1.0
Summary: A production-grade Python library for RAG on local codebases with multi-provider AI support and MCP (Model Context Protocol) server integration
Author-email: Abhishek <abhishekpandey2432001@gmail.com>
License: MIT
Project-URL: Homepage, https://github.com/abhishek2432001/deeprepo
Project-URL: Documentation, https://github.com/abhishek2432001/deeprepo#readme
Project-URL: Repository, https://github.com/abhishek2432001/deeprepo
Project-URL: Bug Tracker, https://github.com/abhishek2432001/deeprepo/issues
Keywords: rag,retrieval-augmented-generation,vector-search,semantic-search,llm,embeddings,code-analysis,ai,machine-learning,nlp,mcp,model-context-protocol,cursor,claude-desktop
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
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 :: Libraries :: Python Modules
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
Classifier: Topic :: Text Processing :: Indexing
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: numpy>=1.24.0
Requires-Dist: requests>=2.28.0
Requires-Dist: openai>=1.0.0
Requires-Dist: google-generativeai>=0.3.0
Requires-Dist: anthropic>=0.18.0
Requires-Dist: tiktoken>=0.7.0
Provides-Extra: huggingface
Provides-Extra: ollama
Provides-Extra: graph
Requires-Dist: tree-sitter>=0.21.0; extra == "graph"
Requires-Dist: tree-sitter-python>=0.21.0; extra == "graph"
Requires-Dist: tree-sitter-javascript>=0.21.0; extra == "graph"
Requires-Dist: tree-sitter-typescript>=0.21.0; extra == "graph"
Requires-Dist: tree-sitter-go>=0.21.0; extra == "graph"
Requires-Dist: tree-sitter-rust>=0.21.0; extra == "graph"
Requires-Dist: tree-sitter-java>=0.21.0; extra == "graph"
Provides-Extra: all-providers
Requires-Dist: tree-sitter>=0.21.0; extra == "all-providers"
Requires-Dist: tree-sitter-python>=0.21.0; extra == "all-providers"
Requires-Dist: tree-sitter-javascript>=0.21.0; extra == "all-providers"
Requires-Dist: tree-sitter-typescript>=0.21.0; extra == "all-providers"
Requires-Dist: tree-sitter-go>=0.21.0; extra == "all-providers"
Requires-Dist: tree-sitter-rust>=0.21.0; extra == "all-providers"
Requires-Dist: tree-sitter-java>=0.21.0; extra == "all-providers"
Provides-Extra: mcp
Requires-Dist: mcp>=1.2.0; extra == "mcp"
Provides-Extra: dev
Requires-Dist: pytest>=7.0.0; extra == "dev"
Requires-Dist: build>=0.10.0; extra == "dev"
Requires-Dist: twine>=4.0.0; extra == "dev"
Dynamic: license-file

# DeepRepo Core

A production-grade Python library for RAG on local codebases — **code knowledge graph**, **hierarchical wiki engine**, **smart query routing**, and **branch isolation**.

> See the main [README.md](https://github.com/abhishek2432001/deeprepo/blob/main/README.md) for complete documentation.

## Quick Install

```bash
pip install deeprepo

# With MCP server support
pip install deeprepo[mcp]
```

## Quick Start (CLI)

```bash
# Ingest current directory (Ollama, free and local)
deeprepo ingest .

# Browse the auto-generated wiki with in-page chat
deeprepo serve                     # → http://localhost:8080

# Ask questions directly
deeprepo query "how does authentication work?"
deeprepo query "what breaks if I change router.py?"
```

## Quick Start (Python API)

```python
from deeprepo import DeepRepoClient

# Initialize (defaults to Ollama if running, else OpenAI)
client = DeepRepoClient(provider_name="ollama")

# Ingest your code (incremental — unchanged files are skipped)
result = client.ingest("/path/to/your/code")
print(f"Indexed {result['files_scanned']} files, {result['wiki_generated']} wiki pages")

# Query with smart routing
response = client.query("How does authentication work?")
print(response['answer'])
print(f"Intent: {response['intent']}, Strategy: {response['strategy']}")
print(f"Sources: {response['sources']}")    # list of file paths

# Browse the wiki
print(f"Wiki at: {client.get_wiki_dir()}")
```

## CLI Commands

| Command | Description |
|---------|-------------|
| `deeprepo init` | Detect provider setup, print the ingest command |
| `deeprepo ingest [PATH]` | Build graph + wiki + embeddings |
| `deeprepo wiki [PATH]` | Regenerate wiki pages only |
| `deeprepo serve` | Launch wiki viewer + chat at port 8080 |
| `deeprepo query "…"` | Ask a question, get an AI answer |
| `deeprepo status` | Show branch isolation & cache freshness |

## What's Inside

| Module | Purpose |
|--------|---------|
| `client.py` | Main facade — branch isolation, freshness, provider wiring |
| `graph.py` | SQLite store: graph nodes/edges, embeddings, wiki index, state |
| `graph_builder.py` | Tree-sitter AST parser → code knowledge graph |
| `wiki.py` | Hierarchical wiki engine — bottom-up LLM synthesis |
| `router.py` | Intent classifier + 6 context strategy selectors |
| `ingestion.py` | File scanner, chunker, language detection |
| `ui.py` | Wiki viewer (HTTP + mermaid renderer + chat) |
| `mcp/server.py` | 7 focused MCP tools for AI assistants |

## MCP Tools (7 tools)

Connect to Cursor / Claude Desktop as an MCP server:

```bash
deeprepo-mcp     # starts the MCP server on stdio
```

| Tool | Purpose |
|------|---------|
| `ingest_codebase` | Index a repo directory |
| `find_symbol` | Locate a class/function (~50 tokens) |
| `get_file_structure` | File API without reading source (~150 tokens) |
| `explain_file` | Plain-English file explanation (~300 tokens) |
| `find_change_impact` | Blast-radius analysis (~300 tokens) |
| `ask_codebase` | Open-ended question about the code |
| `get_project_overview` | Whole-repo narrative overview |

## Design Diagrams

- **[High-Level Design](../docs/high-level-design.excalidraw)** — Process flow diagram
- **[Class Interaction Design](../docs/class-interaction-design.excalidraw)** — Class relationships

Open with [excalidraw.com](https://excalidraw.com) or the VS Code Excalidraw extension.

## License

MIT License — see LICENSE file for details.
