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-sovereign-core-mv/blob/main/scripts/preflight-branch-guard.sh # aien-sovereign-core-mv AienOS host runtime: inference scheduling, paged KV state, the aien CLI and Spark verification tooling. Its inference engine is in alpha testing (DGX Spark GB10); Omega is the implementation destination. 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-sovereign-core-mv / scripts / preflight-branch-guard.sh` 52 lines ยท 2118 bytes Raw Blame History 1 #!/usr/bin/env bash 2 # SPDX-License-Identifier: Apache-2.0 3 # Copyright 2026 Drake Stapleton (AIEN / aien-dev) 4 # 5 # Licensed under the Apache License, Version 2.0 (the "License"); 6 # you may not use this file except in compliance with the License. 7 # You may obtain a copy of the License at 8 # 9 # http://www.apache.org/licenses/LICENSE-2.0 10 # 11 # Unless required by applicable law or agreed to in writing, software 12 # distributed under the License is distributed on an "AS IS" BASIS, 13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 # See the License for the specific language governing permissions and 15 # limitations under the License. 16 17 # Branch policy check used by agent-preflight.sh. 18 # 19 # AIEN_PREFLIGHT_CONTEXT selects what is being validated: 20 # developer (default) work in progress. Direct work on main is refused. 21 # merged-tree a tree that already landed on main (CI on push to main). 22 # Being on main is expected, so the branch rule does not apply. 23 # Any other value is an error, so a typo can never silently skip the guard. 24 set -eo pipefail 25 26 CONTEXT="${AIEN_PREFLIGHT_CONTEXT:-developer}" 27 BRANCH=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo "unknown") 28 29 case "$CONTEXT" in 30 developer) 31 if [ "$BRANCH" = "main" ]; then 32 echo "FAILED" 33 echo "Error: Cannot commit directly to main. Create a feature branch (e.g. feat/, fix/)." 34 exit 1 35 fi 36 echo "PASSED (Branch: $BRANCH)" 37 ;; 38 merged-tree) 39 # Only honoured on the real CI runner validating main; a local shell cannot claim it. 40 if [ "${GITHUB_ACTIONS:-}" != "true" ] || [ "${GITHUB_REF:-}" != "refs/heads/main" ]; then 41 echo "FAILED" 42 echo "Error: merged-tree context is only valid in GitHub Actions on refs/heads/main." 43 exit 1 44 fi 45 echo "PASSED (merged-tree context; branch rule not applicable, checked out: $BRANCH)" 46 ;; 47 *) 48 echo "FAILED" 49 echo "Error: unknown AIEN_PREFLIGHT_CONTEXT '$CONTEXT' (use developer or merged-tree)." 50 exit 1 51 ;; 52 esac