From cc6655134e155dd0879ecb8eb009271e17488834 Mon Sep 17 00:00:00 2001 From: Lukasz Kasprzak Date: Mon, 17 Aug 2026 16:19:02 +0200 Subject: feat(cli): --version, a CHANGELOG, and a release target Groundwork for tagging. The project had no version anywhere: not in dune-project, not in the binary, no CHANGELOG, no tags. The version lives in two places -- dune-project, which generates colitur.opam, and a constant in bin/main.ml, which is what --version prints. Two rather than one because dune's watermarking only substitutes in a release tarball, so a binary built the ordinary way from a checkout would report a placeholder. The release target rewrites both and then re-checks both, and finally requires the freshly built binary to report the version it just wrote: a release that bumped one and not the other would ship a binary disagreeing with its own package metadata. --version is deliberately not embedded in the help text. cli.t pins help's first line, and a version there would mean editing a test expectation every release for no gain. The release target mirrors lectio's, refusals included: no release from a dirty tree, none without a CHANGELOG entry for that version, none whose version bump silently failed to apply, and `make check` -- the full 1583-9999 sweep, not the sampling suite -- must pass before the tag is created. --- test/cli.t | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'test') diff --git a/test/cli.t b/test/cli.t index d7e86f7..419e7f0 100644 --- a/test/cli.t +++ b/test/cli.t @@ -241,3 +241,21 @@ Every command the help lists is a command the binary actually accepts. This is the check that catches help text drifting away from the dispatch: $ for c in easter temporal day readings; do colitur $c 2026 > /dev/null || echo "$c FAILED"; done + +--version prints the version alone, to standard output, exit 0. Deliberately +not embedded in the help text above: this pin would then have to be edited +every release, for no gain. The Makefile's release target asserts the built +binary reports the version it just wrote, so the two cannot drift. + + $ colitur --version + 0.1.0 + + $ colitur -V + 0.1.0 + +Agreement with the package metadata (dune-project's own (version ...), which +generates colitur.opam) is NOT asserted here: the cram sandbox has no source +tree to read dune-project from. It is asserted in the Makefile's release +target instead, which rewrites both and then requires the freshly built +binary to report the version it just wrote -- the point in time where a drift +between the two could actually be introduced. -- cgit v1.3