@fern-api/generator-cli 0.6.5 → 0.6.6

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 (3) hide show
  1. package/dist/api.js +12 -3
  2. package/dist/cli.js +16 -7
  3. package/package.json +2 -2
package/dist/api.js CHANGED
@@ -5541,6 +5541,10 @@ var ClonedRepository = class _ClonedRepository {
5541
5541
  await this.git.push("origin", branch, { "--set-upstream": null });
5542
5542
  }
5543
5543
  }
5544
+ async fetch(args) {
5545
+ await this.git.cwd(this.clonePath);
5546
+ await this.git.fetch(args);
5547
+ }
5544
5548
  async pull(branch) {
5545
5549
  await this.git.cwd(this.clonePath);
5546
5550
  await this.git.pull("origin", branch);
@@ -5666,12 +5670,13 @@ var ClonedRepository = class _ClonedRepository {
5666
5670
  await this.git.push("origin", branch, { "--set-upstream": null });
5667
5671
  }
5668
5672
  // Only used by replay's PR mode to push synthetic divergent commits to a fern-bot/ branch.
5669
- // Uses --force-with-lease (not --force) so we fail safely if the branch was updated
5670
- // by someone else since we cloned. Never targets main or user branches.
5673
+ // These branches are exclusively owned by the pipeline — no human pushes to them.
5674
+ // Uses --force (not --force-with-lease) because the lease check fails after
5675
+ // git fetch --unshallow updates remote refs. Never targets main or user branches.
5671
5676
  async forcePush() {
5672
5677
  await this.git.cwd(this.clonePath);
5673
5678
  const currentBranch = await this.getCurrentBranch();
5674
- await this.git.push("origin", currentBranch, ["--force-with-lease"]);
5679
+ await this.git.push("origin", currentBranch, ["--force"]);
5675
5680
  }
5676
5681
  async createBranchFromHead(branchName) {
5677
5682
  await this.git.cwd(this.clonePath);
@@ -10034,6 +10039,10 @@ var GithubStep = class extends BaseStep {
10034
10039
  try {
10035
10040
  this.logger.debug("Starting GitHub self-hosted flow in directory: " + this.outputDir);
10036
10041
  const repository = ClonedRepository.createAtPath(this.outputDir);
10042
+ try {
10043
+ await repository.fetch(["--unshallow"]);
10044
+ } catch {
10045
+ }
10037
10046
  const now = /* @__PURE__ */ new Date();
10038
10047
  const formattedDate = now.toISOString().replace("T", "_").replace(/:/g, "-").replace("Z", "").replace(".", "_");
10039
10048
  const newPrBranch = `fern-bot/${formattedDate}`;
package/dist/cli.js CHANGED
@@ -19327,7 +19327,7 @@ var init_diff3 = __esm({
19327
19327
  }
19328
19328
  });
19329
19329
 
19330
- // ../../node_modules/.pnpm/@fern-api+replay@0.6.1/node_modules/@fern-api/replay/dist/index.js
19330
+ // ../../node_modules/.pnpm/@fern-api+replay@0.6.2/node_modules/@fern-api/replay/dist/index.js
19331
19331
  var dist_exports = {};
19332
19332
  __export(dist_exports, {
19333
19333
  FERN_BOT_EMAIL: () => FERN_BOT_EMAIL2,
@@ -19686,7 +19686,7 @@ function status(outputDir) {
19686
19686
  }
19687
19687
  var import_fs6, import_path8, import_yaml, import_crypto, import_promises4, import_os, import_path9, import_fs7, import_path10, import_crypto2, import_fs8, import_path11, import_yaml2, import_crypto3, import_fs9, import_path12, import_fs10, __defProp3, __getOwnPropNames3, __esm3, __export3, GitClient_exports, GitClient, init_GitClient, FERN_BOT_NAME2, FERN_BOT_EMAIL2, FERN_BOT_LOGIN2, FERN_SUPPORT_NAMES, LOCKFILE_HEADER, LockfileManager, INFRASTRUCTURE_FILES, ReplayDetector, BINARY_EXTENSIONS, ReplayApplicator, ReplayCommitter, ReplayService, FernignoreMigrator, REPLAY_FERNIGNORE_ENTRIES;
19688
19688
  var init_dist = __esm({
19689
- "../../node_modules/.pnpm/@fern-api+replay@0.6.1/node_modules/@fern-api/replay/dist/index.js"() {
19689
+ "../../node_modules/.pnpm/@fern-api+replay@0.6.2/node_modules/@fern-api/replay/dist/index.js"() {
19690
19690
  "use strict";
19691
19691
  init_esm4();
19692
19692
  import_fs6 = require("fs");
@@ -20560,12 +20560,12 @@ CLI Version: ${options.cliVersion}`;
20560
20560
  await this.git.exec(["commit", "-m", fullMessage]);
20561
20561
  return (await this.git.exec(["rev-parse", "HEAD"])).trim();
20562
20562
  }
20563
- async commitReplay(patchCount, patches) {
20563
+ async commitReplay(_patchCount, patches) {
20564
20564
  await this.stageAll();
20565
20565
  if (!await this.hasStagedChanges()) {
20566
20566
  return (await this.git.exec(["rev-parse", "HEAD"])).trim();
20567
20567
  }
20568
- let fullMessage = `[fern-replay] Applied ${patchCount} customization(s)`;
20568
+ let fullMessage = `[fern-replay] Applied customizations`;
20569
20569
  if (patches && patches.length > 0) {
20570
20570
  fullMessage += "\n\nPatches replayed:";
20571
20571
  for (const patch of patches) {
@@ -22992,6 +22992,10 @@ var ClonedRepository = class _ClonedRepository {
22992
22992
  await this.git.push("origin", branch, { "--set-upstream": null });
22993
22993
  }
22994
22994
  }
22995
+ async fetch(args) {
22996
+ await this.git.cwd(this.clonePath);
22997
+ await this.git.fetch(args);
22998
+ }
22995
22999
  async pull(branch) {
22996
23000
  await this.git.cwd(this.clonePath);
22997
23001
  await this.git.pull("origin", branch);
@@ -23117,12 +23121,13 @@ var ClonedRepository = class _ClonedRepository {
23117
23121
  await this.git.push("origin", branch, { "--set-upstream": null });
23118
23122
  }
23119
23123
  // Only used by replay's PR mode to push synthetic divergent commits to a fern-bot/ branch.
23120
- // Uses --force-with-lease (not --force) so we fail safely if the branch was updated
23121
- // by someone else since we cloned. Never targets main or user branches.
23124
+ // These branches are exclusively owned by the pipeline — no human pushes to them.
23125
+ // Uses --force (not --force-with-lease) because the lease check fails after
23126
+ // git fetch --unshallow updates remote refs. Never targets main or user branches.
23122
23127
  async forcePush() {
23123
23128
  await this.git.cwd(this.clonePath);
23124
23129
  const currentBranch = await this.getCurrentBranch();
23125
- await this.git.push("origin", currentBranch, ["--force-with-lease"]);
23130
+ await this.git.push("origin", currentBranch, ["--force"]);
23126
23131
  }
23127
23132
  async createBranchFromHead(branchName) {
23128
23133
  await this.git.cwd(this.clonePath);
@@ -31161,6 +31166,10 @@ var GithubStep = class extends BaseStep {
31161
31166
  try {
31162
31167
  this.logger.debug("Starting GitHub self-hosted flow in directory: " + this.outputDir);
31163
31168
  const repository = ClonedRepository.createAtPath(this.outputDir);
31169
+ try {
31170
+ await repository.fetch(["--unshallow"]);
31171
+ } catch {
31172
+ }
31164
31173
  const now = /* @__PURE__ */ new Date();
31165
31174
  const formattedDate = now.toISOString().replace("T", "_").replace(/:/g, "-").replace("Z", "").replace(".", "_");
31166
31175
  const newPrBranch = `fern-bot/${formattedDate}`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fern-api/generator-cli",
3
- "version": "0.6.5",
3
+ "version": "0.6.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/fern-api/fern.git",
@@ -22,7 +22,7 @@
22
22
  "**"
23
23
  ],
24
24
  "dependencies": {
25
- "@fern-api/replay": "^0.6.1",
25
+ "@fern-api/replay": "^0.6.2",
26
26
  "@octokit/rest": "^22.0.1",
27
27
  "es-toolkit": "^1.39.10",
28
28
  "tmp-promise": "^3.0.3"