UNPKG

lokalise-mcp

Version:

The Lokalise MCP Server brings Lokalise's localization power to Claude and AI assistants—manage projects, keys, and translations by chat.

160 lines (159 loc) • 5.73 kB
/** * Standardized formatting utilities for consistent output across all CLI and Tool interfaces. * These functions should be used by all formatters to ensure consistent formatting. */ /** * Format a date in a standardized way: YYYY-MM-DD HH:MM:SS UTC * @param dateString - ISO date string or Date object * @returns Formatted date string */ export declare function formatDate(dateString?: string | Date): string; /** * Format a URL as a markdown link * @param url - URL to format * @param title - Link title * @returns Formatted markdown link */ export declare function formatUrl(url?: string, title?: string): string; /** * Format a heading with consistent style * @param text - Heading text * @param level - Heading level (1-6) * @returns Formatted heading */ export declare function formatHeading(text: string, level?: number): string; /** * Format a list of key-value pairs as a bullet list * @param items - Object with key-value pairs * @param keyFormatter - Optional function to format keys * @returns Formatted bullet list */ export declare function formatBulletList(items: Record<string, unknown>, keyFormatter?: (key: string) => string): string; /** * Format a separator line * @returns Separator line */ export declare function formatSeparator(): string; /** * Format an array safely, handling null/undefined cases * @param arr - Array to format * @param emptyMessage - Message when array is empty * @param separator - Separator between items * @returns Formatted array string */ export declare function formatSafeArray(arr: string[] | undefined | null, emptyMessage?: string, separator?: string): string; /** * Format platform-specific data object (common pattern across formatters) * @param obj - Platform object with ios, android, web, other properties * @param emptyMessage - Message when no platforms configured * @returns Formatted platform data */ export declare function formatPlatformData(obj: unknown, emptyMessage?: string): string; /** * Format progress percentage with appropriate status icon * @param progress - Progress percentage (0-100) * @returns Formatted progress with icon */ export declare function formatProgress(progress: number): string; /** * Get status icon based on progress or completion state * @param progress - Progress value (0-100) * @returns Status icon */ export declare function getStatusIcon(progress: number): string; /** * Format a markdown table from array of objects * @param data - Array of data objects * @param columns - Column configuration * @returns Formatted markdown table */ export declare function formatTable<T extends Record<string, unknown>>(data: T[], columns: Array<{ key: keyof T; header: string; formatter?: (value: unknown) => string; maxWidth?: number; }>): string; /** * Format statistics summary section * @param stats - Statistics object * @param title - Section title * @returns Formatted statistics section */ export declare function formatStatistics(stats: Record<string, number | string>, title?: string): string; /** * Format empty state message with context * @param entityType - Type of entity (projects, keys, etc.) * @param context - Additional context (project name, etc.) * @param suggestions - Array of suggestions * @returns Formatted empty state */ export declare function formatEmptyState(entityType: string, context?: string, suggestions?: string[]): string; /** * Format pagination information * @param hasMore - Whether there are more pages * @param cursor - Current cursor/page info * @param currentCount - Number of items in current page * @returns Formatted pagination info */ export declare function formatPaginationInfo(hasMore: boolean, cursor?: string | number | null, currentCount?: number): string; /** * Format error list from bulk operations * @param errors - Array of error objects * @returns Formatted error section */ export declare function formatErrorList(errors: Array<{ message?: string; code?: string; key?: string; key_id?: number; }>): string; /** * Format recommendations/next steps list * @param recommendations - Array of recommendation strings * @param title - Section title * @returns Formatted recommendations section */ export declare function formatRecommendations(recommendations: string[], title?: string): string; /** * Format footer timestamp * @param action - Action performed (retrieved, created, etc.) * @param context - Additional context * @returns Formatted footer */ export declare function formatFooter(action?: string, context?: string): string; /** * Format project context section with dashboard links * @param projectId - Project ID * @param sections - Additional sections to include * @returns Formatted project context */ export declare function formatProjectContext(projectId: string, sections?: Array<{ path?: string; label: string; icon?: string; }>): string; /** * Format quick actions section * @param projectId - Project ID * @param actions - Quick action configurations * @returns Formatted quick actions */ export declare function formatQuickActions(projectId: string, actions?: Array<{ path: string; label: string; icon?: string; }>): string; /** * Calculate and format percentage with proper rounding * @param value - Current value * @param total - Total value * @returns Formatted percentage */ export declare function formatPercentage(value: number, total: number): string; /** * Format a truncated text with ellipsis if needed * @param text - Text to truncate * @param maxLength - Maximum length before truncation * @returns Truncated text */ export declare function formatTruncated(text: string, maxLength: number): string;