ShtukbaseStandard

Standard: SemVer

std-semver · version 0.1.0
Industry standards3 norms3 checks

Semantic Versioning 2.0.0: versions in manifests and release tags are valid, a breaking change raises the major; three norms and a hint for the next version from commits.

About the package

What the standard is. Semantic Versioning 2.0.0 is the rules for a version number MAJOR.MINOR.PATCH. The text: https://semver.org/spec/v2.0.0.html. A breaking change to the public API raises the major, a new backward-compatible feature raises the minor, a fix raises the patch. A pre-release is written with a hyphen (1.0.0-rc.1), build metadata with a plus (1.0.0+20261128). While the major is 0, the API may change in any way (item 4).

When to install. The project has releases or packages with a version that someone relies on: a library, a tool, the standard's packages. We learn of breaking changes from Conventional Commits (! in the header or a BREAKING CHANGE footer), so the package sits well next to std-conventional-commits.

How to configure. The page /norms/standards/semver.md: which manifests to look at (manifests), what to skip (exclude, by default fixtures and archives), where the version of the whole project is (versionFile, by default the first manifest in the root), the prefix of release tags (tagPrefix, v by default), what a breaking change raises while the major is 0 (zeroMajor: minor or major). A hint: shtuk run std-semver next gives the project version, the last release and the next version from commits.

What is checked

  • SV-R01 (MUST, enforce): the version in package.json, Cargo.toml ([package], [workspace.package]), pyproject.toml ([project], [tool.poetry]) and package.md (a Shtukbase package) is valid SemVer 2.0.0. The check is the regular expression from the standard itself. A manifest without a version (a private package.json, a workspace member, a dynamic version) is not checked. The valid check.
  • SV-R02 (MUST, observe): after the last release tag, a breaking commit raises the major (while the major is 0, the minor), and the project version is not lower than the last release. It observes: a version is often raised at the moment of release, not at the moment of the commit. The breaking check.
  • SV-R03 (SHOULD, enforce): a tag that looks like a release (v and a digit) carries a valid version: v1.2 or v1.2.3.4 is a finding. The tags check.

What is not checked

  • What a project's public API is and whether a change is really breaking: a person decides this (item 1 of the standard). The package trusts the commits.
  • Versions of dependencies and ranges (^1.2.0): these are not the project's version.
  • pyproject.toml by PEP 440 (1.0rc1) does not conform to SemVer; such a project removes pyproject.toml from manifests.
  • Released content under a version does not change (item 3): that is the history of the registry, not of files.

The package only reads git (git tag, git log). It writes nothing.

Norms 3

"Blocks": the enforcer stops a violation. "Observes": it only notes it. Level MUST means required; SHOULD means yes by default.

Actions 4

NameWhat it doesFileWhen
validVersions in manifests are valid SemVer 2.0.0
norm SV-R01
checks/sv01_valid.ts
check
breakingA breaking change after a release raises the major (observes)
norm SV-R02
checks/sv02_breaking.ts
check
tagsRelease tags are valid SemVer 2.0.0
norm SV-R03
checks/sv03_tags.ts
check
nextThe project version, the last release and the next version from commitschecks/version.ts
shtuk run

shtuk check runs the checks; shtuk run std-semver <name> runs any action. "After install" actions run by themselves only if the package comes from a trusted source.

Pages 4

They go into the project at these paths.

Package files 7

They go into .shtukbase/packages/std-semver/; actions run from there.