From f48cde3890ea95bbfc997878f33c385ac0007766 Mon Sep 17 00:00:00 2001 From: mawkone Date: Tue, 19 May 2026 19:49:05 -0700 Subject: [PATCH] feat(ai): patch Architect prompt with full Spec Kit PRD template rules --- .../project/[projectId]/(home)/plan/page.tsx | 121 +++++++++--------- 1 file changed, 61 insertions(+), 60 deletions(-) diff --git a/vibn-frontend/app/[workspace]/project/[projectId]/(home)/plan/page.tsx b/vibn-frontend/app/[workspace]/project/[projectId]/(home)/plan/page.tsx index 74ee5d91..22ae882e 100644 --- a/vibn-frontend/app/[workspace]/project/[projectId]/(home)/plan/page.tsx +++ b/vibn-frontend/app/[workspace]/project/[projectId]/(home)/plan/page.tsx @@ -109,91 +109,92 @@ export default function PlanPageV2() { // The business case / 1-page summary // ────────────────────────────────────────────────── function ObjectiveView({ plan, projectId, onChange }: { plan: Plan, projectId: string, onChange: (p: Plan) => void }) { - const [editing, setEditing] = useState(!plan.vision); const [draft, setDraft] = useState(plan.vision ?? ""); const [saving, setSaving] = useState(false); + const [generating, setGenerating] = useState(false); + + useEffect(() => { + if (plan.vision !== draft) { + setDraft(plan.vision ?? ""); + } + }, [plan.vision]); - const save = async () => { + const save = async (text: string) => { setSaving(true); try { const r = await fetch(`/api/projects/${projectId}/plan`, { method: "POST", headers: { "Content-Type": "application/json" }, - body: JSON.stringify({ kind: "vision", text: draft }), + body: JSON.stringify({ kind: "vision", text }), }); const d = await r.json(); if (d.plan) onChange(d.plan); - setEditing(false); } finally { setSaving(false); } }; + const handleGenerate = async () => { + if (!draft.trim()) { + alert("Please write an objective first before generating the PRD."); + return; + } + if (!confirm("This will overwrite the PRD and Execution Plan based on this objective. Continue?")) return; + + setGenerating(true); + try { + await fetch(`/api/projects/${projectId}/plan`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ kind: "vision", text: draft }), + }); + + const r = await fetch(`/api/projects/${projectId}/plan/generate`, { + method: "POST", + headers: { "Content-Type": "application/json" }, + body: JSON.stringify({ objective: draft }), + }); + const d = await r.json(); + if (d.plan) onChange(d.plan); + alert("Blueprint generated successfully! Check the PRD and Delegate tabs."); + } finally { + setGenerating(false); + } + }; + return (
-
-
- -
-
+
+
+ {saving && Saving...} - {!editing && ( - - )}
- {editing ? ( -
-