Skip to content

Commit d2d0b20

Browse files
committed
docs
1 parent 455b73b commit d2d0b20

File tree

7 files changed

+588
-979
lines changed

7 files changed

+588
-979
lines changed
File renamed without changes.

docs/configuration.md

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
# Configurazione avanzata
3+
4+
## File `.deepbase.toml`
5+
6+
Posizionare nella root del progetto da analizzare il file `.deepbase.toml`, verrà riconosciuto automaticamente.
7+
8+
### Esempio di file
9+
```
10+
# Esempio di file di configurazione per DeepBase.
11+
# Salva questo file come .deepbase.toml nella root del tuo progetto.
12+
13+
# Aggiungi altre directory da ignorare.
14+
# Queste si sommeranno a quelle di default.
15+
ignore_dirs = [
16+
"my_secret_folder",
17+
"temp_data"
18+
]
19+
20+
# Aggiungi altri files da ignorare.
21+
# Questi si sommeranno a quelle di default.
22+
ignore_files = [
23+
"secrets.txt"
24+
]
25+
26+
# Aggiungi altre estensioni o nomi di file da includere.
27+
significant_extensions = [
28+
".env.example",
29+
".customtext"
30+
]
31+
```

docs/examples.md

Lines changed: 354 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,354 @@
1+
# Esempi pratici
2+
3+
Questa pagina contiene esempi reali d'uso di DeepBase per diversi scenari e tipologie di progetto.
4+
5+
---
6+
7+
## 📁 Esempio 1: Progetto Python Flask
8+
9+
**Struttura progetto:**
10+
```
11+
my-flask-app/
12+
├── app/
13+
│ ├── __init__.py
14+
│ ├── routes.py # <- focus qui
15+
│ ├── models.py # <- focus qui
16+
│ ├── forms.py
17+
│ ├── templates/ # <- da ignorare
18+
│ └── static/
19+
├── config.py
20+
├── requirements.txt
21+
├── tests/ # <- da ignorare
22+
└── instance/
23+
└── app.db # <- database
24+
```
25+
26+
**Configurazione `.deepbase.toml`:**
27+
```toml
28+
ignore_dirs = ["app/templates", "tests", "instance", "__pycache__"]
29+
ignore_files = ["*.pyc", ".env", ".flaskenv"]
30+
```
31+
32+
**Comando:**
33+
```bash
34+
deepbase . --light --focus "app/routes.py" --focus "app/models.py"
35+
```
36+
37+
**Output:** Struttura light dell'intero progetto + contenuto completo di routes e models.
38+
39+
---
40+
41+
## 📁 Esempio 2: Progetto React + Node.js
42+
43+
**Struttura progetto:**
44+
```
45+
my-react-app/
46+
├── src/
47+
│ ├── components/
48+
│ │ ├── Button.jsx
49+
│ │ └── Card.jsx
50+
│ ├── pages/
51+
│ │ ├── Home.jsx # <- focus qui
52+
│ │ └── Dashboard.jsx # <- focus qui
53+
│ └── utils/
54+
│ └── api.js
55+
├── public/
56+
├── node_modules/ # <- da ignorare
57+
├── build/ # <- da ignorare
58+
├── package.json
59+
└── package-lock.json # <- da ignorare
60+
```
61+
62+
**Configurazione `.deepbase.toml`:**
63+
```toml
64+
ignore_dirs = ["node_modules", "build", "dist", "coverage", ".next"]
65+
ignore_files = ["package-lock.json", "yarn.lock", "*.log"]
66+
```
67+
68+
**Comando:**
69+
```bash
70+
deepbase . --light --focus "src/pages/*"
71+
```
72+
73+
---
74+
75+
## 📁 Esempio 3: Analisi Database SQLite
76+
77+
**Scenario:** Vuoi documentare lo schema del database + alcune query importanti.
78+
79+
**Struttura:**
80+
```
81+
data-project/
82+
├── migrations/
83+
│ ├── 001_initial.sql # <- focus qui
84+
│ └── 002_add_users.sql # <- focus qui
85+
├── queries/
86+
│ ├── reports.sql # <- focus qui
87+
│ └── analytics.sql
88+
└── production.db # <- database da analizzare
89+
```
90+
91+
**Configurazione `.deepbase.toml`:**
92+
```toml
93+
ignore_dirs = ["backups", "temp"]
94+
significant_extensions = [".sql", ".db", ".sqlite"]
95+
```
96+
97+
**Comando:**
98+
```bash
99+
deepbase . --light --focus "production.db" --focus "migrations/*" --focus "queries/reports.sql"
100+
```
101+
102+
**Output:** Schema completo del database + contenuto SQL dei file focalizzati.
103+
104+
---
105+
106+
## 📁 Esempio 4: Monorepo con più package
107+
108+
**Struttura:**
109+
```
110+
monorepo/
111+
├── packages/
112+
│ ├── core/
113+
│ │ ├── src/
114+
│ │ └── package.json
115+
│ ├── ui/ # <- focus solo questo
116+
│ │ ├── src/
117+
│ │ └── package.json
118+
│ └── utils/
119+
│ └── src/
120+
├── apps/
121+
│ ├── web/
122+
│ └── admin/
123+
└── turbo.json
124+
```
125+
126+
**Comando:**
127+
```bash
128+
deepbase . --light --focus "packages/ui/**/*"
129+
```
130+
131+
---
132+
133+
## 📁 Esempio 5: Documentazione LaTeX
134+
135+
**Struttura:**
136+
```
137+
thesis/
138+
├── chapters/
139+
│ ├── introduction.tex
140+
│ ├── methods.tex # <- focus qui
141+
│ ├── results.tex # <- focus qui
142+
│ └── conclusion.tex
143+
├── figures/
144+
├── bibliography.bib
145+
└── main.tex
146+
```
147+
148+
**Comando:**
149+
```bash
150+
deepbase . --light --focus "chapters/methods.tex" --focus "chapters/results.tex"
151+
```
152+
153+
---
154+
155+
## 📁 Esempio 6: Configurazione granulare (esclusioni complesse)
156+
157+
**Scenario:** Progetto con molti file temporanei e configurazioni locali.
158+
159+
**`.deepbase.toml`:**
160+
```toml
161+
# Directory
162+
ignore_dirs = [
163+
"node_modules",
164+
"__pycache__",
165+
".pytest_cache",
166+
"dist",
167+
"build",
168+
"coverage",
169+
".tox",
170+
# Esclusioni specifiche per percorso
171+
"legacy/old_components", # solo questa specifica
172+
"experiments/temp_*", # tutte le cartelle temp_*
173+
"src/components/__dev__" # cartella dev interna
174+
]
175+
176+
# File
177+
ignore_files = [
178+
"*.log",
179+
"*.tmp",
180+
"*.bak",
181+
".env*",
182+
"local.settings.json",
183+
"secrets.*",
184+
# Esclusioni specifiche per percorso
185+
"config/local.yaml",
186+
"src/debug_utils.py"
187+
]
188+
189+
# Estensioni extra
190+
significant_extensions = [".prisma", ".graphql", ".proto"]
191+
```
192+
193+
**Comando:**
194+
```bash
195+
deepbase . --light
196+
```
197+
198+
---
199+
200+
## 📁 Esempio 7: Focus da file esterno
201+
202+
**Scenario:** Hai una lista lunga di file da analizzare.
203+
204+
**File `focus-list.txt`:**
205+
```
206+
src/auth/login.js
207+
src/auth/register.js
208+
src/middleware/jwt.js
209+
config/auth.yaml
210+
tests/auth.test.js
211+
```
212+
213+
**Comando:**
214+
```bash
215+
deepbase . --light --focus-file focus-list.txt
216+
```
217+
218+
---
219+
220+
## 📁 Esempio 8: CI/CD - Generazione automatica contesto
221+
222+
**Scenario:** Generare contesto per PR review automatica.
223+
224+
**Script `.github/workflows/context.yml`:**
225+
```yaml
226+
name: Generate LLM Context
227+
228+
on:
229+
pull_request:
230+
paths:
231+
- 'src/**'
232+
233+
jobs:
234+
context:
235+
runs-on: ubuntu-latest
236+
steps:
237+
- uses: actions/checkout@v3
238+
239+
- name: Install DeepBase
240+
run: pip install deepbase
241+
242+
- name: Generate context
243+
run: |
244+
deepbase . --light --focus "src/**" -o pr-context.md
245+
246+
- name: Upload artifact
247+
uses: actions/upload-artifact@v3
248+
with:
249+
name: llm-context
250+
path: pr-context.md
251+
```
252+
253+
---
254+
255+
## 📁 Esempio 9: Confronto tra versioni
256+
257+
**Scenario:** Hai due branch e vuoi confrontare le differenze di struttura.
258+
259+
```bash
260+
# Branch main
261+
git checkout main
262+
deepbase . --light -o context-main.md
263+
264+
# Branch feature
265+
git checkout feature-branch
266+
deepbase . --light -o context-feature.md
267+
268+
# Ora confronta i due file con diff o LLM
269+
diff context-main.md context-feature.md
270+
```
271+
272+
---
273+
274+
## 📁 Esempio 10: Progetto complesso multi-linguaggio
275+
276+
**Struttura:**
277+
```
278+
fullstack-app/
279+
├── backend/
280+
│ ├── src/
281+
│ │ ├── controllers/ # Python
282+
│ │ ├── models/ # Python
283+
│ │ └── main.py
284+
│ ├── migrations/ # SQL
285+
│ └── requirements.txt
286+
├── frontend/
287+
│ ├── src/
288+
│ │ ├── components/ # React/TS
289+
│ │ └── pages/
290+
│ └── package.json
291+
├── mobile/
292+
│ └── ios/ # <- da ignorare (build)
293+
├── shared/
294+
│ └── types.ts # <- focus qui (tipi condivisi)
295+
└── README.md
296+
```
297+
298+
**`.deepbase.toml`:**
299+
```toml
300+
ignore_dirs = [
301+
"backend/__pycache__",
302+
"frontend/node_modules",
303+
"mobile/ios",
304+
"mobile/android",
305+
"mobile/build"
306+
]
307+
308+
ignore_files = [
309+
"frontend/package-lock.json",
310+
"backend/*.pyc"
311+
]
312+
```
313+
314+
**Comando:**
315+
```bash
316+
deepbase . --light --focus "backend/src/main.py" --focus "shared/types.ts"
317+
```
318+
319+
---
320+
321+
## 💡 Tips & Tricks
322+
323+
### Verifica cosa verrà incluso
324+
325+
```bash
326+
# Genera solo struttura (veloce, per controllare)
327+
deepbase . > structure.md
328+
329+
# Poi aggiungi --light o --all quando sei soddisfatto
330+
```
331+
332+
### Stima token prima di generare
333+
334+
Guarda la stima nell'output dell'albero:
335+
```
336+
📁 my-project/ (245.6 KB | ~61.4k t)
337+
```
338+
339+
Se troppo alto, aumenta le esclusioni nel TOML.
340+
341+
### Ignorare file già nel contesto
342+
343+
DeepBase ignora automaticamente l'output file (`llm_context.md` di default) per evitare loop.
344+
345+
### Usa con pipe
346+
347+
```bash
348+
deepbase . --light | head -n 100 # prime 100 righe
349+
deepbase . --light | wc -l # conta righe
350+
```
351+
352+
---
353+
354+
Hai un caso d'uso particolare? [Apri una issue](https://github.com/follen99/deepbase/issues) per aggiungerlo agli esempi!

0 commit comments

Comments
 (0)