#!/bin/sh
# SPDX-FileCopyrightText: 2026 Domantas Adomėlis <legal@denaerium.com>
# SPDX-License-Identifier: MIT OR Apache-2.0

set -u

if ! command -v cog >/dev/null 2>&1; then
    echo "cocogitto not installed: cargo install cocogitto (or pacman -S cocogitto)" >&2
    exit 1
fi

if ! cog verify --file "$1"; then
    echo "Commit message does not follow Conventional Commits." >&2
    echo "Format: type(scope)?: description  (e.g. feat(api): add rate limiting)" >&2
    exit 1
fi
