/** * CodeDiffRenderer - Renders code diffs with intuitive +/- highlighting * * This utility provides clear visualization of code changes with syntax-aware * formatting and copy-paste friendly output. * * Design principles: * - Clear +/- indicators with recognizable colors * - Green background for additions, red background for deletions * - Line numbers for context * - Syntax highlighting for code * - Clean copy-paste output * * @module CodeDiffRenderer */ export interface DiffLine { type: 'context' | 'added' | 'removed'; lineNumber?: number; content: string; } export interface FileDiff { path: string; language?: string; lines: DiffLine[]; additions: number; deletions: number; } export interface DiffSummary { filesChanged: number; additions: number; deletions: number; } /** * CodeDiffRenderer - Renders code diffs with clear visual distinction * * Handles single file diffs and multi-file diff summaries with * copy-paste friendly formatting. */ export declare class CodeDiffRenderer { private theme; private terminalWidth; constructor(); /** * Renders a single file diff * * Format: * Modified: api/users.ts (+3 -1) * 12 | export const getUsers = async (req: Request, res: Response) => { * 13 | try { * - 14 | const users = await db.users.findAll(); * + 14 | const users = await db.users.findAll({ where: { active: true } }); * 15 | res.json(users); * 16 | } catch (error) { * * @param diff - File diff details */ renderFileDiff(diff: FileDiff): string; /** * Renders a single diff line with appropriate styling * * @param line - The diff line to render */ private renderDiffLine; /** * Renders a diff summary for multiple files * * Format: * Changes: 3 files (+42 -18) * Modified: api/users.ts (+15 -5) * Created: api/auth.ts (+25 -0) * Modified: api/index.ts (+2 -13) * * @param files - Array of file diffs */ renderDiffSummary(files: FileDiff[]): string; /** * Renders inline code with syntax highlighting * * Format: * const result = await fetchData(); * * @param code - Code snippet * @param language - Programming language */ renderInlineCode(code: string, language?: string): string; /** * Renders a code block with header * * Format: * File: api/users.ts (TypeScript) * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ * 1 | import { Request, Response } from 'express'; * 2 | import { db } from '../database'; * 3 | * 4 | export const getUsers = async (req: Request, res: Response) => { * ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ * * @param code - Code content * @param filename - File name/path * @param language - Programming language */ renderCodeBlock(code: string, filename?: string, language?: string): string; /** * Format change counts (+X -Y) */ private formatChangeCounts; /** * Basic JavaScript/TypeScript syntax highlighting */ private highlightJavaScript; /** * Basic Python syntax highlighting */ private highlightPython; /** * Refreshes theme (call after theme change) */ refreshTheme(): void; } /** * Default singleton instance */ export declare const codeDiffRenderer: CodeDiffRenderer; //# sourceMappingURL=CodeDiffRenderer.d.ts.map