/**
 * Change-area analysis for one worktree node, used to order sibling nodes for
 * batch refinement so that nodes least likely to conflict merge first.
 *
 * The heuristic is deliberately git-only and side-effect-free: it inspects the
 * commits the node's branch adds on top of the base (`base..branch`) and records
 *   - whether any submodule gitlink path is touched (high-conflict signal: the
 *     batch must rebase later siblings onto the advanced submodule main), and
 *   - the set of changed top-level paths (so siblings touching disjoint trees can
 *     be ordered ahead of ones that overlap).
 */
export interface MeshRefineBatchNodeChangeArea {
    nodeId: string;
    workspace: string;
    branch: string;
    /** Top-level path segments changed by the branch vs. base (e.g. 'oss', 'packages'). */
    changedTopLevelPaths: string[];
    /** Full changed file list (bounded) for overlap detection. */
    changedFiles: string[];
    /** Submodule gitlink paths touched by the branch (subset of changedTopLevelPaths). */
    touchedSubmodulePaths: string[];
    /** True when the branch touches at least one submodule gitlink. */
    touchesSubmodule: boolean;
    /** Number of commits the branch is ahead of base; 0 means nothing to merge. */
    aheadCount: number;
    /** Non-fatal analysis error (e.g. base/branch unresolved); ordering falls back to neutral. */
    error?: string;
}
export interface MeshRefineBatchOrderingResult {
    /** Node IDs in the order they should be refined. */
    order: string[];
    /** Per-node change areas, keyed by node id, for plan transparency. */
    changeAreas: Record<string, MeshRefineBatchNodeChangeArea>;
    /** Human-readable explanation of why the order was chosen. */
    rationale: string[];
}
/**
 * Analyze one worktree node's change area against its merge base.
 *
 * @param baseRef  ref that the node will merge into (e.g. 'origin/main' or a SHA)
 * @param branchRef the node's branch tip
 * @param diffCwd  repo to run the diff in (the worktree itself is authoritative for
 *                 `branch` resolution, but the diff `base..branch` is symmetric, so
 *                 the worktree cwd works for both refs once base is a reachable SHA).
 */
export declare function analyzeMeshRefineNodeChangeArea(args: {
    nodeId: string;
    workspace: string;
    branch: string;
    baseRef: string;
    branchRef: string;
    diffCwd: string;
    submodulePaths: Set<string>;
}): Promise<MeshRefineBatchNodeChangeArea>;
/**
 * Order nodes for batch refinement to minimize cross-sibling conflicts.
 *
 * Heuristic (deterministic, stable):
 *   1. Nodes that do NOT touch any submodule come first — they cannot advance the
 *      submodule main, so they never force a later submodule rebase.
 *   2. Within each group, fewer touched top-level paths first (smaller blast radius).
 *   3. Tie-break by node id for determinism.
 *
 * Submodule-touching siblings are intrinsically serial: each one that merges
 * advances oss main, so the next must rebase. Ordering them last keeps the
 * non-submodule merges (which never need a submodule rebase) clean and up front.
 */
export declare function orderMeshRefineBatchNodes(changeAreas: MeshRefineBatchNodeChangeArea[]): MeshRefineBatchOrderingResult;
