/**
* A merged PR that `hula revert` can undo.
*/
export interface ResolvedTarget {
/** `pr` when resolved through a merged PR; `commit` for a bare SHA revert. */
kind: "pr" | "commit";
/** Merged PR number, or null for a bare-commit revert with no associated PR. */
prNumber: number | null;
/** Title used for the `Revert "
"` PR. */
prTitle: string;
/** Original PR URL (null for a bare-commit revert). */
prUrl: string | null;
/** Base branch to open the revert PR into. */
baseBranch: string;
/** The (usually deleted) feature/head branch, so it can be recreated. */
headBranch: string | null;
/** Original PR head SHA, used to recreate the deleted branch. */
headSha: string | null;
/** Issue the original PR closed (reopened after the revert), or null. */
closedIssueNumber: number | null;
/**
* For a bare-commit target (a SHA with no associated merged PR): the exact
* commit to revert. Null for the PR path, where the merge shape is resolved
* via {@link PRService.getMergeInfo}.
*/
directCommitSha: string | null;
}
/** One candidate when a branch name maps to several merged PRs. */
export interface TargetCandidate {
prNumber: number;
title: string;
mergedAt: string | null;
url: string;
headRef: string;
}
export type ResolveResult = {
status: "resolved";
target: ResolvedTarget;
} | {
status: "ambiguous";
candidates: TargetCandidate[];
} | {
status: "error";
message: string;
};
/**
* Detect the repository's default branch via `gh`, falling back to `main`.
* The result is guarded against shell-unsafe names by the caller before use.
*/
export declare function detectDefaultBranch(): Promise;
/**
* Classify a `` string into its kind + extracted value.
* Exported for unit testing of the detection logic.
*/
export declare function detectTargetKind(target: string): {
kind: "pr";
prNumber: number;
} | {
kind: "sha";
sha: string;
} | {
kind: "branch";
branch: string;
};
/**
* Resolve a `` (branch name, PR number/URL, or commit SHA) to the
* merged PR (or bare commit) that `hula revert` should undo.
*
* @param target - The user-supplied target string.
* @param opts.pr - Explicit PR number to disambiguate a reused branch name.
* @param opts.defaultBranch - Default branch, used as the base for a bare-commit revert.
*/
export declare function resolveTarget(target: string, opts?: {
pr?: number;
defaultBranch?: string;
}): Promise;
//# sourceMappingURL=resolveTarget.d.ts.map