json-conflict-resolver
Version:
A rules-based JSON conflict resolver that parses Git conflict markers, reconstructs ours/theirs, and merges with deterministic strategies — beyond line-based merges.
33 lines (32 loc) • 1.4 kB
TypeScript
import { Conflict } from "./merger";
import { Config, InbuiltMergeStrategies } from "./types";
import { NormalizedConfig } from "./normalizer";
import { createLogger } from "./logger";
/**
* Common merge logic for processing a single file with ours/theirs/base data
*/
export declare const processMerge: <T extends string = InbuiltMergeStrategies>({ ours, theirs, base, format, filePath, config, normalizedConfig, logger, autoStage, }: {
ours: unknown;
theirs: unknown;
base?: unknown;
format: string;
filePath: string;
config: Config<T>;
normalizedConfig: NormalizedConfig;
logger: Awaited<ReturnType<typeof createLogger>>;
autoStage?: boolean;
}) => Promise<{
success: boolean;
conflicts: Conflict[];
}>;
/**
* Resolves Git merge conflicts for a single file using the three-way merge approach.
* This function is designed to work as a Git merge driver.
*
* @param oursPath - Path to the "ours" version of the file
* @param basePath - Path to the common ancestor version of the file
* @param theirsPath - Path to the "theirs" version of the file
* @param config - Configuration for conflict resolution
* @returns Promise that resolves when merge is complete
*/
export declare const resolveGitMergeFiles: <T extends string = InbuiltMergeStrategies>(oursPath: string, basePath: string, theirsPath: string, config?: Config<T>) => Promise<never>;