@fern-api/fern-api-dev 5.70.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.
- package/cli.cjs +205 -62
- 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 =
|
|
100200
|
-
function
|
|
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);
|
|
@@ -457164,13 +457164,13 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context3 }) {
|
|
|
457164
457164
|
}
|
|
457165
457165
|
}
|
|
457166
457166
|
}
|
|
457167
|
-
const { writeFile:
|
|
457167
|
+
const { writeFile: writeFile102 } = await import("fs/promises");
|
|
457168
457168
|
const yamlContent = index_vite_proxy_tmp_default.dump(parsed, {
|
|
457169
457169
|
indent: 2,
|
|
457170
457170
|
lineWidth: -1,
|
|
457171
457171
|
noRefs: true
|
|
457172
457172
|
});
|
|
457173
|
-
await
|
|
457173
|
+
await writeFile102(overrideFilePath, yamlContent, "utf-8");
|
|
457174
457174
|
context3.logger.info(`Removed ${validationResult.invalidCount} invalid AI examples from ai_examples_override.yml`);
|
|
457175
457175
|
return {
|
|
457176
457176
|
removedCount: validationResult.invalidCount,
|
|
@@ -480472,8 +480472,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
480472
480472
|
}
|
|
480473
480473
|
}
|
|
480474
480474
|
var fs$writeFile = fs35.writeFile;
|
|
480475
|
-
fs35.writeFile =
|
|
480476
|
-
function
|
|
480475
|
+
fs35.writeFile = writeFile102;
|
|
480476
|
+
function writeFile102(path120, data2, options2, cb) {
|
|
480477
480477
|
if (typeof options2 === "function")
|
|
480478
480478
|
cb = options2, options2 = null;
|
|
480479
480479
|
return go$writeFile(path120, data2, options2, cb);
|
|
@@ -564690,7 +564690,8 @@ var require_AutoVersioningService = __commonJS({
|
|
|
564690
564690
|
}
|
|
564691
564691
|
await this.addSuffixToGoMod(goModPath, modulePath, suffix);
|
|
564692
564692
|
await this.addSuffixToGoFiles(workingDirectory, modulePath, suffix);
|
|
564693
|
-
this.
|
|
564693
|
+
await this.addSuffixToMarkdownFiles(workingDirectory, modulePath, suffix);
|
|
564694
|
+
this.logger.info(`Added ${suffix} to Go module path ${modulePath} across imports, headers, and docs`);
|
|
564694
564695
|
}
|
|
564695
564696
|
/**
|
|
564696
564697
|
* Extracts the major version number from a version string.
|
|
@@ -564771,15 +564772,16 @@ var require_AutoVersioningService = __commonJS({
|
|
|
564771
564772
|
return results;
|
|
564772
564773
|
}
|
|
564773
564774
|
/**
|
|
564774
|
-
* Adds a version suffix to import paths
|
|
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.
|
|
564775
564777
|
*/
|
|
564776
564778
|
async addSuffixToGoFiles(repoRoot, modulePath, suffix) {
|
|
564777
564779
|
const goFiles = await this.walkDirectory(repoRoot, (filePath) => (0, path_1.extname)(filePath) === ".go");
|
|
564778
564780
|
await this.processInParallel(goFiles, (filePath) => this.addSuffixToGoFile(filePath, modulePath, suffix));
|
|
564779
564781
|
}
|
|
564780
564782
|
/**
|
|
564781
|
-
* Adds a version suffix to import paths
|
|
564782
|
-
*
|
|
564783
|
+
* Adds a version suffix to import paths and embedded module-path string
|
|
564784
|
+
* literals in a single .go file.
|
|
564783
564785
|
*/
|
|
564784
564786
|
async addSuffixToGoFile(filePath, modulePath, suffix) {
|
|
564785
564787
|
const content5 = await (0, promises_1.readFile)(filePath, "utf-8");
|
|
@@ -564798,13 +564800,10 @@ var require_AutoVersioningService = __commonJS({
|
|
|
564798
564800
|
inImportBlock = false;
|
|
564799
564801
|
}
|
|
564800
564802
|
const isImportLine = inImportBlock || trimmed2.startsWith('import "') || trimmed2.startsWith('import "') || /^import\s+\w+\s+"/.test(trimmed2);
|
|
564801
|
-
if (!isImportLine) {
|
|
564802
|
-
continue;
|
|
564803
|
-
}
|
|
564804
564803
|
if (!line.includes(modulePath)) {
|
|
564805
564804
|
continue;
|
|
564806
564805
|
}
|
|
564807
|
-
const newLine = line.
|
|
564806
|
+
const newLine = isImportLine ? line.split(`"${modulePath}/`).join(`"${modulePath}${suffix}/`).split(`"${modulePath}"`).join(`"${modulePath}${suffix}"`) : line.split(`"${modulePath}"`).join(`"${modulePath}${suffix}"`);
|
|
564808
564807
|
if (newLine !== line) {
|
|
564809
564808
|
lines[i5] = newLine;
|
|
564810
564809
|
changed = true;
|
|
@@ -564815,6 +564814,36 @@ var require_AutoVersioningService = __commonJS({
|
|
|
564815
564814
|
this.logger.debug(`Updated Go imports in ${filePath}`);
|
|
564816
564815
|
}
|
|
564817
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
|
+
}
|
|
564818
564847
|
/**
|
|
564819
564848
|
* Extracts the file path from a diff file section.
|
|
564820
564849
|
* Parses the "diff --git a/path b/path" header line.
|
|
@@ -564860,6 +564889,44 @@ var require_AutoVersioningService = __commonJS({
|
|
|
564860
564889
|
}
|
|
564861
564890
|
});
|
|
564862
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
|
+
|
|
564863
564930
|
// ../../generator-cli/lib/autoversion/VersionUtils.js
|
|
564864
564931
|
var require_VersionUtils = __commonJS({
|
|
564865
564932
|
"../../generator-cli/lib/autoversion/VersionUtils.js"(exports2) {
|
|
@@ -564998,7 +565065,7 @@ var require_autoversion = __commonJS({
|
|
|
564998
565065
|
"../../generator-cli/lib/autoversion/index.js"(exports2) {
|
|
564999
565066
|
"use strict";
|
|
565000
565067
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
565001
|
-
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;
|
|
565002
565069
|
var AutoVersioningCache_js_1 = require_AutoVersioningCache();
|
|
565003
565070
|
Object.defineProperty(exports2, "AutoVersioningCache", { enumerable: true, get: function() {
|
|
565004
565071
|
return AutoVersioningCache_js_1.AutoVersioningCache;
|
|
@@ -565016,6 +565083,13 @@ var require_autoversion = __commonJS({
|
|
|
565016
565083
|
Object.defineProperty(exports2, "formatSizeKB", { enumerable: true, get: function() {
|
|
565017
565084
|
return AutoVersioningService_js_1.formatSizeKB;
|
|
565018
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
|
+
} });
|
|
565019
565093
|
var VersionUtils_js_1 = require_VersionUtils();
|
|
565020
565094
|
Object.defineProperty(exports2, "AUTO_VERSION", { enumerable: true, get: function() {
|
|
565021
565095
|
return VersionUtils_js_1.AUTO_VERSION;
|
|
@@ -566400,32 +566474,11 @@ ${body}` : `${COMMIT_MARKER} ${subject}`;
|
|
|
566400
566474
|
async prependChangelogEntry(params2) {
|
|
566401
566475
|
const { version: version7, entry } = params2;
|
|
566402
566476
|
const changelogPath = (0, path_1.join)(this.outputDir, "changelog.md");
|
|
566403
|
-
const now = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10);
|
|
566404
|
-
const header = `## [${version7}] - ${now}
|
|
566405
|
-
`;
|
|
566406
|
-
const newBlock = `${header}${entry.trim()}
|
|
566407
|
-
|
|
566408
|
-
`;
|
|
566409
566477
|
let existing = "";
|
|
566410
566478
|
if ((0, fs_1.existsSync)(changelogPath)) {
|
|
566411
566479
|
existing = await (0, promises_1.readFile)(changelogPath, "utf-8");
|
|
566412
566480
|
}
|
|
566413
|
-
|
|
566414
|
-
if (existing.trim().length === 0) {
|
|
566415
|
-
output2 = `# Changelog
|
|
566416
|
-
|
|
566417
|
-
${newBlock}`;
|
|
566418
|
-
} else if (existing.startsWith("# Changelog")) {
|
|
566419
|
-
const newlineIdx = existing.indexOf("\n");
|
|
566420
|
-
const headerLine = newlineIdx >= 0 ? existing.slice(0, newlineIdx) : existing;
|
|
566421
|
-
const remainder = (newlineIdx >= 0 ? existing.slice(newlineIdx + 1) : "").replace(/^\s*\n/, "");
|
|
566422
|
-
output2 = `${headerLine}
|
|
566423
|
-
|
|
566424
|
-
${newBlock}${remainder}`;
|
|
566425
|
-
} else {
|
|
566426
|
-
output2 = `${newBlock}${existing}`;
|
|
566427
|
-
}
|
|
566428
|
-
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");
|
|
566429
566482
|
}
|
|
566430
566483
|
brandMessage(message) {
|
|
566431
566484
|
if (this.config.isWhitelabel) {
|
|
@@ -582302,6 +582355,7 @@ var require_GithubStep = __commonJS({
|
|
|
582302
582355
|
var rest_1 = (init_dist_src9(), __toCommonJS(dist_src_exports));
|
|
582303
582356
|
var promises_1 = require("fs/promises");
|
|
582304
582357
|
var path_1 = require("path");
|
|
582358
|
+
var index_1 = require_autoversion();
|
|
582305
582359
|
var createReplayBranch_1 = require_createReplayBranch();
|
|
582306
582360
|
var findExistingUpdatablePR_1 = require_findExistingUpdatablePR();
|
|
582307
582361
|
var parseCommitMessage_1 = require_parseCommitMessage();
|
|
@@ -582643,31 +582697,38 @@ var require_GithubStep = __commonJS({
|
|
|
582643
582697
|
}
|
|
582644
582698
|
}
|
|
582645
582699
|
/**
|
|
582646
|
-
* Guarantees `changelog.md`
|
|
582647
|
-
*
|
|
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
|
|
582648
582702
|
* "See full changelog" link resolves. AutoVersionStep normally writes this file via
|
|
582649
|
-
* `prependChangelogEntry`; this
|
|
582650
|
-
* directory GithubStep commits (e.g. non-replay self-hosted generation)
|
|
582651
|
-
*
|
|
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.
|
|
582652
582707
|
*
|
|
582653
|
-
* Returns `true` when it created the file, `false` when the
|
|
582654
|
-
*
|
|
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.
|
|
582655
582710
|
*/
|
|
582656
582711
|
async ensureChangelogFile(resolved) {
|
|
582657
|
-
const entry = resolved.changelogEntry?.trim();
|
|
582658
|
-
|
|
582712
|
+
const entry = resolved.changelogEntry?.trim() ?? "";
|
|
582713
|
+
const version7 = resolved.newVersion ?? resolved.previousVersion;
|
|
582714
|
+
if (entry.length === 0 && resolved.newVersion == null) {
|
|
582659
582715
|
return false;
|
|
582660
582716
|
}
|
|
582661
582717
|
const changelogPath = (0, path_1.join)(this.outputDir, "changelog.md");
|
|
582718
|
+
let existing;
|
|
582662
582719
|
try {
|
|
582663
|
-
await (0, promises_1.
|
|
582664
|
-
return false;
|
|
582720
|
+
existing = await (0, promises_1.readFile)(changelogPath, "utf-8");
|
|
582665
582721
|
} catch {
|
|
582666
|
-
|
|
582667
|
-
|
|
582668
|
-
|
|
582669
|
-
|
|
582722
|
+
existing = void 0;
|
|
582723
|
+
}
|
|
582724
|
+
if (existing != null) {
|
|
582725
|
+
if (version7 == null || (0, index_1.changelogContainsVersion)(existing, version7)) {
|
|
582726
|
+
return false;
|
|
582727
|
+
}
|
|
582670
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;
|
|
582671
582732
|
}
|
|
582672
582733
|
deriveSkipCommit(replayResult) {
|
|
582673
582734
|
if (replayResult == null) {
|
|
@@ -610909,6 +610970,7 @@ var require_GitHub = __commonJS({
|
|
|
610909
610970
|
var fs_utils_1 = (init_lib8(), __toCommonJS(lib_exports3));
|
|
610910
610971
|
var github_1 = (init_lib11(), __toCommonJS(lib_exports4));
|
|
610911
610972
|
var rest_1 = (init_dist_src9(), __toCommonJS(dist_src_exports));
|
|
610973
|
+
var promises_1 = require("fs/promises");
|
|
610912
610974
|
var GitHub = class {
|
|
610913
610975
|
githubConfig;
|
|
610914
610976
|
constructor({ githubConfig }) {
|
|
@@ -610933,9 +610995,10 @@ var require_GitHub = __commonJS({
|
|
|
610933
610995
|
await repository.pull(branch);
|
|
610934
610996
|
}
|
|
610935
610997
|
const fernIgnoreFiles = await this.getFernignoreFiles(repository);
|
|
610998
|
+
const changelogFiles = await this.getChangelogFilesToPreserve(repository, sourceDirectory);
|
|
610936
610999
|
await repository.overwriteLocalContents(sourceDirectory);
|
|
610937
611000
|
await repository.add(".");
|
|
610938
|
-
await this.restoreFiles(repository, fernIgnoreFiles);
|
|
611001
|
+
await this.restoreFiles(repository, [...fernIgnoreFiles, ...changelogFiles]);
|
|
610939
611002
|
await repository.commit("SDK Generation");
|
|
610940
611003
|
if (isEmptyRepo) {
|
|
610941
611004
|
await repository.pushUpstream(branch);
|
|
@@ -610972,9 +611035,10 @@ var require_GitHub = __commonJS({
|
|
|
610972
611035
|
const prBranch = `fern-bot/${formattedDate}`;
|
|
610973
611036
|
await repository.checkout(prBranch);
|
|
610974
611037
|
const fernIgnoreFiles = await this.getFernignoreFiles(repository);
|
|
611038
|
+
const changelogFiles = await this.getChangelogFilesToPreserve(repository, sourceDirectory);
|
|
610975
611039
|
await repository.overwriteLocalContents(sourceDirectory);
|
|
610976
611040
|
await repository.add(".");
|
|
610977
|
-
await this.restoreFiles(repository, fernIgnoreFiles);
|
|
611041
|
+
await this.restoreFiles(repository, [...fernIgnoreFiles, ...changelogFiles]);
|
|
610978
611042
|
await repository.commit("SDK Generation");
|
|
610979
611043
|
await repository.push();
|
|
610980
611044
|
const apiBaseUrl = (0, github_1.getGithubApiBaseUrl)(this.githubConfig.uri);
|
|
@@ -611018,6 +611082,25 @@ var require_GitHub = __commonJS({
|
|
|
611018
611082
|
const tracked = await repository.listTrackedFiles();
|
|
611019
611083
|
return (0, github_1.expandFernignorePatterns)(fernignore, tracked);
|
|
611020
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
|
+
}
|
|
611021
611104
|
async restoreFiles(repository, files) {
|
|
611022
611105
|
if (files.length === 0) {
|
|
611023
611106
|
return;
|
|
@@ -622831,7 +622914,7 @@ var require_jsonfile = __commonJS({
|
|
|
622831
622914
|
const str2 = stringify5(obj, options2);
|
|
622832
622915
|
await universalify.fromCallback(fs34.writeFile)(file4, str2, options2);
|
|
622833
622916
|
}
|
|
622834
|
-
var
|
|
622917
|
+
var writeFile102 = universalify.fromPromise(_writeFile);
|
|
622835
622918
|
function writeFileSync9(file4, obj, options2 = {}) {
|
|
622836
622919
|
const fs34 = options2.fs || _fs;
|
|
622837
622920
|
const str2 = stringify5(obj, options2);
|
|
@@ -622840,7 +622923,7 @@ var require_jsonfile = __commonJS({
|
|
|
622840
622923
|
module4.exports = {
|
|
622841
622924
|
readFile: readFile120,
|
|
622842
622925
|
readFileSync: readFileSync19,
|
|
622843
|
-
writeFile:
|
|
622926
|
+
writeFile: writeFile102,
|
|
622844
622927
|
writeFileSync: writeFileSync9
|
|
622845
622928
|
};
|
|
622846
622929
|
}
|
|
@@ -689246,7 +689329,7 @@ var AccessTokenPosthogManager = class {
|
|
|
689246
689329
|
properties: {
|
|
689247
689330
|
...event,
|
|
689248
689331
|
...event.properties,
|
|
689249
|
-
version: "5.70.
|
|
689332
|
+
version: "5.70.1",
|
|
689250
689333
|
usingAccessToken: true,
|
|
689251
689334
|
...getRunIdProperties()
|
|
689252
689335
|
}
|
|
@@ -689312,7 +689395,7 @@ var UserPosthogManager = class {
|
|
|
689312
689395
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
689313
689396
|
event: "CLI",
|
|
689314
689397
|
properties: {
|
|
689315
|
-
version: "5.70.
|
|
689398
|
+
version: "5.70.1",
|
|
689316
689399
|
...event,
|
|
689317
689400
|
...event.properties,
|
|
689318
689401
|
usingAccessToken: false,
|
|
@@ -870413,7 +870496,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
870413
870496
|
var LOGS_FOLDER_NAME = "logs";
|
|
870414
870497
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
870415
870498
|
function getCliSource() {
|
|
870416
|
-
const version7 = "5.70.
|
|
870499
|
+
const version7 = "5.70.1";
|
|
870417
870500
|
return `cli@${version7}`;
|
|
870418
870501
|
}
|
|
870419
870502
|
var DebugLogger = class {
|
|
@@ -902985,7 +903068,7 @@ var LegacyDocsPublisher = class {
|
|
|
902985
903068
|
previewId,
|
|
902986
903069
|
disableTemplates: void 0,
|
|
902987
903070
|
skipUpload,
|
|
902988
|
-
cliVersion: "5.70.
|
|
903071
|
+
cliVersion: "5.70.1",
|
|
902989
903072
|
loginCommand: "fern auth login"
|
|
902990
903073
|
});
|
|
902991
903074
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -955982,6 +956065,7 @@ var LocalTaskHandler = class {
|
|
|
955982
956065
|
const isFernIgnorePresent = this.skipFernignore ? false : await this.isFernIgnorePresent();
|
|
955983
956066
|
const isExistingGitRepo = await this.isGitRepository();
|
|
955984
956067
|
const priorChangelog = this.version != null && (0, import_autoversion2.isAutoVersion)(this.version) ? await this.readPriorChangelog(3) : "";
|
|
956068
|
+
const priorChangelogFile = await this.readChangelogFile();
|
|
955985
956069
|
if (isFernIgnorePresent) {
|
|
955986
956070
|
const absolutePathToFernignore = AbsoluteFilePath2.of(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME)));
|
|
955987
956071
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
@@ -955997,6 +956081,13 @@ var LocalTaskHandler = class {
|
|
|
955997
956081
|
} else {
|
|
955998
956082
|
await this.copyGeneratedFilesNoFernIgnoreDeleteAll();
|
|
955999
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
|
+
}
|
|
956000
956091
|
if (this.absolutePathToTmpSnippetJSON != null && this.absolutePathToLocalSnippetJSON != null && await doesPathExist(this.absolutePathToTmpSnippetJSON)) {
|
|
956001
956092
|
await this.copySnippetJSON({
|
|
956002
956093
|
absolutePathToTmpSnippetJSON: this.absolutePathToTmpSnippetJSON,
|
|
@@ -956598,6 +956689,58 @@ var LocalTaskHandler = class {
|
|
|
956598
956689
|
return "";
|
|
956599
956690
|
}
|
|
956600
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
|
+
}
|
|
956601
956744
|
/**
|
|
956602
956745
|
* Reads the most recent git commit message that touched the .fern/ directory
|
|
956603
956746
|
* in the spec repo. This provides context to the AI about why the API changed.
|
|
@@ -969346,7 +969489,7 @@ function getAutomationContextFromEnv() {
|
|
|
969346
969489
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
969347
969490
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
969348
969491
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
969349
|
-
cli_version: "5.70.
|
|
969492
|
+
cli_version: "5.70.1"
|
|
969350
969493
|
};
|
|
969351
969494
|
}
|
|
969352
969495
|
function isAutomationMode() {
|
|
@@ -970178,7 +970321,7 @@ var CliContext = class _CliContext {
|
|
|
970178
970321
|
if (false) {
|
|
970179
970322
|
this.logger.error("CLI_VERSION is not defined");
|
|
970180
970323
|
}
|
|
970181
|
-
return "5.70.
|
|
970324
|
+
return "5.70.1";
|
|
970182
970325
|
}
|
|
970183
970326
|
getCliName() {
|
|
970184
970327
|
if (false) {
|
package/package.json
CHANGED