@fern-api/replay 0.6.0 → 0.6.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.cjs +16642 -0
- package/dist/cli.cjs.map +1 -0
- package/dist/index.cjs +2014 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +463 -0
- package/dist/index.d.ts +463 -12
- package/dist/index.js +1968 -10
- package/dist/index.js.map +1 -1
- package/package.json +16 -6
- package/dist/FernignoreMigrator.d.ts +0 -38
- package/dist/FernignoreMigrator.d.ts.map +0 -1
- package/dist/FernignoreMigrator.js +0 -210
- package/dist/FernignoreMigrator.js.map +0 -1
- package/dist/LockfileManager.d.ts +0 -31
- package/dist/LockfileManager.d.ts.map +0 -1
- package/dist/LockfileManager.js +0 -124
- package/dist/LockfileManager.js.map +0 -1
- package/dist/ReplayApplicator.d.ts +0 -30
- package/dist/ReplayApplicator.d.ts.map +0 -1
- package/dist/ReplayApplicator.js +0 -544
- package/dist/ReplayApplicator.js.map +0 -1
- package/dist/ReplayCommitter.d.ts +0 -19
- package/dist/ReplayCommitter.d.ts.map +0 -1
- package/dist/ReplayCommitter.js +0 -64
- package/dist/ReplayCommitter.js.map +0 -1
- package/dist/ReplayDetector.d.ts +0 -22
- package/dist/ReplayDetector.d.ts.map +0 -1
- package/dist/ReplayDetector.js +0 -147
- package/dist/ReplayDetector.js.map +0 -1
- package/dist/ReplayService.d.ts +0 -100
- package/dist/ReplayService.d.ts.map +0 -1
- package/dist/ReplayService.js +0 -596
- package/dist/ReplayService.js.map +0 -1
- package/dist/ThreeWayMerge.d.ts +0 -11
- package/dist/ThreeWayMerge.d.ts.map +0 -1
- package/dist/ThreeWayMerge.js +0 -48
- package/dist/ThreeWayMerge.js.map +0 -1
- package/dist/cli.d.ts +0 -3
- package/dist/cli.d.ts.map +0 -1
- package/dist/cli.js +0 -462
- package/dist/cli.js.map +0 -1
- package/dist/commands/bootstrap.d.ts +0 -46
- package/dist/commands/bootstrap.d.ts.map +0 -1
- package/dist/commands/bootstrap.js +0 -237
- package/dist/commands/bootstrap.js.map +0 -1
- package/dist/commands/forget.d.ts +0 -16
- package/dist/commands/forget.d.ts.map +0 -1
- package/dist/commands/forget.js +0 -27
- package/dist/commands/forget.js.map +0 -1
- package/dist/commands/index.d.ts +0 -6
- package/dist/commands/index.d.ts.map +0 -1
- package/dist/commands/index.js +0 -6
- package/dist/commands/index.js.map +0 -1
- package/dist/commands/reset.d.ts +0 -16
- package/dist/commands/reset.d.ts.map +0 -1
- package/dist/commands/reset.js +0 -25
- package/dist/commands/reset.js.map +0 -1
- package/dist/commands/resolve.d.ts +0 -16
- package/dist/commands/resolve.d.ts.map +0 -1
- package/dist/commands/resolve.js +0 -28
- package/dist/commands/resolve.js.map +0 -1
- package/dist/commands/status.d.ts +0 -26
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js +0 -24
- package/dist/commands/status.js.map +0 -1
- package/dist/git/CommitDetection.d.ts +0 -7
- package/dist/git/CommitDetection.d.ts.map +0 -1
- package/dist/git/CommitDetection.js +0 -26
- package/dist/git/CommitDetection.js.map +0 -1
- package/dist/git/GitClient.d.ts +0 -22
- package/dist/git/GitClient.d.ts.map +0 -1
- package/dist/git/GitClient.js +0 -109
- package/dist/git/GitClient.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/types.d.ts +0 -80
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
package/dist/ReplayService.js
DELETED
|
@@ -1,596 +0,0 @@
|
|
|
1
|
-
import { existsSync, readFileSync } from "node:fs";
|
|
2
|
-
import { join } from "node:path";
|
|
3
|
-
import { minimatch } from "minimatch";
|
|
4
|
-
import { GitClient } from "./git/GitClient.js";
|
|
5
|
-
import { LockfileManager } from "./LockfileManager.js";
|
|
6
|
-
import { ReplayApplicator } from "./ReplayApplicator.js";
|
|
7
|
-
import { ReplayCommitter } from "./ReplayCommitter.js";
|
|
8
|
-
import { ReplayDetector } from "./ReplayDetector.js";
|
|
9
|
-
export class ReplayService {
|
|
10
|
-
git;
|
|
11
|
-
detector;
|
|
12
|
-
applicator;
|
|
13
|
-
committer;
|
|
14
|
-
lockManager;
|
|
15
|
-
outputDir;
|
|
16
|
-
constructor(outputDir, _config) {
|
|
17
|
-
const git = new GitClient(outputDir);
|
|
18
|
-
this.git = git;
|
|
19
|
-
this.outputDir = outputDir;
|
|
20
|
-
this.lockManager = new LockfileManager(outputDir);
|
|
21
|
-
this.detector = new ReplayDetector(git, this.lockManager, outputDir);
|
|
22
|
-
this.applicator = new ReplayApplicator(git, this.lockManager, outputDir);
|
|
23
|
-
this.committer = new ReplayCommitter(git, outputDir);
|
|
24
|
-
}
|
|
25
|
-
async runReplay(options) {
|
|
26
|
-
if (options?.skipApplication) {
|
|
27
|
-
return this.handleSkipApplication(options);
|
|
28
|
-
}
|
|
29
|
-
const flow = this.determineFlow();
|
|
30
|
-
switch (flow) {
|
|
31
|
-
case "first-generation":
|
|
32
|
-
return this.handleFirstGeneration(options);
|
|
33
|
-
case "no-patches":
|
|
34
|
-
return this.handleNoPatchesRegeneration(options);
|
|
35
|
-
case "normal-regeneration":
|
|
36
|
-
return this.handleNormalRegeneration(options);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* Sync the lockfile after a divergent PR was squash-merged.
|
|
41
|
-
* Call this BEFORE runReplay() when the CLI detects a merged divergent PR.
|
|
42
|
-
*
|
|
43
|
-
* After updating the generation record, re-detects customer patches via
|
|
44
|
-
* tree diff between the generation tag (pure generation tree) and HEAD
|
|
45
|
-
* (which includes customer customizations after squash merge). This ensures
|
|
46
|
-
* patches survive the squash merge → regenerate cycle even when the lockfile
|
|
47
|
-
* was restored from the base branch during conflict PR creation.
|
|
48
|
-
*/
|
|
49
|
-
async syncFromDivergentMerge(generationCommitSha, options) {
|
|
50
|
-
const treeHash = await this.git.getTreeHash(generationCommitSha);
|
|
51
|
-
const timestamp = (await this.git.exec(["log", "-1", "--format=%aI", generationCommitSha])).trim();
|
|
52
|
-
const record = {
|
|
53
|
-
commit_sha: generationCommitSha,
|
|
54
|
-
tree_hash: treeHash,
|
|
55
|
-
timestamp,
|
|
56
|
-
cli_version: options?.cliVersion ?? "unknown",
|
|
57
|
-
generator_versions: options?.generatorVersions ?? {},
|
|
58
|
-
base_branch_head: options?.baseBranchHead
|
|
59
|
-
};
|
|
60
|
-
if (!this.lockManager.exists()) {
|
|
61
|
-
this.lockManager.initializeInMemory(record);
|
|
62
|
-
}
|
|
63
|
-
else {
|
|
64
|
-
this.lockManager.read();
|
|
65
|
-
this.lockManager.addGeneration(record);
|
|
66
|
-
this.lockManager.clearPatches();
|
|
67
|
-
}
|
|
68
|
-
this.lockManager.save();
|
|
69
|
-
// Re-detect customer patches via tree diff. The generation tag has the
|
|
70
|
-
// pure generation tree, so any differences between it and HEAD represent
|
|
71
|
-
// customer customizations that survived the squash merge.
|
|
72
|
-
try {
|
|
73
|
-
const redetectedPatches = await this.detector.detectNewPatches();
|
|
74
|
-
if (redetectedPatches.length > 0) {
|
|
75
|
-
for (const patch of redetectedPatches) {
|
|
76
|
-
this.lockManager.addPatch(patch);
|
|
77
|
-
}
|
|
78
|
-
this.lockManager.save();
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
catch {
|
|
82
|
-
// If re-detection fails, proceed without patches.
|
|
83
|
-
// The normal replay flow will still attempt detection.
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
determineFlow() {
|
|
87
|
-
if (!this.lockManager.exists()) {
|
|
88
|
-
return "first-generation";
|
|
89
|
-
}
|
|
90
|
-
const lock = this.lockManager.read();
|
|
91
|
-
if (lock.patches.length === 0) {
|
|
92
|
-
return "no-patches";
|
|
93
|
-
}
|
|
94
|
-
return "normal-regeneration";
|
|
95
|
-
}
|
|
96
|
-
async handleFirstGeneration(options) {
|
|
97
|
-
if (options?.dryRun) {
|
|
98
|
-
return {
|
|
99
|
-
flow: "first-generation",
|
|
100
|
-
patchesDetected: 0,
|
|
101
|
-
patchesApplied: 0,
|
|
102
|
-
patchesWithConflicts: 0,
|
|
103
|
-
patchesSkipped: 0,
|
|
104
|
-
conflicts: []
|
|
105
|
-
};
|
|
106
|
-
}
|
|
107
|
-
const commitOpts = options
|
|
108
|
-
? {
|
|
109
|
-
cliVersion: options.cliVersion ?? "unknown",
|
|
110
|
-
generatorVersions: options.generatorVersions ?? {},
|
|
111
|
-
baseBranchHead: options.baseBranchHead
|
|
112
|
-
}
|
|
113
|
-
: undefined;
|
|
114
|
-
await this.committer.commitGeneration("Initial SDK generation", commitOpts);
|
|
115
|
-
const genRecord = await this.committer.createGenerationRecord(commitOpts);
|
|
116
|
-
this.lockManager.initialize(genRecord);
|
|
117
|
-
return {
|
|
118
|
-
flow: "first-generation",
|
|
119
|
-
patchesDetected: 0,
|
|
120
|
-
patchesApplied: 0,
|
|
121
|
-
patchesWithConflicts: 0,
|
|
122
|
-
patchesSkipped: 0,
|
|
123
|
-
conflicts: []
|
|
124
|
-
};
|
|
125
|
-
}
|
|
126
|
-
/**
|
|
127
|
-
* Skip-application mode: commit the generation and update the lockfile
|
|
128
|
-
* but don't detect or apply patches. Sets a marker so the next normal
|
|
129
|
-
* run skips revert detection in preGenerationRebase().
|
|
130
|
-
*/
|
|
131
|
-
async handleSkipApplication(options) {
|
|
132
|
-
const commitOpts = options
|
|
133
|
-
? {
|
|
134
|
-
cliVersion: options.cliVersion ?? "unknown",
|
|
135
|
-
generatorVersions: options.generatorVersions ?? {},
|
|
136
|
-
baseBranchHead: options.baseBranchHead
|
|
137
|
-
}
|
|
138
|
-
: undefined;
|
|
139
|
-
await this.committer.commitGeneration("Update SDK (replay skipped)", commitOpts);
|
|
140
|
-
const genRecord = await this.committer.createGenerationRecord(commitOpts);
|
|
141
|
-
if (this.lockManager.exists()) {
|
|
142
|
-
this.lockManager.read();
|
|
143
|
-
this.lockManager.addGeneration(genRecord);
|
|
144
|
-
}
|
|
145
|
-
else {
|
|
146
|
-
this.lockManager.initializeInMemory(genRecord);
|
|
147
|
-
}
|
|
148
|
-
this.lockManager.setReplaySkippedAt(new Date().toISOString());
|
|
149
|
-
this.lockManager.save();
|
|
150
|
-
// Commit the lockfile update so it's pushed with the branch.
|
|
151
|
-
// Without this, the marker and generation record stay in the
|
|
152
|
-
// working tree and are lost when GithubStep pushes.
|
|
153
|
-
if (!options?.stageOnly) {
|
|
154
|
-
await this.committer.commitReplay(0);
|
|
155
|
-
}
|
|
156
|
-
else {
|
|
157
|
-
await this.committer.stageAll();
|
|
158
|
-
}
|
|
159
|
-
return {
|
|
160
|
-
flow: "skip-application",
|
|
161
|
-
patchesDetected: 0,
|
|
162
|
-
patchesApplied: 0,
|
|
163
|
-
patchesWithConflicts: 0,
|
|
164
|
-
patchesSkipped: 0,
|
|
165
|
-
conflicts: []
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
async handleNoPatchesRegeneration(options) {
|
|
169
|
-
const newPatches = await this.detector.detectNewPatches();
|
|
170
|
-
const warnings = [...this.detector.warnings];
|
|
171
|
-
if (options?.dryRun) {
|
|
172
|
-
return {
|
|
173
|
-
flow: "no-patches",
|
|
174
|
-
patchesDetected: newPatches.length,
|
|
175
|
-
patchesApplied: 0,
|
|
176
|
-
patchesWithConflicts: 0,
|
|
177
|
-
patchesSkipped: 0,
|
|
178
|
-
conflicts: [],
|
|
179
|
-
wouldApply: newPatches,
|
|
180
|
-
warnings: warnings.length > 0 ? warnings : undefined
|
|
181
|
-
};
|
|
182
|
-
}
|
|
183
|
-
const commitOpts = options
|
|
184
|
-
? {
|
|
185
|
-
cliVersion: options.cliVersion ?? "unknown",
|
|
186
|
-
generatorVersions: options.generatorVersions ?? {},
|
|
187
|
-
baseBranchHead: options.baseBranchHead
|
|
188
|
-
}
|
|
189
|
-
: undefined;
|
|
190
|
-
await this.committer.commitGeneration("Update SDK", commitOpts);
|
|
191
|
-
const genRecord = await this.committer.createGenerationRecord(commitOpts);
|
|
192
|
-
// Add generation to lockfile BEFORE applying patches so the applicator
|
|
193
|
-
// can read the current generation's tree hash for rename detection.
|
|
194
|
-
this.lockManager.addGeneration(genRecord);
|
|
195
|
-
let results = [];
|
|
196
|
-
if (newPatches.length > 0) {
|
|
197
|
-
results = await this.applicator.applyPatches(newPatches);
|
|
198
|
-
}
|
|
199
|
-
// Rebase cleanly applied patches to the current generation.
|
|
200
|
-
// This prevents recurring conflicts on subsequent regenerations.
|
|
201
|
-
const rebaseCounts = await this.rebasePatches(results, genRecord.commit_sha);
|
|
202
|
-
// Save lockfile BEFORE commit — lockfile is source of truth.
|
|
203
|
-
for (const patch of newPatches) {
|
|
204
|
-
if (!rebaseCounts.absorbedPatchIds.has(patch.id)) {
|
|
205
|
-
this.lockManager.addPatch(patch);
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
this.lockManager.save();
|
|
209
|
-
if (newPatches.length > 0) {
|
|
210
|
-
if (!options?.stageOnly) {
|
|
211
|
-
const appliedCount = results.filter((r) => r.status === "applied" || r.status === "conflict").length;
|
|
212
|
-
if (appliedCount > 0) {
|
|
213
|
-
await this.committer.commitReplay(appliedCount, newPatches);
|
|
214
|
-
}
|
|
215
|
-
}
|
|
216
|
-
else {
|
|
217
|
-
await this.committer.stageAll();
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
return this.buildReport("no-patches", newPatches, results, options, warnings, rebaseCounts);
|
|
221
|
-
}
|
|
222
|
-
async handleNormalRegeneration(options) {
|
|
223
|
-
if (options?.dryRun) {
|
|
224
|
-
const existingPatches = this.lockManager.getPatches();
|
|
225
|
-
const newPatches = await this.detector.detectNewPatches();
|
|
226
|
-
const warnings = [...this.detector.warnings];
|
|
227
|
-
const allPatches = [...existingPatches, ...newPatches];
|
|
228
|
-
return {
|
|
229
|
-
flow: "normal-regeneration",
|
|
230
|
-
patchesDetected: allPatches.length,
|
|
231
|
-
patchesApplied: 0,
|
|
232
|
-
patchesWithConflicts: 0,
|
|
233
|
-
patchesSkipped: 0,
|
|
234
|
-
conflicts: [],
|
|
235
|
-
wouldApply: allPatches,
|
|
236
|
-
warnings: warnings.length > 0 ? warnings : undefined
|
|
237
|
-
};
|
|
238
|
-
}
|
|
239
|
-
// Pre-generation rebase: update stale/modified patches while HEAD has customer code.
|
|
240
|
-
let existingPatches = this.lockManager.getPatches();
|
|
241
|
-
const preRebaseCounts = await this.preGenerationRebase(existingPatches);
|
|
242
|
-
// Dedup patches by content hash after pre-generation rebase.
|
|
243
|
-
existingPatches = this.lockManager.getPatches();
|
|
244
|
-
const seenHashes = new Set();
|
|
245
|
-
for (const p of existingPatches) {
|
|
246
|
-
if (seenHashes.has(p.content_hash)) {
|
|
247
|
-
this.lockManager.removePatch(p.id);
|
|
248
|
-
}
|
|
249
|
-
else {
|
|
250
|
-
seenHashes.add(p.content_hash);
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
existingPatches = this.lockManager.getPatches();
|
|
254
|
-
const newPatches = await this.detector.detectNewPatches();
|
|
255
|
-
const warnings = [...this.detector.warnings];
|
|
256
|
-
const allPatches = [...existingPatches, ...newPatches];
|
|
257
|
-
const commitOpts = options
|
|
258
|
-
? {
|
|
259
|
-
cliVersion: options.cliVersion ?? "unknown",
|
|
260
|
-
generatorVersions: options.generatorVersions ?? {},
|
|
261
|
-
baseBranchHead: options.baseBranchHead
|
|
262
|
-
}
|
|
263
|
-
: undefined;
|
|
264
|
-
await this.committer.commitGeneration("Update SDK", commitOpts);
|
|
265
|
-
const genRecord = await this.committer.createGenerationRecord(commitOpts);
|
|
266
|
-
// Add generation to lockfile BEFORE applying patches so the applicator
|
|
267
|
-
// can read the current generation's tree hash for rename detection.
|
|
268
|
-
this.lockManager.addGeneration(genRecord);
|
|
269
|
-
const results = await this.applicator.applyPatches(allPatches);
|
|
270
|
-
// Rebase cleanly applied patches to the current generation.
|
|
271
|
-
const rebaseCounts = await this.rebasePatches(results, genRecord.commit_sha);
|
|
272
|
-
// Save lockfile BEFORE commit — lockfile is source of truth.
|
|
273
|
-
for (const patch of newPatches) {
|
|
274
|
-
if (!rebaseCounts.absorbedPatchIds.has(patch.id)) {
|
|
275
|
-
this.lockManager.addPatch(patch);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
this.lockManager.save();
|
|
279
|
-
if (options?.stageOnly) {
|
|
280
|
-
await this.committer.stageAll();
|
|
281
|
-
}
|
|
282
|
-
else {
|
|
283
|
-
const appliedCount = results.filter((r) => r.status === "applied" || r.status === "conflict").length;
|
|
284
|
-
if (appliedCount > 0) {
|
|
285
|
-
await this.committer.commitReplay(appliedCount, allPatches);
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
|
-
return this.buildReport("normal-regeneration", allPatches, results, options, warnings, rebaseCounts, preRebaseCounts);
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* Rebase cleanly applied patches so they are relative to the current generation.
|
|
292
|
-
* This prevents recurring conflicts on subsequent regenerations.
|
|
293
|
-
* Returns the number of patches rebased.
|
|
294
|
-
*/
|
|
295
|
-
async rebasePatches(results, currentGenSha) {
|
|
296
|
-
let absorbed = 0;
|
|
297
|
-
let repointed = 0;
|
|
298
|
-
let contentRebased = 0;
|
|
299
|
-
let keptAsUserOwned = 0;
|
|
300
|
-
// Track content hashes to deduplicate converging incremental patches.
|
|
301
|
-
const seenContentHashes = new Set();
|
|
302
|
-
const absorbedPatchIds = new Set();
|
|
303
|
-
// Pre-pass: Update patch.files with resolved (renamed) paths from application.
|
|
304
|
-
// This ensures downstream operations (user-owned check, git diff, git show)
|
|
305
|
-
// use the current file paths rather than stale pre-rename paths.
|
|
306
|
-
for (const result of results) {
|
|
307
|
-
if (result.resolvedFiles && Object.keys(result.resolvedFiles).length > 0) {
|
|
308
|
-
const patch = result.patch;
|
|
309
|
-
const updatedFiles = patch.files.map((f) => result.resolvedFiles[f] ?? f);
|
|
310
|
-
patch.files = updatedFiles;
|
|
311
|
-
try {
|
|
312
|
-
this.lockManager.updatePatch(patch.id, { files: updatedFiles });
|
|
313
|
-
}
|
|
314
|
-
catch {
|
|
315
|
-
// New patches aren't in lockfile yet — in-memory update sufficient
|
|
316
|
-
}
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
for (const result of results) {
|
|
320
|
-
if (result.status === "conflict" && result.fileResults) {
|
|
321
|
-
// For conflict patches with mixed results, trim any clean files
|
|
322
|
-
// that were absorbed by the generator. This prevents absorbed files
|
|
323
|
-
// from poisoning the pre-generation rebase conflict marker check.
|
|
324
|
-
await this.trimAbsorbedFiles(result, currentGenSha);
|
|
325
|
-
continue;
|
|
326
|
-
}
|
|
327
|
-
// Only rebase cleanly applied patches.
|
|
328
|
-
// Conflicted patches keep their old base_generation so they retry.
|
|
329
|
-
if (result.status !== "applied")
|
|
330
|
-
continue;
|
|
331
|
-
const patch = result.patch;
|
|
332
|
-
// Skip if already based on the current generation
|
|
333
|
-
if (patch.base_generation === currentGenSha)
|
|
334
|
-
continue;
|
|
335
|
-
try {
|
|
336
|
-
// Check if any files are user-owned (new, .fernignore-protected, or .fernignore itself).
|
|
337
|
-
const fernignorePatterns = this.readFernignorePatterns();
|
|
338
|
-
const isUserOwned = await Promise.all(patch.files.map(async (file) => {
|
|
339
|
-
// .fernignore itself is always user-owned
|
|
340
|
-
if (file === ".fernignore") {
|
|
341
|
-
return true;
|
|
342
|
-
}
|
|
343
|
-
// Check .fernignore patterns (cheaper than git)
|
|
344
|
-
if (fernignorePatterns.some((p) => file === p || minimatch(file, p))) {
|
|
345
|
-
return true;
|
|
346
|
-
}
|
|
347
|
-
// Check if file exists in the generation commit tree
|
|
348
|
-
const content = await this.git.showFile(currentGenSha, file);
|
|
349
|
-
return content === null;
|
|
350
|
-
}));
|
|
351
|
-
const hasUserOwnedFiles = isUserOwned.some(Boolean);
|
|
352
|
-
if (hasUserOwnedFiles) {
|
|
353
|
-
// Patch contains user-owned files — just update base_generation
|
|
354
|
-
// to prevent re-evaluation. Keep patch_content as-is since
|
|
355
|
-
// these files aren't produced by the generator.
|
|
356
|
-
this.lockManager.updatePatch(patch.id, {
|
|
357
|
-
base_generation: currentGenSha
|
|
358
|
-
});
|
|
359
|
-
keptAsUserOwned++;
|
|
360
|
-
continue;
|
|
361
|
-
}
|
|
362
|
-
// All files exist in generation — safe to use git diff for
|
|
363
|
-
// absorption check and patch rebasing.
|
|
364
|
-
const diff = await this.git.exec(["diff", currentGenSha, "--", ...patch.files]).catch(() => null);
|
|
365
|
-
if (!diff || !diff.trim()) {
|
|
366
|
-
// Patch is now empty — customization was absorbed by the generator.
|
|
367
|
-
this.lockManager.removePatch(patch.id);
|
|
368
|
-
absorbedPatchIds.add(patch.id);
|
|
369
|
-
absorbed++;
|
|
370
|
-
continue;
|
|
371
|
-
}
|
|
372
|
-
const newContentHash = this.detector.computeContentHash(diff);
|
|
373
|
-
// If another patch already captured this exact diff, this patch
|
|
374
|
-
// is redundant (e.g., incremental patches that both resolve to
|
|
375
|
-
// the same cumulative state after rebase).
|
|
376
|
-
if (seenContentHashes.has(newContentHash)) {
|
|
377
|
-
this.lockManager.removePatch(patch.id);
|
|
378
|
-
absorbedPatchIds.add(patch.id);
|
|
379
|
-
absorbed++;
|
|
380
|
-
continue;
|
|
381
|
-
}
|
|
382
|
-
seenContentHashes.add(newContentHash);
|
|
383
|
-
this.lockManager.updatePatch(patch.id, {
|
|
384
|
-
base_generation: currentGenSha,
|
|
385
|
-
patch_content: diff,
|
|
386
|
-
content_hash: newContentHash
|
|
387
|
-
});
|
|
388
|
-
contentRebased++;
|
|
389
|
-
}
|
|
390
|
-
catch {
|
|
391
|
-
// If rebasing fails for any reason, keep the original patch unchanged
|
|
392
|
-
}
|
|
393
|
-
}
|
|
394
|
-
return { absorbed, repointed, contentRebased, keptAsUserOwned, absorbedPatchIds };
|
|
395
|
-
}
|
|
396
|
-
/**
|
|
397
|
-
* For conflict patches with mixed results (some files merged, some conflicted),
|
|
398
|
-
* check if the cleanly merged files were absorbed by the generator (empty diff).
|
|
399
|
-
* If so, remove them from patch.files so they don't pollute the pre-generation
|
|
400
|
-
* rebase conflict marker check (`git grep <<<<<<< -- ...patch.files`).
|
|
401
|
-
*
|
|
402
|
-
* Non-absorbed clean files stay in patch.files — removing them would lose
|
|
403
|
-
* the customization on the next generation.
|
|
404
|
-
*/
|
|
405
|
-
async trimAbsorbedFiles(result, currentGenSha) {
|
|
406
|
-
const cleanFiles = result.fileResults.filter((f) => f.status === "merged").map((f) => f.file);
|
|
407
|
-
if (cleanFiles.length === 0)
|
|
408
|
-
return;
|
|
409
|
-
const patch = result.patch;
|
|
410
|
-
const fernignorePatterns = this.readFernignorePatterns();
|
|
411
|
-
// Filter to only generator-produced clean files (not user-owned)
|
|
412
|
-
const generatorCleanFiles = [];
|
|
413
|
-
for (const file of cleanFiles) {
|
|
414
|
-
if (file === ".fernignore")
|
|
415
|
-
continue;
|
|
416
|
-
if (fernignorePatterns.some((p) => file === p || minimatch(file, p)))
|
|
417
|
-
continue;
|
|
418
|
-
const content = await this.git.showFile(currentGenSha, file);
|
|
419
|
-
if (content === null)
|
|
420
|
-
continue; // user-owned new file
|
|
421
|
-
generatorCleanFiles.push(file);
|
|
422
|
-
}
|
|
423
|
-
if (generatorCleanFiles.length === 0)
|
|
424
|
-
return;
|
|
425
|
-
// Check which clean files have an empty diff (absorbed by generator)
|
|
426
|
-
const absorbedFiles = new Set();
|
|
427
|
-
for (const file of generatorCleanFiles) {
|
|
428
|
-
try {
|
|
429
|
-
const diff = await this.git.exec(["diff", currentGenSha, "--", file]).catch(() => null);
|
|
430
|
-
if (!diff || !diff.trim()) {
|
|
431
|
-
absorbedFiles.add(file);
|
|
432
|
-
}
|
|
433
|
-
}
|
|
434
|
-
catch {
|
|
435
|
-
// If diff fails, leave the file in the patch
|
|
436
|
-
}
|
|
437
|
-
}
|
|
438
|
-
if (absorbedFiles.size === 0)
|
|
439
|
-
return;
|
|
440
|
-
// Remove absorbed files from the patch's file list
|
|
441
|
-
const remainingFiles = patch.files.filter((f) => !absorbedFiles.has(f));
|
|
442
|
-
if (remainingFiles.length === patch.files.length)
|
|
443
|
-
return; // nothing changed
|
|
444
|
-
try {
|
|
445
|
-
this.lockManager.updatePatch(patch.id, { files: remainingFiles });
|
|
446
|
-
}
|
|
447
|
-
catch {
|
|
448
|
-
// New patches aren't in lockfile yet — update in-memory only
|
|
449
|
-
patch.files = remainingFiles;
|
|
450
|
-
}
|
|
451
|
-
}
|
|
452
|
-
/**
|
|
453
|
-
* Pre-generation rebase: update patches using the customer's current state.
|
|
454
|
-
* Called BEFORE commitGeneration() while HEAD has customer code.
|
|
455
|
-
*/
|
|
456
|
-
async preGenerationRebase(patches) {
|
|
457
|
-
const lock = this.lockManager.read();
|
|
458
|
-
const currentGen = lock.current_generation;
|
|
459
|
-
// If the previous run was skip-application, clear the marker and
|
|
460
|
-
// skip all revert detection. Patches are preserved as-is.
|
|
461
|
-
if (this.lockManager.isReplaySkipped()) {
|
|
462
|
-
this.lockManager.clearReplaySkippedAt();
|
|
463
|
-
return { conflictResolved: 0, conflictAbsorbed: 0, contentRefreshed: 0 };
|
|
464
|
-
}
|
|
465
|
-
let conflictResolved = 0;
|
|
466
|
-
let conflictAbsorbed = 0;
|
|
467
|
-
let contentRefreshed = 0;
|
|
468
|
-
for (const patch of patches) {
|
|
469
|
-
if (patch.base_generation === currentGen) {
|
|
470
|
-
// Content refresh: check if user modified their customization
|
|
471
|
-
// since the last replay commit.
|
|
472
|
-
try {
|
|
473
|
-
const diff = await this.git
|
|
474
|
-
.exec(["diff", currentGen, "HEAD", "--", ...patch.files])
|
|
475
|
-
.catch(() => null);
|
|
476
|
-
if (diff === null)
|
|
477
|
-
continue;
|
|
478
|
-
if (!diff.trim()) {
|
|
479
|
-
// User reverted all customizations in this patch
|
|
480
|
-
this.lockManager.removePatch(patch.id);
|
|
481
|
-
contentRefreshed++;
|
|
482
|
-
continue;
|
|
483
|
-
}
|
|
484
|
-
const newContentHash = this.detector.computeContentHash(diff);
|
|
485
|
-
if (newContentHash !== patch.content_hash) {
|
|
486
|
-
// User changed their customization — update patch content
|
|
487
|
-
// and recalculate the files list (some files may no longer differ)
|
|
488
|
-
const filesOutput = await this.git
|
|
489
|
-
.exec(["diff", "--name-only", currentGen, "HEAD", "--", ...patch.files])
|
|
490
|
-
.catch(() => null);
|
|
491
|
-
const newFiles = filesOutput
|
|
492
|
-
? filesOutput
|
|
493
|
-
.trim()
|
|
494
|
-
.split("\n")
|
|
495
|
-
.filter(Boolean)
|
|
496
|
-
.filter((f) => !f.startsWith(".fern/"))
|
|
497
|
-
: patch.files;
|
|
498
|
-
if (newFiles.length === 0) {
|
|
499
|
-
this.lockManager.removePatch(patch.id);
|
|
500
|
-
}
|
|
501
|
-
else {
|
|
502
|
-
this.lockManager.updatePatch(patch.id, {
|
|
503
|
-
patch_content: diff,
|
|
504
|
-
content_hash: newContentHash,
|
|
505
|
-
files: newFiles
|
|
506
|
-
});
|
|
507
|
-
}
|
|
508
|
-
contentRefreshed++;
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
catch {
|
|
512
|
-
// If anything fails, leave the patch unchanged
|
|
513
|
-
}
|
|
514
|
-
continue;
|
|
515
|
-
}
|
|
516
|
-
try {
|
|
517
|
-
// Check for unresolved conflict markers in HEAD
|
|
518
|
-
const markerFiles = await this.git
|
|
519
|
-
.exec(["grep", "-l", "<<<<<<<", "HEAD", "--", ...patch.files])
|
|
520
|
-
.catch(() => "");
|
|
521
|
-
if (markerFiles.trim())
|
|
522
|
-
continue;
|
|
523
|
-
// Compute customer's resolved state relative to current generation
|
|
524
|
-
const diff = await this.git.exec(["diff", currentGen, "HEAD", "--", ...patch.files]).catch(() => null);
|
|
525
|
-
// Diff command failed (e.g., invalid SHA) — skip this patch
|
|
526
|
-
if (diff === null)
|
|
527
|
-
continue;
|
|
528
|
-
if (!diff.trim()) {
|
|
529
|
-
// Empty diff — customer reverted their customization
|
|
530
|
-
this.lockManager.removePatch(patch.id);
|
|
531
|
-
conflictAbsorbed++;
|
|
532
|
-
continue;
|
|
533
|
-
}
|
|
534
|
-
// Update the patch with the resolved content
|
|
535
|
-
const newContentHash = this.detector.computeContentHash(diff);
|
|
536
|
-
this.lockManager.updatePatch(patch.id, {
|
|
537
|
-
base_generation: currentGen,
|
|
538
|
-
patch_content: diff,
|
|
539
|
-
content_hash: newContentHash
|
|
540
|
-
});
|
|
541
|
-
conflictResolved++;
|
|
542
|
-
}
|
|
543
|
-
catch {
|
|
544
|
-
// If anything fails, leave the patch unchanged
|
|
545
|
-
}
|
|
546
|
-
}
|
|
547
|
-
return { conflictResolved, conflictAbsorbed, contentRefreshed };
|
|
548
|
-
}
|
|
549
|
-
readFernignorePatterns() {
|
|
550
|
-
const fernignorePath = join(this.outputDir, ".fernignore");
|
|
551
|
-
if (!existsSync(fernignorePath))
|
|
552
|
-
return [];
|
|
553
|
-
return readFileSync(fernignorePath, "utf-8")
|
|
554
|
-
.split("\n")
|
|
555
|
-
.map((line) => line.trim())
|
|
556
|
-
.filter((line) => line && !line.startsWith("#"));
|
|
557
|
-
}
|
|
558
|
-
buildReport(flow, patches, results, options, warnings, rebaseCounts, preRebaseCounts) {
|
|
559
|
-
const conflictResults = results.filter((r) => r.status === "conflict");
|
|
560
|
-
const conflictDetails = conflictResults
|
|
561
|
-
.map((r) => {
|
|
562
|
-
const conflictFiles = r.fileResults?.filter((f) => f.status === "conflict") ?? [];
|
|
563
|
-
const cleanFiles = r.fileResults?.filter((f) => f.status === "merged").map((f) => f.file) ?? [];
|
|
564
|
-
return {
|
|
565
|
-
patchId: r.patch.id,
|
|
566
|
-
patchMessage: r.patch.original_message,
|
|
567
|
-
reason: r.conflictReason,
|
|
568
|
-
files: conflictFiles,
|
|
569
|
-
cleanFiles: cleanFiles.length > 0 ? cleanFiles : undefined
|
|
570
|
-
};
|
|
571
|
-
})
|
|
572
|
-
.filter((d) => d.files.length > 0);
|
|
573
|
-
const partialCount = conflictDetails.filter((d) => d.cleanFiles && d.cleanFiles.length > 0).length;
|
|
574
|
-
return {
|
|
575
|
-
flow,
|
|
576
|
-
patchesDetected: patches.length,
|
|
577
|
-
patchesApplied: results.filter((r) => r.status === "applied").length,
|
|
578
|
-
patchesWithConflicts: conflictResults.length,
|
|
579
|
-
patchesSkipped: results.filter((r) => r.status === "skipped").length,
|
|
580
|
-
patchesPartiallyApplied: partialCount > 0 ? partialCount : undefined,
|
|
581
|
-
patchesAbsorbed: rebaseCounts && rebaseCounts.absorbed > 0 ? rebaseCounts.absorbed : undefined,
|
|
582
|
-
patchesRepointed: rebaseCounts && rebaseCounts.repointed > 0 ? rebaseCounts.repointed : undefined,
|
|
583
|
-
patchesContentRebased: rebaseCounts && rebaseCounts.contentRebased > 0 ? rebaseCounts.contentRebased : undefined,
|
|
584
|
-
patchesKeptAsUserOwned: rebaseCounts && rebaseCounts.keptAsUserOwned > 0 ? rebaseCounts.keptAsUserOwned : undefined,
|
|
585
|
-
patchesConflictResolved: preRebaseCounts && preRebaseCounts.conflictResolved + preRebaseCounts.conflictAbsorbed > 0
|
|
586
|
-
? preRebaseCounts.conflictResolved + preRebaseCounts.conflictAbsorbed
|
|
587
|
-
: undefined,
|
|
588
|
-
patchesRefreshed: preRebaseCounts && preRebaseCounts.contentRefreshed > 0 ? preRebaseCounts.contentRefreshed : undefined,
|
|
589
|
-
conflicts: conflictResults.flatMap((r) => r.fileResults?.filter((f) => f.status === "conflict") ?? []),
|
|
590
|
-
conflictDetails: conflictDetails.length > 0 ? conflictDetails : undefined,
|
|
591
|
-
wouldApply: options?.dryRun ? patches : undefined,
|
|
592
|
-
warnings: warnings && warnings.length > 0 ? warnings : undefined
|
|
593
|
-
};
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
//# sourceMappingURL=ReplayService.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ReplayService.js","sourceRoot":"","sources":["../src/ReplayService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD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C,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS;YACzE,UAAU,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS;YACjD,QAAQ,EAAE,QAAQ,IAAI,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS;SACnE,CAAC;IACN,CAAC;CACJ"}
|
package/dist/ThreeWayMerge.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { MergeResult } from "./types.js";
|
|
2
|
-
/**
|
|
3
|
-
* Performs a 3-way merge using the diff3 algorithm.
|
|
4
|
-
*
|
|
5
|
-
* @param base - The common ancestor (pristine generated state user edited against)
|
|
6
|
-
* @param ours - The new generated version
|
|
7
|
-
* @param theirs - The user's customized version
|
|
8
|
-
* @returns MergeResult with content, conflict flag, and conflict regions
|
|
9
|
-
*/
|
|
10
|
-
export declare function threeWayMerge(base: string, ours: string, theirs: string): MergeResult;
|
|
11
|
-
//# sourceMappingURL=ThreeWayMerge.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ThreeWayMerge.d.ts","sourceRoot":"","sources":["../src/ThreeWayMerge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAkB,WAAW,EAAE,MAAM,YAAY,CAAC;AAE9D;;;;;;;GAOG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,CA2CrF"}
|