Skip to main content

Ouro AX

ax-exit-codes

A tool's exit codes as one table: the overview, every command's footer, help --json and the MCP error shape read it, so the numbers never drift. Codes 0, 1 and 2 mean the same thing in every Ouro AX tool.

npx shadcn@latest add ourostack/ouro-ui/ax-exit-codes#v1.3.10

It installs lib/ouro/ax/exit-codes.ts. Its tests are ax-exit-codes-tests. Every item runs on Node 22.18 or later as it is copied: the files import each other as ./<file>.ts. The Ouro AX guide shows how they fit together.

Exports

BASE_EXIT_CODES

const BASE_EXIT_CODES: readonly ExitCode[]

defineExitCodes

The tool's table: the base codes (their meanings may be reworded, never their names) then its own, numbered from 3 with no gaps.

function defineExitCodes(codes?: readonly ExitCode[]): ExitTable

ExitCode

A tool's exit codes as one table: the overview, every command's footer, help --json and the MCP error shape read it, so the numbers never drift. Codes 0, 1 and 2 mean the same thing in every Ouro AX tool.

interface ExitCode {
  code: number;
  name: string;
  short: string;
  meaning: string;
}

ExitTable

interface ExitTable {
  readonly codes: readonly ExitCode[];
  code(name: string): number;
  has(name: string): boolean;
  line(): string;
}

FINDINGS_EXIT_CODE

The code a check or doctor tool declares beside the base codes: its checks ran and found a problem, with a fix beside it. A check that threw before finishing is a crash and exits with the base error code instead, so an agent tells "the tool found something" from "the tool broke" by the code alone.

const FINDINGS_EXIT_CODE: ExitCode