Commit Graph

32 Commits

Author SHA1 Message Date
Michele
14588eaa94 docs(02-02): complete per-item regeneration + summary counter plan
Tasks completed: 2/2
- PostCard regen button with inline form, topic override, badge
- OutputReview summary counter with regenerated/edited tracking

SUMMARY: .planning/phases/02-prompt-control-output-review/02-02-SUMMARY.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:53:43 +01:00
Michele
ad2483d48d feat(02-02): OutputReview summary counter with regenerated/edited tracking
- Add regeneratedSlots Set to track regenerated post indices
- Add summary counter showing: N post, X generati, Y rigenerati, Z modificati
- Counter updates in real-time after each regeneration or inline edit
- Pass isRegenerated prop to PostCard for visual badge
- Update info box to mention regen feature with RefreshCw icon
- Use JSON.stringify comparison for manual edit detection

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:03:11 +01:00
Michele
3488023142 feat(02-02): PostCard regen button with inline form, topic override, and regenerated badge
- Add handleRegen function with topic/notes override support
- Add inline popover form with optional topic and notes fields
- Add isRegenerated prop with amber RefreshCw badge for regenerated posts
- Regen button positioned in card header next to expand/collapse chevron
- Form appears below header with Rigenera/Annulla actions

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 21:01:47 +01:00
Michele
36fa50173f docs(02-01): complete prompt CRUD + prompt editor plan
Tasks completed: 2/2
- Backend prompts router with 4 CRUD endpoints
- Frontend Prompt Editor page with types, hooks, route, sidebar

SUMMARY: .planning/phases/02-prompt-control-output-review/02-01-SUMMARY.md

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 20:58:24 +01:00
Michele
ca3dd59072 feat(02-01): prompt editor UI with types, hooks, page, route, sidebar
- Add PromptInfo, PromptListResponse, PromptDetail types
- Add usePromptList, usePrompt, useSavePrompt, useResetPrompt hooks
- Create PromptEditor page with two-column layout, live variables
- Add /prompt-editor route in App.tsx
- Add Prompt Editor nav item with Pencil icon in Sidebar
- TypeScript compiles without errors

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 20:57:01 +01:00
Michele
05972fa8f1 feat(02-01): backend prompts router with 4 CRUD endpoints
- GET /api/prompts — list all prompts with modified/default flag
- GET /api/prompts/{name} — read prompt content + required variables
- PUT /api/prompts/{name} — save modified prompt with validation
- POST /api/prompts/{name}/reset — restore prompt to default
- Lazy PromptService init to handle lifespan directory creation
- Router registered in main.py before SPA catch-all

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 20:54:30 +01:00
Michele
5ba641e7d6 docs(02): create phase plan
Phase 02: Prompt Control + Output Review
- 2 plan(s) in 2 wave(s)
- Wave 1: 02-01 (Prompt Editor backend+frontend)
- Wave 2: 02-02 (Per-item regen + summary counter)
- Ready for execution
2026-03-08 20:17:29 +01:00
Michele
c22d9dde97 docs(02): capture phase context
Phase 02: Prompt Control + Output Review
- Implementation decisions documented
- Phase boundary established
2026-03-08 19:57:36 +01:00
Michele
4894e09707 docs(phase-1): complete Core Generation Pipeline phase
Phase 1 executed (4 plans, 3 waves), verified, gap fixed.
36 requirements marked Complete in traceability table.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 03:15:43 +01:00
Michele
d8e3eb9415 fix(01): calendar slot merge in OutputReview for PN/Schwartz badges
GenerateResponse now includes calendar field from backend.
OutputReview merges CalendarSlot into PostResult via slot_index,
enabling BadgePN, BadgeSchwartz rendering and Retry button.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 03:14:07 +01:00
Michele
23599e1736 docs(01-04): complete web UI plan — 4 task, 16 file, build pulita
Tasks completed: 4/4
- Task 1: Layout, routing, API hooks, tipi TypeScript, Dashboard, Settings
- Task 2a: Badge PN/Schwartz e PostCard con stati success/failed/pending
- Task 2b: SlideViewer con edit inline e ProgressIndicator con polling
- Task 2c: Pagine GenerateCalendar, OutputReview, GenerateSingle complete

SUMMARY: .planning/phases/01-core-generation-pipeline/01-04-SUMMARY.md
2026-03-08 02:31:42 +01:00
Michele
a5d1c15c3a feat(01-04): pagine GenerateCalendar, OutputReview, GenerateSingle complete
- GenerateCalendar.tsx: form con obiettivo+settimane+brand+tono+nicchie
  - Pulsante Genera disabilitato senza API key con banner link a Impostazioni
  - Async submit: mutation ritorna job_id, mostra ProgressIndicator
  - Auto-navigate a /risultati/:jobId quando job completato
- OutputReview.tsx: carica job results via useJobResults(jobId)
  - Griglia PostCard responsive con conteggio success/failed
  - Stato locale per edit inline (aggiornato da PostCard.onEdit)
  - Download CSV via useDownloadEditedCsv (POST con edits) con due pulsanti (header + footer)
- GenerateSingle.tsx: form con tipo PN, livello Schwartz, nicchia, formato narrativo
  - Topic opzionale (altrimenti generato dall'AI)
  - Anteprima risultato con PostCard+SlideViewer e download CSV singolo
2026-03-08 02:29:17 +01:00
Michele
9e5bddc312 feat(01-04): SlideViewer con edit inline e ProgressIndicator con polling
- SlideViewer.tsx: navigazione frecce sinistra/destra tra 8 slide (Cover + 6 centrali + CTA)
  - EditableField component: click-to-edit per ogni campo (input/textarea)
  - Dot indicators + keyboard navigation (frecce sinistra/destra)
  - Caption Instagram editabile con contatore caratteri
  - Callback onEdit propaga modifiche al parent
- ProgressIndicator.tsx: polling real-time via useJobStatus(jobId)
  - Barra progresso visuale con percentuale
  - Lista post con icone stato: pending/running/success/failed
  - onComplete(jobId) chiamato quando status diventa 'completed'
  - Poll ogni 2s (condizionale nel hook, si ferma quando completed/failed)
2026-03-08 02:26:54 +01:00
Michele
a2ebd72041 feat(01-04): badge PN/Schwartz e PostCard con stati success/failed/pending
- BadgePN.tsx: 6 colori distinti per tipi PN (valore/storytelling/news/riprova_sociale/coinvolgimento/promozione)
- BadgeSchwartz.tsx: 5 livelli L1-L5 con tooltip descriptivo, colori progressivi
- PostCard.tsx: stati success (espandibile con SlideViewer) / failed (errore + pulsante Riprova) / pending (loader)
- SlideViewer.tsx: stub per compilazione (completato nel task successivo)
- PostCard usa useGenerateSingle() per rigenerazione inline post falliti
2026-03-08 02:25:17 +01:00
Michele
738a877d39 feat(01-04): layout, routing, API hooks, tipi TypeScript, Dashboard, Settings
- types.ts: CalendarSlot, GeneratedPost, PostResult, JobStatus, Settings, SettingsStatus
- api/client.ts: aggiunto apiGet, apiPost, apiPut, apiDownload, triggerDownload
- api/hooks.ts: 10+ hooks TanStack Query (settings, generate, job polling, CSV export)
- components/Layout.tsx + Sidebar.tsx: sidebar stone/amber palette con 4 nav link
- pages/Dashboard.tsx: banner API key, quick actions link, step guide
- pages/Settings.tsx: form completo (API key password, LLM select, brand, nicchie checkbox)
- App.tsx: 5 route con BrowserRouter basename='/postgenerator', QueryClientProvider, Layout
2026-03-08 02:23:55 +01:00
Michele
60b46cb5c1 docs(01-03): complete pipeline LLM + API routers plan
Tasks completed: 2/2
- Task 1: LLMService, CSVBuilder, GenerationPipeline
- Task 2: API routers (calendar, generate, export, settings) e wiring main.py

SUMMARY: .planning/phases/01-core-generation-pipeline/01-03-SUMMARY.md
2026-03-08 02:16:49 +01:00
Michele
e06edde4ef feat(01-03): API routers (calendar, generate, export, settings) e wiring main.py
- schemas/settings.py: Settings pydantic model con api_key, llm_model, nicchie_attive, tono
- routers/calendar.py: POST /api/calendar/generate, GET /api/calendar/formats
- routers/generate.py: POST /api/generate/bulk (202 + job_id), GET /job/{job_id}/status (polling), GET /job/{job_id}, POST /single
- routers/export.py: GET /api/export/{job_id}/csv (originale), POST /api/export/{job_id}/csv (modifiche inline)
- routers/settings.py: GET /api/settings/status (api_key_configured), GET /api/settings, PUT /api/settings
- main.py: include_router x4 PRIMA di SPAStaticFiles, copia prompt default al primo avvio
2026-03-08 02:14:17 +01:00
Michele
083621afd3 feat(01-03): LLMService, CSVBuilder, GenerationPipeline
- LLMService: retry 3x, RateLimitError legge retry-after header, 5xx backoff esponenziale, ValidationError riprova con istruzione correttiva, inter_request_delay 2s
- LLMService.generate_topic(): usa TopicResult come response_schema (passa per loop retry/validation)
- CSVBuilder: encoding utf-8-sig, header CANVA_FIELDS locked, mappa GeneratedPost+CalendarSlot -> 33 colonne
- GenerationPipeline: background task asyncio.create_task, _jobs dict progresso real-time, per-item try/except individuale, persistenza JSON su disco
2026-03-08 02:10:28 +01:00
Michele
f9c452586f docs(01-02): complete servizi dominio plan
Tasks completed: 2/2
- Task 1: Costanti dominio, Pydantic schemas, FormatSelector
- Task 2: CalendarService, PromptService, 7 prompt .txt in italiano

SUMMARY: .planning/phases/01-core-generation-pipeline/01-02-SUMMARY.md
2026-03-08 02:02:35 +01:00
Michele
ef9b9471fc feat(01-02): CalendarService, PromptService, 7 prompt .txt in italiano
- backend/services/calendar_service.py: genera 13 slot con distribuzione PN (4v+2s+2n+3r+1c+1p) e Schwartz (L5=3,L4=3,L3=4,L2=2,L1=1), ordina per funnel, ruota nicchie, calcola date
- backend/services/prompt_service.py: carica/compila/elenca prompt {{variabile}}, ValueError per variabili mancanti
- backend/data/prompts/system_prompt.txt: sistema prompt esperto content marketing B2B italiano
- backend/data/prompts/topic_generator.txt: generazione topic per slot calendario
- backend/data/prompts/pas_valore.txt: formato PAS per post valore educativo
- backend/data/prompts/listicle_valore.txt: formato Listicle per post valore
- backend/data/prompts/bab_storytelling.txt: formato BAB per post storytelling
- backend/data/prompts/aida_promozione.txt: formato AIDA per post promozionale
- backend/data/prompts/dato_news.txt: formato Dato+Implicazione per post news
2026-03-08 02:00:00 +01:00
Michele
f6d9215b52 docs(01-01): complete infrastructure skeleton plan
Tasks completed: 2/2
- Task 1: Backend FastAPI skeleton + Docker build config
- Task 2: React + Vite + Tailwind v4 SPA scaffold con API client

SUMMARY: .planning/phases/01-core-generation-pipeline/01-01-SUMMARY.md
2026-03-08 01:57:09 +01:00
Michele
62f4b487b0 feat(01-01): React + Vite + Tailwind v4 SPA scaffold con API client
- Vite react-ts project con base: '/postgenerator/' (Pitfall #9 risolto)
- Tailwind v4 via @tailwindcss/vite plugin + @import "tailwindcss" in index.css
- react-router-dom con BrowserRouter basename="/postgenerator"
- @tanstack/react-query con QueryClientProvider
- lucide-react installato per icone
- src/api/client.ts: API_BASE='/postgenerator/api', apiFetch<T> con error handling
- Dev proxy: /postgenerator/api -> http://localhost:8000 (strip /postgenerator)
- App.tsx: HomePage placeholder "Setup completo", struttura Routes pronta
- Build Vite: 253.90kB JS + 5.53kB CSS, nessun errore TypeScript
2026-03-08 01:55:19 +01:00
Michele
209d8962f7 feat(01-02): costanti dominio, schemas Pydantic, FormatSelector
- backend/constants.py: CANVA_FIELDS (33 col locked), PERSUASION_DISTRIBUTION (13), SCHWARTZ_DISTRIBUTION (13)
- backend/schemas/calendar.py: CalendarSlot, CalendarRequest, CalendarResponse
- backend/schemas/generate.py: SlideContent, GeneratedPost, TopicResult, GenerateRequest, PostResult, GenerateResponse
- backend/data/format_mapping.json: matrice 6 tipi x 5 livelli (30 combinazioni)
- backend/services/format_selector.py: FormatSelector con select_format e fallback PAS
- fix .gitignore: backend/data/prompts/ e format_mapping.json non erano ignorabili
2026-03-08 01:54:58 +01:00
Michele
50d5708016 feat(01-01): Backend FastAPI skeleton + Docker build config
- FastAPI app with SPAStaticFiles catch-all (root_path NOT in constructor)
- config.py with DATA_PATH, PROMPTS_PATH, OUTPUTS_PATH, CAMPAIGNS_PATH, CONFIG_PATH
- Startup lifespan creates data directories automatically
- Health endpoint: GET /api/health -> {"status": "ok"}
- Dockerfile multi-stage: node:22-slim builds React, python:3.12-slim serves API+SPA
- --root-path /postgenerator set in Uvicorn CMD only (avoids Pitfall #4)
- docker-compose.yml: lab-postgenerator-app, proxy_net, named volume for data persistence
- requirements.txt with pinned versions: fastapi[standard]==0.135.1, anthropic==0.84.0
2026-03-08 01:51:41 +01:00
Michele
696b265e4d fix(01): revise plans based on checker feedback
- Fix CSV-01 column count: 32 -> 33 (8 meta + 24 slide + 1 caption)
- Add TopicResult Pydantic model + topic_generator.txt prompt
- Make bulk generation async with background task + polling endpoint
- Add POST /api/export/{job_id}/csv for inline edit CSV download
- Split Plan 01-04 Task 2 into 2a/2b/2c (badges, slideviewer, pages)
- Update ProgressIndicator to use polling on /status endpoint
- Add --yes flag and frontend/ prerequisite note to Plan 01-01

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 01:40:30 +01:00
Michele
3f1dbbf396 docs(01): create phase plan
Phase 01: Core Generation Pipeline
- 4 plan(s) in 3 wave(s)
- Wave 1: 01-01 (infra) + 01-02 (core services) parallel
- Wave 2: 01-03 (LLM pipeline + API routers)
- Wave 3: 01-04 (Web UI) with human-verify checkpoint
- Ready for execution
2026-03-08 01:27:25 +01:00
Michele
595b6ee7e7 docs(01): capture phase context
Phase 01: Core Generation Pipeline
- Implementation decisions documented
- Phase boundary established

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 01:16:42 +01:00
Michele
fed78f0e43 docs: create roadmap (4 phases)
Phases:
1. Core Generation Pipeline: 36 requirements (infra + calendar + LLM + CSV + UI)
2. Prompt Control + Output Review: 2 requirements
3. Organization Layer: 5 requirements (swipe file)
4. Enrichment: 3 requirements (Unsplash)

All 46 v1 requirements mapped to phases.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 14:37:14 +01:00
Michele
1dedf7cf98 docs: define v1 requirements
46 requirements across 9 categories
8 requirements deferred to v2

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 14:30:30 +01:00
Michele
fe6cd4d516 docs: complete project research
Files:
- STACK.md
- FEATURES.md
- ARCHITECTURE.md
- PITFALLS.md
- SUMMARY.md

Key findings:
- Stack: FastAPI 0.135.1 + React 19 + Vite 7 + Tailwind v4, single-container deploy
- Architecture: FastAPI serves React SPA via catch-all, file-based storage (Docker volume), LLMService with retry/backoff
- Critical pitfall: All 9 pitfalls map to Phase 1 — Italian prompts, Canva field constants, UTF-8 BOM, root_path config, per-item bulk isolation

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-07 14:06:44 +01:00
Michele
dd601a0d08 chore: add project config
Mode: yolo
Depth: standard
Parallelization: enabled
Workflow agents: research=off, plan_check=on, verifier=on

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 13:56:16 +01:00
Michele
5335b3b0ae docs: initialize project
Instagram carousel automation system for B2B content marketing - strategic content engine with Persuasion Nurturing, Schwartz levels, and niche rotation producing Canva Bulk Create CSV

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-07 13:44:43 +01:00