UNPKG

v0-ui-reviewer

Version:

Next-gen UI/UX reviewer with multi-model AI support (OpenAI, Claude, v0), style extraction, and live preview sandbox

121 lines (120 loc) 3.31 kB
import { AIModel } from './ai-service.js'; export interface V0APIResponse { id: string; model: string; object: string; created: number; choices: Array<{ index: number; message: { role: string; content: string; }; finish_reason: string; }>; } export interface UIReviewOptions { url?: string; screenshotPath?: string; context?: string; customPrompt?: string; mobile?: boolean; fullPage?: boolean; outputPath?: string; showImage?: boolean; verbose?: boolean; onProgress?: (step: string, percent: number, message?: string) => void; extractStyles?: boolean; styleOutputPath?: string; styleFormat?: 'json' | 'css' | 'tailwind'; model?: AIModel; deepDive?: boolean; gridSize?: number; batchId?: string; } export interface UIReviewResult { componentBreakdown: string; heuristicAudit: string; recommendations: string; codeSamples: string; abTestIdeas: string; screenshot?: string; analysisTimestamp: string; url?: string; designTokens?: string; } /** * V0 UI/UX Expert Reviewer CLI * * A powerful command-line tool that combines Puppeteer screenshot capture * with the v0 API to provide expert UI/UX analysis with terminal image display. */ export declare class V0UIReviewerCLI { private apiKey; private baseURL; private timeout; private screenshotCapture; private imageDisplay; private enhancedCapture; private aiService; constructor(apiKey?: string, options?: { timeout?: number; verbose?: boolean; }); /** * Expert UI/UX Review Prompt - Enhanced for CLI use */ private getExpertPrompt; /** * Capture screenshot with enhanced anti-bot detection and retry logic */ captureScreenshot(url: string, options?: { fullPage?: boolean; viewportWidth?: number; viewportHeight?: number; outputPath?: string; mobile?: boolean; timeout?: number; verbose?: boolean; retries?: number; onProgress?: (step: string, percent: number, message?: string) => void; }): Promise<string>; /** * Display image in terminal with enhanced quality */ displayImageInTerminal(imagePath: string, options?: { width?: number; height?: number; preserveAspectRatio?: boolean; verbose?: boolean; }): Promise<void>; /** * Convert image to base64 for API */ private imageToBase64; /** * Call v0 API with expert UI/UX review prompt */ private callAIAPI; /** * Parse the structured response from v0 API */ private parseResponse; /** * Perform complete UI/UX review with CLI enhancements */ reviewURL(url: string, options?: UIReviewOptions): Promise<UIReviewResult>; /** * Review an existing screenshot */ reviewScreenshot(screenshotPath: string, options?: UIReviewOptions): Promise<UIReviewResult>; /** * Format analysis as markdown */ formatAsMarkdown(analysis: UIReviewResult): string; /** * Save analysis to file */ saveAnalysis(analysis: UIReviewResult, outputPath: string): Promise<void>; } export default V0UIReviewerCLI;