@pokit/terminal

@pokit/terminal is the default terminal UI for pok CLIs, built on clack. It bundles the three UI surfaces — reporter (event rendering), prompter (interactive input), and navigator (menu presentation policy) — behind a single factory, so an app wires them in with one call.

Installation

bun add @pokit/terminal

@pokit/core is a peer dependency.

Zero-config

You usually do not import @pokit/terminal directly. When your pok.config.ts omits reporter, prompter, or navigator, the pok launcher resolves @pokit/terminal from your project and wires in its defaults automatically:

import { defineConfig } from '@pokit/core';

export default defineConfig({});

The launcher also uses these defaults in fallback mode — when a repo has a package.json but no pok.config.ts.

createTerminalUI

import { createTerminalUI } from '@pokit/terminal';

const { reporter, prompter, navigator } = createTerminalUI();

Signature

function createTerminalUI(options?: TerminalUIOptions): TerminalUI;

type TerminalUIOptions = {
  /** When true, logs are displayed immediately instead of being buffered during spinners. */
  verbose?: boolean;
  /** Output configuration (color, unicode, interactive). Detected from args/env when omitted. */
  output?: OutputConfig;
};

type TerminalUI = {
  reporter: ReporterAdapter;
  prompter: Prompter;
  navigator: Navigator;
};

All three surfaces share a single screen, so loading indicators and rendering are owned in one place.

Passing options explicitly

Only construct the UI yourself when you need to pass options. Spread the result into your config:

import { defineConfig } from '@pokit/core';
import { createTerminalUI } from '@pokit/terminal';

export default defineConfig({
  ...createTerminalUI({ verbose: true }),
});

Surfaces

SurfaceTypeRole
reporterReporterAdapterSubscribes to the event bus and renders spinners, groups, and logs.
prompterPrompterInteractive select, multiselect, confirm, text, and autocomplete.
navigatorNavigatorMenu presentation policy: breadcrumbs, choose/back/exit, up-navigation on cancel.