import { type Composition } from "../../shared/composition.js";
import { type PreflightResult } from "../../shared/composition/preflight.js";
export interface OpsContext {
    workId: string;
    /** Override for tests / non-default work roots. Defaults to ~/.autoviral/works. */
    worksRoot?: string;
}
export declare function compositionPathFor(ctx: OpsContext): string;
/**
 * Phase 5 Task 5.4 — sibling file that holds the previous content of
 * composition.yaml at the moment of the most recent write. Used by
 * `autoviral comp diff` to surface unified diffs.
 *
 * Naming: NOT `.bak` — the legacy crossfade-fix tooling already uses
 * `.bak` in user workspaces, so we'd stomp on real backup data.
 * `.previous` is unambiguous and never used elsewhere in the project.
 */
export declare function compositionPreviousPathFor(ctx: OpsContext): string;
export declare function readCompositionFor(ctx: OpsContext): Promise<Composition>;
export declare function writeCompositionFor(ctx: OpsContext, comp: Composition): Promise<void>;
/**
 * Phase 5 Task 5.4 — unified diff between composition.yaml.previous and
 * current composition.yaml. Returns:
 *   - `{ diff: string, hasBaseline: true }` with a unified diff (may be
 *     empty if files match)
 *   - `{ diff: "", hasBaseline: false }` if no .previous snapshot exists
 *     (first-write case, before any mutation)
 *   - Throws if reading the current composition fails.
 *
 * We deliberately keep the implementation dependency-free — a small
 * line-level unified diff is fine for human inspection at the CLI; we
 * are not building a syntax-aware yaml diff.
 */
export declare function diffCompositionFor(ctx: OpsContext): Promise<{
    diff: string;
    hasBaseline: boolean;
}>;
/**
 * Minimal line-level unified diff. NOT a Myers diff — we walk both
 * files looking for the longest common prefix, then the longest common
 * suffix, and emit a single hunk for the middle. This is deterministic,
 * dependency-free, and good enough for the human-facing `autoviral comp
 * diff` output. The CLI never tries to *apply* this diff — it's display
 * only.
 */
export declare function unifiedDiff(before: string, after: string, beforeName: string, afterName: string): string;
export declare function withWorkLock<T>(workId: string, fn: () => Promise<T>): Promise<T>;
export declare function mutateCompositionFor(ctx: OpsContext, mutator: (comp: Composition) => Composition, onCommitted?: (next: Composition) => void): Promise<Composition>;
export declare function dryRunMutate(ctx: OpsContext, mutator: (comp: Composition) => Composition, _onCommitted?: (next: Composition) => void): Promise<PreflightResult>;
//# sourceMappingURL=composition-ops.d.ts.map