@fern-api/generator-cli 0.9.50 → 0.9.51
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 +27 -39
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -41162,56 +41162,44 @@ var AutoVersioningService = class _AutoVersioningService {
|
|
|
41162
41162
|
}
|
|
41163
41163
|
/**
|
|
41164
41164
|
* Removes paired - and + lines where the only difference is the magic version.
|
|
41165
|
+
*
|
|
41166
|
+
* Matching is done across the whole section rather than only between adjacent lines.
|
|
41167
|
+
* Unified diffs group every deletion before every addition within a hunk, so when
|
|
41168
|
+
* several version-bearing lines change together (e.g. `X-Fern-SDK-Version` and
|
|
41169
|
+
* `User-Agent` on consecutive lines) an adjacency-only pass leaves the interleaved
|
|
41170
|
+
* deletions behind. Once the magic-version additions are stripped, those orphaned
|
|
41171
|
+
* deletions reach the AI analyzer as apparent removals — which is why a routine
|
|
41172
|
+
* version bump was reported as the `User-Agent` header being dropped. Pairing each
|
|
41173
|
+
* version-change deletion with any unused version-change addition in the section and
|
|
41174
|
+
* dropping both keeps the diff balanced regardless of layout.
|
|
41165
41175
|
*/
|
|
41166
41176
|
removeVersionChangePairs(lines, mappedMagicVersion) {
|
|
41167
|
-
const
|
|
41168
|
-
let
|
|
41169
|
-
|
|
41170
|
-
|
|
41171
|
-
if (!currentLine) {
|
|
41172
|
-
lineIndex++;
|
|
41177
|
+
const removed = /* @__PURE__ */ new Set();
|
|
41178
|
+
for (let deletionIndex = 0; deletionIndex < lines.length; deletionIndex++) {
|
|
41179
|
+
const deletionLine = lines[deletionIndex];
|
|
41180
|
+
if (deletionLine == null || removed.has(deletionIndex) || !this.isDeletionLine(deletionLine)) {
|
|
41173
41181
|
continue;
|
|
41174
41182
|
}
|
|
41175
|
-
|
|
41176
|
-
|
|
41177
|
-
|
|
41178
|
-
|
|
41179
|
-
|
|
41180
|
-
|
|
41181
|
-
|
|
41182
|
-
|
|
41183
|
+
for (let additionIndex = 0; additionIndex < lines.length; additionIndex++) {
|
|
41184
|
+
if (additionIndex === deletionIndex || removed.has(additionIndex)) {
|
|
41185
|
+
continue;
|
|
41186
|
+
}
|
|
41187
|
+
const additionLine = lines[additionIndex];
|
|
41188
|
+
if (additionLine == null || !this.isAdditionLine(additionLine)) {
|
|
41189
|
+
continue;
|
|
41190
|
+
}
|
|
41191
|
+
if (this.isVersionChangePair(deletionLine, additionLine, mappedMagicVersion)) {
|
|
41192
|
+
removed.add(deletionIndex);
|
|
41193
|
+
removed.add(additionIndex);
|
|
41194
|
+
break;
|
|
41183
41195
|
}
|
|
41184
|
-
} else {
|
|
41185
|
-
result.push(currentLine);
|
|
41186
|
-
lineIndex++;
|
|
41187
41196
|
}
|
|
41188
41197
|
}
|
|
41189
|
-
return
|
|
41198
|
+
return lines.filter((_2, index) => !removed.has(index));
|
|
41190
41199
|
}
|
|
41191
41200
|
isDeletionLine(line) {
|
|
41192
41201
|
return line.startsWith("-") && !_AutoVersioningService.isDiffHeader(line);
|
|
41193
41202
|
}
|
|
41194
|
-
findMatchingAdditionLine(lines, startIndex, mappedMagicVersion) {
|
|
41195
|
-
const startLine = lines[startIndex];
|
|
41196
|
-
if (!startLine) {
|
|
41197
|
-
return -1;
|
|
41198
|
-
}
|
|
41199
|
-
for (let nextIndex = startIndex + 1; nextIndex < lines.length; nextIndex++) {
|
|
41200
|
-
const nextLine = lines[nextIndex];
|
|
41201
|
-
if (!nextLine) {
|
|
41202
|
-
continue;
|
|
41203
|
-
}
|
|
41204
|
-
if (this.shouldStopSearching(nextLine)) {
|
|
41205
|
-
break;
|
|
41206
|
-
}
|
|
41207
|
-
if (this.isAdditionLine(nextLine)) {
|
|
41208
|
-
if (this.isVersionChangePair(startLine, nextLine, mappedMagicVersion)) {
|
|
41209
|
-
return nextIndex;
|
|
41210
|
-
}
|
|
41211
|
-
}
|
|
41212
|
-
}
|
|
41213
|
-
return -1;
|
|
41214
|
-
}
|
|
41215
41203
|
isAdditionLine(line) {
|
|
41216
41204
|
return line.startsWith("+") && !_AutoVersioningService.isDiffHeader(line);
|
|
41217
41205
|
}
|