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

plgg-cli

v0.0.1

Published

A plgg-style toolkit for building command-line program wrappers: typed commands, options, argv parsing, and a Result-to-exit-code fold

Readme

plgg-cli

UNSTABLE - Experimental study work. Part of the plgg monorepo.

A plgg-style toolkit for building command-line program wrappers — the commander.js idea done in plgg: declare a program's commands and options as typed data, parse process.argv into a validated Invocation, dispatch to a handler, and fold the handler's Result into a shell outcome (stdout / stderr / exit code) — with an auto-generated usage banner.

Naming, on purpose. Everywhere else in this monorepo "CLI" means a package's own argv→exit-code entrypoint. plgg-cli is the toolkit those entrypoints are built on — it wraps your program as a command-line program. It does not spawn external programs (a spawn/exec library is a separate, future concern).

UNSTABLE / EXPERIMENTAL POC. plgg discipline is non-negotiable: errors as values, expression-only bodies, process touched at exactly one seam, no as/any/@ts-ignore. plgg-cli's only runtime dependency is plgg.

Usage

import { ok, err, getOr, pipe } from "plgg";
import {
  program, command, option, flag,
  optionOf, hasFlag, runCli,
} from "plgg-cli";

const app = program("greet", "a tiny demo CLI", [
  command("hello", "print a greeting", [
    option("name", "who", "who to greet"),
    flag("shout", "upper-case the greeting"),
  ]),
]);

// A handler returns its shell outcome as a value: Ok -> stdout, Err -> stderr + exit 1.
const hello = (inv) =>
  pipe(
    getOr("world")(optionOf("name")(inv)),
    (who) =>
      hasFlag("shout")(inv)
        ? `HELLO, ${who.toUpperCase()}!`
        : `Hello, ${who}.`,
    (line) => Promise.resolve(ok(line)),
  );

// Reads process.argv, dispatches, and folds the Result to the shell.
await runCli(app, { hello });

Design

  • Typed spec, in data. program / command / option / flag build a plain Readonly description; a value-option (option("config", "path")) takes the following token, a boolean flag (flag("watch")) is presence-only.
  • Strict parsing. A value-option with no following token is a MissingOptionValue; an undeclared --flag is an UnknownOption. Both are Box-tagged CliErrors that runCli renders to stderr with a non-zero exit — no silent leniency.
  • One seam. process.argv / stdout / stderr / exitCode live only in seam.ts behind an injectable CliConsole, so the whole run fold is testable with a fake and zero global mutation (runWith).
  • SoftStr, honestly. argv values (and authored spec labels) are the bare SoftStr primitive — argv tokens are genuinely possibly-empty, so branding them Str would be dishonest. Lift to Str with asStr at a call site that actually needs a non-empty guarantee.

License

MIT