From c1b5adbde8753dde88d524fbac87c2e480dacc82 Mon Sep 17 00:00:00 2001 From: Gemini AI Date: Sat, 20 Dec 2025 16:05:22 +0400 Subject: [PATCH] fix(automation): Switch to Build Mode for Backend Generation - Modified Views.tsx to keep the user in GlobalMode.Build instead of switching to Chat when generating a backend. - Added intelligent system prompt routing in LayoutComponents.tsx for [BACKEND_REQUEST] to ensure the AI knows how to generate a server.js file. --- .../src/components/LayoutComponents.tsx | 14 +++++++++++++- bin/goose-ultra-final/src/components/Views.tsx | 4 ++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/bin/goose-ultra-final/src/components/LayoutComponents.tsx b/bin/goose-ultra-final/src/components/LayoutComponents.tsx index 50b5c23..f63dafe 100644 --- a/bin/goose-ultra-final/src/components/LayoutComponents.tsx +++ b/bin/goose-ultra-final/src/components/LayoutComponents.tsx @@ -2470,7 +2470,19 @@ Format: { "ideas": [{ "title": "Short Title", "subtitle": "One line", "tag": "To (window as any)._redesignApprovedSessions[state.activeProject.id] = true; } - if (isQaFailureArtifact) { + const isBackendRequest = userPrompt.includes('[BACKEND_REQUEST]'); + + if (isBackendRequest) { + // --- BACKEND GENERATION MODE --- + systemPrompt = `[SYSTEM INSTRUCTION]: BACKEND GENERATION REQUEST. + +The user wants to generate a server-side implementation for the existing frontend. +1. Analyze the provided frontend code in the user prompt. +2. Identify all API endpoints and data structures. +3. Propose a plan to create a 'server.js' (Node.js/Express) file. +4. The plan MUST start with '[PLAN]'. +5. Do NOT modify the frontend code. Only build the backend.`; + } else if (isQaFailureArtifact) { // --- REPAIR MODE (F3: Retention & Match) --- // "Broken frontend is treated as a REPAIR task" const originalIntent = state.activeProject?.originalPrompt || "Unknown Intent"; diff --git a/bin/goose-ultra-final/src/components/Views.tsx b/bin/goose-ultra-final/src/components/Views.tsx index f63dced..0153557 100644 --- a/bin/goose-ultra-final/src/components/Views.tsx +++ b/bin/goose-ultra-final/src/components/Views.tsx @@ -1452,8 +1452,8 @@ Start with "# 🔧 Repair Plan" and be concise.`; return; } - // Switch to Chat to show progress - dispatch({ type: 'SET_MODE', mode: GlobalMode.Chat }); + // Switch to Build mode (Plan tab) to show progress + dispatch({ type: 'SET_MODE', mode: GlobalMode.Build }); dispatch({ type: 'SET_TAB', tab: TabId.Plan }); const prompt = `[BACKEND_REQUEST]