Releases: bombshell-dev/clack
@clack/[email protected]
Minor Changes
- 07ca32d: Reverted a change where placeholders were being set as values on return.
@clack/[email protected]
Major Changes
-
c713fd5: The package is now distributed as ESM-only. In
v0releases, the package was dual-published as CJS and ESM.For existing CJS projects using Node v20+, please see Node's guide on Loading ECMAScript modules using
require().
Minor Changes
-
99c3530: Adds
formatoption to the note prompt to allow formatting of individual lines -
0aaee4c: Added new
taskLogprompt for log output which is cleared on success -
729bbb6: Add support for customizable spinner cancel and error messages. Users can now customize these messages either per spinner instance or globally via the
updateSettingsfunction to support multilingual CLIs.This update also improves the architecture by exposing the core settings to the prompts package, enabling more consistent default message handling across the codebase.
// Per-instance customization const spinner = prompts.spinner({ cancelMessage: "Operación cancelada", // "Operation cancelled" in Spanish errorMessage: "Se produjo un error", // "An error occurred" in Spanish }); // Global customization via updateSettings prompts.updateSettings({ messages: { cancel: "Operación cancelada", // "Operation cancelled" in Spanish error: "Se produjo un error", // "An error occurred" in Spanish }, }); // Settings can now be accessed directly console.log(prompts.settings.messages.cancel); // "Operación cancelada" // Direct options take priority over global settings const spinner = prompts.spinner({ cancelMessage: "Cancelled", // This will be used instead of the global setting });
-
44df9af: Adds a new
groupSpacingoption to grouped multi-select prompts. If set to an integer greater than 0, it will add that number of new lines between each group. -
f2c2b89: Adds
AutocompletePromptto core with comprehensive tests and implement bothautocompleteandautocomplete-multiselectcomponents in prompts package. -
c45b9fb: Adds support for detecting spinner cancellation via CTRL+C. This allows for graceful handling of user interruptions during long-running operations.
-
9a09318: Adds new
progressprompt to display a progess-bar -
19558b9: Added support for custom frames in spinner prompt
Patch Changes
- 46dc0a4: Fixes multiselect only shows hints on the first item in the options list. Now correctly shows hints for all selected options with hint property.
- 17342d2: Exposes a new
SpinnerResulttype to describe the return type ofspinner - 6868c1c: Adds a new
selectableGroupsboolean to the group multi-select prompt. UsingselectableGroups: falsewill disable the ability to select a top-level group, but still allow every child to be selected individually. - 7a556ad: Updates all prompts to accept a custom
outputandinputstream - 7cc8a55: Messages passed to the
stopmethod of a spinner no longer have dots stripped. - 2048eb1: Fix spinner's dots behavior with custom frames
- Updated dependencies [729bbb6]
- Updated dependencies [6868c1c]
- Updated dependencies [a4f5034]
- Updated dependencies [c713fd5]
- Updated dependencies [a36292b]
- Updated dependencies [f2c2b89]
- @clack/[email protected]
@clack/[email protected]
Patch Changes
- 11a5dc1: Fixes multiselect only shows hints on the first item in the options list. Now correctly shows hints for all selected options with hint property.
- 30aa7ed: Adds a new
selectableGroupsboolean to the group multi-select prompt. UsingselectableGroups: falsewill disable the ability to select a top-level group, but still allow every child to be selected individually. - Updated dependencies [30aa7ed]
- Updated dependencies [5dfce8a]
- Updated dependencies [f574297]
- @clack/[email protected]
@clack/[email protected]
Patch Changes
- 30aa7ed: Adds a new
selectableGroupsboolean to the group multi-select prompt. UsingselectableGroups: falsewill disable the ability to select a top-level group, but still allow every child to be selected individually. - 5dfce8a: Fixes an edge case for placeholder values. Previously, when pressing
enteron an empty prompt, placeholder values would be ignored. Now, placeholder values are treated as the prompt value. - f574297: Fix "TTY initialization failed: uv_tty_init returned EBADF (bad file descriptor)" error happening on Windows for non-tty terminals.
@clack/[email protected]
Minor Changes
-
613179d: Adds a new
indicatoroption tospinner, which supports the original"dots"loading animation or a new"timer"loading animation.import * as p from "@clack/prompts"; const spin = p.spinner({ indicator: "timer" }); spin.start("Loading"); await sleep(3000); spin.stop("Loaded");
-
a38b2bc: Adds
streamAPI which provides the same methods aslog, but for iterable (even async) message streams. This is particularly useful for AI responses which are dynamically generated by LLMs.import * as p from "@clack/prompts"; await p.stream.step( (async function* () { yield* generateLLMResponse(question); })() );
@clack/[email protected]
Patch Changes
- 8093f3c: Adds
Errorsupport to thevalidatefunction - 98925e3: Exports the
Optiontype and improves JSDocannotations - 1904e57: Replace custom utility for stripping ANSI control sequences with Node's built-in
stripVTControlCharactersutility. - Updated dependencies [8093f3c]
- Updated dependencies [e5ba09a]
- Updated dependencies [8cba8e3]
- @clack/[email protected]
@clack/[email protected]
Patch Changes
- 8093f3c: Adds
Errorsupport to thevalidatefunction - e5ba09a: Fixes a cursor display bug in terminals that do not support the "hidden" escape sequence. See Issue #127.
- 8cba8e3: Fixes a rendering bug with cursor positions for
TextPrompt
@clack/[email protected]
Minor Changes
-
a83d2f8: Adds a new
updateSettings()function to support new global keybindings.updateSettings()accepts analiasesobject 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.
-
801246b: Adds a new
signaloption 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();
-
a83d2f8: Updates default keybindings to support Vim motion shortcuts and map the
escapekey to cancel (ctrl+c).alias action kup lright jdown hleft esccancel
Patch Changes
@clack/[email protected]
Minor Changes
-
a83d2f8: Adds a new
updateSettings()function to support new global keybindings.updateSettings()accepts analiasesobject that maps custom keys to an action (up | down | left | right | space | enter | cancel).import { updateSettings } from "@clack/core"; // 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.
-
801246b: Adds a new
signaloption to support programmatic prompt cancellation with an abort controller. -
a83d2f8: Updates default keybindings to support Vim motion shortcuts and map the
escapekey to cancel (ctrl+c).alias action kup lright jdown hleft esccancel
Patch Changes
- 51e12bc: Improves types for events and interaction states.
@clack/[email protected]
Patch Changes
- Updated dependencies [4845f4f]
- Updated dependencies [d7b2fb9]
- @clack/[email protected]