#!/bin/bash S=/tmp/claude-1000/-home-jmm-Code-blogposts/7ba1f72e-807b-4749-bcd3-a065da793e6d/scratchpad cd $S API="https://api.tangled.org/xrpc/sh.tangled.repo.countPullsBy?subject=did:plc:nlzmjyfv6loqtxyzvdcznwgf" echo "=== waiting for api.tangled.org ===" for i in $(seq 1 240); do code=$(curl -s -m 20 -o /dev/null -w "%{http_code}" "$API") if [ "$code" = "200" ]; then echo "API healthy after $((i*30))s"; break; fi echo " [$i] http $code, retrying in 30s"; sleep 30 done [ "$code" != "200" ] && { echo "GAVE UP: API still down"; exit 1; } set -e echo "=== stage 1: pulls (knot1) ==="; python3 crawl_pulls.py echo "=== stage 2: owner backfill ==="; python3 stage2_backfill.py 2>&1 | grep -v "^ERR" | tail -5 cat repo_dids.txt repo_dids_extra.txt | sort -u > .d && mv .d repo_dids.txt echo "=== stage 1b: pulls (off-knot) ==="; python3 crawl_pulls.py echo "=== stage 3: merged pull index ==="; python3 stage3_commits.py 2>&1 | grep -v "^ERR" | tail -4 echo "=== stage 3b: patch blobs ==="; python3 stage3b_blobs.py 2>&1 | grep -v "^ERR" | tail -3 echo "=== stage 4: handles ==="; python3 stage4_handles.py 2>&1 | grep -v "^ERR" | tail -2 echo "=== analyze + build ==="; python3 analyze.py > analyze_out.txt && python3 build_html.py echo "PIPELINE_DONE"