## Summary
- CI publish workflow fails when re-run after a partial publish because
npm rejects republishing an existing version
- Add version-published checks to `check-npm-packages.js` so
already-published packages are skipped in the dry-run step
- Extract a shared `publish-if-needed.sh` script that checks the npm
registry before publishing, used by all three trusted publish steps
- Consolidate the old `checkPackageExists` and new version check into a
single `npmViewVersion` helper to avoid redundant npm registry calls
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>