/** * CLI utilities — argument parsing, color parsing, and frame processing helpers. * * These helpers are intentionally framework-free so the CLI inherits the * zero-dependency posture of the library itself. */ import { RGBColor, ImageData } from '../types.js'; import { GifResult } from '../gif-result.js'; /** Error class for user-facing CLI failures (bad flags, missing input, etc). */ export declare class CliError extends Error { constructor(message: string); } /** Result of parsing CLI argv. */ export interface ParsedArgs { positional: string[]; options: Map; } export declare function parseArgs(argv: string[]): ParsedArgs; export declare function getString(args: ParsedArgs, ...keys: string[]): string | undefined; export declare function requireString(args: ParsedArgs, ...keys: string[]): string; export declare function getNumber(args: ParsedArgs, ...keys: string[]): number | undefined; export declare function requireNumber(args: ParsedArgs, ...keys: string[]): number; export declare function getInt(args: ParsedArgs, ...keys: string[]): number | undefined; export declare function requireInt(args: ParsedArgs, ...keys: string[]): number; export declare function getBool(args: ParsedArgs, ...keys: string[]): boolean; export declare function getChoice(args: ParsedArgs, keys: string[], choices: readonly T[]): T | undefined; /** * Parses a color string. Accepts: * - "r,g,b" e.g. "255,0,0" * - "#rrggbb" e.g. "#ff0000" * - "#rgb" e.g. "#f00" */ export declare function parseColor(input: string): RGBColor; export declare function getColor(args: ParsedArgs, ...keys: string[]): RGBColor | undefined; /** Parses "color1;color2;..." (semicolons because commas separate RGB). */ export declare function getColorList(args: ParsedArgs, ...keys: string[]): RGBColor[] | undefined; /** Reads a file into a Uint8Array, surfacing a friendly error if it's missing. */ export declare function readGifFile(path: string): Promise; /** Ensures the parent directory of `outputPath` exists before writing. */ export declare function ensureParentDir(outputPath: string): Promise; /** * Reads a GIF, applies a per-frame transform, and writes the result. * * For single-frame GIFs the output is a static GIF; for animated GIFs the * original delays and loop count are preserved. */ export declare function processGifFrames(inputPath: string, outputPath: string, transform: (frame: ImageData) => ImageData, options?: { maxColors?: number; }): Promise; /** Formats a byte count for human display ("1.5 KB"). */ export declare function formatBytes(bytes: number): string;