@fern-api/fern-api-dev 5.32.0 → 5.32.1

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 +81 -36
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -360347,9 +360347,9 @@ var require_diff3 = __commonJS({
360347
360347
  }
360348
360348
  });
360349
360349
 
360350
- // ../../../node_modules/.pnpm/@fern-api+replay@0.16.0/node_modules/@fern-api/replay/dist/index.cjs
360350
+ // ../../../node_modules/.pnpm/@fern-api+replay@0.16.1/node_modules/@fern-api/replay/dist/index.cjs
360351
360351
  var require_dist14 = __commonJS({
360352
- "../../../node_modules/.pnpm/@fern-api+replay@0.16.0/node_modules/@fern-api/replay/dist/index.cjs"(exports2, module4) {
360352
+ "../../../node_modules/.pnpm/@fern-api+replay@0.16.1/node_modules/@fern-api/replay/dist/index.cjs"(exports2, module4) {
360353
360353
  "use strict";
360354
360354
  var __defProp4 = Object.defineProperty;
360355
360355
  var __getOwnPropDesc4 = Object.getOwnPropertyDescriptor;
@@ -360917,6 +360917,7 @@ var require_dist14 = __commonJS({
360917
360917
  }
360918
360918
  var import_node_fs32 = require("fs");
360919
360919
  var import_node_path42 = require("path");
360920
+ var import_minimatch8 = require_commonjs3();
360920
360921
  var import_yaml18 = require_dist11();
360921
360922
  var LOCKFILE_HEADER = "# DO NOT EDIT MANUALLY - Managed by Fern Replay\n";
360922
360923
  var LockfileNotFoundError = class extends Error {
@@ -360928,10 +360929,23 @@ var require_dist14 = __commonJS({
360928
360929
  var LockfileManager = class {
360929
360930
  outputDir;
360930
360931
  lock = null;
360932
+ fernignorePatterns = [];
360931
360933
  warnings = [];
360932
360934
  constructor(outputDir) {
360933
360935
  this.outputDir = outputDir;
360934
360936
  }
360937
+ /**
360938
+ * Inform the lockfile of the customer's `.fernignore` patterns so that
360939
+ * `save()` can suppress its "Patch X removed from lockfile" warning when
360940
+ * every file in the stripped patch is already `.fernignore`-protected.
360941
+ * The strip itself still happens (credentials never persist); only the
360942
+ * customer-visible warning is suppressed in that case, because the
360943
+ * protected files survive the generator wipe regardless of whether the
360944
+ * lockfile tracks them, so there's nothing for the customer to action.
360945
+ */
360946
+ setFernignorePatterns(patterns) {
360947
+ this.fernignorePatterns = patterns;
360948
+ }
360935
360949
  get lockfilePath() {
360936
360950
  return (0, import_node_path42.join)(this.outputDir, ".fern", "replay.lock");
360937
360951
  }
@@ -361000,9 +361014,14 @@ var require_dist14 = __commonJS({
361000
361014
  if (sensitiveFiles.length > 0) {
361001
361015
  reasons.push(`sensitive files: ${sensitiveFiles.join(", ")}`);
361002
361016
  }
361003
- this.warnings.push(
361004
- `Patch ${patch5.id} removed from lockfile: ${reasons.join("; ")}. This prevents credential exposure in committed lockfiles.`
361017
+ const allProtected = patch5.files.length > 0 && patch5.files.every(
361018
+ (f4) => this.fernignorePatterns.some((p14) => f4 === p14 || (0, import_minimatch8.minimatch)(f4, p14))
361005
361019
  );
361020
+ if (!allProtected) {
361021
+ this.warnings.push(
361022
+ `Patch ${patch5.id} removed from lockfile: ${reasons.join("; ")}. This prevents credential exposure in committed lockfiles.`
361023
+ );
361024
+ }
361006
361025
  } else {
361007
361026
  cleanPatches.push(patch5);
361008
361027
  }
@@ -361875,7 +361894,7 @@ var require_dist14 = __commonJS({
361875
361894
  var import_promises310 = require("fs/promises");
361876
361895
  var import_node_os15 = require("os");
361877
361896
  var import_node_path52 = require("path");
361878
- var import_minimatch8 = require_commonjs3();
361897
+ var import_minimatch22 = require_commonjs3();
361879
361898
  var MergeAccumulator = class {
361880
361899
  constructor(mode, sharedFiles) {
361881
361900
  this.mode = mode;
@@ -362579,13 +362598,13 @@ var require_dist14 = __commonJS({
362579
362598
  isExcluded(patch5) {
362580
362599
  const config5 = this.lockManager.getCustomizationsConfig();
362581
362600
  if (!config5.exclude) return false;
362582
- return patch5.files.some((file4) => config5.exclude.some((pattern) => (0, import_minimatch8.minimatch)(file4, pattern)));
362601
+ return patch5.files.some((file4) => config5.exclude.some((pattern) => (0, import_minimatch22.minimatch)(file4, pattern)));
362583
362602
  }
362584
362603
  async resolveFilePath(filePath, baseTreeHash, currentTreeHash) {
362585
362604
  const config5 = this.lockManager.getCustomizationsConfig();
362586
362605
  if (config5.moves) {
362587
362606
  for (const move of config5.moves) {
362588
- if ((0, import_minimatch8.minimatch)(filePath, move.from) || filePath === move.from) {
362607
+ if ((0, import_minimatch22.minimatch)(filePath, move.from) || filePath === move.from) {
362589
362608
  if (filePath === move.from) {
362590
362609
  return move.to;
362591
362610
  }
@@ -362872,7 +362891,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
362872
362891
  var import_node_fs210 = require("fs");
362873
362892
  var import_promises610 = require("fs/promises");
362874
362893
  var import_node_path82 = require("path");
362875
- var import_minimatch32 = require_commonjs3();
362894
+ var import_minimatch42 = require_commonjs3();
362876
362895
  init_GitClient();
362877
362896
  var import_promises410 = require("fs/promises");
362878
362897
  var import_node_os22 = require("os");
@@ -362981,12 +363000,23 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
362981
363000
  unlocatableFiles.push(file4);
362982
363001
  continue;
362983
363002
  }
362984
- const locInCurrentGen = locInCurrentGenRaw.map(
362985
- (l9) => resolveSpan(l9, currentGenLines, "old")
362986
- );
362987
- const locInWorkingTree = locInWorkingTreeRaw.map(
362988
- (l9) => resolveSpan(l9, workingTreeLines, "new")
362989
- );
363003
+ const locInCurrentGen = [];
363004
+ const locInWorkingTree = [];
363005
+ let spanResolutionFailed = false;
363006
+ for (let i9 = 0; i9 < locInCurrentGenRaw.length; i9++) {
363007
+ const cg = resolveSpan(locInCurrentGenRaw[i9], currentGenLines, "old");
363008
+ const wt10 = resolveSpan(locInWorkingTreeRaw[i9], workingTreeLines, "new");
363009
+ if (cg === null || wt10 === null) {
363010
+ spanResolutionFailed = true;
363011
+ break;
363012
+ }
363013
+ locInCurrentGen.push(cg);
363014
+ locInWorkingTree.push(wt10);
363015
+ }
363016
+ if (spanResolutionFailed) {
363017
+ unlocatableFiles.push(file4);
363018
+ continue;
363019
+ }
362990
363020
  const overlay = overlayRegions(
362991
363021
  currentGenLines,
362992
363022
  locInCurrentGen,
@@ -363048,11 +363078,11 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
363048
363078
  if (prefer === "old") {
363049
363079
  if (oldFits) return { ...loc, oursSpan: hunk.oldCount };
363050
363080
  if (newFits) return { ...loc, oursSpan: hunk.newCount };
363051
- } else {
363052
- if (newFits) return { ...loc, oursSpan: hunk.newCount };
363053
- if (oldFits) return { ...loc, oursSpan: hunk.oldCount };
363081
+ return loc;
363054
363082
  }
363055
- return loc;
363083
+ if (newFits) return { ...loc, oursSpan: hunk.newCount };
363084
+ if (oldFits) return { ...loc, oursSpan: hunk.oldCount };
363085
+ return null;
363056
363086
  }
363057
363087
  function sequenceMatches(needle, haystack, offset2) {
363058
363088
  if (offset2 + needle.length > haystack.length) return false;
@@ -363164,7 +363194,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
363164
363194
  const trailer = hasTrailingNewline ? "" : "\n\";
363165
363195
  return header + "\n" + body + trailer + "\n";
363166
363196
  }
363167
- var import_minimatch22 = require_commonjs3();
363197
+ var import_minimatch32 = require_commonjs3();
363168
363198
  var FileOwnership = class {
363169
363199
  constructor(git) {
363170
363200
  this.git = git;
@@ -363188,7 +363218,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
363188
363218
  const { file: file4, originalFileName, patch: patch5, currentGenSha, fernignorePatterns, warnedGens, warnings } = ctx;
363189
363219
  if (patch5.user_owned) return true;
363190
363220
  if (file4 === ".fernignore") return true;
363191
- if (fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch22.minimatch)(file4, p14))) return true;
363221
+ if (fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch32.minimatch)(file4, p14))) return true;
363192
363222
  if (fileIsCreationInPatchContent(patch5.patch_content, originalFileName ?? file4)) {
363193
363223
  return true;
363194
363224
  }
@@ -363265,6 +363295,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
363265
363295
  };
363266
363296
  }
363267
363297
  async apply(_prep) {
363298
+ this.service.lockManager.setFernignorePatterns(this.service.readFernignorePatterns());
363268
363299
  this.service.lockManager.save();
363269
363300
  return firstGenerationReport();
363270
363301
  }
@@ -363321,6 +363352,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
363321
363352
  };
363322
363353
  }
363323
363354
  async apply(_prep, options2) {
363355
+ this.service.lockManager.setFernignorePatterns(this.service.readFernignorePatterns());
363324
363356
  this.service.lockManager.save();
363325
363357
  const credentialWarnings = [...this.service.lockManager.warnings];
363326
363358
  if (!options2?.stageOnly) {
@@ -363442,6 +363474,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
363442
363474
  this.service.lockManager.addPatch(patch5);
363443
363475
  }
363444
363476
  }
363477
+ this.service.lockManager.setFernignorePatterns(this.service.readFernignorePatterns());
363445
363478
  this.service.lockManager.save();
363446
363479
  this.service.warnings.push(...this.service.lockManager.warnings);
363447
363480
  if (newPatches.length > 0) {
@@ -363602,6 +363635,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
363602
363635
  }
363603
363636
  }
363604
363637
  }
363638
+ this.service.lockManager.setFernignorePatterns(this.service.readFernignorePatterns());
363605
363639
  this.service.lockManager.save();
363606
363640
  this.service.warnings.push(...this.service.lockManager.warnings);
363607
363641
  if (options2?.stageOnly) {
@@ -363833,7 +363867,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
363833
363867
  )
363834
363868
  );
363835
363869
  const hasProtectedFiles = patch5.files.some(
363836
- (file4) => file4 === ".fernignore" || fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch32.minimatch)(file4, p14))
363870
+ (file4) => file4 === ".fernignore" || fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch42.minimatch)(file4, p14))
363837
363871
  );
363838
363872
  const allUserOwned = isUserOwnedPerFile.every(Boolean);
363839
363873
  if (allUserOwned && patch5.files.length > 0) {
@@ -364273,7 +364307,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
364273
364307
  );
364274
364308
  if (snapHasStaleMarkers) continue;
364275
364309
  const isProtectedSnap = patch5.files.some(
364276
- (file4) => file4 === ".fernignore" || fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch32.minimatch)(file4, p14))
364310
+ (file4) => file4 === ".fernignore" || fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch42.minimatch)(file4, p14))
364277
364311
  );
364278
364312
  if (isProtectedSnap) continue;
364279
364313
  const snapHash = this.detector.computeContentHash(snapshotDiff);
@@ -364293,6 +364327,11 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
364293
364327
  (files) => this.git.exec(["diff", currentGen, "HEAD", "--", ...files]).catch(() => null)
364294
364328
  );
364295
364329
  if (ppResult === null) continue;
364330
+ if (ppResult.hadFallback) {
364331
+ this.warnings.push(
364332
+ `Patch ${patch5.id}: couldn't fully isolate ${ppResult.fallbackFiles.join(", ")} \u2014 customization preserved, attribution may have merged with another patch.`
364333
+ );
364334
+ }
364296
364335
  const diff2 = ppResult.diff;
364297
364336
  if (!diff2.trim()) {
364298
364337
  if (await allPatchFilesUserOwned(patch5)) continue;
@@ -364308,7 +364347,7 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
364308
364347
  continue;
364309
364348
  }
364310
364349
  const isProtected = patch5.files.some(
364311
- (file4) => file4 === ".fernignore" || fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch32.minimatch)(file4, p14))
364350
+ (file4) => file4 === ".fernignore" || fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch42.minimatch)(file4, p14))
364312
364351
  );
364313
364352
  if (isProtected) {
364314
364353
  continue;
@@ -364380,6 +364419,11 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
364380
364419
  (files) => this.git.exec(["diff", currentGen, "HEAD", "--", ...files]).catch(() => null)
364381
364420
  );
364382
364421
  if (ppResult === null) continue;
364422
+ if (ppResult.hadFallback) {
364423
+ this.warnings.push(
364424
+ `Patch ${patch5.id}: couldn't fully isolate ${ppResult.fallbackFiles.join(", ")} \u2014 customization preserved, attribution may have merged with another patch.`
364425
+ );
364426
+ }
364383
364427
  const diff2 = ppResult.diff;
364384
364428
  if (!diff2.trim()) {
364385
364429
  if (await allPatchFilesUserOwned(patch5)) {
@@ -364467,13 +364511,14 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
364467
364511
  if (files.length === 0) return;
364468
364512
  const fernignorePatterns = this.readFernignorePatterns();
364469
364513
  for (const file4 of files) {
364470
- if (fernignorePatterns.some((pattern) => (0, import_minimatch32.minimatch)(file4, pattern))) continue;
364514
+ if (fernignorePatterns.some((pattern) => (0, import_minimatch42.minimatch)(file4, pattern))) continue;
364471
364515
  try {
364472
364516
  await this.git.exec(["checkout", "HEAD", "--", file4]);
364473
364517
  } catch {
364474
364518
  }
364475
364519
  }
364476
364520
  }
364521
+ /** @internal Used by Flow implementations in `src/flows/`. */
364477
364522
  readFernignorePatterns() {
364478
364523
  const fernignorePath = (0, import_node_path82.join)(this.outputDir, ".fernignore");
364479
364524
  if (!(0, import_node_fs210.existsSync)(fernignorePath)) return [];
@@ -364554,7 +364599,7 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
364554
364599
  var import_node_crypto22 = require("crypto");
364555
364600
  var import_node_fs33 = require("fs");
364556
364601
  var import_node_path92 = require("path");
364557
- var import_minimatch42 = require_commonjs3();
364602
+ var import_minimatch52 = require_commonjs3();
364558
364603
  var import_yaml22 = require_dist11();
364559
364604
  var FernignoreMigrator = class {
364560
364605
  git;
@@ -364586,7 +364631,7 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
364586
364631
  const commitsOnly = [];
364587
364632
  const syntheticPatches = [];
364588
364633
  for (const pattern of patterns) {
364589
- const matchingPatch = patches.find((p14) => p14.files.some((f4) => (0, import_minimatch42.minimatch)(f4, pattern) || f4 === pattern));
364634
+ const matchingPatch = patches.find((p14) => p14.files.some((f4) => (0, import_minimatch52.minimatch)(f4, pattern) || f4 === pattern));
364590
364635
  if (matchingPatch) {
364591
364636
  trackedByBoth.push({
364592
364637
  file: pattern,
@@ -364659,7 +364704,7 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
364659
364704
  fernignoreOnly.push(...remainingFernignoreOnly);
364660
364705
  }
364661
364706
  for (const patch5 of patches) {
364662
- const hasUnprotectedFiles = patch5.files.some((f4) => !patterns.some((p14) => (0, import_minimatch42.minimatch)(f4, p14) || f4 === p14));
364707
+ const hasUnprotectedFiles = patch5.files.some((f4) => !patterns.some((p14) => (0, import_minimatch52.minimatch)(f4, p14) || f4 === p14));
364663
364708
  if (hasUnprotectedFiles) {
364664
364709
  commitsOnly.push(patch5);
364665
364710
  }
@@ -364671,7 +364716,7 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
364671
364716
  const results = [];
364672
364717
  for (const pattern of patterns) {
364673
364718
  const matching = allFiles.filter(
364674
- (f4) => (0, import_minimatch42.minimatch)(f4, pattern) || f4 === pattern || f4.startsWith(pattern + "/")
364719
+ (f4) => (0, import_minimatch52.minimatch)(f4, pattern) || f4 === pattern || f4.startsWith(pattern + "/")
364675
364720
  );
364676
364721
  results.push({ pattern, files: matching.length > 0 ? matching : [pattern] });
364677
364722
  }
@@ -364980,7 +365025,7 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
364980
365025
  const normalized = relevantLines.filter((line) => !line.startsWith("index ")).join("\n").replace(/\n-- \n[\d]+\.[\d]+[^\n]*\s*$/, "");
364981
365026
  return `sha256:${(0, import_node_crypto32.createHash)("sha256").update(normalized).digest("hex")}`;
364982
365027
  }
364983
- var import_minimatch52 = require_commonjs3();
365028
+ var import_minimatch62 = require_commonjs3();
364984
365029
  function parseDiffStat(patchContent) {
364985
365030
  let additions = 0;
364986
365031
  let deletions = 0;
@@ -365010,7 +365055,7 @@ If you want to keep these lines, restore them in a follow-up commit and re-run r
365010
365055
  }
365011
365056
  function matchesPatch(patch5, pattern) {
365012
365057
  const fileMatch = patch5.files.some(
365013
- (file4) => file4 === pattern || (0, import_minimatch52.minimatch)(file4, pattern)
365058
+ (file4) => file4 === pattern || (0, import_minimatch62.minimatch)(file4, pattern)
365014
365059
  );
365015
365060
  if (fileMatch) return true;
365016
365061
  return patch5.original_message.toLowerCase().includes(pattern.toLowerCase());
@@ -668398,7 +668443,7 @@ var AccessTokenPosthogManager = class {
668398
668443
  properties: {
668399
668444
  ...event,
668400
668445
  ...event.properties,
668401
- version: "5.32.0",
668446
+ version: "5.32.1",
668402
668447
  usingAccessToken: true,
668403
668448
  ...getRunIdProperties()
668404
668449
  }
@@ -668462,7 +668507,7 @@ var UserPosthogManager = class {
668462
668507
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
668463
668508
  event: "CLI",
668464
668509
  properties: {
668465
- version: "5.32.0",
668510
+ version: "5.32.1",
668466
668511
  ...event,
668467
668512
  ...event.properties,
668468
668513
  usingAccessToken: false,
@@ -860238,7 +860283,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
860238
860283
  var LOGS_FOLDER_NAME = "logs";
860239
860284
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
860240
860285
  function getCliSource() {
860241
- const version7 = "5.32.0";
860286
+ const version7 = "5.32.1";
860242
860287
  return `cli@${version7}`;
860243
860288
  }
860244
860289
  var DebugLogger = class {
@@ -879070,7 +879115,7 @@ var LegacyDocsPublisher = class {
879070
879115
  previewId,
879071
879116
  disableTemplates: void 0,
879072
879117
  skipUpload,
879073
- cliVersion: "5.32.0",
879118
+ cliVersion: "5.32.1",
879074
879119
  loginCommand: "fern auth login"
879075
879120
  });
879076
879121
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -953480,7 +953525,7 @@ function getAutomationContextFromEnv() {
953480
953525
  config_branch: process.env.FERN_CONFIG_BRANCH,
953481
953526
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
953482
953527
  trigger: process.env.GITHUB_EVENT_NAME,
953483
- cli_version: "5.32.0"
953528
+ cli_version: "5.32.1"
953484
953529
  };
953485
953530
  }
953486
953531
  function isAutomationMode() {
@@ -954306,7 +954351,7 @@ var CliContext = class _CliContext {
954306
954351
  if (false) {
954307
954352
  this.logger.error("CLI_VERSION is not defined");
954308
954353
  }
954309
- return "5.32.0";
954354
+ return "5.32.1";
954310
954355
  }
954311
954356
  getCliName() {
954312
954357
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.32.0",
2
+ "version": "5.32.1",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",