Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .claude/skills/gitnexus/gitnexus-cli/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ Run from the project root. This parses all source files, builds the knowledge gr
| `--force` | Force full re-index even if up to date |
| `--embeddings` | Enable embedding generation for semantic search (off by default) |

**When to run:** First time in a project, after major code changes, or when `gitnexus://repo/{name}/context` reports the index is stale.
**When to run:** First time in a project, after major code changes, or when `gitnexus://repo/{name}/context` reports the index is stale. In Claude Code, a PostToolUse hook runs `analyze` automatically after `git commit` and `git merge`, preserving embeddings if previously generated.

### status — Check index freshness

Expand Down
20 changes: 19 additions & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- gitnexus:start -->
# GitNexus — Code Intelligence

This project is indexed by GitNexus as **GitNexus** (1650 symbols, 4291 relationships, 125 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
This project is indexed by GitNexus as **GitNexus** (1638 symbols, 4305 relationships, 123 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.

> If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first.

Expand Down Expand Up @@ -69,6 +69,24 @@ Before completing any code modification task, verify:
3. `gitnexus_detect_changes()` confirms changes match expected scope
4. All d=1 (WILL BREAK) dependents were updated

## Keeping the Index Fresh

After committing code changes, the GitNexus index becomes stale. Re-run analyze to update it:

```bash
npx gitnexus analyze
```

If the index previously included embeddings, preserve them by adding `--embeddings`:

```bash
npx gitnexus analyze --embeddings
```

To check whether embeddings exist, inspect `.gitnexus/meta.json` — the `stats.embeddings` field shows the count (0 means no embeddings). **Running analyze without `--embeddings` will delete any previously generated embeddings.**

> Claude Code users: A PostToolUse hook handles this automatically after `git commit` and `git merge`.

## CLI

- Re-index: `npx gitnexus analyze`
Expand Down
20 changes: 19 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<!-- gitnexus:start -->
# GitNexus — Code Intelligence

This project is indexed by GitNexus as **GitNexus** (1650 symbols, 4291 relationships, 125 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.
This project is indexed by GitNexus as **GitNexus** (1638 symbols, 4305 relationships, 123 execution flows). Use the GitNexus MCP tools to understand code, assess impact, and navigate safely.

> If any GitNexus tool warns the index is stale, run `npx gitnexus analyze` in terminal first.

Expand Down Expand Up @@ -69,6 +69,24 @@ Before completing any code modification task, verify:
3. `gitnexus_detect_changes()` confirms changes match expected scope
4. All d=1 (WILL BREAK) dependents were updated

## Keeping the Index Fresh

After committing code changes, the GitNexus index becomes stale. Re-run analyze to update it:

```bash
npx gitnexus analyze
```

If the index previously included embeddings, preserve them by adding `--embeddings`:

```bash
npx gitnexus analyze --embeddings
```

To check whether embeddings exist, inspect `.gitnexus/meta.json` — the `stats.embeddings` field shows the count (0 means no embeddings). **Running analyze without `--embeddings` will delete any previously generated embeddings.**

> Claude Code users: A PostToolUse hook handles this automatically after `git commit` and `git merge`.

## CLI

- Re-index: `npx gitnexus analyze`
Expand Down
189 changes: 189 additions & 0 deletions gitnexus-web/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,189 @@
# GitNexus Web UI

Web frontend per GitNexus — visualizzazione interattiva del knowledge graph di un codebase con grafo Sigma.js, chat AI, e code navigation.

## Prerequisiti

- Node.js ≥ 18
- GitNexus CLI installato (`npm i -g gitnexus` oppure symlink al repo locale)
- Almeno un repository indicizzato con `npx gitnexus analyze`

## Quick Start

```bash
# 1. Installa le dipendenze
npm install

# 2. Avvia il backend GitNexus (in un terminale separato, dalla directory di un repo indicizzato)
cd ~/workproj/EPAGHE
npx gitnexus serve
# → Backend su http://localhost:4747

# 3. Avvia il dev server frontend
cd ~/private/GitNexus/gitnexus-web
npm run dev
# → Frontend su http://localhost:5173
```

Apri http://localhost:5173 nel browser. La UI si connette automaticamente al backend su `localhost:4747`.

## Modalità di caricamento

La UI supporta 3 modi per caricare un codebase:

| Modalità | Come | Quando usarla |
|----------|------|---------------|
| **Server locale** | Connessione a `gitnexus serve` | Repo già indicizzato localmente (consigliato) |
| **Upload ZIP** | Drag & drop di un `.zip` | Analisi in-browser senza backend |
| **Git clone** | URL di un repo GitHub | Clone + analisi in-browser via isomorphic-git |

### Connessione al server locale

1. Avvia `npx gitnexus serve` nella directory del repo (porta default: 4747)
2. Nella UI, inserisci `http://localhost:4747` nel campo server della pagina iniziale
3. Se il backend ha più repository indicizzati, seleziona quello desiderato dal dropdown

**Shortcut via URL**: `http://localhost:5173?server=http://localhost:4747` — si connette automaticamente.

## Script NPM

| Comando | Descrizione |
|---------|-------------|
| `npm run dev` | Dev server Vite con HMR |
| `npm run build` | Build di produzione (`tsc` + `vite build`) |
| `npm run preview` | Preview della build di produzione |

## Debug in VS Code

La cartella `.vscode/` contiene le configurazioni pronte. Apri il progetto in VS Code e vai su **Run and Debug** (Ctrl+Shift+D / Cmd+Shift+D):

| Configurazione | Descrizione |
|---------------|-------------|
| **Debug FE (Chrome)** | Avvia Vite + apre Chrome con debugger. Breakpoint nei `.tsx` funzionano. |
| **Debug FE (Edge)** | Come sopra, con Microsoft Edge |
| **Attach to Chrome (già avviato)** | Si attacca a Chrome lanciato con `--remote-debugging-port=9222` |
| **Full Stack (FE + Backend)** | Avvia prima `gitnexus serve` (backend), poi Vite + Chrome debug |

### Avvio rapido debug

```
F5 con "Debug FE (Chrome)" selezionato
```

Vite parte in automatico (task `vite:dev`), Chrome si apre con i devtools connessi. I breakpoint nei sorgenti TypeScript/React funzionano direttamente.

### Debug full-stack

Seleziona la configurazione **"Full Stack (FE + Backend GitNexus)"** — avvia sia il backend (`gitnexus serve` sulla porta 4747) che il frontend con debug Chrome.

> **Nota**: la task `gitnexus:serve` esegue `npx gitnexus serve` nella directory `~/workproj/EPAGHE`. Modifica il `cwd` in `.vscode/tasks.json` se il repo è altrove.

### Attach a Chrome esistente

Se preferisci avviare Chrome manualmente con il debugging remoto:

```bash
/Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome \
--remote-debugging-port=9222 \
http://localhost:5173
```

Poi usa la configurazione **"Attach to Chrome (già avviato)"**.

## Architettura

```
src/
├── main.tsx # Entry point React
├── App.tsx # Root component, routing tra viste
├── components/ # Componenti UI
│ ├── DropZone.tsx # Pagina iniziale (upload/clone/connect)
│ ├── GraphCanvas.tsx # Visualizzazione grafo (Sigma.js + graphology)
│ ├── Header.tsx # Barra superiore con search e repo switcher
│ ├── RightPanel.tsx # Pannello destro (code viewer + chat AI)
│ ├── FileTreePanel.tsx # Albero file navigabile
│ ├── CodeReferencesPanel.tsx # Riferimenti al codice dal grafo
│ ├── SettingsPanel.tsx # Configurazione LLM (OpenAI/Anthropic/Ollama)
│ ├── StatusBar.tsx # Barra di stato in basso
│ ├── ProcessesPanel.tsx # Visualizzazione execution flows
│ ├── ProcessFlowModal.tsx # Dettaglio flusso con diagramma Mermaid
│ └── QueryFAB.tsx # Floating action button per query
├── hooks/
│ ├── useAppState.tsx # State globale dell'app (React Context)
│ ├── useBackend.ts # Connessione al backend GitNexus
│ ├── useSettings.ts # Settings LLM
│ └── useSigma.ts # Hook per Sigma.js graph rendering
├── services/
│ ├── backend.ts # Client HTTP per API backend GitNexus
│ ├── server-connection.ts # Connessione e download grafo dal server
│ ├── git-clone.ts # Clone in-browser via isomorphic-git
│ └── zip.ts # Estrazione ZIP in-browser
├── core/
│ ├── graph/ # Struttura dati grafo (KnowledgeGraph)
│ ├── kuzu/ # KuzuDB WASM (query Cypher in-browser)
│ ├── ingestion/ # Pipeline analisi in-browser
│ ├── tree-sitter/ # Parsing AST in-browser
│ ├── llm/ # Integrazione LLM (Anthropic/OpenAI/Ollama)
│ ├── embeddings/ # Embeddings in-browser (WebGPU/WASM)
│ └── search/ # Ricerca semantica
├── lib/
│ ├── constants.ts # Costanti app
│ ├── graph-adapter.ts # Adattatore graphology ↔ KnowledgeGraph
│ ├── mermaid-generator.ts # Generazione diagrammi Mermaid
│ └── utils.ts # Utility generiche
├── config/
│ ├── supported-languages.ts # Linguaggi supportati dal parser
│ └── ignore-service.ts # Pattern di file da ignorare
├── types/ # Type definitions
├── vendor/leiden/ # Algoritmo Leiden per community detection
└── workers/
└── ingestion.worker.ts # Web Worker per analisi in background
```

## API Backend

Quando connessa al server locale (`gitnexus serve`), la UI usa queste API:

| Endpoint | Metodo | Descrizione |
|----------|--------|-------------|
| `/api/repos` | GET | Lista repository indicizzati |
| `/api/repo?repo=NAME` | GET | Info su un repository |
| `/api/graph?repo=NAME` | GET | Grafo completo (nodi + relazioni) |
| `/api/file?repo=NAME&path=PATH` | GET | Contenuto sorgente di un file |
| `/api/processes?repo=NAME` | GET | Lista execution flows |
| `/api/process?repo=NAME&name=NAME` | GET | Dettaglio di un execution flow |
| `/api/clusters?repo=NAME` | GET | Lista functional area clusters |
| `/api/cluster?repo=NAME&name=NAME` | GET | Dettaglio di un cluster |
| `/api/query` | POST | Query Cypher (`{cypher, repo}`) |
| `/api/search` | POST | Ricerca semantica (`{query, repo, limit}`) |

## Stack tecnologico

- **Framework**: React 18 + TypeScript
- **Build**: Vite 5
- **Styling**: Tailwind CSS 4
- **Grafo**: Sigma.js 3 + graphology
- **Database**: KuzuDB WASM (query Cypher in-browser)
- **Parsing**: tree-sitter WASM (AST in-browser)
- **LLM**: LangChain (Anthropic, OpenAI, Google GenAI, Ollama)
- **Embeddings**: HuggingFace Transformers.js (WebGPU/WASM)
- **Diagrammi**: Mermaid
- **Git in-browser**: isomorphic-git
- **Deploy**: Vercel (con CORS proxy per git clone)

## Deploy su Vercel

Il progetto è configurato per Vercel:

- `vercel.json` — header Cross-Origin Isolation (necessari per SharedArrayBuffer / KuzuDB WASM)
- `api/proxy.ts` — CORS proxy serverless per isomorphic-git (solo URL GitHub)

```bash
npx vercel
```

## Variabili d'ambiente

Nessuna variabile d'ambiente richiesta per lo sviluppo locale. Il backend URL di default è `http://localhost:4747` (configurabile dalla UI).

Per il deploy Vercel, le API key LLM vengono inserite dall'utente nel pannello Settings della UI (salvate in localStorage, mai inviate al server).
7 changes: 7 additions & 0 deletions gitnexus-web/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions gitnexus-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,17 @@
"@langchain/openai": "^1.2.2",
"@sigma/edge-curve": "^3.1.0",
"@tailwindcss/vite": "^4.1.18",
"aws4fetch": "^1.0.20",
"axios": "^1.13.2",
"buffer": "^6.0.3",
"comlink": "^4.4.2",
"d3": "^7.9.0",
"graphology": "^0.26.0",
"graphology-indices": "^0.17.0",
"graphology-utils": "^2.3.0",
"mnemonist": "^0.39.0",
"pandemonium": "^2.4.0",
"graphology-layout-force": "^0.2.4",
"graphology-layout-forceatlas2": "^0.10.1",
"graphology-layout-noverlap": "^0.4.2",
"graphology-utils": "^2.3.0",
"isomorphic-git": "^1.36.1",
"jszip": "^3.10.1",
"kuzu-wasm": "^0.11.1",
Expand All @@ -39,6 +38,8 @@
"lucide-react": "^0.562.0",
"mermaid": "^11.12.2",
"minisearch": "^7.2.0",
"mnemonist": "^0.39.0",
"pandemonium": "^2.4.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-markdown": "^10.1.0",
Expand Down
Loading