← back to Codex Review 2026 04 30

launch-fix.sh

69 lines

#!/usr/bin/env bash
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=4
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 3
  done
}

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

wait
echo "=== fix batch end $(date -Iseconds) ===" >> "$ROOT/fix-batch.log"
echo "" >> "$ROOT/fix-batch.log"
echo "=== fix summary ===" >> "$ROOT/fix-batch.log"
for p in "${PROJECTS[@]}"; do
  rc=$(cat "$ROOT/$p/fix_exit_code" 2>/dev/null || echo "?")
  dur=$(cat "$ROOT/$p/fix_duration_s" 2>/dev/null || echo "?")
  size=$(wc -c < "$ROOT/$p/CHANGES.md" 2>/dev/null || echo 0)
  before=$(wc -l < "$ROOT/$p/files-before.txt" 2>/dev/null || echo 0)
  after=$(wc -l < "$ROOT/$p/files-after.txt" 2>/dev/null || echo 0)
  printf "%-28s rc=%-3s dur=%4ss CHANGES=%6sB files: %s→%s\n" "$p" "$rc" "$dur" "$size" "$before" "$after" >> "$ROOT/fix-batch.log"
done