export type PrStatus = "pending" | "failing" | "passing" | "merged" | "closed" | "draft"; export interface PrInfo { number: number; url: string; status: PrStatus; /** Open, not a draft, and either checks failed or no approval yet: the user's turn. */ needsReview: boolean; title?: string; } /** Pull request URLs in a text, each once, without a trailing path (`/files`, `#…`). */ export declare function prUrlsIn(text: string): string[]; export declare function isPrUrl(s: string): boolean; export declare function prNumber(url: string): number | undefined; export interface LinkStep { /** Pull requests the command's output names. */ urls: string[]; /** Look the branch up now (and after later commands until one is found). */ lookup: boolean; /** A command that retries a pending lookup. */ retry: boolean; } /** What a finished shell command means for the session's pull requests. */ export declare function linkStep(command: string, output: string): LinkStep; /** Claude Code retries the branch lookup after up to five later commands. */ export declare const LOOKUP_RETRIES = 5; interface GhCheck { conclusion?: string | null; state?: string | null; status?: string | null; } export interface GhPr { number?: number; url?: string; state?: string; isDraft?: boolean; reviewDecision?: string | null; statusCheckRollup?: GhCheck[] | null; title?: string; } /** Checks of `gh pr view --json statusCheckRollup`: check runs carry conclusion, statuses state. */ export declare function checksOf(rollup: GhCheck[] | null | undefined): "none" | "pending" | "failing" | "passing"; /** One pull request from `gh pr view --json number,url,state,isDraft,reviewDecision,statusCheckRollup,title`. */ export declare function prFromGh(pr: GhPr): PrInfo | undefined; /** Claude Code's colours: yellow waiting or failed, green passed, purple merged, grey draft or closed. */ export declare function prTone(s: PrStatus): "warning" | "success" | "accent" | "dim"; /** The pull request that most needs attention (its colour is the label's when there are several). */ export declare function mostUrgent(prs: PrInfo[]): PrInfo | undefined; /** The row's label: `#1234`, or `3 PRs`. */ export declare function prLabel(prs: PrInfo[] | undefined): { text: string; tone: ReturnType; url?: string; } | undefined; /** OSC 8 hyperlink, unless FORCE_HYPERLINK=0 (Claude Code emits it even over SSH or tmux). */ export declare function hyperlink(text: string, url: string | undefined, env?: NodeJS.ProcessEnv): string; /** Claude Code's "Ready for review": an open pull request that needs review or has failing checks. */ export declare function readyForReview(prs: PrInfo[] | undefined): boolean; /** `#1234` or a pull request URL typed into the agent view's input. */ export declare function prQuery(text: string): { number: number; url?: string; } | undefined; export declare function rowHasPr(prs: PrInfo[] | undefined, q: { number: number; url?: string; }): boolean; export {};