import { useState } from 'react'; import { Button } from '@/components/ui/button'; import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; import { MessageSquareText, RotateCcw, Info } from 'lucide-react'; import { cn } from '@/lib/utils'; import type { PromptCustomization, CustomPrompt } from '@automaker/types'; import { TAB_CONFIGS } from './tab-configs'; import { Banner, PromptFieldList } from './components'; interface PromptCustomizationSectionProps { promptCustomization?: PromptCustomization; onPromptCustomizationChange: (customization: PromptCustomization) => void; } /** * PromptCustomizationSection Component * * Allows users to customize AI prompts for different parts of the application: * - Auto Mode (feature implementation) * - Agent Runner (interactive chat) * - Backlog Plan (Kanban planning) * - Enhancement (feature description improvement) * - And many more... */ export function PromptCustomizationSection({ promptCustomization = {}, onPromptCustomizationChange, }: PromptCustomizationSectionProps) { const [activeTab, setActiveTab] = useState('auto-mode'); const updatePrompt = ( category: keyof PromptCustomization, field: string, value: CustomPrompt | undefined ) => { const updated = { ...promptCustomization, [category]: { ...promptCustomization[category], [field]: value, }, }; onPromptCustomizationChange(updated); }; const resetToDefaults = (category: keyof PromptCustomization) => { const updated = { ...promptCustomization, [category]: {}, }; onPromptCustomizationChange(updated); }; const resetAllToDefaults = () => { onPromptCustomizationChange({}); }; return (
{/* Header */}

Prompt Customization

Customize AI prompts for Auto Mode, Agent Runner, and other features.

{/* Info Banner */}

How to Customize Prompts

Toggle the switch to enable custom mode and edit the prompt. When disabled, the default built-in prompt is used. You can use the default as a starting point by enabling the toggle.

{/* Tabs */}
{TAB_CONFIGS.map((tab) => ( {tab.label} ))} {TAB_CONFIGS.map((tab) => ( {/* Tab Header */}

{tab.title}

{/* Tab Banner */} {tab.banner && } {/* Main Fields */} {tab.fields.length > 0 && (
)} {/* Sections (for tabs like Auto Mode with grouped fields) */} {tab.sections?.map((section, idx) => (
{section.title && (

{section.title}

)} {section.banner && (
)}
))}
))}
); }