← back to Codex Review 2026 04 30

launch-all.sh

72 lines

#!/usr/bin/env bash
# Run codex review against all 25 tracked projects, 5 at a time.
set -u
ROOT="$HOME/Projects/codex-review-2026-04-30"
cd "$ROOT" || exit 1

PROJECTS=(
  bankrupt-leads
  professional-directory
  lawyer-directory-builder
  site-factory
  the-ai-factory
  visual-factory
  secrets-manager
  Hormuzy
  resize-it
  yolo-agent
  Forza
  trademarks-copyright
  Ken
  VictoryStays
  malden-house
  jill-website
  stayclaim
  wholivedthere
  claimmyaddress
  bubbesblock
  Letsbegin
  dear-bubbe-next
  AgentAbrams
  Designer-Wallcoverings
  Norma
)

CONCURRENCY=5
PIDS=()

reap() {
  while [ "${#PIDS[@]}" -ge "$CONCURRENCY" ]; do
    for i in "${!PIDS[@]}"; do
      if ! kill -0 "${PIDS[$i]}" 2>/dev/null; then
        unset 'PIDS[i]'
      fi
    done
    PIDS=("${PIDS[@]}")
    [ "${#PIDS[@]}" -ge "$CONCURRENCY" ] && sleep 2
  done
}

echo "=== batch start $(date -Iseconds) ===" > "$ROOT/batch.log"
for p in "${PROJECTS[@]}"; do
  reap
  echo "[$(date +%H:%M:%S)] launching $p" >> "$ROOT/batch.log"
  ./run-codex.sh "$p" &
  PIDS+=("$!")
done

wait
echo "=== batch end $(date -Iseconds) ===" >> "$ROOT/batch.log"

# Summarize
echo "" >> "$ROOT/batch.log"
echo "=== summary ===" >> "$ROOT/batch.log"
for p in "${PROJECTS[@]}"; do
  rc_file="$ROOT/$p/exit_code"
  dur_file="$ROOT/$p/duration_s"
  size=$(wc -c < "$ROOT/$p/review.md" 2>/dev/null || echo 0)
  rc=$(cat "$rc_file" 2>/dev/null || echo "?")
  dur=$(cat "$dur_file" 2>/dev/null || echo "?")
  printf "%-28s rc=%-3s dur=%4ss size=%6sB\n" "$p" "$rc" "$dur" "$size" >> "$ROOT/batch.log"
done