// Convert a SeedDraft into a ProseMirror JSON document the user lands on in // the editor. After the pivot the prose is canonical; the analyze pipeline // derives taxonomy / glossary / model / requirements from it on demand. // // We use a deterministic template (not an LLM) — fast, predictable, and the // user is going to keep editing anyway. Section structure mirrors the seed // fields so the analyze passes have clear hooks. import type { JSONContent } from "@tiptap/react"; import type { SeedDraft } from "./seedInterview"; export function seedToProseDoc(seed: SeedDraft): JSONContent { const content: JSONContent[] = []; if (seed.title) { content.push({ type: "heading", attrs: { level: 1 }, content: [{ type: "text", text: seed.title }] }); } else { content.push({ type: "heading", attrs: { level: 1 }, content: [{ type: "text", text: "Untitled idea" }] }); } if (seed.problem) { content.push({ type: "heading", attrs: { level: 2 }, content: [{ type: "text", text: "Problem" }] }); content.push({ type: "paragraph", content: [{ type: "text", text: seed.problem }] }); } if (seed.targetUser) { content.push({ type: "heading", attrs: { level: 2 }, content: [{ type: "text", text: "Target user" }] }); content.push({ type: "paragraph", content: [{ type: "text", text: seed.targetUser }] }); } if (seed.desiredOutcome) { content.push({ type: "heading", attrs: { level: 2 }, content: [{ type: "text", text: "Desired outcome" }] }); content.push({ type: "paragraph", content: [{ type: "text", text: seed.desiredOutcome }] }); } if (seed.initialHypothesis) { content.push({ type: "heading", attrs: { level: 2 }, content: [{ type: "text", text: "Initial hypothesis" }] }); content.push({ type: "paragraph", content: [{ type: "text", text: seed.initialHypothesis }] }); } if (seed.constraints && seed.constraints.length > 0) { content.push({ type: "heading", attrs: { level: 2 }, content: [{ type: "text", text: "Constraints" }] }); for (const c of seed.constraints) { content.push({ type: "paragraph", content: [{ type: "text", text: `· ${c}` }] }); } } return { type: "doc", content }; }