gitx.do 0.0.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/LICENSE +21 -0
- package/README.md +156 -0
- package/dist/durable-object/object-store.d.ts +113 -0
- package/dist/durable-object/object-store.d.ts.map +1 -0
- package/dist/durable-object/object-store.js +387 -0
- package/dist/durable-object/object-store.js.map +1 -0
- package/dist/durable-object/schema.d.ts +17 -0
- package/dist/durable-object/schema.d.ts.map +1 -0
- package/dist/durable-object/schema.js +43 -0
- package/dist/durable-object/schema.js.map +1 -0
- package/dist/durable-object/wal.d.ts +111 -0
- package/dist/durable-object/wal.d.ts.map +1 -0
- package/dist/durable-object/wal.js +200 -0
- package/dist/durable-object/wal.js.map +1 -0
- package/dist/index.d.ts +24 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +101 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/adapter.d.ts +231 -0
- package/dist/mcp/adapter.d.ts.map +1 -0
- package/dist/mcp/adapter.js +502 -0
- package/dist/mcp/adapter.js.map +1 -0
- package/dist/mcp/sandbox.d.ts +261 -0
- package/dist/mcp/sandbox.d.ts.map +1 -0
- package/dist/mcp/sandbox.js +983 -0
- package/dist/mcp/sandbox.js.map +1 -0
- package/dist/mcp/sdk-adapter.d.ts +413 -0
- package/dist/mcp/sdk-adapter.d.ts.map +1 -0
- package/dist/mcp/sdk-adapter.js +672 -0
- package/dist/mcp/sdk-adapter.js.map +1 -0
- package/dist/mcp/tools.d.ts +133 -0
- package/dist/mcp/tools.d.ts.map +1 -0
- package/dist/mcp/tools.js +1604 -0
- package/dist/mcp/tools.js.map +1 -0
- package/dist/ops/blame.d.ts +148 -0
- package/dist/ops/blame.d.ts.map +1 -0
- package/dist/ops/blame.js +754 -0
- package/dist/ops/blame.js.map +1 -0
- package/dist/ops/branch.d.ts +215 -0
- package/dist/ops/branch.d.ts.map +1 -0
- package/dist/ops/branch.js +608 -0
- package/dist/ops/branch.js.map +1 -0
- package/dist/ops/commit-traversal.d.ts +209 -0
- package/dist/ops/commit-traversal.d.ts.map +1 -0
- package/dist/ops/commit-traversal.js +755 -0
- package/dist/ops/commit-traversal.js.map +1 -0
- package/dist/ops/commit.d.ts +221 -0
- package/dist/ops/commit.d.ts.map +1 -0
- package/dist/ops/commit.js +606 -0
- package/dist/ops/commit.js.map +1 -0
- package/dist/ops/merge-base.d.ts +223 -0
- package/dist/ops/merge-base.d.ts.map +1 -0
- package/dist/ops/merge-base.js +581 -0
- package/dist/ops/merge-base.js.map +1 -0
- package/dist/ops/merge.d.ts +385 -0
- package/dist/ops/merge.d.ts.map +1 -0
- package/dist/ops/merge.js +1203 -0
- package/dist/ops/merge.js.map +1 -0
- package/dist/ops/tag.d.ts +182 -0
- package/dist/ops/tag.d.ts.map +1 -0
- package/dist/ops/tag.js +608 -0
- package/dist/ops/tag.js.map +1 -0
- package/dist/ops/tree-builder.d.ts +82 -0
- package/dist/ops/tree-builder.d.ts.map +1 -0
- package/dist/ops/tree-builder.js +246 -0
- package/dist/ops/tree-builder.js.map +1 -0
- package/dist/ops/tree-diff.d.ts +243 -0
- package/dist/ops/tree-diff.d.ts.map +1 -0
- package/dist/ops/tree-diff.js +657 -0
- package/dist/ops/tree-diff.js.map +1 -0
- package/dist/pack/delta.d.ts +68 -0
- package/dist/pack/delta.d.ts.map +1 -0
- package/dist/pack/delta.js +343 -0
- package/dist/pack/delta.js.map +1 -0
- package/dist/pack/format.d.ts +84 -0
- package/dist/pack/format.d.ts.map +1 -0
- package/dist/pack/format.js +261 -0
- package/dist/pack/format.js.map +1 -0
- package/dist/pack/full-generation.d.ts +327 -0
- package/dist/pack/full-generation.d.ts.map +1 -0
- package/dist/pack/full-generation.js +1159 -0
- package/dist/pack/full-generation.js.map +1 -0
- package/dist/pack/generation.d.ts +118 -0
- package/dist/pack/generation.d.ts.map +1 -0
- package/dist/pack/generation.js +459 -0
- package/dist/pack/generation.js.map +1 -0
- package/dist/pack/index.d.ts +181 -0
- package/dist/pack/index.d.ts.map +1 -0
- package/dist/pack/index.js +552 -0
- package/dist/pack/index.js.map +1 -0
- package/dist/refs/branch.d.ts +224 -0
- package/dist/refs/branch.d.ts.map +1 -0
- package/dist/refs/branch.js +170 -0
- package/dist/refs/branch.js.map +1 -0
- package/dist/refs/storage.d.ts +208 -0
- package/dist/refs/storage.d.ts.map +1 -0
- package/dist/refs/storage.js +421 -0
- package/dist/refs/storage.js.map +1 -0
- package/dist/refs/tag.d.ts +230 -0
- package/dist/refs/tag.d.ts.map +1 -0
- package/dist/refs/tag.js +188 -0
- package/dist/refs/tag.js.map +1 -0
- package/dist/storage/lru-cache.d.ts +188 -0
- package/dist/storage/lru-cache.d.ts.map +1 -0
- package/dist/storage/lru-cache.js +410 -0
- package/dist/storage/lru-cache.js.map +1 -0
- package/dist/storage/object-index.d.ts +140 -0
- package/dist/storage/object-index.d.ts.map +1 -0
- package/dist/storage/object-index.js +166 -0
- package/dist/storage/object-index.js.map +1 -0
- package/dist/storage/r2-pack.d.ts +394 -0
- package/dist/storage/r2-pack.d.ts.map +1 -0
- package/dist/storage/r2-pack.js +1062 -0
- package/dist/storage/r2-pack.js.map +1 -0
- package/dist/tiered/cdc-pipeline.d.ts +316 -0
- package/dist/tiered/cdc-pipeline.d.ts.map +1 -0
- package/dist/tiered/cdc-pipeline.js +771 -0
- package/dist/tiered/cdc-pipeline.js.map +1 -0
- package/dist/tiered/migration.d.ts +242 -0
- package/dist/tiered/migration.d.ts.map +1 -0
- package/dist/tiered/migration.js +592 -0
- package/dist/tiered/migration.js.map +1 -0
- package/dist/tiered/parquet-writer.d.ts +248 -0
- package/dist/tiered/parquet-writer.d.ts.map +1 -0
- package/dist/tiered/parquet-writer.js +555 -0
- package/dist/tiered/parquet-writer.js.map +1 -0
- package/dist/tiered/read-path.d.ts +141 -0
- package/dist/tiered/read-path.d.ts.map +1 -0
- package/dist/tiered/read-path.js +204 -0
- package/dist/tiered/read-path.js.map +1 -0
- package/dist/types/objects.d.ts +53 -0
- package/dist/types/objects.d.ts.map +1 -0
- package/dist/types/objects.js +291 -0
- package/dist/types/objects.js.map +1 -0
- package/dist/types/storage.d.ts +117 -0
- package/dist/types/storage.d.ts.map +1 -0
- package/dist/types/storage.js +8 -0
- package/dist/types/storage.js.map +1 -0
- package/dist/utils/hash.d.ts +31 -0
- package/dist/utils/hash.d.ts.map +1 -0
- package/dist/utils/hash.js +60 -0
- package/dist/utils/hash.js.map +1 -0
- package/dist/utils/sha1.d.ts +26 -0
- package/dist/utils/sha1.d.ts.map +1 -0
- package/dist/utils/sha1.js +127 -0
- package/dist/utils/sha1.js.map +1 -0
- package/dist/wire/capabilities.d.ts +236 -0
- package/dist/wire/capabilities.d.ts.map +1 -0
- package/dist/wire/capabilities.js +437 -0
- package/dist/wire/capabilities.js.map +1 -0
- package/dist/wire/pkt-line.d.ts +67 -0
- package/dist/wire/pkt-line.d.ts.map +1 -0
- package/dist/wire/pkt-line.js +145 -0
- package/dist/wire/pkt-line.js.map +1 -0
- package/dist/wire/receive-pack.d.ts +302 -0
- package/dist/wire/receive-pack.d.ts.map +1 -0
- package/dist/wire/receive-pack.js +885 -0
- package/dist/wire/receive-pack.js.map +1 -0
- package/dist/wire/smart-http.d.ts +321 -0
- package/dist/wire/smart-http.d.ts.map +1 -0
- package/dist/wire/smart-http.js +654 -0
- package/dist/wire/smart-http.js.map +1 -0
- package/dist/wire/upload-pack.d.ts +333 -0
- package/dist/wire/upload-pack.d.ts.map +1 -0
- package/dist/wire/upload-pack.js +850 -0
- package/dist/wire/upload-pack.js.map +1 -0
- package/package.json +61 -0
|
@@ -0,0 +1,385 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Three-way merge implementation for Git
|
|
3
|
+
*
|
|
4
|
+
* This module provides functionality for merging branches using
|
|
5
|
+
* three-way merge algorithm, including conflict detection and resolution.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Types of merge conflicts that can occur
|
|
9
|
+
*/
|
|
10
|
+
export type ConflictType = 'content' | 'add-add' | 'modify-delete' | 'delete-modify' | 'rename-rename' | 'rename-delete' | 'directory-file';
|
|
11
|
+
/**
|
|
12
|
+
* Merge strategies available
|
|
13
|
+
*/
|
|
14
|
+
export type MergeStrategy = 'recursive' | 'ours' | 'theirs' | 'octopus' | 'subtree';
|
|
15
|
+
/**
|
|
16
|
+
* Status of a merge operation
|
|
17
|
+
*/
|
|
18
|
+
export type MergeStatus = 'fast-forward' | 'merged' | 'conflicted' | 'up-to-date' | 'aborted' | 'in-progress';
|
|
19
|
+
/**
|
|
20
|
+
* Represents a conflict marker position in a file
|
|
21
|
+
*/
|
|
22
|
+
export interface ConflictMarker {
|
|
23
|
+
/** Line number where marker starts (1-indexed) */
|
|
24
|
+
startLine: number;
|
|
25
|
+
/** Line number where marker ends (1-indexed) */
|
|
26
|
+
endLine: number;
|
|
27
|
+
/** The conflicting content from the base version */
|
|
28
|
+
baseContent?: string;
|
|
29
|
+
/** The conflicting content from our (current) version */
|
|
30
|
+
oursContent: string;
|
|
31
|
+
/** The conflicting content from theirs (merged) version */
|
|
32
|
+
theirsContent: string;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Represents a single merge conflict
|
|
36
|
+
*/
|
|
37
|
+
export interface MergeConflict {
|
|
38
|
+
/** Type of conflict */
|
|
39
|
+
type: ConflictType;
|
|
40
|
+
/** Path to the conflicted file */
|
|
41
|
+
path: string;
|
|
42
|
+
/** SHA of the file in base (common ancestor) */
|
|
43
|
+
baseSha?: string;
|
|
44
|
+
/** SHA of the file in our (current) branch */
|
|
45
|
+
oursSha?: string;
|
|
46
|
+
/** SHA of the file in their (merged) branch */
|
|
47
|
+
theirsSha?: string;
|
|
48
|
+
/** Mode of the file in base */
|
|
49
|
+
baseMode?: string;
|
|
50
|
+
/** Mode of the file in ours */
|
|
51
|
+
oursMode?: string;
|
|
52
|
+
/** Mode of the file in theirs */
|
|
53
|
+
theirsMode?: string;
|
|
54
|
+
/** Content with conflict markers if type is 'content' */
|
|
55
|
+
conflictedContent?: Uint8Array;
|
|
56
|
+
/** Detailed conflict markers for content conflicts */
|
|
57
|
+
markers?: ConflictMarker[];
|
|
58
|
+
/** Original path if this was a rename */
|
|
59
|
+
originalPath?: string;
|
|
60
|
+
/** Renamed path(s) in case of rename conflicts */
|
|
61
|
+
renamedPaths?: {
|
|
62
|
+
ours?: string;
|
|
63
|
+
theirs?: string;
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Options for merge operations
|
|
68
|
+
*/
|
|
69
|
+
export interface MergeOptions {
|
|
70
|
+
/** Merge strategy to use (default: 'recursive') */
|
|
71
|
+
strategy?: MergeStrategy;
|
|
72
|
+
/** Whether to allow fast-forward merges (default: true) */
|
|
73
|
+
allowFastForward?: boolean;
|
|
74
|
+
/** Force fast-forward only, fail if not possible (default: false) */
|
|
75
|
+
fastForwardOnly?: boolean;
|
|
76
|
+
/** Automatically resolve conflicts using strategy (default: false) */
|
|
77
|
+
autoResolve?: boolean;
|
|
78
|
+
/** Strategy option for conflict resolution when autoResolve is true */
|
|
79
|
+
conflictStrategy?: 'ours' | 'theirs' | 'union';
|
|
80
|
+
/** Commit message for merge commit */
|
|
81
|
+
message?: string;
|
|
82
|
+
/** Do not create a merge commit, leave changes staged */
|
|
83
|
+
noCommit?: boolean;
|
|
84
|
+
/** Squash commits from the merged branch */
|
|
85
|
+
squash?: boolean;
|
|
86
|
+
/** For octopus merges: list of additional branch SHAs */
|
|
87
|
+
additionalBranches?: string[];
|
|
88
|
+
/** Rename detection threshold (0-100, default: 50) */
|
|
89
|
+
renameThreshold?: number;
|
|
90
|
+
/** Whether to detect renames (default: true) */
|
|
91
|
+
detectRenames?: boolean;
|
|
92
|
+
/** Whether to detect copies (default: false) */
|
|
93
|
+
detectCopies?: boolean;
|
|
94
|
+
/** Author for the merge commit */
|
|
95
|
+
author?: {
|
|
96
|
+
name: string;
|
|
97
|
+
email: string;
|
|
98
|
+
timestamp?: number;
|
|
99
|
+
timezone?: string;
|
|
100
|
+
};
|
|
101
|
+
/** Committer for the merge commit */
|
|
102
|
+
committer?: {
|
|
103
|
+
name: string;
|
|
104
|
+
email: string;
|
|
105
|
+
timestamp?: number;
|
|
106
|
+
timezone?: string;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Statistics about the merge operation
|
|
111
|
+
*/
|
|
112
|
+
export interface MergeStats {
|
|
113
|
+
/** Number of files added */
|
|
114
|
+
filesAdded: number;
|
|
115
|
+
/** Number of files modified */
|
|
116
|
+
filesModified: number;
|
|
117
|
+
/** Number of files deleted */
|
|
118
|
+
filesDeleted: number;
|
|
119
|
+
/** Number of files renamed */
|
|
120
|
+
filesRenamed: number;
|
|
121
|
+
/** Number of binary files changed */
|
|
122
|
+
binaryFilesChanged: number;
|
|
123
|
+
/** Total lines added (text files only) */
|
|
124
|
+
linesAdded: number;
|
|
125
|
+
/** Total lines removed (text files only) */
|
|
126
|
+
linesRemoved: number;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Result of a merge operation
|
|
130
|
+
*/
|
|
131
|
+
export interface MergeResult {
|
|
132
|
+
/** Status of the merge */
|
|
133
|
+
status: MergeStatus;
|
|
134
|
+
/** SHA of the resulting merge commit (if created) */
|
|
135
|
+
commitSha?: string;
|
|
136
|
+
/** SHA of the resulting tree */
|
|
137
|
+
treeSha?: string;
|
|
138
|
+
/** Common ancestor commit SHA */
|
|
139
|
+
baseSha?: string;
|
|
140
|
+
/** SHA of the current branch before merge */
|
|
141
|
+
oursSha: string;
|
|
142
|
+
/** SHA of the merged branch */
|
|
143
|
+
theirsSha: string;
|
|
144
|
+
/** List of conflicts if status is 'conflicted' */
|
|
145
|
+
conflicts?: MergeConflict[];
|
|
146
|
+
/** Statistics about the merge */
|
|
147
|
+
stats?: MergeStats;
|
|
148
|
+
/** Message for the merge (user-provided or auto-generated) */
|
|
149
|
+
message?: string;
|
|
150
|
+
/** Whether the merge was a fast-forward */
|
|
151
|
+
fastForward: boolean;
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* State of an in-progress merge (stored in .git/MERGE_HEAD, etc.)
|
|
155
|
+
*/
|
|
156
|
+
export interface MergeState {
|
|
157
|
+
/** SHA of the commit being merged */
|
|
158
|
+
mergeHead: string;
|
|
159
|
+
/** SHA of the original HEAD before merge */
|
|
160
|
+
origHead: string;
|
|
161
|
+
/** Commit message for the merge */
|
|
162
|
+
message: string;
|
|
163
|
+
/** Merge mode (for special merges) */
|
|
164
|
+
mode?: 'squash' | 'no-ff';
|
|
165
|
+
/** List of unresolved conflicts */
|
|
166
|
+
unresolvedConflicts: MergeConflict[];
|
|
167
|
+
/** List of resolved conflicts */
|
|
168
|
+
resolvedConflicts: MergeConflict[];
|
|
169
|
+
/** Options used for the merge */
|
|
170
|
+
options: MergeOptions;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Options for resolving a conflict
|
|
174
|
+
*/
|
|
175
|
+
export interface ResolveOptions {
|
|
176
|
+
/** Resolution strategy */
|
|
177
|
+
resolution: 'ours' | 'theirs' | 'base' | 'custom';
|
|
178
|
+
/** Custom content when resolution is 'custom' */
|
|
179
|
+
customContent?: Uint8Array;
|
|
180
|
+
/** Custom mode when resolution is 'custom' */
|
|
181
|
+
customMode?: string;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Result of conflict resolution
|
|
185
|
+
*/
|
|
186
|
+
export interface ResolveResult {
|
|
187
|
+
/** Whether resolution was successful */
|
|
188
|
+
success: boolean;
|
|
189
|
+
/** Path that was resolved */
|
|
190
|
+
path: string;
|
|
191
|
+
/** Error message if resolution failed */
|
|
192
|
+
error?: string;
|
|
193
|
+
/** Remaining unresolved conflicts */
|
|
194
|
+
remainingConflicts: number;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Result of abort or continue operations
|
|
198
|
+
*/
|
|
199
|
+
export interface MergeOperationResult {
|
|
200
|
+
/** Whether the operation was successful */
|
|
201
|
+
success: boolean;
|
|
202
|
+
/** Error message if operation failed */
|
|
203
|
+
error?: string;
|
|
204
|
+
/** Current HEAD SHA after operation */
|
|
205
|
+
headSha?: string;
|
|
206
|
+
/** Status message */
|
|
207
|
+
message?: string;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Extended object type that may include parsed commit/tree data
|
|
211
|
+
*/
|
|
212
|
+
interface ExtendedObject {
|
|
213
|
+
type: string;
|
|
214
|
+
data: Uint8Array;
|
|
215
|
+
tree?: string;
|
|
216
|
+
parents?: string[];
|
|
217
|
+
entries?: Array<{
|
|
218
|
+
mode: string;
|
|
219
|
+
name: string;
|
|
220
|
+
sha: string;
|
|
221
|
+
}>;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Interface for the storage layer used by merge operations
|
|
225
|
+
*/
|
|
226
|
+
export interface MergeStorage {
|
|
227
|
+
/** Read an object by SHA */
|
|
228
|
+
readObject(sha: string): Promise<ExtendedObject | null>;
|
|
229
|
+
/** Write an object and return its SHA */
|
|
230
|
+
writeObject(type: string, data: Uint8Array): Promise<string>;
|
|
231
|
+
/** Read a reference */
|
|
232
|
+
readRef(ref: string): Promise<string | null>;
|
|
233
|
+
/** Write a reference */
|
|
234
|
+
writeRef(ref: string, sha: string): Promise<void>;
|
|
235
|
+
/** Read merge state */
|
|
236
|
+
readMergeState(): Promise<MergeState | null>;
|
|
237
|
+
/** Write merge state */
|
|
238
|
+
writeMergeState(state: MergeState): Promise<void>;
|
|
239
|
+
/** Delete merge state */
|
|
240
|
+
deleteMergeState(): Promise<void>;
|
|
241
|
+
/** Stage a file for the index */
|
|
242
|
+
stageFile(path: string, sha: string, mode: string, stage?: number): Promise<void>;
|
|
243
|
+
/** Get the current index */
|
|
244
|
+
getIndex(): Promise<Map<string, {
|
|
245
|
+
sha: string;
|
|
246
|
+
mode: string;
|
|
247
|
+
stage: number;
|
|
248
|
+
}>>;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Performs a three-way merge between the current branch and another commit.
|
|
252
|
+
*
|
|
253
|
+
* This function implements Git's three-way merge algorithm:
|
|
254
|
+
* 1. Find the common ancestor (merge base) of the two commits
|
|
255
|
+
* 2. Compare both sides against the base to identify changes
|
|
256
|
+
* 3. Apply non-conflicting changes automatically
|
|
257
|
+
* 4. Identify and report conflicts for manual resolution
|
|
258
|
+
*
|
|
259
|
+
* @param storage - The storage interface for reading/writing objects
|
|
260
|
+
* @param oursSha - SHA of the current branch's HEAD commit
|
|
261
|
+
* @param theirsSha - SHA of the commit to merge
|
|
262
|
+
* @param options - Merge options
|
|
263
|
+
* @returns MergeResult with status and any conflicts
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* ```typescript
|
|
267
|
+
* const result = await merge(storage, 'abc123', 'def456', {
|
|
268
|
+
* message: 'Merge feature branch',
|
|
269
|
+
* allowFastForward: true
|
|
270
|
+
* })
|
|
271
|
+
*
|
|
272
|
+
* if (result.status === 'conflicted') {
|
|
273
|
+
* console.log('Conflicts:', result.conflicts)
|
|
274
|
+
* }
|
|
275
|
+
* ```
|
|
276
|
+
*/
|
|
277
|
+
export declare function merge(storage: MergeStorage, oursSha: string, theirsSha: string, options?: MergeOptions): Promise<MergeResult>;
|
|
278
|
+
/**
|
|
279
|
+
* Resolves a single merge conflict.
|
|
280
|
+
*
|
|
281
|
+
* After a merge results in conflicts, use this function to resolve
|
|
282
|
+
* individual files. Once all conflicts are resolved, use continueMerge()
|
|
283
|
+
* to complete the merge.
|
|
284
|
+
*
|
|
285
|
+
* @param storage - The storage interface
|
|
286
|
+
* @param path - Path to the conflicted file
|
|
287
|
+
* @param options - Resolution options
|
|
288
|
+
* @returns ResolveResult indicating success and remaining conflicts
|
|
289
|
+
*
|
|
290
|
+
* @example
|
|
291
|
+
* ```typescript
|
|
292
|
+
* // Resolve using "ours" strategy
|
|
293
|
+
* await resolveConflict(storage, 'src/file.ts', { resolution: 'ours' })
|
|
294
|
+
*
|
|
295
|
+
* // Resolve with custom content
|
|
296
|
+
* await resolveConflict(storage, 'src/file.ts', {
|
|
297
|
+
* resolution: 'custom',
|
|
298
|
+
* customContent: new TextEncoder().encode('merged content')
|
|
299
|
+
* })
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
302
|
+
export declare function resolveConflict(storage: MergeStorage, path: string, options: ResolveOptions): Promise<ResolveResult>;
|
|
303
|
+
/**
|
|
304
|
+
* Aborts an in-progress merge operation.
|
|
305
|
+
*
|
|
306
|
+
* This restores the repository to its state before the merge began,
|
|
307
|
+
* discarding any changes made during conflict resolution.
|
|
308
|
+
*
|
|
309
|
+
* @param storage - The storage interface
|
|
310
|
+
* @returns MergeOperationResult indicating success
|
|
311
|
+
*
|
|
312
|
+
* @example
|
|
313
|
+
* ```typescript
|
|
314
|
+
* const result = await abortMerge(storage)
|
|
315
|
+
* if (result.success) {
|
|
316
|
+
* console.log('Merge aborted, HEAD is now', result.headSha)
|
|
317
|
+
* }
|
|
318
|
+
* ```
|
|
319
|
+
*/
|
|
320
|
+
export declare function abortMerge(storage: MergeStorage): Promise<MergeOperationResult>;
|
|
321
|
+
/**
|
|
322
|
+
* Continues a merge after all conflicts have been resolved.
|
|
323
|
+
*
|
|
324
|
+
* This creates the merge commit with the resolved files and
|
|
325
|
+
* cleans up the merge state.
|
|
326
|
+
*
|
|
327
|
+
* @param storage - The storage interface
|
|
328
|
+
* @param message - Optional commit message (overrides stored message)
|
|
329
|
+
* @returns MergeOperationResult with the new commit SHA
|
|
330
|
+
*
|
|
331
|
+
* @example
|
|
332
|
+
* ```typescript
|
|
333
|
+
* // After resolving all conflicts
|
|
334
|
+
* const result = await continueMerge(storage)
|
|
335
|
+
* if (result.success) {
|
|
336
|
+
* console.log('Merge completed with commit', result.headSha)
|
|
337
|
+
* }
|
|
338
|
+
* ```
|
|
339
|
+
*/
|
|
340
|
+
export declare function continueMerge(storage: MergeStorage, message?: string): Promise<MergeOperationResult>;
|
|
341
|
+
/**
|
|
342
|
+
* Finds the best common ancestor (merge base) for two commits.
|
|
343
|
+
*
|
|
344
|
+
* @param storage - The storage interface
|
|
345
|
+
* @param commit1 - First commit SHA
|
|
346
|
+
* @param commit2 - Second commit SHA
|
|
347
|
+
* @returns SHA of the merge base, or null if no common ancestor exists
|
|
348
|
+
*/
|
|
349
|
+
export declare function findMergeBase(storage: MergeStorage, commit1: string, commit2: string): Promise<string | null>;
|
|
350
|
+
/**
|
|
351
|
+
* Performs a content-level three-way merge on text files.
|
|
352
|
+
*
|
|
353
|
+
* @param base - Content of the base (common ancestor) version
|
|
354
|
+
* @param ours - Content of our (current) version
|
|
355
|
+
* @param theirs - Content of their (merged) version
|
|
356
|
+
* @returns Merged content and any conflict markers
|
|
357
|
+
*/
|
|
358
|
+
export declare function mergeContent(base: Uint8Array, ours: Uint8Array, theirs: Uint8Array): {
|
|
359
|
+
merged: Uint8Array;
|
|
360
|
+
hasConflicts: boolean;
|
|
361
|
+
markers: ConflictMarker[];
|
|
362
|
+
};
|
|
363
|
+
/**
|
|
364
|
+
* Checks if a file is binary (non-text).
|
|
365
|
+
*
|
|
366
|
+
* @param content - File content to check
|
|
367
|
+
* @returns true if the file appears to be binary
|
|
368
|
+
*/
|
|
369
|
+
export declare function isBinaryFile(content: Uint8Array): boolean;
|
|
370
|
+
/**
|
|
371
|
+
* Gets the current merge state if a merge is in progress.
|
|
372
|
+
*
|
|
373
|
+
* @param storage - The storage interface
|
|
374
|
+
* @returns MergeState if merge is in progress, null otherwise
|
|
375
|
+
*/
|
|
376
|
+
export declare function getMergeState(storage: MergeStorage): Promise<MergeState | null>;
|
|
377
|
+
/**
|
|
378
|
+
* Checks if a merge is currently in progress.
|
|
379
|
+
*
|
|
380
|
+
* @param storage - The storage interface
|
|
381
|
+
* @returns true if a merge is in progress
|
|
382
|
+
*/
|
|
383
|
+
export declare function isMergeInProgress(storage: MergeStorage): Promise<boolean>;
|
|
384
|
+
export {};
|
|
385
|
+
//# sourceMappingURL=merge.d.ts.map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