Skip to content

⌨️ @reliverse/prompts: A modern, type-safe, crash-resistant library for creating seamless, typesafe prompts in CLI applications. Designed for simplicity and elegance, it enables intuitive and robust user interactions.

License

Notifications You must be signed in to change notification settings

reliverse/prompts

Repository files navigation

@reliverse/prompts

docs | npmjs.com | github.com

  • A single library to build the entire command line interface application.
  • A modern, crash-resistant library for creating seamless, typesafe prompts in CLI applications.
  • Designed for simplicity and elegance, it enables intuitive and robust user interactions.

example prompt

Installation

Install via your preferred package manager:

bun add @reliverse/prompts # instead of bun you can use: npm, pnpm, or yarn (deno support is coming soon)

confirm prompt

Key Features

  • Type Safety: Built with TypeScript, ensuring robust types and preventing runtime errors.
  • Schema Validation: Define and validate inputs using schemas for reliable data handling.
  • Flexibility: Supports various prompt types including text, password, number, select, and multiselect.
  • Crash Resilience: Structured to handle cancellations and errors gracefully, keeping your application stable.

Prompt Types

  • Text: Simple text input.
  • Password: Secure, hidden input for passwords.
  • Number: Numeric input with validation.
  • Confirm: Yes/No prompt.
  • Select: Dropdown selection from multiple choices.
  • Multiselect: Multiple choice selection from a list.

Validation

Each prompt can include custom validation logic to provide immediate feedback to the user.

Playground

Install the @reliverse/prompts library locally and run the following examples to see the library in action. Alternatively, you can just visit the following links to see the code:

  1. bun dev:id - examples/reliverse/install-deps.ts - An advanced example of a CLI that installs dependencies. Trying to create a drop-in replacement for @clack/prompts, unjs/consola, @inquirer/prompts, terkelg/prompts, withastro/astro, etc.
  2. bun dev:us - examples/reliverse/user-signup.ts - An advanced example of a CLI application that simulates a user signup process.
  3. bun dev:wm - examples/reliverse/win-mln-js.ts - A fun example of a quiz game. Inspired by this video created by Fireship.
  4. bun dev:sc - examples/reliverse/simple-check.ts - Just a very basic example to check the library.

Installing Locally

clone https://github.com/reliverse/prompts.git
cd prompts
bun i

About

⌨️ @reliverse/prompts: A modern, type-safe, crash-resistant library for creating seamless, typesafe prompts in CLI applications. Designed for simplicity and elegance, it enables intuitive and robust user interactions.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published