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

# ax-example

A small tool built only from the kit, for the tests and as the pattern to copy: commands of both effects, an action that returns an outcome with a preview, a wait on a room, an ambiguous word, a tool-specific exit code and a voice.

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

It installs `lib/ouro/ax/example-cli.ts`, with `ax-command`, `ax-effects`, `ax-exit-codes`, `ax-outcome`, `ax-problem`, `ax-wait`. Its tests are `ax-example-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

### `exampleCli`

```ts
const exampleCli: Cli<RunContext>
```

### `exits`

A small tool built only from the kit, for the tests and as the pattern to copy: commands of both effects, an action that returns an outcome with a preview, a wait on a room, an ambiguous word, a tool-specific exit code and a voice.

```ts
const exits: ExitTable
```

### `postMessage`

Someone posts in a room (the tests use it to answer a wait).

```ts
function postMessage(ref: string, by: string, text: string): void
```

### `resetRooms`

Puts the toy's one room back as it started.

```ts
function resetRooms(): void
```

### `rooms`

```ts
const rooms: Record<string, { title: string; members: string[]; notes: string[]; messages: AxEvent[] }>
```

### `setClock`

Sets the clock the toy stamps messages and receipts with: tests pass a fixed one, and `setClock()` puts back the real one.

```ts
function setClock(now?: () => Date): void
```
