/**
 * HookInstaller — Installs and manages the post-merge Git hook.
 *
 * Follows hexagonal architecture: all I/O is injected via constructor.
 * The service executes a strategy decided by the caller (CLI handler).
 *
 * @module domain/services/HookInstaller
 */
import type HookPathPort from '../../ports/HookPathPort.ts';
export interface FsAdapter {
    writeFileSync(path: string, content: string | Uint8Array, options?: {
        mode?: number;
    }): void;
    chmodSync(path: string, mode: number): void;
    readFileSync(path: string, encoding?: string): string;
    existsSync(path: string): boolean;
    mkdirSync(path: string, options?: {
        recursive?: boolean;
    }): void;
}
export interface PathUtils {
    join(...segments: string[]): string;
    resolve(...segments: string[]): string;
}
export type HookKind = 'none' | 'ours' | 'foreign';
export interface HookClassification {
    kind: HookKind;
    version?: string;
    appended?: boolean;
}
/**
 * Classifies an existing hook file's content.
 *
 * Determines whether the hook is absent, ours (with version), or foreign (third-party).
 *
 * @param content - File content or null if missing
 * @returns Classification result
 */
export declare function classifyExistingHook(content: string | null | undefined): HookClassification;
export type InstallStrategy = 'install' | 'upgrade' | 'append' | 'replace';
export interface InstallResult {
    action: string;
    hookPath: string;
    version: string;
    backupPath?: string;
}
export interface HookStatus {
    installed: boolean;
    version?: string;
    current?: boolean;
    foreign?: boolean;
    hookPath: string;
}
export declare class HookInstaller {
    private readonly _fs;
    private readonly _hookPathPort;
    private readonly _templateDir;
    private readonly _version;
    private readonly _path;
    /**
     * Creates a new HookInstaller.
     */
    constructor({ fs, hookPathPort, version, templateDir, path, }: {
        fs: FsAdapter;
        hookPathPort: HookPathPort;
        version: string;
        templateDir: string;
        path: PathUtils;
    });
    /**
     * Returns the version string this installer stamps hooks with.
     */
    get version(): string;
    /**
     * Get the current hook status for a repo.
     */
    getHookStatus(repoPath: string): Promise<HookStatus>;
    /**
     * Installs the post-merge hook.
     *
     * @param repoPath - Path to git repo
     * @param opts - Install options
     * @throws {WarpError} If the strategy is not recognized
     */
    install(repoPath: string, { strategy }: {
        strategy: InstallStrategy;
    }): Promise<InstallResult>;
    /**
     * Writes a fresh hook file with no pre-existing content.
     */
    private _freshInstall;
    /**
     * Upgrades an existing warp hook, preserving appended third-party content when possible.
     */
    private _upgradeInstall;
    /**
     * Appends the warp hook body to an existing third-party hook file.
     */
    private _appendInstall;
    /**
     * Replaces an existing hook file, creating a backup of the original.
     */
    private _replaceInstall;
    /**
     * Loads the post-merge hook template from the configured template directory.
     */
    private _loadTemplate;
    /**
     * Replaces version placeholders in the template with the actual version string.
     */
    private _stampVersion;
    /**
     * Resolves the hooks directory, respecting core.hooksPath and custom git-dir config.
     */
    private _resolveHooksDir;
    /**
     * Resolves the full path to the post-merge hook file.
     */
    private _resolveHookPath;
    /**
     * Reads a file, returning null if it does not exist or cannot be read.
     */
    private _readFile;
    /**
     * Creates the directory if it does not already exist.
     */
    private _ensureDir;
}
