@fern-api/fern-api-dev 5.69.0 → 5.70.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 +222 -65
  2. package/package.json +1 -1
package/cli.cjs CHANGED
@@ -100196,8 +100196,8 @@ var require_graceful_fs = __commonJS({
100196
100196
  }
100197
100197
  }
100198
100198
  var fs$writeFile = fs35.writeFile;
100199
- fs35.writeFile = writeFile101;
100200
- function writeFile101(path120, data2, options2, cb) {
100199
+ fs35.writeFile = writeFile102;
100200
+ function writeFile102(path120, data2, options2, cb) {
100201
100201
  if (typeof options2 === "function")
100202
100202
  cb = options2, options2 = null;
100203
100203
  return go$writeFile(path120, data2, options2, cb);
@@ -117178,7 +117178,8 @@ var init_DocsYmlSchemas = __esm({
117178
117178
  model: AIChatModel.optional(),
117179
117179
  "system-prompt": external_exports.string().optional(),
117180
117180
  location: external_exports.array(AIChatLocation).optional(),
117181
- datasources: external_exports.array(AIChatDatasource).optional()
117181
+ datasources: external_exports.array(AIChatDatasource).optional(),
117182
+ "mask-pii": external_exports.boolean().optional()
117182
117183
  });
117183
117184
  FontConfigVariant = external_exports.object({
117184
117185
  path: external_exports.string(),
@@ -121576,7 +121577,8 @@ var init_AiChatConfig2 = __esm({
121576
121577
  model: AiChatModel2.optional(),
121577
121578
  systemPrompt: schemas_exports6.property("system-prompt", schemas_exports6.string().optional()),
121578
121579
  location: schemas_exports6.list(AiChatLocation2).optional(),
121579
- datasources: schemas_exports6.list(AiChatDatasource).optional()
121580
+ datasources: schemas_exports6.list(AiChatDatasource).optional(),
121581
+ maskPii: schemas_exports6.property("mask-pii", schemas_exports6.boolean().optional())
121580
121582
  });
121581
121583
  }
121582
121584
  });
@@ -457162,13 +457164,13 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context3 }) {
457162
457164
  }
457163
457165
  }
457164
457166
  }
457165
- const { writeFile: writeFile101 } = await import("fs/promises");
457167
+ const { writeFile: writeFile102 } = await import("fs/promises");
457166
457168
  const yamlContent = index_vite_proxy_tmp_default.dump(parsed, {
457167
457169
  indent: 2,
457168
457170
  lineWidth: -1,
457169
457171
  noRefs: true
457170
457172
  });
457171
- await writeFile101(overrideFilePath, yamlContent, "utf-8");
457173
+ await writeFile102(overrideFilePath, yamlContent, "utf-8");
457172
457174
  context3.logger.info(`Removed ${validationResult.invalidCount} invalid AI examples from ai_examples_override.yml`);
457173
457175
  return {
457174
457176
  removedCount: validationResult.invalidCount,
@@ -461443,7 +461445,8 @@ var init_DocsDefinitionResolver = __esm({
461443
461445
  datasources: this.parsedDocsConfig.aiChatConfig.datasources?.map((ds2) => ({
461444
461446
  url: ds2.url,
461445
461447
  title: ds2.title
461446
- }))
461448
+ })),
461449
+ maskPii: this.parsedDocsConfig.aiChatConfig.maskPii
461447
461450
  } : void 0,
461448
461451
  hideNavLinks: void 0,
461449
461452
  title: this.parsedDocsConfig.title,
@@ -480469,8 +480472,8 @@ var require_graceful_fs2 = __commonJS({
480469
480472
  }
480470
480473
  }
480471
480474
  var fs$writeFile = fs35.writeFile;
480472
- fs35.writeFile = writeFile101;
480473
- function writeFile101(path120, data2, options2, cb) {
480475
+ fs35.writeFile = writeFile102;
480476
+ function writeFile102(path120, data2, options2, cb) {
480474
480477
  if (typeof options2 === "function")
480475
480478
  cb = options2, options2 = null;
480476
480479
  return go$writeFile(path120, data2, options2, cb);
@@ -564687,7 +564690,8 @@ var require_AutoVersioningService = __commonJS({
564687
564690
  }
564688
564691
  await this.addSuffixToGoMod(goModPath, modulePath, suffix);
564689
564692
  await this.addSuffixToGoFiles(workingDirectory, modulePath, suffix);
564690
- this.logger.info(`Added ${suffix} to Go module path ${modulePath} and all import paths`);
564693
+ await this.addSuffixToMarkdownFiles(workingDirectory, modulePath, suffix);
564694
+ this.logger.info(`Added ${suffix} to Go module path ${modulePath} across imports, headers, and docs`);
564691
564695
  }
564692
564696
  /**
564693
564697
  * Extracts the major version number from a version string.
@@ -564768,15 +564772,16 @@ var require_AutoVersioningService = __commonJS({
564768
564772
  return results;
564769
564773
  }
564770
564774
  /**
564771
- * Adds a version suffix to import paths in all .go files in the repository.
564775
+ * Adds a version suffix to import paths and embedded module-path string
564776
+ * literals (e.g. the X-Fern-SDK-Name header value) in all .go files.
564772
564777
  */
564773
564778
  async addSuffixToGoFiles(repoRoot, modulePath, suffix) {
564774
564779
  const goFiles = await this.walkDirectory(repoRoot, (filePath) => (0, path_1.extname)(filePath) === ".go");
564775
564780
  await this.processInParallel(goFiles, (filePath) => this.addSuffixToGoFile(filePath, modulePath, suffix));
564776
564781
  }
564777
564782
  /**
564778
- * Adds a version suffix to import paths in a single .go file.
564779
- * Replaces occurrences of the module path with modulePath + suffix in import statements.
564783
+ * Adds a version suffix to import paths and embedded module-path string
564784
+ * literals in a single .go file.
564780
564785
  */
564781
564786
  async addSuffixToGoFile(filePath, modulePath, suffix) {
564782
564787
  const content5 = await (0, promises_1.readFile)(filePath, "utf-8");
@@ -564795,13 +564800,10 @@ var require_AutoVersioningService = __commonJS({
564795
564800
  inImportBlock = false;
564796
564801
  }
564797
564802
  const isImportLine = inImportBlock || trimmed2.startsWith('import "') || trimmed2.startsWith('import "') || /^import\s+\w+\s+"/.test(trimmed2);
564798
- if (!isImportLine) {
564799
- continue;
564800
- }
564801
564803
  if (!line.includes(modulePath)) {
564802
564804
  continue;
564803
564805
  }
564804
- const newLine = line.replace(`"${modulePath}/`, `"${modulePath}${suffix}/`).replace(`"${modulePath}"`, `"${modulePath}${suffix}"`);
564806
+ const newLine = isImportLine ? line.split(`"${modulePath}/`).join(`"${modulePath}${suffix}/`).split(`"${modulePath}"`).join(`"${modulePath}${suffix}"`) : line.split(`"${modulePath}"`).join(`"${modulePath}${suffix}"`);
564805
564807
  if (newLine !== line) {
564806
564808
  lines[i5] = newLine;
564807
564809
  changed = true;
@@ -564812,6 +564814,36 @@ var require_AutoVersioningService = __commonJS({
564812
564814
  this.logger.debug(`Updated Go imports in ${filePath}`);
564813
564815
  }
564814
564816
  }
564817
+ /**
564818
+ * Adds a version suffix to Go module references in all Markdown files
564819
+ * (e.g. README.md) in the repository, so documented install commands and
564820
+ * import samples resolve to the correct /vN module path when copy-pasted.
564821
+ */
564822
+ async addSuffixToMarkdownFiles(repoRoot, modulePath, suffix) {
564823
+ const markdownFiles = await this.walkDirectory(repoRoot, (filePath) => (0, path_1.extname)(filePath).toLowerCase() === ".md");
564824
+ await this.processInParallel(markdownFiles, (filePath) => this.addSuffixToMarkdownFile(filePath, modulePath, suffix));
564825
+ }
564826
+ /**
564827
+ * Adds a version suffix to Go module references in a single Markdown file.
564828
+ * Rewrites `go get`/`go install` install commands and quoted import paths in
564829
+ * code samples. Web URLs (e.g. `https://pkg.go.dev/<modulePath>`) are left
564830
+ * untouched because the module path there is neither quote-anchored nor
564831
+ * preceded by an install command.
564832
+ */
564833
+ async addSuffixToMarkdownFile(filePath, modulePath, suffix) {
564834
+ const content5 = await (0, promises_1.readFile)(filePath, "utf-8");
564835
+ if (!content5.includes(modulePath)) {
564836
+ return;
564837
+ }
564838
+ let updated = content5.split(`"${modulePath}/`).join(`"${modulePath}${suffix}/`).split(`"${modulePath}"`).join(`"${modulePath}${suffix}"`);
564839
+ const escapedModulePath = modulePath.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
564840
+ const installCommandPattern = new RegExp(`(go (?:get|install)(?:\\s+-\\S+)*\\s+)${escapedModulePath}(?![\\w./-])`, "g");
564841
+ updated = updated.replace(installCommandPattern, `$1${modulePath}${suffix}`);
564842
+ if (updated !== content5) {
564843
+ await (0, promises_1.writeFile)(filePath, updated, "utf-8");
564844
+ this.logger.debug(`Updated Go module path in ${filePath}`);
564845
+ }
564846
+ }
564815
564847
  /**
564816
564848
  * Extracts the file path from a diff file section.
564817
564849
  * Parses the "diff --git a/path b/path" header line.
@@ -564857,6 +564889,44 @@ var require_AutoVersioningService = __commonJS({
564857
564889
  }
564858
564890
  });
564859
564891
 
564892
+ // ../../generator-cli/lib/autoversion/changelogUtils.js
564893
+ var require_changelogUtils = __commonJS({
564894
+ "../../generator-cli/lib/autoversion/changelogUtils.js"(exports2) {
564895
+ "use strict";
564896
+ Object.defineProperty(exports2, "__esModule", { value: true });
564897
+ exports2.prependChangelogBlock = prependChangelogBlock2;
564898
+ exports2.changelogContainsVersion = changelogContainsVersion2;
564899
+ function prependChangelogBlock2({ existingContent, version: version7, entry, date: date26 = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10) }) {
564900
+ const header = version7 != null ? `## [${version7}] - ${date26}
564901
+ ` : `## ${date26}
564902
+ `;
564903
+ const trimmedEntry = entry.trim();
564904
+ const newBlock = trimmedEntry.length > 0 ? `${header}${trimmedEntry}
564905
+
564906
+ ` : `${header}
564907
+ `;
564908
+ if (existingContent.trim().length === 0) {
564909
+ return `# Changelog
564910
+
564911
+ ${newBlock}`;
564912
+ }
564913
+ if (existingContent.startsWith("# Changelog")) {
564914
+ const newlineIdx = existingContent.indexOf("\n");
564915
+ const headerLine = newlineIdx >= 0 ? existingContent.slice(0, newlineIdx) : existingContent;
564916
+ const remainder = (newlineIdx >= 0 ? existingContent.slice(newlineIdx + 1) : "").replace(/^\s*\n/, "");
564917
+ return `${headerLine}
564918
+
564919
+ ${newBlock}${remainder}`;
564920
+ }
564921
+ return `${newBlock}${existingContent}`;
564922
+ }
564923
+ function changelogContainsVersion2(content5, version7) {
564924
+ const escaped = version7.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
564925
+ return new RegExp(`^## \\[${escaped}\\]`, "m").test(content5);
564926
+ }
564927
+ }
564928
+ });
564929
+
564860
564930
  // ../../generator-cli/lib/autoversion/VersionUtils.js
564861
564931
  var require_VersionUtils = __commonJS({
564862
564932
  "../../generator-cli/lib/autoversion/VersionUtils.js"(exports2) {
@@ -564995,7 +565065,7 @@ var require_autoversion = __commonJS({
564995
565065
  "../../generator-cli/lib/autoversion/index.js"(exports2) {
564996
565066
  "use strict";
564997
565067
  Object.defineProperty(exports2, "__esModule", { value: true });
564998
- 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.formatSizeKB = exports2.countFilesInDiff = exports2.AutoVersioningService = exports2.AutoVersioningException = exports2.AutoVersioningCache = void 0;
565068
+ 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;
564999
565069
  var AutoVersioningCache_js_1 = require_AutoVersioningCache();
565000
565070
  Object.defineProperty(exports2, "AutoVersioningCache", { enumerable: true, get: function() {
565001
565071
  return AutoVersioningCache_js_1.AutoVersioningCache;
@@ -565013,6 +565083,13 @@ var require_autoversion = __commonJS({
565013
565083
  Object.defineProperty(exports2, "formatSizeKB", { enumerable: true, get: function() {
565014
565084
  return AutoVersioningService_js_1.formatSizeKB;
565015
565085
  } });
565086
+ var changelogUtils_js_1 = require_changelogUtils();
565087
+ Object.defineProperty(exports2, "changelogContainsVersion", { enumerable: true, get: function() {
565088
+ return changelogUtils_js_1.changelogContainsVersion;
565089
+ } });
565090
+ Object.defineProperty(exports2, "prependChangelogBlock", { enumerable: true, get: function() {
565091
+ return changelogUtils_js_1.prependChangelogBlock;
565092
+ } });
565016
565093
  var VersionUtils_js_1 = require_VersionUtils();
565017
565094
  Object.defineProperty(exports2, "AUTO_VERSION", { enumerable: true, get: function() {
565018
565095
  return VersionUtils_js_1.AUTO_VERSION;
@@ -566397,32 +566474,11 @@ ${body}` : `${COMMIT_MARKER} ${subject}`;
566397
566474
  async prependChangelogEntry(params2) {
566398
566475
  const { version: version7, entry } = params2;
566399
566476
  const changelogPath = (0, path_1.join)(this.outputDir, "changelog.md");
566400
- const now = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
566401
- const header = `## [${version7}] - ${now}
566402
- `;
566403
- const newBlock = `${header}${entry.trim()}
566404
-
566405
- `;
566406
566477
  let existing = "";
566407
566478
  if ((0, fs_1.existsSync)(changelogPath)) {
566408
566479
  existing = await (0, promises_1.readFile)(changelogPath, "utf-8");
566409
566480
  }
566410
- let output2;
566411
- if (existing.trim().length === 0) {
566412
- output2 = `# Changelog
566413
-
566414
- ${newBlock}`;
566415
- } else if (existing.startsWith("# Changelog")) {
566416
- const newlineIdx = existing.indexOf("\n");
566417
- const headerLine = newlineIdx >= 0 ? existing.slice(0, newlineIdx) : existing;
566418
- const remainder = (newlineIdx >= 0 ? existing.slice(newlineIdx + 1) : "").replace(/^\s*\n/, "");
566419
- output2 = `${headerLine}
566420
-
566421
- ${newBlock}${remainder}`;
566422
- } else {
566423
- output2 = `${newBlock}${existing}`;
566424
- }
566425
- await (0, promises_1.writeFile)(changelogPath, output2, "utf-8");
566481
+ await (0, promises_1.writeFile)(changelogPath, (0, index_1.prependChangelogBlock)({ existingContent: existing, version: version7, entry }), "utf-8");
566426
566482
  }
566427
566483
  brandMessage(message) {
566428
566484
  if (this.config.isWhitelabel) {
@@ -582299,6 +582355,7 @@ var require_GithubStep = __commonJS({
582299
582355
  var rest_1 = (init_dist_src9(), __toCommonJS(dist_src_exports));
582300
582356
  var promises_1 = require("fs/promises");
582301
582357
  var path_1 = require("path");
582358
+ var index_1 = require_autoversion();
582302
582359
  var createReplayBranch_1 = require_createReplayBranch();
582303
582360
  var findExistingUpdatablePR_1 = require_findExistingUpdatablePR();
582304
582361
  var parseCommitMessage_1 = require_parseCommitMessage();
@@ -582640,31 +582697,38 @@ var require_GithubStep = __commonJS({
582640
582697
  }
582641
582698
  }
582642
582699
  /**
582643
- * Guarantees `changelog.md` is present in the output directory whenever a changelog entry
582644
- * exists for this run, so the file lands in the committed tree that GithubStep pushes and the
582700
+ * Guarantees `changelog.md` records this run whenever there is a changelog entry or a
582701
+ * resolved version, so the file lands in the committed tree that GithubStep pushes and the
582645
582702
  * "See full changelog" link resolves. AutoVersionStep normally writes this file via
582646
- * `prependChangelogEntry`; this is a safety net for paths where that write never reached the
582647
- * directory GithubStep commits (e.g. non-replay self-hosted generation), which previously left
582648
- * the link pointing at a non-existent blob (404).
582703
+ * `prependChangelogEntry`; this covers the paths where that write never reached the
582704
+ * directory GithubStep commits (e.g. non-replay self-hosted generation) and explicitly
582705
+ * versioned runs (`--version X.Y.Z`), which record a version-only entry with an empty
582706
+ * description. Existing entries are always preserved — the new block is prepended.
582649
582707
  *
582650
- * Returns `true` when it created the file, `false` when the file already existed (or there is
582651
- * no changelog entry to write).
582708
+ * Returns `true` when it created or modified the file, `false` when the version's entry was
582709
+ * already recorded (e.g. by AutoVersionStep) or there is nothing to write.
582652
582710
  */
582653
582711
  async ensureChangelogFile(resolved) {
582654
- const entry = resolved.changelogEntry?.trim();
582655
- if (entry == null || entry.length === 0) {
582712
+ const entry = resolved.changelogEntry?.trim() ?? "";
582713
+ const version7 = resolved.newVersion ?? resolved.previousVersion;
582714
+ if (entry.length === 0 && resolved.newVersion == null) {
582656
582715
  return false;
582657
582716
  }
582658
582717
  const changelogPath = (0, path_1.join)(this.outputDir, "changelog.md");
582718
+ let existing;
582659
582719
  try {
582660
- await (0, promises_1.access)(changelogPath);
582661
- return false;
582720
+ existing = await (0, promises_1.readFile)(changelogPath, "utf-8");
582662
582721
  } catch {
582663
- const version7 = resolved.newVersion ?? resolved.previousVersion;
582664
- await (0, promises_1.writeFile)(changelogPath, buildChangelogFileContents(entry, version7), "utf-8");
582665
- this.logger.debug(`Wrote changelog.md${version7 != null ? ` for ${version7}` : ""}.`);
582666
- return true;
582722
+ existing = void 0;
582723
+ }
582724
+ if (existing != null) {
582725
+ if (version7 == null || (0, index_1.changelogContainsVersion)(existing, version7)) {
582726
+ return false;
582727
+ }
582667
582728
  }
582729
+ await (0, promises_1.writeFile)(changelogPath, (0, index_1.prependChangelogBlock)({ existingContent: existing ?? "", version: version7, entry }), "utf-8");
582730
+ this.logger.debug(`Wrote changelog.md${version7 != null ? ` for ${version7}` : ""}.`);
582731
+ return true;
582668
582732
  }
582669
582733
  deriveSkipCommit(replayResult) {
582670
582734
  if (replayResult == null) {
@@ -610906,6 +610970,7 @@ var require_GitHub = __commonJS({
610906
610970
  var fs_utils_1 = (init_lib8(), __toCommonJS(lib_exports3));
610907
610971
  var github_1 = (init_lib11(), __toCommonJS(lib_exports4));
610908
610972
  var rest_1 = (init_dist_src9(), __toCommonJS(dist_src_exports));
610973
+ var promises_1 = require("fs/promises");
610909
610974
  var GitHub = class {
610910
610975
  githubConfig;
610911
610976
  constructor({ githubConfig }) {
@@ -610930,9 +610995,10 @@ var require_GitHub = __commonJS({
610930
610995
  await repository.pull(branch);
610931
610996
  }
610932
610997
  const fernIgnoreFiles = await this.getFernignoreFiles(repository);
610998
+ const changelogFiles = await this.getChangelogFilesToPreserve(repository, sourceDirectory);
610933
610999
  await repository.overwriteLocalContents(sourceDirectory);
610934
611000
  await repository.add(".");
610935
- await this.restoreFiles(repository, fernIgnoreFiles);
611001
+ await this.restoreFiles(repository, [...fernIgnoreFiles, ...changelogFiles]);
610936
611002
  await repository.commit("SDK Generation");
610937
611003
  if (isEmptyRepo) {
610938
611004
  await repository.pushUpstream(branch);
@@ -610969,9 +611035,10 @@ var require_GitHub = __commonJS({
610969
611035
  const prBranch = `fern-bot/${formattedDate}`;
610970
611036
  await repository.checkout(prBranch);
610971
611037
  const fernIgnoreFiles = await this.getFernignoreFiles(repository);
611038
+ const changelogFiles = await this.getChangelogFilesToPreserve(repository, sourceDirectory);
610972
611039
  await repository.overwriteLocalContents(sourceDirectory);
610973
611040
  await repository.add(".");
610974
- await this.restoreFiles(repository, fernIgnoreFiles);
611041
+ await this.restoreFiles(repository, [...fernIgnoreFiles, ...changelogFiles]);
610975
611042
  await repository.commit("SDK Generation");
610976
611043
  await repository.push();
610977
611044
  const apiBaseUrl = (0, github_1.getGithubApiBaseUrl)(this.githubConfig.uri);
@@ -611015,6 +611082,25 @@ var require_GitHub = __commonJS({
611015
611082
  const tracked = await repository.listTrackedFiles();
611016
611083
  return (0, github_1.expandFernignorePatterns)(fernignore, tracked);
611017
611084
  }
611085
+ /**
611086
+ * Returns tracked changelog files (e.g. `changelog.md`) that should be restored after
611087
+ * `overwriteLocalContents`, so existing changelog entries are never wiped when the
611088
+ * generated output doesn't include a changelog of its own.
611089
+ */
611090
+ async getChangelogFilesToPreserve(repository, sourceDirectory) {
611091
+ const tracked = await repository.listTrackedFiles();
611092
+ const trackedChangelogs = tracked.filter((file4) => file4.toLowerCase() === "changelog.md");
611093
+ if (trackedChangelogs.length === 0) {
611094
+ return [];
611095
+ }
611096
+ try {
611097
+ const sourceFiles = await (0, promises_1.readdir)(sourceDirectory);
611098
+ const sourceHasChangelog = sourceFiles.some((file4) => file4.toLowerCase() === "changelog.md");
611099
+ return sourceHasChangelog ? [] : trackedChangelogs;
611100
+ } catch {
611101
+ return trackedChangelogs;
611102
+ }
611103
+ }
611018
611104
  async restoreFiles(repository, files) {
611019
611105
  if (files.length === 0) {
611020
611106
  return;
@@ -622828,7 +622914,7 @@ var require_jsonfile = __commonJS({
622828
622914
  const str2 = stringify5(obj, options2);
622829
622915
  await universalify.fromCallback(fs34.writeFile)(file4, str2, options2);
622830
622916
  }
622831
- var writeFile101 = universalify.fromPromise(_writeFile);
622917
+ var writeFile102 = universalify.fromPromise(_writeFile);
622832
622918
  function writeFileSync9(file4, obj, options2 = {}) {
622833
622919
  const fs34 = options2.fs || _fs;
622834
622920
  const str2 = stringify5(obj, options2);
@@ -622837,7 +622923,7 @@ var require_jsonfile = __commonJS({
622837
622923
  module4.exports = {
622838
622924
  readFile: readFile120,
622839
622925
  readFileSync: readFileSync19,
622840
- writeFile: writeFile101,
622926
+ writeFile: writeFile102,
622841
622927
  writeFileSync: writeFileSync9
622842
622928
  };
622843
622929
  }
@@ -689243,7 +689329,7 @@ var AccessTokenPosthogManager = class {
689243
689329
  properties: {
689244
689330
  ...event,
689245
689331
  ...event.properties,
689246
- version: "5.69.0",
689332
+ version: "5.70.1",
689247
689333
  usingAccessToken: true,
689248
689334
  ...getRunIdProperties()
689249
689335
  }
@@ -689309,7 +689395,7 @@ var UserPosthogManager = class {
689309
689395
  distinctId: this.userId ?? await this.getPersistedDistinctId(),
689310
689396
  event: "CLI",
689311
689397
  properties: {
689312
- version: "5.69.0",
689398
+ version: "5.70.1",
689313
689399
  ...event,
689314
689400
  ...event.properties,
689315
689401
  usingAccessToken: false,
@@ -870410,7 +870496,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
870410
870496
  var LOGS_FOLDER_NAME = "logs";
870411
870497
  var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
870412
870498
  function getCliSource() {
870413
- const version7 = "5.69.0";
870499
+ const version7 = "5.70.1";
870414
870500
  return `cli@${version7}`;
870415
870501
  }
870416
870502
  var DebugLogger = class {
@@ -897206,6 +897292,17 @@ var definitions6 = {
897206
897292
  }
897207
897293
  ],
897208
897294
  description: "Additional content sources that Ask Fern should index and search."
897295
+ },
897296
+ "mask-pii": {
897297
+ oneOf: [
897298
+ {
897299
+ type: "boolean"
897300
+ },
897301
+ {
897302
+ type: "null"
897303
+ }
897304
+ ],
897305
+ description: "When enabled, personally identifiable information (PII) in user messages is masked before\nbeing sent to Ask Fern. Disabled by default."
897209
897306
  }
897210
897307
  },
897211
897308
  additionalProperties: false
@@ -902971,7 +903068,7 @@ var LegacyDocsPublisher = class {
902971
903068
  previewId,
902972
903069
  disableTemplates: void 0,
902973
903070
  skipUpload,
902974
- cliVersion: "5.69.0",
903071
+ cliVersion: "5.70.1",
902975
903072
  loginCommand: "fern auth login"
902976
903073
  });
902977
903074
  if (taskContext.getResult() === TaskResult.Failure) {
@@ -955968,6 +956065,7 @@ var LocalTaskHandler = class {
955968
956065
  const isFernIgnorePresent = this.skipFernignore ? false : await this.isFernIgnorePresent();
955969
956066
  const isExistingGitRepo = await this.isGitRepository();
955970
956067
  const priorChangelog = this.version != null && (0, import_autoversion2.isAutoVersion)(this.version) ? await this.readPriorChangelog(3) : "";
956068
+ const priorChangelogFile = await this.readChangelogFile();
955971
956069
  if (isFernIgnorePresent) {
955972
956070
  const absolutePathToFernignore = AbsoluteFilePath2.of(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME)));
955973
956071
  const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
@@ -955983,6 +956081,13 @@ var LocalTaskHandler = class {
955983
956081
  } else {
955984
956082
  await this.copyGeneratedFilesNoFernIgnoreDeleteAll();
955985
956083
  }
956084
+ await this.restoreChangelogFile(priorChangelogFile);
956085
+ if (this.version != null && !(0, import_autoversion2.isAutoVersion)(this.version)) {
956086
+ await this.prependExplicitVersionChangelogEntry({
956087
+ version: this.version,
956088
+ createIfMissing: isExistingGitRepo
956089
+ });
956090
+ }
955986
956091
  if (this.absolutePathToTmpSnippetJSON != null && this.absolutePathToLocalSnippetJSON != null && await doesPathExist(this.absolutePathToTmpSnippetJSON)) {
955987
956092
  await this.copySnippetJSON({
955988
956093
  absolutePathToTmpSnippetJSON: this.absolutePathToTmpSnippetJSON,
@@ -956584,6 +956689,58 @@ var LocalTaskHandler = class {
956584
956689
  return "";
956585
956690
  }
956586
956691
  }
956692
+ /**
956693
+ * Reads the full contents of the changelog file (case-insensitive `changelog.md`)
956694
+ * in the output directory. Returns undefined when no changelog file exists.
956695
+ */
956696
+ async readChangelogFile() {
956697
+ try {
956698
+ const files = await (0, import_promises137.readdir)(this.absolutePathToLocalOutput);
956699
+ const filename = files.find((f3) => f3.toLowerCase() === "changelog.md");
956700
+ if (filename == null) {
956701
+ return void 0;
956702
+ }
956703
+ const content5 = await (0, import_promises137.readFile)(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(filename)), "utf-8");
956704
+ return { filename, content: content5 };
956705
+ } catch (error50) {
956706
+ this.context.logger.debug(`Failed to read changelog file: ${error50}`);
956707
+ return void 0;
956708
+ }
956709
+ }
956710
+ /**
956711
+ * Restores the changelog file captured before the copy operations if those
956712
+ * operations removed it (generators don't emit changelog.md, so a plain copy
956713
+ * would silently drop all prior entries).
956714
+ */
956715
+ async restoreChangelogFile(prior) {
956716
+ if (prior == null) {
956717
+ return;
956718
+ }
956719
+ const current3 = await this.readChangelogFile();
956720
+ if (current3 != null) {
956721
+ return;
956722
+ }
956723
+ await (0, import_promises137.writeFile)(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(prior.filename)), prior.content);
956724
+ this.context.logger.debug(`Restored ${prior.filename} removed during generation.`);
956725
+ }
956726
+ /**
956727
+ * Prepends a version-only changelog entry (version header, empty description) for an
956728
+ * explicitly pinned version. Skips when the version is already recorded. When no
956729
+ * changelog file exists, one is created only if `createIfMissing` is set (SDK repos) —
956730
+ * plain local filesystem outputs are left untouched.
956731
+ */
956732
+ async prependExplicitVersionChangelogEntry({ version: version7, createIfMissing }) {
956733
+ const existing = await this.readChangelogFile();
956734
+ if (existing == null && !createIfMissing) {
956735
+ return;
956736
+ }
956737
+ if (existing != null && (0, import_autoversion2.changelogContainsVersion)(existing.content, version7)) {
956738
+ return;
956739
+ }
956740
+ const filename = existing?.filename ?? "changelog.md";
956741
+ await (0, import_promises137.writeFile)(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(filename)), (0, import_autoversion2.prependChangelogBlock)({ existingContent: existing?.content ?? "", version: version7, entry: "" }));
956742
+ this.context.logger.debug(`Recorded version ${version7} in ${filename}.`);
956743
+ }
956587
956744
  /**
956588
956745
  * Reads the most recent git commit message that touched the .fern/ directory
956589
956746
  * in the spec repo. This provides context to the AI about why the API changed.
@@ -969332,7 +969489,7 @@ function getAutomationContextFromEnv() {
969332
969489
  config_branch: process.env.FERN_CONFIG_BRANCH,
969333
969490
  config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
969334
969491
  trigger: process.env.GITHUB_EVENT_NAME,
969335
- cli_version: "5.69.0"
969492
+ cli_version: "5.70.1"
969336
969493
  };
969337
969494
  }
969338
969495
  function isAutomationMode() {
@@ -970164,7 +970321,7 @@ var CliContext = class _CliContext {
970164
970321
  if (false) {
970165
970322
  this.logger.error("CLI_VERSION is not defined");
970166
970323
  }
970167
- return "5.69.0";
970324
+ return "5.70.1";
970168
970325
  }
970169
970326
  getCliName() {
970170
970327
  if (false) {
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "5.69.0",
2
+ "version": "5.70.1",
3
3
  "repository": {
4
4
  "type": "git",
5
5
  "url": "git+https://github.com/fern-api/fern.git",