@fern-api/fern-api-dev 4.75.0-5-g68e18dd3bdb → 4.76.0-1-g4629aee782f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/cli.cjs +54 -17
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -345167,6 +345167,7 @@ var require_GithubStep = __commonJS({
345167
345167
  exports2.GithubStep = void 0;
345168
345168
  exports2.enrichPrBodyForAutomation = enrichPrBodyForAutomation;
345169
345169
  exports2.shouldEnableAutomerge = shouldEnableAutomerge;
345170
+ exports2.shouldPushGenerationBaseTag = shouldPushGenerationBaseTag;
345170
345171
  exports2.resolveBranchAction = resolveBranchAction;
345171
345172
  var core_utils_1 = (init_lib4(), __toCommonJS(lib_exports));
345172
345173
  var github_1 = (init_lib7(), __toCommonJS(lib_exports3));
@@ -345246,7 +345247,11 @@ var require_GithubStep = __commonJS({
345246
345247
  });
345247
345248
  switch (branchAction) {
345248
345249
  case "replay-branch":
345249
- generationBaseSha = await (0, createReplayBranch_1.createReplayBranch)(repository, prBranch, this.config.commitMessage, replayConflictInfo, this.logger);
345250
+ if (shouldPushGenerationBaseTag(replayResult)) {
345251
+ generationBaseSha = await (0, createReplayBranch_1.createReplayBranch)(repository, prBranch, this.config.commitMessage, replayConflictInfo, this.logger);
345252
+ } else {
345253
+ await repository.createBranchFromHead(prBranch);
345254
+ }
345250
345255
  break;
345251
345256
  case "create-from-head":
345252
345257
  await repository.createBranchFromHead(prBranch);
@@ -345444,6 +345449,9 @@ _Fern Run ID: \`${config5.runId}\`_`;
345444
345449
  function shouldEnableAutomerge(config5) {
345445
345450
  return config5.automationMode === true && config5.autoMerge === true && config5.hasBreakingChanges !== true;
345446
345451
  }
345452
+ function shouldPushGenerationBaseTag(replayResult) {
345453
+ return (replayResult?.patchesWithConflicts ?? 0) > 0;
345454
+ }
345447
345455
  function resolveBranchAction({ automationMode, skipCommit, existingPR }) {
345448
345456
  if (skipCommit) {
345449
345457
  return "replay-branch";
@@ -354642,6 +354650,7 @@ var require_replay_run = __commonJS({
354642
354650
  "use strict";
354643
354651
  Object.defineProperty(exports2, "__esModule", { value: true });
354644
354652
  exports2.replayRun = replayRun;
354653
+ exports2.isTagMergedIntoHead = isTagMergedIntoHead;
354645
354654
  var replay_1 = require_dist14();
354646
354655
  var child_process_1 = require("child_process");
354647
354656
  var fs_1 = require("fs");
@@ -354686,18 +354695,22 @@ var require_replay_run = __commonJS({
354686
354695
  }
354687
354696
  }
354688
354697
  if (shouldSync && tagSha != null) {
354689
- const syncService = new replay_1.ReplayService(outputDir, { enabled: true });
354690
- await syncService.syncFromDivergentMerge(tagSha, {
354691
- cliVersion,
354692
- generatorVersions,
354693
- baseBranchHead: baseBranchHead ?? void 0
354694
- });
354695
- try {
354696
- const freshLockManager = new replay_1.LockfileManager(outputDir);
354697
- if (freshLockManager.exists()) {
354698
- previousGenerationSha = freshLockManager.read().current_generation;
354698
+ if (!isTagMergedIntoHead(outputDir, tagSha)) {
354699
+ logger4?.warn(`fern-generation-base tag ${tagSha} is not reachable from HEAD \u2014 skipping divergent-merge sync. The tag likely points at an unmerged generation (PR closed without merge).`);
354700
+ } else {
354701
+ const syncService = new replay_1.ReplayService(outputDir, { enabled: true });
354702
+ await syncService.syncFromDivergentMerge(tagSha, {
354703
+ cliVersion,
354704
+ generatorVersions,
354705
+ baseBranchHead: baseBranchHead ?? void 0
354706
+ });
354707
+ try {
354708
+ const freshLockManager = new replay_1.LockfileManager(outputDir);
354709
+ if (freshLockManager.exists()) {
354710
+ previousGenerationSha = freshLockManager.read().current_generation;
354711
+ }
354712
+ } catch {
354699
354713
  }
354700
- } catch {
354701
354714
  }
354702
354715
  }
354703
354716
  }
@@ -354747,6 +354760,30 @@ var require_replay_run = __commonJS({
354747
354760
  baseBranchHead: resolvedBaseBranchHead
354748
354761
  };
354749
354762
  }
354763
+ function isTagMergedIntoHead(cwd2, tagSha) {
354764
+ try {
354765
+ (0, child_process_1.execFileSync)("git", ["merge-base", "--is-ancestor", tagSha, "HEAD"], {
354766
+ cwd: cwd2,
354767
+ stdio: "pipe"
354768
+ });
354769
+ return true;
354770
+ } catch {
354771
+ }
354772
+ const tagTree = gitRevParse(cwd2, `${tagSha}^{tree}`);
354773
+ if (tagTree == null) {
354774
+ return false;
354775
+ }
354776
+ try {
354777
+ const trees = (0, child_process_1.execFileSync)("git", ["log", "HEAD", "--format=%T", "--max-count=500"], {
354778
+ cwd: cwd2,
354779
+ encoding: "utf-8",
354780
+ stdio: "pipe"
354781
+ });
354782
+ return trees.split("\n").some((t3) => t3.trim() === tagTree);
354783
+ } catch {
354784
+ return false;
354785
+ }
354786
+ }
354750
354787
  function gitRevParse(cwd2, rev) {
354751
354788
  try {
354752
354789
  return (0, child_process_1.execFileSync)("git", ["rev-parse", "--verify", rev], {
@@ -621915,7 +621952,7 @@ var AccessTokenPosthogManager = class {
621915
621952
  properties: {
621916
621953
  ...event,
621917
621954
  ...event.properties,
621918
- version: "4.75.0-5-g68e18dd3bdb",
621955
+ version: "4.76.0-1-g4629aee782f",
621919
621956
  usingAccessToken: true
621920
621957
  }
621921
621958
  });
@@ -621969,7 +622006,7 @@ var UserPosthogManager = class {
621969
622006
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
621970
622007
  event: "CLI",
621971
622008
  properties: {
621972
- version: "4.75.0-5-g68e18dd3bdb",
622009
+ version: "4.76.0-1-g4629aee782f",
621973
622010
  ...event,
621974
622011
  ...event.properties,
621975
622012
  usingAccessToken: false,
@@ -839179,7 +839216,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
839179
839216
  var LOGS_FOLDER_NAME = "logs";
839180
839217
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
839181
839218
  function getCliSource() {
839182
- const version7 = "4.75.0-5-g68e18dd3bdb";
839219
+ const version7 = "4.76.0-1-g4629aee782f";
839183
839220
  return `cli@${version7}`;
839184
839221
  }
839185
839222
  var DebugLogger = class {
@@ -850494,7 +850531,7 @@ var LegacyDocsPublisher = class {
850494
850531
  previewId,
850495
850532
  disableTemplates: void 0,
850496
850533
  skipUpload,
850497
- cliVersion: "4.75.0-5-g68e18dd3bdb"
850534
+ cliVersion: "4.76.0-1-g4629aee782f"
850498
850535
  });
850499
850536
  if (taskContext.getResult() === TaskResult.Failure) {
850500
850537
  return { success: false };
@@ -924952,7 +924989,7 @@ var CliContext = class _CliContext {
924952
924989
  if (false) {
924953
924990
  this.logger.error("CLI_VERSION is not defined");
924954
924991
  }
924955
- return "4.75.0-5-g68e18dd3bdb";
924992
+ return "4.76.0-1-g4629aee782f";
924956
924993
  }
924957
924994
  getCliName() {
924958
924995
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.75.0-5-g68e18dd3bdb",
2
+ "version": "4.76.0-1-g4629aee782f",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",