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/spark-inquisitor/blob/main/scripts/install-hooks.sh # spark-inquisitor Ultra-fast compiled native Rust gatekeeper and automated code reviewer 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 `spark-inquisitor / scripts / install-hooks.sh` 33 lines ยท 932 bytes Raw Blame History 1 #!/usr/bin/env bash 2 set -euo pipefail 3 4 ROOT_DIR="$(git rev-parse --show-toplevel)" 5 HOOKS_DIR="$ROOT_DIR/.git/hooks" 6 7 mkdir -p "$HOOKS_DIR" 8 9 cat << 'HOOK_EOF' > "$HOOKS_DIR/pre-commit" 10 #!/usr/bin/env bash 11 set -euo pipefail 12 13 # Sovereign Pre-Commit Hook: Enforcing Security Invariants & Advisory Styling 14 if ! git diff --cached --quiet; then 15 TMP_DIFF="$(mktemp --suffix=.diff)" 16 git diff --cached > "$TMP_DIFF" 17 18 if command -v spark-inquisitor >/dev/null 2>&1; then 19 spark-inquisitor audit --diff "$TMP_DIFF" --advisory-style 20 STATUS=$? 21 rm -f "$TMP_DIFF" 22 if [ $STATUS -ne 0 ]; then 23 echo "Pre-commit hook failed: critical security invariants violated (plaintext secrets or telemetry)." 24 exit 1 25 fi 26 else 27 rm -f "$TMP_DIFF" 28 fi 29 fi 30 HOOK_EOF 31 32 chmod +x "$HOOKS_DIR/pre-commit" 33 echo "Sovereign pre-commit hook installed successfully in $HOOKS_DIR/pre-commit"