@fern-api/fern-api-dev 5.17.0 → 5.17.1-3-g719b96df398

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 +139 -8
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -354406,9 +354406,9 @@ var require_diff3 = __commonJS({
354406
354406
  }
354407
354407
  });
354408
354408
 
354409
- // ../../../node_modules/.pnpm/@fern-api+replay@0.14.1/node_modules/@fern-api/replay/dist/index.cjs
354409
+ // ../../../node_modules/.pnpm/@fern-api+replay@0.15.0/node_modules/@fern-api/replay/dist/index.cjs
354410
354410
  var require_dist13 = __commonJS({
354411
- "../../../node_modules/.pnpm/@fern-api+replay@0.14.1/node_modules/@fern-api/replay/dist/index.cjs"(exports2, module4) {
354411
+ "../../../node_modules/.pnpm/@fern-api+replay@0.15.0/node_modules/@fern-api/replay/dist/index.cjs"(exports2, module4) {
354412
354412
  "use strict";
354413
354413
  var __defProp4 = Object.defineProperty;
354414
354414
  var __getOwnPropDesc4 = Object.getOwnPropertyDescriptor;
@@ -357919,6 +357919,66 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
357919
357919
  }
357920
357920
  return snapshot;
357921
357921
  }
357922
+ /**
357923
+ * FER-10203: returns true when a `[fern-autoversion]` commit between
357924
+ * `fromSha` and `toSha` touched any of the patch's `files`. Re-classifies
357925
+ * each grep match via `isGenerationCommit` so a customer commit that
357926
+ * merely quotes the marker in its body doesn't false-positive.
357927
+ */
357928
+ async hasAutoversionContamination(fromSha, toSha, files) {
357929
+ if (files.length === 0) return false;
357930
+ const log4 = await this.git.exec([
357931
+ "log",
357932
+ `${fromSha}..${toSha}`,
357933
+ "--grep=\\[fern-autoversion\\]",
357934
+ "--extended-regexp",
357935
+ "--format=%H%x09%aN%x09%ae%x09%s",
357936
+ "--",
357937
+ ...files
357938
+ ]).catch(() => "");
357939
+ if (!log4.trim()) return false;
357940
+ for (const line of log4.trim().split("\n")) {
357941
+ const [sha, authorName, authorEmail, message] = line.split(" ");
357942
+ if (sha == null) continue;
357943
+ if (isGenerationCommit({
357944
+ sha,
357945
+ authorName: authorName ?? "",
357946
+ authorEmail: authorEmail ?? "",
357947
+ message: message ?? ""
357948
+ })) {
357949
+ return true;
357950
+ }
357951
+ }
357952
+ return false;
357953
+ }
357954
+ /**
357955
+ * FER-10203: rebuild patch_content from `theirs_snapshot` (captured at
357956
+ * detection time, predates pipeline content) rather than a HEAD-relative
357957
+ * diff. Returns `null` when snapshot is missing or doesn't cover every
357958
+ * file in `patch.files` — caller leaves the patch unchanged.
357959
+ */
357960
+ async computeSnapshotBasedPatchDiff(patch5, currentGen) {
357961
+ if (!patch5.theirs_snapshot) return null;
357962
+ if (Object.keys(patch5.theirs_snapshot).length === 0) return null;
357963
+ for (const file4 of patch5.files) {
357964
+ if (patch5.theirs_snapshot[file4] == null) return null;
357965
+ }
357966
+ const fragments = [];
357967
+ for (const file4 of patch5.files) {
357968
+ const theirsContent = patch5.theirs_snapshot[file4];
357969
+ const oursContent = await this.git.showFile(currentGen, file4).catch(() => null);
357970
+ if (oursContent == null) {
357971
+ fragments.push(synthesizeNewFileDiff(file4, theirsContent));
357972
+ continue;
357973
+ }
357974
+ if (oursContent === theirsContent) continue;
357975
+ const fileDiff = await unifiedDiff(oursContent, theirsContent, file4);
357976
+ if (fileDiff.trim()) {
357977
+ fragments.push(fileDiff);
357978
+ }
357979
+ }
357980
+ return fragments.join("");
357981
+ }
357922
357982
  /**
357923
357983
  * Read THEIRS snapshot from a git tree-ish (commit, branch, or tree).
357924
357984
  * Used when the diff that produced `patch_content` was relative to that
@@ -358184,6 +358244,41 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
358184
358244
  }
358185
358245
  if (patch5.base_generation === currentGen) {
358186
358246
  try {
358247
+ const contaminated = await this.hasAutoversionContamination(
358248
+ currentGen,
358249
+ "HEAD",
358250
+ patch5.files
358251
+ );
358252
+ if (contaminated) {
358253
+ const snapshotDiff = await this.computeSnapshotBasedPatchDiff(
358254
+ patch5,
358255
+ currentGen
358256
+ );
358257
+ if (snapshotDiff === null) continue;
358258
+ if (!snapshotDiff.trim()) {
358259
+ if (await allPatchFilesUserOwned(patch5)) continue;
358260
+ this.lockManager.removePatch(patch5.id);
358261
+ contentRefreshed++;
358262
+ continue;
358263
+ }
358264
+ const snapHasStaleMarkers = snapshotDiff.split("\n").some(
358265
+ (l9) => l9.startsWith("+<<<<<<< Generated") || l9.startsWith("+>>>>>>> Your customization")
358266
+ );
358267
+ if (snapHasStaleMarkers) continue;
358268
+ const isProtectedSnap = patch5.files.some(
358269
+ (file4) => file4 === ".fernignore" || fernignorePatterns.some((p14) => file4 === p14 || (0, import_minimatch22.minimatch)(file4, p14))
358270
+ );
358271
+ if (isProtectedSnap) continue;
358272
+ const snapHash = this.detector.computeContentHash(snapshotDiff);
358273
+ if (snapHash !== patch5.content_hash) {
358274
+ this.lockManager.updatePatch(patch5.id, {
358275
+ patch_content: snapshotDiff,
358276
+ content_hash: snapHash
358277
+ });
358278
+ contentRefreshed++;
358279
+ }
358280
+ continue;
358281
+ }
358187
358282
  const ppResult = await computePerPatchDiffWithFallback(
358188
358283
  patch5,
358189
358284
  (f4) => this.git.showFile(currentGen, f4),
@@ -358235,6 +358330,42 @@ Patches absorbed by generator (${buckets.absorbed.length}):`;
358235
358330
  try {
358236
358331
  const markerFiles = await this.git.exec(["grep", "-l", "<<<<<<< Generated", "HEAD", "--", ...patch5.files]).catch(() => "");
358237
358332
  if (markerFiles.trim()) continue;
358333
+ const contaminated = await this.hasAutoversionContamination(
358334
+ currentGen,
358335
+ "HEAD",
358336
+ patch5.files
358337
+ );
358338
+ if (contaminated) {
358339
+ const snapshotDiff = await this.computeSnapshotBasedPatchDiff(
358340
+ patch5,
358341
+ currentGen
358342
+ );
358343
+ if (snapshotDiff === null) continue;
358344
+ if (!snapshotDiff.trim()) {
358345
+ if (await allPatchFilesUserOwned(patch5)) {
358346
+ try {
358347
+ this.lockManager.updatePatch(patch5.id, { base_generation: currentGen });
358348
+ } catch {
358349
+ }
358350
+ continue;
358351
+ }
358352
+ this.lockManager.removePatch(patch5.id);
358353
+ conflictAbsorbed++;
358354
+ continue;
358355
+ }
358356
+ const snapHasStaleMarkers = snapshotDiff.split("\n").some(
358357
+ (l9) => l9.startsWith("+<<<<<<< Generated") || l9.startsWith("+>>>>>>> Your customization")
358358
+ );
358359
+ if (snapHasStaleMarkers) continue;
358360
+ const snapHash = this.detector.computeContentHash(snapshotDiff);
358361
+ this.lockManager.updatePatch(patch5.id, {
358362
+ base_generation: currentGen,
358363
+ patch_content: snapshotDiff,
358364
+ content_hash: snapHash
358365
+ });
358366
+ conflictResolved++;
358367
+ continue;
358368
+ }
358238
358369
  const ppResult = await computePerPatchDiffWithFallback(
358239
358370
  patch5,
358240
358371
  (f4) => this.git.showFile(currentGen, f4),
@@ -660880,7 +661011,7 @@ var AccessTokenPosthogManager = class {
660880
661011
  properties: {
660881
661012
  ...event,
660882
661013
  ...event.properties,
660883
- version: "5.17.0",
661014
+ version: "5.17.1-3-g719b96df398",
660884
661015
  usingAccessToken: true,
660885
661016
  ...getRunIdProperties()
660886
661017
  }
@@ -660935,7 +661066,7 @@ var UserPosthogManager = class {
660935
661066
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
660936
661067
  event: "CLI",
660937
661068
  properties: {
660938
- version: "5.17.0",
661069
+ version: "5.17.1-3-g719b96df398",
660939
661070
  ...event,
660940
661071
  ...event.properties,
660941
661072
  usingAccessToken: false,
@@ -851918,7 +852049,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
851918
852049
  var LOGS_FOLDER_NAME = "logs";
851919
852050
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
851920
852051
  function getCliSource() {
851921
- const version7 = "5.17.0";
852052
+ const version7 = "5.17.1-3-g719b96df398";
851922
852053
  return `cli@${version7}`;
851923
852054
  }
851924
852055
  var DebugLogger = class {
@@ -863567,7 +863698,7 @@ function sanitizeRelativePathForS3(relativeFilePath) {
863567
863698
  return relativeFilePath.replace(/\.\.\//g, "_dot_dot_/");
863568
863699
  }
863569
863700
  async function publishDocs({ token, organization, docsWorkspace, domain: domain3, customDomains, apiWorkspaces, ossWorkspaces, context: context3, preview, previewId, editThisPage, disableTemplates = false, skipUpload = false, withAiExamples = true, excludeApis = false, targetAudiences, docsUrl, cliVersion, ciSource, deployerAuthor, loginCommand = "fern login", multiSource = false }) {
863570
- const fdrOrigin = "https://registry-dev2.buildwithfern.com";
863701
+ const fdrOrigin = process.env.FERN_FDR_ORIGIN ?? process.env.OVERRIDE_FDR_ORIGIN ?? "https://registry-dev2.buildwithfern.com" ?? "https://registry.buildwithfern.com";
863571
863702
  const isAirGapped = await detectAirGappedMode(`${fdrOrigin}/health`, context3.logger);
863572
863703
  if (isAirGapped) {
863573
863704
  context3.logger.debug("Detected air-gapped environment - skipping external FDR service calls");
@@ -864727,7 +864858,7 @@ var LegacyDocsPublisher = class {
864727
864858
  previewId,
864728
864859
  disableTemplates: void 0,
864729
864860
  skipUpload,
864730
- cliVersion: "5.17.0",
864861
+ cliVersion: "5.17.1-3-g719b96df398",
864731
864862
  loginCommand: "fern auth login"
864732
864863
  });
864733
864864
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -939305,7 +939436,7 @@ var CliContext = class _CliContext {
939305
939436
  if (false) {
939306
939437
  this.logger.error("CLI_VERSION is not defined");
939307
939438
  }
939308
- return "5.17.0";
939439
+ return "5.17.1-3-g719b96df398";
939309
939440
  }
939310
939441
  getCliName() {
939311
939442
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.17.0",
2
+ "version": "5.17.1-3-g719b96df398",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",