feat: add compute-version.sh + bats tests

Emits <upstream-tag>-seth<N> to stdout. Pure logic, no side effects.
5/5 bats tests pass; output verified as 3.99-master618-seth1.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-29 10:18:12 -04:00
parent 52096c0d63
commit 9cc418c68f
2 changed files with 73 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
#!/usr/bin/env bash
# Emit "<upstream-tag>-seth<N>" version string to stdout.
# Pure logic: no side effects.
#
# CALLER RESPONSIBILITY (per spec §5.4): the local tag db must be fresh.
# If invoked outside the release flow, run `git fetch origin --tags` first
# or risk a stale <N> value.
#
# Spec: sethlabels-docs/specs/2026-04-29-packaging-design.md §5.4 (D4)
set -euo pipefail
upstream_tag=$(git describe --tags --abbrev=0 upstream/master)
existing_count=$(git tag --list "${upstream_tag}-seth*" | wc -l | tr -d ' ')
next_n=$((existing_count + 1))
echo "${upstream_tag}-seth${next_n}"