chore: archive v2.2 Sales Loop milestone

- ROADMAP.md: collassato a milestone summary, v2.2 in <details>
- PROJECT.md: full evolution review — What This Is, Validated v2.2, Active v2.3, Key Decisions aggiornate
- MILESTONES.md: entry v2.2 + entry v2.1 aggiunti
- milestones/v2.2-ROADMAP.md: archivio completo fasi 18-22
- milestones/v2.2-REQUIREMENTS.md: archivio requirements con outcomes

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-06-20 18:31:08 +02:00
parent cbfd959c36
commit fb1ef95c96
5 changed files with 329 additions and 268 deletions
+73
View File
@@ -0,0 +1,73 @@
# Requirements Archive — v2.2 Sales Loop
**Archived:** 2026-06-20
**Milestone:** v2.2 Sales Loop (Phases 1822)
**Outcome:** 10/11 requirements Complete · 1 deferred (PUB-03 email Resend)
---
## v2.2 — Sales Loop Requirements
### Cleanup & Consolidamento (Phase 18 / R1)
| ID | Requirement | Outcome |
|----|-------------|---------|
| CLEAN-01 | Pagina Forecast + voce sidebar rimossa | ✅ Complete — Phase 18-01 |
| CLEAN-02 | Quote builder manuale rimosso | ✅ Complete — Phase 18-01 |
| CLEAN-03 | Analytics fusa nella Dashboard, rotta duplicata eliminata | ✅ Complete — Phase 18-02 |
| CLEAN-04 | Fasi v2.1 residue archiviate nel planning | ✅ Complete — Phase 18-03 |
### Pipeline CRM Kanban (Phase 19 / R2)
| ID | Requirement | Outcome |
|----|-------------|---------|
| PIPE-01 | Board Kanban Pipedrive-style con drag-drop tra stage | ✅ Complete — Phase 19-01 |
| PIPE-02 | Vinto/Perso come cambio-colonna manuale | ✅ Complete — Phase 19-01 |
### Knowledge Base Cliente (Phase 20 / R3)
| ID | Requirement | Outcome |
|----|-------------|---------|
| KB-01 | Schema additivo `client_transcripts` con migration a prod | ✅ Complete — Phase 20-01/02 |
| KB-02 | UI incolla/elenca transcript nel dettaglio lead | ✅ Complete — Phase 20-03 |
### Agente AI — Generazione Preventivo (Phase 21 / R4)
| ID | Requirement | Outcome |
|----|-------------|---------|
| AI-01 | Admin seleziona cliente+offerta; AI legge transcript+offerta → bozza | ✅ Complete — Phase 21-01 |
| AI-02 | Admin rivede ed edita la bozza prima di pubblicare | ✅ Complete — Phase 21-01 |
### Pagina Pubblica Preventivo (Phase 22 / R5)
| ID | Requirement | Outcome |
|----|-------------|---------|
| PUB-01 | Pagina pubblica `/preventivo/[slug]` — deck 20+ slide | ✅ Complete — Phase 22-01 |
| PUB-02 | Cliente accetta/rifiuta; esito riflesso nel DB | ✅ Complete — Phase 22-01 |
| PUB-03 | Invio link via email Resend | ❌ Not implemented — deferred to v2.3 backlog |
---
## Backlog Portato Avanti
| ID | Requirement | Stato |
|----|-------------|-------|
| PUB-03 | Email Resend invio link preventivo | Deferred → v2.3 |
| PROP-03 | Stripe Payment Link su offerta | Backlog (post-R5 originale) |
| PROP-04 | Auto-provisioning al "Vinto" | Backlog (post-R5 originale) |
| AUTH-OTP-01 | Accesso cliente via OTP email | Design pronto, deferred |
| OFFER-12 | Import CSV/Notion one-shot | Rimandato 2026-06-14 |
---
## Requirements Non-v2.2 (Storico)
*I requirements di v1.0 e v2.0/v2.1 sono archiviati in:*
- `.planning/milestones/v1.0-REQUIREMENTS.md`
- `.planning/milestones/v2.0-REQUIREMENTS.md`
*I requirements congelati/abbandonati di v2.1 (PROJ-06..10, DASH-11, PROP-01..05) sono documentati in `.planning/milestones/v2.2-ROADMAP.md` sezione "Milestone Summary".*
---
*Archived: 2026-06-20 at v2.2 milestone close*
+144
View File
@@ -0,0 +1,144 @@
# Milestone v2.2: Sales Loop
**Status:** ✅ SHIPPED 2026-06-20
**Phases:** 1822 (R1R5)
**Total Plans:** 9 plans · 27 commits · 87 files · +7.349/-842 righe
**Timeline:** 2026-06-19 → 2026-06-20
## Overview
v2.2 chiude il **loop di vendita end-to-end**: dopo che l'utente ha articolato il flusso commerciale reale (piano `.claude/plans/glittery-sprouting-pudding.md`), le fasi residue v2.1 (13/15/16/17) sono state congelate/abbandonate e sostituite da 5 fasi nuove. Il flusso: lead in pipeline Kanban → transcript datati delle call → agente AI genera preventivo → deck pubblico 20+ slide → accept/reject manuale nel CRM.
## Phases
### Phase 18: Cleanup & Consolidamento (R1)
**Goal**: Sgomberare il campo dai doppioni e dal peso morto prima di costruire il loop di vendita.
**Mode:** ui (solo rimozioni/rotte, nessun drop di tabelle)
**Requirements**: CLEAN-01, CLEAN-02, CLEAN-03, CLEAN-04
**Plans**: 3 plans
Plans:
- [x] 18-01-PLAN.md — Rimozione Forecast + Quote Builder manuale (CLEAN-01, CLEAN-02)
- [x] 18-02-PLAN.md — Fusione analytics nella Dashboard, eliminazione rotta /admin/analytics (CLEAN-03)
- [x] 18-03-PLAN.md — Verifica CLEAN-04 planning docs + build check + checkpoint visuale
**Status**: ✅ Complete (2026-06-19)
**What was built:**
- Rimossa pagina `/admin/forecast` + voce sidebar
- Rimosso quote builder manuale `/admin/quotes/new` + SendQuoteModal rami irraggiungibili
- Statistiche annuali `/admin/analytics` fuse nella Dashboard `/admin` (CLEAN-03); rotta duplicata eliminata
- Fasi v2.1 residue (13/15/16/17) marcate cancellate/congelate nel planning
---
### Phase 19: Pipeline CRM Kanban (R2)
**Goal**: I lead si gestiscono in una board Kanban stile Pipedrive con drag-drop tra gli stage.
**Mode:** ui
**Depends on**: Phase 14 (CRM lead esistente). Riusa `@dnd-kit`.
**Requirements**: PIPE-01, PIPE-02
**Plans**: 1 plan
Plans:
- [x] 19-01-PLAN.md — LeadsKanbanBoard + LeadsViewToggle + page wiring (PIPE-01, PIPE-02)
**Status**: ✅ Complete (2026-06-19)
**What was built:**
- Board Kanban 6 colonne (contacted → qualified → proposal_sent → negotiating → won/lost) con drag-drop persistente
- Toggle Lista/Kanban con ricerca integrata
- Spostare un lead su "Vinto"/"Perso" aggiorna `leads.status` → registra l'esito manuale
---
### Phase 20: Knowledge Base Cliente (R3)
**Goal**: Memorizzare i transcript datati delle call e mostrarli nel profilo lead.
**Mode:** schema + ui
**Depends on**: Phase 14 (lead). Migration a prod via SSH.
**Requirements**: KB-01, KB-02
**Plans**: 3 plans
Plans:
- [x] 20-01-PLAN.md — Migration SQL `0009_client_transcripts` (BLOCKING prod checkpoint)
- [x] 20-02-PLAN.md — Schema Drizzle `clientTranscripts` + `getTranscripts`/`addTranscript`/`deleteTranscript`
- [x] 20-03-PLAN.md — `TranscriptModal` + sezione "Transcript Call" in `LeadDetail` + wiring `page.tsx`
**Status**: ✅ Complete (2026-06-20)
**What was built:**
- Tabella `client_transcripts` (lead_id, client_id, content, call_date, title, created_at) applicata a prod via SSH tunnel
- Data layer completo con Drizzle ORM + server actions
- UI: sezione "Transcript Call" nel dettaglio lead con modal per incollare, lista espandibile/collassabile, elimina
---
### Phase 21: Agente AI — Generazione Preventivo (R4)
**Goal**: Admin seleziona cliente+offerta; AI legge transcript+offerta → genera bozza preventivo.
**Mode:** ai + ui
**Depends on**: Phase 20 (transcript) + Phase 11/12 (offerte)
**Requirements**: AI-01, AI-02
**Plans**: 1 plan (21+22 eseguiti insieme per coerenza architetturale)
Plans:
- [x] 21-01-PLAN.md — Agente AI + form builder admin + migration 0010 proposals
**Status**: ✅ Complete (2026-06-20)
**What was built:**
- `@anthropic-ai/sdk@0.105.0` + `ANTHROPIC_API_KEY` in Coolify
- `src/lib/proposal/schema.ts` — Zod schema `ProposalContent` (20+ sezioni strutturate)
- `src/lib/proposal/agent.ts``generateProposalContent()` → Claude Opus 4.8, JSON validato Zod
- `src/lib/proposal/assemble.ts``assembleProposal()`: fonde AI + offerta DB + profilo consulente
- `src/lib/proposal/profile.ts``CONSULTANT_PROFILE` (bio, fatti, testimonianze, legal, nextSteps)
- `proposals` table in DB: id, slug, lead_id, client_id, offer_macro_id, content jsonb, state, accepted_at
- Admin pages: lista preventivi, form genera (con pre-fill `?lead_id=X`), review bozza, pubblica/elimina
---
### Phase 22: Pagina Pubblica Preventivo + Email (R5)
**Goal**: Pubblicare la proposta come deck pubblico `/preventivo/[slug]` con accept/reject.
**Mode:** ui
**Depends on**: Phase 21 (proposals table + content)
**Requirements**: PUB-01, PUB-02 ✅ · PUB-03 ❌ deferred
**Plans**: 1 plan
Plans:
- [x] 22-01-PLAN.md — ProposalDeck + public page + accept/reject actions
**Status**: ✅ Complete (2026-06-20) · PUB-03 deferred
**What was built:**
- `src/app/preventivo/[slug]/page.tsx` — server component pubblico con gestione stati
- `src/app/preventivo/[slug]/actions.ts``acceptProposal` + `rejectProposal` con `accepted_at` immutabile
- `ProposalDeck.tsx` — deck client component: `h-screen overflow-hidden`, keyboard nav, dots
- 20 componenti slide: Cover, Vision, Index, ChapterDivider ×5, Strategist, Facts, Testimonials, ProblemNode ×N, SynthesisDiagram, SolutionNode ×N, SolutionSynthesis, Scope, Deliverables, Timeline, Pricing, StagesRecap, ComparisonMatrix, NextSteps, Accept, Closing
- **PUB-03 (email Resend) NOT implemented** — link va condiviso manualmente; deferred a v2.3 backlog
---
## Milestone Summary
**Key Decisions:**
- Sales Loop come north-star v2.2: abbandonato workspace post-vendita (Phase 13), revenue stats (Phase 15), Proposal AI v2.1 (16/17) — riscopate come 21+22 con transcript
- AI model: `claude-opus-4-8` per qualità copywriting strategico (~$0.44/preventivo)
- Output AI: JSON strutturato validato Zod → template fisso → coerenza visiva garantita
- `proposals.content` come JSONB snapshot (non riferimento a entità live) → immutabile
- Email Resend (PUB-03) deferred: scope minimo funziona, priorità al loop core
**Known Gaps at Close:**
- PUB-03: invio email Resend non implementato (1 item, vedi backlog v2.3)
- `profile.ts`: testimonianze placeholder, da aggiornare con dati reali
**Technical Debt:**
- Tabelle legacy `service_catalog`/`offer_services`/`offer_micro_services` ancora presenti (deadweight, cleanup futuro)
- `createService`/`serviceSchema` dead code in `catalog/actions.ts`
- `drizzle-kit generate` rotto da Phase 8 (meta snapshots out of sync) — SQL scritto a mano
---
*Per lo stato corrente del progetto, vedi `.planning/ROADMAP.md`*