A CLI utility to consolidate project context for LLMs.
Project description
DeepBase
DeepBase è un tool CLI che analizza una directory di progetto, estrae la struttura delle cartelle e il contenuto dei file di codice significativi, consolidandoli in un unico file di contesto per LLM.
✨ Features
| Feature | Descrizione |
|---|---|
| 📁 Project Structure | Genera una tree view della struttura di cartelle e file |
| 🧠 Smart Filtering | Ignora automaticamente directory comuni (.git, venv, node_modules) |
| ⚡ Token Optimization (TOON) | Genera "Semantic Skeletons" (classi, firme, docstring) per risparmiare fino al 90% dei token |
| 💡 Light Mode | Modalità ultra-leggera con solo firme di metodi e commenti iniziali |
| 🔍 Hybrid Focus Mode | Combina contesto leggero per l'intero progetto con contenuto completo per file/folder specifici |
| 🗄️ Database Support | Estrae schema da database SQLite (tabelle, colonne, relazioni) |
| 🌐 Multi-Language Parsing | Supporto nativo per Python, JavaScript, TypeScript, React (JSX/TSX), Markdown, LaTeX |
| 🔧 Plugin System | Architettura a plugin per parser personalizzati |
| ⚙️ Configurable | Personalizza via file .deepbase.toml |
| 📄 Unified Output | Tutto in un unico file, facile da copiare e incollare per gli LLM |
🚀 Installation
pip install deepbase
Development Mode
git clone https://github.com/follen99/deepbase.git
cd deepbase
pip install -e ".[dev]"
📖 How to Use
1. Basic Project Analysis
Structure Only (Default)
Genera rapidamente una tree view della struttura del progetto:
deepbase .
Include All Content
Per generare il contesto completo con tutto il codice:
deepbase . --all
⚠️ Attenzione: usare solo per progetti piccoli.
2. Smart Token Optimization (TOON)
Per progetti grandi, inviare tutto il codice a un LLM è costoso. TOON estrae solo lo "scheletro" semantico:
deepbase . --toon
# oppure
deepbase . -t
Risultato: Gli LLM capiscono l'architettura usando token minimi.
3. Light Mode (Ultra-Lightweight)
Modalità ancora più leggera di TOON, include solo firme di metodi/funzioni e commenti iniziali:
deepbase . --light
# oppure
deepbase . -l
4. Hybrid Mode (Focus)
Combina TOON per l'intero progetto con contenuto completo per file specifici.
Focus via CLI:
deepbase . --toon --focus "server/controllers/*" --focus "client/src/login.js"
Focus via File:
Crea un file (es. context_task.txt):
server/routes/auth.js
server/models/User.js
client/src/components/LoginForm.jsx
Esegui:
deepbase . --toon --focus-file context_task.txt
5. Database Analysis
DeepBase può analizzare database SQLite estraendo schema e relazioni:
# Schema completo
deepbase database.db --all
# Schema in modalità TOON (solo struttura)
deepbase database.db --toon
# Focus su tabelle specifiche
deepbase database.db --toon --focus "users" --focus "orders"
6. Single File Analysis
Analisi di un singolo file:
# Solo struttura (default)
deepbase README.md
# Struttura + contenuto completo
deepbase README.md --all
# Modalità TOON
deepbase script.py --toon
🌐 Supported Languages
| Linguaggio | Estensioni | Parser |
|---|---|---|
| Python | .py |
✅ Nativo - Classi, funzioni, async, type hints, docstring |
| JavaScript | .js, .jsx |
✅ Nativo - Funzioni, classi, componenti React |
| TypeScript | .ts, .tsx |
✅ Nativo - Tipi, interfacce, generics |
| Markdown | .md |
✅ Nativo - Headers, struttura documento |
| LaTeX | .tex |
✅ Nativo - Sezioni, comandi |
| JSON | .json |
✅ Legacy - Struttura dati |
| SQLite | .db, .sqlite |
✅ Database - Schema, tabelle, colonne |
| Altri | * |
⚠️ Fallback - Prime 10 righe + warning |
⚙️ Configuration (.deepbase.toml)
Crea un file .deepbase.toml nella root del progetto:
# Directory aggiuntive da ignorare
ignore_dirs = ["my_assets", "experimental", "logs"]
# Estensioni/filename aggiuntivi da includere
significant_extensions = [".cfg", "Makefile", ".tsx", ".prisma"]
# Directory sempre incluse (anche se matchano ignore_dirs)
force_include_dirs = ["important_logs"]
📊 Output Example
# Project Context: MyProject
> Total Size (raw): 15.28 KB | Est. Tokens (light): ~3,912
📁 MyProject/
├── 📄 README.md (1.9% | ~73t)
├── 📁 src/ (65.0% | ~2.5k t)
│ ├── 📄 main.py (25.0% | ~980t)
│ └── 📄 utils.py (40.0% | ~1.5k t)
└── 📁 tests/ (33.1% | ~1.3k t)
└── 📄 test_main.py (33.1% | ~1.3k t)
### FILE CONTENTS (LIGHT — signatures only)
> FILE: src/main.py
def main() -> None: ...
class Application:
def __init__(self, config: dict): ...
def run(self) -> int: ...
🛠️ Development Workflow
# Install in editable mode
pip install -e ".[dev]"
# Run tests
pytest
# Run specific test
pytest tests/test_suite_python.py -v
📚 Documentation
La documentazione completa è disponibile su GitHub Pages:
📝 Changelog
[1.8.0] - 2024-02-12
- ✅ Parser JavaScript/TypeScript/React (JSX/TSX)
- ✅ Parser Markdown e LaTeX
- ✅ Supporto database SQLite
- ✅ Sistema plugin per parser
- ✅ Modalità Light avanzata
- ✅ Focus mode per tabelle database
[1.7.0] - 2024-02-10
- ✅ Miglioramenti al parser Python (async, type hints)
- ✅ Supporto file focus da file esterno
- ✅ Stima token più accurata
🤝 Contributing
Contributi sono benvenuti! Per favore:
- Fork il repository
- Crea un branch (
git checkout -b feature/amazing-feature) - Commit le modifiche (
git commit -m 'Add amazing feature') - Push al branch (
git push origin feature/amazing-feature) - Apri una Pull Request
📄 License
Questo progetto è rilasciato sotto licenza GPL 3. Vedi il file LICENSE per i dettagli.
Built with ❤️ by Giuliano Ranauro
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file deepbase-1.8.1.tar.gz.
File metadata
- Download URL: deepbase-1.8.1.tar.gz
- Upload date:
- Size: 65.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3944fb5e0bfc39c7b02fff118b9d6eba33e5fdf9c07fff13320cc9d50486427a
|
|
| MD5 |
955be3397fc06c12ada291dd12f61913
|
|
| BLAKE2b-256 |
f734c92ae7f9169bf945025f219165adc63aae5beeb9f7e299f48e3be2142032
|
File details
Details for the file deepbase-1.8.1-py3-none-any.whl.
File metadata
- Download URL: deepbase-1.8.1-py3-none-any.whl
- Upload date:
- Size: 48.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
93b912ab4c893372a5bd8390df36a3a1d5170ab89455b027b18ea1c82e92b29d
|
|
| MD5 |
9d112792d35fd7fd29d49fee8d687616
|
|
| BLAKE2b-256 |
def3d79349bbe398833bf62db88427d688f1ce19ce4bb0978d535ccc49ae8f36
|