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

@bunizao/cli-kit

v0.1.0

Published

Shared command-line contract for Bunizao CLI tools

Readme

@bunizao/cli-kit

Small shared primitives for the ontrack, moodle, and edstem command-line tools. The package owns their stable command contract: verbs, error codes, exit codes, output formats, mutation confirmation, and command self-description.

Install

npm install https://codeload.github.com/bunizao/cli-kit/tar.gz/refs/tags/v0.1.0 commander

After the registry release, consumers can switch to the versioned package:

npm install @bunizao/cli-kit commander

Node.js 18 or newer is supported. Individual CLIs may require a newer runtime.

Program setup

import {
  commandsJson,
  createProgram,
  insertDefaultVerb,
  mutating,
  type NounSpec,
} from "@bunizao/cli-kit";

const program = createProgram({
  name: "example",
  version: "1.0.0",
  description: "Example CLI",
});

const units = program.command("units").aliases(["courses", "projects"]);
units.command("list").action(listUnits);
units.command("show <unit>").action(showUnit);
mutating(units.command("set <unit> <state>")).action(setUnitState);

const nouns: readonly NounSpec[] = [
  {
    name: "units",
    aliases: ["courses", "projects"],
    verbs: ["list", "show", "set"],
    defaultByArity: { 0: "list", 1: "show" },
    valueFlags: [],
  },
];

const args = insertDefaultVerb(process.argv.slice(2), nouns);
await program.parseAsync(args, { from: "user" });

insertDefaultVerb accepts user arguments, not the Node executable and script prefix. It is a pure transform and does not mutate the provided array.

List option flags that consume a separate value in valueFlags. This lets the arity counter ignore option values when flags are interleaved with positionals. Boolean flags and --flag=value do not need to be listed.

Output and errors

resolveFormat applies explicit --json, --yaml, or --table flags, then defaults to table for a TTY and json for a pipe. render serializes a value and can select top-level fields. writeOutput writes to stdout or a file and treats a closed stdout pipe as successful.

Catch errors at the executable boundary and render them once:

const format = resolveFormat(program.opts(), process.stdout.isTTY === true);

try {
  await program.parseAsync(args, { from: "user" });
} catch (error) {
  const isNormalExit = typeof error === "object" && error && "exitCode" in error && error.exitCode === 0;
  if (!isNormalExit) {
    const reported = reportError(error, format);
    process.stderr.write(reported.text);
    process.exitCode = reported.exitCode;
  }
}

Commander error text is suppressed by createProgram, so the shared reporter is the only error renderer. Help and version requests render normally, then throw Commander's zero-exit signal; preserve that status without reporting it. Usage failures throw for the boundary to report once.

Mutations

Call mutating(command) for send, submit, set, and mark-read commands. The marker is included by commandsJson. Command actions call confirm before making an upstream request:

const shouldApply = await confirm(
  { summary: "Set FIT1045 task 1.1 to complete" },
  { yes: options.yes, dryRun: options.dryRun, interactive: process.stdin.isTTY === true },
);

if (!shouldApply) return;

The plan and prompt are written to stderr. A non-interactive mutation without --yes throws a usage error. A dry run prints its plan and returns false.

Command description

commandsJson(program) returns the program metadata and full command tree. Every node includes aliases, positional arguments, options, enum values, nested commands, and mutating. Domain commands at noun depth must use a verb exported in VERBS; unsupported verbs throw. auth and skills are action groups rather than domain nouns and are not assigned a verb field.

The exit-code table, error vocabulary, and verb set are public versioned API. Changing one requires a major package release.

The conformance suite is isolated under conformance/. Until all three CLIs have published their normalized releases, missing binaries are reported as skipped tests. Its CI workflow installs the published packages before running the suite.