@fern-api/fern-api-dev 4.62.2 → 4.62.3-11-g47af2473afa
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 +707 -85
- package/package.json +1 -1
package/cli.cjs
CHANGED
|
@@ -363452,9 +363452,9 @@ var require_diff3 = __commonJS({
|
|
|
363452
363452
|
}
|
|
363453
363453
|
});
|
|
363454
363454
|
|
|
363455
|
-
// ../../../node_modules/.pnpm/@fern-api+replay@0.
|
|
363455
|
+
// ../../../node_modules/.pnpm/@fern-api+replay@0.9.0/node_modules/@fern-api/replay/dist/index.cjs
|
|
363456
363456
|
var require_dist11 = __commonJS({
|
|
363457
|
-
"../../../node_modules/.pnpm/@fern-api+replay@0.
|
|
363457
|
+
"../../../node_modules/.pnpm/@fern-api+replay@0.9.0/node_modules/@fern-api/replay/dist/index.cjs"(exports2, module4) {
|
|
363458
363458
|
"use strict";
|
|
363459
363459
|
var __defProp4 = Object.defineProperty;
|
|
363460
363460
|
var __getOwnPropDesc4 = Object.getOwnPropertyDescriptor;
|
|
@@ -363631,7 +363631,7 @@ var require_dist11 = __commonJS({
|
|
|
363631
363631
|
return commit.message.startsWith("[fern-replay]");
|
|
363632
363632
|
}
|
|
363633
363633
|
function isRevertCommit(message) {
|
|
363634
|
-
return
|
|
363634
|
+
return /^Revert ".+"$/.test(message);
|
|
363635
363635
|
}
|
|
363636
363636
|
function parseRevertedSha(fullBody) {
|
|
363637
363637
|
const match3 = fullBody.match(/This reverts commit ([0-9a-f]{40})\./);
|
|
@@ -363730,6 +363730,15 @@ var require_dist11 = __commonJS({
|
|
|
363730
363730
|
this.ensureLoaded();
|
|
363731
363731
|
this.lock.patches = [];
|
|
363732
363732
|
}
|
|
363733
|
+
addForgottenHash(hash5) {
|
|
363734
|
+
this.ensureLoaded();
|
|
363735
|
+
if (!this.lock.forgotten_hashes) {
|
|
363736
|
+
this.lock.forgotten_hashes = [];
|
|
363737
|
+
}
|
|
363738
|
+
if (!this.lock.forgotten_hashes.includes(hash5)) {
|
|
363739
|
+
this.lock.forgotten_hashes.push(hash5);
|
|
363740
|
+
}
|
|
363741
|
+
}
|
|
363733
363742
|
getUnresolvedPatches() {
|
|
363734
363743
|
this.ensureLoaded();
|
|
363735
363744
|
return this.lock.patches.filter((p10) => p10.status === "unresolved");
|
|
@@ -363824,6 +363833,7 @@ var require_dist11 = __commonJS({
|
|
|
363824
363833
|
}
|
|
363825
363834
|
const commits = this.parseGitLog(log4);
|
|
363826
363835
|
const newPatches = [];
|
|
363836
|
+
const forgottenHashes = new Set(lock.forgotten_hashes ?? []);
|
|
363827
363837
|
for (const commit of commits) {
|
|
363828
363838
|
if (isGenerationCommit(commit)) {
|
|
363829
363839
|
continue;
|
|
@@ -363837,7 +363847,7 @@ var require_dist11 = __commonJS({
|
|
|
363837
363847
|
}
|
|
363838
363848
|
const patchContent = await this.git.formatPatch(commit.sha);
|
|
363839
363849
|
const contentHash = this.computeContentHash(patchContent);
|
|
363840
|
-
if (lock.patches.find((p10) => p10.content_hash === contentHash)) {
|
|
363850
|
+
if (lock.patches.find((p10) => p10.content_hash === contentHash) || forgottenHashes.has(contentHash)) {
|
|
363841
363851
|
continue;
|
|
363842
363852
|
}
|
|
363843
363853
|
const filesOutput = await this.git.exec(["diff-tree", "--no-commit-id", "--name-only", "-r", commit.sha]);
|
|
@@ -363907,6 +363917,9 @@ var require_dist11 = __commonJS({
|
|
|
363907
363917
|
revertIndicesToRemove.add(idx);
|
|
363908
363918
|
}
|
|
363909
363919
|
}
|
|
363920
|
+
if (!matchedExisting && !matchedNew) {
|
|
363921
|
+
revertIndicesToRemove.add(i11);
|
|
363922
|
+
}
|
|
363910
363923
|
}
|
|
363911
363924
|
const filteredPatches = newPatches.filter((_16, i11) => !revertIndicesToRemove.has(i11));
|
|
363912
363925
|
return { patches: filteredPatches, revertedPatchIds: [...revertedPatchIdSet] };
|
|
@@ -363933,7 +363946,7 @@ var require_dist11 = __commonJS({
|
|
|
363933
363946
|
if (!diff2.trim()) return { patches: [], revertedPatchIds: [] };
|
|
363934
363947
|
const contentHash = this.computeContentHash(diff2);
|
|
363935
363948
|
const lock = this.lockManager.read();
|
|
363936
|
-
if (lock.patches.some((p10) => p10.content_hash === contentHash)) {
|
|
363949
|
+
if (lock.patches.some((p10) => p10.content_hash === contentHash) || (lock.forgotten_hashes ?? []).includes(contentHash)) {
|
|
363937
363950
|
return { patches: [], revertedPatchIds: [] };
|
|
363938
363951
|
}
|
|
363939
363952
|
const headSha = (await this.git.exec(["rev-parse", "HEAD"])).trim();
|
|
@@ -363999,6 +364012,32 @@ var require_dist11 = __commonJS({
|
|
|
363999
364012
|
var import_node_os15 = require("os");
|
|
364000
364013
|
var import_node_path210 = require("path");
|
|
364001
364014
|
var import_minimatch8 = require_commonjs3();
|
|
364015
|
+
function stripConflictMarkers(content5) {
|
|
364016
|
+
const lines = content5.split("\n");
|
|
364017
|
+
const result = [];
|
|
364018
|
+
let inConflict = false;
|
|
364019
|
+
let inOurs = false;
|
|
364020
|
+
for (const line of lines) {
|
|
364021
|
+
if (line.startsWith("<<<<<<< ")) {
|
|
364022
|
+
inConflict = true;
|
|
364023
|
+
inOurs = true;
|
|
364024
|
+
continue;
|
|
364025
|
+
}
|
|
364026
|
+
if (inConflict && line === "=======") {
|
|
364027
|
+
inOurs = false;
|
|
364028
|
+
continue;
|
|
364029
|
+
}
|
|
364030
|
+
if (inConflict && line.startsWith(">>>>>>> ")) {
|
|
364031
|
+
inConflict = false;
|
|
364032
|
+
inOurs = false;
|
|
364033
|
+
continue;
|
|
364034
|
+
}
|
|
364035
|
+
if (!inConflict || inOurs) {
|
|
364036
|
+
result.push(line);
|
|
364037
|
+
}
|
|
364038
|
+
}
|
|
364039
|
+
return result.join("\n");
|
|
364040
|
+
}
|
|
364002
364041
|
var BINARY_EXTENSIONS2 = /* @__PURE__ */ new Set([
|
|
364003
364042
|
".png",
|
|
364004
364043
|
".jpg",
|
|
@@ -364070,7 +364109,8 @@ var require_dist11 = __commonJS({
|
|
|
364070
364109
|
async applyPatches(patches) {
|
|
364071
364110
|
this.resetAccumulator();
|
|
364072
364111
|
const results = [];
|
|
364073
|
-
for (
|
|
364112
|
+
for (let i11 = 0; i11 < patches.length; i11++) {
|
|
364113
|
+
const patch5 = patches[i11];
|
|
364074
364114
|
if (this.isExcluded(patch5)) {
|
|
364075
364115
|
results.push({
|
|
364076
364116
|
patch: patch5,
|
|
@@ -364081,6 +364121,33 @@ var require_dist11 = __commonJS({
|
|
|
364081
364121
|
}
|
|
364082
364122
|
const result = await this.applyPatchWithFallback(patch5);
|
|
364083
364123
|
results.push(result);
|
|
364124
|
+
if (result.status === "conflict" && result.fileResults) {
|
|
364125
|
+
const laterFiles = /* @__PURE__ */ new Set();
|
|
364126
|
+
for (let j16 = i11 + 1; j16 < patches.length; j16++) {
|
|
364127
|
+
for (const f10 of patches[j16].files) {
|
|
364128
|
+
laterFiles.add(f10);
|
|
364129
|
+
}
|
|
364130
|
+
}
|
|
364131
|
+
const resolvedToOriginal = /* @__PURE__ */ new Map();
|
|
364132
|
+
if (result.resolvedFiles) {
|
|
364133
|
+
for (const [orig, resolved] of Object.entries(result.resolvedFiles)) {
|
|
364134
|
+
resolvedToOriginal.set(resolved, orig);
|
|
364135
|
+
}
|
|
364136
|
+
}
|
|
364137
|
+
for (const fileResult of result.fileResults) {
|
|
364138
|
+
if (fileResult.status !== "conflict") continue;
|
|
364139
|
+
const originalPath = resolvedToOriginal.get(fileResult.file) ?? fileResult.file;
|
|
364140
|
+
if (laterFiles.has(fileResult.file) || laterFiles.has(originalPath)) {
|
|
364141
|
+
const filePath = (0, import_node_path210.join)(this.outputDir, fileResult.file);
|
|
364142
|
+
try {
|
|
364143
|
+
const content5 = await (0, import_promises181.readFile)(filePath, "utf-8");
|
|
364144
|
+
const stripped = stripConflictMarkers(content5);
|
|
364145
|
+
await (0, import_promises181.writeFile)(filePath, stripped);
|
|
364146
|
+
} catch {
|
|
364147
|
+
}
|
|
364148
|
+
}
|
|
364149
|
+
}
|
|
364150
|
+
}
|
|
364084
364151
|
}
|
|
364085
364152
|
return results;
|
|
364086
364153
|
}
|
|
@@ -364099,7 +364166,7 @@ var require_dist11 = __commonJS({
|
|
|
364099
364166
|
const resolvedPath = await this.resolveFilePath(filePath, baseGen.tree_hash, currentTreeHash);
|
|
364100
364167
|
const base4 = await this.git.showFile(baseGen.tree_hash, filePath);
|
|
364101
364168
|
const theirs = await this.applyPatchToContent(base4, patch5.patch_content, filePath, tempGit, tempDir2);
|
|
364102
|
-
if (theirs
|
|
364169
|
+
if (theirs) {
|
|
364103
364170
|
this.fileTheirsAccumulator.set(resolvedPath, {
|
|
364104
364171
|
content: theirs,
|
|
364105
364172
|
baseGeneration: patch5.base_generation
|
|
@@ -364231,7 +364298,7 @@ var require_dist11 = __commonJS({
|
|
|
364231
364298
|
);
|
|
364232
364299
|
let useAccumulatorAsMergeBase = false;
|
|
364233
364300
|
const accumulatorEntry = this.fileTheirsAccumulator.get(resolvedPath);
|
|
364234
|
-
if (!theirs &&
|
|
364301
|
+
if (!theirs && accumulatorEntry) {
|
|
364235
364302
|
theirs = await this.applyPatchToContent(
|
|
364236
364303
|
accumulatorEntry.content,
|
|
364237
364304
|
patch5.patch_content,
|
|
@@ -364290,7 +364357,7 @@ var require_dist11 = __commonJS({
|
|
|
364290
364357
|
reason: "missing-content"
|
|
364291
364358
|
};
|
|
364292
364359
|
}
|
|
364293
|
-
if (!base4 || !ours) {
|
|
364360
|
+
if (!base4 && !useAccumulatorAsMergeBase || !ours) {
|
|
364294
364361
|
return {
|
|
364295
364362
|
file: resolvedPath,
|
|
364296
364363
|
status: "skipped",
|
|
@@ -364298,11 +364365,18 @@ var require_dist11 = __commonJS({
|
|
|
364298
364365
|
};
|
|
364299
364366
|
}
|
|
364300
364367
|
const mergeBase = useAccumulatorAsMergeBase && accumulatorEntry ? accumulatorEntry.content : base4;
|
|
364368
|
+
if (mergeBase == null) {
|
|
364369
|
+
return {
|
|
364370
|
+
file: resolvedPath,
|
|
364371
|
+
status: "skipped",
|
|
364372
|
+
reason: "missing-content"
|
|
364373
|
+
};
|
|
364374
|
+
}
|
|
364301
364375
|
const merged = threeWayMerge(mergeBase, ours, effective_theirs);
|
|
364302
364376
|
const outDir = (0, import_node_path210.dirname)(oursPath);
|
|
364303
364377
|
await (0, import_promises181.mkdir)(outDir, { recursive: true });
|
|
364304
364378
|
await (0, import_promises181.writeFile)(oursPath, merged.content);
|
|
364305
|
-
if (effective_theirs
|
|
364379
|
+
if (effective_theirs) {
|
|
364306
364380
|
this.fileTheirsAccumulator.set(resolvedPath, {
|
|
364307
364381
|
content: effective_theirs,
|
|
364308
364382
|
baseGeneration: patch5.base_generation
|
|
@@ -364541,32 +364615,6 @@ CLI Version: ${options2.cliVersion}`;
|
|
|
364541
364615
|
var import_node_path310 = require("path");
|
|
364542
364616
|
var import_minimatch22 = require_commonjs3();
|
|
364543
364617
|
init_GitClient();
|
|
364544
|
-
function stripConflictMarkers(content5) {
|
|
364545
|
-
const lines = content5.split("\n");
|
|
364546
|
-
const result = [];
|
|
364547
|
-
let inConflict = false;
|
|
364548
|
-
let inOurs = false;
|
|
364549
|
-
for (const line of lines) {
|
|
364550
|
-
if (line.startsWith("<<<<<<< ")) {
|
|
364551
|
-
inConflict = true;
|
|
364552
|
-
inOurs = true;
|
|
364553
|
-
continue;
|
|
364554
|
-
}
|
|
364555
|
-
if (inConflict && line === "=======") {
|
|
364556
|
-
inOurs = false;
|
|
364557
|
-
continue;
|
|
364558
|
-
}
|
|
364559
|
-
if (inConflict && line.startsWith(">>>>>>> ")) {
|
|
364560
|
-
inConflict = false;
|
|
364561
|
-
inOurs = false;
|
|
364562
|
-
continue;
|
|
364563
|
-
}
|
|
364564
|
-
if (!inConflict || inOurs) {
|
|
364565
|
-
result.push(line);
|
|
364566
|
-
}
|
|
364567
|
-
}
|
|
364568
|
-
return result.join("\n");
|
|
364569
|
-
}
|
|
364570
364618
|
var ReplayService = class {
|
|
364571
364619
|
git;
|
|
364572
364620
|
detector;
|
|
@@ -365528,30 +365576,145 @@ CLI Version: ${options2.cliVersion}`;
|
|
|
365528
365576
|
return `sha256:${(0, import_node_crypto32.createHash)("sha256").update(normalized).digest("hex")}`;
|
|
365529
365577
|
}
|
|
365530
365578
|
var import_minimatch42 = require_commonjs3();
|
|
365531
|
-
function
|
|
365579
|
+
function parseDiffStat(patchContent) {
|
|
365580
|
+
let additions = 0;
|
|
365581
|
+
let deletions = 0;
|
|
365582
|
+
let inDiffHunk = false;
|
|
365583
|
+
for (const line of patchContent.split("\n")) {
|
|
365584
|
+
if (line.startsWith("diff --git ")) {
|
|
365585
|
+
inDiffHunk = true;
|
|
365586
|
+
continue;
|
|
365587
|
+
}
|
|
365588
|
+
if (!inDiffHunk) continue;
|
|
365589
|
+
if (line.startsWith("+") && !line.startsWith("+++")) {
|
|
365590
|
+
additions++;
|
|
365591
|
+
} else if (line.startsWith("-") && !line.startsWith("---")) {
|
|
365592
|
+
deletions++;
|
|
365593
|
+
}
|
|
365594
|
+
}
|
|
365595
|
+
return { additions, deletions };
|
|
365596
|
+
}
|
|
365597
|
+
function toMatchedPatch(patch5) {
|
|
365598
|
+
return {
|
|
365599
|
+
id: patch5.id,
|
|
365600
|
+
message: patch5.original_message,
|
|
365601
|
+
files: patch5.files,
|
|
365602
|
+
diffstat: parseDiffStat(patch5.patch_content),
|
|
365603
|
+
...patch5.status ? { status: patch5.status } : {}
|
|
365604
|
+
};
|
|
365605
|
+
}
|
|
365606
|
+
function matchesPatch(patch5, pattern) {
|
|
365607
|
+
const fileMatch = patch5.files.some(
|
|
365608
|
+
(file4) => file4 === pattern || (0, import_minimatch42.minimatch)(file4, pattern)
|
|
365609
|
+
);
|
|
365610
|
+
if (fileMatch) return true;
|
|
365611
|
+
return patch5.original_message.toLowerCase().includes(pattern.toLowerCase());
|
|
365612
|
+
}
|
|
365613
|
+
function buildWarnings(patches) {
|
|
365614
|
+
const warnings = [];
|
|
365615
|
+
for (const patch5 of patches) {
|
|
365616
|
+
if (patch5.status === "resolving") {
|
|
365617
|
+
warnings.push(
|
|
365618
|
+
`patch ${patch5.id} has conflict markers in these files: ${patch5.files.join(", ")}. Run \`git checkout -- <files>\` to restore the generated versions.`
|
|
365619
|
+
);
|
|
365620
|
+
} else if (patch5.status === "unresolved") {
|
|
365621
|
+
warnings.push(
|
|
365622
|
+
`patch ${patch5.id} had unresolved conflicts (files: ${patch5.files.join(", ")}).`
|
|
365623
|
+
);
|
|
365624
|
+
}
|
|
365625
|
+
}
|
|
365626
|
+
return warnings;
|
|
365627
|
+
}
|
|
365628
|
+
var EMPTY_RESULT = {
|
|
365629
|
+
initialized: false,
|
|
365630
|
+
removed: [],
|
|
365631
|
+
remaining: 0,
|
|
365632
|
+
notFound: false,
|
|
365633
|
+
alreadyForgotten: [],
|
|
365634
|
+
totalPatches: 0,
|
|
365635
|
+
warnings: []
|
|
365636
|
+
};
|
|
365637
|
+
function forget(outputDir, options2) {
|
|
365532
365638
|
const lockManager = new LockfileManager(outputDir);
|
|
365533
365639
|
if (!lockManager.exists()) {
|
|
365534
|
-
return {
|
|
365640
|
+
return { ...EMPTY_RESULT };
|
|
365535
365641
|
}
|
|
365536
365642
|
const lock = lockManager.read();
|
|
365537
|
-
const
|
|
365538
|
-
|
|
365539
|
-
|
|
365540
|
-
|
|
365541
|
-
|
|
365643
|
+
const totalPatches = lock.patches.length;
|
|
365644
|
+
if (options2?.all) {
|
|
365645
|
+
const removed = lock.patches.map(toMatchedPatch);
|
|
365646
|
+
const warnings = buildWarnings(lock.patches);
|
|
365647
|
+
if (!options2.dryRun) {
|
|
365648
|
+
for (const patch5 of lock.patches) {
|
|
365649
|
+
lockManager.addForgottenHash(patch5.content_hash);
|
|
365650
|
+
}
|
|
365651
|
+
lockManager.clearPatches();
|
|
365652
|
+
lockManager.save();
|
|
365653
|
+
}
|
|
365654
|
+
return {
|
|
365655
|
+
initialized: true,
|
|
365656
|
+
removed,
|
|
365657
|
+
remaining: 0,
|
|
365658
|
+
notFound: false,
|
|
365659
|
+
alreadyForgotten: [],
|
|
365660
|
+
totalPatches,
|
|
365661
|
+
warnings
|
|
365662
|
+
};
|
|
365542
365663
|
}
|
|
365543
|
-
|
|
365544
|
-
|
|
365545
|
-
|
|
365546
|
-
|
|
365547
|
-
|
|
365548
|
-
|
|
365549
|
-
|
|
365550
|
-
|
|
365664
|
+
if (options2?.patchIds && options2.patchIds.length > 0) {
|
|
365665
|
+
const removed = [];
|
|
365666
|
+
const alreadyForgotten = [];
|
|
365667
|
+
const patchesToRemove = [];
|
|
365668
|
+
for (const id2 of options2.patchIds) {
|
|
365669
|
+
const patch5 = lock.patches.find((p10) => p10.id === id2);
|
|
365670
|
+
if (patch5) {
|
|
365671
|
+
removed.push(toMatchedPatch(patch5));
|
|
365672
|
+
patchesToRemove.push(patch5);
|
|
365673
|
+
} else {
|
|
365674
|
+
alreadyForgotten.push(id2);
|
|
365675
|
+
}
|
|
365551
365676
|
}
|
|
365552
|
-
|
|
365677
|
+
const warnings = buildWarnings(patchesToRemove);
|
|
365678
|
+
if (!options2.dryRun) {
|
|
365679
|
+
for (const patch5 of patchesToRemove) {
|
|
365680
|
+
lockManager.addForgottenHash(patch5.content_hash);
|
|
365681
|
+
lockManager.removePatch(patch5.id);
|
|
365682
|
+
}
|
|
365683
|
+
lockManager.save();
|
|
365684
|
+
}
|
|
365685
|
+
return {
|
|
365686
|
+
initialized: true,
|
|
365687
|
+
removed,
|
|
365688
|
+
remaining: totalPatches - removed.length,
|
|
365689
|
+
notFound: removed.length === 0 && alreadyForgotten.length > 0,
|
|
365690
|
+
alreadyForgotten,
|
|
365691
|
+
totalPatches,
|
|
365692
|
+
warnings
|
|
365693
|
+
};
|
|
365553
365694
|
}
|
|
365554
|
-
|
|
365695
|
+
if (options2?.pattern) {
|
|
365696
|
+
const matched = lock.patches.filter((p10) => matchesPatch(p10, options2.pattern)).map(toMatchedPatch);
|
|
365697
|
+
return {
|
|
365698
|
+
initialized: true,
|
|
365699
|
+
removed: [],
|
|
365700
|
+
remaining: totalPatches,
|
|
365701
|
+
notFound: matched.length === 0,
|
|
365702
|
+
alreadyForgotten: [],
|
|
365703
|
+
totalPatches,
|
|
365704
|
+
warnings: [],
|
|
365705
|
+
matched
|
|
365706
|
+
};
|
|
365707
|
+
}
|
|
365708
|
+
return {
|
|
365709
|
+
initialized: true,
|
|
365710
|
+
removed: [],
|
|
365711
|
+
remaining: totalPatches,
|
|
365712
|
+
notFound: totalPatches === 0,
|
|
365713
|
+
alreadyForgotten: [],
|
|
365714
|
+
totalPatches,
|
|
365715
|
+
warnings: [],
|
|
365716
|
+
matched: lock.patches.map(toMatchedPatch)
|
|
365717
|
+
};
|
|
365555
365718
|
}
|
|
365556
365719
|
var import_node_fs52 = require("fs");
|
|
365557
365720
|
function reset2(outputDir, options2) {
|
|
@@ -365667,24 +365830,49 @@ CLI Version: ${options2.cliVersion}`;
|
|
|
365667
365830
|
function status(outputDir) {
|
|
365668
365831
|
const lockManager = new LockfileManager(outputDir);
|
|
365669
365832
|
if (!lockManager.exists()) {
|
|
365670
|
-
return {
|
|
365833
|
+
return {
|
|
365834
|
+
initialized: false,
|
|
365835
|
+
generationCount: 0,
|
|
365836
|
+
lastGeneration: void 0,
|
|
365837
|
+
patches: [],
|
|
365838
|
+
unresolvedCount: 0,
|
|
365839
|
+
excludePatterns: []
|
|
365840
|
+
};
|
|
365671
365841
|
}
|
|
365672
365842
|
const lock = lockManager.read();
|
|
365673
365843
|
const patches = lock.patches.map((patch5) => ({
|
|
365674
|
-
|
|
365675
|
-
|
|
365844
|
+
id: patch5.id,
|
|
365845
|
+
type: patch5.patch_content.includes("new file mode") ? "added" : "modified",
|
|
365676
365846
|
message: patch5.original_message,
|
|
365677
|
-
|
|
365847
|
+
author: patch5.original_author.split("<")[0]?.trim() || "unknown",
|
|
365848
|
+
sha: patch5.original_commit.slice(0, 7),
|
|
365849
|
+
files: patch5.files,
|
|
365850
|
+
fileCount: patch5.files.length,
|
|
365851
|
+
...patch5.status ? { status: patch5.status } : {}
|
|
365678
365852
|
}));
|
|
365853
|
+
const unresolvedCount = lock.patches.filter(
|
|
365854
|
+
(p10) => p10.status === "unresolved" || p10.status === "resolving"
|
|
365855
|
+
).length;
|
|
365679
365856
|
let lastGeneration;
|
|
365680
365857
|
const lastGen = lock.generations.find((g19) => g19.commit_sha === lock.current_generation);
|
|
365681
365858
|
if (lastGen) {
|
|
365682
365859
|
lastGeneration = {
|
|
365683
|
-
sha: lastGen.commit_sha,
|
|
365684
|
-
timestamp: lastGen.timestamp
|
|
365860
|
+
sha: lastGen.commit_sha.slice(0, 7),
|
|
365861
|
+
timestamp: lastGen.timestamp,
|
|
365862
|
+
cliVersion: lastGen.cli_version,
|
|
365863
|
+
generatorVersions: lastGen.generator_versions
|
|
365685
365864
|
};
|
|
365686
365865
|
}
|
|
365687
|
-
|
|
365866
|
+
const config5 = lockManager.getCustomizationsConfig();
|
|
365867
|
+
const excludePatterns = config5.exclude ?? [];
|
|
365868
|
+
return {
|
|
365869
|
+
initialized: true,
|
|
365870
|
+
generationCount: lock.generations.length,
|
|
365871
|
+
lastGeneration,
|
|
365872
|
+
patches,
|
|
365873
|
+
unresolvedCount,
|
|
365874
|
+
excludePatterns
|
|
365875
|
+
};
|
|
365688
365876
|
}
|
|
365689
365877
|
}
|
|
365690
365878
|
});
|
|
@@ -366044,6 +366232,19 @@ var require_pipeline2 = __commonJS({
|
|
|
366044
366232
|
}
|
|
366045
366233
|
});
|
|
366046
366234
|
|
|
366235
|
+
// ../../generator-cli/lib/replay/replay-forget.js
|
|
366236
|
+
var require_replay_forget = __commonJS({
|
|
366237
|
+
"../../generator-cli/lib/replay/replay-forget.js"(exports2) {
|
|
366238
|
+
"use strict";
|
|
366239
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
366240
|
+
exports2.replayForget = replayForget2;
|
|
366241
|
+
var replay_1 = require_dist11();
|
|
366242
|
+
function replayForget2(params2) {
|
|
366243
|
+
return (0, replay_1.forget)(params2.outputDir, params2.options);
|
|
366244
|
+
}
|
|
366245
|
+
}
|
|
366246
|
+
});
|
|
366247
|
+
|
|
366047
366248
|
// ../../generator-cli/lib/replay/replay-init.js
|
|
366048
366249
|
var require_replay_init = __commonJS({
|
|
366049
366250
|
"../../generator-cli/lib/replay/replay-init.js"(exports2) {
|
|
@@ -366208,12 +366409,25 @@ var require_replay_resolve = __commonJS({
|
|
|
366208
366409
|
}
|
|
366209
366410
|
});
|
|
366210
366411
|
|
|
366412
|
+
// ../../generator-cli/lib/replay/replay-status.js
|
|
366413
|
+
var require_replay_status = __commonJS({
|
|
366414
|
+
"../../generator-cli/lib/replay/replay-status.js"(exports2) {
|
|
366415
|
+
"use strict";
|
|
366416
|
+
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
366417
|
+
exports2.replayStatus = replayStatus2;
|
|
366418
|
+
var replay_1 = require_dist11();
|
|
366419
|
+
function replayStatus2(params2) {
|
|
366420
|
+
return (0, replay_1.status)(params2.outputDir);
|
|
366421
|
+
}
|
|
366422
|
+
}
|
|
366423
|
+
});
|
|
366424
|
+
|
|
366211
366425
|
// ../../generator-cli/lib/api.js
|
|
366212
366426
|
var require_api5 = __commonJS({
|
|
366213
366427
|
"../../generator-cli/lib/api.js"(exports2) {
|
|
366214
366428
|
"use strict";
|
|
366215
366429
|
Object.defineProperty(exports2, "__esModule", { value: true });
|
|
366216
|
-
exports2.replayRun = exports2.replayResolve = exports2.replayInit = exports2.formatBootstrapSummary = exports2.PostGenerationPipeline = exports2.logReplaySummary = exports2.formatReplayPrBody = exports2.consolePipelineLogger = exports2.githubRelease = exports2.githubPush = exports2.githubPr = exports2.generateReferenceToStream = exports2.generateReference = exports2.generateReadmeToStream = exports2.generateReadme = void 0;
|
|
366430
|
+
exports2.replayStatus = exports2.replayRun = exports2.replayResolve = exports2.replayInit = exports2.formatBootstrapSummary = exports2.replayForget = exports2.PostGenerationPipeline = exports2.logReplaySummary = exports2.formatReplayPrBody = exports2.consolePipelineLogger = exports2.githubRelease = exports2.githubPush = exports2.githubPr = exports2.generateReferenceToStream = exports2.generateReference = exports2.generateReadmeToStream = exports2.generateReadme = void 0;
|
|
366217
366431
|
var generate_readme_js_1 = require_generate_readme();
|
|
366218
366432
|
Object.defineProperty(exports2, "generateReadme", { enumerable: true, get: function() {
|
|
366219
366433
|
return generate_readme_js_1.generateReadme;
|
|
@@ -366253,6 +366467,10 @@ var require_api5 = __commonJS({
|
|
|
366253
366467
|
Object.defineProperty(exports2, "PostGenerationPipeline", { enumerable: true, get: function() {
|
|
366254
366468
|
return index_js_1.PostGenerationPipeline;
|
|
366255
366469
|
} });
|
|
366470
|
+
var replay_forget_js_1 = require_replay_forget();
|
|
366471
|
+
Object.defineProperty(exports2, "replayForget", { enumerable: true, get: function() {
|
|
366472
|
+
return replay_forget_js_1.replayForget;
|
|
366473
|
+
} });
|
|
366256
366474
|
var replay_init_js_1 = require_replay_init();
|
|
366257
366475
|
Object.defineProperty(exports2, "formatBootstrapSummary", { enumerable: true, get: function() {
|
|
366258
366476
|
return replay_init_js_1.formatBootstrapSummary;
|
|
@@ -366268,6 +366486,10 @@ var require_api5 = __commonJS({
|
|
|
366268
366486
|
Object.defineProperty(exports2, "replayRun", { enumerable: true, get: function() {
|
|
366269
366487
|
return replay_run_js_1.replayRun;
|
|
366270
366488
|
} });
|
|
366489
|
+
var replay_status_js_1 = require_replay_status();
|
|
366490
|
+
Object.defineProperty(exports2, "replayStatus", { enumerable: true, get: function() {
|
|
366491
|
+
return replay_status_js_1.replayStatus;
|
|
366492
|
+
} });
|
|
366271
366493
|
}
|
|
366272
366494
|
});
|
|
366273
366495
|
|
|
@@ -588535,7 +588757,7 @@ var RequestBodyConverter = class extends converters_exports.AbstractConverters.A
|
|
|
588535
588757
|
contentType
|
|
588536
588758
|
});
|
|
588537
588759
|
if (convertedSchema == null) {
|
|
588538
|
-
return
|
|
588760
|
+
return this.handleSchemalessJsonContent({ contentType, mediaTypeObject });
|
|
588539
588761
|
}
|
|
588540
588762
|
const requestBodyTypeShape = convertedSchema.schema?.typeDeclaration.shape;
|
|
588541
588763
|
if (requestBodyTypeShape?.type === "object") {
|
|
@@ -588591,6 +588813,55 @@ var RequestBodyConverter = class extends converters_exports.AbstractConverters.A
|
|
|
588591
588813
|
};
|
|
588592
588814
|
}
|
|
588593
588815
|
}
|
|
588816
|
+
/**
|
|
588817
|
+
* Handles JSON request bodies that have no schema but DO have native OpenAPI
|
|
588818
|
+
* examples. Creates an unknown-typed reference request body so that examples
|
|
588819
|
+
* are preserved for docs rendering and code snippet generation.
|
|
588820
|
+
*/
|
|
588821
|
+
handleSchemalessJsonContent({ contentType, mediaTypeObject }) {
|
|
588822
|
+
const hasExamples = mediaTypeObject.example != null || mediaTypeObject.examples != null && Object.keys(mediaTypeObject.examples).length > 0;
|
|
588823
|
+
if (!hasExamples) {
|
|
588824
|
+
return void 0;
|
|
588825
|
+
}
|
|
588826
|
+
const v2Examples = {
|
|
588827
|
+
userSpecifiedExamples: {},
|
|
588828
|
+
autogeneratedExamples: {}
|
|
588829
|
+
};
|
|
588830
|
+
const examples = this.context.getNamedExamplesFromMediaTypeObject({
|
|
588831
|
+
mediaTypeObject,
|
|
588832
|
+
breadcrumbs: this.breadcrumbs,
|
|
588833
|
+
defaultExampleName: `${[...this.group, this.method].join("_")}_example`
|
|
588834
|
+
});
|
|
588835
|
+
const usedExampleNames = /* @__PURE__ */ new Set();
|
|
588836
|
+
for (const [key2, example] of examples) {
|
|
588837
|
+
const resolvedExample = this.context.resolveExampleWithValue(example);
|
|
588838
|
+
const resolvedExampleObject = this.context.resolveExampleRecursively({
|
|
588839
|
+
example,
|
|
588840
|
+
breadcrumbs: this.breadcrumbs
|
|
588841
|
+
});
|
|
588842
|
+
let exampleName = key2;
|
|
588843
|
+
if (this.context.isExampleWithSummary(resolvedExampleObject)) {
|
|
588844
|
+
const summary = resolvedExampleObject.summary;
|
|
588845
|
+
if (!usedExampleNames.has(summary)) {
|
|
588846
|
+
exampleName = summary;
|
|
588847
|
+
}
|
|
588848
|
+
}
|
|
588849
|
+
usedExampleNames.add(exampleName);
|
|
588850
|
+
if (resolvedExample != null) {
|
|
588851
|
+
v2Examples.userSpecifiedExamples[exampleName] = resolvedExample;
|
|
588852
|
+
}
|
|
588853
|
+
}
|
|
588854
|
+
return {
|
|
588855
|
+
requestBody: HttpRequestBody.reference({
|
|
588856
|
+
contentType,
|
|
588857
|
+
docs: this.description,
|
|
588858
|
+
requestBodyType: TypeReference2.unknown(),
|
|
588859
|
+
v2Examples
|
|
588860
|
+
}),
|
|
588861
|
+
streamRequestBody: void 0,
|
|
588862
|
+
inlinedTypes: {}
|
|
588863
|
+
};
|
|
588864
|
+
}
|
|
588594
588865
|
handleMultipartContent({ contentType }) {
|
|
588595
588866
|
const mediaTypeObject = this.mediaType;
|
|
588596
588867
|
if (mediaTypeObject == null || mediaTypeObject.schema == null) {
|
|
@@ -590440,6 +590711,18 @@ var OperationConverter = class _OperationConverter extends AbstractOperationConv
|
|
|
590440
590711
|
httpMethod,
|
|
590441
590712
|
baseUrl
|
|
590442
590713
|
});
|
|
590714
|
+
if (Object.keys(fernExamples.examples).length === 0 && Object.keys(fernExamples.streamExamples).length === 0) {
|
|
590715
|
+
const nativeExamples = this.synthesizeEndpointExamplesFromNativeRequestBody({
|
|
590716
|
+
httpPath: path97,
|
|
590717
|
+
httpMethod,
|
|
590718
|
+
baseUrl
|
|
590719
|
+
});
|
|
590720
|
+
if (nativeExamples != null) {
|
|
590721
|
+
for (const [name2, example] of Object.entries(nativeExamples)) {
|
|
590722
|
+
fernExamples.examples[name2] = example;
|
|
590723
|
+
}
|
|
590724
|
+
}
|
|
590725
|
+
}
|
|
590443
590726
|
const endpointLevelSecuritySchemes = new Set(this.operation.security?.flatMap((securityRequirement) => Object.keys(securityRequirement)) ?? []);
|
|
590444
590727
|
const securityHeaders = this.authSchemeToHeaders(Array.from(endpointLevelSecuritySchemes));
|
|
590445
590728
|
if (securityHeaders.length > 0) {
|
|
@@ -590876,6 +591159,107 @@ var OperationConverter = class _OperationConverter extends AbstractOperationConv
|
|
|
590876
591159
|
streamExamples: {}
|
|
590877
591160
|
};
|
|
590878
591161
|
}
|
|
591162
|
+
/**
|
|
591163
|
+
* Synthesizes endpoint-level v2Examples from native OpenAPI request body
|
|
591164
|
+
* examples (mediaType.example / mediaType.examples) when no x-fern-examples
|
|
591165
|
+
* or x-code-samples extensions are present.
|
|
591166
|
+
*
|
|
591167
|
+
* This ensures that specs like Close's, which have native examples on
|
|
591168
|
+
* schemaless request bodies, get rendered in docs and code snippets.
|
|
591169
|
+
*
|
|
591170
|
+
* Also extracts native response examples from the operation's successful (2xx)
|
|
591171
|
+
* responses so that the 200 response panel is preserved in docs.
|
|
591172
|
+
*/
|
|
591173
|
+
synthesizeEndpointExamplesFromNativeRequestBody({ httpPath, httpMethod, baseUrl }) {
|
|
591174
|
+
if (this.operation.requestBody == null) {
|
|
591175
|
+
return void 0;
|
|
591176
|
+
}
|
|
591177
|
+
const resolvedRequestBody = this.context.resolveMaybeReference({
|
|
591178
|
+
schemaOrReference: this.operation.requestBody,
|
|
591179
|
+
breadcrumbs: [...this.breadcrumbs, "requestBody"]
|
|
591180
|
+
});
|
|
591181
|
+
if (resolvedRequestBody == null) {
|
|
591182
|
+
return void 0;
|
|
591183
|
+
}
|
|
591184
|
+
const responseExample = this.extractNativeResponseExample();
|
|
591185
|
+
const result = {};
|
|
591186
|
+
for (const [, mediaType] of Object.entries(resolvedRequestBody.content)) {
|
|
591187
|
+
if (mediaType.schema != null) {
|
|
591188
|
+
continue;
|
|
591189
|
+
}
|
|
591190
|
+
const namedExamples = this.context.getNamedExamplesFromMediaTypeObject({
|
|
591191
|
+
mediaTypeObject: mediaType,
|
|
591192
|
+
breadcrumbs: [...this.breadcrumbs, "requestBody"],
|
|
591193
|
+
defaultExampleName: "Example"
|
|
591194
|
+
});
|
|
591195
|
+
for (const [name2, example] of namedExamples) {
|
|
591196
|
+
const resolvedValue = this.context.resolveExampleWithValue(example);
|
|
591197
|
+
if (resolvedValue != null) {
|
|
591198
|
+
result[name2] = {
|
|
591199
|
+
displayName: void 0,
|
|
591200
|
+
request: {
|
|
591201
|
+
docs: void 0,
|
|
591202
|
+
endpoint: {
|
|
591203
|
+
method: httpMethod,
|
|
591204
|
+
path: this.buildExamplePath(httpPath, {})
|
|
591205
|
+
},
|
|
591206
|
+
baseUrl: void 0,
|
|
591207
|
+
environment: baseUrl,
|
|
591208
|
+
auth: void 0,
|
|
591209
|
+
pathParameters: {},
|
|
591210
|
+
queryParameters: {},
|
|
591211
|
+
headers: {},
|
|
591212
|
+
requestBody: resolvedValue
|
|
591213
|
+
},
|
|
591214
|
+
response: responseExample,
|
|
591215
|
+
codeSamples: void 0
|
|
591216
|
+
};
|
|
591217
|
+
}
|
|
591218
|
+
}
|
|
591219
|
+
}
|
|
591220
|
+
return Object.keys(result).length > 0 ? result : void 0;
|
|
591221
|
+
}
|
|
591222
|
+
/**
|
|
591223
|
+
* Extracts the first native example from the operation's successful (2xx) response.
|
|
591224
|
+
* This is used to populate the response body in synthesized endpoint examples
|
|
591225
|
+
* so that the 200 response panel is preserved in docs.
|
|
591226
|
+
*/
|
|
591227
|
+
extractNativeResponseExample() {
|
|
591228
|
+
if (this.operation.responses == null) {
|
|
591229
|
+
return void 0;
|
|
591230
|
+
}
|
|
591231
|
+
for (const [statusCode, response] of Object.entries(this.operation.responses)) {
|
|
591232
|
+
const statusCodeNum = parseInt(statusCode);
|
|
591233
|
+
if (isNaN(statusCodeNum) || statusCodeNum < 200 || statusCodeNum >= 300) {
|
|
591234
|
+
continue;
|
|
591235
|
+
}
|
|
591236
|
+
const resolvedResponse = this.context.resolveMaybeReference({
|
|
591237
|
+
schemaOrReference: response,
|
|
591238
|
+
breadcrumbs: [...this.breadcrumbs, "responses", statusCode]
|
|
591239
|
+
});
|
|
591240
|
+
if (resolvedResponse?.content == null) {
|
|
591241
|
+
continue;
|
|
591242
|
+
}
|
|
591243
|
+
for (const [, responseMediaType] of Object.entries(resolvedResponse.content)) {
|
|
591244
|
+
const namedExamples = this.context.getNamedExamplesFromMediaTypeObject({
|
|
591245
|
+
mediaTypeObject: responseMediaType,
|
|
591246
|
+
breadcrumbs: [...this.breadcrumbs, "responses", statusCode],
|
|
591247
|
+
defaultExampleName: "Example"
|
|
591248
|
+
});
|
|
591249
|
+
for (const [, example] of namedExamples) {
|
|
591250
|
+
const resolvedValue = this.context.resolveExampleWithValue(example);
|
|
591251
|
+
if (resolvedValue != null) {
|
|
591252
|
+
return {
|
|
591253
|
+
docs: void 0,
|
|
591254
|
+
statusCode: statusCodeNum,
|
|
591255
|
+
body: api_exports.V2HttpEndpointResponseBody.json(resolvedValue)
|
|
591256
|
+
};
|
|
591257
|
+
}
|
|
591258
|
+
}
|
|
591259
|
+
}
|
|
591260
|
+
}
|
|
591261
|
+
return void 0;
|
|
591262
|
+
}
|
|
590879
591263
|
convertStreamConditionExamples({ httpPath, httpMethod, baseUrl, fernExamples }) {
|
|
590880
591264
|
const filteredJsonExamples = fernExamples.filter((example) => !(example.response != null && "stream" in example.response));
|
|
590881
591265
|
const filteredStreamExamples = fernExamples.filter((example) => example.response != null && "stream" in example.response);
|
|
@@ -602754,7 +603138,7 @@ var AccessTokenPosthogManager = class {
|
|
|
602754
603138
|
properties: {
|
|
602755
603139
|
...event,
|
|
602756
603140
|
...event.properties,
|
|
602757
|
-
version: "4.62.
|
|
603141
|
+
version: "4.62.3-11-g47af2473afa",
|
|
602758
603142
|
usingAccessToken: true
|
|
602759
603143
|
}
|
|
602760
603144
|
});
|
|
@@ -602805,7 +603189,7 @@ var UserPosthogManager = class {
|
|
|
602805
603189
|
distinctId: this.userId ?? await this.getPersistedDistinctId(),
|
|
602806
603190
|
event: "CLI",
|
|
602807
603191
|
properties: {
|
|
602808
|
-
version: "4.62.
|
|
603192
|
+
version: "4.62.3-11-g47af2473afa",
|
|
602809
603193
|
...event,
|
|
602810
603194
|
...event.properties,
|
|
602811
603195
|
usingAccessToken: false,
|
|
@@ -603850,9 +604234,17 @@ function constructAuth0Url({ origin: origin2, auth0Domain: auth0Domain2, auth0Cl
|
|
|
603850
604234
|
|
|
603851
604235
|
// ../login/lib/auth0-login/resolveSsoConnection.js
|
|
603852
604236
|
async function resolveSsoConnection({ dashboardBaseUrl, email: email3 }) {
|
|
603853
|
-
|
|
603854
|
-
|
|
603855
|
-
|
|
604237
|
+
let response;
|
|
604238
|
+
try {
|
|
604239
|
+
response = await axios_default.post(`${dashboardBaseUrl}/api/sso/resolve`, { email: email3 }, {
|
|
604240
|
+
headers: { "Content-Type": "application/json" }
|
|
604241
|
+
});
|
|
604242
|
+
} catch (error50) {
|
|
604243
|
+
if (axios_default.isAxiosError(error50) && error50.response?.status === 404) {
|
|
604244
|
+
throw new Error(`No SSO connection associated with email: ${email3}`);
|
|
604245
|
+
}
|
|
604246
|
+
throw error50;
|
|
604247
|
+
}
|
|
603856
604248
|
const responseData = response.data;
|
|
603857
604249
|
if (typeof responseData !== "object" || responseData == null) {
|
|
603858
604250
|
throw new Error("Invalid response format from SSO resolve endpoint");
|
|
@@ -622184,7 +622576,7 @@ function getClientOptions(options2, getDefaultIntegrationsImpl) {
|
|
|
622184
622576
|
const tracesSampleRate = getTracesSampleRate(options2.tracesSampleRate);
|
|
622185
622577
|
const mergedOptions = {
|
|
622186
622578
|
...options2,
|
|
622187
|
-
dsn: options2.dsn ?? "
|
|
622579
|
+
dsn: options2.dsn ?? "",
|
|
622188
622580
|
environment: options2.environment ?? "development",
|
|
622189
622581
|
sendClientReports: options2.sendClientReports ?? true,
|
|
622190
622582
|
transport: options2.transport ?? makeNodeTransport,
|
|
@@ -626778,7 +627170,7 @@ var TelemetryClient = class {
|
|
|
626778
627170
|
usingAccessToken: process.env.FERN_TOKEN != null
|
|
626779
627171
|
};
|
|
626780
627172
|
this.posthog = apiKey != null && apiKey.length > 0 && isTelemetryEnabled ? new PostHog(apiKey) : void 0;
|
|
626781
|
-
const sentryDsn = "
|
|
627173
|
+
const sentryDsn = "";
|
|
626782
627174
|
if (sentryDsn != null && sentryDsn.length > 0 && isTelemetryEnabled) {
|
|
626783
627175
|
const sentryEnvironment = "development";
|
|
626784
627176
|
if (sentryEnvironment == null || sentryEnvironment.length === 0) {
|
|
@@ -752800,8 +753192,8 @@ var V66_TO_V65_MIGRATION = {
|
|
|
752800
753192
|
[GeneratorName.SWIFT_SDK]: GeneratorWasNeverUpdatedToConsumeNewIR,
|
|
752801
753193
|
[GeneratorName.PHP_MODEL]: "0.1.0-rc.0",
|
|
752802
753194
|
[GeneratorName.PHP_SDK]: "2.3.2-rc.0",
|
|
752803
|
-
[GeneratorName.RUST_MODEL]:
|
|
752804
|
-
[GeneratorName.RUST_SDK]:
|
|
753195
|
+
[GeneratorName.RUST_MODEL]: "0.5.0-rc.0",
|
|
753196
|
+
[GeneratorName.RUST_SDK]: "0.32.0-rc.0"
|
|
752805
753197
|
},
|
|
752806
753198
|
jsonifyEarlierVersion: (ir15) => IrSerialization_exports.V65.IntermediateRepresentation.jsonOrThrow(ir15, {
|
|
752807
753199
|
unrecognizedObjectKeys: "passthrough",
|
|
@@ -840093,7 +840485,7 @@ var import_path54 = __toESM(require("path"), 1);
|
|
|
840093
840485
|
var LOCAL_STORAGE_FOLDER4 = ".fern-dev";
|
|
840094
840486
|
var LOGS_FOLDER_NAME = "logs";
|
|
840095
840487
|
function getCliSource() {
|
|
840096
|
-
const version7 = "4.62.
|
|
840488
|
+
const version7 = "4.62.3-11-g47af2473afa";
|
|
840097
840489
|
return `cli@${version7}`;
|
|
840098
840490
|
}
|
|
840099
840491
|
var DebugLogger = class {
|
|
@@ -851186,7 +851578,7 @@ var LegacyDocsPublisher = class {
|
|
|
851186
851578
|
/**
|
|
851187
851579
|
* Publish the docs workspace to the given instance.
|
|
851188
851580
|
*/
|
|
851189
|
-
async publish({ instanceUrl, preview, skipUpload }) {
|
|
851581
|
+
async publish({ instanceUrl, preview, previewId, skipUpload }) {
|
|
851190
851582
|
const taskContext = new TaskContextAdapter({ context: this.context, task: this.task });
|
|
851191
851583
|
try {
|
|
851192
851584
|
const url3 = await runRemoteGenerationForDocsWorkspace({
|
|
@@ -851198,10 +851590,10 @@ var LegacyDocsPublisher = class {
|
|
|
851198
851590
|
token: this.token,
|
|
851199
851591
|
instanceUrl,
|
|
851200
851592
|
preview,
|
|
851201
|
-
previewId
|
|
851593
|
+
previewId,
|
|
851202
851594
|
disableTemplates: void 0,
|
|
851203
851595
|
skipUpload,
|
|
851204
|
-
cliVersion: "4.62.
|
|
851596
|
+
cliVersion: "4.62.3-11-g47af2473afa"
|
|
851205
851597
|
});
|
|
851206
851598
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
851207
851599
|
return { success: false };
|
|
@@ -851856,6 +852248,7 @@ var PublishCommand = class {
|
|
|
851856
852248
|
const result = await publisher.publish({
|
|
851857
852249
|
instanceUrl,
|
|
851858
852250
|
preview: args.preview,
|
|
852251
|
+
previewId: args.previewId,
|
|
851859
852252
|
skipUpload: args["skip-upload"] || void 0
|
|
851860
852253
|
});
|
|
851861
852254
|
if (!result.success) {
|
|
@@ -852039,6 +852432,7 @@ var PreviewCommand = class {
|
|
|
852039
852432
|
await this.publishCommand.handle(context3, {
|
|
852040
852433
|
...args,
|
|
852041
852434
|
preview: true,
|
|
852435
|
+
previewId: args.id,
|
|
852042
852436
|
force: true
|
|
852043
852437
|
});
|
|
852044
852438
|
}
|
|
@@ -852057,6 +852451,9 @@ function addPreviewCommand(cli) {
|
|
|
852057
852451
|
type: "boolean",
|
|
852058
852452
|
default: false,
|
|
852059
852453
|
description: "Treat all validation warnings as errors"
|
|
852454
|
+
}).option("id", {
|
|
852455
|
+
type: "string",
|
|
852456
|
+
description: "A stable identifier for the preview. Reusing the same ID overwrites the previous preview, keeping the URL stable."
|
|
852060
852457
|
}).option("skip-upload", {
|
|
852061
852458
|
type: "boolean",
|
|
852062
852459
|
default: false,
|
|
@@ -903893,7 +904290,8 @@ var LegacyLocalGenerationRunner = class {
|
|
|
903893
904290
|
absolutePathToPreview: void 0,
|
|
903894
904291
|
inspect: false,
|
|
903895
904292
|
ai: void 0,
|
|
903896
|
-
skipFernignore: args.skipFernignore
|
|
904293
|
+
skipFernignore: args.skipFernignore,
|
|
904294
|
+
requireEnvVars: args.requireEnvVars
|
|
903897
904295
|
});
|
|
903898
904296
|
if (taskContext.getResult() === TaskResult.Failure) {
|
|
903899
904297
|
return {
|
|
@@ -904001,7 +904399,7 @@ var LegacyRemoteGenerationRunner = class {
|
|
|
904001
904399
|
whitelabel: void 0,
|
|
904002
904400
|
dynamicIrOnly: false,
|
|
904003
904401
|
retryRateLimited: false,
|
|
904004
|
-
requireEnvVars: true
|
|
904402
|
+
requireEnvVars: args.requireEnvVars ?? true
|
|
904005
904403
|
});
|
|
904006
904404
|
if (this.isLocalGitCombo(args) && absolutePathToPreview != null) {
|
|
904007
904405
|
const generatorName = basename2(generatorInvocation.name);
|
|
@@ -904139,7 +904537,8 @@ var GeneratorPipeline = class {
|
|
|
904139
904537
|
outputPath: args.outputPath,
|
|
904140
904538
|
containerEngine: args.containerEngine,
|
|
904141
904539
|
token: args.token,
|
|
904142
|
-
skipFernignore: args.skipFernignore
|
|
904540
|
+
skipFernignore: args.skipFernignore,
|
|
904541
|
+
requireEnvVars: args.requireEnvVars
|
|
904143
904542
|
});
|
|
904144
904543
|
if (!result.success) {
|
|
904145
904544
|
return {
|
|
@@ -904175,7 +904574,8 @@ var GeneratorPipeline = class {
|
|
|
904175
904574
|
preview: args.preview,
|
|
904176
904575
|
outputPath: args.outputPath,
|
|
904177
904576
|
fernignorePath: args.fernignorePath,
|
|
904178
|
-
skipFernignore: args.skipFernignore
|
|
904577
|
+
skipFernignore: args.skipFernignore,
|
|
904578
|
+
requireEnvVars: args.requireEnvVars
|
|
904179
904579
|
});
|
|
904180
904580
|
if (!result.success) {
|
|
904181
904581
|
return {
|
|
@@ -904550,7 +904950,8 @@ var GenerateCommand = class {
|
|
|
904550
904950
|
token,
|
|
904551
904951
|
version: args["output-version"],
|
|
904552
904952
|
fernignorePath: args.fernignore,
|
|
904553
|
-
skipFernignore: args["skip-fernignore"]
|
|
904953
|
+
skipFernignore: args["skip-fernignore"],
|
|
904954
|
+
requireEnvVars: args["require-env-vars"]
|
|
904554
904955
|
});
|
|
904555
904956
|
if (!pipelineResult.success) {
|
|
904556
904957
|
task.stage.generator.fail(pipelineResult.error);
|
|
@@ -904824,6 +905225,10 @@ function addGenerateCommand(cli) {
|
|
|
904824
905225
|
type: "boolean",
|
|
904825
905226
|
default: false,
|
|
904826
905227
|
description: "Skip the .fernignore file and generate all files. For remote generation, uploads an empty .fernignore. For local generation, skips reading .fernignore from the output directory."
|
|
905228
|
+
}).option("require-env-vars", {
|
|
905229
|
+
type: "boolean",
|
|
905230
|
+
default: true,
|
|
905231
|
+
description: "Require all referenced environment variables to be defined (use --no-require-env-vars to substitute empty strings for missing variables)"
|
|
904827
905232
|
}));
|
|
904828
905233
|
}
|
|
904829
905234
|
|
|
@@ -904888,6 +905293,10 @@ function addPreviewCommand2(cli) {
|
|
|
904888
905293
|
type: "string",
|
|
904889
905294
|
description: "Path to .fernignore file",
|
|
904890
905295
|
hidden: true
|
|
905296
|
+
}).option("require-env-vars", {
|
|
905297
|
+
type: "boolean",
|
|
905298
|
+
default: true,
|
|
905299
|
+
description: "Require all referenced environment variables to be defined (use --no-require-env-vars to substitute empty strings for missing variables)"
|
|
904891
905300
|
}));
|
|
904892
905301
|
}
|
|
904893
905302
|
|
|
@@ -923923,7 +924332,7 @@ var SentryClient = class {
|
|
|
923923
924332
|
sentry;
|
|
923924
924333
|
constructor({ release: release2 }) {
|
|
923925
924334
|
const isTelemetryEnabled = process.env.FERN_DISABLE_TELEMETRY !== "true";
|
|
923926
|
-
const sentryDsn = "
|
|
924335
|
+
const sentryDsn = "";
|
|
923927
924336
|
if (isTelemetryEnabled && sentryDsn != null && sentryDsn.length > 0) {
|
|
923928
924337
|
const sentryEnvironment = "development";
|
|
923929
924338
|
if (sentryEnvironment == null || sentryEnvironment.length === 0) {
|
|
@@ -924484,7 +924893,7 @@ var CliContext = class {
|
|
|
924484
924893
|
if (false) {
|
|
924485
924894
|
this.logger.error("CLI_VERSION is not defined");
|
|
924486
924895
|
}
|
|
924487
|
-
return "4.62.
|
|
924896
|
+
return "4.62.3-11-g47af2473afa";
|
|
924488
924897
|
}
|
|
924489
924898
|
getCliName() {
|
|
924490
924899
|
if (false) {
|
|
@@ -944292,6 +944701,8 @@ function addReplayCommand(cli, cliContext) {
|
|
|
944292
944701
|
builder: (yargs) => {
|
|
944293
944702
|
addReplayInitCommand(yargs, cliContext);
|
|
944294
944703
|
addReplayResolveCommand(yargs, cliContext);
|
|
944704
|
+
addReplayStatusCommand(yargs, cliContext);
|
|
944705
|
+
addReplayForgetCommand(yargs, cliContext);
|
|
944295
944706
|
return yargs;
|
|
944296
944707
|
},
|
|
944297
944708
|
handler: () => {
|
|
@@ -944338,9 +944749,15 @@ function addReplayInitCommand(cli, cliContext) {
|
|
|
944338
944749
|
githubRepo = githubRepo ?? resolved.githubRepo;
|
|
944339
944750
|
token = token ?? resolved.token;
|
|
944340
944751
|
}
|
|
944341
|
-
if (githubRepo == null
|
|
944342
|
-
|
|
944343
|
-
|
|
944752
|
+
if (githubRepo == null) {
|
|
944753
|
+
return cliContext.failAndThrow(
|
|
944754
|
+
"Missing required github config. Either use --group to read from generators.yml, or provide --github directly."
|
|
944755
|
+
);
|
|
944756
|
+
}
|
|
944757
|
+
if (token == null) {
|
|
944758
|
+
cliContext.logger.warn(
|
|
944759
|
+
"No GitHub token found. Clone may fail for private repos. Set GITHUB_TOKEN or pass --token."
|
|
944760
|
+
);
|
|
944344
944761
|
}
|
|
944345
944762
|
cliContext.logger.info(`Initializing Replay for: ${githubRepo}`);
|
|
944346
944763
|
if (argv.dryRun) {
|
|
@@ -944476,6 +944893,211 @@ Resolve the conflicts in your editor, then run \`fern replay resolve\` again to
|
|
|
944476
944893
|
}
|
|
944477
944894
|
);
|
|
944478
944895
|
}
|
|
944896
|
+
function addReplayStatusCommand(cli, cliContext) {
|
|
944897
|
+
cli.command(
|
|
944898
|
+
"status [directory]",
|
|
944899
|
+
false,
|
|
944900
|
+
// hidden from --help
|
|
944901
|
+
(yargs) => yargs.positional("directory", {
|
|
944902
|
+
type: "string",
|
|
944903
|
+
default: ".",
|
|
944904
|
+
description: "SDK directory containing .fern/replay.lock"
|
|
944905
|
+
}).option("verbose", {
|
|
944906
|
+
type: "boolean",
|
|
944907
|
+
alias: "v",
|
|
944908
|
+
default: false,
|
|
944909
|
+
description: "Show all patches with full details"
|
|
944910
|
+
}),
|
|
944911
|
+
async (argv) => {
|
|
944912
|
+
await cliContext.instrumentPostHogEvent({
|
|
944913
|
+
command: "fern replay status"
|
|
944914
|
+
});
|
|
944915
|
+
const outputDir = resolve5(cwd(), argv.directory ?? ".");
|
|
944916
|
+
try {
|
|
944917
|
+
const result = (0, import_generator_cli2.replayStatus)({ outputDir });
|
|
944918
|
+
if (!result.initialized) {
|
|
944919
|
+
cliContext.logger.info("Replay is not initialized. Run `fern replay init` to get started.");
|
|
944920
|
+
return;
|
|
944921
|
+
}
|
|
944922
|
+
cliContext.logger.info(
|
|
944923
|
+
`Replay: ${result.patches.length} customization(s) tracked, ${result.generationCount} generation(s)`
|
|
944924
|
+
);
|
|
944925
|
+
if (result.lastGeneration) {
|
|
944926
|
+
cliContext.logger.info(
|
|
944927
|
+
`Last generation: ${result.lastGeneration.sha} (${result.lastGeneration.timestamp})`
|
|
944928
|
+
);
|
|
944929
|
+
}
|
|
944930
|
+
if (result.patches.length === 0) {
|
|
944931
|
+
cliContext.logger.info("No customizations tracked.");
|
|
944932
|
+
return;
|
|
944933
|
+
}
|
|
944934
|
+
const patchesToShow = argv.verbose ? result.patches : result.patches.slice(0, 10);
|
|
944935
|
+
for (const patch5 of patchesToShow) {
|
|
944936
|
+
const statusTag = patch5.status ? ` [${patch5.status}]` : "";
|
|
944937
|
+
if (argv.verbose) {
|
|
944938
|
+
cliContext.logger.info(
|
|
944939
|
+
`
|
|
944940
|
+
${patch5.id} (${patch5.type})${statusTag}
|
|
944941
|
+
${patch5.message}
|
|
944942
|
+
Author: ${patch5.author} (${patch5.sha})
|
|
944943
|
+
Files (${patch5.fileCount}): ${patch5.files.join(", ")}`
|
|
944944
|
+
);
|
|
944945
|
+
} else {
|
|
944946
|
+
cliContext.logger.info(
|
|
944947
|
+
` ${patch5.id}: ${patch5.message} (${patch5.fileCount} file(s))${statusTag}`
|
|
944948
|
+
);
|
|
944949
|
+
}
|
|
944950
|
+
}
|
|
944951
|
+
if (!argv.verbose && result.patches.length > 10) {
|
|
944952
|
+
cliContext.logger.info(` ... and ${result.patches.length - 10} more (use --verbose to see all)`);
|
|
944953
|
+
}
|
|
944954
|
+
if (result.unresolvedCount > 0) {
|
|
944955
|
+
cliContext.logger.warn(
|
|
944956
|
+
`
|
|
944957
|
+
${result.unresolvedCount} patch(es) have unresolved conflicts. Run \`fern replay resolve\` to fix.`
|
|
944958
|
+
);
|
|
944959
|
+
}
|
|
944960
|
+
if (result.excludePatterns.length > 0) {
|
|
944961
|
+
cliContext.logger.info(`
|
|
944962
|
+
Exclude patterns: ${result.excludePatterns.join(", ")}`);
|
|
944963
|
+
}
|
|
944964
|
+
} catch (error50) {
|
|
944965
|
+
cliContext.failAndThrow(`Failed to get Replay status: ${extractErrorMessage(error50)}`);
|
|
944966
|
+
}
|
|
944967
|
+
}
|
|
944968
|
+
);
|
|
944969
|
+
}
|
|
944970
|
+
function addReplayForgetCommand(cli, cliContext) {
|
|
944971
|
+
cli.command(
|
|
944972
|
+
"forget [args..]",
|
|
944973
|
+
false,
|
|
944974
|
+
// hidden from --help
|
|
944975
|
+
(yargs) => yargs.positional("args", {
|
|
944976
|
+
type: "string",
|
|
944977
|
+
array: true,
|
|
944978
|
+
description: "Patch IDs (e.g. patch-abc12345) or a search pattern"
|
|
944979
|
+
}).option("dry-run", {
|
|
944980
|
+
type: "boolean",
|
|
944981
|
+
default: false,
|
|
944982
|
+
description: "Show what would be removed without actually removing"
|
|
944983
|
+
}).option("yes", {
|
|
944984
|
+
type: "boolean",
|
|
944985
|
+
alias: "y",
|
|
944986
|
+
default: false,
|
|
944987
|
+
description: "Skip confirmation prompts"
|
|
944988
|
+
}).option("all", {
|
|
944989
|
+
type: "boolean",
|
|
944990
|
+
default: false,
|
|
944991
|
+
description: "Remove all tracked patches"
|
|
944992
|
+
}),
|
|
944993
|
+
async (argv) => {
|
|
944994
|
+
await cliContext.instrumentPostHogEvent({
|
|
944995
|
+
command: "fern replay forget"
|
|
944996
|
+
});
|
|
944997
|
+
const outputDir = resolve5(cwd(), ".");
|
|
944998
|
+
const args = argv.args ?? [];
|
|
944999
|
+
const dryRun = argv.dryRun;
|
|
945000
|
+
try {
|
|
945001
|
+
if (argv.all) {
|
|
945002
|
+
const result2 = (0, import_generator_cli2.replayForget)({ outputDir, options: { all: true, dryRun } });
|
|
945003
|
+
if (!result2.initialized) {
|
|
945004
|
+
cliContext.logger.info("Replay is not initialized. Nothing to forget.");
|
|
945005
|
+
return;
|
|
945006
|
+
}
|
|
945007
|
+
if (result2.removed.length === 0) {
|
|
945008
|
+
cliContext.logger.info("No patches to remove.");
|
|
945009
|
+
return;
|
|
945010
|
+
}
|
|
945011
|
+
if (dryRun) {
|
|
945012
|
+
cliContext.logger.info(`Would remove ${result2.removed.length} patch(es):`);
|
|
945013
|
+
} else {
|
|
945014
|
+
cliContext.logger.info(`Removed ${result2.removed.length} patch(es):`);
|
|
945015
|
+
}
|
|
945016
|
+
for (const patch5 of result2.removed) {
|
|
945017
|
+
cliContext.logger.info(` ${patch5.id}: ${patch5.message}`);
|
|
945018
|
+
}
|
|
945019
|
+
for (const warning of result2.warnings) {
|
|
945020
|
+
cliContext.logger.warn(warning);
|
|
945021
|
+
}
|
|
945022
|
+
return;
|
|
945023
|
+
}
|
|
945024
|
+
if (args.length > 0 && args.every((a10) => a10.startsWith("patch-"))) {
|
|
945025
|
+
const result2 = (0, import_generator_cli2.replayForget)({ outputDir, options: { patchIds: args, dryRun } });
|
|
945026
|
+
if (!result2.initialized) {
|
|
945027
|
+
cliContext.logger.info("Replay is not initialized. Nothing to forget.");
|
|
945028
|
+
return;
|
|
945029
|
+
}
|
|
945030
|
+
if (result2.removed.length > 0) {
|
|
945031
|
+
const verb = dryRun ? "Would remove" : "Removed";
|
|
945032
|
+
for (const patch5 of result2.removed) {
|
|
945033
|
+
cliContext.logger.info(`${verb}: ${patch5.id} \u2014 ${patch5.message}`);
|
|
945034
|
+
}
|
|
945035
|
+
}
|
|
945036
|
+
for (const id2 of result2.alreadyForgotten) {
|
|
945037
|
+
cliContext.logger.info(`Already forgotten: ${id2}`);
|
|
945038
|
+
}
|
|
945039
|
+
for (const warning of result2.warnings) {
|
|
945040
|
+
cliContext.logger.warn(warning);
|
|
945041
|
+
}
|
|
945042
|
+
return;
|
|
945043
|
+
}
|
|
945044
|
+
const pattern = args.length === 1 ? args[0] : void 0;
|
|
945045
|
+
const result = (0, import_generator_cli2.replayForget)({ outputDir, options: { pattern } });
|
|
945046
|
+
if (!result.initialized) {
|
|
945047
|
+
cliContext.logger.info("Replay is not initialized. Nothing to forget.");
|
|
945048
|
+
return;
|
|
945049
|
+
}
|
|
945050
|
+
const matched = result.matched ?? [];
|
|
945051
|
+
if (matched.length === 0) {
|
|
945052
|
+
if (pattern) {
|
|
945053
|
+
cliContext.logger.info(`No patches matching "${pattern}".`);
|
|
945054
|
+
} else {
|
|
945055
|
+
cliContext.logger.info("No patches tracked.");
|
|
945056
|
+
}
|
|
945057
|
+
return;
|
|
945058
|
+
}
|
|
945059
|
+
cliContext.logger.info(`${matched.length} patch(es) matched:`);
|
|
945060
|
+
for (const patch5 of matched) {
|
|
945061
|
+
const stat6 = `+${patch5.diffstat.additions}/-${patch5.diffstat.deletions}`;
|
|
945062
|
+
cliContext.logger.info(` ${patch5.id}: ${patch5.message} (${stat6})`);
|
|
945063
|
+
}
|
|
945064
|
+
if (dryRun) {
|
|
945065
|
+
cliContext.logger.info("\nDry run \u2014 no patches removed.");
|
|
945066
|
+
return;
|
|
945067
|
+
}
|
|
945068
|
+
if (!argv.yes) {
|
|
945069
|
+
if (!process.stdout.isTTY) {
|
|
945070
|
+
cliContext.failAndThrow(
|
|
945071
|
+
"Confirmation required. Use --yes to skip confirmation in non-interactive mode."
|
|
945072
|
+
);
|
|
945073
|
+
return;
|
|
945074
|
+
}
|
|
945075
|
+
const readline7 = await import("readline");
|
|
945076
|
+
const rl3 = readline7.createInterface({ input: process.stdin, output: process.stderr });
|
|
945077
|
+
const answer = await new Promise((resolvePrompt) => {
|
|
945078
|
+
rl3.question(`
|
|
945079
|
+
Remove ${matched.length} patch(es)? [y/N] `, resolvePrompt);
|
|
945080
|
+
});
|
|
945081
|
+
rl3.close();
|
|
945082
|
+
if (answer.toLowerCase() !== "y") {
|
|
945083
|
+
cliContext.logger.info("Cancelled.");
|
|
945084
|
+
return;
|
|
945085
|
+
}
|
|
945086
|
+
}
|
|
945087
|
+
const patchIds = matched.map((p10) => p10.id);
|
|
945088
|
+
const removeResult = (0, import_generator_cli2.replayForget)({ outputDir, options: { patchIds, dryRun: false } });
|
|
945089
|
+
cliContext.logger.info(
|
|
945090
|
+
`Removed ${removeResult.removed.length} patch(es). ${removeResult.remaining} remaining.`
|
|
945091
|
+
);
|
|
945092
|
+
for (const warning of removeResult.warnings) {
|
|
945093
|
+
cliContext.logger.warn(warning);
|
|
945094
|
+
}
|
|
945095
|
+
} catch (error50) {
|
|
945096
|
+
cliContext.failAndThrow(`Failed to forget patches: ${extractErrorMessage(error50)}`);
|
|
945097
|
+
}
|
|
945098
|
+
}
|
|
945099
|
+
);
|
|
945100
|
+
}
|
|
944479
945101
|
function parseOwnerRepo(githubRepo) {
|
|
944480
945102
|
const cleaned = githubRepo.replace(/^https?:\/\//, "").replace(/\.git$/, "").replace(/^github\.com\//, "");
|
|
944481
945103
|
const parts = cleaned.split("/");
|
package/package.json
CHANGED