Packages

@clack/prompts

1.9.0 · 9 Nov 2026MIT48.7M / weekRepositoryHomepagenpmAtom feed

Your version

0.9.0

19 Dec 2024Where it was published

0.11.0 is the newest release of 0.9.x.

In short

3 new1 fixed1 internal

Release note

Minor Changes

  • Adds a new updateSettings() function to support new global keybindings.

    updateSettings() accepts an aliases object that maps custom keys to an action (up | down | left | right | space | enter | cancel).

    import { updateSettings } from "@clack/prompts";
    
    // Support custom keybindings
    updateSettings({
      aliases: {
        w: "up",
        a: "left",
        s: "down",
        d: "right",
      },
    });

Warning

In order to enforce consistent, user-friendly defaults across the ecosystem, updateSettings does not support disabling Clack's default keybindings.

  • Adds a new signal option to support programmatic prompt cancellation with an abort controller.

    One example use case is automatically cancelling a prompt after a timeout.

    const shouldContinue = await confirm({
      message: "This message will self destruct in 5 seconds",
      signal: AbortSignal.timeout(5000),
    });

    Another use case is racing a long running task with a manual prompt.

    const abortController = new AbortController();
    
    const projectType = await Promise.race([
      detectProjectType({
        signal: abortController.signal,
      }),
      select({
        message: "Pick a project type.",
        options: [
          { value: "ts", label: "TypeScript" },
          { value: "js", label: "JavaScript" },
          { value: "coffee", label: "CoffeeScript", hint: "oh no" },
        ],
        signal: abortController.signal,
      }),
    ]);
    
    abortController.abort();
  • Updates default keybindings to support Vim motion shortcuts and map the escape key to cancel (ctrl+c).

    aliasaction
    kup
    lright
    jdown
    hleft
    esccancel

Patch Changes

  • Adapts spinner output for static CI environments

A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.