#!/bin/sh # Print index.html to loop-claude-explained.pdf beside it, in the playwright-for-claude image. # The image comes from ~/code/playwright-for-agents: its ./pw builds it on first use. set -eu here=$(cd "$(dirname "$0")" && pwd) work=$(mktemp -d) trap 'rm -rf "$work"' EXIT if ! docker image inspect playwright-for-claude >/dev/null 2>&1; then echo "No playwright-for-claude image. Build it once with: ~/code/playwright-for-agents/pw about:blank" >&2 exit 1 fi # index.html is an artifact body, without a doctype, head or body of its own, so wrap it as the artifact host does. { printf '
\n' cat "$here/index.html" printf '\n' } > "$work/page.html" cp "$here/render-pdf.js" "$work/" docker run --rm --init --memory 2g --memory-swap 2g -v "$work:/work" -w /work --entrypoint node playwright-for-claude render-pdf.js cp "$work/out.pdf" "$here/loop-claude-explained.pdf" echo "Wrote $here/loop-claude-explained.pdf"