Implements all 5 phases of Foundary Studio backend:
Phase 1: Chat Persistence (8 API endpoints)
- Conversations and messages with proper cascading deletes
- PostgreSQL schema with auto-update triggers
- Full CRUD operations with structured logging
Phase 2: Blueprint Entity (5 API endpoints)
- JSONB spec storage with GIN indexes
- Flexible structured data for project specifications
- Version-controlled blueprint management
Phase 3: Architect Service (3 API endpoints)
- Conversational AI orchestration with Claude
- Multi-turn dialogue with context building
- Blueprint spec extraction from conversations
Phase 4: Work Queue Integration
- Verified existing endpoint compatibility
Phase 5: Structured Questions (6 API endpoints)
- Four question types: text, choice, multichoice, yesno
- Answer validation with proper constraints
- Conversation-linked Q&A flow
Architecture:
- Textbook hexagonal architecture (domain → port → adapter → service → handler)
- Zero external dependencies in domain layer
- Consistent error handling with proper wrapping
- Auth scopes on all routes (projects:read, projects:execute)
- Structured logging with operation context and duration tracking
- NULL-safe DTO converters throughout
Database:
- 3 new migrations (019, 020, 021)
- UUIDs for all primary keys
- Proper foreign key constraints with ON DELETE CASCADE
- Optimized indexes including partial index for unanswered questions
- Auto-update triggers for timestamps
OpenAPI Documentation:
- Complete API documentation under 'Foundary' tag
- 22 new endpoints documented with examples
- Request/response schemas for all operations
Logging Improvements:
- Added operation field to all service logs
- Added duration_ms tracking for performance monitoring
- Log response_length instead of full response content
- Consistent use of logging field constants
- Execute-then-log pattern for delete operations
Files: 32 changed, 2800+ lines added
- 7 domain models
- 3 database migrations
- 3 port interfaces
- 3 postgres adapters
- 4 services (conversation, blueprint, question, architect)
- 4 handlers with DTOs
- OpenAPI documentation
- Integration in main.go
🤖 Generated with Claude Code
Co-Authored-By: Claude <noreply@anthropic.com>
7.8 KiB
7.8 KiB
Foundary Studio UI - ASCII Screens
1. Project Dashboard (The "Lobby")
Entry point for the Product Owner.
+-----------------------------------------------------------------------------+
| Foundary Studio [ New Project ] |
+-----------------------------------------------------------------------------+
| |
| Active Projects |
| |
| +---------------------------+ +---------------------------+ |
| | cool-project | | internal-tool-v2 | |
| | ● Running | | ● Pending | |
| | | | | |
| | Last: Add Auth Feature | | Init: 2 mins ago | |
| | [ View ] | | [ View ] | |
| +---------------------------+ +---------------------------+ |
| |
| +---------------------------+ |
| | legacy-migration | |
| | ● Failed | |
| | | |
| | Error: OOM Kill | |
| | [ Logs ] | |
| +---------------------------+ |
| |
+-----------------------------------------------------------------------------+
2. Project Workspace (The "Three Panes")
The core workspace for defining and building.
+-------------------------------------------------------------------------------------+
| < Back | cool-project | ● Live (v0.4.2) [ Deploy ] |
+--------------------------+------------------------------+---------------------------+
| CHAT (Architect) | PLAN (Blueprint) | PREVIEW (Staging) |
| | | |
| User: I need a way for | ## Data Model | +---------------------+ |
| users to upload cats. | | | Cool App | |
| | [+] Table: Cats | | | |
| Arch: Okay. Should it | - id: uuid | | [ Login ] | |
| be public or private? | - name: string | | | |
| | - img_url: string | | Welcome! | |
| User: Public feed. | | | | |
| | ## API | | | |
| Arch: Updating plan... | | | | |
| [Plan Updated] | [+] POST /api/cats | | | |
| | [+] GET /api/feed | | | |
| Arch: I have a question | | | | |
| about image hosting. | ## UI Components | | | |
| [Review Needed] | | | | |
| | [+] CatCard.tsx | | | |
| [ Type message... ] | [+] UploadModal.tsx | | | |
+--------------------------+------------------------------+---------------------------+
3. Review & Orchestration (The "Engine Room")
When the Architect needs technical confirmation or when a build is running.
+-----------------------------------------------------------------------------+
| Request: "Add Cat Upload Feature" |
+-----------------------------------------------------------------------------+
| |
| Status: ● Reviewing |
| |
| [!] Question from Engineering Agent |
| "I see we are using S3 for storage. Do we have a bucket configured |
| for public read access yet?" |
| |
| [ Yes, it's 'img-prod' ] [ No, create one ] [ Let me check... ] |
| |
+-----------------------------------------------------------------------------+
| |
| Work Queue |
| |
| 1. [Spec] Analyze Requirements .................. ✓ Done |
| 2. [Code] Generate Handlers (cats.go) ........... ✓ Done |
| 3. [Code] Generate UI (Upload.tsx) .............. ⟳ Running... |
| 4. [Test] Run Integration Tests ................. ○ Pending |
| 5. [Deploy] Update K8s Manifests ................ ○ Pending |
| |
+-----------------------------------------------------------------------------+
| Logs / OTEL |
| > agent: generating component structure... |
| > agent: checking imports... |
+-----------------------------------------------------------------------------+
4. History & OTEL (The "Rearview Mirror")
Viewing past requests and system telemetry.
+-----------------------------------------------------------------------------+
| Request History |
+-----------------------------------------------------------------------------+
| |
| ID | Request | Status | Duration | Traces |
| ------+--------------------------+------------+----------+--------------- |
| #104 | "Fix header alignment" | ✓ Deployed | 45s | [View Trace] |
| #103 | "Add Cat Upload" | ✓ Deployed | 5m 12s | [View Trace] |
| #102 | "User Auth" | ⚠ Failed | 2m 00s | [View Trace] |
| |
+-----------------------------------------------------------------------------+
| |
| Selected Trace: #103 (Add Cat Upload) |
| |
| [api] POST /sdlc/execute ----------------------------------------- 200ms |
| [agent] Generate Spec ----------------------------------- 1500ms |
| [llm] Claude 3.5 Sonnet -------------------------- 1200ms |
| [worker] git commit ----------------------- 100ms |
| |
+-----------------------------------------------------------------------------+