@fern-api/fern-api-dev 5.89.5 → 5.89.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 (2) hide show
  1. package/cli.cjs +76 -25
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -568242,6 +568242,7 @@ var require_VersionUtils = __commonJS({
568242
568242
  exports2.maxVersionBump = maxVersionBump3;
568243
568243
  exports2.isAutoVersion = isAutoVersion5;
568244
568244
  exports2.isValidSemver = isValidSemver;
568245
+ exports2.isPlaceholderVersion = isPlaceholderVersion2;
568245
568246
  exports2.incrementVersion = incrementVersion;
568246
568247
  exports2.extractPreviousVersionFromDiffLine = extractPreviousVersionFromDiffLine;
568247
568248
  var semver_1 = __importDefault2(require_semver2());
@@ -568321,11 +568322,18 @@ var require_VersionUtils = __commonJS({
568321
568322
  function isValidSemver(version7) {
568322
568323
  return SEMVER_PATTERN.test(version7);
568323
568324
  }
568325
+ function isPlaceholderVersion2(version7) {
568326
+ const withoutPrefix = version7.startsWith("v") ? version7.slice(1) : version7;
568327
+ return withoutPrefix === exports2.MAGIC_VERSION || withoutPrefix.startsWith(`${exports2.MAGIC_VERSION}.`) || withoutPrefix === exports2.MAGIC_VERSION_PYTHON || withoutPrefix.startsWith(`${exports2.MAGIC_VERSION_PYTHON}.`);
568328
+ }
568324
568329
  function incrementVersion(currentVersion, versionBump) {
568325
568330
  const matcher = currentVersion.match(SEMVER_PATTERN);
568326
568331
  if (!matcher) {
568327
568332
  throw new AutoVersioningService_js_1.AutoVersioningException("Invalid semantic version format: " + currentVersion);
568328
568333
  }
568334
+ if (isPlaceholderVersion2(currentVersion)) {
568335
+ throw new AutoVersioningService_js_1.AutoVersioningException("Refusing to increment the magic placeholder version: " + currentVersion + ". A real previous version must be resolved first.");
568336
+ }
568329
568337
  const prefix2 = matcher[1] ?? "";
568330
568338
  const versionWithoutPrefix = currentVersion.slice(prefix2.length);
568331
568339
  const preRelease = matcher[5];
@@ -568366,7 +568374,7 @@ var require_autoversion = __commonJS({
568366
568374
  "../../generator-cli/lib/autoversion/index.js"(exports2) {
568367
568375
  "use strict";
568368
568376
  Object.defineProperty(exports2, "__esModule", { value: true });
568369
- exports2.VersionBump = exports2.maxVersionBump = exports2.mapMagicVersionForLanguage = exports2.MAX_RAW_DIFF_BYTES = exports2.MAX_CHUNKS = exports2.MAX_AI_DIFF_BYTES = exports2.MAGIC_VERSION_PYTHON = exports2.MAGIC_VERSION = exports2.isValidSemver = exports2.isAutoVersion = exports2.incrementVersion = exports2.extractPreviousVersionFromDiffLine = exports2.extractLanguageFromGeneratorName = exports2.AUTO_VERSION = exports2.prependChangelogBlock = exports2.changelogContainsVersion = exports2.formatSizeKB = exports2.countFilesInDiff = exports2.AutoVersioningService = exports2.AutoVersioningException = exports2.AutoVersioningCache = void 0;
568377
+ exports2.VersionBump = exports2.maxVersionBump = exports2.mapMagicVersionForLanguage = exports2.MAX_RAW_DIFF_BYTES = exports2.MAX_CHUNKS = exports2.MAX_AI_DIFF_BYTES = exports2.MAGIC_VERSION_PYTHON = exports2.MAGIC_VERSION = exports2.isValidSemver = exports2.isPlaceholderVersion = exports2.isAutoVersion = exports2.incrementVersion = exports2.extractPreviousVersionFromDiffLine = exports2.extractLanguageFromGeneratorName = exports2.AUTO_VERSION = exports2.prependChangelogBlock = exports2.changelogContainsVersion = exports2.formatSizeKB = exports2.countFilesInDiff = exports2.AutoVersioningService = exports2.AutoVersioningException = exports2.AutoVersioningCache = void 0;
568370
568378
  var AutoVersioningCache_js_1 = require_AutoVersioningCache();
568371
568379
  Object.defineProperty(exports2, "AutoVersioningCache", { enumerable: true, get: function() {
568372
568380
  return AutoVersioningCache_js_1.AutoVersioningCache;
@@ -568407,6 +568415,9 @@ var require_autoversion = __commonJS({
568407
568415
  Object.defineProperty(exports2, "isAutoVersion", { enumerable: true, get: function() {
568408
568416
  return VersionUtils_js_1.isAutoVersion;
568409
568417
  } });
568418
+ Object.defineProperty(exports2, "isPlaceholderVersion", { enumerable: true, get: function() {
568419
+ return VersionUtils_js_1.isPlaceholderVersion;
568420
+ } });
568410
568421
  Object.defineProperty(exports2, "isValidSemver", { enumerable: true, get: function() {
568411
568422
  return VersionUtils_js_1.isValidSemver;
568412
568423
  } });
@@ -569237,7 +569248,8 @@ var require_AutoVersionStep = __commonJS({
569237
569248
  }
569238
569249
  async handleFirstGeneration(params2) {
569239
569250
  const { service, language, mappedMagicVersion, commit } = params2;
569240
- const initialVersion = this.config.baseVersion ?? (mappedMagicVersion.startsWith("v") ? "v0.0.1" : "0.0.1");
569251
+ const configuredBaseVersion = this.usableVersion(this.config.baseVersion, "baseVersion");
569252
+ const initialVersion = configuredBaseVersion ?? (mappedMagicVersion.startsWith("v") ? "v0.0.1" : "0.0.1");
569241
569253
  if (!(0, index_1.isValidSemver)(initialVersion)) {
569242
569254
  const errorMessage = `AutoVersionStep: baseVersion ${JSON.stringify(initialVersion)} is not a valid semver string (expected e.g. "1.2.3" or "v1.2.3"). Refusing to run.`;
569243
569255
  this.logger.error(errorMessage);
@@ -569547,12 +569559,13 @@ var require_AutoVersionStep = __commonJS({
569547
569559
  */
569548
569560
  async resolvePreviousVersionNonReplay(params2) {
569549
569561
  const { service, rawDiff, mappedMagicVersion, baseVersion } = params2;
569550
- if (baseVersion != null && (0, index_1.isValidSemver)(baseVersion)) {
569551
- this.logger.debug(`AutoVersionStep (non-replay): previous version from pipeline baseVersion: ${baseVersion}`);
569552
- return this.normalizeVersionPrefix(baseVersion, mappedMagicVersion);
569562
+ const usableBaseVersion = this.usableVersion(baseVersion, "baseVersion");
569563
+ if (usableBaseVersion != null && (0, index_1.isValidSemver)(usableBaseVersion)) {
569564
+ this.logger.debug(`AutoVersionStep (non-replay): previous version from pipeline baseVersion: ${usableBaseVersion}`);
569565
+ return this.normalizeVersionPrefix(usableBaseVersion, mappedMagicVersion);
569553
569566
  }
569554
569567
  try {
569555
- const extracted = service.extractPreviousVersion(rawDiff, mappedMagicVersion);
569568
+ const extracted = this.usableVersion(service.extractPreviousVersion(rawDiff, mappedMagicVersion) ?? void 0, "diff");
569556
569569
  if (extracted != null) {
569557
569570
  this.logger.debug(`AutoVersionStep (non-replay): previous version from diff: ${extracted}`);
569558
569571
  return extracted;
@@ -569563,12 +569576,12 @@ var require_AutoVersionStep = __commonJS({
569563
569576
  }
569564
569577
  this.logger.info("AutoVersionStep (non-replay): magic version not in diff; trying metadata + git tags.");
569565
569578
  }
569566
- const metadataVersion = this.readVersionFromMetadataAtHead();
569579
+ const metadataVersion = this.usableVersion(this.readVersionFromMetadataAtHead(), "metadata.json");
569567
569580
  if (metadataVersion != null) {
569568
569581
  return this.normalizeVersionPrefix(metadataVersion, mappedMagicVersion);
569569
569582
  }
569570
569583
  try {
569571
- const tagVersion = await service.getLatestVersionFromGitTags(this.outputDir);
569584
+ const tagVersion = this.usableVersion(await service.getLatestVersionFromGitTags(this.outputDir) ?? void 0, "git tags");
569572
569585
  if (tagVersion != null) {
569573
569586
  return this.normalizeVersionPrefix(tagVersion, mappedMagicVersion);
569574
569587
  }
@@ -569579,12 +569592,13 @@ var require_AutoVersionStep = __commonJS({
569579
569592
  }
569580
569593
  async resolvePreviousVersion(params2) {
569581
569594
  const { service, rawDiff, mappedMagicVersion, baseVersion } = params2;
569582
- if (baseVersion != null && (0, index_1.isValidSemver)(baseVersion)) {
569583
- this.logger.debug(`AutoVersionStep: previous version from pipeline baseVersion: ${baseVersion}`);
569584
- return this.normalizeVersionPrefix(baseVersion, mappedMagicVersion);
569595
+ const usableBaseVersion = this.usableVersion(baseVersion, "baseVersion");
569596
+ if (usableBaseVersion != null && (0, index_1.isValidSemver)(usableBaseVersion)) {
569597
+ this.logger.debug(`AutoVersionStep: previous version from pipeline baseVersion: ${usableBaseVersion}`);
569598
+ return this.normalizeVersionPrefix(usableBaseVersion, mappedMagicVersion);
569585
569599
  }
569586
569600
  try {
569587
- const extracted = service.extractPreviousVersion(rawDiff, mappedMagicVersion);
569601
+ const extracted = this.usableVersion(service.extractPreviousVersion(rawDiff, mappedMagicVersion) ?? void 0, "diff");
569588
569602
  if (extracted != null) {
569589
569603
  this.logger.debug(`AutoVersionStep: previous version from diff: ${extracted}`);
569590
569604
  return extracted;
@@ -569595,12 +569609,12 @@ var require_AutoVersionStep = __commonJS({
569595
569609
  }
569596
569610
  this.logger.info("AutoVersionStep: magic version not found in diff; falling back to metadata + git tags.");
569597
569611
  }
569598
- const metadataVersion = await this.readVersionFromMetadata();
569612
+ const metadataVersion = this.usableVersion(await this.readVersionFromMetadata(), "metadata.json");
569599
569613
  if (metadataVersion != null) {
569600
569614
  return this.normalizeVersionPrefix(metadataVersion, mappedMagicVersion);
569601
569615
  }
569602
569616
  try {
569603
- const tagVersion = await service.getLatestVersionFromGitTags(this.outputDir);
569617
+ const tagVersion = this.usableVersion(await service.getLatestVersionFromGitTags(this.outputDir) ?? void 0, "git tags");
569604
569618
  if (tagVersion != null) {
569605
569619
  return this.normalizeVersionPrefix(tagVersion, mappedMagicVersion);
569606
569620
  }
@@ -569622,6 +569636,25 @@ var require_AutoVersionStep = __commonJS({
569622
569636
  return void 0;
569623
569637
  }
569624
569638
  }
569639
+ /**
569640
+ * Drops candidate previous versions that are the magic placeholder. SDK repos
569641
+ * that derive their published version at release time keep the placeholder
569642
+ * committed, so every resolution source (baseVersion, diff extraction,
569643
+ * metadata.json, git tags) can hand back the sentinel; incrementing it would
569644
+ * emit a mutated placeholder such as `0.0.0-fern-placeholder.0` instead of a
569645
+ * real version. Returning undefined lets the caller fall through to the next
569646
+ * source, and ultimately to the first-generation path.
569647
+ */
569648
+ usableVersion(version7, source2) {
569649
+ if (version7 == null) {
569650
+ return void 0;
569651
+ }
569652
+ if ((0, index_1.isPlaceholderVersion)(version7)) {
569653
+ this.logger.info(`AutoVersionStep: ignoring placeholder version ${version7} from ${source2}; trying the next previous-version source.`);
569654
+ return void 0;
569655
+ }
569656
+ return version7;
569657
+ }
569625
569658
  normalizeVersionPrefix(version7, mappedMagicVersion) {
569626
569659
  const stripped = version7.startsWith("v") ? version7.slice(1) : version7;
569627
569660
  return mappedMagicVersion.startsWith("v") ? `v${stripped}` : stripped;
@@ -694418,7 +694451,7 @@ var AccessTokenPosthogManager = class {
694418
694451
  properties: {
694419
694452
  ...event,
694420
694453
  ...event.properties,
694421
- version: "5.89.5",
694454
+ version: "5.89.6",
694422
694455
  usingAccessToken: true,
694423
694456
  ...getRunIdProperties()
694424
694457
  }
@@ -694484,7 +694517,7 @@ var UserPosthogManager = class {
694484
694517
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
694485
694518
  event: "CLI",
694486
694519
  properties: {
694487
- version: "5.89.5",
694520
+ version: "5.89.6",
694488
694521
  ...event,
694489
694522
  ...event.properties,
694490
694523
  usingAccessToken: false,
@@ -875614,7 +875647,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
875614
875647
  var LOGS_FOLDER_NAME = "logs";
875615
875648
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
875616
875649
  function getCliSource() {
875617
- const version7 = "5.89.5";
875650
+ const version7 = "5.89.6";
875618
875651
  return `cli@${version7}`;
875619
875652
  }
875620
875653
  var DebugLogger = class {
@@ -908324,7 +908357,7 @@ var LegacyDocsPublisher = class {
908324
908357
  previewId,
908325
908358
  disableTemplates: void 0,
908326
908359
  skipUpload,
908327
- cliVersion: "5.89.5",
908360
+ cliVersion: "5.89.6",
908328
908361
  loginCommand: "fern auth login"
908329
908362
  });
908330
908363
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -961942,16 +961975,16 @@ var LocalTaskHandler = class {
961942
961975
  }
961943
961976
  let previousVersion;
961944
961977
  try {
961945
- previousVersion = autoVersioningService.extractPreviousVersion(diffContent, mappedMagicVersion);
961978
+ previousVersion = this.usableVersion(autoVersioningService.extractPreviousVersion(diffContent, mappedMagicVersion) ?? void 0, "diff");
961946
961979
  } catch (e2) {
961947
961980
  if (!(e2 instanceof import_autoversion2.AutoVersioningException) || !e2.magicVersionAbsent) {
961948
961981
  throw e2;
961949
961982
  }
961950
961983
  this.context.logger.info(`Magic version not found in diff, trying fallbacks: ${e2}`);
961951
- previousVersion = await this.getVersionFromLocalMetadata();
961984
+ previousVersion = this.usableVersion(await this.getVersionFromLocalMetadata(), "metadata.json");
961952
961985
  if (previousVersion == null) {
961953
961986
  const tagVersion = await autoVersioningService.getLatestVersionFromGitTags(this.absolutePathToLocalOutput);
961954
- previousVersion = this.normalizeVersionPrefix(tagVersion);
961987
+ previousVersion = this.usableVersion(this.normalizeVersionPrefix(tagVersion), "git tags");
961955
961988
  }
961956
961989
  if (previousVersion == null) {
961957
961990
  this.context.logger.info("No git tags found \u2014 treating as new SDK repository");
@@ -961971,10 +962004,10 @@ var LocalTaskHandler = class {
961971
962004
  const cleanedFileCount = (0, import_autoversion2.countFilesInDiff)(cleanedDiff);
961972
962005
  this.context.logger.debug(`Generated diff size: ${rawDiffSizeKB}KB (${diffContent.length} chars), ${rawFileCount} files changed. Cleaned diff size: ${cleanedDiffSizeKB}KB (${cleanedDiff.length} chars), ${cleanedFileCount} files remaining`);
961973
962006
  if (previousVersion == null) {
961974
- previousVersion = await this.getVersionFromLocalMetadata();
962007
+ previousVersion = this.usableVersion(await this.getVersionFromLocalMetadata(), "metadata.json");
961975
962008
  if (previousVersion == null) {
961976
962009
  const rawTagVersion = await autoVersioningService.getLatestVersionFromGitTags(this.absolutePathToLocalOutput);
961977
- const normalizedTag = this.normalizeVersionPrefix(rawTagVersion);
962010
+ const normalizedTag = this.usableVersion(this.normalizeVersionPrefix(rawTagVersion), "git tags");
961978
962011
  if (normalizedTag != null) {
961979
962012
  this.context.logger.info(`No previous version from diff; using git tag: ${normalizedTag}`);
961980
962013
  previousVersion = normalizedTag;
@@ -962244,6 +962277,24 @@ var LocalTaskHandler = class {
962244
962277
  return void 0;
962245
962278
  }
962246
962279
  }
962280
+ /**
962281
+ * Drops candidate previous versions that are the magic placeholder. SDK repos
962282
+ * that derive their published version at release time keep the placeholder
962283
+ * committed, so any resolution source can hand back the sentinel; bumping it
962284
+ * would publish a mutated placeholder rather than a real version. Returning
962285
+ * undefined lets the caller fall through to the next source, and ultimately to
962286
+ * the initial-version path.
962287
+ */
962288
+ usableVersion(version7, source2) {
962289
+ if (version7 == null) {
962290
+ return void 0;
962291
+ }
962292
+ if ((0, import_autoversion2.isPlaceholderVersion)(version7)) {
962293
+ this.context.logger.info(`Ignoring placeholder version ${version7} from ${source2}; trying the next previous-version source.`);
962294
+ return void 0;
962295
+ }
962296
+ return version7;
962297
+ }
962247
962298
  /**
962248
962299
  * Normalizes a version string's `v` prefix to match the convention used by
962249
962300
  * the magic version for this generator's language. Git tags may use `v1.2.3`
@@ -975214,7 +975265,7 @@ function getAutomationContextFromEnv() {
975214
975265
  config_branch: process.env.FERN_CONFIG_BRANCH,
975215
975266
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
975216
975267
  trigger: process.env.GITHUB_EVENT_NAME,
975217
- cli_version: "5.89.5"
975268
+ cli_version: "5.89.6"
975218
975269
  };
975219
975270
  }
975220
975271
  function isAutomationMode() {
@@ -976046,7 +976097,7 @@ var CliContext = class _CliContext {
976046
976097
  if (false) {
976047
976098
  this.logger.error("CLI_VERSION is not defined");
976048
976099
  }
976049
- return "5.89.5";
976100
+ return "5.89.6";
976050
976101
  }
976051
976102
  getCliName() {
976052
976103
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.89.5",
2
+ "version": "5.89.6",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",