Patch, corrected
A patch is a fix for behaviour that was never intended, not a promise of backward compatibility (which is practically impossible to guarantee). The definition is amended so a fix stays a fix.
Specification 1.0.0
Semantic Versions is an open specification for how version numbers are assigned, incremented, grouped, compared and matched. A spiritual successor to Semantic Versioning 2.0.0-rc.1.
npm:react@1.2.3-beta.4+build.7
# source:name @ major.minor.patch-prerelease+buildWhy a new spec
Semantic Versioning 2.0.0 is more than a decade old, has not meaningfully changed in that time, and has no realistic path to a 3.0. The way we ship software has moved on. Package managers escaped the first circle of dependency hell by quietly bolting sets, ranges and comparators onto a spec that never defined them, each in its own dialect: ^1.2.3 in npm and Composer, ~> 1.2 in Bundler, a bare 1.2.3 that means a caret in Cargo, ~=1.2 in pip, [1.0,2.0) in Maven and NuGet. That is how we landed in a deeper circle, where package managers read the same version differently and resolve to different graphs.
A specification is a language, and it is only as good as the definitions it contains. Software changes over time and sometimes breaks; that is natural, and necessary for growth. A versioning spec exists to codify the signals that communicate change, so it should codify the ones we actually use.
What changed
A patch is a fix for behaviour that was never intended, not a promise of backward compatibility (which is practically impossible to guarantee). The definition is amended so a fix stays a fix.
2.0.0-rc.2 turned builds into inert "build metadata," making every build of a version equivalent. Two artifacts with different hashes or architectures are distinct software, so builds order again.
Precedence alone can't describe a collection of versions. This spec defines ordered, unordered, normal, prerelease and build sets: the vocabulary you need to manage more than one version at a time.
Comparators (>=1.2.7), comparator sets, hyphen ranges, x-ranges, tilde and caret. The grammar tools already ship, defined so they desugar to primitive comparators in one deterministic way.
~>)The pessimistic operator, borrowed from the Ruby world, is defined explicitly rather than left to each tool's imagination.
Backus–Naur grammars for versions, ranges and comparators, plus a parser you can read, so anyone can build a compliant library.
The full ruleset: versions, sets, ranges, comparators and precedence.
The case for making this spec the next version of Semantic Versioning, and why it stands on its own regardless.
Test what matches what against the range grammar, entirely in your browser.
Formal Backus–Naur forms, ready to build a library from.
How builds were introduced, and how a later change made them meaningless.
Target coordinates carried in the version: napi:sharp@0.33.0+linux.x64.musl
A verifiable content digest carried in the version: npm:react@18.2.0+sha512.…
Pinning a resolved subgraph whose nodes are variant- and integrity-qualified identities.
Status of this document
Semantic Versions 1.0.0 is published and ready to build on. The reference parser (semantic-versions) and its ports to seven other languages track the specification and pass a shared conformance suite, and the work is being stewarded toward an open standards body. It is also written to become Semantic Versioning 3.0.0, if there is enough interest in taking it upstream. Corrections and proposals are welcome in the repository.