@fern-api/generator-cli 0.9.6 → 0.9.7
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 +55 -5
- package/package.json +2 -2
package/dist/cli.js
CHANGED
|
@@ -20098,7 +20098,7 @@ var init_diff3 = __esm({
|
|
|
20098
20098
|
}
|
|
20099
20099
|
});
|
|
20100
20100
|
|
|
20101
|
-
// ../../node_modules/.pnpm/@fern-api+replay@0.10.
|
|
20101
|
+
// ../../node_modules/.pnpm/@fern-api+replay@0.10.4/node_modules/@fern-api/replay/dist/index.js
|
|
20102
20102
|
var dist_exports = {};
|
|
20103
20103
|
__export(dist_exports, {
|
|
20104
20104
|
FERN_BOT_EMAIL: () => FERN_BOT_EMAIL2,
|
|
@@ -21063,7 +21063,7 @@ function status(outputDir) {
|
|
|
21063
21063
|
}
|
|
21064
21064
|
var import_fs6, import_path8, import_yaml, import_crypto, import_promises4, import_os, import_path9, import_fs7, import_path10, import_crypto2, import_fs8, import_path11, import_yaml2, import_crypto3, import_fs9, import_path12, import_fs10, __defProp3, __getOwnPropNames3, __esm3, __export3, GitClient_exports, GitClient, init_GitClient, HybridReconstruction_exports, init_HybridReconstruction, FERN_BOT_NAME2, FERN_BOT_EMAIL2, FERN_BOT_LOGIN2, FERN_SUPPORT_NAMES, LOCKFILE_HEADER, LockfileNotFoundError, LockfileManager, INFRASTRUCTURE_FILES, ReplayDetector, CONFLICT_OPENER, CONFLICT_SEPARATOR, CONFLICT_CLOSER, BINARY_EXTENSIONS, ReplayApplicator, ReplayCommitter, ReplayService, FernignoreMigrator, REPLAY_FERNIGNORE_ENTRIES, GITATTRIBUTES_ENTRIES, EMPTY_RESULT;
|
|
21065
21065
|
var init_dist3 = __esm({
|
|
21066
|
-
"../../node_modules/.pnpm/@fern-api+replay@0.10.
|
|
21066
|
+
"../../node_modules/.pnpm/@fern-api+replay@0.10.4/node_modules/@fern-api/replay/dist/index.js"() {
|
|
21067
21067
|
"use strict";
|
|
21068
21068
|
init_esm4();
|
|
21069
21069
|
import_fs6 = require("fs");
|
|
@@ -21427,6 +21427,7 @@ var init_dist3 = __esm({
|
|
|
21427
21427
|
}
|
|
21428
21428
|
const log = await this.git.exec([
|
|
21429
21429
|
"log",
|
|
21430
|
+
"--first-parent",
|
|
21430
21431
|
"--format=%H%x00%an%x00%ae%x00%s",
|
|
21431
21432
|
`${lastGen.commit_sha}..HEAD`,
|
|
21432
21433
|
"--",
|
|
@@ -21442,11 +21443,20 @@ var init_dist3 = __esm({
|
|
|
21442
21443
|
if (isGenerationCommit(commit)) {
|
|
21443
21444
|
continue;
|
|
21444
21445
|
}
|
|
21445
|
-
|
|
21446
|
-
if (parents.length > 1) {
|
|
21446
|
+
if (lock.patches.find((p) => p.original_commit === commit.sha)) {
|
|
21447
21447
|
continue;
|
|
21448
21448
|
}
|
|
21449
|
-
|
|
21449
|
+
const parents = await this.git.getCommitParents(commit.sha);
|
|
21450
|
+
if (parents.length > 1) {
|
|
21451
|
+
const compositePatch = await this.createMergeCompositePatch({
|
|
21452
|
+
mergeCommit: commit,
|
|
21453
|
+
firstParent: parents[0],
|
|
21454
|
+
lastGen,
|
|
21455
|
+
lock
|
|
21456
|
+
});
|
|
21457
|
+
if (compositePatch) {
|
|
21458
|
+
newPatches.push(compositePatch);
|
|
21459
|
+
}
|
|
21450
21460
|
continue;
|
|
21451
21461
|
}
|
|
21452
21462
|
let patchContent;
|
|
@@ -21545,6 +21555,46 @@ var init_dist3 = __esm({
|
|
|
21545
21555
|
const normalized = patchContent.split("\n").filter((line) => !line.startsWith("From ") && !line.startsWith("index ") && !line.startsWith("Date: ")).join("\n");
|
|
21546
21556
|
return `sha256:${(0, import_crypto.createHash)("sha256").update(normalized).digest("hex")}`;
|
|
21547
21557
|
}
|
|
21558
|
+
/**
|
|
21559
|
+
* Create a single composite patch for a merge commit by diffing the merge
|
|
21560
|
+
* commit against its first parent. This captures the net change of the
|
|
21561
|
+
* entire merged branch as one patch, eliminating accumulator chaining and
|
|
21562
|
+
* zero-net-change ghost conflicts.
|
|
21563
|
+
*/
|
|
21564
|
+
async createMergeCompositePatch(input) {
|
|
21565
|
+
const { mergeCommit, firstParent, lastGen, lock } = input;
|
|
21566
|
+
const forgottenHashes = new Set(lock.forgotten_hashes ?? []);
|
|
21567
|
+
const filesOutput = await this.git.exec([
|
|
21568
|
+
"diff",
|
|
21569
|
+
"--name-only",
|
|
21570
|
+
firstParent,
|
|
21571
|
+
mergeCommit.sha
|
|
21572
|
+
]);
|
|
21573
|
+
const files = filesOutput.trim().split("\n").filter(Boolean).filter((f2) => !INFRASTRUCTURE_FILES.has(f2)).filter((f2) => !f2.startsWith(".fern/"));
|
|
21574
|
+
if (files.length === 0) return null;
|
|
21575
|
+
const diff = await this.git.exec([
|
|
21576
|
+
"diff",
|
|
21577
|
+
firstParent,
|
|
21578
|
+
mergeCommit.sha,
|
|
21579
|
+
"--",
|
|
21580
|
+
...files
|
|
21581
|
+
]);
|
|
21582
|
+
if (!diff.trim()) return null;
|
|
21583
|
+
const contentHash = this.computeContentHash(diff);
|
|
21584
|
+
if (lock.patches.some((p) => p.content_hash === contentHash) || forgottenHashes.has(contentHash)) {
|
|
21585
|
+
return null;
|
|
21586
|
+
}
|
|
21587
|
+
return {
|
|
21588
|
+
id: `patch-merge-${mergeCommit.sha.slice(0, 8)}`,
|
|
21589
|
+
content_hash: contentHash,
|
|
21590
|
+
original_commit: mergeCommit.sha,
|
|
21591
|
+
original_message: mergeCommit.message,
|
|
21592
|
+
original_author: `${mergeCommit.authorName} <${mergeCommit.authorEmail}>`,
|
|
21593
|
+
base_generation: lastGen.commit_sha,
|
|
21594
|
+
files,
|
|
21595
|
+
patch_content: diff
|
|
21596
|
+
};
|
|
21597
|
+
}
|
|
21548
21598
|
/**
|
|
21549
21599
|
* Detect patches via tree diff for non-linear history. Returns a composite patch.
|
|
21550
21600
|
* Revert reconciliation is skipped here because tree-diff produces a single composite
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fern-api/generator-cli",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.7",
|
|
4
4
|
"repository": {
|
|
5
5
|
"type": "git",
|
|
6
6
|
"url": "git+https://github.com/fern-api/fern.git",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
"**"
|
|
23
23
|
],
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@fern-api/replay": "0.10.
|
|
25
|
+
"@fern-api/replay": "0.10.4",
|
|
26
26
|
"@octokit/rest": "^22.0.1",
|
|
27
27
|
"es-toolkit": "^1.45.1",
|
|
28
28
|
"tmp-promise": "^3.0.3"
|