@fern-api/fern-api-dev 5.70.0 → 5.70.2
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 +225 -63
- 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);
|
|
@@ -167522,6 +167522,20 @@ function detectMultipleBaseUrls(servers1, servers2) {
|
|
|
167522
167522
|
}
|
|
167523
167523
|
return allMatch && allDifferent;
|
|
167524
167524
|
}
|
|
167525
|
+
function dedupeServers(servers) {
|
|
167526
|
+
const seen = /* @__PURE__ */ new Set();
|
|
167527
|
+
return servers.filter((server) => {
|
|
167528
|
+
if (server.type === "grouped") {
|
|
167529
|
+
return true;
|
|
167530
|
+
}
|
|
167531
|
+
const key2 = `${getEnvironmentName2(server)}\0${server.url}`;
|
|
167532
|
+
if (seen.has(key2)) {
|
|
167533
|
+
return false;
|
|
167534
|
+
}
|
|
167535
|
+
seen.add(key2);
|
|
167536
|
+
return true;
|
|
167537
|
+
});
|
|
167538
|
+
}
|
|
167525
167539
|
function getPreferredUrlForNameExtraction(server) {
|
|
167526
167540
|
return server.defaultUrl ?? server.url;
|
|
167527
167541
|
}
|
|
@@ -167737,7 +167751,7 @@ function merge6(ir1, ir22, options2) {
|
|
|
167737
167751
|
description: ir1.description ?? ir22.description,
|
|
167738
167752
|
basePath: ir1.basePath ?? ir22.basePath,
|
|
167739
167753
|
basePathParameters: ir1.basePathParameters ?? ir22.basePathParameters,
|
|
167740
|
-
servers: [...ir1.servers, ...ir22.servers],
|
|
167754
|
+
servers: dedupeServers([...ir1.servers, ...ir22.servers]),
|
|
167741
167755
|
websocketServers: [...ir1.websocketServers, ...ir22.websocketServers],
|
|
167742
167756
|
tags: {
|
|
167743
167757
|
tagsById: {
|
|
@@ -457164,13 +457178,13 @@ async function removeInvalidAiExamples({ sourceFilePath, context: context3 }) {
|
|
|
457164
457178
|
}
|
|
457165
457179
|
}
|
|
457166
457180
|
}
|
|
457167
|
-
const { writeFile:
|
|
457181
|
+
const { writeFile: writeFile102 } = await import("fs/promises");
|
|
457168
457182
|
const yamlContent = index_vite_proxy_tmp_default.dump(parsed, {
|
|
457169
457183
|
indent: 2,
|
|
457170
457184
|
lineWidth: -1,
|
|
457171
457185
|
noRefs: true
|
|
457172
457186
|
});
|
|
457173
|
-
await
|
|
457187
|
+
await writeFile102(overrideFilePath, yamlContent, "utf-8");
|
|
457174
457188
|
context3.logger.info(`Removed ${validationResult.invalidCount} invalid AI examples from ai_examples_override.yml`);
|
|
457175
457189
|
return {
|
|
457176
457190
|
removedCount: validationResult.invalidCount,
|
|
@@ -480472,8 +480486,8 @@ var require_graceful_fs2 = __commonJS({
|
|
|
480472
480486
|
}
|
|
480473
480487
|
}
|
|
480474
480488
|
var fs$writeFile = fs35.writeFile;
|
|
480475
|
-
fs35.writeFile =
|
|
480476
|
-
function
|
|
480489
|
+
fs35.writeFile = writeFile102;
|
|
480490
|
+
function writeFile102(path120, data2, options2, cb) {
|
|
480477
480491
|
if (typeof options2 === "function")
|
|
480478
480492
|
cb = options2, options2 = null;
|
|
480479
480493
|
return go$writeFile(path120, data2, options2, cb);
|
|
@@ -564690,7 +564704,8 @@ var require_AutoVersioningService = __commonJS({
|
|
|
564690
564704
|
}
|
|
564691
564705
|
await this.addSuffixToGoMod(goModPath, modulePath, suffix);
|
|
564692
564706
|
await this.addSuffixToGoFiles(workingDirectory, modulePath, suffix);
|
|
564693
|
-
this.
|
|
564707
|
+
await this.addSuffixToMarkdownFiles(workingDirectory, modulePath, suffix);
|
|
564708
|
+
this.logger.info(`Added ${suffix} to Go module path ${modulePath} across imports, headers, and docs`);
|
|
564694
564709
|
}
|
|
564695
564710
|
/**
|
|
564696
564711
|
* Extracts the major version number from a version string.
|
|
@@ -564771,15 +564786,16 @@ var require_AutoVersioningService = __commonJS({
|
|
|
564771
564786
|
return results;
|
|
564772
564787
|
}
|
|
564773
564788
|
/**
|
|
564774
|
-
* Adds a version suffix to import paths
|
|
564789
|
+
* Adds a version suffix to import paths and embedded module-path string
|
|
564790
|
+
* literals (e.g. the X-Fern-SDK-Name header value) in all .go files.
|
|
564775
564791
|
*/
|
|
564776
564792
|
async addSuffixToGoFiles(repoRoot, modulePath, suffix) {
|
|
564777
564793
|
const goFiles = await this.walkDirectory(repoRoot, (filePath) => (0, path_1.extname)(filePath) === ".go");
|
|
564778
564794
|
await this.processInParallel(goFiles, (filePath) => this.addSuffixToGoFile(filePath, modulePath, suffix));
|
|
564779
564795
|
}
|
|
564780
564796
|
/**
|
|
564781
|
-
* Adds a version suffix to import paths
|
|
564782
|
-
*
|
|
564797
|
+
* Adds a version suffix to import paths and embedded module-path string
|
|
564798
|
+
* literals in a single .go file.
|
|
564783
564799
|
*/
|
|
564784
564800
|
async addSuffixToGoFile(filePath, modulePath, suffix) {
|
|
564785
564801
|
const content5 = await (0, promises_1.readFile)(filePath, "utf-8");
|
|
@@ -564798,13 +564814,10 @@ var require_AutoVersioningService = __commonJS({
|
|
|
564798
564814
|
inImportBlock = false;
|
|
564799
564815
|
}
|
|
564800
564816
|
const isImportLine = inImportBlock || trimmed2.startsWith('import "') || trimmed2.startsWith('import "') || /^import\s+\w+\s+"/.test(trimmed2);
|
|
564801
|
-
if (!isImportLine) {
|
|
564802
|
-
continue;
|
|
564803
|
-
}
|
|
564804
564817
|
if (!line.includes(modulePath)) {
|
|
564805
564818
|
continue;
|
|
564806
564819
|
}
|
|
564807
|
-
const newLine = line.
|
|
564820
|
+
const newLine = isImportLine ? line.split(`"${modulePath}/`).join(`"${modulePath}${suffix}/`).split(`"${modulePath}"`).join(`"${modulePath}${suffix}"`) : line.split(`"${modulePath}"`).join(`"${modulePath}${suffix}"`);
|
|
564808
564821
|
if (newLine !== line) {
|
|
564809
564822
|
lines[i5] = newLine;
|
|
564810
564823
|
changed = true;
|
|
@@ -564815,6 +564828,36 @@ var require_AutoVersioningService = __commonJS({
|
|
|
564815
564828
|
this.logger.debug(`Updated Go imports in ${filePath}`);
|
|
564816
564829
|
}
|
|
564817
564830
|
}
|
|
564831
|
+
/**
|
|
564832
|
+
* Adds a version suffix to Go module references in all Markdown files
|
|
564833
|
+
* (e.g. README.md) in the repository, so documented install commands and
|
|
564834
|
+
* import samples resolve to the correct /vN module path when copy-pasted.
|
|
564835
|
+
*/
|
|
564836
|
+
async addSuffixToMarkdownFiles(repoRoot, modulePath, suffix) {
|
|
564837
|
+
const markdownFiles = await this.walkDirectory(repoRoot, (filePath) => (0, path_1.extname)(filePath).toLowerCase() === ".md");
|
|
564838
|
+
await this.processInParallel(markdownFiles, (filePath) => this.addSuffixToMarkdownFile(filePath, modulePath, suffix));
|
|
564839
|
+
}
|
|
564840
|
+
/**
|
|
564841
|
+
* Adds a version suffix to Go module references in a single Markdown file.
|
|
564842
|
+
* Rewrites `go get`/`go install` install commands and quoted import paths in
|
|
564843
|
+
* code samples. Web URLs (e.g. `https://pkg.go.dev/<modulePath>`) are left
|
|
564844
|
+
* untouched because the module path there is neither quote-anchored nor
|
|
564845
|
+
* preceded by an install command.
|
|
564846
|
+
*/
|
|
564847
|
+
async addSuffixToMarkdownFile(filePath, modulePath, suffix) {
|
|
564848
|
+
const content5 = await (0, promises_1.readFile)(filePath, "utf-8");
|
|
564849
|
+
if (!content5.includes(modulePath)) {
|
|
564850
|
+
return;
|
|
564851
|
+
}
|
|
564852
|
+
let updated = content5.split(`"${modulePath}/`).join(`"${modulePath}${suffix}/`).split(`"${modulePath}"`).join(`"${modulePath}${suffix}"`);
|
|
564853
|
+
const escapedModulePath = modulePath.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
564854
|
+
const installCommandPattern = new RegExp(`(go (?:get|install)(?:\\s+-\\S+)*\\s+)${escapedModulePath}(?![\\w./-])`, "g");
|
|
564855
|
+
updated = updated.replace(installCommandPattern, `$1${modulePath}${suffix}`);
|
|
564856
|
+
if (updated !== content5) {
|
|
564857
|
+
await (0, promises_1.writeFile)(filePath, updated, "utf-8");
|
|
564858
|
+
this.logger.debug(`Updated Go module path in ${filePath}`);
|
|
564859
|
+
}
|
|
564860
|
+
}
|
|
564818
564861
|
/**
|
|
564819
564862
|
* Extracts the file path from a diff file section.
|
|
564820
564863
|
* Parses the "diff --git a/path b/path" header line.
|
|
@@ -564860,6 +564903,44 @@ var require_AutoVersioningService = __commonJS({
|
|
|
564860
564903
|
}
|
|
564861
564904
|
});
|
|
564862
564905
|
|
|
564906
|
+
// ../../generator-cli/lib/autoversion/changelogUtils.js
|
|
564907
|
+
var require_changelogUtils = __commonJS({
|
|
564908
|
+
"../../generator-cli/lib/autoversion/changelogUtils.js"(exports2) {
|
|
564909
|
+
"use strict";
|
|
564910
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
564911
|
+
exports2.prependChangelogBlock = prependChangelogBlock2;
|
|
564912
|
+
exports2.changelogContainsVersion = changelogContainsVersion2;
|
|
564913
|
+
function prependChangelogBlock2({ existingContent, version: version7, entry, date: date26 = (/* @__PURE__ */ new Date()).toISOString().slice(0, 10) }) {
|
|
564914
|
+
const header = version7 != null ? `## [${version7}] - ${date26}
|
|
564915
|
+
` : `## ${date26}
|
|
564916
|
+
`;
|
|
564917
|
+
const trimmedEntry = entry.trim();
|
|
564918
|
+
const newBlock = trimmedEntry.length > 0 ? `${header}${trimmedEntry}
|
|
564919
|
+
|
|
564920
|
+
` : `${header}
|
|
564921
|
+
`;
|
|
564922
|
+
if (existingContent.trim().length === 0) {
|
|
564923
|
+
return `# Changelog
|
|
564924
|
+
|
|
564925
|
+
${newBlock}`;
|
|
564926
|
+
}
|
|
564927
|
+
if (existingContent.startsWith("# Changelog")) {
|
|
564928
|
+
const newlineIdx = existingContent.indexOf("\n");
|
|
564929
|
+
const headerLine = newlineIdx >= 0 ? existingContent.slice(0, newlineIdx) : existingContent;
|
|
564930
|
+
const remainder = (newlineIdx >= 0 ? existingContent.slice(newlineIdx + 1) : "").replace(/^\s*\n/, "");
|
|
564931
|
+
return `${headerLine}
|
|
564932
|
+
|
|
564933
|
+
${newBlock}${remainder}`;
|
|
564934
|
+
}
|
|
564935
|
+
return `${newBlock}${existingContent}`;
|
|
564936
|
+
}
|
|
564937
|
+
function changelogContainsVersion2(content5, version7) {
|
|
564938
|
+
const escaped = version7.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
564939
|
+
return new RegExp(`^## \\[${escaped}\\]`, "m").test(content5);
|
|
564940
|
+
}
|
|
564941
|
+
}
|
|
564942
|
+
});
|
|
564943
|
+
|
|
564863
564944
|
// ../../generator-cli/lib/autoversion/VersionUtils.js
|
|
564864
564945
|
var require_VersionUtils = __commonJS({
|
|
564865
564946
|
"../../generator-cli/lib/autoversion/VersionUtils.js"(exports2) {
|
|
@@ -564998,7 +565079,7 @@ var require_autoversion = __commonJS({
|
|
|
564998
565079
|
"../../generator-cli/lib/autoversion/index.js"(exports2) {
|
|
564999
565080
|
"use strict";
|
|
565000
565081
|
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;
|
|
565082
|
+
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
565083
|
var AutoVersioningCache_js_1 = require_AutoVersioningCache();
|
|
565003
565084
|
Object.defineProperty(exports2, "AutoVersioningCache", { enumerable: true, get: function() {
|
|
565004
565085
|
return AutoVersioningCache_js_1.AutoVersioningCache;
|
|
@@ -565016,6 +565097,13 @@ var require_autoversion = __commonJS({
|
|
|
565016
565097
|
Object.defineProperty(exports2, "formatSizeKB", { enumerable: true, get: function() {
|
|
565017
565098
|
return AutoVersioningService_js_1.formatSizeKB;
|
|
565018
565099
|
} });
|
|
565100
|
+
var changelogUtils_js_1 = require_changelogUtils();
|
|
565101
|
+
Object.defineProperty(exports2, "changelogContainsVersion", { enumerable: true, get: function() {
|
|
565102
|
+
return changelogUtils_js_1.changelogContainsVersion;
|
|
565103
|
+
} });
|
|
565104
|
+
Object.defineProperty(exports2, "prependChangelogBlock", { enumerable: true, get: function() {
|
|
565105
|
+
return changelogUtils_js_1.prependChangelogBlock;
|
|
565106
|
+
} });
|
|
565019
565107
|
var VersionUtils_js_1 = require_VersionUtils();
|
|
565020
565108
|
Object.defineProperty(exports2, "AUTO_VERSION", { enumerable: true, get: function() {
|
|
565021
565109
|
return VersionUtils_js_1.AUTO_VERSION;
|
|
@@ -566400,32 +566488,11 @@ ${body}` : `${COMMIT_MARKER} ${subject}`;
|
|
|
566400
566488
|
async prependChangelogEntry(params2) {
|
|
566401
566489
|
const { version: version7, entry } = params2;
|
|
566402
566490
|
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
566491
|
let existing = "";
|
|
566410
566492
|
if ((0, fs_1.existsSync)(changelogPath)) {
|
|
566411
566493
|
existing = await (0, promises_1.readFile)(changelogPath, "utf-8");
|
|
566412
566494
|
}
|
|
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");
|
|
566495
|
+
await (0, promises_1.writeFile)(changelogPath, (0, index_1.prependChangelogBlock)({ existingContent: existing, version: version7, entry }), "utf-8");
|
|
566429
566496
|
}
|
|
566430
566497
|
brandMessage(message) {
|
|
566431
566498
|
if (this.config.isWhitelabel) {
|
|
@@ -582302,6 +582369,7 @@ var require_GithubStep = __commonJS({
|
|
|
582302
582369
|
var rest_1 = (init_dist_src9(), __toCommonJS(dist_src_exports));
|
|
582303
582370
|
var promises_1 = require("fs/promises");
|
|
582304
582371
|
var path_1 = require("path");
|
|
582372
|
+
var index_1 = require_autoversion();
|
|
582305
582373
|
var createReplayBranch_1 = require_createReplayBranch();
|
|
582306
582374
|
var findExistingUpdatablePR_1 = require_findExistingUpdatablePR();
|
|
582307
582375
|
var parseCommitMessage_1 = require_parseCommitMessage();
|
|
@@ -582643,31 +582711,38 @@ var require_GithubStep = __commonJS({
|
|
|
582643
582711
|
}
|
|
582644
582712
|
}
|
|
582645
582713
|
/**
|
|
582646
|
-
* Guarantees `changelog.md`
|
|
582647
|
-
*
|
|
582714
|
+
* Guarantees `changelog.md` records this run whenever there is a changelog entry or a
|
|
582715
|
+
* resolved version, so the file lands in the committed tree that GithubStep pushes and the
|
|
582648
582716
|
* "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
|
-
*
|
|
582717
|
+
* `prependChangelogEntry`; this covers the paths where that write never reached the
|
|
582718
|
+
* directory GithubStep commits (e.g. non-replay self-hosted generation) and explicitly
|
|
582719
|
+
* versioned runs (`--version X.Y.Z`), which record a version-only entry with an empty
|
|
582720
|
+
* description. Existing entries are always preserved — the new block is prepended.
|
|
582652
582721
|
*
|
|
582653
|
-
* Returns `true` when it created the file, `false` when the
|
|
582654
|
-
*
|
|
582722
|
+
* Returns `true` when it created or modified the file, `false` when the version's entry was
|
|
582723
|
+
* already recorded (e.g. by AutoVersionStep) or there is nothing to write.
|
|
582655
582724
|
*/
|
|
582656
582725
|
async ensureChangelogFile(resolved) {
|
|
582657
|
-
const entry = resolved.changelogEntry?.trim();
|
|
582658
|
-
|
|
582726
|
+
const entry = resolved.changelogEntry?.trim() ?? "";
|
|
582727
|
+
const version7 = resolved.newVersion ?? resolved.previousVersion;
|
|
582728
|
+
if (entry.length === 0 && resolved.newVersion == null) {
|
|
582659
582729
|
return false;
|
|
582660
582730
|
}
|
|
582661
582731
|
const changelogPath = (0, path_1.join)(this.outputDir, "changelog.md");
|
|
582732
|
+
let existing;
|
|
582662
582733
|
try {
|
|
582663
|
-
await (0, promises_1.
|
|
582664
|
-
return false;
|
|
582734
|
+
existing = await (0, promises_1.readFile)(changelogPath, "utf-8");
|
|
582665
582735
|
} catch {
|
|
582666
|
-
|
|
582667
|
-
|
|
582668
|
-
|
|
582669
|
-
|
|
582736
|
+
existing = void 0;
|
|
582737
|
+
}
|
|
582738
|
+
if (existing != null) {
|
|
582739
|
+
if (version7 == null || (0, index_1.changelogContainsVersion)(existing, version7)) {
|
|
582740
|
+
return false;
|
|
582741
|
+
}
|
|
582670
582742
|
}
|
|
582743
|
+
await (0, promises_1.writeFile)(changelogPath, (0, index_1.prependChangelogBlock)({ existingContent: existing ?? "", version: version7, entry }), "utf-8");
|
|
582744
|
+
this.logger.debug(`Wrote changelog.md${version7 != null ? ` for ${version7}` : ""}.`);
|
|
582745
|
+
return true;
|
|
582671
582746
|
}
|
|
582672
582747
|
deriveSkipCommit(replayResult) {
|
|
582673
582748
|
if (replayResult == null) {
|
|
@@ -610909,6 +610984,7 @@ var require_GitHub = __commonJS({
|
|
|
610909
610984
|
var fs_utils_1 = (init_lib8(), __toCommonJS(lib_exports3));
|
|
610910
610985
|
var github_1 = (init_lib11(), __toCommonJS(lib_exports4));
|
|
610911
610986
|
var rest_1 = (init_dist_src9(), __toCommonJS(dist_src_exports));
|
|
610987
|
+
var promises_1 = require("fs/promises");
|
|
610912
610988
|
var GitHub = class {
|
|
610913
610989
|
githubConfig;
|
|
610914
610990
|
constructor({ githubConfig }) {
|
|
@@ -610933,9 +611009,10 @@ var require_GitHub = __commonJS({
|
|
|
610933
611009
|
await repository.pull(branch);
|
|
610934
611010
|
}
|
|
610935
611011
|
const fernIgnoreFiles = await this.getFernignoreFiles(repository);
|
|
611012
|
+
const changelogFiles = await this.getChangelogFilesToPreserve(repository, sourceDirectory);
|
|
610936
611013
|
await repository.overwriteLocalContents(sourceDirectory);
|
|
610937
611014
|
await repository.add(".");
|
|
610938
|
-
await this.restoreFiles(repository, fernIgnoreFiles);
|
|
611015
|
+
await this.restoreFiles(repository, [...fernIgnoreFiles, ...changelogFiles]);
|
|
610939
611016
|
await repository.commit("SDK Generation");
|
|
610940
611017
|
if (isEmptyRepo) {
|
|
610941
611018
|
await repository.pushUpstream(branch);
|
|
@@ -610972,9 +611049,10 @@ var require_GitHub = __commonJS({
|
|
|
610972
611049
|
const prBranch = `fern-bot/${formattedDate}`;
|
|
610973
611050
|
await repository.checkout(prBranch);
|
|
610974
611051
|
const fernIgnoreFiles = await this.getFernignoreFiles(repository);
|
|
611052
|
+
const changelogFiles = await this.getChangelogFilesToPreserve(repository, sourceDirectory);
|
|
610975
611053
|
await repository.overwriteLocalContents(sourceDirectory);
|
|
610976
611054
|
await repository.add(".");
|
|
610977
|
-
await this.restoreFiles(repository, fernIgnoreFiles);
|
|
611055
|
+
await this.restoreFiles(repository, [...fernIgnoreFiles, ...changelogFiles]);
|
|
610978
611056
|
await repository.commit("SDK Generation");
|
|
610979
611057
|
await repository.push();
|
|
610980
611058
|
const apiBaseUrl = (0, github_1.getGithubApiBaseUrl)(this.githubConfig.uri);
|
|
@@ -611018,6 +611096,25 @@ var require_GitHub = __commonJS({
|
|
|
611018
611096
|
const tracked = await repository.listTrackedFiles();
|
|
611019
611097
|
return (0, github_1.expandFernignorePatterns)(fernignore, tracked);
|
|
611020
611098
|
}
|
|
611099
|
+
/**
|
|
611100
|
+
* Returns tracked changelog files (e.g. `changelog.md`) that should be restored after
|
|
611101
|
+
* `overwriteLocalContents`, so existing changelog entries are never wiped when the
|
|
611102
|
+
* generated output doesn't include a changelog of its own.
|
|
611103
|
+
*/
|
|
611104
|
+
async getChangelogFilesToPreserve(repository, sourceDirectory) {
|
|
611105
|
+
const tracked = await repository.listTrackedFiles();
|
|
611106
|
+
const trackedChangelogs = tracked.filter((file4) => file4.toLowerCase() === "changelog.md");
|
|
611107
|
+
if (trackedChangelogs.length === 0) {
|
|
611108
|
+
return [];
|
|
611109
|
+
}
|
|
611110
|
+
try {
|
|
611111
|
+
const sourceFiles = await (0, promises_1.readdir)(sourceDirectory);
|
|
611112
|
+
const sourceHasChangelog = sourceFiles.some((file4) => file4.toLowerCase() === "changelog.md");
|
|
611113
|
+
return sourceHasChangelog ? [] : trackedChangelogs;
|
|
611114
|
+
} catch {
|
|
611115
|
+
return trackedChangelogs;
|
|
611116
|
+
}
|
|
611117
|
+
}
|
|
611021
611118
|
async restoreFiles(repository, files) {
|
|
611022
611119
|
if (files.length === 0) {
|
|
611023
611120
|
return;
|
|
@@ -622831,7 +622928,7 @@ var require_jsonfile = __commonJS({
|
|
|
622831
622928
|
const str2 = stringify5(obj, options2);
|
|
622832
622929
|
await universalify.fromCallback(fs34.writeFile)(file4, str2, options2);
|
|
622833
622930
|
}
|
|
622834
|
-
var
|
|
622931
|
+
var writeFile102 = universalify.fromPromise(_writeFile);
|
|
622835
622932
|
function writeFileSync9(file4, obj, options2 = {}) {
|
|
622836
622933
|
const fs34 = options2.fs || _fs;
|
|
622837
622934
|
const str2 = stringify5(obj, options2);
|
|
@@ -622840,7 +622937,7 @@ var require_jsonfile = __commonJS({
|
|
|
622840
622937
|
module4.exports = {
|
|
622841
622938
|
readFile: readFile120,
|
|
622842
622939
|
readFileSync: readFileSync19,
|
|
622843
|
-
writeFile:
|
|
622940
|
+
writeFile: writeFile102,
|
|
622844
622941
|
writeFileSync: writeFileSync9
|
|
622845
622942
|
};
|
|
622846
622943
|
}
|
|
@@ -689246,7 +689343,7 @@ var AccessTokenPosthogManager = class {
|
|
|
689246
689343
|
properties: {
|
|
689247
689344
|
...event,
|
|
689248
689345
|
...event.properties,
|
|
689249
|
-
version: "5.70.
|
|
689346
|
+
version: "5.70.2",
|
|
689250
689347
|
usingAccessToken: true,
|
|
689251
689348
|
...getRunIdProperties()
|
|
689252
689349
|
}
|
|
@@ -689312,7 +689409,7 @@ var UserPosthogManager = class {
|
|
|
689312
689409
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
689313
689410
|
event: "CLI",
|
|
689314
689411
|
properties: {
|
|
689315
|
-
version: "5.70.
|
|
689412
|
+
version: "5.70.2",
|
|
689316
689413
|
...event,
|
|
689317
689414
|
...event.properties,
|
|
689318
689415
|
usingAccessToken: false,
|
|
@@ -870413,7 +870510,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
870413
870510
|
var LOGS_FOLDER_NAME = "logs";
|
|
870414
870511
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
870415
870512
|
function getCliSource() {
|
|
870416
|
-
const version7 = "5.70.
|
|
870513
|
+
const version7 = "5.70.2";
|
|
870417
870514
|
return `cli@${version7}`;
|
|
870418
870515
|
}
|
|
870419
870516
|
var DebugLogger = class {
|
|
@@ -902985,7 +903082,7 @@ var LegacyDocsPublisher = class {
|
|
|
902985
903082
|
previewId,
|
|
902986
903083
|
disableTemplates: void 0,
|
|
902987
903084
|
skipUpload,
|
|
902988
|
-
cliVersion: "5.70.
|
|
903085
|
+
cliVersion: "5.70.2",
|
|
902989
903086
|
loginCommand: "fern auth login"
|
|
902990
903087
|
});
|
|
902991
903088
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
@@ -922875,6 +922972,11 @@ var Generation = class {
|
|
|
922875
922972
|
multipartMethodNameForCollection: "AddFileParameterParts",
|
|
922876
922973
|
isReferenceType: true
|
|
922877
922974
|
}),
|
|
922975
|
+
/** Factory for the default HttpClient with automatic response decompression */
|
|
922976
|
+
DefaultHttpClientFactory: () => this.csharp.classReference({
|
|
922977
|
+
namespace: this.namespaces.core,
|
|
922978
|
+
origin: this.model.staticExplicit("DefaultHttpClientFactory")
|
|
922979
|
+
}),
|
|
922878
922980
|
/** HTTP header management utilities */
|
|
922879
922981
|
Headers: () => this.csharp.classReference({
|
|
922880
922982
|
namespace: this.namespaces.core,
|
|
@@ -955982,6 +956084,7 @@ var LocalTaskHandler = class {
|
|
|
955982
956084
|
const isFernIgnorePresent = this.skipFernignore ? false : await this.isFernIgnorePresent();
|
|
955983
956085
|
const isExistingGitRepo = await this.isGitRepository();
|
|
955984
956086
|
const priorChangelog = this.version != null && (0, import_autoversion2.isAutoVersion)(this.version) ? await this.readPriorChangelog(3) : "";
|
|
956087
|
+
const priorChangelogFile = await this.readChangelogFile();
|
|
955985
956088
|
if (isFernIgnorePresent) {
|
|
955986
956089
|
const absolutePathToFernignore = AbsoluteFilePath2.of(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(FERNIGNORE_FILENAME)));
|
|
955987
956090
|
const fernIgnorePaths = await getFernIgnorePaths({ absolutePathToFernignore });
|
|
@@ -955997,6 +956100,13 @@ var LocalTaskHandler = class {
|
|
|
955997
956100
|
} else {
|
|
955998
956101
|
await this.copyGeneratedFilesNoFernIgnoreDeleteAll();
|
|
955999
956102
|
}
|
|
956103
|
+
await this.restoreChangelogFile(priorChangelogFile);
|
|
956104
|
+
if (this.version != null && !(0, import_autoversion2.isAutoVersion)(this.version)) {
|
|
956105
|
+
await this.prependExplicitVersionChangelogEntry({
|
|
956106
|
+
version: this.version,
|
|
956107
|
+
createIfMissing: isExistingGitRepo
|
|
956108
|
+
});
|
|
956109
|
+
}
|
|
956000
956110
|
if (this.absolutePathToTmpSnippetJSON != null && this.absolutePathToLocalSnippetJSON != null && await doesPathExist(this.absolutePathToTmpSnippetJSON)) {
|
|
956001
956111
|
await this.copySnippetJSON({
|
|
956002
956112
|
absolutePathToTmpSnippetJSON: this.absolutePathToTmpSnippetJSON,
|
|
@@ -956598,6 +956708,58 @@ var LocalTaskHandler = class {
|
|
|
956598
956708
|
return "";
|
|
956599
956709
|
}
|
|
956600
956710
|
}
|
|
956711
|
+
/**
|
|
956712
|
+
* Reads the full contents of the changelog file (case-insensitive `changelog.md`)
|
|
956713
|
+
* in the output directory. Returns undefined when no changelog file exists.
|
|
956714
|
+
*/
|
|
956715
|
+
async readChangelogFile() {
|
|
956716
|
+
try {
|
|
956717
|
+
const files = await (0, import_promises137.readdir)(this.absolutePathToLocalOutput);
|
|
956718
|
+
const filename = files.find((f3) => f3.toLowerCase() === "changelog.md");
|
|
956719
|
+
if (filename == null) {
|
|
956720
|
+
return void 0;
|
|
956721
|
+
}
|
|
956722
|
+
const content5 = await (0, import_promises137.readFile)(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(filename)), "utf-8");
|
|
956723
|
+
return { filename, content: content5 };
|
|
956724
|
+
} catch (error50) {
|
|
956725
|
+
this.context.logger.debug(`Failed to read changelog file: ${error50}`);
|
|
956726
|
+
return void 0;
|
|
956727
|
+
}
|
|
956728
|
+
}
|
|
956729
|
+
/**
|
|
956730
|
+
* Restores the changelog file captured before the copy operations if those
|
|
956731
|
+
* operations removed it (generators don't emit changelog.md, so a plain copy
|
|
956732
|
+
* would silently drop all prior entries).
|
|
956733
|
+
*/
|
|
956734
|
+
async restoreChangelogFile(prior) {
|
|
956735
|
+
if (prior == null) {
|
|
956736
|
+
return;
|
|
956737
|
+
}
|
|
956738
|
+
const current3 = await this.readChangelogFile();
|
|
956739
|
+
if (current3 != null) {
|
|
956740
|
+
return;
|
|
956741
|
+
}
|
|
956742
|
+
await (0, import_promises137.writeFile)(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(prior.filename)), prior.content);
|
|
956743
|
+
this.context.logger.debug(`Restored ${prior.filename} removed during generation.`);
|
|
956744
|
+
}
|
|
956745
|
+
/**
|
|
956746
|
+
* Prepends a version-only changelog entry (version header, empty description) for an
|
|
956747
|
+
* explicitly pinned version. Skips when the version is already recorded. When no
|
|
956748
|
+
* changelog file exists, one is created only if `createIfMissing` is set (SDK repos) —
|
|
956749
|
+
* plain local filesystem outputs are left untouched.
|
|
956750
|
+
*/
|
|
956751
|
+
async prependExplicitVersionChangelogEntry({ version: version7, createIfMissing }) {
|
|
956752
|
+
const existing = await this.readChangelogFile();
|
|
956753
|
+
if (existing == null && !createIfMissing) {
|
|
956754
|
+
return;
|
|
956755
|
+
}
|
|
956756
|
+
if (existing != null && (0, import_autoversion2.changelogContainsVersion)(existing.content, version7)) {
|
|
956757
|
+
return;
|
|
956758
|
+
}
|
|
956759
|
+
const filename = existing?.filename ?? "changelog.md";
|
|
956760
|
+
await (0, import_promises137.writeFile)(join8(this.absolutePathToLocalOutput, RelativeFilePath2.of(filename)), (0, import_autoversion2.prependChangelogBlock)({ existingContent: existing?.content ?? "", version: version7, entry: "" }));
|
|
956761
|
+
this.context.logger.debug(`Recorded version ${version7} in ${filename}.`);
|
|
956762
|
+
}
|
|
956601
956763
|
/**
|
|
956602
956764
|
* Reads the most recent git commit message that touched the .fern/ directory
|
|
956603
956765
|
* in the spec repo. This provides context to the AI about why the API changed.
|
|
@@ -969346,7 +969508,7 @@ function getAutomationContextFromEnv() {
|
|
|
969346
969508
|
config_branch: process.env.FERN_CONFIG_BRANCH,
|
|
969347
969509
|
config_pr_number: process.env.FERN_CONFIG_PR_NUMBER,
|
|
969348
969510
|
trigger: process.env.GITHUB_EVENT_NAME,
|
|
969349
|
-
cli_version: "5.70.
|
|
969511
|
+
cli_version: "5.70.2"
|
|
969350
969512
|
};
|
|
969351
969513
|
}
|
|
969352
969514
|
function isAutomationMode() {
|
|
@@ -970178,7 +970340,7 @@ var CliContext = class _CliContext {
|
|
|
970178
970340
|
if (false) {
|
|
970179
970341
|
this.logger.error("CLI_VERSION is not defined");
|
|
970180
970342
|
}
|
|
970181
|
-
return "5.70.
|
|
970343
|
+
return "5.70.2";
|
|
970182
970344
|
}
|
|
970183
970345
|
getCliName() {
|
|
970184
970346
|
if (false) {
|
package/package.json
CHANGED