← back to Justin David Pricing 2026

am_report.sh

47 lines

#!/bin/bash
# DWLA per-yard GMC deploy — morning report (LOCAL, read-only).
# Verifies the overnight deploy + emails Steve via George + drops a CNCP note.
set -uo pipefail
DS="accounts/146735262/dataSources/10686764882"
LOG="$HOME/.claude/yolo-queue/gmc-dwla-peryard-deploy-log.json"
OUT="$HOME/.claude/yolo-queue/gmc-dwla-am-report-$(date +%Y%m%d).txt"

# 1. scale final count from deploy log
SCALE=$(python3 - "$LOG" <<'PY' 2>/dev/null
import json,sys
d=json.load(open(sys.argv[1]))
sc=[e for e in d if 'scale' in str(e.get('action','')).lower()]
last=sc[-1] if sc else {}
print(f"scale actions logged: {len(sc)}; last: {last.get('action')} ok={last.get('ok','?')} fail={last.get('fail','?')} total={last.get('total', last.get('attempted','?'))}")
PY
)

# 2. live MC verify (did the per-yard offers merge?)
VERIFY=$(cd "$HOME/Projects/gmc-titlefix" && node gmc-dwla-peryard-primary.js --verify --ds "$DS" 2>&1 | tail -20)

# 3. store-side clean check (feed-only invariant)
TOKEN=$(grep -m1 '^SHOPIFY_ADMIN_TOKEN=' "$HOME/Projects/secrets-manager/.env" | cut -d= -f2- | tr -d '"'"'"'\r')
STORE=$(curl -s "https://designer-laboratory-sandbox.myshopify.com/admin/api/2024-10/products.json?handle=islander-conch-wallcovering-phillipe-romano" -H "X-Shopify-Access-Token: $TOKEN" \
  | python3 -c "import json,sys;p=json.load(sys.stdin)['products'][0];print(', '.join(f\"{v['title']} \${v['price']} grams={v['grams']}\" for v in p['variants']))" 2>/dev/null)

BODY="<div style='font-family:-apple-system,Helvetica,sans-serif;color:#222'>
<h3>DWLA 'Los Angeles Fabrics' per-yard → Google Merchant Center — morning report</h3>
<p style='color:#888;font-size:13px'>$(date '+%Y-%m-%d %H:%M %Z') · datasource $DS · feed-only, read-only, \$0</p>
<p><b>1. Scale:</b> $SCALE</p>
<p><b>2. Live MC merge (per-yard offers appearing at correct price; ~24h Google lag from ~5pm 7/16 so morning may be partial):</b><br><pre style='font-size:12px;background:#f6f6f6;padding:8px;border-radius:6px;white-space:pre-wrap'>$VERIFY</pre></p>
<p><b>3. Sample-exclusion NEXT STEP (STEVE-GATED, not executed):</b> once per-yard offers are confirmed live, surgically suppress the \$4.25 sample offers (shopify_US_* offerIds) — NOT the blunt gmc-feed-exclude.js which delists whole products. Reply to run it.</p>
<p><b>4. Store-side (must be unchanged, feed-only):</b> islander-conch → $STORE</p>
<p style='color:#888;font-size:12px'>Revert everything: node ~/Projects/gmc-titlefix/gmc-dwla-peryard-primary.js --delete-ds $DS</p>
</div>"

{ echo "SCALE: $SCALE"; echo; echo "VERIFY:"; echo "$VERIFY"; echo; echo "STORE: $STORE"; } > "$OUT"

# George email
. "$HOME/.claude/skills/_shared/george-send.sh" 2>/dev/null
RESP="$(george_send steve-office steve@designerwallcoverings.com "DWLA per-yard GMC deploy — morning report $(date +%Y-%m-%d)" "$BODY" 2>&1)"
echo "$RESP" | grep -q '"success":true' && echo "emailed" || echo "email FAILED: $RESP"

# CNCP note
curl -sS --max-time 10 "http://localhost:3333/api/parking-lot" -H 'Content-Type: application/json' \
  -d "$(python3 -c "import json,sys;print(json.dumps({'url':'https://www.designerwallcoverings.com/collections/phillipe-romano','note':'[DWLA per-yard GMC deploy AM report] '+open('$OUT').read()[:400]}))")" >/dev/null 2>&1 && echo "CNCP posted" || echo "CNCP skip"