/** * High-level GitHub client — wraps http.mts for application-level concerns. * * All GitHub I/O goes through native fetch (via http.mts); the `gh` CLI is no * longer used for GitHub API calls, but may be invoked as an auth-token * fallback via `gh auth token` when neither GH_TOKEN nor GITHUB_TOKEN is set. */ import type { MergeableState, MergeStateStatus } from "../types.mts"; export type { RateLimitInfo } from "./http.mts"; export { graphql, graphqlWithRateLimit } from "./http.mts"; export interface RepoInfo { owner: string; name: string; } /** * Returns the current repo's owner and name by parsing `git remote get-url origin`. * Handles https://, git@, and ssh:// remote URL formats. */ export declare function getRepoInfo(): Promise; /** * Derives the PR number for the current HEAD branch. * Returns null if no open PR is found. */ export declare function getCurrentPrNumber(): Promise; /** Returns the PR number for a given branch, or null if no open PR is found. */ export declare function getPrNumberForBranch(branch: string, owner: string, repo: string): Promise; /** Returns the `headRefOid` (commit SHA) of the given PR as reported by GitHub. */ export declare function getPrHeadSha(pr: number, owner: string, name: string): Promise; /** Fetches the node ID and body text for a PR. GitHub returns null body for empty bodies — coerced to "". */ export declare function getPullRequestBody(pr: number, owner: string, name: string): Promise<{ nodeId: string; body: string; }>; /** Overwrites the PR body. */ export declare function updatePullRequestBody(pullRequestId: string, body: string): Promise; /** * Fetches PR state, `mergeable`, and `mergeStateStatus` via the REST API. * * Used when the GraphQL API returns `UNKNOWN` for mergeability or before a * READY state. The same response carries state so a concurrent merge or * close can supersede the earlier GraphQL snapshot without another request. */ export declare function getMergeableState(pr: number, owner: string, repo: string): Promise<{ mergeable: MergeableState; mergeStateStatus: MergeStateStatus; state?: "OPEN" | "CLOSED" | "MERGED"; }>; export declare function getCurrentBranch(): Promise;