@fern-api/replay 0.5.0 → 0.6.1
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 -65
- package/dist/FernignoreMigrator.d.ts.map +0 -1
- package/dist/FernignoreMigrator.js +0 -237
- 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 -62
- package/dist/ReplayApplicator.d.ts.map +0 -1
- package/dist/ReplayApplicator.js +0 -533
- package/dist/ReplayApplicator.js.map +0 -1
- package/dist/ReplayCommitter.d.ts +0 -39
- package/dist/ReplayCommitter.d.ts.map +0 -1
- package/dist/ReplayCommitter.js +0 -84
- package/dist/ReplayCommitter.js.map +0 -1
- package/dist/ReplayDetector.d.ts +0 -27
- package/dist/ReplayDetector.d.ts.map +0 -1
- package/dist/ReplayDetector.js +0 -150
- package/dist/ReplayDetector.js.map +0 -1
- package/dist/ReplayService.d.ts +0 -113
- package/dist/ReplayService.d.ts.map +0 -1
- package/dist/ReplayService.js +0 -579
- 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 -262
- package/dist/commands/bootstrap.js.map +0 -1
- package/dist/commands/forget.d.ts +0 -26
- package/dist/commands/forget.d.ts.map +0 -1
- package/dist/commands/forget.js +0 -37
- 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 -28
- package/dist/commands/reset.d.ts.map +0 -1
- package/dist/commands/reset.js +0 -37
- 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 -34
- package/dist/commands/status.d.ts.map +0 -1
- package/dist/commands/status.js +0 -32
- package/dist/commands/status.js.map +0 -1
- package/dist/git/CommitDetection.d.ts +0 -11
- package/dist/git/CommitDetection.d.ts.map +0 -1
- package/dist/git/CommitDetection.js +0 -25
- package/dist/git/CommitDetection.js.map +0 -1
- package/dist/git/GitClient.d.ts +0 -33
- package/dist/git/GitClient.d.ts.map +0 -1
- package/dist/git/GitClient.js +0 -118
- package/dist/git/GitClient.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/types.d.ts +0 -78
- package/dist/types.d.ts.map +0 -1
- package/dist/types.js +0 -3
- package/dist/types.js.map +0 -1
package/dist/ReplayApplicator.js
DELETED
|
@@ -1,533 +0,0 @@
|
|
|
1
|
-
import { readFile, writeFile, mkdtemp, rm, mkdir } from "node:fs/promises";
|
|
2
|
-
import { join, dirname, extname } from "node:path";
|
|
3
|
-
import { tmpdir } from "node:os";
|
|
4
|
-
import { minimatch } from "minimatch";
|
|
5
|
-
import { threeWayMerge } from "./ThreeWayMerge.js";
|
|
6
|
-
const BINARY_EXTENSIONS = new Set([
|
|
7
|
-
".png", ".jpg", ".jpeg", ".gif", ".bmp", ".ico", ".webp", ".svg",
|
|
8
|
-
".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx",
|
|
9
|
-
".zip", ".gz", ".tar", ".bz2", ".7z", ".rar",
|
|
10
|
-
".jar", ".war", ".ear", ".class",
|
|
11
|
-
".exe", ".dll", ".so", ".dylib", ".o", ".a",
|
|
12
|
-
".woff", ".woff2", ".ttf", ".eot", ".otf",
|
|
13
|
-
".mp3", ".mp4", ".avi", ".mov", ".wav", ".flac",
|
|
14
|
-
".sqlite", ".db",
|
|
15
|
-
".pyc", ".pyo",
|
|
16
|
-
".DS_Store",
|
|
17
|
-
]);
|
|
18
|
-
export class ReplayApplicator {
|
|
19
|
-
git;
|
|
20
|
-
lockManager;
|
|
21
|
-
outputDir;
|
|
22
|
-
renameCache = new Map();
|
|
23
|
-
fileTheirsAccumulator = new Map();
|
|
24
|
-
constructor(git, lockManager, outputDir) {
|
|
25
|
-
this.git = git;
|
|
26
|
-
this.lockManager = lockManager;
|
|
27
|
-
this.outputDir = outputDir;
|
|
28
|
-
}
|
|
29
|
-
/** Reset inter-patch accumulator for a new cycle. */
|
|
30
|
-
resetAccumulator() {
|
|
31
|
-
this.fileTheirsAccumulator.clear();
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Apply all patches, returning results for each.
|
|
35
|
-
* Skips patches that match exclude patterns in replay.yml
|
|
36
|
-
*/
|
|
37
|
-
async applyPatches(patches) {
|
|
38
|
-
this.resetAccumulator(); // Clear accumulator for this apply cycle
|
|
39
|
-
const results = [];
|
|
40
|
-
for (const patch of patches) {
|
|
41
|
-
if (this.isExcluded(patch)) {
|
|
42
|
-
results.push({
|
|
43
|
-
patch,
|
|
44
|
-
status: "skipped",
|
|
45
|
-
method: "git-am",
|
|
46
|
-
});
|
|
47
|
-
continue;
|
|
48
|
-
}
|
|
49
|
-
const result = await this.applyPatchWithFallback(patch);
|
|
50
|
-
results.push(result);
|
|
51
|
-
}
|
|
52
|
-
return results;
|
|
53
|
-
}
|
|
54
|
-
/** Populate accumulator after git apply succeeds. */
|
|
55
|
-
async populateAccumulatorForPatch(patch, baseGen, currentTreeHash) {
|
|
56
|
-
if (!baseGen)
|
|
57
|
-
return;
|
|
58
|
-
// Create temp git repo to apply patches to base content
|
|
59
|
-
const tempDir = await mkdtemp(join(tmpdir(), "replay-acc-"));
|
|
60
|
-
const { GitClient } = await import("./git/GitClient.js");
|
|
61
|
-
const tempGit = new GitClient(tempDir);
|
|
62
|
-
await tempGit.exec(["init"]);
|
|
63
|
-
await tempGit.exec(["config", "user.email", "replay@fern.com"]);
|
|
64
|
-
await tempGit.exec(["config", "user.name", "Fern Replay"]);
|
|
65
|
-
try {
|
|
66
|
-
for (const filePath of patch.files) {
|
|
67
|
-
if (isBinaryFile(filePath))
|
|
68
|
-
continue;
|
|
69
|
-
const resolvedPath = await this.resolveFilePath(filePath, baseGen.tree_hash, currentTreeHash);
|
|
70
|
-
const base = await this.git.showFile(baseGen.tree_hash, filePath);
|
|
71
|
-
const theirs = await this.applyPatchToContent(base, patch.patch_content, filePath, tempGit, tempDir);
|
|
72
|
-
if (theirs && base) {
|
|
73
|
-
this.fileTheirsAccumulator.set(resolvedPath, {
|
|
74
|
-
content: theirs,
|
|
75
|
-
baseGeneration: patch.base_generation,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
finally {
|
|
81
|
-
await rm(tempDir, { recursive: true }).catch(() => { });
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
/** Apply patch: try git apply --3way, fall back to per-file 3-way merge. */
|
|
85
|
-
async applyPatchWithFallback(patch) {
|
|
86
|
-
// Resolve all file paths to check accumulator (need baseGen for resolution)
|
|
87
|
-
const baseGen = this.lockManager.getGeneration(patch.base_generation);
|
|
88
|
-
const lock = this.lockManager.read();
|
|
89
|
-
const currentGen = lock.generations.find((g) => g.commit_sha === lock.current_generation);
|
|
90
|
-
const currentTreeHash = currentGen?.tree_hash ?? baseGen?.tree_hash ?? "";
|
|
91
|
-
// Check if any file in this patch needs accumulation
|
|
92
|
-
// If so, skip fast path to ensure we benefit from pre-merge logic
|
|
93
|
-
const needsAccumulation = await Promise.all(patch.files.map(async (f) => {
|
|
94
|
-
if (!baseGen)
|
|
95
|
-
return false;
|
|
96
|
-
const resolved = await this.resolveFilePath(f, baseGen.tree_hash, currentTreeHash);
|
|
97
|
-
return this.fileTheirsAccumulator.has(resolved);
|
|
98
|
-
})).then((results) => results.some(Boolean));
|
|
99
|
-
// Strategy 1: Try git apply --3way (skip if accumulation needed)
|
|
100
|
-
if (!needsAccumulation) {
|
|
101
|
-
// Snapshot files before git apply (may leave conflict markers on failure)
|
|
102
|
-
const snapshots = new Map();
|
|
103
|
-
const resolvedFiles = {};
|
|
104
|
-
for (const filePath of patch.files) {
|
|
105
|
-
const resolvedPath = baseGen
|
|
106
|
-
? await this.resolveFilePath(filePath, baseGen.tree_hash, currentTreeHash)
|
|
107
|
-
: filePath;
|
|
108
|
-
if (resolvedPath !== filePath) {
|
|
109
|
-
resolvedFiles[filePath] = resolvedPath;
|
|
110
|
-
}
|
|
111
|
-
const fullPath = join(this.outputDir, resolvedPath);
|
|
112
|
-
snapshots.set(resolvedPath, await readFile(fullPath, "utf-8").catch(() => null));
|
|
113
|
-
}
|
|
114
|
-
try {
|
|
115
|
-
await this.git.execWithInput(["apply", "--3way"], patch.patch_content);
|
|
116
|
-
// Success! Populate accumulator so subsequent patches on these files
|
|
117
|
-
// will skip fast path and use the pre-merge logic instead
|
|
118
|
-
await this.populateAccumulatorForPatch(patch, baseGen, currentTreeHash);
|
|
119
|
-
return {
|
|
120
|
-
patch, status: "applied", method: "git-am",
|
|
121
|
-
...(Object.keys(resolvedFiles).length > 0 && { resolvedFiles }),
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
|
-
catch {
|
|
125
|
-
// git apply --3way failed and may have left conflict markers on disk
|
|
126
|
-
// Restore files from snapshot to undo any corruption before fallback
|
|
127
|
-
for (const [resolvedPath, content] of snapshots) {
|
|
128
|
-
if (content != null) {
|
|
129
|
-
await writeFile(join(this.outputDir, resolvedPath), content);
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
// Strategy 2: Fall back to file-by-file 3-way merge (uses accumulator)
|
|
135
|
-
return this.applyWithThreeWayMerge(patch);
|
|
136
|
-
}
|
|
137
|
-
/**
|
|
138
|
-
* Manual 3-way merge for when git am fails.
|
|
139
|
-
* Creates a single shared temp git repo for all files in the patch.
|
|
140
|
-
*/
|
|
141
|
-
async applyWithThreeWayMerge(patch) {
|
|
142
|
-
const fileResults = [];
|
|
143
|
-
const resolvedFiles = {};
|
|
144
|
-
const tempDir = await mkdtemp(join(tmpdir(), "replay-"));
|
|
145
|
-
const { GitClient } = await import("./git/GitClient.js");
|
|
146
|
-
const tempGit = new GitClient(tempDir);
|
|
147
|
-
await tempGit.exec(["init"]);
|
|
148
|
-
await tempGit.exec(["config", "user.email", "replay@fern.com"]);
|
|
149
|
-
await tempGit.exec(["config", "user.name", "Fern Replay"]);
|
|
150
|
-
try {
|
|
151
|
-
for (const filePath of patch.files) {
|
|
152
|
-
if (isBinaryFile(filePath)) {
|
|
153
|
-
fileResults.push({
|
|
154
|
-
file: filePath,
|
|
155
|
-
status: "skipped",
|
|
156
|
-
reason: "binary-file",
|
|
157
|
-
});
|
|
158
|
-
continue;
|
|
159
|
-
}
|
|
160
|
-
const result = await this.mergeFile(patch, filePath, tempGit, tempDir);
|
|
161
|
-
if (result.file !== filePath) {
|
|
162
|
-
resolvedFiles[filePath] = result.file;
|
|
163
|
-
}
|
|
164
|
-
fileResults.push(result);
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
finally {
|
|
168
|
-
await rm(tempDir, { recursive: true }).catch(() => { });
|
|
169
|
-
}
|
|
170
|
-
const conflictFiles = fileResults.filter((r) => r.status === "conflict");
|
|
171
|
-
const hasConflicts = conflictFiles.length > 0;
|
|
172
|
-
// Aggregate conflict reason from file-level to patch-level
|
|
173
|
-
const conflictReason = hasConflicts
|
|
174
|
-
? (conflictFiles.some((f) => f.conflictReason === "base-generation-mismatch")
|
|
175
|
-
? "base-generation-mismatch"
|
|
176
|
-
: conflictFiles[0]?.conflictReason)
|
|
177
|
-
: undefined;
|
|
178
|
-
return {
|
|
179
|
-
patch,
|
|
180
|
-
status: hasConflicts ? "conflict" : "applied",
|
|
181
|
-
method: "3way-merge",
|
|
182
|
-
fileResults,
|
|
183
|
-
conflictReason,
|
|
184
|
-
...(Object.keys(resolvedFiles).length > 0 && { resolvedFiles }),
|
|
185
|
-
};
|
|
186
|
-
}
|
|
187
|
-
/**
|
|
188
|
-
* Merge a single file using 3-way merge.
|
|
189
|
-
*/
|
|
190
|
-
async mergeFile(patch, filePath, tempGit, tempDir) {
|
|
191
|
-
try {
|
|
192
|
-
const baseGen = this.lockManager.getGeneration(patch.base_generation);
|
|
193
|
-
if (!baseGen) {
|
|
194
|
-
return { file: filePath, status: "skipped", reason: "base-generation-not-found" };
|
|
195
|
-
}
|
|
196
|
-
// Resolve file path in case the generator renamed it between generations
|
|
197
|
-
const lock = this.lockManager.read();
|
|
198
|
-
const currentGen = lock.generations.find((g) => g.commit_sha === lock.current_generation);
|
|
199
|
-
const currentTreeHash = currentGen?.tree_hash ?? baseGen.tree_hash;
|
|
200
|
-
const resolvedPath = await this.resolveFilePath(filePath, baseGen.tree_hash, currentTreeHash);
|
|
201
|
-
// Build conflict metadata for this file (used if conflict occurs)
|
|
202
|
-
const metadata = {
|
|
203
|
-
patchId: patch.id,
|
|
204
|
-
patchMessage: patch.original_message,
|
|
205
|
-
baseGeneration: patch.base_generation,
|
|
206
|
-
currentGeneration: lock.current_generation,
|
|
207
|
-
};
|
|
208
|
-
// BASE: pristine state from when user made their edit (old path)
|
|
209
|
-
let base = await this.git.showFile(baseGen.tree_hash, filePath);
|
|
210
|
-
// If BASE is null, check if this file is the target of a rename in the patch.
|
|
211
|
-
// Rename diffs (e.g., git mv old new) have the content at the old path.
|
|
212
|
-
let renameSourcePath;
|
|
213
|
-
if (!base) {
|
|
214
|
-
const renameSource = this.extractRenameSource(patch.patch_content, filePath);
|
|
215
|
-
if (renameSource) {
|
|
216
|
-
base = await this.git.showFile(baseGen.tree_hash, renameSource);
|
|
217
|
-
renameSourcePath = renameSource;
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
// OURS: current generated state on disk (resolved/new path)
|
|
221
|
-
const oursPath = join(this.outputDir, resolvedPath);
|
|
222
|
-
const ours = await readFile(oursPath, "utf-8").catch(() => null);
|
|
223
|
-
// THEIRS: user's version (apply patch to base using original path)
|
|
224
|
-
let theirs = await this.applyPatchToContent(base, patch.patch_content, filePath, tempGit, tempDir, renameSourcePath);
|
|
225
|
-
// Fall back to accumulator as merge base for incremental patches.
|
|
226
|
-
let useAccumulatorAsMergeBase = false;
|
|
227
|
-
const accumulatorEntry = this.fileTheirsAccumulator.get(resolvedPath);
|
|
228
|
-
if (!theirs && base && accumulatorEntry) {
|
|
229
|
-
theirs = await this.applyPatchToContent(accumulatorEntry.content, patch.patch_content, filePath, tempGit, tempDir);
|
|
230
|
-
if (theirs) {
|
|
231
|
-
useAccumulatorAsMergeBase = true;
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
// Pre-merge with accumulated customizations (skip when accumulator is merge base).
|
|
235
|
-
let effective_theirs = theirs;
|
|
236
|
-
let baseMismatchSkipped = false;
|
|
237
|
-
if (theirs && base && !useAccumulatorAsMergeBase) {
|
|
238
|
-
if (accumulatorEntry && accumulatorEntry.baseGeneration === patch.base_generation) {
|
|
239
|
-
// Pre-merge: combine previous customizations with current patch
|
|
240
|
-
try {
|
|
241
|
-
const preMerged = threeWayMerge(base, accumulatorEntry.content, theirs);
|
|
242
|
-
if (!preMerged.hasConflicts) {
|
|
243
|
-
// Clean merge - use the combined result
|
|
244
|
-
effective_theirs = preMerged.content;
|
|
245
|
-
}
|
|
246
|
-
else {
|
|
247
|
-
// Pre-merge has conflicts - skip accumulator for this patch
|
|
248
|
-
// to avoid nested conflict markers. User patches conflict
|
|
249
|
-
// with each other and require manual resolution.
|
|
250
|
-
effective_theirs = theirs;
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
catch {
|
|
254
|
-
// If pre-merge fails unexpectedly, fall back to current_theirs
|
|
255
|
-
effective_theirs = theirs;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
else if (accumulatorEntry) {
|
|
259
|
-
// Base generations differ - accumulator pre-merge skipped.
|
|
260
|
-
// The main merge below will still run, but if it conflicts
|
|
261
|
-
// we flag it as a base-generation-mismatch.
|
|
262
|
-
baseMismatchSkipped = true;
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
// Handle new files (user created, didn't exist in generation)
|
|
266
|
-
if (!base && !ours && effective_theirs) {
|
|
267
|
-
const outDir = dirname(oursPath);
|
|
268
|
-
await mkdir(outDir, { recursive: true });
|
|
269
|
-
await writeFile(oursPath, effective_theirs);
|
|
270
|
-
return { file: resolvedPath, status: "merged", reason: "new-file" };
|
|
271
|
-
}
|
|
272
|
-
// Handle new file created by both user and generator (conflict)
|
|
273
|
-
if (!base && ours && effective_theirs) {
|
|
274
|
-
const merged = threeWayMerge("", ours, effective_theirs);
|
|
275
|
-
const outDir = dirname(oursPath);
|
|
276
|
-
await mkdir(outDir, { recursive: true });
|
|
277
|
-
await writeFile(oursPath, merged.content);
|
|
278
|
-
if (merged.hasConflicts) {
|
|
279
|
-
return {
|
|
280
|
-
file: resolvedPath,
|
|
281
|
-
status: "conflict",
|
|
282
|
-
conflicts: merged.conflicts,
|
|
283
|
-
conflictReason: "new-file-both",
|
|
284
|
-
conflictMetadata: metadata,
|
|
285
|
-
};
|
|
286
|
-
}
|
|
287
|
-
return { file: resolvedPath, status: "merged" };
|
|
288
|
-
}
|
|
289
|
-
if (!effective_theirs) {
|
|
290
|
-
return {
|
|
291
|
-
file: resolvedPath,
|
|
292
|
-
status: "skipped",
|
|
293
|
-
reason: "missing-content",
|
|
294
|
-
};
|
|
295
|
-
}
|
|
296
|
-
if (!base || !ours) {
|
|
297
|
-
return {
|
|
298
|
-
file: resolvedPath,
|
|
299
|
-
status: "skipped",
|
|
300
|
-
reason: "missing-content",
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
// Perform 3-way merge.
|
|
304
|
-
// For incremental patches, use the accumulated state as the merge base
|
|
305
|
-
// so the diff is computed relative to prior patches, not the raw generation.
|
|
306
|
-
const mergeBase = useAccumulatorAsMergeBase && accumulatorEntry
|
|
307
|
-
? accumulatorEntry.content : base;
|
|
308
|
-
const merged = threeWayMerge(mergeBase, ours, effective_theirs);
|
|
309
|
-
// Write result to the resolved (current) path
|
|
310
|
-
const outDir = dirname(oursPath);
|
|
311
|
-
await mkdir(outDir, { recursive: true });
|
|
312
|
-
await writeFile(oursPath, merged.content);
|
|
313
|
-
// Update accumulator after successful merge
|
|
314
|
-
// This allows subsequent patches on the same file to benefit from pre-merge
|
|
315
|
-
if (effective_theirs && base) {
|
|
316
|
-
this.fileTheirsAccumulator.set(resolvedPath, {
|
|
317
|
-
content: effective_theirs,
|
|
318
|
-
baseGeneration: patch.base_generation,
|
|
319
|
-
});
|
|
320
|
-
}
|
|
321
|
-
if (merged.hasConflicts) {
|
|
322
|
-
return {
|
|
323
|
-
file: resolvedPath,
|
|
324
|
-
status: "conflict",
|
|
325
|
-
conflicts: merged.conflicts,
|
|
326
|
-
conflictReason: baseMismatchSkipped ? "base-generation-mismatch" : "same-line-edit",
|
|
327
|
-
conflictMetadata: metadata,
|
|
328
|
-
};
|
|
329
|
-
}
|
|
330
|
-
return { file: resolvedPath, status: "merged" };
|
|
331
|
-
}
|
|
332
|
-
catch (error) {
|
|
333
|
-
return {
|
|
334
|
-
file: filePath,
|
|
335
|
-
status: "skipped",
|
|
336
|
-
reason: `error: ${error instanceof Error ? error.message : String(error)}`,
|
|
337
|
-
};
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
/**
|
|
341
|
-
* Check if patch should be skipped based on exclude patterns in replay.yml
|
|
342
|
-
*/
|
|
343
|
-
isExcluded(patch) {
|
|
344
|
-
const config = this.lockManager.getCustomizationsConfig();
|
|
345
|
-
if (!config.exclude)
|
|
346
|
-
return false;
|
|
347
|
-
return patch.files.some((file) => config.exclude.some((pattern) => minimatch(file, pattern)));
|
|
348
|
-
}
|
|
349
|
-
/**
|
|
350
|
-
* Resolve a file path that may have been renamed between generations.
|
|
351
|
-
* Checks manual moves in replay.yml first, then git rename detection.
|
|
352
|
-
*/
|
|
353
|
-
async resolveFilePath(filePath, baseTreeHash, currentTreeHash) {
|
|
354
|
-
// Priority 1: Manual moves from replay.yml
|
|
355
|
-
const config = this.lockManager.getCustomizationsConfig();
|
|
356
|
-
if (config.moves) {
|
|
357
|
-
for (const move of config.moves) {
|
|
358
|
-
if (minimatch(filePath, move.from) || filePath === move.from) {
|
|
359
|
-
// For exact matches, replace directly
|
|
360
|
-
if (filePath === move.from) {
|
|
361
|
-
return move.to;
|
|
362
|
-
}
|
|
363
|
-
// For glob matches, replace the matching prefix
|
|
364
|
-
// e.g., from: "src/api/**" to: "src/resources/**"
|
|
365
|
-
// filePath: "src/api/client.ts" → "src/resources/client.ts"
|
|
366
|
-
const fromBase = move.from.replace(/\*\*.*$/, "");
|
|
367
|
-
const toBase = move.to.replace(/\*\*.*$/, "");
|
|
368
|
-
if (filePath.startsWith(fromBase)) {
|
|
369
|
-
return toBase + filePath.slice(fromBase.length);
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
}
|
|
373
|
-
}
|
|
374
|
-
// Priority 2: Git rename detection (cached per tree pair)
|
|
375
|
-
const cacheKey = `${baseTreeHash}:${currentTreeHash}`;
|
|
376
|
-
let renames = this.renameCache.get(cacheKey);
|
|
377
|
-
if (!renames) {
|
|
378
|
-
renames = await this.git.detectRenames(baseTreeHash, currentTreeHash);
|
|
379
|
-
this.renameCache.set(cacheKey, renames);
|
|
380
|
-
}
|
|
381
|
-
const gitRename = renames.find((r) => r.from === filePath);
|
|
382
|
-
if (gitRename) {
|
|
383
|
-
return gitRename.to;
|
|
384
|
-
}
|
|
385
|
-
// Priority 3: No rename detected
|
|
386
|
-
return filePath;
|
|
387
|
-
}
|
|
388
|
-
/**
|
|
389
|
-
* Apply patch content to base to reconstruct user's version.
|
|
390
|
-
* Uses the shared temp repo + git apply.
|
|
391
|
-
*/
|
|
392
|
-
async applyPatchToContent(base, patchContent, filePath, tempGit, tempDir, sourceFilePath) {
|
|
393
|
-
if (!base) {
|
|
394
|
-
// New file - extract content directly from patch
|
|
395
|
-
return this.extractNewFileFromPatch(patchContent, filePath);
|
|
396
|
-
}
|
|
397
|
-
// Extract only the diff for this specific file
|
|
398
|
-
const fileDiff = this.extractFileDiff(patchContent, filePath);
|
|
399
|
-
if (!fileDiff)
|
|
400
|
-
return null;
|
|
401
|
-
try {
|
|
402
|
-
if (sourceFilePath) {
|
|
403
|
-
// Rename case: write base at the OLD path, apply the rename diff,
|
|
404
|
-
// then read from the NEW path (filePath).
|
|
405
|
-
const tempSourcePath = join(tempDir, sourceFilePath);
|
|
406
|
-
await mkdir(dirname(tempSourcePath), { recursive: true });
|
|
407
|
-
await writeFile(tempSourcePath, base);
|
|
408
|
-
await tempGit.exec(["add", sourceFilePath]);
|
|
409
|
-
await tempGit.exec(["commit", "-m", `base for rename ${sourceFilePath} -> ${filePath}`, "--allow-empty"]);
|
|
410
|
-
await tempGit.execWithInput(["apply", "--allow-empty"], fileDiff);
|
|
411
|
-
const tempTargetPath = join(tempDir, filePath);
|
|
412
|
-
return await readFile(tempTargetPath, "utf-8");
|
|
413
|
-
}
|
|
414
|
-
// Normal case: write base at filePath, apply diff, read back
|
|
415
|
-
const tempFilePath = join(tempDir, filePath);
|
|
416
|
-
await mkdir(dirname(tempFilePath), { recursive: true });
|
|
417
|
-
await writeFile(tempFilePath, base);
|
|
418
|
-
// Stage and commit so git apply has a clean base
|
|
419
|
-
await tempGit.exec(["add", filePath]);
|
|
420
|
-
await tempGit.exec(["commit", "-m", `base for ${filePath}`, "--allow-empty"]);
|
|
421
|
-
// Apply this file's diff
|
|
422
|
-
await tempGit.execWithInput(["apply", "--allow-empty"], fileDiff);
|
|
423
|
-
return await readFile(tempFilePath, "utf-8");
|
|
424
|
-
}
|
|
425
|
-
catch {
|
|
426
|
-
return null;
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
/**
|
|
430
|
-
* Extract the diff for a single file from a multi-file patch.
|
|
431
|
-
* Returns just the `diff --git ...` block for the target file.
|
|
432
|
-
*/
|
|
433
|
-
extractFileDiff(patchContent, filePath) {
|
|
434
|
-
const lines = patchContent.split("\n");
|
|
435
|
-
const diffLines = [];
|
|
436
|
-
let inTargetFile = false;
|
|
437
|
-
for (const line of lines) {
|
|
438
|
-
if (line.startsWith("diff --git")) {
|
|
439
|
-
if (inTargetFile) {
|
|
440
|
-
// Hit the next file's diff, stop collecting
|
|
441
|
-
break;
|
|
442
|
-
}
|
|
443
|
-
if (isDiffLineForFile(line, filePath)) {
|
|
444
|
-
inTargetFile = true;
|
|
445
|
-
diffLines.push(line);
|
|
446
|
-
}
|
|
447
|
-
continue;
|
|
448
|
-
}
|
|
449
|
-
if (inTargetFile) {
|
|
450
|
-
diffLines.push(line);
|
|
451
|
-
}
|
|
452
|
-
}
|
|
453
|
-
return diffLines.length > 0 ? diffLines.join("\n") + "\n" : null;
|
|
454
|
-
}
|
|
455
|
-
/**
|
|
456
|
-
* Extract the rename source path from a patch for a given target file.
|
|
457
|
-
* Returns the original path if the diff block for targetFilePath is a rename,
|
|
458
|
-
* or null if it's not a rename.
|
|
459
|
-
*/
|
|
460
|
-
extractRenameSource(patchContent, targetFilePath) {
|
|
461
|
-
const lines = patchContent.split("\n");
|
|
462
|
-
let inTargetFile = false;
|
|
463
|
-
for (const line of lines) {
|
|
464
|
-
if (line.startsWith("diff --git")) {
|
|
465
|
-
if (inTargetFile)
|
|
466
|
-
break; // past the target block
|
|
467
|
-
inTargetFile = isDiffLineForFile(line, targetFilePath);
|
|
468
|
-
continue;
|
|
469
|
-
}
|
|
470
|
-
if (!inTargetFile)
|
|
471
|
-
continue;
|
|
472
|
-
// Stop at first hunk — rename headers appear before @@
|
|
473
|
-
if (line.startsWith("@@"))
|
|
474
|
-
break;
|
|
475
|
-
if (line.startsWith("rename from ")) {
|
|
476
|
-
return line.slice("rename from ".length);
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
return null;
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* Extract new file content from a patch (when base is null).
|
|
483
|
-
* Parses the unified diff to get the added lines.
|
|
484
|
-
*/
|
|
485
|
-
extractNewFileFromPatch(patchContent, filePath) {
|
|
486
|
-
const lines = patchContent.split("\n");
|
|
487
|
-
const addedLines = [];
|
|
488
|
-
let inTargetFile = false;
|
|
489
|
-
let inHunk = false;
|
|
490
|
-
let noTrailingNewline = false;
|
|
491
|
-
for (const line of lines) {
|
|
492
|
-
if (line.startsWith("diff --git")) {
|
|
493
|
-
if (inTargetFile)
|
|
494
|
-
break; // hit next file's diff
|
|
495
|
-
inTargetFile = isDiffLineForFile(line, filePath);
|
|
496
|
-
inHunk = false;
|
|
497
|
-
continue;
|
|
498
|
-
}
|
|
499
|
-
if (!inTargetFile)
|
|
500
|
-
continue;
|
|
501
|
-
if (line.startsWith("@@")) {
|
|
502
|
-
inHunk = true;
|
|
503
|
-
continue;
|
|
504
|
-
}
|
|
505
|
-
if (!inHunk)
|
|
506
|
-
continue;
|
|
507
|
-
if (line === "\") {
|
|
508
|
-
noTrailingNewline = true;
|
|
509
|
-
continue;
|
|
510
|
-
}
|
|
511
|
-
if (line.startsWith("+") && !line.startsWith("+++")) {
|
|
512
|
-
addedLines.push(line.slice(1));
|
|
513
|
-
}
|
|
514
|
-
}
|
|
515
|
-
if (addedLines.length === 0)
|
|
516
|
-
return null;
|
|
517
|
-
return addedLines.join("\n") + (noTrailingNewline ? "" : "\n");
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
function isBinaryFile(filePath) {
|
|
521
|
-
const ext = extname(filePath).toLowerCase();
|
|
522
|
-
return BINARY_EXTENSIONS.has(ext);
|
|
523
|
-
}
|
|
524
|
-
/**
|
|
525
|
-
* Check if a `diff --git` line targets the given file path.
|
|
526
|
-
* Uses a regex anchored to the line format to avoid substring false positives
|
|
527
|
-
* (e.g., `lib/foo.ts` matching `b/lib/foo.ts-backup`).
|
|
528
|
-
*/
|
|
529
|
-
function isDiffLineForFile(diffLine, filePath) {
|
|
530
|
-
const match = diffLine.match(/^diff --git a\/.+ b\/(.+)$/);
|
|
531
|
-
return match !== null && match[1] === filePath;
|
|
532
|
-
}
|
|
533
|
-
//# sourceMappingURL=ReplayApplicator.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ReplayApplicator.js","sourceRoot":"","sources":["../src/ReplayApplicator.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC3E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AAGnD,MAAM,iBAAiB,GAAG,IAAI,GAAG,CAAC;IAC9B,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM;IAChE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO;IACzD,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM;IAC5C,MAAM,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C,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC;IACnE,CAAC;CACJ;AAED,SAAS,YAAY,CAAC,QAAgB;IAClC,MAAM,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5C,OAAO,iBAAiB,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;AACtC,CAAC;AAED;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,QAAgB,EAAE,QAAgB;IACzD,MAAM,KAAK,GAAG,QAAQ,CAAC,KAAK,CAAC,4BAA4B,CAAC,CAAC;IAC3D,OAAO,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,CAAC,CAAC,KAAK,QAAQ,CAAC;AACnD,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import type { GitClient } from "./git/GitClient.js";
|
|
2
|
-
import type { GenerationRecord, StoredPatch } from "./types.js";
|
|
3
|
-
export interface CommitOptions {
|
|
4
|
-
cliVersion: string;
|
|
5
|
-
generatorVersions: Record<string, string>;
|
|
6
|
-
}
|
|
7
|
-
export declare class ReplayCommitter {
|
|
8
|
-
private git;
|
|
9
|
-
private outputDir;
|
|
10
|
-
constructor(git: GitClient, outputDir: string);
|
|
11
|
-
/**
|
|
12
|
-
* Commit the generation output (after generator runs, before replay).
|
|
13
|
-
* Uses [fern-generated] prefix for detection.
|
|
14
|
-
*/
|
|
15
|
-
commitGeneration(message: string, options?: CommitOptions): Promise<string>;
|
|
16
|
-
/**
|
|
17
|
-
* Commit the replay result (after patches applied).
|
|
18
|
-
* Uses [fern-replay] prefix for detection.
|
|
19
|
-
*/
|
|
20
|
-
commitReplay(patchCount: number, patches?: StoredPatch[]): Promise<string>;
|
|
21
|
-
/**
|
|
22
|
-
* Create a GenerationRecord for the current state.
|
|
23
|
-
* Captures commit SHA and tree hash for future 3-way merges.
|
|
24
|
-
*/
|
|
25
|
-
createGenerationRecord(options?: CommitOptions): Promise<GenerationRecord>;
|
|
26
|
-
/**
|
|
27
|
-
* Stage all changes in output directory.
|
|
28
|
-
*/
|
|
29
|
-
stageAll(): Promise<void>;
|
|
30
|
-
/**
|
|
31
|
-
* Check if there are staged changes to commit.
|
|
32
|
-
*/
|
|
33
|
-
hasStagedChanges(): Promise<boolean>;
|
|
34
|
-
/**
|
|
35
|
-
* Get the tree hash for a commit.
|
|
36
|
-
*/
|
|
37
|
-
getTreeHash(commitSha: string): Promise<string>;
|
|
38
|
-
}
|
|
39
|
-
//# sourceMappingURL=ReplayCommitter.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ReplayCommitter.d.ts","sourceRoot":"","sources":["../src/ReplayCommitter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,KAAK,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAEhE,MAAM,WAAW,aAAa;IAC1B,UAAU,EAAE,MAAM,CAAC;IACnB,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC7C;AAED,qBAAa,eAAe;IACxB,OAAO,CAAC,GAAG,CAAY;IACvB,OAAO,CAAC,SAAS,CAAS;gBAEd,GAAG,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM;IAK7C;;;OAGG;IACG,gBAAgB,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,MAAM,CAAC;IAwBjF;;;OAGG;IACG,YAAY,CAAC,UAAU,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,WAAW,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC;IAoBhF;;;OAGG;IACG,sBAAsB,CAAC,OAAO,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC;IAahF;;OAEG;IACG,QAAQ,IAAI,OAAO,CAAC,IAAI,CAAC;IAI/B;;OAEG;IACG,gBAAgB,IAAI,OAAO,CAAC,OAAO,CAAC;IAK1C;;OAEG;IACG,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAGxD"}
|