/**
 * Apply an approved diff to a SKILL.md file, commit the change, and record
 * the event in the ledger.
 *
 * AC-US2-04: writes the diff AND runs `git commit -m "refine(<skill>): <rationale>"`.
 *            NEVER pushes.
 * AC-US2-05: records the refinement in `.specweave/state/skill-refinements.json`.
 *
 * Git operations go through `execFileNoThrow` so arguments cannot be shell-
 * interpolated. If any step fails the SKILL.md is restored from the pre-diff
 * snapshot and no ledger entry is written.
 *
 * @module core/skill-refine/apply
 */
import { dirname } from 'path';
import { type ExecResult } from '../../utils/execFileNoThrow';
import { type RefinementLedgerEntry } from './ledger';
export interface ApplyOptions {
    /** Absolute path to the SKILL.md being refined. */
    skillPath: string;
    /** Unified diff from Haiku (or user-edited). */
    diff: string;
    /** Haiku-generated rationale (goes into commit message + ledger). */
    rationale: string;
    /** Signal IDs that motivated this refinement (for ledger provenance). */
    signalIds: string[];
    /** Target skill slug (e.g. `sw:architect`) — used in commit message + ledger. */
    targetSkill: string;
    /** Absolute path to `.specweave/state/skill-refinements.json`. */
    ledgerPath: string;
    /** Absolute path to the git repo that holds `skillPath`. */
    repoRoot: string;
    /** Optional override — defaults to `git config user.email` then 'unknown'. */
    author?: string;
    /** Injection seam for tests. Defaults to the real execFileNoThrow. */
    runGit?: (args: string[], cwd: string) => Promise<ExecResult>;
}
export interface ApplyResult {
    commitSha: string;
    ledgerEntry: RefinementLedgerEntry;
}
/**
 * Apply the diff + commit + record. Throws on any step failure; callers
 * translate the error into user-facing text.
 */
export declare function applyRefinement(opts: ApplyOptions): Promise<ApplyResult>;
export { dirname };
//# sourceMappingURL=apply.d.ts.map