feat(cli): push clean diff branch with original package name for sdk preview#15076
Merged
feat(cli): push clean diff branch with original package name for sdk preview#15076
Conversation
…preview When using `fern sdk preview --push-diff`, split into two generation jobs: - Job 1: publish preview package to registry (preview-scoped name) - Job 2: push clean diff branch to SDK repo (original package name) This ensures the diff branch shows real API changes without preview artifacts like package name rewrites to @org-preview/pkg. Co-Authored-By: Claude Opus 4.6 <[email protected]>
There was a problem hiding this comment.
Claude Code Review
This repository is configured for manual code reviews. Comment @claude review to trigger a review and subscribe this PR to future pushes, or @claude review once for a one-time review.
Tip: disable this comment in your organization's Code Review settings.
Contributor
🌱 Seed Test SelectorSelect languages to run seed tests for:
How to use: Click the ⋯ menu above → "Edit" → check the boxes you want → click "Update comment". Tests will run automatically and snapshots will be committed to this PR. |
Swimburger
approved these changes
Apr 16, 2026
The diff branch was getting an empty package name because overrideGroupOutputForDiffBranch was setting publishInfo to undefined. The TypeScript generator reads the package name from publishInfo, so without it the generated package.json had name: "". Preserve the original publishInfo so the generator produces code with the correct package name. Fiddle's dryRun=true prevents actual publishing. Verified end-to-end: diff branch now has the original @fern-demo/sdk-preview-test package name instead of empty string. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Only package name and registry URL are needed for code generation on the diff branch. Stripping tokens prevents accidental production publishing if the server-side dryRun guard were ever bypassed. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Use return values instead of empty block statements in _visit callbacks to satisfy biome's noEmptyBlockStatements rule. Co-Authored-By: Claude Opus 4.6 <[email protected]>
Unknown _other variants and postman (which has no package name) now return undefined instead of leaking credentials. Fail-safe: if a new variant is added, it won't silently pass through with tokens intact. Co-Authored-By: Claude Opus 4.6 <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When using
fern sdk preview --push-diff, the CLI now runs two separate generation jobs:@org-preview/pkg), same as before.The two-job approach works with the Fiddle-side
!dryRunguard (fern-api/fiddle#701) — Job 2 usesfiddlePreview=truewhich setsdryRun=true, preventing the publish override from firing while keeping the generator in github mode.Changes
overrideOutputForPreview.ts: SimplifiedoverrideGroupOutputForPreview()to always usepublishV2(npmOverride). Added newoverrideGroupOutputForDiffBranch()that producesgithubV2(push)with original owner/repo and nopublishInfo, filtering out generators without GitHub config.sdkPreview.ts: When--push-diffis active and the generator has GitHub config, runs Job 1 then Job 2 sequentially. UsescommonRemoteArgsto reduce duplication.overrideGroupOutputForDiffBranch.Related
!dryRunguard on the publish override)Test plan
overrideOutputForPreview.test.tsfern-demo/sdk-preview-test-configthat preview package publishes and clean diff branch is pushed🤖 Generated with Claude Code