npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@hyperfrontend/questions

v0.2.0

Published

Terminal prompting library with composable, functional API for text, select, confirm, and multiselect prompts

Downloads

219

Readme

@hyperfrontend/questions

Terminal prompting library with composable, functional API for text, select, confirm, and multiselect prompts

• 👉 See documentation

What is @hyperfrontend/questions?

A terminal prompting library built on functional programming principles. Create interactive CLI experiences with composable, type-safe prompts that return structured outcomes.

Key Features

  • Pure Functions — Every prompt is a pure function returning Promise<PromptOutcome<T>>, making results predictable and easily testable
  • Composable API — Build complex interactive flows by combining simple prompt functions
  • Type-Safe — Full TypeScript support with discriminated unions for prompt outcomes
  • Zero External Dependencies — Uses only Node.js built-ins and @hyperfrontend utilities
  • Searchable Multiselect — Type-to-filter functionality for large option lists

Architecture Highlights

Each prompt follows a functional state machine pattern:

  • Immutable State — All prompt state is frozen; updates create new state objects
  • Explicit Outcomes — Prompts return either { result: 'submitted', value: T } or { result: 'cancelled', value: undefined }
  • Terminal Abstraction — Low-level I/O is encapsulated in a Terminal interface for testability

Why Use @hyperfrontend/questions?

When building CLI tools, you need interactive prompts that are:

  1. Predictable — Know exactly what a prompt returns, always
  2. Composable — Chain prompts without callback hell
  3. Cancellable — Handle Ctrl+C gracefully with structured cancellation
  4. Lightweight — No large dependency trees for simple prompts

This library provides all four while staying true to functional programming principles.

Installation

npm install @hyperfrontend/questions

Quick Start

import { text, confirm, select, multiselect, PromptResult } from '@hyperfrontend/questions'

// Text input
const nameResult = await text({
  message: 'What is your name?',
  validate: (value) => (value.length < 2 ? 'Name too short' : undefined),
})

if (nameResult.result === PromptResult.Submitted) {
  console.log(`Hello, ${nameResult.value}!`)
}

// Text input with a live label — `renderMessage` is recomputed on every keystroke
import { style } from '@hyperfrontend/questions'

await text({
  message: 'Title:',
  renderMessage: (value) => {
    const left = 72 - value.length
    return `Title (${left >= 0 ? style.green(`${left} left`) : style.red(`${-left} over`)}):`
  },
})

// Confirmation
const continueResult = await confirm({
  message: 'Continue?',
  initial: true,
})

// Single select
const colorResult = await select({
  message: 'Pick a color:',
  choices: [
    { label: 'Red', value: 'red' },
    { label: 'Green', value: 'green', hint: 'recommended' },
    { label: 'Blue', value: 'blue' },
  ],
})

// Multiselect with search
const featuresResult = await multiselect({
  message: 'Select features:',
  choices: [
    { label: 'TypeScript', value: 'ts' },
    { label: 'ESLint', value: 'eslint' },
    { label: 'Prettier', value: 'prettier' },
  ],
  searchable: true,
  min: 1,
})

API Overview

| Function | Description | | -------------- | ----------------------------------------------------------------------------- | | text | Free-form text input with optional validation and live-updating labels | | confirm | Yes/no confirmation prompt | | select | Single selection from a list of choices | | multiselect | Multiple selections with optional search | | style | ANSI colour helpers (green, yellow, red, cyan, bold, dim, gray) | | PromptResult | Discriminated union: 'submitted' \| 'cancelled' |

All prompts return Promise<PromptOutcome<T>> where:

type PromptOutcome<T> = { result: 'submitted'; value: T } | { result: 'cancelled'; value: undefined }

Compatibility

| Environment | Supported | | -------------- | --------- | | Node.js >= 18 | ✅ | | TTY Terminal | ✅ | | Tree Shakeable | ✅ |

License

MIT