#!/usr/bin/env bash
#MISE description="Bump version in moon.mod to match computed release version"
#MISE depends=["release:version"]
set -euo pipefail

VERSION=$(mise run release:version 2>/dev/null | tail -1)

# Update moon.mod version field (portable across GNU and BSD sed)
sed -E "s/^version[[:space:]]*=[[:space:]]*\"[^\"]*\"/version = \"$VERSION\"/" moon.mod > moon.mod.tmp
mv moon.mod.tmp moon.mod

echo "Bumped moon.mod version to $VERSION"
