← back to Dw Activation Calendar
regen.sh
17 lines
#!/bin/zsh
# Daily re-projection of the SKU activation schedule: re-stamps every staged
# item's go-live DATE+TIME against the current worklist (items already drained
# drop out, remaining items get fresh slots). Idempotent, read-only vs dw_unified.
set -u
export PATH="/opt/homebrew/opt/postgresql@14/bin:/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
DIR="$HOME/Projects/dw-activation-calendar"
LOG="$DIR/regen.log"
cd "$DIR" || exit 1
echo "[$(date '+%Y-%m-%d %H:%M:%S')] regen start" >>"$LOG"
# --- re-intro guard pre-check (TK-10474): FAIL-CLOSED — abort if guard missing/non-exec OR trips ---
GUARD="$HOME/Projects/dw-activation-calendar/scripts/check-reintro-guard.sh"
if [ ! -x "$GUARD" ]; then echo "[$(date '+%Y-%m-%d %H:%M:%S')] ABORT: re-intro guard missing/not executable — failing closed" >>"$LOG"; exit 1; fi
if ! "$GUARD" >>"$LOG" 2>&1; then echo "[$(date '+%Y-%m-%d %H:%M:%S')] ABORT: re-intro guard drift detected — schedule regen skipped" >>"$LOG"; exit 1; fi
node scripts/generate-schedule.js >>"$LOG" 2>&1
echo "[$(date '+%Y-%m-%d %H:%M:%S')] regen end rc=$?" >>"$LOG"