Skip to content

Concepts

Cli detects interactivity from TTY input and output unless the caller passes interactive. It accepts optional input, output, and terminal width so a host can control where prompts and messages go. welcome, info, step, outro, cancel, task, and checklist provide shared presentation. A task stops its spinner on success. A failed task rethrows the original error. When a spinner is active, it displays a generic failure message without error details.

In noninteractive mode, ordinary messages are written as text and confirm returns false. text, password, select, and search throw because they require an interactive terminal. task reports progress as plain lines instead of animating a spinner.

search accepts ordered choices with labels, descriptions and optional group names. It displays group headings and can collapse one group behind a counted disclosure row. Typing searches every choice, including collapsed choices. Enter expands the disclosure or selects a choice. Callers own the catalog and group membership. Clack owns input, navigation and cancellation.

renderBanner is the browser-safe rendering entrypoint. It chooses a brand’s wide or compact art for interactive terminals, and a plain brand label for piped or no-color output. Widths below 60 columns use compact art. Set rawPty: true when writing directly to a raw pseudo-terminal to receive CRLF line endings.