Deal Foundry v0 Prompt
INFO
This is the v0.dev prompt used to generate the Deal Foundry UI prototype. It specifies the Next.js/shadcn/ui stack, guided workflow UX, DealModel DSL integration, and Claude Opus assistant panel.
txt
Build a Next.js (latest, App Router) web app called “Deal Foundry” using shadcn/ui components and Tailwind. No React Server Components for app logic; use client components where needed. Use TanStack React Query for data fetching/caching. Use TypeScript.
Goal: Produce realistic UI screens for an internal enterprise authoring tool that helps semi-technical model authors (technical PMs) go from domain knowledge + contract artifacts → a deal model (schema + computations + payment terms + events) → fixtures/tests → contract preview → publish.
This is a UI prototype; stub APIs with mocked data and simulated latency (200–900ms). The UX should feel elegant and guided, not like a dense IDE.
NON-NEGOTIABLES:
1) Guided workflow is primary. Tabs are “expert mode.”
2) If you show a DSL editor, it MUST be our DealModel DSL style: `model { ... }`, `inputs { schema: """...""" }`, `computations { metric ...; output ...; }`, `clause { ... payment_terms { term { ... } } }`, `type { ... }`. Do NOT invent a different DSL (no `def x = ...`).
3) The “Calculations” dropdown/list must come from compiling/parsing the model’s `computations` (metrics/outputs). Do NOT invent random calculations.
4) Use a real JSON builder for JSON editing: integrate https://github.com/lovasoa/jsonjoy-builder
- default editor for input JSON Schema, ui-schema, and canonical model JSON
- provide a Raw JSON toggle
5) Support schema component refs: `$ref` authoring + “Validate & Bundle” UI.
- show Authored Schema (editable) and Bundled Schema (read-only)
- schema library refs use `de://schema-library/lib/common@1.0.0#/Money`
- disallow http/file refs in bundle step (mock enforcement)
Core layout:
- Top nav: Deal Foundry logo/name, current draft/model name, environment badge (DEV/PROD), user avatar.
- Left sidebar: Model Library, Drafts, Schema Library, Operations (DLQ), Settings.
- Main content: Draft Workspace with a **Step Rail** (Guided Mode) and an **Assistant panel** (Claude Opus) that is prominent.
- “Expert Mode” toggle reveals the full tab bar.
GUIDED MODE (primary):
A vertical Step Rail on the left of the workspace (inside the page), with 7 steps:
1) Intake
2) Clause Inventory
3) Schema
4) Computations & Payment Terms
5) Contract Preview
6) Tests (Fixtures + Workbench)
7) Publish
Each step page has:
- a clear “What you do here” header
- a big primary CTA (“Next Step”)
- a progress indicator (e.g., 3/7)
- blocking issues panel (missing fields, failing fixtures)
Assistant panel (right side) simulates Claude Opus:
- shows step-by-step actions: Extract intent → Propose clause inventory → Propose schema patch → Propose model patch → Generate fixtures → Run tests
- provides buttons: Apply Patch, Regenerate, Ask Clarifying Question
- display “patch preview” as a diff (mock)
EXPERT MODE (secondary):
Tabs: Summary, Documents, Clause Inventory, Schema, Model, Fixtures, Calculation Workbench, Compile/Test, Diff, Sandbox Testing, Contract Preview.
ROUTES/SCREENS TO IMPLEMENT:
1) /models — Model Library
- table: Name, Deal Type, Version, Status (draft/active/canary/deprecated), Owners, Last Edited
- actions: Create New Draft, Import Fixture Pack, Compare versions
2) /drafts/[id] — Draft Workspace (Guided Mode default)
- header actions: Validate, Run Fixtures, Submit for Review, Publish (disabled unless ready)
- Step Rail + Assistant prominent
- each step renders a dedicated panel:
a) Intake: paste description + upload docs, show doc extraction status, select doc blocks
b) Clause Inventory: LLM-proposed clause families (financial/non-financial), author curation, links to schema components, coverage meter
c) Schema: jsonjoy-builder editor, $ref picker, Validate & Bundle (authored vs bundled views), form preview, sample payload generator
d) Computations & Payment Terms: show calculations list derived from computations; payment term builder UI
e) Contract Preview: template editor + rendered preview from a fixture; binding picker; coverage warnings
f) Tests: fixtures list + run + diffs + explain links; workbench for single-calculation testing and “promote to fixture”
g) Publish: readiness checklist, compatibility selection, approve/request changes mock
3) /schema-library — Schema Components Library
- list components grouped: common, finance, touring, film, endorsement
- show versions; copy `$ref` button generating `de://schema-library/...`
- component detail panel shows JSON snippet and usage examples
4) /operations/dlq — Dead Letters
- table: source_service, item_type, error_code, status, created_at
- bulk retry; detail drawer with payload and retry history
KEY COMPONENTS TO BUILD (must exist in code):
- StepRail.tsx (guided workflow)
- AssistantPanel.tsx (Claude simulation)
- JsonJoyEditor.tsx (jsonjoy-builder integration + raw toggle)
- SchemaBundlePanel.tsx (authored vs bundled schema views + refsUsed/errors)
- ClauseInventoryPanel.tsx (inventory list + coverage + link to schema)
- ContractPreviewPanel.tsx (template editor + rendered preview)
- WorkbenchPanel.tsx (calculation workbench + promote to fixture)
- FixturePackImportDialog.tsx (import zip; show summary; confirm)
MOCKED API FUNCTIONS (use React Query):
- listModels(), getModelVersion(dealType, version)
- getDraft(draftId), updateDraft(draftId, patch)
- extractDocpack(documentId), listDocBlocks(draftId)
- generateClauseInventory(draftId, selectedBlocks), updateClauseInventory(draftId)
- validateSchema(draftId), bundleSchema(draftId) -> returns bundledSchema + refsUsed + errors
- compileModel(draftId) -> returns calc catalog + errors/warnings
- listCalculations(draftId) -> derived from compile output
- runWorkbench(draftId, calculationKey, inputs, evidenceOverrides) -> result + breakdown + warnings + explainRef
- promoteWorkbenchRunToFixture(draftId, runId, fixtureName)
- runFixtures(draftId), exportFixturePack(draftId), importFixturePack(draftId)
DATA REQUIREMENTS:
Seed the prototype with two realistic drafts:
- Touring Agreement v2.0.0
- Film License v2.5.0
Ensure calculations and DSL shown match the selected draft (no cross-domain drift).
DELIVERABLE:
A runnable Next.js project with the guided authoring workflow, prominent LLM assistant panel, clause inventory step, schema bundling UI, contract preview, fixtures + workbench, and jsonjoy-builder integrated for JSON editing.
UPDATE: Drop CEL. Computations in the DSL are specification blocks (type/description/dependencies/invariants). Authoring-time verification uses LLM-generated evaluator code + eval jobs (sprites/local sandbox).