JavaScript CLI libraries

Updated Nov 2026

JavaScript CLI libraries turn the arguments typed after a command into options, flags, and handler calls inside a Node.js program. A parser reads that argument list and checks it against the commands and options the program declares. These libraries define the commands of build tools, deploy scripts, and code generators that developers and coding agents run from a terminal.

Popularity

Commander has the most monthly downloads in this comparison, at 2.9B.

LibraryMonthly downloadsStarsLast releaseLicense
Commander
2.9B
28.5KNov 2026MIT
yargs
1.5B
11.5KSep 2026MIT
argparse
1.4B
516Oct 2026PSF-2.0
CAC
265.6M
3.1KOct 2026MIT
Meow
193.8M
3.7KFeb 2026MIT
Citty
190.8M
1.4KApr 2026MIT
@oclif/core
63.4M
321Nov 2026MIT
Sade
57.5M
1.1KJan 2022MIT
Downloads: npm, last thirty days. Stars and releases: GitHub. Amber: no release in over a year.

Libraries and code examples

Commander

Builds command trees with options, argument validation, action handlers, and generated help.

Downloads / mo
2.9B
Stars
28.5K
Last release
15.1.0
License
MIT

Strengths

  • Builds nested command trees. Define subcommands and their own arguments, options, and handlers.
  • Rejects missing required options. Use requiredOption when a named option must be supplied.

Limitations

  • Async actions need asynchronous parsing. Call parseAsync when any action handler is asynchronous.
  • Strong option inference needs extras. Install extra-typings to infer action parameters and parsed option types.

Quickstart

From Readme.md
$ npm install commander@15.1.0
import { Command } from "commander";
const cli = new Command();
cli.option("--name <name>").parse(["node", "hello", "--name", "Ada"]);
console.log(cli.opts().name);

Parses command-line arguments with command modules, validation, and configurable value coercion.

Downloads / mo
1.5B
Stars
11.5K
Last release
18.2.0
License
MIT

Strengths

  • Transforms option values during parsing. Use coerce to transform values or reject invalid inputs.
  • Requires named flags explicitly. Use demandOption for flags that every invocation needs.

Limitations

  • Numeric-looking strings are converted. Declare string options to preserve leading-zero identifiers.
  • Directory discovery flattens commands. Register nested command trees explicitly.

Quickstart

From README.md
$ npm install yargs@18.2.0
import yargs from "yargs";
const argv = yargs(["--name", "Ada"]).option("name", { type: "string" }).parseSync();
console.log(argv.name);

yargs examples

From open-source projects on GitHub

Parses command-line arguments for Node.js with subcommands, as a port of Python's argparse.

Downloads / mo
1.4B
Stars
516
Last release
3.0.4
License
PSF-2.0

Limitations

  • No keyword arguments. Pass an options object where Python argparse takes keyword arguments.

Quickstart

From README.md
$ npm install argparse@3.0.4
const { ArgumentParser } = require("argparse");
const parser = new ArgumentParser({ description: "Greeting input" });
parser.add_argument("--name");
console.log(parser.parse_args(["--name", "Ada"]).name);

argparse examples

From open-source projects on GitHub

Builds small command-line interfaces with subcommands, variadic arguments, and nested option objects.

Downloads / mo
265.6M
Stars
3.1K
Last release
7.1.0
License
MIT

Strengths

  • Groups dotted options into objects. Dot-nested flags are merged into one option object.
  • Supports variadic command arguments. Collect multiple positional values with a variadic argument.

Limitations

  • Commands need actions for validation. Attach an action to enable action-command option checks.
  • Negated flags need explicit definitions. Declare the no-prefixed option to accept false from the command line.

Quickstart

From README.md
$ npm install cac@7.1.0
import { cac } from "cac";
const cli = cac("hello");
const parsed = cli.option("--name <name>", "Name").parse(["node", "hello", "--name", "Ada"]);
console.log(parsed.options.name);

CAC examples

From open-source projects on GitHub

Parses arguments and flags and prints the supplied help text on --help.

Downloads / mo
193.8M
Stars
3.7K
Last release
14.1.0
License
MIT

Strengths

  • Converts flags to camelCase. Flag names arrive as camelCase keys in the parsed result.

Quickstart

From readme.md
$ npm install meow@14.1.0
import meow from "meow";
const cli = meow("Usage: hello --name <name>", {
  importMeta: import.meta,
  argv: ["--name", "Ada"],
  flags: { name: { type: "string" } },
});
console.log(cli.flags.name);

Meow examples

From open-source projects on GitHub

Builds command-line apps from command definitions with nested, lazily loaded subcommands.

Downloads / mo
190.8M
Stars
1.4K
Last release
0.2.2
License
MIT

Strengths

  • Built on util.parseArgs. Parsing runs on Node's native util.parseArgs with no dependencies.

Quickstart

From README.md
$ npm install citty@0.2.2
import { defineCommand, runMain } from "citty";
const main = defineCommand({
  meta: { name: "hello" },
  args: { name: { type: "string", default: "Ada" } },
  run({ args }) { console.log(`Hello ${args.name}`); },
});
await runMain(main);

Citty examples

From open-source projects on GitHub

Provides a framework for single-command and multi-command CLIs, built out of the Salesforce CLI.

Downloads / mo
63.4M
Stars
321
Last release
5.1.12
License
MIT

Quickstart

From README.md
$ npm install @oclif/core@5.1.12
import { Args, Parser } from "@oclif/core";
const { args } = await Parser.parse(["Ada"], {
  args: { name: Args.string({ required: true }) },
});
console.log(args.name);

@oclif/core examples

From open-source projects on GitHub

Builds Node.js CLIs with git-like subcommands, option aliases, default values, and generated help text.

Downloads / mo
57.5M
Stars
1.1K
Last release
1.8.1
License
MIT

Quickstart

From readme.md
$ npm install sade@1.8.1
import sade from "sade";
sade("hello <name>")
  .action(name => console.log(`Hello ${name}`))
  .parse(["node", "hello", "Ada"]);

Sade examples

From open-source projects on GitHub

FAQ

Commander builds command trees with options, handlers, and generated help, and it has the most monthly downloads, at 2.9B. yargs adds value coercion and validation, while oclif organizes larger CLIs as command classes with plugins.

Commander is a Node.js library for command-line programs. It defines commands, options, and action handlers, then parses the command line and prints generated help.

Commander defines command trees with a fluent API and needs parseAsync for asynchronous actions. yargs converts and validates option values during parsing with coerce and demandOption.

oclif builds class-based CLIs with command discovery and plugins, the structure behind the Salesforce CLI. Commander keeps commands in one fluent program definition.

Use parseAsync instead of parse when an action handler is asynchronous.

Declare the relevant key with string to prevent numeric or boolean interpretation.

For coding agents

Found your CLI library? Help your agent use it.

Connect Exa so your coding agent can find the library’s documentation, check its API, and look up implementations while you build.

Run in your terminal

claude plugin install exa@claude-plugins-official