OmniRoute/docs/i18n/it/CONTRIBUTING.md

13 KiB

Contributing to OmniRoute (Italiano)

🌐 Languages: 🇺🇸 English · 🇪🇸 es · 🇫🇷 fr · 🇩🇪 de · 🇮🇹 it · 🇷🇺 ru · 🇨🇳 zh-CN · 🇯🇵 ja · 🇰🇷 ko · 🇸🇦 ar · 🇮🇳 hi · 🇮🇳 in · 🇹🇭 th · 🇻🇳 vi · 🇮🇩 id · 🇲🇾 ms · 🇳🇱 nl · 🇵🇱 pl · 🇸🇪 sv · 🇳🇴 no · 🇩🇰 da · 🇫🇮 fi · 🇵🇹 pt · 🇷🇴 ro · 🇭🇺 hu · 🇧🇬 bg · 🇸🇰 sk · 🇺🇦 uk-UA · 🇮🇱 he · 🇵🇭 phi · 🇧🇷 pt-BR · 🇨🇿 cs · 🇹🇷 tr


Grazie per il tuo interesse nel contribuire! Questa guida copre tutto ciò di cui hai bisogno per iniziare.---

Development Setup

Prerequisites

-Node.js>= 18 < 24 (consigliato: 22 LTS) -npm10+ -Git### Clone & Install

git clone https://github.com/diegosouzapw/OmniRoute.git
cd OmniRoute
npm install

Environment Variables

# Create your .env from the template
cp .env.example .env

# Generate required secrets
echo "JWT_SECRET=$(openssl rand -base64 48)" >> .env
echo "API_KEY_SECRET=$(openssl rand -hex 32)" >> .env

Variabili chiave per lo sviluppo:

Variabile Sviluppo predefinito Descrizione
"PORTO" 20128 Porta del server
NEXT_PUBLIC_BASE_URL http://localhost:20128 URL di base per il frontend
JWT_SECRET (generare sopra) Segreto della firma JWT
PASSWORD_INIZIALE CAMBIAMI Prima password di accesso
APP_LOG_LEVEL "informazioni" Registra il livello di dettaglio ### Dashboard Settings

La dashboard fornisce interruttori dell'interfaccia utente per funzionalità che possono essere configurate anche tramite variabili di ambiente:

Impostazione della posizione Attiva/disattiva Descrizione
Impostazioni → Avanzate Modalità debug Abilita i log delle richieste di debug (UI)
Impostazioni → Generale Visibilità della barra laterale Mostra/nascondi le sezioni della barra laterale

Queste impostazioni vengono archiviate nel database e persistono dopo i riavvii, sovrascrivendo le impostazioni predefinite di env var quando impostate.### Running Locally

# Development mode (hot reload)
npm run dev

# Production build
npm run build
npm run start

# Common port configuration
PORT=20128 NEXT_PUBLIC_BASE_URL=http://localhost:20128 npm run dev

URL predefiniti:

-Dashboard: http://localhost:20128/dashboard -API: http://localhost:20128/v1---

Git Workflow

⚠️**MAI impegnarsi direttamente in main.**Utilizza sempre i rami delle funzionalità.```bash git checkout -b feat/your-feature-name

... make changes ...

git commit -m "feat: describe your change" git push -u origin feat/your-feature-name

Open a Pull Request on GitHub


### Branch Naming

| Prefisso | Scopo |
| ----------- | ------------------------ |
| `impresa/` | Nuove funzionalità |
| `aggiustare/` | Correzioni di bug |
| `refactoring/` | Ristrutturazione del codice |
| `documenti/` | Modifiche alla documentazione |
| `prova/` | Aggiunte/correzioni ai test |
| `lavoretto/` | Strumenti, CI, dipendenze |### Commit Messages

Segui [Commit convenzionali](https://www.conventionalcommits.org/):```
feat: add circuit breaker for provider calls
fix: resolve JWT secret validation edge case
docs: update SECURITY.md with PII protection
test: add observability unit tests
refactor(db): consolidate rate limit tables

Ambiti: db, sse, oauth, dashboard, api, cli, docker, ci, mcp, a2a, memory, skills.---

Running Tests

# All tests (unit + vitest + ecosystem + e2e)
npm run test:all

# Single test file (Node.js native test runner — most tests use this)
node --import tsx/esm --test tests/unit/your-file.test.mjs

# Vitest (MCP server, autoCombo, cache)
npm run test:vitest

# E2E tests (requires Playwright)
npm run test:e2e

# Protocol clients E2E (MCP transports, A2A)
npm run test:protocols:e2e

# Ecosystem compatibility tests
npm run test:ecosystem

# Coverage (60% min statements/lines/functions/branches)
npm run test:coverage
npm run coverage:report

# Lint + format check
npm run lint
npm run check

Note sulla copertura:

  • "npm run test:coverage" misura la copertura del codice sorgente per la suite di unit test principale, esclude "tests/" e include "open-sse/"
  • Le richieste pull devono mantenere il livello di copertura complessiva al60% o superioreper estratti conto, linee, funzioni e filiali
  • Se un PR modifica il codice di produzione in src/, open-sse/, electron/ o bin/, deve aggiungere o aggiornare test automatizzati nello stesso PR
  • npm run cover:report stampa il report dettagliato file per file dell'ultima esecuzione della copertura
  • npm run test:coverage:legacy preserva la metrica precedente per il confronto storico
  • Consulta docs/COVERAGE_PLAN.md per la roadmap di miglioramento graduale della copertura### Pull Request Requirements

Prima di aprire o unire un PR:

  • Esegui npm run test:unit
  • Esegui npm run test:coverage
  • Assicurarsi che il limite di copertura rimanga al**60%+**per tutte le metriche
  • Includere i file di test modificati o aggiunti nella descrizione PR quando il codice di produzione è cambiato
  • Controllare il risultato SonarQube sul PR quando i segreti del progetto sono configurati in CI

Stato attuale del test:122 file di test unitariche coprono:

  • Traduttori del fornitore e conversione del formato
  • Limitazione della velocità, interruttore automatico e resilienza
  • Cache semantica, idempotenza, monitoraggio dei progressi
  • Operazioni e schema del database (21 moduli DB)
  • Flussi e autenticazione OAuth
  • Convalida dell'endpoint API (Zod v4)
  • Strumenti server MCP e applicazione dell'ambito
  • Sistemi di memoria e abilità---

Code Style

-ESLint— Esegui npm run lint prima del commit -Più carino— Formattato automaticamente tramite lint-staged al commit (2 spazi, punto e virgola, virgolette doppie, larghezza 100 caratteri, virgole finali es5) -TypeScript— Tutto il codice src/ utilizza .ts/.tsx; open-sse/ utilizza .ts/.js; documento con TSDoc ("@param, @returns, @throws) -**No eval()**— ESLint applica no-eval, no-implied-eval, no-new-func` -Convalida Zod: utilizza gli schemi Zod v4 per tutta la convalida degli input API -Nome: File = camelCase/kebab-case, componenti = PascalCase, costanti = UPPER_SNAKE---

Project Structure

src/                        # TypeScript (.ts / .tsx)
├── app/                    # Next.js 16 App Router
│   ├── (dashboard)/        # Dashboard pages (23 sections)
│   ├── api/                # API routes (51 directories)
│   └── login/              # Auth pages (.tsx)
├── domain/                 # Policy engine (policyEngine, comboResolver, costRules, etc.)
├── lib/                    # Core business logic (.ts)
│   ├── a2a/                # Agent-to-Agent v0.3 protocol server
│   ├── acp/                # Agent Communication Protocol registry
│   ├── compliance/         # Compliance policy engine
│   ├── db/                 # SQLite database layer (21 modules + 16 migrations)
│   ├── memory/             # Persistent conversational memory
│   ├── oauth/              # OAuth providers, services, and utilities
│   ├── skills/             # Extensible skill framework
│   ├── usage/              # Usage tracking and cost calculation
│   └── localDb.ts          # Re-export layer only — never add logic here
├── middleware/              # Request middleware (promptInjectionGuard)
├── mitm/                   # MITM proxy (cert, DNS, target routing)
├── shared/
│   ├── components/         # React components (.tsx)
│   ├── constants/          # Provider definitions (60+), MCP scopes, routing strategies
│   ├── utils/              # Circuit breaker, sanitizer, auth helpers
│   └── validation/         # Zod v4 schemas
└── sse/                    # SSE proxy pipeline

open-sse/                   # @omniroute/open-sse workspace
├── executors/              # 14 provider-specific request executors
├── handlers/               # 11 request handlers (chat, responses, embeddings, images, etc.)
├── mcp-server/             # MCP server (25 tools, 3 transports, 10 scopes)
├── services/               # 36+ services (combo, autoCombo, rateLimitManager, etc.)
├── translator/             # Format translators (OpenAI ↔ Claude ↔ Gemini ↔ Responses ↔ Ollama)
├── transformer/            # Responses API transformer
└── utils/                  # 22 utility modules (stream, TLS, proxy, logging)

electron/                   # Electron desktop app (cross-platform)

tests/
├── unit/                   # Node.js test runner (122 test files)
├── integration/            # Integration tests
├── e2e/                    # Playwright tests
├── security/               # Security tests
├── translator/             # Translator-specific tests
└── load/                   # Load tests

docs/                       # Documentation
├── ARCHITECTURE.md         # System architecture
├── API_REFERENCE.md        # All endpoints
├── USER_GUIDE.md           # Provider setup, CLI integration
├── TROUBLESHOOTING.md      # Common issues
├── MCP-SERVER.md           # MCP server (25 tools)
├── A2A-SERVER.md           # A2A agent protocol
├── AUTO-COMBO.md           # Auto-combo engine
├── CLI-TOOLS.md            # CLI tools integration
├── COVERAGE_PLAN.md        # Test coverage improvement plan
├── openapi.yaml            # OpenAPI specification
└── adr/                    # Architecture Decision Records

Adding a New Provider

Step 1: Register Provider Constants

Aggiungi a src/shared/constants/provviders.ts — Convalidato da Zod al caricamento del modulo.### Step 2: Add Executor (if custom logic needed)

Crea un esecutore in "open-sse/executors/your-provider.ts" estendendo l'esecutore di base.### Step 3: Add Translator (if non-OpenAI format)

Crea traduttori di richiesta/risposta in open-sse/translator/.### Step 4: Add OAuth Config (if OAuth-based)

Aggiungi le credenziali OAuth in src/lib/oauth/constants/oauth.ts e il servizio in src/lib/oauth/services/.### Step 5: Register Models

Aggiungi le definizioni del modello in "open-sse/config/providerRegistry.ts".### Step 6: Add Tests

Scrivi i test unitari in tests/unit/ che coprano almeno:

  • Registrazione del fornitore
  • Traduzione richiesta/risposta
  • Gestione degli errori---

Pull Request Checklist

  • I test sono superati (npm test)
  • Passaggi di lint (npm run lint)
  • La compilazione riesce (npm run build)
  • [] Tipi TypeScript aggiunti per nuove funzioni e interfacce pubbliche
  • Nessun segreto codificato o valore di fallback
  • Tutti gli input convalidati con schemi Zod
  • [] CHANGELOG aggiornato (se la modifica è rivolta all'utente)
  • Documentazione aggiornata (se applicabile)---

Releasing

Le versioni vengono gestite tramite il flusso di lavoro "/generate-release". Quando viene creata una nuova versione GitHub, il pacchetto vienepubblicato automaticamente su npmtramite GitHub Actions.---

Getting Help

-Architettura: vedi docs/ARCHITECTURE.md -Riferimento API: vedi docs/API_REFERENCE.md -Problemi: github.com/diegosouzapw/OmniRoute/issues -ADR: vedere docs/adr/ per i record delle decisioni architettoniche