@fern-api/generator-cli 0.10.0 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +390 -270
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -21964,257 +21964,7 @@ var require_dist3 = __commonJS({
|
|
|
21964
21964
|
}
|
|
21965
21965
|
});
|
|
21966
21966
|
|
|
21967
|
-
// ../../node_modules/.pnpm
|
|
21968
|
-
function LCS(buffer1, buffer2) {
|
|
21969
|
-
let equivalenceClasses = {};
|
|
21970
|
-
for (let j2 = 0; j2 < buffer2.length; j2++) {
|
|
21971
|
-
const item = buffer2[j2];
|
|
21972
|
-
if (equivalenceClasses[item]) {
|
|
21973
|
-
equivalenceClasses[item].push(j2);
|
|
21974
|
-
} else {
|
|
21975
|
-
equivalenceClasses[item] = [j2];
|
|
21976
|
-
}
|
|
21977
|
-
}
|
|
21978
|
-
const NULLRESULT = { buffer1index: -1, buffer2index: -1, chain: null };
|
|
21979
|
-
let candidates = [NULLRESULT];
|
|
21980
|
-
for (let i2 = 0; i2 < buffer1.length; i2++) {
|
|
21981
|
-
const item = buffer1[i2];
|
|
21982
|
-
const buffer2indices = equivalenceClasses[item] || [];
|
|
21983
|
-
let r2 = 0;
|
|
21984
|
-
let c3 = candidates[0];
|
|
21985
|
-
for (let jx = 0; jx < buffer2indices.length; jx++) {
|
|
21986
|
-
const j2 = buffer2indices[jx];
|
|
21987
|
-
let s;
|
|
21988
|
-
for (s = r2; s < candidates.length; s++) {
|
|
21989
|
-
if (candidates[s].buffer2index < j2 && (s === candidates.length - 1 || candidates[s + 1].buffer2index > j2)) {
|
|
21990
|
-
break;
|
|
21991
|
-
}
|
|
21992
|
-
}
|
|
21993
|
-
if (s < candidates.length) {
|
|
21994
|
-
const newCandidate = { buffer1index: i2, buffer2index: j2, chain: candidates[s] };
|
|
21995
|
-
if (r2 === candidates.length) {
|
|
21996
|
-
candidates.push(c3);
|
|
21997
|
-
} else {
|
|
21998
|
-
candidates[r2] = c3;
|
|
21999
|
-
}
|
|
22000
|
-
r2 = s + 1;
|
|
22001
|
-
c3 = newCandidate;
|
|
22002
|
-
if (r2 === candidates.length) {
|
|
22003
|
-
break;
|
|
22004
|
-
}
|
|
22005
|
-
}
|
|
22006
|
-
}
|
|
22007
|
-
candidates[r2] = c3;
|
|
22008
|
-
}
|
|
22009
|
-
return candidates[candidates.length - 1];
|
|
22010
|
-
}
|
|
22011
|
-
function diffIndices(buffer1, buffer2) {
|
|
22012
|
-
const lcs = LCS(buffer1, buffer2);
|
|
22013
|
-
let result = [];
|
|
22014
|
-
let tail1 = buffer1.length;
|
|
22015
|
-
let tail2 = buffer2.length;
|
|
22016
|
-
for (let candidate = lcs; candidate !== null; candidate = candidate.chain) {
|
|
22017
|
-
const mismatchLength1 = tail1 - candidate.buffer1index - 1;
|
|
22018
|
-
const mismatchLength2 = tail2 - candidate.buffer2index - 1;
|
|
22019
|
-
tail1 = candidate.buffer1index;
|
|
22020
|
-
tail2 = candidate.buffer2index;
|
|
22021
|
-
if (mismatchLength1 || mismatchLength2) {
|
|
22022
|
-
result.push({
|
|
22023
|
-
buffer1: [tail1 + 1, mismatchLength1],
|
|
22024
|
-
buffer1Content: buffer1.slice(tail1 + 1, tail1 + 1 + mismatchLength1),
|
|
22025
|
-
buffer2: [tail2 + 1, mismatchLength2],
|
|
22026
|
-
buffer2Content: buffer2.slice(tail2 + 1, tail2 + 1 + mismatchLength2)
|
|
22027
|
-
});
|
|
22028
|
-
}
|
|
22029
|
-
}
|
|
22030
|
-
result.reverse();
|
|
22031
|
-
return result;
|
|
22032
|
-
}
|
|
22033
|
-
function diffPatch(buffer1, buffer2) {
|
|
22034
|
-
const lcs = LCS(buffer1, buffer2);
|
|
22035
|
-
let result = [];
|
|
22036
|
-
let tail1 = buffer1.length;
|
|
22037
|
-
let tail2 = buffer2.length;
|
|
22038
|
-
function chunkDescription(buffer, offset, length) {
|
|
22039
|
-
let chunk = [];
|
|
22040
|
-
for (let i2 = 0; i2 < length; i2++) {
|
|
22041
|
-
chunk.push(buffer[offset + i2]);
|
|
22042
|
-
}
|
|
22043
|
-
return {
|
|
22044
|
-
offset,
|
|
22045
|
-
length,
|
|
22046
|
-
chunk
|
|
22047
|
-
};
|
|
22048
|
-
}
|
|
22049
|
-
for (let candidate = lcs; candidate !== null; candidate = candidate.chain) {
|
|
22050
|
-
const mismatchLength1 = tail1 - candidate.buffer1index - 1;
|
|
22051
|
-
const mismatchLength2 = tail2 - candidate.buffer2index - 1;
|
|
22052
|
-
tail1 = candidate.buffer1index;
|
|
22053
|
-
tail2 = candidate.buffer2index;
|
|
22054
|
-
if (mismatchLength1 || mismatchLength2) {
|
|
22055
|
-
result.push({
|
|
22056
|
-
buffer1: chunkDescription(buffer1, candidate.buffer1index + 1, mismatchLength1),
|
|
22057
|
-
buffer2: chunkDescription(buffer2, candidate.buffer2index + 1, mismatchLength2)
|
|
22058
|
-
});
|
|
22059
|
-
}
|
|
22060
|
-
}
|
|
22061
|
-
result.reverse();
|
|
22062
|
-
return result;
|
|
22063
|
-
}
|
|
22064
|
-
function diff3MergeRegions(a, o2, b3) {
|
|
22065
|
-
let hunks = [];
|
|
22066
|
-
function addHunk(h2, ab) {
|
|
22067
|
-
hunks.push({
|
|
22068
|
-
ab,
|
|
22069
|
-
oStart: h2.buffer1[0],
|
|
22070
|
-
oLength: h2.buffer1[1],
|
|
22071
|
-
abStart: h2.buffer2[0],
|
|
22072
|
-
abLength: h2.buffer2[1]
|
|
22073
|
-
});
|
|
22074
|
-
}
|
|
22075
|
-
diffIndices(o2, a).forEach((item) => addHunk(item, "a"));
|
|
22076
|
-
diffIndices(o2, b3).forEach((item) => addHunk(item, "b"));
|
|
22077
|
-
hunks.sort((x2, y2) => x2.oStart - y2.oStart);
|
|
22078
|
-
let results = [];
|
|
22079
|
-
let currOffset = 0;
|
|
22080
|
-
function advanceTo(endOffset) {
|
|
22081
|
-
if (endOffset > currOffset) {
|
|
22082
|
-
results.push({
|
|
22083
|
-
stable: true,
|
|
22084
|
-
buffer: "o",
|
|
22085
|
-
bufferStart: currOffset,
|
|
22086
|
-
bufferLength: endOffset - currOffset,
|
|
22087
|
-
bufferContent: o2.slice(currOffset, endOffset)
|
|
22088
|
-
});
|
|
22089
|
-
currOffset = endOffset;
|
|
22090
|
-
}
|
|
22091
|
-
}
|
|
22092
|
-
while (hunks.length) {
|
|
22093
|
-
let hunk = hunks.shift();
|
|
22094
|
-
let regionStart = hunk.oStart;
|
|
22095
|
-
let regionEnd = hunk.oStart + hunk.oLength;
|
|
22096
|
-
let regionHunks = [hunk];
|
|
22097
|
-
advanceTo(regionStart);
|
|
22098
|
-
while (hunks.length) {
|
|
22099
|
-
const nextHunk = hunks[0];
|
|
22100
|
-
const nextHunkStart = nextHunk.oStart;
|
|
22101
|
-
if (nextHunkStart > regionEnd)
|
|
22102
|
-
break;
|
|
22103
|
-
regionEnd = Math.max(regionEnd, nextHunkStart + nextHunk.oLength);
|
|
22104
|
-
regionHunks.push(hunks.shift());
|
|
22105
|
-
}
|
|
22106
|
-
if (regionHunks.length === 1) {
|
|
22107
|
-
if (hunk.abLength > 0) {
|
|
22108
|
-
const buffer = hunk.ab === "a" ? a : b3;
|
|
22109
|
-
results.push({
|
|
22110
|
-
stable: true,
|
|
22111
|
-
buffer: hunk.ab,
|
|
22112
|
-
bufferStart: hunk.abStart,
|
|
22113
|
-
bufferLength: hunk.abLength,
|
|
22114
|
-
bufferContent: buffer.slice(hunk.abStart, hunk.abStart + hunk.abLength)
|
|
22115
|
-
});
|
|
22116
|
-
}
|
|
22117
|
-
} else {
|
|
22118
|
-
let bounds = {
|
|
22119
|
-
a: [a.length, -1, o2.length, -1],
|
|
22120
|
-
b: [b3.length, -1, o2.length, -1]
|
|
22121
|
-
};
|
|
22122
|
-
while (regionHunks.length) {
|
|
22123
|
-
hunk = regionHunks.shift();
|
|
22124
|
-
const oStart = hunk.oStart;
|
|
22125
|
-
const oEnd = oStart + hunk.oLength;
|
|
22126
|
-
const abStart = hunk.abStart;
|
|
22127
|
-
const abEnd = abStart + hunk.abLength;
|
|
22128
|
-
let b22 = bounds[hunk.ab];
|
|
22129
|
-
b22[0] = Math.min(abStart, b22[0]);
|
|
22130
|
-
b22[1] = Math.max(abEnd, b22[1]);
|
|
22131
|
-
b22[2] = Math.min(oStart, b22[2]);
|
|
22132
|
-
b22[3] = Math.max(oEnd, b22[3]);
|
|
22133
|
-
}
|
|
22134
|
-
const aStart = bounds.a[0] + (regionStart - bounds.a[2]);
|
|
22135
|
-
const aEnd = bounds.a[1] + (regionEnd - bounds.a[3]);
|
|
22136
|
-
const bStart = bounds.b[0] + (regionStart - bounds.b[2]);
|
|
22137
|
-
const bEnd = bounds.b[1] + (regionEnd - bounds.b[3]);
|
|
22138
|
-
let result = {
|
|
22139
|
-
stable: false,
|
|
22140
|
-
aStart,
|
|
22141
|
-
aLength: aEnd - aStart,
|
|
22142
|
-
aContent: a.slice(aStart, aEnd),
|
|
22143
|
-
oStart: regionStart,
|
|
22144
|
-
oLength: regionEnd - regionStart,
|
|
22145
|
-
oContent: o2.slice(regionStart, regionEnd),
|
|
22146
|
-
bStart,
|
|
22147
|
-
bLength: bEnd - bStart,
|
|
22148
|
-
bContent: b3.slice(bStart, bEnd)
|
|
22149
|
-
};
|
|
22150
|
-
results.push(result);
|
|
22151
|
-
}
|
|
22152
|
-
currOffset = regionEnd;
|
|
22153
|
-
}
|
|
22154
|
-
advanceTo(o2.length);
|
|
22155
|
-
return results;
|
|
22156
|
-
}
|
|
22157
|
-
function diff3Merge(a, o2, b3, options) {
|
|
22158
|
-
let defaults3 = {
|
|
22159
|
-
excludeFalseConflicts: true,
|
|
22160
|
-
stringSeparator: /\s+/
|
|
22161
|
-
};
|
|
22162
|
-
options = Object.assign(defaults3, options);
|
|
22163
|
-
if (typeof a === "string")
|
|
22164
|
-
a = a.split(options.stringSeparator);
|
|
22165
|
-
if (typeof o2 === "string")
|
|
22166
|
-
o2 = o2.split(options.stringSeparator);
|
|
22167
|
-
if (typeof b3 === "string")
|
|
22168
|
-
b3 = b3.split(options.stringSeparator);
|
|
22169
|
-
let results = [];
|
|
22170
|
-
const regions = diff3MergeRegions(a, o2, b3);
|
|
22171
|
-
let okBuffer = [];
|
|
22172
|
-
function flushOk() {
|
|
22173
|
-
if (okBuffer.length) {
|
|
22174
|
-
results.push({ ok: okBuffer });
|
|
22175
|
-
}
|
|
22176
|
-
okBuffer = [];
|
|
22177
|
-
}
|
|
22178
|
-
function isFalseConflict(a2, b22) {
|
|
22179
|
-
if (a2.length !== b22.length)
|
|
22180
|
-
return false;
|
|
22181
|
-
for (let i2 = 0; i2 < a2.length; i2++) {
|
|
22182
|
-
if (a2[i2] !== b22[i2])
|
|
22183
|
-
return false;
|
|
22184
|
-
}
|
|
22185
|
-
return true;
|
|
22186
|
-
}
|
|
22187
|
-
regions.forEach((region) => {
|
|
22188
|
-
if (region.stable) {
|
|
22189
|
-
okBuffer.push(...region.bufferContent);
|
|
22190
|
-
} else {
|
|
22191
|
-
if (options.excludeFalseConflicts && isFalseConflict(region.aContent, region.bContent)) {
|
|
22192
|
-
okBuffer.push(...region.aContent);
|
|
22193
|
-
} else {
|
|
22194
|
-
flushOk();
|
|
22195
|
-
results.push({
|
|
22196
|
-
conflict: {
|
|
22197
|
-
a: region.aContent,
|
|
22198
|
-
aIndex: region.aStart,
|
|
22199
|
-
o: region.oContent,
|
|
22200
|
-
oIndex: region.oStart,
|
|
22201
|
-
b: region.bContent,
|
|
22202
|
-
bIndex: region.bStart
|
|
22203
|
-
}
|
|
22204
|
-
});
|
|
22205
|
-
}
|
|
22206
|
-
}
|
|
22207
|
-
});
|
|
22208
|
-
flushOk();
|
|
22209
|
-
return results;
|
|
22210
|
-
}
|
|
22211
|
-
var init_diff3 = __esm({
|
|
22212
|
-
"../../node_modules/.pnpm/node-diff3@3.2.0/node_modules/node-diff3/dist/diff3.mjs"() {
|
|
22213
|
-
"use strict";
|
|
22214
|
-
}
|
|
22215
|
-
});
|
|
22216
|
-
|
|
22217
|
-
// ../../node_modules/.pnpm/@fern-api+replay@0.19.2/node_modules/@fern-api/replay/dist/index.js
|
|
21967
|
+
// ../../node_modules/.pnpm/@fern-api+replay@0.19.3/node_modules/@fern-api/replay/dist/index.js
|
|
22218
21968
|
var dist_exports = {};
|
|
22219
21969
|
__export(dist_exports, {
|
|
22220
21970
|
CREDENTIAL_PATTERNS: () => CREDENTIAL_PATTERNS,
|
|
@@ -22633,6 +22383,244 @@ function filterInfrastructureAndSensitiveFiles(rawFilesOutput, fernignorePattern
|
|
|
22633
22383
|
const files = nonSensitive.filter((f) => !matchesFernignorePattern(f, fernignorePatterns));
|
|
22634
22384
|
return { files, sensitiveFiles, fernignoredFiles, infrastructureFiles };
|
|
22635
22385
|
}
|
|
22386
|
+
function LCS(buffer1, buffer2) {
|
|
22387
|
+
const equivalenceClasses = /* @__PURE__ */ new Map();
|
|
22388
|
+
for (let j2 = 0; j2 < buffer2.length; j2++) {
|
|
22389
|
+
const item = buffer2[j2];
|
|
22390
|
+
const indices = equivalenceClasses.get(item);
|
|
22391
|
+
if (indices != null) {
|
|
22392
|
+
indices.push(j2);
|
|
22393
|
+
} else {
|
|
22394
|
+
equivalenceClasses.set(item, [j2]);
|
|
22395
|
+
}
|
|
22396
|
+
}
|
|
22397
|
+
const nullResult = { buffer1index: -1, buffer2index: -1, chain: null };
|
|
22398
|
+
const candidates = [nullResult];
|
|
22399
|
+
for (let i2 = 0; i2 < buffer1.length; i2++) {
|
|
22400
|
+
const item = buffer1[i2];
|
|
22401
|
+
const buffer2indices = equivalenceClasses.get(item) ?? [];
|
|
22402
|
+
let r2 = 0;
|
|
22403
|
+
let c3 = candidates[0];
|
|
22404
|
+
for (let jx = 0; jx < buffer2indices.length; jx++) {
|
|
22405
|
+
const j2 = buffer2indices[jx];
|
|
22406
|
+
let s = candidates.length;
|
|
22407
|
+
let lo = r2;
|
|
22408
|
+
let hi = candidates.length - 1;
|
|
22409
|
+
let found = -1;
|
|
22410
|
+
while (lo <= hi) {
|
|
22411
|
+
const mid = lo + hi >> 1;
|
|
22412
|
+
if (candidates[mid].buffer2index < j2) {
|
|
22413
|
+
found = mid;
|
|
22414
|
+
lo = mid + 1;
|
|
22415
|
+
} else {
|
|
22416
|
+
hi = mid - 1;
|
|
22417
|
+
}
|
|
22418
|
+
}
|
|
22419
|
+
if (found !== -1 && (found === candidates.length - 1 || candidates[found + 1].buffer2index > j2)) {
|
|
22420
|
+
s = found;
|
|
22421
|
+
}
|
|
22422
|
+
if (s < candidates.length) {
|
|
22423
|
+
const newCandidate = { buffer1index: i2, buffer2index: j2, chain: candidates[s] };
|
|
22424
|
+
if (r2 === candidates.length) {
|
|
22425
|
+
candidates.push(c3);
|
|
22426
|
+
} else {
|
|
22427
|
+
candidates[r2] = c3;
|
|
22428
|
+
}
|
|
22429
|
+
r2 = s + 1;
|
|
22430
|
+
c3 = newCandidate;
|
|
22431
|
+
if (r2 === candidates.length) {
|
|
22432
|
+
break;
|
|
22433
|
+
}
|
|
22434
|
+
}
|
|
22435
|
+
}
|
|
22436
|
+
candidates[r2] = c3;
|
|
22437
|
+
}
|
|
22438
|
+
return candidates[candidates.length - 1];
|
|
22439
|
+
}
|
|
22440
|
+
function diffIndices(buffer1, buffer2) {
|
|
22441
|
+
const lcs = LCS(buffer1, buffer2);
|
|
22442
|
+
const result = [];
|
|
22443
|
+
let tail1 = buffer1.length;
|
|
22444
|
+
let tail2 = buffer2.length;
|
|
22445
|
+
let candidate = lcs;
|
|
22446
|
+
while (candidate !== null) {
|
|
22447
|
+
const mismatchLength1 = tail1 - candidate.buffer1index - 1;
|
|
22448
|
+
const mismatchLength2 = tail2 - candidate.buffer2index - 1;
|
|
22449
|
+
tail1 = candidate.buffer1index;
|
|
22450
|
+
tail2 = candidate.buffer2index;
|
|
22451
|
+
if (mismatchLength1 || mismatchLength2) {
|
|
22452
|
+
result.push({
|
|
22453
|
+
buffer1: [tail1 + 1, mismatchLength1],
|
|
22454
|
+
buffer1Content: buffer1.slice(tail1 + 1, tail1 + 1 + mismatchLength1),
|
|
22455
|
+
buffer2: [tail2 + 1, mismatchLength2],
|
|
22456
|
+
buffer2Content: buffer2.slice(tail2 + 1, tail2 + 1 + mismatchLength2)
|
|
22457
|
+
});
|
|
22458
|
+
}
|
|
22459
|
+
candidate = candidate.chain;
|
|
22460
|
+
}
|
|
22461
|
+
result.reverse();
|
|
22462
|
+
return result;
|
|
22463
|
+
}
|
|
22464
|
+
function diffPatch(buffer1, buffer2) {
|
|
22465
|
+
const lcs = LCS(buffer1, buffer2);
|
|
22466
|
+
const result = [];
|
|
22467
|
+
let tail1 = buffer1.length;
|
|
22468
|
+
let tail2 = buffer2.length;
|
|
22469
|
+
function chunkDescription(buffer, offset, length) {
|
|
22470
|
+
const chunk = [];
|
|
22471
|
+
for (let i2 = 0; i2 < length; i2++) {
|
|
22472
|
+
chunk.push(buffer[offset + i2]);
|
|
22473
|
+
}
|
|
22474
|
+
return {
|
|
22475
|
+
offset,
|
|
22476
|
+
length,
|
|
22477
|
+
chunk
|
|
22478
|
+
};
|
|
22479
|
+
}
|
|
22480
|
+
let candidate = lcs;
|
|
22481
|
+
while (candidate !== null) {
|
|
22482
|
+
const mismatchLength1 = tail1 - candidate.buffer1index - 1;
|
|
22483
|
+
const mismatchLength2 = tail2 - candidate.buffer2index - 1;
|
|
22484
|
+
tail1 = candidate.buffer1index;
|
|
22485
|
+
tail2 = candidate.buffer2index;
|
|
22486
|
+
if (mismatchLength1 || mismatchLength2) {
|
|
22487
|
+
result.push({
|
|
22488
|
+
buffer1: chunkDescription(buffer1, candidate.buffer1index + 1, mismatchLength1),
|
|
22489
|
+
buffer2: chunkDescription(buffer2, candidate.buffer2index + 1, mismatchLength2)
|
|
22490
|
+
});
|
|
22491
|
+
}
|
|
22492
|
+
candidate = candidate.chain;
|
|
22493
|
+
}
|
|
22494
|
+
result.reverse();
|
|
22495
|
+
return result;
|
|
22496
|
+
}
|
|
22497
|
+
function diff3MergeRegions(a, o2, b3) {
|
|
22498
|
+
const hunks = [];
|
|
22499
|
+
function addHunk(h2, ab) {
|
|
22500
|
+
hunks.push({
|
|
22501
|
+
ab,
|
|
22502
|
+
oStart: h2.buffer1[0],
|
|
22503
|
+
oLength: h2.buffer1[1],
|
|
22504
|
+
abStart: h2.buffer2[0],
|
|
22505
|
+
abLength: h2.buffer2[1]
|
|
22506
|
+
});
|
|
22507
|
+
}
|
|
22508
|
+
diffIndices(o2, a).forEach((item) => addHunk(item, "a"));
|
|
22509
|
+
diffIndices(o2, b3).forEach((item) => addHunk(item, "b"));
|
|
22510
|
+
hunks.sort((x2, y2) => x2.oStart - y2.oStart);
|
|
22511
|
+
const results = [];
|
|
22512
|
+
let currOffset = 0;
|
|
22513
|
+
function advanceTo(endOffset) {
|
|
22514
|
+
if (endOffset > currOffset) {
|
|
22515
|
+
results.push({
|
|
22516
|
+
stable: true,
|
|
22517
|
+
bufferContent: o2.slice(currOffset, endOffset)
|
|
22518
|
+
});
|
|
22519
|
+
currOffset = endOffset;
|
|
22520
|
+
}
|
|
22521
|
+
}
|
|
22522
|
+
while (hunks.length) {
|
|
22523
|
+
const firstHunk = hunks.shift();
|
|
22524
|
+
if (firstHunk === void 0) break;
|
|
22525
|
+
let hunk = firstHunk;
|
|
22526
|
+
const regionStart = hunk.oStart;
|
|
22527
|
+
let regionEnd = hunk.oStart + hunk.oLength;
|
|
22528
|
+
const regionHunks = [hunk];
|
|
22529
|
+
advanceTo(regionStart);
|
|
22530
|
+
while (hunks.length) {
|
|
22531
|
+
const nextHunk = hunks[0];
|
|
22532
|
+
const nextHunkStart = nextHunk.oStart;
|
|
22533
|
+
if (nextHunkStart > regionEnd) break;
|
|
22534
|
+
regionEnd = Math.max(regionEnd, nextHunkStart + nextHunk.oLength);
|
|
22535
|
+
const next = hunks.shift();
|
|
22536
|
+
if (next === void 0) break;
|
|
22537
|
+
regionHunks.push(next);
|
|
22538
|
+
}
|
|
22539
|
+
if (regionHunks.length === 1) {
|
|
22540
|
+
if (hunk.abLength > 0) {
|
|
22541
|
+
const buffer = hunk.ab === "a" ? a : b3;
|
|
22542
|
+
results.push({
|
|
22543
|
+
stable: true,
|
|
22544
|
+
bufferContent: buffer.slice(hunk.abStart, hunk.abStart + hunk.abLength)
|
|
22545
|
+
});
|
|
22546
|
+
}
|
|
22547
|
+
} else {
|
|
22548
|
+
const bounds = {
|
|
22549
|
+
a: [a.length, -1, o2.length, -1],
|
|
22550
|
+
b: [b3.length, -1, o2.length, -1]
|
|
22551
|
+
};
|
|
22552
|
+
while (regionHunks.length) {
|
|
22553
|
+
const next = regionHunks.shift();
|
|
22554
|
+
if (next === void 0) break;
|
|
22555
|
+
hunk = next;
|
|
22556
|
+
const oStart = hunk.oStart;
|
|
22557
|
+
const oEnd = oStart + hunk.oLength;
|
|
22558
|
+
const abStart = hunk.abStart;
|
|
22559
|
+
const abEnd = abStart + hunk.abLength;
|
|
22560
|
+
const bound = bounds[hunk.ab];
|
|
22561
|
+
bound[0] = Math.min(abStart, bound[0]);
|
|
22562
|
+
bound[1] = Math.max(abEnd, bound[1]);
|
|
22563
|
+
bound[2] = Math.min(oStart, bound[2]);
|
|
22564
|
+
bound[3] = Math.max(oEnd, bound[3]);
|
|
22565
|
+
}
|
|
22566
|
+
const aStart = bounds.a[0] + (regionStart - bounds.a[2]);
|
|
22567
|
+
const aEnd = bounds.a[1] + (regionEnd - bounds.a[3]);
|
|
22568
|
+
const bStart = bounds.b[0] + (regionStart - bounds.b[2]);
|
|
22569
|
+
const bEnd = bounds.b[1] + (regionEnd - bounds.b[3]);
|
|
22570
|
+
results.push({
|
|
22571
|
+
stable: false,
|
|
22572
|
+
aStart,
|
|
22573
|
+
aContent: a.slice(aStart, aEnd),
|
|
22574
|
+
oStart: regionStart,
|
|
22575
|
+
oContent: o2.slice(regionStart, regionEnd),
|
|
22576
|
+
bStart,
|
|
22577
|
+
bContent: b3.slice(bStart, bEnd)
|
|
22578
|
+
});
|
|
22579
|
+
}
|
|
22580
|
+
currOffset = regionEnd;
|
|
22581
|
+
}
|
|
22582
|
+
advanceTo(o2.length);
|
|
22583
|
+
return results;
|
|
22584
|
+
}
|
|
22585
|
+
function diff3Merge(a, o2, b3) {
|
|
22586
|
+
const regions = diff3MergeRegions(a, o2, b3);
|
|
22587
|
+
const results = [];
|
|
22588
|
+
let okBuffer = [];
|
|
22589
|
+
function flushOk() {
|
|
22590
|
+
if (okBuffer.length) {
|
|
22591
|
+
results.push({ ok: okBuffer });
|
|
22592
|
+
}
|
|
22593
|
+
okBuffer = [];
|
|
22594
|
+
}
|
|
22595
|
+
function isFalseConflict(left2, right2) {
|
|
22596
|
+
if (left2.length !== right2.length) return false;
|
|
22597
|
+
for (let i2 = 0; i2 < left2.length; i2++) {
|
|
22598
|
+
if (left2[i2] !== right2[i2]) return false;
|
|
22599
|
+
}
|
|
22600
|
+
return true;
|
|
22601
|
+
}
|
|
22602
|
+
regions.forEach((region) => {
|
|
22603
|
+
if (region.stable) {
|
|
22604
|
+
okBuffer.push(...region.bufferContent);
|
|
22605
|
+
} else if (isFalseConflict(region.aContent, region.bContent)) {
|
|
22606
|
+
okBuffer.push(...region.aContent);
|
|
22607
|
+
} else {
|
|
22608
|
+
flushOk();
|
|
22609
|
+
results.push({
|
|
22610
|
+
conflict: {
|
|
22611
|
+
a: region.aContent,
|
|
22612
|
+
aIndex: region.aStart,
|
|
22613
|
+
o: region.oContent,
|
|
22614
|
+
oIndex: region.oStart,
|
|
22615
|
+
b: region.bContent,
|
|
22616
|
+
bIndex: region.bStart
|
|
22617
|
+
}
|
|
22618
|
+
});
|
|
22619
|
+
}
|
|
22620
|
+
});
|
|
22621
|
+
flushOk();
|
|
22622
|
+
return results;
|
|
22623
|
+
}
|
|
22636
22624
|
function threeWayMerge(base, ours, theirs) {
|
|
22637
22625
|
const baseLines = base.split("\n");
|
|
22638
22626
|
const oursLines = ours.split("\n");
|
|
@@ -24295,7 +24283,7 @@ function status(outputDir) {
|
|
|
24295
24283
|
}
|
|
24296
24284
|
var import_promises4, import_os, import_path7, import_fs6, import_path8, import_yaml, import_crypto, import_path9, import_promises5, import_os2, import_path10, import_promises6, import_path11, import_promises7, import_path12, import_fs7, import_promises8, import_path13, import_fs8, import_path14, import_promises9, import_os3, import_path15, import_child_process3, import_crypto2, import_fs9, import_path16, import_yaml2, import_crypto3, import_fs10, import_path17, import_fs11, import_promises10, import_path18, __defProp3, __getOwnPropNames3, __esm3, __export3, GitClient_exports, GitClient, init_GitClient, HybridReconstruction_exports, init_HybridReconstruction, PatchApplyTheirs_exports, init_PatchApplyTheirs, CREDENTIAL_PATTERNS, SENSITIVE_FILE_PATTERNS, FERN_BOT_NAME, FERN_BOT_EMAIL, FERN_BOT_LOGIN, FERN_SUPPORT_NAMES, LOCKFILE_HEADER, LockfileNotFoundError, LockfileManager, BINARY_EXTENSIONS, INFRASTRUCTURE_FILES, ReplayDetector, MergeAccumulator, CONFLICT_OPENER, CONFLICT_SEPARATOR, CONFLICT_CLOSER, AUTOVERSION_PLACEHOLDERS, VERSION_TOKEN, VERSION_MASK, ReplayApplicator, ReplayCommitter, FileOwnership, FirstGenerationFlow, SkipApplicationFlow, NoPatchesFlow, NormalRegenerationFlow, ReplayService, FernignoreMigrator, REPLAY_FERNIGNORE_ENTRIES, GITATTRIBUTES_ENTRIES, EMPTY_RESULT;
|
|
24297
24285
|
var init_dist3 = __esm({
|
|
24298
|
-
"../../node_modules/.pnpm/@fern-api+replay@0.19.
|
|
24286
|
+
"../../node_modules/.pnpm/@fern-api+replay@0.19.3/node_modules/@fern-api/replay/dist/index.js"() {
|
|
24299
24287
|
"use strict";
|
|
24300
24288
|
init_esm4();
|
|
24301
24289
|
import_promises4 = require("fs/promises");
|
|
@@ -24308,7 +24296,6 @@ var init_dist3 = __esm({
|
|
|
24308
24296
|
import_crypto = require("crypto");
|
|
24309
24297
|
init_esm3();
|
|
24310
24298
|
import_path9 = require("path");
|
|
24311
|
-
init_diff3();
|
|
24312
24299
|
import_promises5 = require("fs/promises");
|
|
24313
24300
|
import_os2 = require("os");
|
|
24314
24301
|
import_path10 = require("path");
|
|
@@ -42211,7 +42198,8 @@ var AutoVersionStep = class extends BaseStep {
|
|
|
42211
42198
|
};
|
|
42212
42199
|
}
|
|
42213
42200
|
async finalizeWithBump(params) {
|
|
42214
|
-
const { service, language, mappedMagicVersion, previousVersion
|
|
42201
|
+
const { service, language, mappedMagicVersion, previousVersion } = params;
|
|
42202
|
+
const analysis = this.withChangelogFallback(params.analysis);
|
|
42215
42203
|
const newVersion = incrementVersion(previousVersion, analysis.versionBump);
|
|
42216
42204
|
this.logger.info(`AutoVersionStep: ${analysis.versionBump} bump: ${previousVersion} \u2192 ${newVersion}`);
|
|
42217
42205
|
await service.replaceMagicVersion(this.outputDir, mappedMagicVersion, newVersion);
|
|
@@ -42265,7 +42253,8 @@ var AutoVersionStep = class extends BaseStep {
|
|
|
42265
42253
|
* the bumped version but does NOT commit — GithubStep handles the commit.
|
|
42266
42254
|
*/
|
|
42267
42255
|
async finalizeWithBumpNonReplay(params) {
|
|
42268
|
-
const { service, language, mappedMagicVersion, previousVersion
|
|
42256
|
+
const { service, language, mappedMagicVersion, previousVersion } = params;
|
|
42257
|
+
const analysis = this.withChangelogFallback(params.analysis);
|
|
42269
42258
|
const newVersion = incrementVersion(previousVersion, analysis.versionBump);
|
|
42270
42259
|
this.logger.info(
|
|
42271
42260
|
`AutoVersionStep (non-replay): ${analysis.versionBump} bump: ${previousVersion} \u2192 ${newVersion}`
|
|
@@ -42572,6 +42561,26 @@ ${body}` : `${COMMIT_MARKER} ${subject}`;
|
|
|
42572
42561
|
}
|
|
42573
42562
|
await (0, import_promises16.writeFile)(changelogPath, prependChangelogBlock({ existingContent: existing, version: version2, entry }), "utf-8");
|
|
42574
42563
|
}
|
|
42564
|
+
/**
|
|
42565
|
+
* MAJOR/MINOR bumps must ship a changelog entry. FAI occasionally returns a
|
|
42566
|
+
* bump with a populated `pr_description` / `version_bump_reason` but an empty
|
|
42567
|
+
* `changelog_entry`; reuse that text rather than writing a version-only block.
|
|
42568
|
+
*/
|
|
42569
|
+
withChangelogFallback(analysis) {
|
|
42570
|
+
const fallback = resolveChangelogEntryFallbackWithSource(analysis);
|
|
42571
|
+
if (fallback == null) {
|
|
42572
|
+
if (analysis.versionBump !== "PATCH" && !hasText(analysis.changelogEntry)) {
|
|
42573
|
+
this.logger.warn(
|
|
42574
|
+
`AutoVersionStep: FAI returned a ${analysis.versionBump} bump without a changelog entry and no fallback text.`
|
|
42575
|
+
);
|
|
42576
|
+
}
|
|
42577
|
+
return analysis;
|
|
42578
|
+
}
|
|
42579
|
+
this.logger.warn(
|
|
42580
|
+
`AutoVersionStep: FAI returned a ${analysis.versionBump} bump without a changelog entry; using the ${fallback.source} instead.`
|
|
42581
|
+
);
|
|
42582
|
+
return { ...analysis, changelogEntry: fallback.text };
|
|
42583
|
+
}
|
|
42575
42584
|
brandMessage(message) {
|
|
42576
42585
|
if (this.config.isWhitelabel) {
|
|
42577
42586
|
return message;
|
|
@@ -42602,10 +42611,7 @@ ${body}` : `${COMMIT_MARKER} ${subject}`;
|
|
|
42602
42611
|
}
|
|
42603
42612
|
async analyzeChunks(chunks, language, previousVersion) {
|
|
42604
42613
|
const { client, VersionBump: VersionBump4 } = await this.loadBaml();
|
|
42605
|
-
|
|
42606
|
-
let bestMessage = "";
|
|
42607
|
-
let bestVersionBumpReason;
|
|
42608
|
-
const changelogEntries = [];
|
|
42614
|
+
const chunkAnalyses = [];
|
|
42609
42615
|
for (let i2 = 0; i2 < chunks.length; i2++) {
|
|
42610
42616
|
const chunk = chunks[i2];
|
|
42611
42617
|
if (!chunk) {
|
|
@@ -42621,20 +42627,22 @@ ${body}` : `${COMMIT_MARKER} ${subject}`;
|
|
|
42621
42627
|
if (analysis.version_bump === VersionBump4.NO_CHANGE) {
|
|
42622
42628
|
continue;
|
|
42623
42629
|
}
|
|
42624
|
-
|
|
42625
|
-
|
|
42626
|
-
|
|
42627
|
-
|
|
42628
|
-
|
|
42629
|
-
}
|
|
42630
|
-
const entry = analysis.changelog_entry?.trim();
|
|
42631
|
-
if (entry) {
|
|
42632
|
-
changelogEntries.push(entry);
|
|
42633
|
-
}
|
|
42630
|
+
chunkAnalyses.push({
|
|
42631
|
+
versionBump: analysis.version_bump,
|
|
42632
|
+
message: analysis.message,
|
|
42633
|
+
changelogEntry: analysis.changelog_entry,
|
|
42634
|
+
versionBumpReason: analysis.version_bump_reason
|
|
42635
|
+
});
|
|
42634
42636
|
}
|
|
42635
|
-
if (
|
|
42637
|
+
if (chunkAnalyses.length === 0) {
|
|
42636
42638
|
return null;
|
|
42637
42639
|
}
|
|
42640
|
+
const { bestBump, bestMessage, bestVersionBumpReason, changelogEntries, usedBumpReasonAsEntry } = aggregateChunkAnalyses(chunkAnalyses);
|
|
42641
|
+
if (usedBumpReasonAsEntry) {
|
|
42642
|
+
this.logger.warn(
|
|
42643
|
+
`AutoVersionStep: no chunk produced a changelog entry for the ${bestBump} bump; using its version bump reason instead.`
|
|
42644
|
+
);
|
|
42645
|
+
}
|
|
42638
42646
|
if (changelogEntries.length <= 1) {
|
|
42639
42647
|
return {
|
|
42640
42648
|
versionBump: bestBump,
|
|
@@ -42750,6 +42758,57 @@ ${body}` : `${COMMIT_MARKER} ${subject}`;
|
|
|
42750
42758
|
return adapter;
|
|
42751
42759
|
}
|
|
42752
42760
|
};
|
|
42761
|
+
function aggregateChunkAnalyses(chunkAnalyses) {
|
|
42762
|
+
let bestBump = "NO_CHANGE";
|
|
42763
|
+
let bestMessage = "";
|
|
42764
|
+
let bestVersionBumpReason;
|
|
42765
|
+
const entries2 = [];
|
|
42766
|
+
for (const analysis of chunkAnalyses) {
|
|
42767
|
+
const prev = bestBump;
|
|
42768
|
+
bestBump = maxVersionBump(bestBump, analysis.versionBump);
|
|
42769
|
+
if (bestBump !== prev) {
|
|
42770
|
+
bestMessage = analysis.message;
|
|
42771
|
+
bestVersionBumpReason = analysis.versionBumpReason;
|
|
42772
|
+
}
|
|
42773
|
+
const text = analysis.changelogEntry?.trim();
|
|
42774
|
+
if (text) {
|
|
42775
|
+
entries2.push({ bump: analysis.versionBump, text });
|
|
42776
|
+
}
|
|
42777
|
+
}
|
|
42778
|
+
const changelogEntries = entries2.map((entry) => entry.text);
|
|
42779
|
+
const hasEntryAtBestBump = entries2.some((entry) => entry.bump === bestBump);
|
|
42780
|
+
const usedBumpReasonAsEntry = bestBump !== "PATCH" && !hasEntryAtBestBump && hasText(bestVersionBumpReason);
|
|
42781
|
+
if (usedBumpReasonAsEntry && bestVersionBumpReason != null) {
|
|
42782
|
+
changelogEntries.unshift(bestVersionBumpReason.trim());
|
|
42783
|
+
}
|
|
42784
|
+
return { bestBump, bestMessage, bestVersionBumpReason, changelogEntries, usedBumpReasonAsEntry };
|
|
42785
|
+
}
|
|
42786
|
+
function hasText(value) {
|
|
42787
|
+
return value != null && value.trim().length > 0;
|
|
42788
|
+
}
|
|
42789
|
+
function commitMessageBody(message) {
|
|
42790
|
+
const trimmed2 = message.trimEnd();
|
|
42791
|
+
const withoutTrailer = trimmed2.endsWith(FERN_TRAILER) ? trimmed2.slice(0, -FERN_TRAILER.length) : trimmed2;
|
|
42792
|
+
const [, ...rest] = withoutTrailer.split("\n");
|
|
42793
|
+
const body = rest.join("\n").trim();
|
|
42794
|
+
return body.length > 0 ? body : void 0;
|
|
42795
|
+
}
|
|
42796
|
+
function resolveChangelogEntryFallbackWithSource(analysis) {
|
|
42797
|
+
if (hasText(analysis.changelogEntry) || analysis.versionBump === "PATCH") {
|
|
42798
|
+
return void 0;
|
|
42799
|
+
}
|
|
42800
|
+
const candidates = [
|
|
42801
|
+
["PR description", analysis.prDescription],
|
|
42802
|
+
["version bump reason", analysis.versionBumpReason],
|
|
42803
|
+
["commit message body", commitMessageBody(analysis.message)]
|
|
42804
|
+
];
|
|
42805
|
+
for (const [source, text] of candidates) {
|
|
42806
|
+
if (hasText(text)) {
|
|
42807
|
+
return { source, text: text.trim() };
|
|
42808
|
+
}
|
|
42809
|
+
}
|
|
42810
|
+
return void 0;
|
|
42811
|
+
}
|
|
42753
42812
|
var FAI_VERSION_BUMPS = ["MAJOR", "MINOR", "PATCH", "NO_CHANGE"];
|
|
42754
42813
|
function isFaiAnalyzeResponse(value) {
|
|
42755
42814
|
if (typeof value !== "object" || value == null) {
|
|
@@ -43921,6 +43980,66 @@ var ReplayStep = class extends BaseStep {
|
|
|
43921
43980
|
}
|
|
43922
43981
|
};
|
|
43923
43982
|
|
|
43983
|
+
// ../cli/generation/local-generation/docker-utils/lib/dockerHubOatLogin.js
|
|
43984
|
+
var DOCKERHUB_OAT_ENV_VAR = "DOCKERHUB_OAT";
|
|
43985
|
+
var DOCKERHUB_OAT_USERNAME_ENV_VAR = "DOCKERHUB_OAT_USERNAME";
|
|
43986
|
+
var DEFAULT_DOCKERHUB_OAT_USERNAME = "fernenterprise";
|
|
43987
|
+
var DOCKER_HUB_HOSTS = /* @__PURE__ */ new Set([
|
|
43988
|
+
"docker.io",
|
|
43989
|
+
"index.docker.io",
|
|
43990
|
+
"registry-1.docker.io",
|
|
43991
|
+
"registry.hub.docker.com"
|
|
43992
|
+
]);
|
|
43993
|
+
function getDockerHubNamespace(imageName) {
|
|
43994
|
+
const parts = imageName.split("/");
|
|
43995
|
+
const [first2] = parts;
|
|
43996
|
+
if (first2 == null || parts.length < 2) {
|
|
43997
|
+
return void 0;
|
|
43998
|
+
}
|
|
43999
|
+
const host = first2.toLowerCase();
|
|
44000
|
+
const isRegistryHost = host.includes(".") || host.includes(":") || host === "localhost";
|
|
44001
|
+
if (!isRegistryHost) {
|
|
44002
|
+
return first2;
|
|
44003
|
+
}
|
|
44004
|
+
if (!DOCKER_HUB_HOSTS.has(host)) {
|
|
44005
|
+
return void 0;
|
|
44006
|
+
}
|
|
44007
|
+
return parts.length >= 3 ? parts[1] : void 0;
|
|
44008
|
+
}
|
|
44009
|
+
function resolveDockerHubOatLogin(imageName, env3 = process.env) {
|
|
44010
|
+
const token = env3[DOCKERHUB_OAT_ENV_VAR]?.trim();
|
|
44011
|
+
if (token == null || token === "") {
|
|
44012
|
+
return void 0;
|
|
44013
|
+
}
|
|
44014
|
+
const username = env3[DOCKERHUB_OAT_USERNAME_ENV_VAR]?.trim() || DEFAULT_DOCKERHUB_OAT_USERNAME;
|
|
44015
|
+
if (getDockerHubNamespace(imageName) !== username) {
|
|
44016
|
+
return void 0;
|
|
44017
|
+
}
|
|
44018
|
+
return { username, token };
|
|
44019
|
+
}
|
|
44020
|
+
async function ensureDockerHubOatLogin({ imageName, runner, logger, signal, env: env3 = process.env }) {
|
|
44021
|
+
const credentials = resolveDockerHubOatLogin(imageName, env3);
|
|
44022
|
+
if (credentials == null) {
|
|
44023
|
+
return;
|
|
44024
|
+
}
|
|
44025
|
+
logger?.debug(`Logging in to Docker Hub as ${credentials.username} with ${DOCKERHUB_OAT_ENV_VAR} to pull ${imageName}`);
|
|
44026
|
+
const { exitCode, stdout, stderr } = await loggingExeca(logger, runner ?? "docker", ["login", "--username", credentials.username, "--password-stdin"], {
|
|
44027
|
+
input: credentials.token,
|
|
44028
|
+
reject: false,
|
|
44029
|
+
doNotPipeOutput: true,
|
|
44030
|
+
secrets: [credentials.token],
|
|
44031
|
+
signal
|
|
44032
|
+
});
|
|
44033
|
+
if (exitCode !== 0) {
|
|
44034
|
+
if (signal?.aborted === true) {
|
|
44035
|
+
throw new Error(`Docker Hub login as ${credentials.username} was cancelled.`);
|
|
44036
|
+
}
|
|
44037
|
+
throw new Error(`Failed to log in to Docker Hub as ${credentials.username} using ${DOCKERHUB_OAT_ENV_VAR}. Check that the token is a valid organization access token for ${credentials.username} with pull access to ${imageName}.
|
|
44038
|
+
${stdout}
|
|
44039
|
+
${stderr}`);
|
|
44040
|
+
}
|
|
44041
|
+
}
|
|
44042
|
+
|
|
43924
44043
|
// ../cli/generation/local-generation/docker-utils/lib/runDocker.js
|
|
43925
44044
|
var import_promises18 = require("fs/promises");
|
|
43926
44045
|
var import_tmp_promise3 = __toESM(require_tmp_promise(), 1);
|
|
@@ -43955,6 +44074,7 @@ async function pullImage(imageName, runner, signal) {
|
|
|
43955
44074
|
}
|
|
43956
44075
|
async function startContainer({ logger, imageName, runner }) {
|
|
43957
44076
|
const containerRunner = runner ?? "docker";
|
|
44077
|
+
await ensureDockerHubOatLogin({ imageName, runner, logger });
|
|
43958
44078
|
const tryStart = async () => {
|
|
43959
44079
|
const { stdout, exitCode, stderr } = await loggingExeca(logger, containerRunner, ["run", "--user", "root", "-dit", "--entrypoint", "/bin/sh", imageName], {
|
|
43960
44080
|
reject: false,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fern-api/generator-cli",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.2",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/fern-api/fern.git",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@boundaryml/baml": "^0.219.0",
|
|
26
|
-
"@fern-api/replay": "0.19.
|
|
26
|
+
"@fern-api/replay": "0.19.3",
|
|
27
27
|
"@octokit/rest": "^22.0.1",
|
|
28
28
|
"es-toolkit": "^1.45.1",
|
|
29
29
|
"semver": "^7.6.3",
|