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/omega-mv/blob/main/tools/quietlock/testdata/quiet-guard.sh.base # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / tools / quietlock / testdata / quiet-guard.sh.base` 25 lines ยท 2001 bytes Raw Blame History 1 #!/bin/bash 2 # PreToolUse hook (Bash): block heavy builds/tests while the Spark quiet flag is held by someone else. 3 # Flag: ~/workspace/.spark-quiet (key-value lines). Holder marks its own commands with QUIET_HOLDER=1 4 # or adds a line "allow " to the flag; anything matching that regex is let through. 5 flag="$HOME/workspace/.spark-quiet" 6 [ -f "$flag" ] || exit 0 7 # Stale-flag release: if the holder pid is dead AND expected_end has passed, the hold is over. Never touches a live hold. 8 l=$(head -1 "$flag"); p=$(echo "$l" | grep -o "pid=[0-9]*" | cut -d= -f2); e=$(echo "$l" | grep -o "expected_end=[^ ]*" | cut -d= -f2) 9 if [ -n "$p" ] && [ -n "$e" ] && ! kill -0 "$p" 2>/dev/null && [ "$(date -u +%s)" -gt "$(date -u -d "$e" +%s 2>/dev/null || echo `9999999999`)" ]; then 10 echo "[$(date -u +%FT%TZ)] quiet-guard released stale flag: $l" >> "$HOME/workspace/.spark-quiet.history"; rm -f "$flag"; exit 0 11 fi 12 owner=$(echo "$l" | awk "{print \$1\" \"\$2\" \"\$3}") 13 cmd=$(jq -r '.tool_input.command // ""' 2>/dev/null) 14 [ -n "$cmd" ] || exit 0 15 case "$cmd" in *QUIET_HOLDER=1*) exit 0;; esac 16 # queen 2026-10-01: queueing a job for the forge is not running it; never block lanes.sh queue/queue-light/idea/ledger/brief 17 case "$cmd" in *lanes.sh\ queue*|*lanes.sh\ idea*|*lanes.sh\ ledger*|*lanes.sh\ brief*|*lanes.sh\ status*) exit 0;; esac 18 allow=$(grep -m1 '^allow ' "$flag" | cut -d' ' -f2-) 19 if [ -n "$allow" ] && printf '%s' "$cmd" | grep -Eq -- "$allow"; then exit 0; fi 20 heavy='(^|[;&| ])(make|cmake|ninja|ctest|cargo (build|test|run|bench|clippy)|qemu-system[a-z0-9-]*|gcc|g\+\+|clang|cc|rustc|verify_all\.sh|est_load|run_gate|\./test[-_a-z0-9]*)([ ;&|]|$)' 21 if printf '%s' "$cmd" | grep -Eq -- "$heavy"; then 22 echo "BLOCKED by quiet-guard: the Spark quiet flag is held by '${owner:-unknown}' ($l). Builds/tests/QEMU wait until the flag is released. Do code-only work or wait; check 'cat ~/workspace/.spark-quiet'. If you ARE the holder, prefix the command with QUIET_HOLDER=1." >&2 23 exit 2 24 fi 25 exit 0