Skip to content

Add @wraith-protocol/codemod package for v1 migrations (#178) - #196

Merged
truthixify merged 2 commits into
wraith-protocol:developfrom
Jerryvic911:issue-178-codemod-package
Aug 28, 2026
Merged

Add @wraith-protocol/codemod package for v1 migrations (#178)#196
truthixify merged 2 commits into
wraith-protocol:developfrom
Jerryvic911:issue-178-codemod-package

Conversation

@Jerryvic911

Copy link
Copy Markdown
Contributor

Closes #178

Summary

New workspace package packages/codemod/ with a CLI
(npx @wraith-protocol/codemod v1 <path>) built on jscodeshift, plus
a programmatic API (runCodemod()).

Transforms (transforms/v1/)

One transform per breaking change currently documented in
MIGRATING.md:

  • typed-error-catch.cjs — rewrites
    catch (e) { if (e.message.includes(...)) } message-matching into
    e instanceof <TypedError> checks, against a table of known message
    fragments sourced directly from src/errors.ts, and merges in the
    required import from @wraith-protocol/sdk.
  • install-react-native-polyfills.cjs — inserts the required
    installReactNativePolyfills() call and import into React Native
    entry files that need it.

Both are conservative: only recognized patterns are rewritten, and
anything ambiguous is left untouched.

Testing

  • Each transform has a fixture pre/post pair under fixtures/, plus a
    shared no-op-file fixture confirming non-matching code is left
    alone.
  • Snapshot-style vitest tests cover each transform in isolation.
  • An end-to-end test runs the same jscodeshift Runner the CLI uses,
    against a temp fixture app directory.
  • Idempotency is verified at both the unit level (re-running a
    transform against its own output) and end-to-end (a full second CLI
    pass over the fixture app produces zero changes).
  • pnpm test, pnpm typecheck, and pnpm build all pass locally.

Docs

Documented in MIGRATING.md, above the existing manual per-change
instructions, with usage and a note on what the codemod does and
doesn't cover.

Notes

  • MIGRATING.md currently documents these two breaking changes under
    "Upgrading to 2.0.0," not a literal "v0.x → v1.0" section, and
    doesn't contain an "import path move" or "Announcement shape drift"
    breaking change (mentioned in the issue's context). I built
    transforms against what's actually documented and mechanically
    automatable — happy to add more if there's a change I'm missing.
  • pnpm-lock.yaml is updated for the new package's dependencies
    (jscodeshift, tsup, vitest, etc.) — 124 pure additions, no changes
    to existing entries.

@drips-wave

drips-wave Bot commented Aug 28, 2026

Copy link
Copy Markdown

@Jerryvic911 Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@truthixify
truthixify merged commit edd8a30 into wraith-protocol:develop Aug 28, 2026
13 checks passed
@truthixify

Copy link
Copy Markdown
Contributor

Merged. Idempotency verified by a second pass being a no-op, and a pre/post fixture per transform, which is what stops codemods rotting silently. Nice work @Jerryvic911.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

@wraith-protocol/codemod package for v0.x -> v1.0 migrations

2 participants