/** * Spec Generator * AI-powered feature specification generator with interview flow * Enhanced with codebase tools and Claude Code-like UX */ import type { AIProvider } from '../providers.js'; import type { ScanResult } from '../../scanner/types.js'; /** * Session context from /init analysis */ export interface SessionContext { entryPoints?: string[]; keyDirectories?: Record; commands?: { build?: string; dev?: string; test?: string; }; namingConventions?: string; implementationGuidelines?: string[]; keyPatterns?: string[]; } /** * Spec generator options */ export interface SpecGeneratorOptions { featureName: string; projectRoot: string; provider: AIProvider; model: string; scanResult?: ScanResult; /** Rich session context from /init */ sessionContext?: SessionContext; /** Tavily API key for web search */ tavilyApiKey?: string; /** Context7 API key for docs lookup */ context7ApiKey?: string; } /** * Generation phases */ type GeneratorPhase = 'context' | 'goals' | 'interview' | 'generation' | 'complete'; /** * AI-powered spec generator with interview flow */ export declare class SpecGenerator { private conversation; private phase; private readonly featureName; private readonly projectRoot; private generatedSpec; private questionCount; private readonly hasTools; private readonly sessionContext?; constructor(options: SpecGeneratorOptions); /** * Display the current phase header */ private displayHeader; /** * Display session context at start */ private displayContext; /** * Phase 1: Gather context from URLs/files */ private gatherContext; /** * Phase 2: Discuss goals - collect user goals */ private discussGoals; /** * Phase 2a: Explore project silently * AI explores the codebase WITHOUT asking questions - just gathering context */ private exploreProject; /** * Phase 2b: Start interview - acknowledge goals and ask FIRST question * This is a SEPARATE AI turn from exploration to prevent "two answers" bug */ private startInterview; /** * Phase 3: Conduct interview */ private conductInterview; /** * Process a user answer and get AI response */ private processAnswer; /** * Phase 4: Generate spec */ private generateSpec; /** * Run the full spec generation flow * Returns the generated spec or null if cancelled */ run(): Promise; /** * Get the generated spec */ getSpec(): string; /** * Get current phase */ getPhase(): GeneratorPhase; } export {};