npm / commander
commander
What changed in commander 3 to 15, from its official release notes, upgrade guides and advisories. Sources checked 2026-11-30.
60 breaking9 deprecations51 new APIs and options33 behavior and defaults3 tooling26 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initcommander 1515 changes
Breaking changes 5
Unknown-source global option values now mask the local option value source.
Commander 15 is ESM only, which may require configuration for tooling that does not support importing ESM from CommonJS.
The deprecated commander/esm.mjs export has been removed.
Only a lone negative option sets the default option value to true; defining both positive and negative options in either order no longer implicitly sets a default.
Commander 15 requires Node.js v22.12.0 or higher.
Deprecations 3
cmd.combineFlagAndOptionalValue() is deprecated.
cmd.storeOptionsAsProperties() is deprecated.
Commander 14 moves into maintenance and will receive security updates through May 2027, which may inform upgrade timing.
Behavior and default changes 3
InvalidOptionArgumentError is no longer deprecated.
Variadic option placeholders now support Unicode.
Error messages now show excess command arguments, helping developers identify arguments that were not expected.
Fixes and other changes 4
The help option's group is preserved when a conflicting flag is hidden.
The Node inspector port is incremented when spawning an executable subcommand with --inspect-wait.
The Node inspector port is incremented for IPv6 hosts when spawning an executable subcommand.
Negative number arguments with an uppercase E exponent are now accepted.
commander 148 changes
Breaking changes 1
Commander 14 requires Node.js v20 or higher.
New APIs and options 2
Adds low-level support for grouping options and commands in help.
Adds the
parseArgproperty to theArgumentclass in TypeScript.
Behavior and default changes 2
Old major versions are supported for 12 months instead of only the previous major version, giving developers a more predictable end-of-life.
Unescaped negative numbers are supported as option-arguments and command-arguments.
Fixes and other changes 3
The typing for the deprecated callback parameter to .outputHelp() is clarified.
Copies settings instead of modifying them in place, fixing side effects.
Removes a bogus leading space when an option has a default value but no description.
commander 1317 changes
Breaking changes 5
Excess command-arguments now cause an error by default; allowExcessArguments() can suppress the error.
Help formatting was refactored into formatItem() and boxWrap().
Help.wrap() was removed as part of a refactor into formatItem() and boxWrap().
Option construction now throws for unsupported option flags, such as multiple characters after a single dash.
Multiple parse() calls now throw when storeOptionsAsProperties is true.
New APIs and options 10
Adds boxWrap() as a Help method.
Adds displayWidth() as a Help method.
Adds color-related support in configureOutput(), including getErrHasColors().
Adds color-related support in configureOutput(), including getOutHasColors().
Adds the minWidthToWrap property to Help.
Adds preformatted() as a Help method.
Adds a method for subclasses to restore state before parsing.
Adds a method for subclasses to save state before parsing.
Adds color-related support in configureOutput(), including stripColor().
Adds style routines for adding color to help when using configureHelp() or a Help subclass.
Behavior and default changes 1
TypeScript action handler callback parameters now include implicit this.
Fixes and other changes 1
Multiple calls to parse() are supported when using default settings.
commander 1210 changes
Breaking changes 7
Adding a command with a name or alias already in use now throws an error.
The CommonJS default export of a global Command instance was removed; use the named
programexport or create a newCommand.Commander 12 requires Node.js v18 or higher.
Adding an option with a flag already in use now throws an error.
When using
.addCommand, constraints are checked and an error is thrown if the parent command has not enabled.enablePositionalOptions().A spawned executable subcommand that terminates due to a signal now causes a non-zero exit code.
Calling
.storeOptionsAsProperties()after setting an option value now throws an error.
Deprecations 1
Passing a string or boolean remains supported but is deprecated; use
.helpCommand()or pass a Command.
New APIs and options 2
Adds another way to configure the built-in help option.
Adds an API for configuring the built-in help command.
commander 114 changes
Breaking changes 1
Commander 11 requires Node.js v16 or higher.
Behavior and default changes 1
The .arguments() method now ignores leading and trailing spaces.
Fixes and other changes 2
The help command works when the help option is disabled.
Types exports for ESM were refined to follow TypeScript guidelines.
commander 102 changes
Breaking changes 1
Commander 10 requires Node.js v14 or higher.
Behavior and default changes 1
Command descriptions are wrapped in help output.
commander 917 changes
Breaking changes 4
A default value specified for a boolean option is now always used as its default value; use .preset() to match some previous behaviours.
Commander 9 requires Node.js v12.20.0 or higher.
Passing an Option to option() or requiredOption() now throws a helpful message.
The internal fallback to require.main.filename when the script is unknown from parse() arguments was removed; use name(), executableDir(), or executableFile to supply details.
New APIs and options 3
Specify a custom search location for subcommands.
Return merged local and global options.
Option.preset() lets you specify the value or argument used when an option is supplied without an option-argument.
Behavior and default changes 5
ECMAScript imports are simpler.
executableFile now accepts an absolute path.
Nested subcommands no longer need to specify executableFile.
showSuggestionAfterError is now enabled by default.
The command name is used as the prefix for a subcommand stand-alone executable name, with the script name as a backwards-compatible fallback.
Fixes and other changes 5
TypeScript now allows passing a readonly string array to aliases().
A boolean option's default value is shown in help only when it is true or false.
TypeScript now allows passing a readonly string array to choices().
An optional argument omitted on the command line now works when the option already has a value from a default or previous arguments.
TypeScript now allows passing a readonly string array to parse() and parseAsync().
commander 822 changes
Breaking changes 6
The callback declaration now allows only string results, not undefined.
Programs without an action handler now error when required command-arguments are missing.
Renames the CommanderError code from commander.invalidOptionArgument.
Removes the TypeScript declaration for the default export of the global Command object; the named program export remains available.
Commander 8 requires Node.js 12 or higher.
The help suggestion is no longer included in the unknown-command error message.
Deprecations 2
The second parameter for adding argument descriptions is deprecated; use
.argument(name, description)instead.Deprecated and replaced by InvalidArgumentError.
New APIs and options 11
Adds an API for adding arguments.
Adds command arguments with a name and description.
Arguments can specify choices.
Optional command-arguments can have a default value.
Supports a custom processing function for command-arguments.
Adds a factory method for creating arguments.
Adds an API to get an option value.
Adds preAction and postAction callbacks.
Adds an API to set an option value.
Displays full help or a custom message after an error.
The Help method now returns an array of Argument.
Behavior and default changes 2
The Command property is initialized to an empty array instead of being undefined.
Is now declared as async.
Tooling 1
The return type is typed using TypeScript generics.
commander 727 changes
Breaking changes 5
Action handlers receive options and command as separate parameters.
Removed from the action handler; use allowExcessArguments(false) to report excess arguments.
Use opts() to access parsed options, which are now stored separately from the command by default.
Removed because action handlers now receive options and command.
Options are stored separately by default instead of as command properties; call this method to restore the old behavior.
Deprecations 3
The callback parameter to help is deprecated.
Using on('--help') is deprecated.
The callback parameter to outputHelp is deprecated.
New APIs and options 11
Adds text before or after built-in help for the current command or its subcommands.
Can show an error when the command line has too many command-arguments for the action handler.
Modifies stdout and stderr usage or customizes error display.
Supports subclassing automatically created options, similar to createCommand.
Lets the program and a subcommand reuse the same option.
Help generation is exposed as a public class that can be subclassed or configured.
Supports specifying the wrap width in columns.
Options can be hidden from help, restricted to a list of choices, and configured to show their default value in help.
Option arguments can be restricted to a list of choices.
Controls how a default value is shown in help.
Passes options through to other programs without needing
--.
Behavior and default changes 4
The command description is initialized to an empty string instead of undefined.
Supports sorting subcommands and options in help.
Can be subclassed or configured without subclassing.
Errors are displayed using process.stderr.write() instead of console.error().
Fixes and other changes 4
Improved backwards compatibility for custom command event listeners.
Help padding calculations now include the help option and help command.
Help padding calculations no longer include hidden options and commands.
Fixed help wrapping so the first line of a command description no longer wraps two characters early.
commander 65 changes
Breaking changes 3
Option flags containing -no- in the middle are no longer treated as negatable.
An error is thrown when an option name might clash with a Command property, with advice on how to resolve the clash.
For options added with only a short flag, the property name now has the same case as the flag; for example, -n is accessed as opts().n instead of with an uppercase property.
Behavior and default changes 2
Options can now be added using only a short flag.
Options can now accept variadic values.
commander 532 changes
Breaking changes 13
The action handler is called whether or not there are non-option arguments.
Unknown options are included in arguments passed to the command action handler and in
.args.The
argsproperty contains command arguments with recognized options removed.Executable subcommands no longer emit the
command:*event.Command events receive the changed
parseOptionsresults: operands and unknown.Author errors are thrown instead of only displaying a message; variadic errors are checked in preflight, and tips are added for missing subcommand executables.
Removes
EventEmitterfrom the TypeScript definition forCommand, eliminating its implicit peer dependency on@types/node.A named, non-executable command can be set as the default command.
Options are validated whether or not an action handler is present.
Includes short-flag and long-flag expansions.
The returned
argsfield is renamed tooperandsand excludes anything after the first unknown option.The returned
unknownfield includes arguments after the first unknown option, including operands.Unknown subcommands display an error by default, with a help suggestion.
New APIs and options 5
Adds a separately configured command to a command.
Customizes the implicit help command.
Adds a factory method to simplify subclassing.
Commands can be nested and use action-handlers.
Can specify where parse arguments come from when they do not follow Node conventions.
Behavior and default changes 8
A combined short-option argument can include boolean flags and a value flag with its value.
TypeScript fluent return types return
thisrather thanCommand, improving subclass compatibility.An implicit help command is available when commands are present, not only when executables are present.
The implicit help command is added only when it will not conflict with other uses of the argument, and works with command aliases.
Returns help text as a string and is no longer private.
Help is displayed by default when a subcommand is missing.
Uses
process.argvimplicitly when arguments are not specified.Action-handler subcommands accept a short option flag and its value concatenated, such as
-p80.
Tooling 2
Adds a TypeScript definition for the
commandsproperty ofCommand.Tightens the TypeScript definition for the custom option processing function passed to
.option().
Fixes and other changes 4
Returns
Promise<this>to be consistent with.parse().Exports the
programproperty.An error is displayed when a required command argument is missing.
Preserves argument order in subcommands.
commander 410 changes
Breaking changes 6
The action handler is now passed an array of unknown arguments.
The default subcommand is called even when there are unknown options.
Official support is limited to Node 8 and above; Node 6 is required.
The command object is no longer included in program.args when an action handler is called.
Types are brought into the imported namespace.
Unknown options are reported when a program argument is supplied with an action handler.
New APIs and options 3
The command:* event parameters now include unknown arguments.
Allows overriding calls to process.exit for additional error handling and to keep the program running.
Adds support for declaring required options.
Behavior and default changes 1
Help descriptions for options and commands are automatically wrapped and indented.
commander 313 changes
Breaking changes 3
TypeScript uses an overloaded function for
.command; an explicitundefinedis no longer valid for an unwanted executable description.Defining
--no-fooafter--fooleaves the default value unchanged instead of setting it to false.Using
--no-fooon the command line emitsoption:no-fooinstead ofoption:foo, so custom event listeners may need updating.
New APIs and options 4
.commandacceptsexecutableFileto specify the executable file name for a command..helpOption(flags, description)customizes the help flags and description.Both
--fooand--no-foocan now be defined..versionaccepts an optional custom description.
Behavior and default changes 3
A boolean default value, such as one supplied from the environment, is allowed.
Help output prefixes subcommands with their parent command.
Subcommands support a hyphen as an option argument.
Fixes and other changes 3
Strings in error messages use straight quotes.
On win32, executable arguments are passed when spawning git-style executables.
The inspector port is incremented for spawned subcommands.