#!/usr/bin/env bash
# CHECK-quill-draft-compliance (lane copy) -- delegates to the repository gate.
#
# WHAT THIS FILE USED TO BE, AND WHY IT IS NOT ANY MORE (Q154)
#   It was a second, independent implementation of the same gate: a bash script
#   with a `python3 -` heredoc that scanned the lane through the absolute path
#   /root/troupe-standup/wizard-work/quill, appended a row read from
#   /root/.hermes/wizard-outputs/quill/ (a file outside the repository), and
#   regenerated the table WITHOUT its header line so that its `diff` would read
#   clean -- which is why the committed table at HEAD had 82 rows and no header.
#   Two implementations of one gate is also why the tree carried two different
#   verdicts for the same artifact.
#
#   There is now exactly one gate, at the repository root, and this path is a
#   pointer to it: same legs, same exit codes, no second rule list, no host
#   path. Arguments are passed through.
#
# Exit codes are the root gate's: 0 all legs passed, 1 a fault, 2 ungradable.
set -u

HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" || exit 2
ROOT="$(cd "$HERE/../.." && pwd)" || exit 2
GATE="$ROOT/CHECK-quill-draft-compliance"

if [ ! -f "$GATE" ]; then
    echo "delegation target missing: $GATE" >&2
    exit 2
fi

exec bash "$GATE" "$@"
