#!/usr/bin/env bash
# Copyright 2026 Petri Koistinen. Licensed under the Apache License, Version 2.0.
#
# Mandatory pre-commit gate; enabled per clone by scripts/install-hooks.sh.
# Bypassing it (--no-verify or otherwise) is prohibited for every
# contributor, human or AI agent alike.

set -eu

root=$(git rev-parse --show-toplevel)

# The workspace version is the UTC day the tree was last committed on.
# When the day has changed since the stamp, the commit carries a fresh
# stamp, so no build published from main names an earlier day.
stamped=$("$root/scripts/version-stamp.sh")
if [ -n "$stamped" ]; then
    echo "$stamped"
    git add "$root/Cargo.toml" "$root/Cargo.lock"
fi

# Mandatory fast quality gates; bypassing them (--no-verify or
# otherwise) is prohibited for every contributor, human or AI agent.
exec "$root/scripts/verify-commit.sh"
