<!-- Generated by scripts/ax-docs.mts from the JSDoc in registry/ouro/ax/. Do not edit; run `pnpm run docs`. -->

# ax-settings

One setting as the manifest declares it: a name, what it does, the values it takes and the one it starts at. The manifest is plain JSON, so a Node CLI and an engine CLI in another language read the same file.

```sh
npx shadcn@latest add ourostack/ouro-ui/ax-settings#v1.3.823
```

It installs `lib/ouro/ax/settings.ts`, with `ax-problem`. Its tests are `ax-settings-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](ax.md) shows how they fit together.

## Exports

### `defineSettings`

One declaration of a tool's settings that its CLIs read, so help, status and a refusal come from the same place. Pass the parsed manifest; a malformed one throws when the tool starts, not in an agent's run.

```ts
function defineSettings(manifest: SettingsManifest): SettingsTable
```

Example:

```ts
const settings = defineSettings(JSON.parse(readFileSync("settings.json", "utf8")));
settings.check("sending", "on");
```

### `SettingDeclaration`

One setting as the manifest declares it: a name, what it does, the values it takes and the one it starts at. The manifest is plain JSON, so a Node CLI and an engine CLI in another language read the same file.

```ts
interface SettingDeclaration {
  name: string;
  about: string;
  values: readonly string[];
  default: string;
}
```

### `SettingsManifest`

The JSON a tool ships once: `{ "settings": [ { "name", "about", "values", "default" } ] }`.

```ts
interface SettingsManifest {
  settings: readonly SettingDeclaration[];
}
```

### `SettingsTable`

```ts
interface SettingsTable {
  readonly settings: readonly SettingDeclaration[];
  get(name: string): SettingDeclaration;
  check(name: string, value: string): string;
  lines(current?: Readonly<Record<string, string>>): string[];
}
```
