Metadata-Version: 2.4
Name: nelgraph
Version: 1.0.3
Summary: GraphRAG knowledge base for codebases
License: MIT
Requires-Python: >=3.10
Requires-Dist: chromadb
Requires-Dist: click
Requires-Dist: fastapi
Requires-Dist: gitpython
Requires-Dist: igraph
Requires-Dist: json-repair
Requires-Dist: leidenalg
Requires-Dist: neo4j
Requires-Dist: networkx
Requires-Dist: openai
Requires-Dist: python-dotenv
Requires-Dist: requests
Requires-Dist: rich
Requires-Dist: tree-sitter
Requires-Dist: tree-sitter-javascript
Requires-Dist: tree-sitter-php
Requires-Dist: tree-sitter-python
Requires-Dist: tree-sitter-typescript
Requires-Dist: uvicorn
Requires-Dist: watchdog
Description-Content-Type: text/markdown

# nelgraph 🚀

An autonomous, zero-configuration Knowledge Graph builder and semantic search engine optimized for local codebases and AI testing agents. It ingests source code, AST Call Graphs, and Git history into a hybrid Graph-Vector database (**Neo4j** + **ChromaDB**) using **DeepSeek V4-Flash**.

## 🛠️ Installation

```bash
pip install nelgraph
```

## 🚀 CLI Usage

### 1. Initialize GraphRAG for your project
Navigate to your project directory and run:

```bash
nelgraph init
```

During initialization, it will prompt you for your OpenRouter API key, configure the local `.env` and `.graphrag_data/` directory, start Neo4j inside a local Docker container, build structural nodes and indexes, and automatically install a git post-commit hook so the graph auto-syncs.

### 2. Manual Synchronization
If you want to manually trigger incremental synchronization:

```bash
nelgraph sync
```

### 3. Check Status
View current database metrics, indexed function counts, and enrichment coverage:

```bash
nelgraph status
```

### 4. Run Watcher
Run a file watcher that auto-syncs the graph in the background when files change:

```bash
nelgraph watch
```

## 🔌 Programmatic Python API

You can import `nelgraph` directly into your scripts or AI testing agents:

```python
import nelgraph

# Configure (if .env is not present or needs custom config)
nelgraph.configure(
    codebase_path="/absolute/path/to/project",
    openrouter_api_key="your-openrouter-key"
)

# 1. Get snapshot of prioritized functions
snapshot = nelgraph.get_snapshot()
print(f"Total functions: {snapshot['total']}")

# 2. Retrieve detailed context for a function
ctx = nelgraph.get_function_context("process_order")
print(ctx.get("function", {}).get("raw_code"))

# 3. Mark function as tested/verified
nelgraph.mark_tested("process_order")
```
