Terminal prompts that promote to native GUI dialogs when a TTY has a desktop; always echo prompt text for pipes/AI.
Explore the docs
Report Bug
·
Request Feature
Enhanced terminal UI that promotes confirmations and text prompts to native Windows dialogs when the process has a TTY and GUI. The prompt text is always written to stdout so that piped output (e.g. to an AI or log) still shows the question—only the input is promoted to a modal when possible.
Part of OpenShellOrg.
CLI tools often ask for y/n or a line of text. In an interactive Windows terminal with a GUI, users can instead get a native dialog with a default (e.g. "Yes") so that pressing Enter confirms without typing.
pnpm add terminal-gui-promptsimport { confirm, confirmBoolean } from "terminal-gui-prompts";
const answer = await confirm({
message: "Delete all files in this folder?",
title: "Confirm delete",
default: "yes",
});
if (answer === "y") doDelete();
const ok = await confirmBoolean({ message: "Continue?" });import { prompt } from "terminal-gui-prompts";
const name = await prompt({
message: "Enter your name",
title: "User",
default: "Guest",
});-
Always: the
messageis written to stdout (so pipes and logs see the question). -
On Windows, with a TTY and no
forceTerminal: a native dialog is shown. -
Otherwise: a normal terminal prompt is used.
Use forceTerminal: true to always use the terminal, e.g. in scripts.
Adapters for @inquirer/prompts and Enquirer are available. See examples and published docs: https://openshellorg.github.io/docs/terminal-gui-prompts/
-
confirm(options)→Promise<"y" | "n"> -
confirmBoolean(options)→Promise<boolean> -
prompt(options)→Promise<string> -
canUseWindowsGui()→boolean
See CHANGELOG.adoc.
MIT — see LICENSE.
Open Shell Org — openshell@devcentr.org