unstale

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 init

@unstale/cli on npm

commander 1515 changes

Breaking changes 5

  • Unknown-source global option values now mask the local option value source.

    15.1.0release notes

  • Commander 15 is ESM only, which may require configuration for tooling that does not support importing ESM from CommonJS.

    15.0.0release notes

  • The deprecated commander/esm.mjs export has been removed.

    15.0.0release notes

  • 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.

    15.0.0release notes

  • Commander 15 requires Node.js v22.12.0 or higher.

    15.0.0release notes

Deprecations 3

  • cmd.combineFlagAndOptionalValue() is deprecated.

    15.1.0release notes

  • cmd.storeOptionsAsProperties() is deprecated.

    15.1.0release notes

  • Commander 14 moves into maintenance and will receive security updates through May 2027, which may inform upgrade timing.

    15.0.0release notes

Behavior and default changes 3

  • InvalidOptionArgumentError is no longer deprecated.

    15.1.0release notes

  • Variadic option placeholders now support Unicode.

    15.1.0release notes

  • Error messages now show excess command arguments, helping developers identify arguments that were not expected.

    15.0.0release notes

Fixes and other changes 4

  • The help option's group is preserved when a conflicting flag is hidden.

    15.1.0release notes

  • The Node inspector port is incremented when spawning an executable subcommand with --inspect-wait.

    15.1.0release notes

  • The Node inspector port is incremented for IPv6 hosts when spawning an executable subcommand.

    15.1.0release notes

  • Negative number arguments with an uppercase E exponent are now accepted.

    15.1.0release notes

commander 148 changes

Breaking changes 1

New APIs and options 2

  • Adds low-level support for grouping options and commands in help.

    14.0.0release notes

  • Adds the parseArg property to the Argument class in TypeScript.

    14.0.0release notes

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.

    14.0.3release notes

  • Unescaped negative numbers are supported as option-arguments and command-arguments.

    14.0.0release notes

Fixes and other changes 3

  • The typing for the deprecated callback parameter to .outputHelp() is clarified.

    14.0.3release notes

  • Copies settings instead of modifying them in place, fixing side effects.

    14.0.0release notes

  • Removes a bogus leading space when an option has a default value but no description.

    14.0.0release notes

commander 1317 changes

Breaking changes 5

  • Excess command-arguments now cause an error by default; allowExcessArguments() can suppress the error.

    13.0.0release notes

  • Help formatting was refactored into formatItem() and boxWrap().

    13.0.0release notes

  • Help.wrap() was removed as part of a refactor into formatItem() and boxWrap().

    13.0.0release notes

  • Option construction now throws for unsupported option flags, such as multiple characters after a single dash.

    13.0.0release notes

  • Multiple parse() calls now throw when storeOptionsAsProperties is true.

    13.0.0release notes

New APIs and options 10

  • Adds boxWrap() as a Help method.

    13.0.0release notes

  • Adds displayWidth() as a Help method.

    13.0.0release notes

  • Adds color-related support in configureOutput(), including getErrHasColors().

    13.0.0release notes

  • Adds color-related support in configureOutput(), including getOutHasColors().

    13.0.0release notes

  • Adds the minWidthToWrap property to Help.

    13.0.0release notes

  • Adds preformatted() as a Help method.

    13.0.0release notes

  • Adds a method for subclasses to restore state before parsing.

    13.0.0release notes

  • Adds a method for subclasses to save state before parsing.

    13.0.0release notes

  • Adds color-related support in configureOutput(), including stripColor().

    13.0.0release notes

  • Adds style routines for adding color to help when using configureHelp() or a Help subclass.

    13.0.0release notes

Behavior and default changes 1

  • TypeScript action handler callback parameters now include implicit this.

    13.0.0release notes

Fixes and other changes 1

  • Multiple calls to parse() are supported when using default settings.

    13.0.0release notes

commander 1210 changes

Breaking changes 7

  • Adding a command with a name or alias already in use now throws an error.

    12.0.0release notes

  • The CommonJS default export of a global Command instance was removed; use the named program export or create a new Command.

    12.0.0release notes

  • Commander 12 requires Node.js v18 or higher.

    12.0.0release notes

  • Adding an option with a flag already in use now throws an error.

    12.0.0release notes

  • When using .addCommand, constraints are checked and an error is thrown if the parent command has not enabled .enablePositionalOptions().

    12.0.0release notes

  • A spawned executable subcommand that terminates due to a signal now causes a non-zero exit code.

    12.0.0release notes

  • Calling .storeOptionsAsProperties() after setting an option value now throws an error.

    12.0.0release notes

Deprecations 1

  • Passing a string or boolean remains supported but is deprecated; use .helpCommand() or pass a Command.

    12.0.0release notes

New APIs and options 2

  • Adds another way to configure the built-in help option.

    12.0.0release notes

  • Adds an API for configuring the built-in help command.

    12.0.0release notes

commander 114 changes

Breaking changes 1

Behavior and default changes 1

  • The .arguments() method now ignores leading and trailing spaces.

    11.0.0release notes

Fixes and other changes 2

  • The help command works when the help option is disabled.

    11.0.0release notes

  • Types exports for ESM were refined to follow TypeScript guidelines.

    11.0.0release notes

commander 102 changes

Breaking changes 1

Behavior and default changes 1

  • Command descriptions are wrapped in help output.

    10.0.0release notes

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.

    9.0.0release notes

  • Commander 9 requires Node.js v12.20.0 or higher.

    9.0.0release notes

  • Passing an Option to option() or requiredOption() now throws a helpful message.

    9.0.0release notes

  • 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.

    9.0.0release notes

New APIs and options 3

  • Specify a custom search location for subcommands.

    9.0.0release notes

  • Return merged local and global options.

    9.0.0release notes

  • Option.preset() lets you specify the value or argument used when an option is supplied without an option-argument.

    9.0.0release notes

Behavior and default changes 5

  • ECMAScript imports are simpler.

    9.0.0release notes

  • executableFile now accepts an absolute path.

    9.0.0release notes

  • Nested subcommands no longer need to specify executableFile.

    9.0.0release notes

  • showSuggestionAfterError is now enabled by default.

    9.0.0release notes

  • The command name is used as the prefix for a subcommand stand-alone executable name, with the script name as a backwards-compatible fallback.

    9.0.0release notes

Fixes and other changes 5

  • TypeScript now allows passing a readonly string array to aliases().

    9.0.0release notes

  • A boolean option's default value is shown in help only when it is true or false.

    9.0.0release notes

  • TypeScript now allows passing a readonly string array to choices().

    9.0.0release notes

  • An optional argument omitted on the command line now works when the option already has a value from a default or previous arguments.

    9.0.0release notes

  • TypeScript now allows passing a readonly string array to parse() and parseAsync().

    9.0.0release notes

commander 822 changes

Breaking changes 6

  • The callback declaration now allows only string results, not undefined.

    8.0.0release notes

  • Programs without an action handler now error when required command-arguments are missing.

    8.0.0release notes

  • Renames the CommanderError code from commander.invalidOptionArgument.

    8.0.0release notes

  • Removes the TypeScript declaration for the default export of the global Command object; the named program export remains available.

    8.0.0release notes

  • Commander 8 requires Node.js 12 or higher.

    8.0.0release notes

  • The help suggestion is no longer included in the unknown-command error message.

    8.0.0release notes

Deprecations 2

  • The second parameter for adding argument descriptions is deprecated; use .argument(name, description) instead.

    8.0.0release notes

  • Deprecated and replaced by InvalidArgumentError.

    8.0.0release notes

New APIs and options 11

Behavior and default changes 2

  • The Command property is initialized to an empty array instead of being undefined.

    8.0.0release notes

  • Is now declared as async.

    8.0.0release notes

Tooling 1

  • The return type is typed using TypeScript generics.

    8.0.0release notes

commander 727 changes

Breaking changes 5

  • Action handlers receive options and command as separate parameters.

    7.0.0release notes

  • Removed from the action handler; use allowExcessArguments(false) to report excess arguments.

    7.0.0release notes

  • Use opts() to access parsed options, which are now stored separately from the command by default.

    7.0.0release notes

  • Removed because action handlers now receive options and command.

    7.0.0release notes

  • Options are stored separately by default instead of as command properties; call this method to restore the old behavior.

    7.0.0release notes

Deprecations 3

New APIs and options 11

  • Adds text before or after built-in help for the current command or its subcommands.

    7.0.0release notes

  • Can show an error when the command line has too many command-arguments for the action handler.

    7.0.0release notes

  • Modifies stdout and stderr usage or customizes error display.

    7.0.0release notes

  • Supports subclassing automatically created options, similar to createCommand.

    7.0.0release notes

  • Lets the program and a subcommand reuse the same option.

    7.0.0release notes

  • Help generation is exposed as a public class that can be subclassed or configured.

    7.0.0release notes

  • Supports specifying the wrap width in columns.

    7.0.0release notes

  • Options can be hidden from help, restricted to a list of choices, and configured to show their default value in help.

    7.0.0release notes

  • Option arguments can be restricted to a list of choices.

    7.0.0release notes

  • Controls how a default value is shown in help.

    7.0.0release notes

  • Passes options through to other programs without needing --.

    7.0.0release notes

Behavior and default changes 4

  • The command description is initialized to an empty string instead of undefined.

    7.0.0release notes

  • Supports sorting subcommands and options in help.

    7.0.0release notes

  • Can be subclassed or configured without subclassing.

    7.0.0release notes

  • Errors are displayed using process.stderr.write() instead of console.error().

    7.0.0release notes

Fixes and other changes 4

  • Improved backwards compatibility for custom command event listeners.

    7.0.0release notes

  • Help padding calculations now include the help option and help command.

    7.0.0release notes

  • Help padding calculations no longer include hidden options and commands.

    7.0.0release notes

  • Fixed help wrapping so the first line of a command description no longer wraps two characters early.

    7.0.0release notes

commander 65 changes

Breaking changes 3

  • Option flags containing -no- in the middle are no longer treated as negatable.

    6.0.0release notes

  • An error is thrown when an option name might clash with a Command property, with advice on how to resolve the clash.

    6.0.0release notes

  • 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.

    6.0.0release notes

Behavior and default changes 2

commander 532 changes

Breaking changes 13

  • The action handler is called whether or not there are non-option arguments.

    5.0.0release notes

  • Unknown options are included in arguments passed to the command action handler and in .args.

    5.0.0release notes

  • The args property contains command arguments with recognized options removed.

    5.0.0release notes

  • Executable subcommands no longer emit the command:* event.

    5.0.0release notes

  • Command events receive the changed parseOptions results: operands and unknown.

    5.0.0release notes

  • Author errors are thrown instead of only displaying a message; variadic errors are checked in preflight, and tips are added for missing subcommand executables.

    5.0.0release notes

  • Removes EventEmitter from the TypeScript definition for Command, eliminating its implicit peer dependency on @types/node.

    5.0.0release notes

  • A named, non-executable command can be set as the default command.

    5.0.0release notes

  • Options are validated whether or not an action handler is present.

    5.0.0release notes

  • Includes short-flag and long-flag expansions.

    5.0.0release notes

  • The returned args field is renamed to operands and excludes anything after the first unknown option.

    5.0.0release notes

  • The returned unknown field includes arguments after the first unknown option, including operands.

    5.0.0release notes

  • Unknown subcommands display an error by default, with a help suggestion.

    5.0.0release notes

New APIs and options 5

  • Adds a separately configured command to a command.

    5.0.0release notes

  • Customizes the implicit help command.

    5.0.0release notes

  • Adds a factory method to simplify subclassing.

    5.0.0release notes

  • Commands can be nested and use action-handlers.

    5.0.0release notes

  • Can specify where parse arguments come from when they do not follow Node conventions.

    5.0.0release notes

Behavior and default changes 8

  • A combined short-option argument can include boolean flags and a value flag with its value.

    5.0.0release notes

  • TypeScript fluent return types return this rather than Command, improving subclass compatibility.

    5.0.0release notes

  • An implicit help command is available when commands are present, not only when executables are present.

    5.0.0release notes

  • The implicit help command is added only when it will not conflict with other uses of the argument, and works with command aliases.

    5.0.0release notes

  • Returns help text as a string and is no longer private.

    5.0.0release notes

  • Help is displayed by default when a subcommand is missing.

    5.0.0release notes

  • Uses process.argv implicitly when arguments are not specified.

    5.0.0release notes

  • Action-handler subcommands accept a short option flag and its value concatenated, such as -p80.

    3.0.0, 5.0.0release notesrelease notes

Tooling 2

  • Adds a TypeScript definition for the commands property of Command.

    5.0.0release notes

  • Tightens the TypeScript definition for the custom option processing function passed to .option().

    5.0.0release notes

Fixes and other changes 4

  • Returns Promise<this> to be consistent with .parse().

    5.0.0release notes

  • Exports the program property.

    5.0.0release notes

  • An error is displayed when a required command argument is missing.

    5.0.0release notes

  • Preserves argument order in subcommands.

    5.0.0release notes

commander 410 changes

Breaking changes 6

  • The action handler is now passed an array of unknown arguments.

    4.0.0release notes

  • The default subcommand is called even when there are unknown options.

    4.0.0release notes

  • Official support is limited to Node 8 and above; Node 6 is required.

    4.0.0release notes

  • The command object is no longer included in program.args when an action handler is called.

    4.0.0release notes

  • Types are brought into the imported namespace.

    4.0.0release notes

  • Unknown options are reported when a program argument is supplied with an action handler.

    4.0.0release notes

New APIs and options 3

  • The command:* event parameters now include unknown arguments.

    4.0.0release notes

  • Allows overriding calls to process.exit for additional error handling and to keep the program running.

    4.0.0release notes

  • Adds support for declaring required options.

    4.0.0release notes

Behavior and default changes 1

  • Help descriptions for options and commands are automatically wrapped and indented.

    4.0.0release notes

commander 313 changes

Breaking changes 3

  • TypeScript uses an overloaded function for .command; an explicit undefined is no longer valid for an unwanted executable description.

    3.0.0release notes

  • Defining --no-foo after --foo leaves the default value unchanged instead of setting it to false.

    3.0.0release notes

  • Using --no-foo on the command line emits option:no-foo instead of option:foo, so custom event listeners may need updating.

    3.0.0release notes

New APIs and options 4

  • .command accepts executableFile to specify the executable file name for a command.

    3.0.0release notes

  • .helpOption(flags, description) customizes the help flags and description.

    3.0.0release notes

  • Both --foo and --no-foo can now be defined.

    3.0.0release notes

  • .version accepts an optional custom description.

    3.0.0release notes

Behavior and default changes 3

  • A boolean default value, such as one supplied from the environment, is allowed.

    3.0.0release notes

  • Help output prefixes subcommands with their parent command.

    3.0.0release notes

  • Subcommands support a hyphen as an option argument.

    3.0.0release notes

Fixes and other changes 3

  • Strings in error messages use straight quotes.

    3.0.0release notes

  • On win32, executable arguments are passed when spawning git-style executables.

    3.0.0release notes

  • The inspector port is incremented for spawned subcommands.

    3.0.0release notes