commander
15.1.0 · 7 Nov 2026MIT785.6M / weekRepositoryHomepagenpmAtom feed
8.3.0 is the newest release of 8.x.
In short
5 breaking2 deprecated9 new5 changed1 internal
- Breaking
Helpmethod.visibleArguments()returns array ofArgument
- Breaking
Commander 8 requires Node.js 12 or higher
- Breaking
CommanderErrorcodecommander.invalidOptionArgumentrenamedcommander.invalidArgument
- Breaking
TypeScript declaration for
.addTextHelp()callback no longer allows result ofundefined, now juststring
- Breaking
TypeScript declaration for default export of global
Commandobject
- Deprecated
Second parameter of
cmd.description(desc, argDescriptions)for adding argument descriptions - Deprecated
InvalidOptionArgumentError(replaced byInvalidArgumentError)
Release note
Added
.argument(name, description)for adding command-argumentssupports default value for optional command-arguments
supports custom processing function
.createArgument()factory method.addArgument()Argumentsupports.choices().showHelpAfterError()to display full help or a custom message after an error.hook()with support for'preAction'and'postAction'callbacksClient typing of
.opts()return type using TypeScript genericsThe number of command-arguments is checked for programs without an action handler
.getOptionValue()and.setOptionValue()
Changed
Refactor and simplify TypeScript declarations (with no default export)
.parseAsync()is now declared asasync- Breaking
Helpmethod.visibleArguments()returns array ofArgument
- Breaking
Commander 8 requires Node.js 12 or higher
- Breaking
CommanderErrorcodecommander.invalidOptionArgumentrenamedcommander.invalidArgument
- Breaking
TypeScript declaration for
.addTextHelp()callback no longer allows result ofundefined, now juststring
Refactor
index.tabinto a file per classRemove help suggestion from "unknown command" error message (see
.showHelpAfteError())Commandproperty.arginitialised to empty array (was previously undefined)
Deprecated
- Deprecated
Second parameter of
cmd.description(desc, argDescriptions)for adding argument descriptions(use new
.argument(name, description)instead)
- Deprecated
InvalidOptionArgumentError(replaced byInvalidArgumentError)
Removed
- Breaking
TypeScript declaration for default export of global
Commandobject
(still available as named
programexport)
Migration Tips
If you have a simple program without an action handler, you will now get an error if
there are missing command-arguments.
program
.option('-d, --debug')
.arguments('<file>');
program.parse();$ node trivial.js error: missing required argument 'file'
If you want to show the help in this situation, you could check the arguments before parsing:
if (process.argv.length === 2) program.help(); program.parse();
Or, you might choose to show the help after any user error:
program.showHelpAfterError();
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.