Skip to content

Main content

SemVer Prerelease Counter Bump

Bump the final numeric identifier in a matching SemVer prerelease lane or start the supplied label at zero; changing labels resets the lane and build metadata is removed.

Loading tool…

Description

Bump the final numeric identifier in a matching SemVer prerelease lane or start the supplied label at zero; changing labels resets the lane and build metadata is removed.

Semantic versions have a major.minor.patch core, optional prerelease identifiers after a hyphen, and build identifiers after a plus. Prereleases precede the corresponding release; build metadata does not affect precedence. A textual spelling, an equal-precedence group and a major.minor release lane therefore answer different questions.1

Bump the final numeric identifier in a matching SemVer prerelease lane or start the supplied label at zero; changing labels resets the lane and build metadata is removed.

When to use this tool

Use this tool to bump the final numeric identifier in a matching SemVer prerelease lane or start the supplied label at zero; changing labels resets the lane and build metadata is removed.

How to use the tool and how it works

  1. Enter version, label using the field definitions below.
  2. Run the operation. Correct input errors before interpreting an output.
  3. Read result.version. Use the ordering, boundary rules and absence conditions described below.

Validate label. If the prerelease does not start with it, replace the prerelease with label.0; otherwise increment the trailing numeric token or append zero. Clear build metadata.2

Input fieldMeaning and unitsAccepted input
versionOne complete strict semantic-version string.Text, at most 8,192 UTF-16 code units; the operation’s grammar also applies.
labelPrerelease label beginning with an ASCII letter or hyphen and containing letters, digits or hyphens.Text, at most 8,192 UTF-16 code units; the operation’s grammar also applies.
Output fieldInterpretation
resultObject containing the named fields below.
result.versionFormatted semantic-version string after the stated transformation.
json
{
  "input": {
    "version": "1.2.3-alpha.1+build.2",
    "label": "alpha"
  },
  "output": {
    "result": {
      "version": "1.2.3-alpha.2"
    }
  }
}

Limitations and assumptions

  • The core version is preserved, and numeric overflow is rejected rather than wrapped.
  • Version text is limited to 1,024 UTF-16 code units with no whitespace. Parsed core and numeric prerelease components must be nonnegative safe integers. Range expressions and a leading v are not accepted.
  • Every declared top-level input field is required and unexpected fields are rejected. Ordinary strings are limited to 8,192 UTF-16 code units and lists to 128 entries, with tighter operation-specific bounds where stated. JSON text has bounded nesting and node counts.
  • Numeric outputs must be finite and no larger in absolute magnitude than the safe-integer limit; operations returning exact large integers use decimal text. Positions are zero-based and spans end exclusively unless the operation explicitly states a different convention.

Alternative or Complementary methods

Choose whether you need exact spelling, precedence or a release-lane grouping. Use a separate package manager or compatibility review for dependency resolution and release-policy decisions.

References

  1. Semantic Versioning 2.0.0 — Semantic Versioning

  2. Tool behavior and example: Semantic Version Prerelease Counter Bump — tool.io

Similar or alternative tools

  • Semantic Version Major Bump

    Bump one SemVer major component, reset lower core components and remove prerelease/build metadata; rejects overflow, no release policy inference.

  • Semantic Version Minor Bump

    Bump one SemVer minor component, reset lower core components and remove prerelease/build metadata; rejects overflow, no release policy inference.