Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

follen99/DeepBase

Repository files navigation

DeepBase

Version 1.8.0 Python 3.8+ GPL 3 License PyPI Ready

LLM Ready TOON Optimized Smart Parsing

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:

  1. Fork il repository
  2. Crea un branch (git checkout -b feature/amazing-feature)
  3. Commit le modifiche (git commit -m 'Add amazing feature')
  4. Push al branch (git push origin feature/amazing-feature)
  5. Apri una Pull Request

πŸ“„ License

Questo progetto Γ¨ rilasciato sotto licenza GPL 3. Vedi il file LICENSE per i dettagli.


Built with ❀️ by Giuliano Ranauro

⭐ Star this repo β€’ πŸ› Report bug β€’ πŸ“¦ PyPI

About

A simple tool for creating LLM context of your codebase

Resources

License

Stars

Watchers

Forks

Packages

Contributors

Languages

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /