# Coming from inquirer

> An inquirer alternative for prompts that never hang: caique/inquirer carries @inquirer/core's surface, graded 41 / 41 by its own suite — and caique's prompts are flags first, so a non-TTY caller gets an error naming the flag instead of a hang.

Source: https://caique.interlace.tools/docs/coming-from/inquirer

**caique** is an **inquirer alternative** built on one rule: a prompt is a flag first. Its
drop-in path, `caique/inquirer`, carries `@inquirer/core`'s surface — the layer every
`@inquirer/prompts` prompt is built on — for CLIs that write their prompts against it.

## Migrate from inquirer in one import

```diff
- import { createPrompt, useState, useKeypress, isEnterKey } from '@inquirer/core';
+ import { createPrompt, useState, useKeypress, isEnterKey } from 'caique/inquirer';
```

The same render functions, hooks (`useState`, `useEffect`, `useRef`, `useMemo`,
`useKeypress`, `usePrefix`), `Separator`, theme helpers and error classes keep working.

**What is not covered.** The legacy `inquirer.prompt([...])` object API — the `inquirer`
package itself — is out of scope: its own maintainer moved off it, and its npm tarball ships
no tests to grade against. `@inquirer/core`'s `usePagination` is not implemented yet and is
named as a gap in caique's spec.

## Is caique compatible with inquirer?

Graded against `@inquirer/core`, where the prompt loop — the keypress state machine both
inquirer façades sit on — is actually tested. Its suite, vendored at 12.0.3 and unmodified
apart from the import specifier, runs against `caique/inquirer` beside a control that runs it
against the real package:

| | passing | rate |
| :-- | --: | --: |
| `caique/inquirer` | 41 / 41 | 100.0% |
| `@inquirer/core` itself (control) | 41 / 41 | 100.0% |

From [Compatibility](https://burgee.interlace.tools/docs/compatibility), which `npm run compat:page` generates from the
oracle's last run; that page is the authority. There is **no graded row for the legacy
`inquirer` package**, for the reason above. The 41 grade the loop, not the drawing.

## What you gain over inquirer

A prompt that waits for a human who is not there is a hang, and a hung agent is a failed
task. caique's own API — `caique/decide`, `caique/ask`, `caique/binding` — declares each
prompt as an option first:

- **An agent answers before it is asked.** A caller who passes the flag is never prompted.
- **No terminal is never a prompt.** With nobody to ask, `decide()` returns an error naming
  the flag and the fix — `--output-dir is required when there is no terminal` — rather than
  waiting on stdin.
- **Checked exhaustively.** All 256 combinations of value, kind, TTY, CI, `--json`, `--yes`,
  `--interactive` and required are generated and checked in `decide.test.ts`.
- **Line mode is the floor.** No raw mode, no cursor movement, no redraw — so the accessible
  rendering and the terminal rendering are the same bytes. A closed stdin is a cancellation,
  not an empty answer.

`caique/inquirer` is the door; the flags-first API is where those properties live.

## When to switch from inquirer

- Your CLI runs in CI, in a container or under an agent, and a prompt there must fail fast.
- You want every prompt answerable from the command line.

The rule, the widgets and the clack path are on [caique](/docs).
