// the find
tj/commander.js
node.js command-line interfaces made easy
Commander.js is the de facto standard CLI argument parser for Node.js — options, subcommands, validation, and auto-generated help. It has been around since 2011, maintained by the community after TJ handed it off, and is a transitive dependency in half the Node ecosystem.
Zero runtime dependencies and under 10KB installed size, which matters when it's pulled in by 50 other packages. The fluent API is readable and self-documenting — option definitions double as help text, which forces authors to keep them in sync. Option conflict and implication modeling (`--disable-server` conflicts with `--port`, `--free-drink` implies `drink: small`) catches configuration errors at parse time instead of deep in business logic. The `extra-typings` companion package infers TypeScript types from the option declarations, giving you typed `.opts()` without hand-writing interfaces.
Subcommand inheritance is a footgun: `.command()` silently copies settings at creation time, but `.addCommand()` does not — you need `.copyInheritedSettings()` manually. This asymmetry has bitten plenty of people who expected consistent behavior. Optional option-arguments (`--flag [value]`) have inherently ambiguous parsing — the docs acknowledge this and point to a separate in-depth doc, which means you will hit edge cases. Environment variable binding (`Option.env()`) has no type coercion, so you still have to parse the string yourself or use a custom `argParser`. The event-based API (`.on('option:verbose', ...)`) is still there but feels like dead weight next to hooks — two overlapping mechanisms for the same problem.