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

@tsed/cli-prompts

v7.9.1

Published

Prompt runner and schema shared across Ts.ED CLIs

Readme

@tsed/cli-prompts

Build & Release TypeScript

Ts.ED’s prompt runner, powered by @clack/prompts, with a declarative schema shared across every CLI package.

Goals

@tsed/cli-prompts extracts the reusable prompt subsystem that used to live in @tsed/cli-core. The package owns:

  • The canonical PromptQuestion schema used by command providers and template generators.
  • A PromptRunner service that evaluates when guards, resolves defaults, and dispatches to prompt handlers.
  • A Clack-based implementation of every prompt type Ts.ED commands rely on (input, password, confirm, list, checkbox, autocomplete).
  • Consistent cancellation/Error handling via PromptCancelledError.

Shipping this as a standalone package lets other workspaces (and downstream CLIs) reuse the exact same behavior without duplicating abstractions or third-party dependencies.

Installation

npm install @tsed/cli-prompts @tsed/core @tsed/di

@tsed/di is required because the prompt runner is an injectable service.

Features

  • Clack UX: Interactively renders all prompts via @clack/prompts (selects, multiselects, autocomplete loops, password masking, etc.).
  • Declarative schema: Define questions with the standard Ts.ED structure (name, type, message, choices, default, when, validate, filter, transformer).
  • Async autocomplete: Built-in support for searchable lists using the source(answers, keyword) contract used by tsed add, tsed generate, and MCP tooling.
  • Cancellation safety: ensureNotCancelled() converts Ctrl+C / ESC exits into a thrown PromptCancelledError, allowing CLI hosts to render a friendly message and abort.
  • Transformer & validation helpers: All handlers consistently run transformer, filter, and validate hooks before finalizing the answer.

Getting started

When you build a CLI that uses @tsed/cli-core, the prompt runner is already injected for you. To use it directly, register it inside your DI context:

import {CliPlatformTest} from "@tsed/cli-testing";
import {PromptRunner, PromptQuestion} from "@tsed/cli-prompts";

await CliPlatformTest.create();
const runner = await CliPlatformTest.invoke<PromptRunner>(PromptRunner);

const questions: PromptQuestion[] = [
  {
    type: "input",
    name: "packageName",
    message: "Package name",
    validate(value) {
      return value ? true : "Package name is required";
    }
  },
  {
    type: "autocomplete",
    name: "feature",
    message: "Choose a feature",
    source: async (_answers, keyword = "") => {
      return ["cli-core", "cli-prompts", "cli-mcp"].filter((entry) => entry.includes(keyword)).map((value) => ({name: value, value}));
    }
  }
];

const answers = await runner.run(questions);
console.log(answers);

📚 Want a larger multi-step flow? See docs/examples/cli/prompts-command-decorators.ts or the CLI prompts guide for a production-style walkthrough that stays in sync with this repository.

Supported question types

| Type | Description | | -------------- | -------------------------------------------------------- | | input | Free-form text entry with optional transform/validation. | | password | Hidden input with customizable mask characters. | | confirm | Boolean yes/no selection. | | list | Single-select list rendered with Clack’s select. | | checkbox | Multi-select list rendered with multiselect. | | autocomplete | Searchable list that re-queries a source function. |

Every question can declare when guards, default values (including functions that read previous answers), pageSize, and choices metadata (name, value, short, checked, disabled).

Handling cancellations

Ctrl+C and ESC bubble up as PromptCancelledError. Catch it at the application boundary (as CliCore does) if you need custom messaging:

import {PromptRunner, PromptCancelledError} from "@tsed/cli-prompts";

try {
  await runner.run(questionList);
} catch (er) {
  if (er instanceof PromptCancelledError) {
    console.log("Prompt cancelled by the user.");
    process.exit(0);
  }
  throw er;
}

Contributors

Please read contributing guidelines here

Backers

Thank you to all our backers! 🙏 [Become a backer]

Sponsors

Support this project by becoming a sponsor. Your logo will show up here with a link to your website. [Become a sponsor]

License

The MIT License (MIT)

Copyright (c) 2016 - Today Romain Lenzotti

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.