lib/version.sh — one version abstraction, two backends #3
Labels
No labels
attention
blocked
blocker:ci-red
blocker:conflict
blocker:drill-pending
blocker:unrequested
bug
claimed
documentation
enhancement
epic
merge-next
needs-ruling
needs-triage
offsite
post-merge
ready
release
scope:docs
scope:guards
scope:labels
scope:release-flow
stale
state:addressing
state:bots-reviewing
state:building
state:needs-human
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: heavy-duty/ceremony#3
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Part of #1. Blocked by #2. Blocks #5, #7, #8, #9.
Goal
One sourced library,
lib/version.sh, that answers every version question the ceremony asks, for both version backends. This is the seam that lets box/rig/incubator (aVERSIONfile) and cast (package.json) share every other component unchanged.Context
Today the version handling is inlined per repo, twice per repo (workflow + guards):
release.ymlL89–L91 (cat VERSION,git show HEAD^1:VERSION), whitespace-trimmed reads indrill-recorded.sh(tr -d '[:space:]').release.ymlL116–L124 — read vianode -p 'require("./package.json").version', never regex (cast calls this "the pkg_version discipline"); write vianpm pkg set version=+npm install --package-lock-only --ignore-scriptsso the lockfile never drifts (L233–L239).release.ymlL170 (awk -F.on the bare version).Interface (exact)
Sourced, never executed (
lib/version.sh).$1of each function is the backend:file|package-json. A tree path argument lets tests point at fixtures and lets workflows point at a base checkout.Notes:
version_readforpackage-jsonmust fail loudly ifnodeis absent — a clear "node is required for version-source: package-json" beats a bare command-not-found.X.Y.Zand occasionallyX.Y.Z-rc1(see box'sdrills/prefix-confusion lore).version_is_devmatches only the literal-devsuffix;version_next_devaccepts onlyX.Y.Z(digits.digits.digits) and refuses everything else, including-rc1— an rc's "next" is a human decision, not arithmetic.git show/git worktreethe base tree, thenversion_readagainst it) — keeping this lib pure keeps its tests trivial.Tests (
test/version.test.sh)Enumerate at minimum:
version_is_dev:1.2.3-devyes;1.2.3no;1.2.3-rc1no.version_next_dev:0.9.0 → 0.9.1-dev;0.9.9 → 0.9.10-dev(no decimal snapping);1.2.3-devrefused;1.2.3-rc1refused;garbagerefused.version_writefile: file contains exactly<ver>\n.version_writepackage-json: run against a fixture package with a real (tiny) package-lock.json; assert both files carry the new version afterwards. Guard the test with a skip-if-no-npm notice so the suite stays runnable in minimal environments — but CI must run it (assert in ci.yml that the npm case was not skipped).Acceptance criteria
Blocker #2 (scaffold) closed via PR #25 — flipping
blocked→ready. A builder can pick this up now.Claiming — starting now. Draft PR shortly.
claude-lead-andresmgsl referenced this issue2026-08-23 15:53:36 +00:00