#!/usr/bin/env bash # check-disk.sh — daily 80% threshold (§5.6). Exit 1 when over. set -uo pipefail : "${DISK_THRESHOLD:=80}" used=$(df --output=pcent / | tail -1 | tr -dc '0-9') echo "root filesystem ${used}% used (threshold ${DISK_THRESHOLD}%)" du -sh "$HOME"/workspace "${CARGO_TARGET_DIR:-$HOME/.cargo-target}" \ "$(pnpm config get store-dir 2>/dev/null || echo /nonexistent)" 2>/dev/null || true if (( used >= DISK_THRESHOLD )); then echo "OVER THRESHOLD — run 'cargo sweep --time 30' and 'pnpm store prune' before adding disk" >&2 exit 1 fi