/** * Output formatters for diagnostic commands. * * Provides human-readable formatting for `weft doctor` and `weft version:check` * reports, plus utility functions for byte sizes and durations. * * @module diagnostics/format */ import type { DiagnosticReport, VersionCheckReport } from './types.ts'; /** * Format a byte count into a human-readable string. * * - 0 returns '0 B' * - Values under 1024 return '{n} B' * - Values under 1024^2 return '{n} KB' (1 decimal place) * - Values under 1024^3 return '{n} MB' (1 decimal place) * - Otherwise returns '{n} GB' (1 decimal place) * * @example * ```ts * import { formatBytes } from '@lostgradient/weft'; * * console.log(formatBytes(0)); // '0 B' * console.log(formatBytes(1024)); // '1.0 KB' * console.log(formatBytes(1048576)); // '1.0 MB' * ``` */ export declare function formatBytes(bytes: number): string; /** * Format a duration in milliseconds into a human-readable string. * * - Under 1000ms: '{n}ms' * - Under 60000ms: '{n} seconds' (rounded) * - Under 3600000ms: '{n} minutes' (rounded) * - Under 86400000ms: '{n} hours' optionally with minutes * - Otherwise: '{n} days' optionally with hours * * @example * ```ts * import { formatDuration } from '@lostgradient/weft'; * * console.log(formatDuration(500)); // '500ms' * console.log(formatDuration(90000)); // '2 minutes' * console.log(formatDuration(7200000)); // '2 hours' * ``` */ export declare function formatDuration(milliseconds: number): string; /** * Format a DiagnosticReport into a human-readable multi-section string. * * @example * ```ts * import { MemoryStorage, collectDiagnostics, formatDiagnosticReport } from '@lostgradient/weft'; * * await using storage = new MemoryStorage(); * const report = await collectDiagnostics(storage, ':memory:'); * console.log(formatDiagnosticReport(report)); * ``` */ export declare function formatDiagnosticReport(report: DiagnosticReport): string; /** * Format a VersionCheckReport into a human-readable string. * * @example * ```ts * import type { VersionCheckReport } from '@lostgradient/weft'; * import { formatVersionCheckReport } from '@lostgradient/weft'; * * const report: VersionCheckReport = { * workflowTypes: [], * overallVerdict: 'safe', * }; * console.log(formatVersionCheckReport(report)); * // Result: safe to deploy. * ``` */ export declare function formatVersionCheckReport(report: VersionCheckReport): string;