import type { FailureExitCodeMapper } from './ProcessApplication.ts'; import { type SysExitCode } from './sysExits.ts'; /** Error class matched by `instanceof`; abstract constructors are accepted. */ export type CliErrorClass = abstract new (...args: never[]) => Error; export interface SysExitFailureMapperOptions { /** App error classes mapped to `config` (78), alongside {@link CliConfigError}. */ readonly config?: readonly CliErrorClass[]; /** App error classes mapped to `dataErr` (65), alongside {@link CliDataError}. */ readonly dataErr?: readonly CliErrorClass[]; /** * Exit code for a handler-origin failure no class matched — chain, IO, or * other runtime failures. Defaults to `software` (70). */ readonly fallback?: SysExitCode; /** App error classes mapped to `usage` (64), alongside {@link CliUsageError}. */ readonly usage?: readonly CliErrorClass[]; } /** * Creates the `sysexits.h` failure policy shared by the CLI fleet. * * Every app-level mapper had the same ladder; this factory replaces the * per-app copies: * * - `parse` origin — an unknown command (rejected by `rejectUnknownCommands`), * an unrecognized flag (rejected by `.strictOptions()`), or a bad option * type — → `usage` (64). Parse origin wins over the error type so a * mis-invocation is always usage. * - A mis-invocation the command surface rejects after parsing * ({@link CliUsageError} or an enrolled app class) → `usage` (64) by error * class, so the code does not depend on which check fired first. * - Misconfiguration ({@link CliConfigError} or enrolled) → `config` (78). * - Incorrect input data ({@link CliDataError} or enrolled) → `dataErr` (65). * - Everything else → {@link SysExitFailureMapperOptions.fallback} * (`software`, 70, by default). * * Classes are matched by `instanceof`, so subclasses of the built-in * vocabulary need no enrollment at all. When one error matches several * buckets, evaluation order is usage, then config, then dataErr. */ export declare function createSysExitFailureMapper(options?: SysExitFailureMapperOptions): FailureExitCodeMapper; //# sourceMappingURL=createSysExitFailureMapper.d.ts.map