Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/aien-architecture-mv/blob/main/tools/name-check/gate.sh # aien-architecture-mv Canonical architecture for the AIEN ecosystem: flows, boundaries, ADRs, and the map from design to implementation repositories. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `aien-architecture-mv / tools / name-check / gate.sh` 34 lines ยท 1952 bytes Raw Blame History 1 #!/bin/sh 2 # Bootstrap trust boundary, as in ../doctrine/gate.sh: authenticate AIEN_OMC against 3 # ../zero-legacy/omega.pin before executing it. The judgments are made in namecheck.om and gate.om; 4 # this script only selects the change under review and hands its git diff to them. 5 # gate.sh ROOT [BASE] BASE defaults to origin/main when it exists, else HEAD~1; the change is 6 # merge-base(BASE, HEAD)..HEAD. 7 set -eu 8 root="${1:?usage: gate.sh ROOT [BASE]}" 9 base="${2:-}" 10 # ROOT is resolved against the caller's directory before this script changes directory 11 root=$(cd "$root" && pwd) || { echo "gate.sh: ROOT $1 is not a directory" >&2; exit 2; } 12 cd "$(dirname "$0")" 13 not_run() { echo "gate.sh: AIEN_OMC is unavailable or not independently pinned (NOT_RUN)" >&2; exit 3; } 14 [ -n "${AIEN_OMC:-}" ] && [ -x "$AIEN_OMC" ] || not_run 15 want=$(sed -n 's/^omc_sha256: //p' ../zero-legacy/omega.pin) || not_run 16 [ "${#want}" -eq 64 ] || not_run 17 case "$want" in *[!0-9a-f]*) not_run ;; esac 18 have=$(sha256sum -- "$AIEN_OMC") || not_run 19 have=${have%% *} 20 [ "$have" = "$want" ] || not_run 21 if [ -z "$base" ]; then 22 if git -C "$root" rev-parse -q --verify origin/main >/dev/null; then base=origin/main; else base=HEAD~1; fi 23 fi 24 mb=$(git -C "$root" merge-base "$base" HEAD) || { echo "gate.sh: no merge base with $base" >&2; exit 2; } 25 mkdir -p build 26 # fixed prefixes and no textconv, whatever the user or repository config says (diff.noprefix, 27 # diff.mnemonicPrefix, textconv drivers): the judge must see the bytes git stores, under b/PATH 28 git -C "$root" -c core.quotePath=false diff --no-color --no-ext-diff --no-textconv \ 29 --src-prefix=a/ --dst-prefix=b/ -U0 "$mb" HEAD > build/change.diff 30 printf 'AIEN-OBS name_check_base "%s"\n' "$mb" 31 "$AIEN_OMC" < gate.om > build/gate 32 chmod +x build/gate 33 [ -s build/gate ] || { echo "gate.sh: AIEN_OMC produced no program from gate.om (NOT_RUN)" >&2; exit 3; } 34 exec build/gate "$AIEN_OMC" build/change.diff