BSD sed (macOS) and GNU sed (Linux) interpret `sed -i ''`
differently — GNU treats the empty string as the script
argument, not the backup suffix. Replace with portable
sed-to-tmpfile-and-mv pattern.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>