@fern-api/fern-api-dev 4.65.0 → 4.65.1-2-g1c055b8c2af
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 +482 -131
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -363097,9 +363097,9 @@ var require_diff3 = __commonJS({
|
|
|
363097
363097
|
}
|
|
363098
363098
|
});
|
|
363099
363099
|
|
|
363100
|
-
// ../../../node_modules/.pnpm/@fern-api+replay@0.
|
|
363100
|
+
// ../../../node_modules/.pnpm/@fern-api+replay@0.10.1/node_modules/@fern-api/replay/dist/index.cjs
|
|
363101
363101
|
var require_dist14 = __commonJS({
|
|
363102
|
-
"../../../node_modules/.pnpm/@fern-api+replay@0.
|
|
363102
|
+
"../../../node_modules/.pnpm/@fern-api+replay@0.10.1/node_modules/@fern-api/replay/dist/index.cjs"(exports2, module4) {
|
|
363103
363103
|
"use strict";
|
|
363104
363104
|
var __defProp4 = Object.defineProperty;
|
|
363105
363105
|
var __getOwnPropDesc4 = Object.getOwnPropertyDescriptor;
|
|
@@ -363496,6 +363496,7 @@ var require_dist14 = __commonJS({
|
|
|
363496
363496
|
FernignoreMigrator: () => FernignoreMigrator,
|
|
363497
363497
|
GitClient: () => GitClient2,
|
|
363498
363498
|
LockfileManager: () => LockfileManager,
|
|
363499
|
+
LockfileNotFoundError: () => LockfileNotFoundError,
|
|
363499
363500
|
ReplayApplicator: () => ReplayApplicator,
|
|
363500
363501
|
ReplayCommitter: () => ReplayCommitter,
|
|
363501
363502
|
ReplayDetector: () => ReplayDetector,
|
|
@@ -363545,6 +363546,12 @@ var require_dist14 = __commonJS({
|
|
|
363545
363546
|
var import_node_path41 = require("path");
|
|
363546
363547
|
var import_yaml18 = require_dist9();
|
|
363547
363548
|
var LOCKFILE_HEADER = "# DO NOT EDIT MANUALLY - Managed by Fern Replay\n";
|
|
363549
|
+
var LockfileNotFoundError = class extends Error {
|
|
363550
|
+
constructor(path98) {
|
|
363551
|
+
super(`Lockfile not found: ${path98}`);
|
|
363552
|
+
this.name = "LockfileNotFoundError";
|
|
363553
|
+
}
|
|
363554
|
+
};
|
|
363548
363555
|
var LockfileManager = class {
|
|
363549
363556
|
outputDir;
|
|
363550
363557
|
lock = null;
|
|
@@ -363564,12 +363571,16 @@ var require_dist14 = __commonJS({
|
|
|
363564
363571
|
if (this.lock) {
|
|
363565
363572
|
return this.lock;
|
|
363566
363573
|
}
|
|
363567
|
-
|
|
363568
|
-
|
|
363574
|
+
try {
|
|
363575
|
+
const content5 = (0, import_node_fs32.readFileSync)(this.lockfilePath, "utf-8");
|
|
363576
|
+
this.lock = (0, import_yaml18.parse)(content5);
|
|
363577
|
+
return this.lock;
|
|
363578
|
+
} catch (error50) {
|
|
363579
|
+
if (error50 instanceof Error && "code" in error50 && error50.code === "ENOENT") {
|
|
363580
|
+
throw new LockfileNotFoundError(this.lockfilePath);
|
|
363581
|
+
}
|
|
363582
|
+
throw error50;
|
|
363569
363583
|
}
|
|
363570
|
-
const content5 = (0, import_node_fs32.readFileSync)(this.lockfilePath, "utf-8");
|
|
363571
|
-
this.lock = (0, import_yaml18.parse)(content5);
|
|
363572
|
-
return this.lock;
|
|
363573
363584
|
}
|
|
363574
363585
|
initialize(firstGeneration) {
|
|
363575
363586
|
this.initializeInMemory(firstGeneration);
|
|
@@ -363713,13 +363724,21 @@ var require_dist14 = __commonJS({
|
|
|
363713
363724
|
const exists2 = await this.git.commitExists(lastGen.commit_sha);
|
|
363714
363725
|
if (!exists2) {
|
|
363715
363726
|
this.warnings.push(
|
|
363716
|
-
`Generation commit ${lastGen.commit_sha.slice(0, 7)} not found in git history.
|
|
363727
|
+
`Generation commit ${lastGen.commit_sha.slice(0, 7)} not found in git history. Falling back to alternate detection.`
|
|
363728
|
+
);
|
|
363729
|
+
return this.detectPatchesViaTreeDiff(
|
|
363730
|
+
lastGen,
|
|
363731
|
+
/* commitKnownMissing */
|
|
363732
|
+
true
|
|
363717
363733
|
);
|
|
363718
|
-
return { patches: [], revertedPatchIds: [] };
|
|
363719
363734
|
}
|
|
363720
363735
|
const isAncestor = await this.git.isAncestor(lastGen.commit_sha, "HEAD");
|
|
363721
363736
|
if (!isAncestor) {
|
|
363722
|
-
return this.detectPatchesViaTreeDiff(
|
|
363737
|
+
return this.detectPatchesViaTreeDiff(
|
|
363738
|
+
lastGen,
|
|
363739
|
+
/* commitKnownMissing */
|
|
363740
|
+
false
|
|
363741
|
+
);
|
|
363723
363742
|
}
|
|
363724
363743
|
const log4 = await this.git.exec([
|
|
363725
363744
|
"log",
|
|
@@ -363745,7 +363764,15 @@ var require_dist14 = __commonJS({
|
|
|
363745
363764
|
if (lock.patches.find((p10) => p10.original_commit === commit.sha)) {
|
|
363746
363765
|
continue;
|
|
363747
363766
|
}
|
|
363748
|
-
|
|
363767
|
+
let patchContent;
|
|
363768
|
+
try {
|
|
363769
|
+
patchContent = await this.git.formatPatch(commit.sha);
|
|
363770
|
+
} catch {
|
|
363771
|
+
this.warnings.push(
|
|
363772
|
+
`Could not generate patch for commit ${commit.sha.slice(0, 7)} \u2014 it may be unreachable in a shallow clone. Skipping.`
|
|
363773
|
+
);
|
|
363774
|
+
continue;
|
|
363775
|
+
}
|
|
363749
363776
|
const contentHash = this.computeContentHash(patchContent);
|
|
363750
363777
|
if (lock.patches.find((p10) => p10.content_hash === contentHash) || forgottenHashes.has(contentHash)) {
|
|
363751
363778
|
continue;
|
|
@@ -363838,11 +363865,15 @@ var require_dist14 = __commonJS({
|
|
|
363838
363865
|
* Revert reconciliation is skipped here because tree-diff produces a single composite
|
|
363839
363866
|
* patch from the aggregate diff — individual revert commits are not distinguishable.
|
|
363840
363867
|
*/
|
|
363841
|
-
async detectPatchesViaTreeDiff(lastGen) {
|
|
363842
|
-
const
|
|
363868
|
+
async detectPatchesViaTreeDiff(lastGen, commitKnownMissing) {
|
|
363869
|
+
const diffBase = await this.resolveDiffBase(lastGen, commitKnownMissing);
|
|
363870
|
+
if (!diffBase) {
|
|
363871
|
+
return this.detectPatchesViaCommitScan();
|
|
363872
|
+
}
|
|
363873
|
+
const filesOutput = await this.git.exec(["diff", "--name-only", diffBase, "HEAD"]);
|
|
363843
363874
|
const files = filesOutput.trim().split("\n").filter(Boolean).filter((f10) => !INFRASTRUCTURE_FILES.has(f10)).filter((f10) => !f10.startsWith(".fern/"));
|
|
363844
363875
|
if (files.length === 0) return { patches: [], revertedPatchIds: [] };
|
|
363845
|
-
const diff2 = await this.git.exec(["diff",
|
|
363876
|
+
const diff2 = await this.git.exec(["diff", diffBase, "HEAD", "--", ...files]);
|
|
363846
363877
|
if (!diff2.trim()) return { patches: [], revertedPatchIds: [] };
|
|
363847
363878
|
const contentHash = this.computeContentHash(diff2);
|
|
363848
363879
|
const lock = this.lockManager.read();
|
|
@@ -363856,12 +363887,113 @@ var require_dist14 = __commonJS({
|
|
|
363856
363887
|
original_commit: headSha,
|
|
363857
363888
|
original_message: "Customer customizations (composite)",
|
|
363858
363889
|
original_author: "composite",
|
|
363859
|
-
|
|
363890
|
+
// Use diffBase when commit is unreachable — the applicator needs a reachable
|
|
363891
|
+
// reference to find base file content. diffBase may be the tree_hash.
|
|
363892
|
+
base_generation: commitKnownMissing ? diffBase : lastGen.commit_sha,
|
|
363860
363893
|
files,
|
|
363861
363894
|
patch_content: diff2
|
|
363862
363895
|
};
|
|
363863
363896
|
return { patches: [compositePatch], revertedPatchIds: [] };
|
|
363864
363897
|
}
|
|
363898
|
+
/**
|
|
363899
|
+
* Last-resort detection when both generation commit and tree are unreachable.
|
|
363900
|
+
* Scans all commits from HEAD, filters against known lockfile patches, and
|
|
363901
|
+
* skips creation-only commits (squashed history after force push).
|
|
363902
|
+
*
|
|
363903
|
+
* Detected patches use the commit's parent as base_generation so the applicator
|
|
363904
|
+
* can find base file content from the parent's tree (which IS reachable).
|
|
363905
|
+
*/
|
|
363906
|
+
async detectPatchesViaCommitScan() {
|
|
363907
|
+
const lock = this.lockManager.read();
|
|
363908
|
+
const log4 = await this.git.exec([
|
|
363909
|
+
"log",
|
|
363910
|
+
"--max-count=200",
|
|
363911
|
+
"--format=%H%x00%an%x00%ae%x00%s",
|
|
363912
|
+
"HEAD",
|
|
363913
|
+
"--",
|
|
363914
|
+
this.sdkOutputDir
|
|
363915
|
+
]);
|
|
363916
|
+
if (!log4.trim()) {
|
|
363917
|
+
return { patches: [], revertedPatchIds: [] };
|
|
363918
|
+
}
|
|
363919
|
+
const commits = this.parseGitLog(log4);
|
|
363920
|
+
const newPatches = [];
|
|
363921
|
+
const forgottenHashes = new Set(lock.forgotten_hashes ?? []);
|
|
363922
|
+
const existingHashes = new Set(lock.patches.map((p10) => p10.content_hash));
|
|
363923
|
+
const existingCommits = new Set(lock.patches.map((p10) => p10.original_commit));
|
|
363924
|
+
for (const commit of commits) {
|
|
363925
|
+
if (isGenerationCommit(commit)) {
|
|
363926
|
+
continue;
|
|
363927
|
+
}
|
|
363928
|
+
const parents = await this.git.getCommitParents(commit.sha);
|
|
363929
|
+
if (parents.length > 1) {
|
|
363930
|
+
continue;
|
|
363931
|
+
}
|
|
363932
|
+
if (existingCommits.has(commit.sha)) {
|
|
363933
|
+
continue;
|
|
363934
|
+
}
|
|
363935
|
+
let patchContent;
|
|
363936
|
+
try {
|
|
363937
|
+
patchContent = await this.git.formatPatch(commit.sha);
|
|
363938
|
+
} catch {
|
|
363939
|
+
continue;
|
|
363940
|
+
}
|
|
363941
|
+
const contentHash = this.computeContentHash(patchContent);
|
|
363942
|
+
if (existingHashes.has(contentHash) || forgottenHashes.has(contentHash)) {
|
|
363943
|
+
continue;
|
|
363944
|
+
}
|
|
363945
|
+
if (this.isCreationOnlyPatch(patchContent)) {
|
|
363946
|
+
continue;
|
|
363947
|
+
}
|
|
363948
|
+
const filesOutput = await this.git.exec(["diff-tree", "--no-commit-id", "--name-only", "-r", commit.sha]);
|
|
363949
|
+
const files = filesOutput.trim().split("\n").filter(Boolean).filter((f10) => !INFRASTRUCTURE_FILES.has(f10));
|
|
363950
|
+
if (files.length === 0) {
|
|
363951
|
+
continue;
|
|
363952
|
+
}
|
|
363953
|
+
if (parents.length === 0) {
|
|
363954
|
+
continue;
|
|
363955
|
+
}
|
|
363956
|
+
const parentSha = parents[0];
|
|
363957
|
+
newPatches.push({
|
|
363958
|
+
id: `patch-${commit.sha.slice(0, 8)}`,
|
|
363959
|
+
content_hash: contentHash,
|
|
363960
|
+
original_commit: commit.sha,
|
|
363961
|
+
original_message: commit.message,
|
|
363962
|
+
original_author: `${commit.authorName} <${commit.authorEmail}>`,
|
|
363963
|
+
base_generation: parentSha,
|
|
363964
|
+
files,
|
|
363965
|
+
patch_content: patchContent
|
|
363966
|
+
});
|
|
363967
|
+
}
|
|
363968
|
+
newPatches.reverse();
|
|
363969
|
+
return { patches: newPatches, revertedPatchIds: [] };
|
|
363970
|
+
}
|
|
363971
|
+
/**
|
|
363972
|
+
* Check if a format-patch consists entirely of new-file creations.
|
|
363973
|
+
* Used to identify squashed commits after force push, which create all files
|
|
363974
|
+
* from scratch (--- /dev/null) rather than modifying existing files.
|
|
363975
|
+
*/
|
|
363976
|
+
isCreationOnlyPatch(patchContent) {
|
|
363977
|
+
const diffOldHeaders = patchContent.split("\n").filter((l14) => l14.startsWith("--- "));
|
|
363978
|
+
if (diffOldHeaders.length === 0) {
|
|
363979
|
+
return false;
|
|
363980
|
+
}
|
|
363981
|
+
return diffOldHeaders.every((l14) => l14 === "--- /dev/null");
|
|
363982
|
+
}
|
|
363983
|
+
/**
|
|
363984
|
+
* Resolve the best available diff base for a generation record.
|
|
363985
|
+
* Prefers commit_sha, falls back to tree_hash for unreachable commits.
|
|
363986
|
+
* When commitKnownMissing is true, skips the redundant commitExists check.
|
|
363987
|
+
*/
|
|
363988
|
+
async resolveDiffBase(gen, commitKnownMissing) {
|
|
363989
|
+
if (!commitKnownMissing && await this.git.commitExists(gen.commit_sha)) {
|
|
363990
|
+
return gen.commit_sha;
|
|
363991
|
+
}
|
|
363992
|
+
if (await this.git.treeExists(gen.tree_hash)) {
|
|
363993
|
+
return gen.tree_hash;
|
|
363994
|
+
}
|
|
363995
|
+
return null;
|
|
363996
|
+
}
|
|
363865
363997
|
parseGitLog(log4) {
|
|
363866
363998
|
return log4.trim().split("\n").map((line) => {
|
|
363867
363999
|
const [sha, authorName, authorEmail, message] = line.split("\0");
|
|
@@ -363886,20 +364018,33 @@ var require_dist14 = __commonJS({
|
|
|
363886
364018
|
outputLines.push(...region.ok);
|
|
363887
364019
|
currentLine += region.ok.length;
|
|
363888
364020
|
} else if (region.conflict) {
|
|
363889
|
-
const
|
|
363890
|
-
|
|
363891
|
-
|
|
363892
|
-
|
|
363893
|
-
|
|
363894
|
-
|
|
363895
|
-
|
|
363896
|
-
|
|
363897
|
-
|
|
363898
|
-
|
|
363899
|
-
|
|
363900
|
-
|
|
363901
|
-
|
|
363902
|
-
|
|
364021
|
+
const resolved = tryResolveConflict(
|
|
364022
|
+
region.conflict.a,
|
|
364023
|
+
// ours (generator)
|
|
364024
|
+
region.conflict.o,
|
|
364025
|
+
// base
|
|
364026
|
+
region.conflict.b
|
|
364027
|
+
// theirs (user)
|
|
364028
|
+
);
|
|
364029
|
+
if (resolved !== null) {
|
|
364030
|
+
outputLines.push(...resolved);
|
|
364031
|
+
currentLine += resolved.length;
|
|
364032
|
+
} else {
|
|
364033
|
+
const startLine = currentLine;
|
|
364034
|
+
outputLines.push("<<<<<<< Generated");
|
|
364035
|
+
outputLines.push(...region.conflict.a);
|
|
364036
|
+
outputLines.push("=======");
|
|
364037
|
+
outputLines.push(...region.conflict.b);
|
|
364038
|
+
outputLines.push(">>>>>>> Your customization");
|
|
364039
|
+
const conflictLines = region.conflict.a.length + region.conflict.b.length + 3;
|
|
364040
|
+
conflicts2.push({
|
|
364041
|
+
startLine,
|
|
364042
|
+
endLine: startLine + conflictLines - 1,
|
|
364043
|
+
ours: region.conflict.a,
|
|
364044
|
+
theirs: region.conflict.b
|
|
364045
|
+
});
|
|
364046
|
+
currentLine += conflictLines;
|
|
364047
|
+
}
|
|
363903
364048
|
}
|
|
363904
364049
|
}
|
|
363905
364050
|
return {
|
|
@@ -363908,33 +364053,134 @@ var require_dist14 = __commonJS({
|
|
|
363908
364053
|
conflicts: conflicts2
|
|
363909
364054
|
};
|
|
363910
364055
|
}
|
|
364056
|
+
function tryResolveConflict(oursLines, baseLines, theirsLines) {
|
|
364057
|
+
if (baseLines.length === 0) {
|
|
364058
|
+
return null;
|
|
364059
|
+
}
|
|
364060
|
+
const oursPatches = (0, import_node_diff3.diffPatch)(baseLines, oursLines);
|
|
364061
|
+
const theirsPatches = (0, import_node_diff3.diffPatch)(baseLines, theirsLines);
|
|
364062
|
+
if (oursPatches.length === 0) return theirsLines;
|
|
364063
|
+
if (theirsPatches.length === 0) return oursLines;
|
|
364064
|
+
if (patchesOverlap(oursPatches, theirsPatches)) {
|
|
364065
|
+
return null;
|
|
364066
|
+
}
|
|
364067
|
+
return applyBothPatches(baseLines, oursPatches, theirsPatches);
|
|
364068
|
+
}
|
|
364069
|
+
function patchesOverlap(oursPatches, theirsPatches) {
|
|
364070
|
+
for (const op5 of oursPatches) {
|
|
364071
|
+
const oStart = op5.buffer1.offset;
|
|
364072
|
+
const oEnd = oStart + op5.buffer1.length;
|
|
364073
|
+
for (const tp3 of theirsPatches) {
|
|
364074
|
+
const tStart = tp3.buffer1.offset;
|
|
364075
|
+
const tEnd = tStart + tp3.buffer1.length;
|
|
364076
|
+
if (op5.buffer1.length === 0 && tp3.buffer1.length === 0 && oStart === tStart) {
|
|
364077
|
+
return true;
|
|
364078
|
+
}
|
|
364079
|
+
if (tp3.buffer1.length === 0 && tStart === oEnd) {
|
|
364080
|
+
return true;
|
|
364081
|
+
}
|
|
364082
|
+
if (op5.buffer1.length === 0 && oStart === tEnd) {
|
|
364083
|
+
return true;
|
|
364084
|
+
}
|
|
364085
|
+
if (oStart < tEnd && tStart < oEnd) {
|
|
364086
|
+
return true;
|
|
364087
|
+
}
|
|
364088
|
+
}
|
|
364089
|
+
}
|
|
364090
|
+
return false;
|
|
364091
|
+
}
|
|
364092
|
+
function applyBothPatches(baseLines, oursPatches, theirsPatches) {
|
|
364093
|
+
const allPatches = [
|
|
364094
|
+
...oursPatches.map((p10) => ({
|
|
364095
|
+
offset: p10.buffer1.offset,
|
|
364096
|
+
length: p10.buffer1.length,
|
|
364097
|
+
replacement: p10.buffer2.chunk
|
|
364098
|
+
})),
|
|
364099
|
+
...theirsPatches.map((p10) => ({
|
|
364100
|
+
offset: p10.buffer1.offset,
|
|
364101
|
+
length: p10.buffer1.length,
|
|
364102
|
+
replacement: p10.buffer2.chunk
|
|
364103
|
+
}))
|
|
364104
|
+
];
|
|
364105
|
+
allPatches.sort((a10, b19) => b19.offset - a10.offset);
|
|
364106
|
+
const result = [...baseLines];
|
|
364107
|
+
for (const p10 of allPatches) {
|
|
364108
|
+
result.splice(p10.offset, p10.length, ...p10.replacement);
|
|
364109
|
+
}
|
|
364110
|
+
return result;
|
|
364111
|
+
}
|
|
363911
364112
|
var import_promises182 = require("fs/promises");
|
|
363912
364113
|
var import_node_os15 = require("os");
|
|
363913
364114
|
var import_node_path210 = require("path");
|
|
363914
364115
|
var import_minimatch8 = require_commonjs3();
|
|
364116
|
+
var CONFLICT_OPENER = "<<<<<<< Generated";
|
|
364117
|
+
var CONFLICT_SEPARATOR = "=======";
|
|
364118
|
+
var CONFLICT_CLOSER = ">>>>>>> Your customization";
|
|
364119
|
+
function trimCR(line) {
|
|
364120
|
+
return line.endsWith("\r") ? line.slice(0, -1) : line;
|
|
364121
|
+
}
|
|
364122
|
+
function findConflictRanges(lines) {
|
|
364123
|
+
const ranges = [];
|
|
364124
|
+
let i11 = 0;
|
|
364125
|
+
while (i11 < lines.length) {
|
|
364126
|
+
if (trimCR(lines[i11]) === CONFLICT_OPENER) {
|
|
364127
|
+
let separatorIdx = -1;
|
|
364128
|
+
let j16 = i11 + 1;
|
|
364129
|
+
let found = false;
|
|
364130
|
+
while (j16 < lines.length) {
|
|
364131
|
+
const trimmed2 = trimCR(lines[j16]);
|
|
364132
|
+
if (trimmed2 === CONFLICT_OPENER) {
|
|
364133
|
+
break;
|
|
364134
|
+
}
|
|
364135
|
+
if (separatorIdx === -1 && trimmed2 === CONFLICT_SEPARATOR) {
|
|
364136
|
+
separatorIdx = j16;
|
|
364137
|
+
} else if (separatorIdx !== -1 && trimmed2 === CONFLICT_CLOSER) {
|
|
364138
|
+
ranges.push({ start: i11, separator: separatorIdx, end: j16 });
|
|
364139
|
+
i11 = j16;
|
|
364140
|
+
found = true;
|
|
364141
|
+
break;
|
|
364142
|
+
}
|
|
364143
|
+
j16++;
|
|
364144
|
+
}
|
|
364145
|
+
if (!found) {
|
|
364146
|
+
i11++;
|
|
364147
|
+
continue;
|
|
364148
|
+
}
|
|
364149
|
+
}
|
|
364150
|
+
i11++;
|
|
364151
|
+
}
|
|
364152
|
+
return ranges;
|
|
364153
|
+
}
|
|
363915
364154
|
function stripConflictMarkers(content5) {
|
|
363916
|
-
const lines = content5.split(
|
|
364155
|
+
const lines = content5.split(/\r?\n/);
|
|
364156
|
+
const ranges = findConflictRanges(lines);
|
|
364157
|
+
if (ranges.length === 0) {
|
|
364158
|
+
return content5;
|
|
364159
|
+
}
|
|
363917
364160
|
const result = [];
|
|
363918
|
-
let
|
|
363919
|
-
let
|
|
363920
|
-
|
|
363921
|
-
|
|
363922
|
-
|
|
363923
|
-
|
|
363924
|
-
|
|
363925
|
-
|
|
363926
|
-
|
|
363927
|
-
|
|
363928
|
-
|
|
363929
|
-
|
|
363930
|
-
|
|
363931
|
-
|
|
363932
|
-
|
|
363933
|
-
|
|
363934
|
-
|
|
363935
|
-
|
|
363936
|
-
|
|
364161
|
+
let rangeIdx = 0;
|
|
364162
|
+
for (let i11 = 0; i11 < lines.length; i11++) {
|
|
364163
|
+
if (rangeIdx < ranges.length) {
|
|
364164
|
+
const range2 = ranges[rangeIdx];
|
|
364165
|
+
if (i11 === range2.start) {
|
|
364166
|
+
continue;
|
|
364167
|
+
}
|
|
364168
|
+
if (i11 > range2.start && i11 < range2.separator) {
|
|
364169
|
+
result.push(lines[i11]);
|
|
364170
|
+
continue;
|
|
364171
|
+
}
|
|
364172
|
+
if (i11 === range2.separator) {
|
|
364173
|
+
continue;
|
|
364174
|
+
}
|
|
364175
|
+
if (i11 > range2.separator && i11 < range2.end) {
|
|
364176
|
+
continue;
|
|
364177
|
+
}
|
|
364178
|
+
if (i11 === range2.end) {
|
|
364179
|
+
rangeIdx++;
|
|
364180
|
+
continue;
|
|
364181
|
+
}
|
|
363937
364182
|
}
|
|
364183
|
+
result.push(lines[i11]);
|
|
363938
364184
|
}
|
|
363939
364185
|
return result.join("\n");
|
|
363940
364186
|
}
|
|
@@ -363999,6 +364245,27 @@ var require_dist14 = __commonJS({
|
|
|
363999
364245
|
this.lockManager = lockManager;
|
|
364000
364246
|
this.outputDir = outputDir;
|
|
364001
364247
|
}
|
|
364248
|
+
/**
|
|
364249
|
+
* Resolve the GenerationRecord for a patch's base_generation.
|
|
364250
|
+
* Falls back to constructing an ad-hoc record from the commit's tree
|
|
364251
|
+
* when base_generation isn't a tracked generation (commit-scan patches).
|
|
364252
|
+
*/
|
|
364253
|
+
async resolveBaseGeneration(baseGeneration) {
|
|
364254
|
+
const gen = this.lockManager.getGeneration(baseGeneration);
|
|
364255
|
+
if (gen) return gen;
|
|
364256
|
+
try {
|
|
364257
|
+
const treeHash = await this.git.getTreeHash(baseGeneration);
|
|
364258
|
+
return {
|
|
364259
|
+
commit_sha: baseGeneration,
|
|
364260
|
+
tree_hash: treeHash,
|
|
364261
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
364262
|
+
cli_version: "unknown",
|
|
364263
|
+
generator_versions: {}
|
|
364264
|
+
};
|
|
364265
|
+
} catch {
|
|
364266
|
+
return void 0;
|
|
364267
|
+
}
|
|
364268
|
+
}
|
|
364002
364269
|
/** Reset inter-patch accumulator for a new cycle. */
|
|
364003
364270
|
resetAccumulator() {
|
|
364004
364271
|
this.fileTheirsAccumulator.clear();
|
|
@@ -364080,7 +364347,7 @@ var require_dist14 = __commonJS({
|
|
|
364080
364347
|
}
|
|
364081
364348
|
}
|
|
364082
364349
|
async applyPatchWithFallback(patch5) {
|
|
364083
|
-
const baseGen = this.
|
|
364350
|
+
const baseGen = await this.resolveBaseGeneration(patch5.base_generation);
|
|
364084
364351
|
const lock = this.lockManager.read();
|
|
364085
364352
|
const currentGen = lock.generations.find((g19) => g19.commit_sha === lock.current_generation);
|
|
364086
364353
|
const currentTreeHash = currentGen?.tree_hash ?? baseGen?.tree_hash ?? "";
|
|
@@ -364164,7 +364431,7 @@ var require_dist14 = __commonJS({
|
|
|
364164
364431
|
}
|
|
364165
364432
|
async mergeFile(patch5, filePath, tempGit, tempDir2) {
|
|
364166
364433
|
try {
|
|
364167
|
-
const baseGen = this.
|
|
364434
|
+
const baseGen = await this.resolveBaseGeneration(patch5.base_generation);
|
|
364168
364435
|
if (!baseGen) {
|
|
364169
364436
|
return { file: filePath, status: "skipped", reason: "base-generation-not-found" };
|
|
364170
364437
|
}
|
|
@@ -364216,9 +364483,20 @@ var require_dist14 = __commonJS({
|
|
|
364216
364483
|
renameSourcePath
|
|
364217
364484
|
);
|
|
364218
364485
|
}
|
|
364486
|
+
if (theirs) {
|
|
364487
|
+
const theirsHasMarkers = theirs.includes("<<<<<<< Generated") || theirs.includes(">>>>>>> Your customization");
|
|
364488
|
+
const baseHasMarkers = base4 != null && (base4.includes("<<<<<<< Generated") || base4.includes(">>>>>>> Your customization"));
|
|
364489
|
+
if (theirsHasMarkers && !baseHasMarkers) {
|
|
364490
|
+
return {
|
|
364491
|
+
file: resolvedPath,
|
|
364492
|
+
status: "skipped",
|
|
364493
|
+
reason: "stale-conflict-markers"
|
|
364494
|
+
};
|
|
364495
|
+
}
|
|
364496
|
+
}
|
|
364219
364497
|
let useAccumulatorAsMergeBase = false;
|
|
364220
364498
|
const accumulatorEntry = this.fileTheirsAccumulator.get(resolvedPath);
|
|
364221
|
-
if (!theirs
|
|
364499
|
+
if (accumulatorEntry && (!theirs || base4 == null)) {
|
|
364222
364500
|
theirs = await this.applyPatchToContent(
|
|
364223
364501
|
accumulatorEntry.content,
|
|
364224
364502
|
patch5.patch_content,
|
|
@@ -364230,6 +364508,17 @@ var require_dist14 = __commonJS({
|
|
|
364230
364508
|
useAccumulatorAsMergeBase = true;
|
|
364231
364509
|
}
|
|
364232
364510
|
}
|
|
364511
|
+
if (theirs) {
|
|
364512
|
+
const theirsHasMarkers = theirs.includes("<<<<<<< Generated") || theirs.includes(">>>>>>> Your customization");
|
|
364513
|
+
const accBaseHasMarkers = accumulatorEntry != null && (accumulatorEntry.content.includes("<<<<<<< Generated") || accumulatorEntry.content.includes(">>>>>>> Your customization"));
|
|
364514
|
+
if (theirsHasMarkers && !accBaseHasMarkers && !(base4 != null && (base4.includes("<<<<<<< Generated") || base4.includes(">>>>>>> Your customization")))) {
|
|
364515
|
+
return {
|
|
364516
|
+
file: resolvedPath,
|
|
364517
|
+
status: "skipped",
|
|
364518
|
+
reason: "stale-conflict-markers"
|
|
364519
|
+
};
|
|
364520
|
+
}
|
|
364521
|
+
}
|
|
364233
364522
|
let effective_theirs = theirs;
|
|
364234
364523
|
let baseMismatchSkipped = false;
|
|
364235
364524
|
if (theirs && base4 && !useAccumulatorAsMergeBase) {
|
|
@@ -364249,12 +364538,16 @@ var require_dist14 = __commonJS({
|
|
|
364249
364538
|
}
|
|
364250
364539
|
}
|
|
364251
364540
|
if (base4 == null && !ours && effective_theirs) {
|
|
364541
|
+
this.fileTheirsAccumulator.set(resolvedPath, {
|
|
364542
|
+
content: effective_theirs,
|
|
364543
|
+
baseGeneration: patch5.base_generation
|
|
364544
|
+
});
|
|
364252
364545
|
const outDir2 = (0, import_node_path210.dirname)(oursPath);
|
|
364253
364546
|
await (0, import_promises182.mkdir)(outDir2, { recursive: true });
|
|
364254
364547
|
await (0, import_promises182.writeFile)(oursPath, effective_theirs);
|
|
364255
364548
|
return { file: resolvedPath, status: "merged", reason: "new-file" };
|
|
364256
364549
|
}
|
|
364257
|
-
if (base4 == null && ours && effective_theirs) {
|
|
364550
|
+
if (base4 == null && ours && effective_theirs && !useAccumulatorAsMergeBase) {
|
|
364258
364551
|
const merged2 = threeWayMerge("", ours, effective_theirs);
|
|
364259
364552
|
const outDir2 = (0, import_node_path210.dirname)(oursPath);
|
|
364260
364553
|
await (0, import_promises182.mkdir)(outDir2, { recursive: true });
|
|
@@ -364296,7 +364589,7 @@ var require_dist14 = __commonJS({
|
|
|
364296
364589
|
const outDir = (0, import_node_path210.dirname)(oursPath);
|
|
364297
364590
|
await (0, import_promises182.mkdir)(outDir, { recursive: true });
|
|
364298
364591
|
await (0, import_promises182.writeFile)(oursPath, merged.content);
|
|
364299
|
-
if (effective_theirs) {
|
|
364592
|
+
if (effective_theirs && !merged.hasConflicts) {
|
|
364300
364593
|
this.fileTheirsAccumulator.set(resolvedPath, {
|
|
364301
364594
|
content: effective_theirs,
|
|
364302
364595
|
baseGeneration: patch5.base_generation
|
|
@@ -364437,16 +364730,24 @@ var require_dist14 = __commonJS({
|
|
|
364437
364730
|
const addedLines = [];
|
|
364438
364731
|
let inTargetFile = false;
|
|
364439
364732
|
let inHunk = false;
|
|
364733
|
+
let isNewFile = false;
|
|
364440
364734
|
let noTrailingNewline = false;
|
|
364441
364735
|
for (const line of lines) {
|
|
364442
364736
|
if (line.startsWith("diff --git")) {
|
|
364443
364737
|
if (inTargetFile) break;
|
|
364444
364738
|
inTargetFile = isDiffLineForFile(line, filePath);
|
|
364445
364739
|
inHunk = false;
|
|
364740
|
+
isNewFile = false;
|
|
364446
364741
|
continue;
|
|
364447
364742
|
}
|
|
364448
364743
|
if (!inTargetFile) continue;
|
|
364744
|
+
if (!inHunk) {
|
|
364745
|
+
if (line === "--- /dev/null" || line.startsWith("new file mode")) {
|
|
364746
|
+
isNewFile = true;
|
|
364747
|
+
}
|
|
364748
|
+
}
|
|
364449
364749
|
if (line.startsWith("@@")) {
|
|
364750
|
+
if (!isNewFile) return null;
|
|
364450
364751
|
inHunk = true;
|
|
364451
364752
|
continue;
|
|
364452
364753
|
}
|
|
@@ -364594,6 +364895,7 @@ CLI Version: ${options2.cliVersion}`;
|
|
|
364594
364895
|
generator_versions: options2?.generatorVersions ?? {},
|
|
364595
364896
|
base_branch_head: options2?.baseBranchHead
|
|
364596
364897
|
};
|
|
364898
|
+
let resolvedPatches;
|
|
364597
364899
|
if (!this.lockManager.exists()) {
|
|
364598
364900
|
this.lockManager.initializeInMemory(record21);
|
|
364599
364901
|
} else {
|
|
@@ -364602,13 +364904,13 @@ CLI Version: ${options2.cliVersion}`;
|
|
|
364602
364904
|
...this.lockManager.getUnresolvedPatches(),
|
|
364603
364905
|
...this.lockManager.getResolvingPatches()
|
|
364604
364906
|
];
|
|
364907
|
+
resolvedPatches = this.lockManager.getPatches().filter((p10) => p10.status == null);
|
|
364605
364908
|
this.lockManager.addGeneration(record21);
|
|
364606
364909
|
this.lockManager.clearPatches();
|
|
364607
364910
|
for (const patch5 of unresolvedPatches) {
|
|
364608
364911
|
this.lockManager.addPatch(patch5);
|
|
364609
364912
|
}
|
|
364610
364913
|
}
|
|
364611
|
-
this.lockManager.save();
|
|
364612
364914
|
try {
|
|
364613
364915
|
const { patches: redetectedPatches } = await this.detector.detectNewPatches();
|
|
364614
364916
|
if (redetectedPatches.length > 0) {
|
|
@@ -364622,20 +364924,27 @@ CLI Version: ${options2.cliVersion}`;
|
|
|
364622
364924
|
for (const patch5 of redetectedPatches) {
|
|
364623
364925
|
this.lockManager.addPatch(patch5);
|
|
364624
364926
|
}
|
|
364625
|
-
this.lockManager.save();
|
|
364626
364927
|
}
|
|
364627
|
-
} catch {
|
|
364928
|
+
} catch (error50) {
|
|
364929
|
+
for (const patch5 of resolvedPatches ?? []) {
|
|
364930
|
+
this.lockManager.addPatch(patch5);
|
|
364931
|
+
}
|
|
364932
|
+
this.detector.warnings.push(
|
|
364933
|
+
`Patch re-detection failed after divergent merge sync. ${(resolvedPatches ?? []).length} previously resolved patch(es) preserved. Error: ${error50 instanceof Error ? error50.message : String(error50)}`
|
|
364934
|
+
);
|
|
364628
364935
|
}
|
|
364936
|
+
this.lockManager.save();
|
|
364629
364937
|
}
|
|
364630
364938
|
determineFlow() {
|
|
364631
|
-
|
|
364632
|
-
|
|
364633
|
-
|
|
364634
|
-
|
|
364635
|
-
|
|
364636
|
-
|
|
364939
|
+
try {
|
|
364940
|
+
const lock = this.lockManager.read();
|
|
364941
|
+
return lock.patches.length === 0 ? "no-patches" : "normal-regeneration";
|
|
364942
|
+
} catch (error50) {
|
|
364943
|
+
if (error50 instanceof LockfileNotFoundError) {
|
|
364944
|
+
return "first-generation";
|
|
364945
|
+
}
|
|
364946
|
+
throw error50;
|
|
364637
364947
|
}
|
|
364638
|
-
return "normal-regeneration";
|
|
364639
364948
|
}
|
|
364640
364949
|
async handleFirstGeneration(options2) {
|
|
364641
364950
|
if (options2?.dryRun) {
|
|
@@ -364677,12 +364986,17 @@ CLI Version: ${options2.cliVersion}`;
|
|
|
364677
364986
|
baseBranchHead: options2.baseBranchHead
|
|
364678
364987
|
} : void 0;
|
|
364679
364988
|
await this.committer.commitGeneration("Update SDK (replay skipped)", commitOpts);
|
|
364989
|
+
await this.cleanupStaleConflictMarkers();
|
|
364680
364990
|
const genRecord = await this.committer.createGenerationRecord(commitOpts);
|
|
364681
|
-
|
|
364991
|
+
try {
|
|
364682
364992
|
this.lockManager.read();
|
|
364683
364993
|
this.lockManager.addGeneration(genRecord);
|
|
364684
|
-
}
|
|
364685
|
-
|
|
364994
|
+
} catch (error50) {
|
|
364995
|
+
if (error50 instanceof LockfileNotFoundError) {
|
|
364996
|
+
this.lockManager.initializeInMemory(genRecord);
|
|
364997
|
+
} else {
|
|
364998
|
+
throw error50;
|
|
364999
|
+
}
|
|
364686
365000
|
}
|
|
364687
365001
|
this.lockManager.setReplaySkippedAt((/* @__PURE__ */ new Date()).toISOString());
|
|
364688
365002
|
this.lockManager.save();
|
|
@@ -364728,6 +365042,7 @@ CLI Version: ${options2.cliVersion}`;
|
|
|
364728
365042
|
baseBranchHead: options2.baseBranchHead
|
|
364729
365043
|
} : void 0;
|
|
364730
365044
|
await this.committer.commitGeneration("Update SDK", commitOpts);
|
|
365045
|
+
await this.cleanupStaleConflictMarkers();
|
|
364731
365046
|
const genRecord = await this.committer.createGenerationRecord(commitOpts);
|
|
364732
365047
|
this.lockManager.addGeneration(genRecord);
|
|
364733
365048
|
let results = [];
|
|
@@ -364821,6 +365136,7 @@ CLI Version: ${options2.cliVersion}`;
|
|
|
364821
365136
|
baseBranchHead: options2.baseBranchHead
|
|
364822
365137
|
} : void 0;
|
|
364823
365138
|
await this.committer.commitGeneration("Update SDK", commitOpts);
|
|
365139
|
+
await this.cleanupStaleConflictMarkers();
|
|
364824
365140
|
const genRecord = await this.committer.createGenerationRecord(commitOpts);
|
|
364825
365141
|
this.lockManager.addGeneration(genRecord);
|
|
364826
365142
|
const results = await this.applicator.applyPatches(allPatches);
|
|
@@ -365011,6 +365327,13 @@ CLI Version: ${options2.cliVersion}`;
|
|
|
365011
365327
|
contentRefreshed++;
|
|
365012
365328
|
continue;
|
|
365013
365329
|
}
|
|
365330
|
+
const diffLines = diff2.split("\n");
|
|
365331
|
+
const hasStaleMarkers = diffLines.some(
|
|
365332
|
+
(l14) => l14.startsWith("+<<<<<<< Generated") || l14.startsWith("+>>>>>>> Your customization")
|
|
365333
|
+
);
|
|
365334
|
+
if (hasStaleMarkers) {
|
|
365335
|
+
continue;
|
|
365336
|
+
}
|
|
365014
365337
|
const newContentHash = this.detector.computeContentHash(diff2);
|
|
365015
365338
|
if (newContentHash !== patch5.content_hash) {
|
|
365016
365339
|
const filesOutput = await this.git.exec(["diff", "--name-only", currentGen, "HEAD", "--", ...patch5.files]).catch(() => null);
|
|
@@ -365031,7 +365354,7 @@ CLI Version: ${options2.cliVersion}`;
|
|
|
365031
365354
|
continue;
|
|
365032
365355
|
}
|
|
365033
365356
|
try {
|
|
365034
|
-
const markerFiles = await this.git.exec(["grep", "-l", "<<<<<<<", "HEAD", "--", ...patch5.files]).catch(() => "");
|
|
365357
|
+
const markerFiles = await this.git.exec(["grep", "-l", "<<<<<<< Generated", "HEAD", "--", ...patch5.files]).catch(() => "");
|
|
365035
365358
|
if (markerFiles.trim()) continue;
|
|
365036
365359
|
const diff2 = await this.git.exec(["diff", currentGen, "HEAD", "--", ...patch5.files]).catch(() => null);
|
|
365037
365360
|
if (diff2 === null) continue;
|
|
@@ -365071,6 +365394,25 @@ CLI Version: ${options2.cliVersion}`;
|
|
|
365071
365394
|
}
|
|
365072
365395
|
}
|
|
365073
365396
|
}
|
|
365397
|
+
/**
|
|
365398
|
+
* Clean up stale conflict markers left by a previous crashed run.
|
|
365399
|
+
* Called after commitGeneration() when HEAD is the [fern-generated] commit.
|
|
365400
|
+
* Restores files to their clean generated state from HEAD.
|
|
365401
|
+
* Skips .fernignore-protected files to prevent overwriting user content.
|
|
365402
|
+
*/
|
|
365403
|
+
async cleanupStaleConflictMarkers() {
|
|
365404
|
+
const markerFiles = await this.git.exec(["grep", "-l", "<<<<<<< Generated", "--", "."]).catch(() => "");
|
|
365405
|
+
const files = markerFiles.trim().split("\n").filter(Boolean);
|
|
365406
|
+
if (files.length === 0) return;
|
|
365407
|
+
const fernignorePatterns = this.readFernignorePatterns();
|
|
365408
|
+
for (const file4 of files) {
|
|
365409
|
+
if (fernignorePatterns.some((pattern) => (0, import_minimatch22.minimatch)(file4, pattern))) continue;
|
|
365410
|
+
try {
|
|
365411
|
+
await this.git.exec(["checkout", "HEAD", "--", file4]);
|
|
365412
|
+
} catch {
|
|
365413
|
+
}
|
|
365414
|
+
}
|
|
365415
|
+
}
|
|
365074
365416
|
readFernignorePatterns() {
|
|
365075
365417
|
const fernignorePath = (0, import_node_path310.join)(this.outputDir, ".fernignore");
|
|
365076
365418
|
if (!(0, import_node_fs210.existsSync)(fernignorePath)) return [];
|
|
@@ -603773,7 +604115,7 @@ var AccessTokenPosthogManager = class {
|
|
|
603773
604115
|
properties: {
|
|
603774
604116
|
...event,
|
|
603775
604117
|
...event.properties,
|
|
603776
|
-
version: "4.65.
|
|
604118
|
+
version: "4.65.1-2-g1c055b8c2af",
|
|
603777
604119
|
usingAccessToken: true
|
|
603778
604120
|
}
|
|
603779
604121
|
});
|
|
@@ -603824,7 +604166,7 @@ var UserPosthogManager = class {
|
|
|
603824
604166
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
603825
604167
|
event: "CLI",
|
|
603826
604168
|
properties: {
|
|
603827
|
-
version: "4.65.
|
|
604169
|
+
version: "4.65.1-2-g1c055b8c2af",
|
|
603828
604170
|
...event,
|
|
603829
604171
|
...event.properties,
|
|
603830
604172
|
usingAccessToken: false,
|
|
@@ -754046,9 +754388,9 @@ var V66_TO_V65_MIGRATION = {
|
|
|
754046
754388
|
[GeneratorName.TYPESCRIPT]: "3.61.0-rc.0",
|
|
754047
754389
|
[GeneratorName.TYPESCRIPT_SDK]: "3.61.0-rc.0",
|
|
754048
754390
|
[GeneratorName.TYPESCRIPT_EXPRESS]: "0.20.0-rc.0",
|
|
754049
|
-
[GeneratorName.JAVA]:
|
|
754050
|
-
[GeneratorName.JAVA_MODEL]:
|
|
754051
|
-
[GeneratorName.JAVA_SDK]:
|
|
754391
|
+
[GeneratorName.JAVA]: "4.2.0-rc.0",
|
|
754392
|
+
[GeneratorName.JAVA_MODEL]: "1.9.0-rc.0",
|
|
754393
|
+
[GeneratorName.JAVA_SDK]: "4.2.0-rc.0",
|
|
754052
754394
|
[GeneratorName.JAVA_SPRING]: GeneratorWasNeverUpdatedToConsumeNewIR,
|
|
754053
754395
|
[GeneratorName.OPENAPI_PYTHON_CLIENT]: GeneratorWasNeverUpdatedToConsumeNewIR,
|
|
754054
754396
|
[GeneratorName.OPENAPI]: "0.4.0-rc.0",
|
|
@@ -813707,6 +814049,8 @@ async function visitDocsConfigFileYamlAst({ contents, visitor, absoluteFilepathT
|
|
|
813707
814049
|
if (navigation == null) {
|
|
813708
814050
|
return;
|
|
813709
814051
|
}
|
|
814052
|
+
const navStart = performance.now();
|
|
814053
|
+
context3.logger.debug("[docs-ast] Starting main navigation traversal...");
|
|
813710
814054
|
await visitNavigationAst2({
|
|
813711
814055
|
absolutePathToFernFolder,
|
|
813712
814056
|
navigation,
|
|
@@ -813716,11 +814060,14 @@ async function visitDocsConfigFileYamlAst({ contents, visitor, absoluteFilepathT
|
|
|
813716
814060
|
apiWorkspaces,
|
|
813717
814061
|
context: context3
|
|
813718
814062
|
});
|
|
814063
|
+
context3.logger.debug(`[docs-ast] Main navigation traversal complete in ${(performance.now() - navStart).toFixed(0)}ms`);
|
|
813719
814064
|
},
|
|
813720
814065
|
products: async (products) => {
|
|
813721
814066
|
if (products == null) {
|
|
813722
814067
|
return;
|
|
813723
814068
|
}
|
|
814069
|
+
const productsStart = performance.now();
|
|
814070
|
+
context3.logger.debug(`[docs-ast] Processing ${products.length} products...`);
|
|
813724
814071
|
await Promise.all(products.map(async (product, idx) => {
|
|
813725
814072
|
if ("path" in product) {
|
|
813726
814073
|
await visitFilepath({
|
|
@@ -813752,6 +814099,7 @@ async function visitDocsConfigFileYamlAst({ contents, visitor, absoluteFilepathT
|
|
|
813752
814099
|
}
|
|
813753
814100
|
}
|
|
813754
814101
|
}));
|
|
814102
|
+
context3.logger.debug(`[docs-ast] Products processing complete in ${(performance.now() - productsStart).toFixed(0)}ms`);
|
|
813755
814103
|
},
|
|
813756
814104
|
check: noop2,
|
|
813757
814105
|
redirects: noop2,
|
|
@@ -813801,6 +814149,8 @@ async function visitDocsConfigFileYamlAst({ contents, visitor, absoluteFilepathT
|
|
|
813801
814149
|
if (versions == null) {
|
|
813802
814150
|
return;
|
|
813803
814151
|
}
|
|
814152
|
+
const versionsStart = performance.now();
|
|
814153
|
+
context3.logger.debug(`[docs-ast] Processing ${versions.length} versions...`);
|
|
813804
814154
|
await Promise.all(versions.map(async (version7, idx) => {
|
|
813805
814155
|
await visitFilepath({
|
|
813806
814156
|
absoluteFilepathToConfiguration,
|
|
@@ -813830,6 +814180,7 @@ async function visitDocsConfigFileYamlAst({ contents, visitor, absoluteFilepathT
|
|
|
813830
814180
|
});
|
|
813831
814181
|
}
|
|
813832
814182
|
}));
|
|
814183
|
+
context3.logger.debug(`[docs-ast] Versions processing complete in ${(performance.now() - versionsStart).toFixed(0)}ms`);
|
|
813833
814184
|
},
|
|
813834
814185
|
roles: noop2,
|
|
813835
814186
|
languages: noop2,
|
|
@@ -836168,42 +836519,46 @@ var ValidMarkdownLinks = {
|
|
|
836168
836519
|
sourceResolver: new SourceResolverImpl(NOOP_CONTEXT2, fernWorkspace)
|
|
836169
836520
|
});
|
|
836170
836521
|
const api = toLatest(convertIrToApiDefinition({ ir: ir15, apiDefinitionId: (0, import_crypto9.randomUUID)(), context: NOOP_CONTEXT2 }));
|
|
836522
|
+
const uniqueDescriptions = collectUniqueDescriptions(api);
|
|
836171
836523
|
const violations = [];
|
|
836172
|
-
|
|
836173
|
-
|
|
836174
|
-
|
|
836175
|
-
|
|
836176
|
-
|
|
836177
|
-
|
|
836178
|
-
|
|
836179
|
-
|
|
836180
|
-
markdown: pathnameToCheck.markdown,
|
|
836181
|
-
workspaceAbsoluteFilePath: workspace.absoluteFilePath,
|
|
836182
|
-
pageSlugs: visitableSlugs,
|
|
836183
|
-
absoluteFilePathsToSlugs,
|
|
836184
|
-
redirects: workspace.config.redirects,
|
|
836185
|
-
baseUrl
|
|
836186
|
-
});
|
|
836187
|
-
if (exists2 === true) {
|
|
836188
|
-
return [];
|
|
836189
|
-
}
|
|
836190
|
-
return exists2.map((brokenPathname) => {
|
|
836191
|
-
const [message, relFilePath] = createLinkViolationMessage({
|
|
836192
|
-
pathnameToCheck,
|
|
836193
|
-
targetPathname: brokenPathname,
|
|
836194
|
-
absoluteFilepathToWorkspace: workspace.absoluteFilePath
|
|
836195
|
-
});
|
|
836196
|
-
return {
|
|
836197
|
-
name: ValidMarkdownLinks.name,
|
|
836198
|
-
severity: "error",
|
|
836199
|
-
message,
|
|
836200
|
-
relFilepath: relFilePath
|
|
836201
|
-
};
|
|
836202
|
-
});
|
|
836203
|
-
}));
|
|
836204
|
-
violations.push(...pathToCheckViolations.flat());
|
|
836524
|
+
const uniquePathnames = /* @__PURE__ */ new Map();
|
|
836525
|
+
for (const description of uniqueDescriptions) {
|
|
836526
|
+
const { pathnamesToCheck, violations: descriptionViolations } = collectPathnamesToCheck(description, { instanceUrls });
|
|
836527
|
+
violations.push(...descriptionViolations);
|
|
836528
|
+
for (const p10 of pathnamesToCheck) {
|
|
836529
|
+
if (!uniquePathnames.has(p10.pathname)) {
|
|
836530
|
+
uniquePathnames.set(p10.pathname, p10);
|
|
836531
|
+
}
|
|
836205
836532
|
}
|
|
836206
836533
|
}
|
|
836534
|
+
const pathToCheckViolations = await Promise.all([...uniquePathnames.values()].map(async (pathnameToCheck) => {
|
|
836535
|
+
const exists2 = await checkIfPathnameExists({
|
|
836536
|
+
pathname: pathnameToCheck.pathname,
|
|
836537
|
+
markdown: pathnameToCheck.markdown,
|
|
836538
|
+
workspaceAbsoluteFilePath: workspace.absoluteFilePath,
|
|
836539
|
+
pageSlugs: visitableSlugs,
|
|
836540
|
+
absoluteFilePathsToSlugs,
|
|
836541
|
+
redirects: workspace.config.redirects,
|
|
836542
|
+
baseUrl
|
|
836543
|
+
});
|
|
836544
|
+
if (exists2 === true) {
|
|
836545
|
+
return [];
|
|
836546
|
+
}
|
|
836547
|
+
return exists2.map((brokenPathname) => {
|
|
836548
|
+
const [message, relFilePath] = createLinkViolationMessage({
|
|
836549
|
+
pathnameToCheck,
|
|
836550
|
+
targetPathname: brokenPathname,
|
|
836551
|
+
absoluteFilepathToWorkspace: workspace.absoluteFilePath
|
|
836552
|
+
});
|
|
836553
|
+
return {
|
|
836554
|
+
name: ValidMarkdownLinks.name,
|
|
836555
|
+
severity: "error",
|
|
836556
|
+
message,
|
|
836557
|
+
relFilepath: relFilePath
|
|
836558
|
+
};
|
|
836559
|
+
});
|
|
836560
|
+
}));
|
|
836561
|
+
violations.push(...pathToCheckViolations.flat());
|
|
836207
836562
|
return violations;
|
|
836208
836563
|
}
|
|
836209
836564
|
};
|
|
@@ -836228,15 +836583,13 @@ function toLatest(apiDefinition) {
|
|
|
836228
836583
|
const latest2 = api_definition_exports.ApiDefinitionV1ToLatest.from(apiDefinition).migrate();
|
|
836229
836584
|
return latest2;
|
|
836230
836585
|
}
|
|
836231
|
-
|
|
836232
|
-
const
|
|
836586
|
+
function collectUniqueDescriptions(apiDefinition) {
|
|
836587
|
+
const set25 = /* @__PURE__ */ new Set();
|
|
836233
836588
|
api_definition_exports.Transformer.descriptions((description) => {
|
|
836234
|
-
|
|
836235
|
-
descriptions.push(description);
|
|
836236
|
-
}
|
|
836589
|
+
set25.add(description);
|
|
836237
836590
|
return description;
|
|
836238
836591
|
}).apiDefinition(apiDefinition);
|
|
836239
|
-
return
|
|
836592
|
+
return set25;
|
|
836240
836593
|
}
|
|
836241
836594
|
|
|
836242
836595
|
// ../yaml/docs-validator/lib/rules/validate-product-file/validate-product-file.js
|
|
@@ -840794,7 +841147,7 @@ var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
|
840794
841147
|
var LOGS_FOLDER_NAME = "logs";
|
|
840795
841148
|
var MAX_LOGS_DIR_SIZE_BYTES = 100 * 1024 * 1024;
|
|
840796
841149
|
function getCliSource() {
|
|
840797
|
-
const version7 = "4.65.
|
|
841150
|
+
const version7 = "4.65.1-2-g1c055b8c2af";
|
|
840798
841151
|
return `cli@${version7}`;
|
|
840799
841152
|
}
|
|
840800
841153
|
var DebugLogger = class {
|
|
@@ -851992,7 +852345,7 @@ var LegacyDocsPublisher = class {
|
|
|
851992
852345
|
previewId,
|
|
851993
852346
|
disableTemplates: void 0,
|
|
851994
852347
|
skipUpload,
|
|
851995
|
-
cliVersion: "4.65.
|
|
852348
|
+
cliVersion: "4.65.1-2-g1c055b8c2af"
|
|
851996
852349
|
});
|
|
851997
852350
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
851998
852351
|
return { success: false };
|
|
@@ -872557,10 +872910,16 @@ var DynamicLiteralMapper = class extends WithGeneration {
|
|
|
872557
872910
|
}
|
|
872558
872911
|
findMatchingUndiscriminatedUnionType({ undiscriminatedUnion: undiscriminatedUnion20, value }) {
|
|
872559
872912
|
for (const typeReference2 of undiscriminatedUnion20.types) {
|
|
872913
|
+
const errorsBefore = this.context.errors.size();
|
|
872560
872914
|
try {
|
|
872561
872915
|
const typeLiteral = this.convert({ typeReference: typeReference2, value });
|
|
872916
|
+
if (is9.Literal.nop(typeLiteral) || this.context.errors.size() > errorsBefore) {
|
|
872917
|
+
this.context.errors.truncate(errorsBefore);
|
|
872918
|
+
continue;
|
|
872919
|
+
}
|
|
872562
872920
|
return { valueTypeReference: typeReference2, typeLiteral };
|
|
872563
872921
|
} catch (e6) {
|
|
872922
|
+
this.context.errors.truncate(errorsBefore);
|
|
872564
872923
|
continue;
|
|
872565
872924
|
}
|
|
872566
872925
|
}
|
|
@@ -875981,13 +876340,16 @@ var DynamicTypeInstantiationMapper = class {
|
|
|
875981
876340
|
}
|
|
875982
876341
|
findMatchingUndiscriminatedUnionType({ undiscriminatedUnion: undiscriminatedUnion20, value }) {
|
|
875983
876342
|
for (const typeReference2 of undiscriminatedUnion20.types) {
|
|
876343
|
+
const errorsBefore = this.context.errors.size();
|
|
875984
876344
|
try {
|
|
875985
876345
|
const typeInstantiation = this.convert({ typeReference: typeReference2, value });
|
|
875986
|
-
if (go_exports.TypeInstantiation.isNop(typeInstantiation)) {
|
|
876346
|
+
if (go_exports.TypeInstantiation.isNop(typeInstantiation) || this.context.errors.size() > errorsBefore) {
|
|
876347
|
+
this.context.errors.truncate(errorsBefore);
|
|
875987
876348
|
continue;
|
|
875988
876349
|
}
|
|
875989
876350
|
return { valueTypeReference: typeReference2, typeInstantiation };
|
|
875990
876351
|
} catch (e6) {
|
|
876352
|
+
this.context.errors.truncate(errorsBefore);
|
|
875991
876353
|
continue;
|
|
875992
876354
|
}
|
|
875993
876355
|
}
|
|
@@ -879191,40 +879553,29 @@ var DynamicTypeLiteralMapper = class {
|
|
|
879191
879553
|
}));
|
|
879192
879554
|
}
|
|
879193
879555
|
findMatchingUndiscriminatedUnionType({ undiscriminatedUnion: undiscriminatedUnion20, value }) {
|
|
879194
|
-
const attemptedVariants = [];
|
|
879195
|
-
const variantErrors = [];
|
|
879196
879556
|
for (const typeReference2 of undiscriminatedUnion20.types) {
|
|
879197
879557
|
const errorsBefore = this.context.errors.size();
|
|
879198
879558
|
try {
|
|
879199
|
-
attemptedVariants.push(JSON.stringify(typeReference2));
|
|
879200
879559
|
const typeInstantiation = this.convert({
|
|
879201
879560
|
typeReference: typeReference2,
|
|
879202
879561
|
value,
|
|
879203
879562
|
inUndiscriminatedUnion: true
|
|
879204
879563
|
});
|
|
879205
|
-
if (java_exports.TypeLiteral.isNop(typeInstantiation)) {
|
|
879564
|
+
if (java_exports.TypeLiteral.isNop(typeInstantiation) || this.context.errors.size() > errorsBefore) {
|
|
879206
879565
|
this.context.errors.truncate(errorsBefore);
|
|
879207
879566
|
continue;
|
|
879208
879567
|
}
|
|
879209
879568
|
return { valueTypeReference: typeReference2, typeInstantiation };
|
|
879210
879569
|
} catch (e6) {
|
|
879211
879570
|
this.context.errors.truncate(errorsBefore);
|
|
879212
|
-
variantErrors.push(`Type ${JSON.stringify(typeReference2)}: ${extractErrorMessage(e6)}`);
|
|
879213
879571
|
continue;
|
|
879214
879572
|
}
|
|
879215
879573
|
}
|
|
879216
879574
|
this.context.errors.add({
|
|
879217
879575
|
severity: Severity.Critical,
|
|
879218
|
-
message: `None of the types in the undiscriminated union matched the given "${typeof value}" value
|
|
879576
|
+
message: `None of the types in the undiscriminated union matched the given "${typeof value}" value`
|
|
879219
879577
|
});
|
|
879220
|
-
|
|
879221
|
-
const detailedErrors = variantErrors.map((error50, index3) => ` ${index3 + 1}. ${error50}`).join("\n");
|
|
879222
|
-
throw new Error(`Failed to match undiscriminated union "${unionName}" for ${typeof value} value.
|
|
879223
|
-
Value: ${JSON.stringify(value)}
|
|
879224
|
-
Attempted ${attemptedVariants.length} variants:
|
|
879225
|
-
${detailedErrors}
|
|
879226
|
-
|
|
879227
|
-
This prevents invalid snippet code generation that would cause formatter errors.`);
|
|
879578
|
+
return void 0;
|
|
879228
879579
|
}
|
|
879229
879580
|
getUndiscriminatedUnionFieldName({ typeReference: typeReference2 }) {
|
|
879230
879581
|
switch (typeReference2.type) {
|
|
@@ -901436,7 +901787,7 @@ var DynamicTypeLiteralMapper7 = class {
|
|
|
901436
901787
|
const errorsBefore = this.context.errors.size();
|
|
901437
901788
|
try {
|
|
901438
901789
|
const result = this.convert({ typeReference: typeReference2, value, convertOpts });
|
|
901439
|
-
if (typescript_exports.TypeLiteral.isNop(result)) {
|
|
901790
|
+
if (typescript_exports.TypeLiteral.isNop(result) || this.context.errors.size() > errorsBefore) {
|
|
901440
901791
|
this.context.errors.truncate(errorsBefore);
|
|
901441
901792
|
continue;
|
|
901442
901793
|
}
|
|
@@ -925583,7 +925934,7 @@ var CliContext = class {
|
|
|
925583
925934
|
if (false) {
|
|
925584
925935
|
this.logger.error("CLI_VERSION is not defined");
|
|
925585
925936
|
}
|
|
925586
|
-
return "4.65.
|
|
925937
|
+
return "4.65.1-2-g1c055b8c2af";
|
|
925587
925938
|
}
|
|
925588
925939
|
getCliName() {
|
|
925589
925940
|
if (false) {
|
package/package.json
CHANGED