The script was using realpath on the output directory without ensuring it
exists first, which would cause an error if the directory did not exist.
Add mkdir -p "$outdir" after line 7 to create the output directory before
it is used.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>