import { KokoroDevice, KokoroDtype } from '../core/kokoro-node'; import { MarkdownToSpeechOptions } from '../utils/markdown-to-speech'; import { RequestedFormat } from './document'; import { RenderOptions } from './render'; export type CliCommand = "speak" | "print" | "help" | "version" | "list-voices"; export interface CliOptions { command: CliCommand; /** Input path, or `-` for stdin. Undefined when `text` is set. */ input?: string; /** Literal text passed with `--text`. */ text?: string; output?: string; format: RequestedFormat; voice: string; speed: number; model?: string; dtype?: KokoroDtype; device?: KokoroDevice; maxChunkLength?: number; gapMs?: number; markdown: MarkdownToSpeechOptions; quiet: boolean; /** Everything wrong with the command line. Non-empty means do not run. */ errors: string[]; } export interface CliIO { /** Writes a line to stdout. */ log?: (line: string) => void; /** Writes a line to stderr — progress and errors go here so `-o -` stays clean. */ error?: (line: string) => void; /** Overrides synthesis, for tests. */ synthesize?: RenderOptions["synthesize"]; /** Overrides reading stdin, for tests. */ readStdin?: () => Promise; /** Whether stdin is a terminal. When false and no input is given, stdin is read. */ stdinIsTTY?: boolean; } export declare const USAGE = "use-voice-control \u2014 read a Markdown or text file aloud into an audio file\n\nUsage\n npx use-voice-control [options]\n npx use-voice-control --text \"Hello there\" -o hello.wav\n cat notes.md | npx use-voice-control - -o notes.wav\n\nMarkdown is converted before it is spoken: \"#\", \"**\" and the rest are not read\nout, headings become their own spoken lines, links keep their text, and fenced\ncode blocks are announced instead of being spelled out.\n\nInput\n File to read. Use \"-\" to read stdin.\n --text Speak this string instead of reading a file.\n -f, --format auto (default), markdown, or text.\n\nOutput\n -o, --out Audio file to write. Default: the input path with a\n .wav extension. Use \"-\" to write the WAV to stdout.\n -p, --print Print the speakable text and exit \u2014 no model, no audio.\n Useful for checking the Markdown conversion.\n -q, --quiet No progress output.\n\nVoice\n -v, --voice Voice id. Default af_heart. See --list-voices.\n -s, --speed Speaking rate, 0.5-2. Default 1.\n --list-voices Print the available voices and exit.\n\nMarkdown handling\n --headings text (default) | announce | skip\n --code announce (default) | read | skip\n --links text (default) | text-and-url\n --tables rows (default) | skip\n --front-matter Read the YAML front matter instead of skipping it.\n\nModel\n --model Hugging Face model id.\n Default onnx-community/Kokoro-82M-v1.0-ONNX.\n --dtype fp32 | fp16 | q8 (default) | q4 | q4f16\n --device cpu (default) | wasm | webgpu\n --chunk Target characters per synthesis chunk. Default 400.\n --gap Silence between chunks. Default 120.\n\nOther\n -h, --help Show this help.\n -V, --version Print the package version.\n\nThe first run downloads the Kokoro weights (about 90 MB at the default q8) into\nthe Hugging Face cache; later runs are offline. Speech is synthesized locally \u2014\nno text leaves the machine."; /** * Parses the command line. Pure: it reads nothing and writes nothing, so the * tests can assert on the whole option set. */ export declare function parseArgs(argv: string[]): CliOptions; /** The `--list-voices` table, derived from the ids so it cannot drift. */ export declare function formatVoiceList(): string; /** * Runs the command line and resolves to the process exit code. * * @param argv Arguments after the executable and script, i.e. `process.argv.slice(2)`. * @param io Injection points for output, stdin and synthesis. */ export declare function runCli(argv: string[], io?: CliIO): Promise;