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
aien-sovereign-core-mv / scripts / install-hooks.sh
| 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 | set -euo pipefail |
| 18 | |
| 19 | ROOT_DIR="$(git rev-parse --show-toplevel)" |
| 20 | HOOKS_DIR="$ROOT_DIR/.git/hooks" |
| 21 | |
| 22 | mkdir -p "$HOOKS_DIR" |
| 23 | |
| 24 | cat << 'HOOK_EOF' > "$HOOKS_DIR/pre-commit" |
| 25 | #!/usr/bin/env bash |
| 26 | set -euo pipefail |
| 27 | |
| 28 | # Sovereign Pre-Commit Hook: Enforcing Security Invariants & Advisory Styling |
| 29 | if ! git diff --cached --quiet; then |
| 30 | TMP_DIFF="$(mktemp --suffix=.diff)" |
| 31 | git diff --cached > "$TMP_DIFF" |
| 32 | |
| 33 | if command -v spark-inquisitor >/dev/null 2>&1; then |
| 34 | spark-inquisitor audit --diff "$TMP_DIFF" --advisory-style |
| 35 | STATUS=$? |
| 36 | rm -f "$TMP_DIFF" |
| 37 | if [ $STATUS -ne 0 ]; then |
| 38 | echo "Pre-commit hook failed: critical security invariants violated (plaintext secrets or telemetry)." |
| 39 | exit 1 |
| 40 | fi |
| 41 | else |
| 42 | rm -f "$TMP_DIFF" |
| 43 | fi |
| 44 | fi |
| 45 | HOOK_EOF |
| 46 | |
| 47 | chmod +x "$HOOKS_DIR/pre-commit" |
| 48 | echo "Sovereign pre-commit hook installed successfully in $HOOKS_DIR/pre-commit" |