#!/usr/bin/env sh
# bd-shim v1
# bd-hooks-version: 0.41.0
#
# bd (beads) prepare-commit-msg hook - thin shim
#
# This shim delegates to 'bd hooks run prepare-commit-msg' which contains
# the actual hook logic. This pattern ensures hook behavior is always
# in sync with the installed bd version - no manual updates needed.
#
# Arguments:
#   $1 = path to the commit message file
#   $2 = source of commit message (message, template, merge, squash, commit)
#   $3 = commit SHA-1 (if -c, -C, or --amend)

# Check if bd is available
if ! command -v bd >/dev/null 2>&1; then
    echo "Warning: bd command not found in PATH, skipping prepare-commit-msg hook" >&2
    echo "  Install bd: brew install steveyegge/tap/bd" >&2
    echo "  Or add bd to your PATH" >&2
    exit 0
fi

exec bd hooks run prepare-commit-msg "$@"
