← back to Norma
agents/instagram-agent/phase1-check.sh
20 lines
#!/bin/bash
# 48h IG Phase-1 rollout check — verify accounts, alert Steve, then self-unload (one-shot).
export PATH=/opt/homebrew/bin:/usr/bin:/bin
cd /Users/macstudio3/Projects/Norma/agents/instagram-agent
V=$(node post-to.js verify 2>&1)
REST=$(echo "$V" | grep -i "restricted" | head -5)
RESHARES=$(cat data/reshares-*.jsonl 2>/dev/null | wc -l | tr -d ' ')
REPLIES=$(cat data/comment-replies-*.jsonl 2>/dev/null | wc -l | tr -d ' ')
if [ -n "$REST" ]; then
MSG="⚠️ IG Phase-1 48h: RESTRICTED accounts found — PAUSE the schedules. $REST"
else
MSG="✅ IG Phase-1 48h: all accounts healthy. ${RESHARES} reshares, ${REPLIES} replies so far. OK to expand data/reshare-phase.json to the next batch."
fi
osascript -e "display notification \"${MSG}\" with title \"IG Phase-1 48h check (TK-10574)\" sound name \"Glass\"" 2>/dev/null
curl -s -X POST http://127.0.0.1:3333/api/parking-lot -H 'Content-Type: application/json' \
-d "{\"title\":\"IG Phase-1 48h check (TK-10574)\",\"note\":$(printf '%s' "$MSG" | python3 -c 'import json,sys;print(json.dumps(sys.stdin.read()))'),\"project\":\"norma-instagram\"}" >/dev/null 2>&1
echo "$(date): $MSG" >> /tmp/dw-ig-phase1-check.log
# one-shot: unload myself so it never re-fires
launchctl bootout gui/$(id -u)/com.steve.dw-ig-phase1-check 2>/dev/null