/**
 * Git Merge Utilities
 *
 * Shared squash-merge-in-temp-worktree logic used by both the Merge Steward
 * and the Docs Steward services.
 *
 * Pattern:
 *  1. Fetch origin
 *  2. (Optional) Pre-flight conflict detection via git merge-tree
 *  3. Create temp worktree with detached HEAD at origin/<target>
 *  4. Squash merge (or regular merge) source branch
 *  5. Commit with provided message
 *  6. Push HEAD:<target> to remote
 *  7. Remove temp worktree (always, in finally)
 *  8. (Optional) Sync local target branch via fast-forward
 *
 * @module
 */
export interface MergeBranchOptions {
    /** Workspace root (the main repo checkout) */
    workspaceRoot: string;
    /** Branch to merge from */
    sourceBranch: string;
    /** Branch to merge into (auto-detected if omitted) */
    targetBranch?: string;
    /** 'squash' (default) or 'merge' (--no-ff) */
    mergeStrategy?: 'squash' | 'merge';
    /** Push to remote after merge (default: true) */
    autoPush?: boolean;
    /** Commit message (required for squash, auto-generated for merge) */
    commitMessage?: string;
    /** Run pre-flight conflict detection via merge-tree (default: true) */
    preflight?: boolean;
    /** Fast-forward local target branch after push (default: true) */
    syncLocal?: boolean;
}
export interface MergeBranchResult {
    /** Whether the merge succeeded */
    success: boolean;
    /** Merge/squash commit hash if successful */
    commitHash?: string;
    /** Whether a conflict was detected */
    hasConflict: boolean;
    /** Error message if merge failed */
    error?: string;
    /** Files with conflicts, if any */
    conflictFiles?: string[];
}
/**
 * Run a git command in a worktree directory.
 * Refuses to run in the workspace root to prevent corrupting the main repo HEAD.
 */
export declare function execGitSafe(command: string, worktreePath: string, workspaceRoot: string): Promise<{
    stdout: string;
    stderr: string;
}>;
/**
 * Detect the default target branch for the repo by checking origin/HEAD,
 * then falling back to origin/main, then origin/master, then 'main'.
 */
export declare function detectTargetBranch(workspaceRoot: string): Promise<string>;
/**
 * Perform a merge of `sourceBranch` into `targetBranch` using a temporary
 * worktree. This never touches the main repo's HEAD or index.
 */
export declare function mergeBranch(options: MergeBranchOptions): Promise<MergeBranchResult>;
/**
 * Fast-forward the local target branch ref to match origin, without
 * the dangerous checkout dance.
 *
 * - When NOT on the target branch: `git fetch origin target:target`
 *   updates the local ref without touching the working tree at all.
 * - When ON the target branch: `git merge --ff-only origin/target`
 *   fast-forwards in place (unavoidably touches working tree files).
 * - If either fails (e.g. non-ff divergence): logs a warning and
 *   returns silently. The merge is already pushed to remote.
 */
export declare function syncLocalBranch(workspaceRoot: string, targetBranch: string): Promise<void>;
//# sourceMappingURL=merge.d.ts.map