Metadata-Version: 2.1
Name: dragula
Version: 0.0.1
Summary: AI-powered codebase indexing and documentation generator.
Author: Matvey Bliznyuk
License: MIT
Project-URL: Source, https://github.com/Neurotrier/dragula
Project-URL: Tracker, https://github.com/Neurotrier/dragula/issues
Keywords: documentation,rag,autogeneration,codebase,indexing,fastapi,llm,ai
Classifier: Operating System :: OS Independent
Classifier: Operating System :: MacOS :: MacOS X
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Operating System :: POSIX :: Linux
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: License :: OSI Approved :: MIT License
Classifier: Intended Audience :: Developers
Classifier: Topic :: Software Development :: Documentation
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Environment :: Web Environment
Classifier: Framework :: FastAPI
Requires-Python: >=3.11
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: chromadb>=0.5.0
Requires-Dist: fastapi>=0.115.0
Requires-Dist: google-genai>=0.8.0
Requires-Dist: jinja2>=3.1.0
Requires-Dist: pydantic>=2.8.0
Requires-Dist: rich>=13.7.0
Requires-Dist: uvicorn>=0.30.0
Provides-Extra: dev
Requires-Dist: pytest>=8.2.0; extra == "dev"
Requires-Dist: build>=1.2.0; extra == "dev"
Requires-Dist: twine>=5.0.0; extra == "dev"

# Dragula

`Dragula` (D-RAG-ula) is a Python library that indexes a Python codebase and serves a local web UI for AI-generated object documentation over pluggable LLM providers.

## Features

- CLI commands: `init`, `index`, `serve`
- AST-based symbol extraction (module/class/function/method)
- SQLite storage for structured symbol data
- ChromaDB storage for semantic chunk vectors
- FastAPI web UI to browse symbols and request AI descriptions (also available via HTTP API)

## Install

Requires **Python 3.11+**.

```bash
pip install dragula
```

## Configuration

Dragula keeps its config and local databases under `<project_root>/.dragula/` (fixed location, similar in spirit to an Alembic env directory).

Initialize once in the target project (creates `.dragula/`, a template `config.ini`, SQLite tables, and the Chroma data directory):

```bash
dragula init .
```

Edit `.dragula/config.ini` for your LLM providers.

### Minimal Gemini config

```ini
[app]
top_k = 6

[chat]
provider = gemini
model = gemini-2.5-flash
api_key = ${GEMINI_API_KEY}
base_url =
timeout_seconds = 60

[embedding]
provider = gemini
model = gemini-embedding-001
api_key = ${GEMINI_API_KEY}
base_url =
timeout_seconds = 60
```

### Mixed providers (chat remote, embedding local)

```ini
[app]
top_k = 6

[chat]
provider = gemini
model = gemini-2.5-flash
api_key = ${GEMINI_API_KEY}
base_url =
timeout_seconds = 60

[embedding]
provider = openai_compatible
model = text-embedding-3-small
base_url = http://localhost:11434/v1
api_key =
timeout_seconds = 60
```

## Usage

Initialize (first time only):

```bash
dragula init .
```

Build index:

```bash
dragula index .
```

Run web UI (default `http://127.0.0.1:8000`):

```bash
dragula serve .
```

Optional server binding:

```bash
dragula serve . --host 0.0.0.0 --port 8080
```

## HTTP API

| Method | Path | Purpose |
|--------|------|---------|
| `GET` | `/` | Web UI |
| `GET` | `/api/symbols` | List symbols |
| `GET` | `/api/symbols/{symbol_id}` | Symbol details and chunks |
| `POST` | `/api/symbols/{symbol_id}/describe` | Generate AI description |
| `DELETE` | `/api/symbols/{symbol_id}/descriptions` | Clear cached descriptions for a symbol |

## Data layout

Under the project root:

- `.dragula/config.ini` — configuration
- `.dragula/symbols.sqlite3` — structured symbol/chunk/description tables
- `.dragula/chroma/` — Chroma persistent vector store
