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

cheetor

v0.15.0

Published

Build interactive command line tools

Readme

cheetor

Build interactive command line tools.

npm github node

Installation

npm install cheetor --save

Usage

import { readFileSync } from 'node:fs';
import { Cheetor } from 'cheetor';

const pkg = JSON.parse(
  readFileSync(new URL('../package.json', import.meta.url), 'utf8')
);

new Cheetor(pkg).setup();

Commands

command() registers a top-level command. cheetor builds on commander, which matches a real command tree, so subcommands nest directly with no folding. Declare the tree with a builder callback (yargs-style): command() always returns the Cheetor instance, and each level receives its own node to configure.

new Cheetor(pkg, new URL('./', import.meta.url))
  .command('deploy', 'Deploy things', (deploy) => {
    deploy.option('-e, --env <env>', 'Target environment');

    deploy.command('rollout <name>', 'Rollout a service', (rollout) => {
      rollout.option('-f, --fast', 'Fast rollout').action((name, options) => {
        console.log(`env=${options.env} name=${name} fast=${options.fast}`);
      });
    });
  })
  .setup();
$ mycli deploy rollout api --env prod --fast
env=prod name=api fast=true

A parent's option can be passed after a subcommand token (note --env prod above) and is read through Commander's merged option view.

Running a node that only has children (no action) prints them:

$ mycli deploy
Available subcommands: rollout

That same parent's -h lists its subcommands under a Commands: section.

Nodes

Every node inside a builder callback exposes:

  • command(name, description?, builder?) — add a child. name may carry positionals, e.g. rollout <name> or rm [file].
  • option(name, description?, config?) — add an option, declared on this node only. Descendants reach an ancestor's option through Commander's option inheritance (optsWithGlobals()): an explicitly passed value applies where it is read, while a flag that is not set resolves to the shallowest ancestor that declares a default.
  • action(fn) — set the handler, called as fn(...positionals, options).
  • alias(name) — an alternate name that routes to this command.
  • description(text) — set or change the description.

config is { default } — it sets the option's default value.

Command modules

A command can also be registered from a module object, or loaded from a file path.

type Module = {
  command?: string;
  describe?: string;
  options?: Array<[name: string, description: string, config?: object]>;
  action?: (...args: unknown[]) => unknown;
};

| Method | Behaviour | | -------------------- | ----------------------------------------------------------------------------------- | | command(module) | Register a Module object passed inline. | | commandFrom(path) | Import the module at path and register it. Throws if missing. | | commandSafe(path) | Like commandFrom, but silently skips the command when the module cannot be found. | | commandSmart(func) | Register whatever func() returns; no-op when it returns undefined. |

path is resolved against the second constructor argument (root), which must be a directory URL. Use new URL('./', import.meta.url) — not a bare import.meta.url (that is the entry file, so a ./ path would resolve beneath it and fail).

new Cheetor(pkg, new URL('./', import.meta.url))
  .command({
    command: 'build',
    describe: 'Build the project',
    action: () => {}
  })
  .commandFrom('./commands/serve.mjs')
  .commandSafe('./commands/optional.mjs')
  .commandSmart(() =>
    process.env.SECRET
      ? { command: 'secret', describe: 'Secret command', action: () => {} }
      : undefined
  )
  .setup();

Setup

setup() finalizes registration and parses process.argv. Pass an action to run instead of the default parse result:

await new Cheetor(pkg, new URL('./', import.meta.url)).setup((parsed) => {
  console.log(parsed);
});