CLI Reference
Installing @neosjs/release registers two equivalent commands: release and neos-release.
Basic Usage
release [<increment>] [options]Positional Argument <increment> (or -i / --increment)
You can specify a semantic increment type or an explicit target version:
| Value | Description |
|---|---|
patch / minor / major | Stable release increment |
prepatch / preminor / premajor | Pre-release increment (case-insensitive, so prePatch is equivalent to prepatch) |
prerelease / pre | Continue the current pre-release series by incrementing the pre-release number |
Explicit version (such as 2.0.0, 2.0.0-rc.1) | Use the specified version directly (it must be greater than or equal to the current version; non-canonical formats are coerced through semver.coerce with a warning) |
--no-increment | Do not increment the version and keep the current latest version (commonly used to backfill a Release, attach assets, or retry a push after a failure) |
When <increment> is omitted:
- Interactive mode: a version selection list is shown, with the version type recommended from commits highlighted and pre-selected (switch with the arrow keys or choose "Custom version").
- CI mode (
--ci): the version type recommended by thechangelogplugin from releasable commits takes precedence; if there are new commits since the last tag but no releasable changes (and the defaultchangelog.requireReleasableCommitsis enabled), a notice is printed and the release is skipped with exit code0; when the recommendation is disabled or there are no new commits at all,patchis used by default (prepatchor a continuedprereleasein pre-release mode).
All CLI Options
General and Debugging Options
| Option | Shorthand | Description |
|---|---|---|
--config <path> | -c | Path to a local configuration file; pass --no-config to disable loading local configuration files |
--dry-run | -d | Dry-run mode: only prints the write commands that would run, without actually modifying files or pushing (see Dry Runs and Troubleshooting) |
--increment <val> | -i | Specify the increment type or an explicit version; pass --no-increment to skip the version increment |
--verbose | -V | Verbose output: -V prints external command/hook output, -VV prints all commands with detailed logs, -VVV also includes debug logs |
--version | -v | Print the version information of @neosjs/release, Node.js, and the operating system |
--help | -h | Print the command-line help |
--lang <lang> | — | Set the interface language: zh-CN, en, or auto (defaults to the system language; takes precedence over the NEOS_RELEASE_LANG environment variable) |
--doctor | — | Environment diagnosis: check the Git, npm, and GitHub / GitLab credentials a release needs; only reads state and changes nothing |
--offline | — | Used with --doctor: skip the checks that need network access (git fetch, npm registry connectivity, and login status) |
Run Mode and Interface Options
| Option | Description |
|---|---|
--ci | Silent non-interactive mode that skips all confirmation prompts (enabled automatically in CI environments; force it off with --no-ci) |
--only-version | Hybrid mode: only the version selection (plus the publish confirmation / OTP when publishing to npm) is interactive; all other steps run automatically as in CI mode |
--release-version | Only calculate the next version and print it to stdout, with all other logs going to stderr, for easy capture in scripts |
--only-changelog | Only generate the changelog for this release and print it to stdout, with all other logs going to stderr, for easy capture in scripts |
--show-changelog | Preview the full changelog for this release in the terminal when the release starts |
--show-changeset | Preview the list of staged files before the Git commit is created (git status --short --untracked-files=no) |
Pre-release, PR, and Sync Mode Options
| Option | Description |
|---|---|
--preRelease[=<id>] | Enter pre-release mode, optionally with a pre-release identifier (such as --preRelease=beta); see Pre-releases, Snapshots & Canary |
--preReleaseId=<id> | Specify the pre-release identifier separately (such as alpha, rc) |
--preReleaseBase=<num> | Specify the starting pre-release number (for example 1 produces 1.0.0-beta.1 instead of .0) |
--snapshot[=<id>] | Snapshot version mode, producing 0.0.0-<id>.N versions; see Pre-releases, Snapshots & Canary |
--canary[=<id>] | Canary preview publishing, producing <next-version>-<id>.<YYYYMMDD>.g<shortSha> and restoring package.json automatically after publishing; see Canary Preview Releases |
--pr / --no-pr | Enable or disable Release-via-PR mode; can be combined with sub-options such as --pr.draft, --pr.branch=..., and --pr.base=...; see Release-via-PR Mode |
--sync-releases[=<vers>] | Parse CHANGELOG.md to sync/backfill GitHub or GitLab Releases (accepts a comma-separated list of versions); see Sync Releases |
Mutually exclusive modes:
--canary,--snapshot, and--prcannot be enabled at the same time; passing them together fails during configuration initialization.
Plugin Toggles and Nested Configuration Overrides
Every built-in plugin and nested configuration option can be toggled or overridden directly from the command line:
# Disable a built-in plugin
release --no-git
release --no-npm
release --no-github
release --no-gitlab
# Enable / disable a specific sub-option
release --npm.publish --github.release
release --no-git.push --no-git.tag
release --npm.stage --npm.publishPackageManager=pnpm
release --pr --pr.draft --pr.base=main
release --sync-releases=v1.3.2,v1.3.1 --github.updateNested sub-options use the exact camelCase key names (kebab-case is not converted to camelCase automatically).
Run Mode Comparison
| Feature | Default Interactive Mode | --only-version | --ci | --release-version / --only-changelog |
|---|---|---|---|---|
| Screen clearing and welcome message | Yes | Yes | No | No |
| Version selection prompt | Yes | Yes | No (recommended version or patch is used automatically) | No (calculated automatically) |
| Git / Changelog / Release confirmations | Confirmed step by step | Runs automatically | Runs automatically | The release flow does not run |
| npm publish confirmation and 2FA interaction | Interactive confirmation + inherits terminal | Interactive confirmation + inherits terminal | Runs automatically (does not inherit terminal) | Not executed |
stdout output | Full logs and interactive interface | Full logs and interactive interface | Task progress and logs | Plain-text result only |
Scripting Output Modes
Use --release-version or --only-changelog when a script or CI pipeline only needs the next version number or the changelog:
# Print the next version
NEXT_VERSION=$(release --release-version)
NEXT_CANARY=$(release --canary --release-version)
# Export the changelog for this release
release --only-changelog > release-notes.mdCharacteristics:
- CI mode is entered automatically (no screen clearing, no welcome box, no interactive prompts).
- The result goes directly to
stdout, while warnings and auxiliary information are redirected tostderr, so piped content is not polluted. - Only the version is calculated or the changelog generated; no files are modified, and no Git commit or publish is performed.
- If there is no new version or no changes are found, a notice is printed to
stderrand the process exits with code0.
Environment Diagnosis (--doctor)
Before releasing (or when troubleshooting a failed release), you can check the environment first. The command only reads state: it never logs in, modifies files, or pushes.
release --doctor # Check Git, npm, and GitHub / GitLab credentials
release --doctor --offline # Skip checks that need network access (fetch, npm registry and login status)The checks cover: the config file, the current branch and its upstream, whether the branch is behind upstream, a clean working tree, the Git identity, the latest tag, npm and registry connectivity and login status, GITHUB_TOKEN / the gh CLI, and GITLAB_TOKEN.
- Each item is marked
✔(passed),⚠(warning),✘(failed), or⊘(skipped); warning and failed items come with a suggested fix. - The command exits with code
1when any check fails, and with0when everything passes or there are only warnings.
Cancelling a Release and Exit Codes
Cancelling with Ctrl+C (or Esc in a Prompt)
- You can abort at any time during a release by pressing
Ctrl+C; this is treated as a deliberate cancellation by the user rather than a failed release. - With the default
git.requireCleanWorkingDir: true, local changes that have already been made (including the modifiedpackage.json, local commits, local tags, or the release PR branch) are rolled back synchronously before the process exits; commits or tags that have already been pushed to the remote are not rolled back. - In
--canarymode, a cancellation or an error restorespackage.jsonto its original content exactly, without touching other uncommitted files in the working directory.
Exit Code Conventions
| Scenario | Exit code | Description |
|---|---|---|
| Release succeeded | 0 | Normal completion |
Cancelled with Ctrl+C / Esc in a terminal | 0 | A deliberate cancellation by someone who is present; avoids pnpm run release / npm run release misreporting the cancellation as an ELIFECYCLE failure |
Interrupted by SIGINT without a terminal (CI, a pipe, or a runner terminating the job) | 130 | The flow did not complete; follows the 128 + 2 convention so the pipeline does not treat the interruption as a success; it is not reported as a failed release either |
git.requireCommits: true with requireCommitsFail: false and no new commits | 0 | Treated as "nothing to release" and ends early normally |
New commits but no releasable changes in CI mode (changelog.requireReleasableCommits: true) | 0 | Prints a notice that there is nothing releasable and skips this release |
--sync-releases matched no versions to sync | 0 | Treated as nothing to sync and ends early normally |
| Configuration error, failed preflight check, or a failed hook or command | 1 | Prints the uniformly formatted error message and exits with a non-zero code |
--doctor found a failed check | 1 | Prints every check with its result; exits with 0 when all checks pass or there are only warnings |
The exit code is
0when cancelling in a terminal, so if you chain commands in a shell (such asrelease && ./post-script.sh), the subsequent commands still run after a cancelled release; in programmatic usage you can distinguish a user cancellation witherror.cancelled === true. Whether you are "in a terminal" is determined by whether stdin is a terminal: usages that redirect stdin, such asrelease < /dev/null, are handled with exit code130on cancellation.