@fern-api/fern-api-dev 4.46.4 → 4.46.5

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 +69 -63
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -24501,7 +24501,7 @@ var init_esm2 = __esm({
24501
24501
  }
24502
24502
  });
24503
24503
 
24504
- // ../../../node_modules/.pnpm/brace-expansion@5.0.3/node_modules/brace-expansion/dist/esm/index.js
24504
+ // ../../../node_modules/.pnpm/brace-expansion@5.0.5/node_modules/brace-expansion/dist/esm/index.js
24505
24505
  function numeric(str3) {
24506
24506
  return !isNaN(str3) ? parseInt(str3, 10) : str3.charCodeAt(0);
24507
24507
  }
@@ -24595,7 +24595,7 @@ function expand_(str3, max, isTop) {
24595
24595
  const x15 = numeric(n6[0]);
24596
24596
  const y24 = numeric(n6[1]);
24597
24597
  const width = Math.max(n6[0].length, n6[1].length);
24598
- let incr = n6.length === 3 && n6[2] !== void 0 ? Math.abs(numeric(n6[2])) : 1;
24598
+ let incr = n6.length === 3 && n6[2] !== void 0 ? Math.max(Math.abs(numeric(n6[2])), 1) : 1;
24599
24599
  let test2 = lte;
24600
24600
  const reverse = y24 < x15;
24601
24601
  if (reverse) {
@@ -24646,7 +24646,7 @@ function expand_(str3, max, isTop) {
24646
24646
  }
24647
24647
  var escSlash, escOpen, escClose, escComma, escPeriod, escSlashPattern, escOpenPattern, escClosePattern, escCommaPattern, escPeriodPattern, slashPattern, openPattern, closePattern, commaPattern, periodPattern, EXPANSION_MAX;
24648
24648
  var init_esm3 = __esm({
24649
- "../../../node_modules/.pnpm/brace-expansion@5.0.3/node_modules/brace-expansion/dist/esm/index.js"() {
24649
+ "../../../node_modules/.pnpm/brace-expansion@5.0.5/node_modules/brace-expansion/dist/esm/index.js"() {
24650
24650
  "use strict";
24651
24651
  init_esm2();
24652
24652
  escSlash = "\0SLASH" + Math.random() + "\0";
@@ -24663,7 +24663,7 @@ var init_esm3 = __esm({
24663
24663
  openPattern = /\\{/g;
24664
24664
  closePattern = /\\}/g;
24665
24665
  commaPattern = /\\,/g;
24666
- periodPattern = /\\./g;
24666
+ periodPattern = /\\\./g;
24667
24667
  EXPANSION_MAX = 1e5;
24668
24668
  }
24669
24669
  });
@@ -50226,9 +50226,9 @@ var require_commonjs = __commonJS({
50226
50226
  }
50227
50227
  });
50228
50228
 
50229
- // ../../../node_modules/.pnpm/brace-expansion@5.0.3/node_modules/brace-expansion/dist/commonjs/index.js
50229
+ // ../../../node_modules/.pnpm/brace-expansion@5.0.5/node_modules/brace-expansion/dist/commonjs/index.js
50230
50230
  var require_commonjs2 = __commonJS({
50231
- "../../../node_modules/.pnpm/brace-expansion@5.0.3/node_modules/brace-expansion/dist/commonjs/index.js"(exports2) {
50231
+ "../../../node_modules/.pnpm/brace-expansion@5.0.5/node_modules/brace-expansion/dist/commonjs/index.js"(exports2) {
50232
50232
  "use strict";
50233
50233
  Object.defineProperty(exports2, "__esModule", { value: true });
50234
50234
  exports2.EXPANSION_MAX = void 0;
@@ -50248,7 +50248,7 @@ var require_commonjs2 = __commonJS({
50248
50248
  var openPattern2 = /\\{/g;
50249
50249
  var closePattern2 = /\\}/g;
50250
50250
  var commaPattern2 = /\\,/g;
50251
- var periodPattern2 = /\\./g;
50251
+ var periodPattern2 = /\\\./g;
50252
50252
  exports2.EXPANSION_MAX = 1e5;
50253
50253
  function numeric2(str3) {
50254
50254
  return !isNaN(str3) ? parseInt(str3, 10) : str3.charCodeAt(0);
@@ -50343,7 +50343,7 @@ var require_commonjs2 = __commonJS({
50343
50343
  const x15 = numeric2(n6[0]);
50344
50344
  const y24 = numeric2(n6[1]);
50345
50345
  const width = Math.max(n6[0].length, n6[1].length);
50346
- let incr = n6.length === 3 && n6[2] !== void 0 ? Math.abs(numeric2(n6[2])) : 1;
50346
+ let incr = n6.length === 3 && n6[2] !== void 0 ? Math.max(Math.abs(numeric2(n6[2])), 1) : 1;
50347
50347
  let test2 = lte2;
50348
50348
  const reverse = y24 < x15;
50349
50349
  if (reverse) {
@@ -365594,7 +365594,7 @@ var require_fernignore = __commonJS({
365594
365594
  var fs_1 = require("fs");
365595
365595
  var promises_1 = require("fs/promises");
365596
365596
  var path_1 = require("path");
365597
- exports2.REPLAY_FERNIGNORE_ENTRIES = [".fern/replay.lock", ".fern/replay.yml"];
365597
+ exports2.REPLAY_FERNIGNORE_ENTRIES = [".fern/replay.lock"];
365598
365598
  async function ensureReplayFernignoreEntries(outputDir) {
365599
365599
  const fernignorePath = (0, path_1.join)(outputDir, ".fernignore");
365600
365600
  let content5 = "";
@@ -365950,7 +365950,6 @@ var require_replay_init = __commonJS({
365950
365950
  exports2.formatBootstrapSummary = formatBootstrapSummary2;
365951
365951
  var github_1 = (init_lib7(), __toCommonJS(lib_exports3));
365952
365952
  var replay_1 = require_dist11();
365953
- var rest_1 = (init_dist_src9(), __toCommonJS(dist_src_exports));
365954
365953
  var fs_1 = require("fs");
365955
365954
  var path_1 = require("path");
365956
365955
  var tmp_promise_1 = __importDefault2(require_tmp_promise());
@@ -365959,12 +365958,11 @@ var require_replay_init = __commonJS({
365959
365958
  const { githubRepo, token, dryRun } = params2;
365960
365959
  const tmpDir = await tmp_promise_1.default.dir({ unsafeCleanup: true });
365961
365960
  const repoPath = tmpDir.path;
365962
- const repository = await (0, github_1.cloneRepository)({
365961
+ await (0, github_1.cloneRepository)({
365963
365962
  githubRepository: githubRepo,
365964
365963
  installationToken: token,
365965
365964
  targetDirectory: repoPath
365966
365965
  });
365967
- const defaultBranch = await repository.getDefaultBranch();
365968
365966
  const bootstrapResult = await (0, replay_1.bootstrap)(repoPath, {
365969
365967
  dryRun,
365970
365968
  fernignoreAction: "skip",
@@ -365973,50 +365971,22 @@ var require_replay_init = __commonJS({
365973
365971
  importHistory: params2.importHistory
365974
365972
  });
365975
365973
  if (!bootstrapResult.generationCommit) {
365976
- return { bootstrap: bootstrapResult };
365974
+ return { bootstrap: bootstrapResult, fernignoreEntries: [] };
365977
365975
  }
365978
365976
  if (dryRun) {
365979
- return { bootstrap: bootstrapResult };
365977
+ return { bootstrap: bootstrapResult, fernignoreEntries: [] };
365980
365978
  }
365981
365979
  (0, fernignore_1.ensureReplayFernignoreEntriesSync)(repoPath);
365982
- const commitMessage = `[fern-replay] Initialize Replay
365983
-
365984
- Tracked ${bootstrapResult.patchesCreated} customization patch(es).
365985
- Base generation: ${bootstrapResult.generationCommit.sha.slice(0, 7)}`;
365986
- const filesToAdd = [".fern/replay.lock", ".fern/replay.yml", ".fernignore"].filter((f10) => (0, fs_1.existsSync)((0, path_1.join)(repoPath, f10)));
365987
- const branchName = `fern-replay/init-${Date.now()}`;
365988
- await repository.checkoutOrCreateLocal(branchName);
365989
- const git = new replay_1.GitClient(repoPath);
365990
- await git.exec(["add", ...filesToAdd]);
365991
- await git.exec([
365992
- "-c",
365993
- `user.name=${replay_1.FERN_BOT_NAME}`,
365994
- "-c",
365995
- `user.email=${replay_1.FERN_BOT_EMAIL}`,
365996
- "-c",
365997
- "commit.gpgsign=false",
365998
- "commit",
365999
- "--no-verify",
366000
- "-m",
366001
- commitMessage
366002
- ]);
366003
- await repository.pushUpstream(branchName);
366004
- const parsed = (0, github_1.parseRepository)(githubRepo);
366005
- const octokit = new rest_1.Octokit({ auth: token });
366006
- const prTitle = params2.prTitle ?? "[fern-replay] Initialize Replay for SDK customizations";
366007
- const prBody = params2.prBody ?? buildPrBody(bootstrapResult);
366008
- const { data: pr17 } = await octokit.pulls.create({
366009
- owner: parsed.owner,
366010
- repo: parsed.repo,
366011
- head: branchName,
366012
- base: defaultBranch,
366013
- title: prTitle,
366014
- body: prBody
366015
- });
365980
+ const lockfilePath = (0, path_1.join)(repoPath, ".fern", "replay.lock");
365981
+ const lockfileContent = (0, fs_1.existsSync)(lockfilePath) ? (0, fs_1.readFileSync)(lockfilePath, "utf-8") : void 0;
365982
+ const replayYmlPath = (0, path_1.join)(repoPath, ".fern", "replay.yml");
365983
+ const replayYmlContent = (0, fs_1.existsSync)(replayYmlPath) ? (0, fs_1.readFileSync)(replayYmlPath, "utf-8") : void 0;
366016
365984
  return {
366017
365985
  bootstrap: bootstrapResult,
366018
- prUrl: pr17.html_url,
366019
- branch: branchName
365986
+ lockfileContent,
365987
+ replayYmlContent,
365988
+ fernignoreEntries: fernignore_1.REPLAY_FERNIGNORE_ENTRIES,
365989
+ prBody: buildPrBody(bootstrapResult)
366020
365990
  };
366021
365991
  }
366022
365992
  function formatBootstrapSummary2(result) {
@@ -366075,14 +366045,6 @@ Base generation: ${bootstrapResult.generationCommit.sha.slice(0, 7)}`;
366075
366045
  entries21.push({ level: "warn", message: ` ${w20}` });
366076
366046
  }
366077
366047
  }
366078
- if (result.prUrl) {
366079
- entries21.push({ level: "info", message: `
366080
- PR created: ${result.prUrl}` });
366081
- entries21.push({ level: "info", message: "Merge the PR to enable Replay for this repository." });
366082
- } else if (result.branch) {
366083
- entries21.push({ level: "info", message: `
366084
- Pushed to branch: ${result.branch}` });
366085
- }
366086
366048
  return entries21;
366087
366049
  }
366088
366050
  function buildPrBody(result) {
@@ -601990,7 +601952,7 @@ var AccessTokenPosthogManager = class {
601990
601952
  properties: {
601991
601953
  ...event,
601992
601954
  ...event.properties,
601993
- version: "4.46.4",
601955
+ version: "4.46.5",
601994
601956
  usingAccessToken: true
601995
601957
  }
601996
601958
  });
@@ -602041,7 +602003,7 @@ var UserPosthogManager = class {
602041
602003
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
602042
602004
  event: "CLI",
602043
602005
  properties: {
602044
- version: "4.46.4",
602006
+ version: "4.46.5",
602045
602007
  ...event,
602046
602008
  ...event.properties,
602047
602009
  usingAccessToken: false,
@@ -825895,7 +825857,7 @@ var import_path54 = __toESM(require("path"), 1);
825895
825857
  var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
825896
825858
  var LOGS_FOLDER_NAME = "logs";
825897
825859
  function getCliSource() {
825898
- const version7 = "4.46.4";
825860
+ const version7 = "4.46.5";
825899
825861
  return `cli@${version7}`;
825900
825862
  }
825901
825863
  var DebugLogger = class {
@@ -836862,7 +836824,7 @@ var LegacyDocsPublisher = class {
836862
836824
  previewId: void 0,
836863
836825
  disableTemplates: void 0,
836864
836826
  skipUpload,
836865
- cliVersion: "4.46.4"
836827
+ cliVersion: "4.46.5"
836866
836828
  });
836867
836829
  if (taskContext.getResult() === TaskResult.Failure) {
836868
836830
  return { success: false };
@@ -909712,7 +909674,7 @@ var CliContext = class {
909712
909674
  if (false) {
909713
909675
  this.logger.error("CLI_VERSION is not defined");
909714
909676
  }
909715
- return "4.46.4";
909677
+ return "4.46.5";
909716
909678
  }
909717
909679
  getCliName() {
909718
909680
  if (false) {
@@ -929241,7 +929203,41 @@ function addReplayInitCommand(cli, cliContext) {
929241
929203
  }
929242
929204
  if (argv.dryRun) {
929243
929205
  cliContext.logger.info("\nDry run complete. No changes made.");
929206
+ return;
929207
+ }
929208
+ if (result.lockfileContent == null) {
929209
+ return cliContext.failAndThrow("Bootstrap succeeded but lockfile content is missing.");
929210
+ }
929211
+ const fernToken = await cliContext.runTask((context3) => askToLogin(context3));
929212
+ const { owner, repo } = parseOwnerRepo(githubRepo);
929213
+ const fiddleOrigin = getFiddleOrigin();
929214
+ const response = await fetch(`${fiddleOrigin}/api/remote-gen/replay/init`, {
929215
+ method: "POST",
929216
+ headers: {
929217
+ "Content-Type": "application/json",
929218
+ Authorization: `Bearer ${fernToken.value}`
929219
+ },
929220
+ body: JSON.stringify({
929221
+ owner,
929222
+ repo,
929223
+ lockfileContents: result.lockfileContent,
929224
+ fernignoreEntries: result.fernignoreEntries,
929225
+ prBody: result.prBody
929226
+ })
929227
+ });
929228
+ if (!response.ok) {
929229
+ if (response.status === 404) {
929230
+ return cliContext.failAndThrow(
929231
+ "The Fern GitHub App is not installed on this repository. Install it at https://github.com/apps/fern-api to enable server-side PR creation."
929232
+ );
929233
+ }
929234
+ const body = await response.text();
929235
+ return cliContext.failAndThrow(`Failed to create PR via Fern: ${body}`);
929244
929236
  }
929237
+ const data2 = await response.json();
929238
+ cliContext.logger.info(`
929239
+ PR created: ${data2.prUrl}`);
929240
+ cliContext.logger.info("Merge the PR to enable Replay for this repository.");
929245
929241
  } catch (error50) {
929246
929242
  cliContext.failAndThrow(`Failed to initialize Replay: ${extractErrorMessage(error50)}`);
929247
929243
  }
@@ -929316,6 +929312,16 @@ Resolve the conflicts in your editor, then run \`fern replay resolve\` again to
929316
929312
  }
929317
929313
  );
929318
929314
  }
929315
+ function parseOwnerRepo(githubRepo) {
929316
+ const cleaned = githubRepo.replace(/^https?:\/\//, "").replace(/\.git$/, "").replace(/^github\.com\//, "");
929317
+ const parts = cleaned.split("/");
929318
+ const owner = parts[parts.length - 2];
929319
+ const repo = parts[parts.length - 1];
929320
+ if (owner == null || repo == null) {
929321
+ throw new Error(`Could not parse owner/repo from: ${githubRepo}`);
929322
+ }
929323
+ return { owner, repo };
929324
+ }
929319
929325
  /*! Bundled license information:
929320
929326
 
929321
929327
  yargs-parser/build/lib/string-utils.js:
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.46.4",
2
+ "version": "4.46.5",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",