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

@jsm-mit/cli-game-helpers

v0.1.3

Published

Interactive CLI helpers for menu-driven playground/sandbox tools: arrow-key menus, prompts, confirmations, and canister-error reporting.

Readme

@jsm-mit/cli-game-helpers

Interactive CLI helpers for menu-driven playground/sandbox tools ("CLI games"): arrow-key menus, prompts, confirmations, and canister-error reporting. Extracted from sultana-command-line-playground and the rabbit-motoko-package sandbox, which carried near-identical copies.

Zero runtime dependencies — everything builds on Node's readline.

API

Menu

  • rl — the shared readline/promises interface on stdin/stdout, created on first use (a proxy over getRl(), same object every time). Importing the package never opens stdin or switches the terminal to raw mode, so a script that only needs handleError exits on its own. Close it (rl.close()) when an interactive tool exits.
  • getRl() — the underlying interface itself, for code that needs the real object rather than the proxy.
  • selectOption<T>(prompt, options, labelFn, header?) — interactive arrow-key menu. UP/DOWN cycles, ENTER selects, ESC cancels (returns null), Ctrl+C exits the process. The menu clears and redraws the screen on every keypress — content that should stay visible above it must be passed as header, not printed beforehand. An empty options array returns null immediately.
  • MenuOption — the { label, value } convenience interface.

Prompts

  • ask(prompt, defaultValue?) — asks a question, returns the trimmed answer; an empty answer returns defaultValue when given.
  • confirm(prompt) — yes/no question; " (y/n): " is appended automatically. Only y / yes (any case) count as yes.
  • pause(message?) — blocks until Enter; default message "\nPress Enter to continue...".

Reporting

  • handleError(error) — prints a canister-shaped error: the message, then errorKey / errorMessage / a logs table from error.cause.
  • nsToIso(ns) — bigint nanosecond timestamp (canister time) → ISO string; undefined renders as "-".

Usage

import { rl, selectOption, ask, confirm, pause } from "@jsm-mit/cli-game-helpers";

const action = await selectOption("=== MENU ===", actions, (a) => a.label);
if (action) {
    const name = await ask("Name: ", "default");
    if (await confirm(`Create '${name}'?`)) {
        // ... do the thing
    }
    await pause("\nPress Enter to return to menu...");
}
rl.close();

Development

  • npm test — vitest.
  • npm run sandbox — interactive demo (sandbox/main.ts).
  • npm run build — compile src/ to dist/.