[object Object]

← back to Designer Wallcoverings

Durable launchd morning report for Kravet roll-variant runner (CNCP win + macOS notification, no Claude needed)

c5d370e13800eae1521cf803180ff883a89bc5ca · 2026-06-11 16:10:04 -0700 · SteveStudio2

Files touched

Diff

commit c5d370e13800eae1521cf803180ff883a89bc5ca
Author: SteveStudio2 <stevestudio2@SteveStacStudio.lan>
Date:   Thu Jun 11 16:10:04 2026 -0700

    Durable launchd morning report for Kravet roll-variant runner (CNCP win + macOS notification, no Claude needed)
---
 shopify/scripts/cadence/kravet-roll-report.sh | 34 +++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

diff --git a/shopify/scripts/cadence/kravet-roll-report.sh b/shopify/scripts/cadence/kravet-roll-report.sh
new file mode 100755
index 00000000..8d605237
--- /dev/null
+++ b/shopify/scripts/cadence/kravet-roll-report.sh
@@ -0,0 +1,34 @@
+#!/bin/zsh
+# kravet-roll-report.sh — durable, Claude-independent morning report on the Kravet roll-variant
+# runner. Reads the audit table, writes a summary file, fires a macOS notification, and posts a
+# CNCP win when variants were added. Runs via launchd (com.steve.kravet-roll-report), 06:12 daily.
+set -u
+OUT=/tmp/kravet-roll-report.txt
+PSQL=/usr/local/bin/psql; [ -x "$PSQL" ] || PSQL=$(command -v psql)
+
+# today's committed adds + cumulative + remaining backlog estimate
+ADDED_TODAY=$("$PSQL" -d dw_unified -At -c "SELECT count(*) FROM kravet_roll_add_audit WHERE committed AND ts::date = current_date;")
+ADDED_TOTAL=$("$PSQL" -d dw_unified -At -c "SELECT count(*) FROM kravet_roll_add_audit WHERE committed;")
+FAILED_TODAY=$("$PSQL" -d dw_unified -At -c "SELECT count(*) FROM kravet_roll_add_audit WHERE NOT committed AND ts::date = current_date;")
+CAP_HIT=$(grep -c "variant creation limit" /tmp/kravet-roll-variants.log 2>/dev/null || echo 0)
+
+{
+  echo "Kravet roll-variant runner — report $(date '+%Y-%m-%d %H:%M')"
+  echo "  added today:      ${ADDED_TODAY:-0} roll variants at MAP"
+  echo "  added cumulative: ${ADDED_TOTAL:-0}"
+  echo "  failed today:     ${FAILED_TODAY:-0}  (daily-cap hits in log: ${CAP_HIT})"
+  echo "  log tail:"
+  tail -6 /tmp/kravet-roll-variants.log 2>/dev/null | sed 's/^/    /'
+} > "$OUT"
+
+# macOS notification (durable, no Claude needed)
+/usr/bin/osascript -e "display notification \"added ${ADDED_TODAY:-0} today, ${ADDED_TOTAL:-0} total, ${FAILED_TODAY:-0} failed\" with title \"Kravet roll variants\"" 2>/dev/null
+
+# post a CNCP win only when something actually landed
+if [ "${ADDED_TODAY:-0}" -gt 0 ]; then
+  /usr/bin/curl -s -X POST http://127.0.0.1:3333/api/wins \
+    -H 'Content-Type: application/json' \
+    -d "{\"project\":\"designer-wallcoverings\",\"title\":\"Kravet roll variants: +${ADDED_TODAY} priced at MAP\",\"summary\":\"Nightly runner added ${ADDED_TODAY} Single-Roll variants at MAP (cumulative ${ADDED_TOTAL}); ${FAILED_TODAY} failed.\",\"valueToday\":\"Kravet-family wallpapers now sellable by the roll\"}" >/dev/null 2>&1
+fi
+
+cat "$OUT"

← 4e4cff4e Add Kravet roll-variant adder: idempotent, MAP-priced, audit  ·  back to Designer Wallcoverings  ·  Durable one-shot launchd test-add (5:02pm, survives session 7a10f8ec →