Versioning

kbuild uses a git-distance based versioning scheme. Instead of deriving version bumps from conventional commit messages, the patch component is computed directly from git revision counts — producing deterministic, monotonically increasing version numbers tied to the commit graph.

Version format

<major>.<minor>.<distance>

major and minor are taken from the package’s existing version string (e.g. the version field in kmono config). distance is a git-derived value that differs between main and feature branches.

Main branch

On the main branch, distance equals the total number of git revisions:

1.2.548

This means every merge to main produces a strictly increasing version.

Feature branches

On a feature branch, distance is a two-part value: <base>-<delta>.

  • base — the number of revisions up to the merge-base with the main branch (the point where the feature branch diverged).

  • delta — the number of revisions on the feature branch since that divergence point.

1.2.501-47

This ensures feature-branch versions never collide with main-branch versions and clearly indicate how far ahead of the fork point a branch has progressed.

API

kbuild.version/inc-package-versions

(kbuild.version/inc-package-versions opts packages)

Updates every package in the packages map with a git-distance version.

Options

Key Default Description

:main-branch

"master"

Name of the main integration branch used for distance calculation.

Examples

Branch Package version Distance Result

master

"1.2.3"

548

"1.2.548"

feature

"1.2.3"

501-47

"1.2.501-47"

master

nil

548

"0.0.548"