Cliffy 1.2.0: fuzzy search, word navigation, and completeOnSubmit
We're happy to announce the release of Cliffy 1.2.0. Select and checkbox prompts support fuzzy search, input prompts understand word navigation and deletion, and autocomplete can accept the highlighted suggestion on submit.
deploy target? Pick a module › strubu❯ structure-builder status-board storefront deno add jsr:@cliffy/prompt@1.2.0
Prompt
Fuzzy search
Long option lists are hard to navigate with arrow keys alone. Select and
checkbox prompts already supported search, and the matching behind it is now a
searchMode option with four strategies:
"substring", a classic contiguous match."fuzzy", the typed characters in order but with gaps allowed, sostrubufindsstructure-builder."typo", tolerating misspellings, sostroberryfindsstrawberry."all", which combines the three and is the default.
So a searchable prompt gets fuzzy and typo matching without asking for it, and
searchMode narrows it to one strategy when you want only that one:
import { Select } from "@cliffy/prompt/select";
const module = await Select.prompt({
message: "Pick a module",
search: true,
searchMode: "fuzzy",
options: ["command", "prompt", "table", "ansi", "keypress"],
});
Substring matches always rank above fuzzy ones, which rank above typo-tolerant ones, so the closest match stays at the top. The same option is available for autocomplete suggestions on input prompts.
completeOnSubmit
Autocomplete prompts can accept whatever is currently highlighted when you press enter, instead of requiring a separate tab first:
import { Input } from "@cliffy/prompt/input";
const branch = await Input.prompt({
message: "Branch",
suggestions: ["main", "develop", "release"],
completeOnSubmit: true,
});
Command
Inherited error handlers
Error handlers now inherit from every ancestor command, not just the immediate parent, so a handler registered on the root command catches errors thrown deep in a subcommand tree.
Fixed in 1.1.1
Shipped in the patch since 1.1.0:
- The
upgradecommand respectsminimum-dependency-ageandmin-release-age. handlare treated as search input when a prompt hassearchenabled, rather than as vim navigation keys.- A type error with Deno 2.8 and newer, caused by the return type of
setIntervalin the upgrade command's spinner, is fixed. It only showed up for anyone type checking their dependencies, withdeno check --allordeno run --check=all.
Acknowledgements
Thank you to everyone who filed the bug reports and questions that shaped this release.
Contributions are welcome. The contributing guide covers how to get started.