# Prompt Zero: OpenRouter API Key Monitor - Project Kickoff ## 🎯 Missione Sviluppare **OpenRouter API Key Monitor**, un'applicazione web multi-utente per monitorare l'utilizzo delle API key della piattaforma OpenRouter. **Repository:** `/home/google/Sources/LucaSacchiNet/openrouter-watcher` **PRD:** `/home/google/Sources/LucaSacchiNet/openrouter-watcher/prd.md` --- ## πŸ“Š Stato Attuale - βœ… **PRD Completo**: Requisiti funzionali e non funzionali definiti - βœ… **Team Configurato**: 3 agenti specializzati pronti - ❌ **Nessun Codice**: Progetto da zero - ❌ **Nessuna Specifica Tecnica**: Da creare --- ## πŸ‘₯ Team di Sviluppo | Agente | Ruolo | File Config | |--------|-------|-------------| | `@spec-architect` | Definisce specifiche e architettura | `.opencode/agents/spec-architect.md` | | `@tdd-developer` | Implementazione TDD | `.opencode/agents/tdd-developer.md` | | `@git-manager` | Gestione commit Git | `.opencode/agents/git-manager.md` | --- ## πŸ”„ Workflow Obbligatorio ``` β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β” β”‚ FASE 1: SPECIFICA β”‚ β”‚ @spec-architect β”‚ β”‚ └── Legge PRD β†’ Crea architecture.md, kanban.md β”‚ β”‚ β”‚ β”‚ ↓ β”‚ β”‚ β”‚ β”‚ FASE 2: IMPLEMENTAZIONE β”‚ β”‚ @tdd-developer β”‚ β”‚ └── RED β†’ GREEN β†’ REFACTOR per ogni task β”‚ β”‚ β”‚ β”‚ ↓ β”‚ β”‚ β”‚ β”‚ FASE 3: COMMIT β”‚ β”‚ @git-manager β”‚ β”‚ └── Commit atomico + Conventional Commits β”‚ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜ ``` --- ## πŸš€ Task Iniziale: Fase 1 - Specifica **AGENTE:** `@spec-architect` **OBIETTIVO:** Analizzare il PRD e creare le specifiche tecniche dettagliate. ### Azioni Richieste 1. **Leggere** `/home/google/Sources/LucaSacchiNet/openrouter-watcher/prd.md` 2. **Creare** la struttura di output: ``` /home/google/Sources/LucaSacchiNet/openrouter-watcher/export/ β”œβ”€β”€ prd.md # Requisiti prodotti (estratto/dettaglio) β”œβ”€β”€ architecture.md # Architettura sistema β”œβ”€β”€ kanban.md # Task breakdown └── progress.md # Tracciamento progresso ``` 3. **Produrre** `architecture.md` con: - Stack tecnologico dettagliato (Python 3.11+, FastAPI, SQLite, SQLAlchemy, JWT) - Struttura cartelle progetto - Diagrammi flusso dati - Schema database completo (DDL) - Interfacce API (OpenAPI specs) - Sicurezza (cifratura, autenticazione) 4. **Produrre** `kanban.md` con: - Task breakdown per Fase 1 (MVP) - Stima complessitΓ  - Dipendenze tra task - Regola "little often": task < 2 ore 5. **Inizializzare** `progress.md` con: - Feature corrente: "Fase 1 - MVP" - Stato: "πŸ”΄ Pianificazione" - Percentuale: 0% ### Criteri di Accettazione - [ ] Architecture.md completo con tutte le sezioni - [ ] Kanban.md con task pronti per @tdd-developer - [ ] Progress.md inizializzato - [ ] Tutti i path usano `/home/google/Sources/LucaSacchiNet/openrouter-watcher/` --- ## πŸ“‹ Requisiti Chiave (Dal PRD) ### FunzionalitΓ  MVP (Fase 1) 1. **Autenticazione Utenti** - Registrazione/login multi-utente - JWT-based authentication - Password hash (bcrypt) 2. **Gestione API Key** - CRUD API key OpenRouter - Cifratura AES-256 in database - Validazione key con OpenRouter API 3. **Dashboard** - Statistiche utilizzo - Grafici temporali - Costi e richieste 4. **API Pubblica** - Endpoint autenticati (Bearer token) - Solo lettura dati - Rate limiting ### Stack Tecnologico - **Backend:** Python 3.11+, FastAPI - **Database:** SQLite + SQLAlchemy - **Frontend:** HTML + HTMX (semplice) - **Auth:** JWT + bcrypt - **Task Background:** APScheduler --- ## πŸ›‘οΈ Vincoli e Best Practices ### Sicurezza (Critico) - API key sempre cifrate (AES-256) - Password hash con bcrypt - SQL injection prevention - XSS prevention - CSRF protection - Rate limiting ### QualitΓ  - Test coverage β‰₯ 90% - TDD obbligatorio - Conventional commits - Commit atomici ### Organizzazione - Task "little often" (< 2 ore) - Documentazione in `/export/` - Bug complessi in `/docs/bug_ledger.md` --- ## πŸ“ Struttura Progetto Attesa ``` /home/google/Sources/LucaSacchiNet/openrouter-watcher/ β”œβ”€β”€ prd.md # Questo PRD β”œβ”€β”€ prompt/ β”‚ └── prompt-zero.md # Questo file β”œβ”€β”€ .opencode/ β”‚ β”œβ”€β”€ agents/ # Configurazioni agenti β”‚ └── skills/ # Skill condivise β”œβ”€β”€ export/ # Output spec-driven (da creare) β”‚ β”œβ”€β”€ prd.md β”‚ β”œβ”€β”€ architecture.md β”‚ β”œβ”€β”€ kanban.md β”‚ └── progress.md β”œβ”€β”€ docs/ # Documentazione (da creare) β”‚ β”œβ”€β”€ bug_ledger.md β”‚ └── architecture.md β”œβ”€β”€ src/ # Codice sorgente (da creare) β”‚ └── openrouter_monitor/ β”‚ β”œβ”€β”€ __init__.py β”‚ β”œβ”€β”€ main.py β”‚ β”œβ”€β”€ config.py β”‚ β”œβ”€β”€ database.py β”‚ β”œβ”€β”€ models/ β”‚ β”œβ”€β”€ routers/ β”‚ β”œβ”€β”€ services/ β”‚ └── utils/ β”œβ”€β”€ tests/ # Test suite (da creare) β”‚ β”œβ”€β”€ unit/ β”‚ β”œβ”€β”€ integration/ β”‚ └── conftest.py β”œβ”€β”€ requirements.txt └── README.md ``` --- ## βœ… Checklist Pre-Sviluppo - [ ] @spec-architect ha letto questo prompt - [ ] Cartella `export/` creata - [ ] `architecture.md` creato con schema DB - [ ] `kanban.md` creato con task Fase 1 - [ ] `progress.md` inizializzato --- ## 🎬 Prossima Azione **@spec-architect**: Inizia analizzando il PRD in `prd.md` e crea le specifiche tecniche in `export/`. **NON iniziare l'implementazione** finchΓ© le specifiche non sono approvate. --- ## πŸ“ž Note per il Team - **Domande sul PRD?** Leggi prima `prd.md` completamente - **AmbiguitΓ ?** Chiedi prima di procedere - **Vincoli tecnici?** Documentali in `architecture.md` - **Task troppo grandi?** Spezza in task piΓΉ piccoli --- **Data Creazione:** 2025-04-07 **Versione:** 1.0 **Stato:** Pronto per kickoff