@fern-api/replay
v0.16.2
Published
Automatically preserves SDK customizations across Fern regenerations
Keywords
Readme
@fern-api/replay
Automatically preserves SDK customizations across Fern regenerations.
What it does
Fern Replay detects your edits to generated SDK code, stores them as patches in .fern/replay.lock, and re-applies them after each regeneration using 3-way merge. Your customizations survive fern generate without manual intervention.
The replay loop
Three phases. The generator runs between detect and apply, overwriting everything in the SDK directory.
- Detect — find new customizations in the customer's git history since the last generation
- Apply — put them back onto the freshly generated code via 3-way merge
- Commit — record the result as a
[fern-replay]commit on top of the[fern-generated]one
Vocabulary
The team's canonical vocabulary — customization, patch, generation, the three merge sides, the patch lifecycle verbs — lives in CONTEXT.md.
Documentation
CONTEXT.md— domain language and team voicedocs/architecture.md— module structure, design decisions, integration withfern/ferndocs/reference.md— types, customer flows, CLI commands, key algorithmsdocs/known-divergences.md— places where multiple implementations exist intentionallydocs/migration-guide.md— upgrade and migration notes
Install
npm install @fern-api/replayDevelopment
npm install
npm run build
npm testLocal Development with Fern CLI
To use a local version of @fern-api/replay with the Fern CLI monorepo:
# From the fern-replay directory
cd /path/to/fern-replay
pnpm link --global
# From the fern monorepo root
cd /path/to/fern
pnpm link --global @fern-api/replayVerify the link is working:
ls -la node_modules/@fern-api/replay
# Should show a symlink pointing to your local fern-replay directoryAny changes you make in fern-replay will be picked up immediately without reinstalling.
To unlink and restore the published npm version:
pnpm unlink @fern-api/replay
pnpm installLicense
MIT
