/**
 * Automated pull request opener for the improvement loop.
 *
 * When `runImprovementLoop` ships a winner (`autoOnPromote: 'pr'`) it produces
 * a promoted surface diff. To close the eval → prod → eval cycle the framework
 * lands that change as a reviewable code change. This module does exactly that:
 *
 *   1. Stage a branch off `baseBranch`.
 *   2. Write each `fileChange` into the worktree.
 *   3. Commit + push.
 *   4. Open a PR via the GitHub API.
 *
 * Two transports ship in core:
 *
 *   - `ghCliClient(opts)` — shells out to the `gh` CLI. No extra deps,
 *     re-uses the developer machine's `gh auth` state, works with both
 *     github.com and GitHub Enterprise. This is the recommended default.
 *   - `httpGithubClient(opts)` — direct `fetch` against `api.github.com`
 *     with a bearer token. Useful in CI where `gh` may not be installed.
 *
 * Both implement the small `AutoPrClient` interface, so tests substitute
 * a fake without spinning a process or network.
 */
export interface FileChange {
    /** Repo-relative path. Forward slashes; no `..`. */
    path: string;
    /** New file contents. UTF-8. */
    contents: string;
    /** Optional explanatory comment shown in the commit body. */
    rationale?: string;
}
export interface RepoRef {
    owner: string;
    name: string;
}
export interface ProposeAutomatedPullRequestInput {
    repo: RepoRef;
    /** Branch to base the PR on. Default `'main'`. */
    baseBranch?: string;
    /** New branch name. Use a prefix + a short stable id; no spaces. */
    branchName: string;
    fileChanges: FileChange[];
    title: string;
    body: string;
    /** Optional GitHub usernames to request review from. */
    reviewers?: string[];
    /** Optional labels to apply. */
    labels?: string[];
    /** Commit author name. Default: derived from the GitHub client. */
    authorName?: string;
    /** Commit author email. Default: derived from the GitHub client. */
    authorEmail?: string;
    /** Dry-run — do not push or open a PR; just return the would-be plan. */
    dryRun?: boolean;
}
export interface ProposeAutomatedPullRequestResult {
    prUrl: string;
    branchName: string;
    headSha: string;
    dryRun: boolean;
}
/** Pluggable transport for the auto-PR pipeline. */
export interface AutoPrClient {
    /**
     * Create a branch from `baseBranch`, write file changes, commit, push,
     * and open a PR. Returns the PR's HTML url and head SHA.
     *
     * Implementations must be idempotent on `branchName`: if the branch
     * already exists with the same head SHA as the would-be commit, return
     * the existing PR rather than failing. This makes the production loop
     * safe to retry on transient errors.
     */
    proposeChange(input: ProposeAutomatedPullRequestInput): Promise<ProposeAutomatedPullRequestResult>;
}
export declare function proposeAutomatedPullRequest(client: AutoPrClient, input: ProposeAutomatedPullRequestInput): Promise<ProposeAutomatedPullRequestResult>;
export interface HttpGithubClientOptions {
    /** Personal access token, GitHub App token, or `GITHUB_TOKEN` from Actions. */
    token: string;
    /** Override for GitHub Enterprise. Default `'https://api.github.com'`. */
    apiBase?: string;
    /** Test seam — defaults to global `fetch`. */
    fetchImpl?: typeof fetch;
    /** Test seam — clock for commit timestamps. */
    now?: () => Date;
}
/**
 * Direct REST-API GitHub client. No external deps.
 *
 * Idempotency strategy: before creating refs/commits/PRs, check whether
 * the branch already exists at the desired tree. If so, return the
 * existing PR (or open one if missing). Errors from concurrent runs
 * (`Reference already exists`) are caught and treated as success.
 */
export declare function httpGithubClient(opts: HttpGithubClientOptions): AutoPrClient;
export interface GhCliClientOptions {
    /** Override the CLI binary (`gh`). For testing. */
    bin?: string;
    /** Working directory containing a clone of `repo`. Default: process cwd. */
    cwd?: string;
    /** Test seam: process spawner. Default: node:child_process spawn. */
    exec?: (bin: string, args: string[], opts: {
        cwd: string;
        stdin?: string;
    }) => Promise<{
        stdout: string;
        stderr: string;
        exitCode: number;
    }>;
}
/**
 * `gh` CLI transport. Requires:
 *   - `gh` installed and authenticated (`gh auth status`).
 *   - A local clone of the repo with a clean working tree.
 *   - `git` on PATH.
 *
 * Uses `gh api` for repo metadata and `gh pr create` for the PR. The
 * actual commit lands via `git`, which keeps `gh`'s footprint minimal.
 */
export declare function ghCliClient(opts?: GhCliClientOptions): AutoPrClient;
//# sourceMappingURL=auto-pr.d.ts.map