import { type JournalResult } from "./commands/journal/index.mts"; import { type MarkFilesAsViewedResult } from "./commands/mark-files-as-viewed.mts"; import type { ResolveResult } from "./comments/resolve.mts"; import type { BuildSuggestionPatchesResult, CommitSuggestionResult, IterateCommandOptions, IterateResult, PollSummaryResult } from "./types.mts"; export interface CreatePrShepherdOptions { /** Working directory used for git, config, and classification-rule lookups. */ cwd?: string; } /** A positive PR number, GitHub pull-request URL, or owner/repo#number reference. */ export type PrReference = number | string; type IterateOptions = Omit; export type SingleIterateInput = IterateOptions & { pr?: PrReference; prs?: never; stack?: never; }; export type AggregateIterateInput = IterateOptions & ({ prs: PrReference[]; pr?: never; stack?: never; } | { stack: PrReference; pr?: never; prs?: never; }); export type IterateInput = SingleIterateInput | AggregateIterateInput; export interface ReviewMutationsOperation { type: "review_mutations"; resolveThreadIds?: string[]; replyThreadIds?: string[]; minimizeCommentIds?: string[]; dismissReviewIds?: string[]; /** Required when replying to a thread or dismissing a review. */ message?: string; requireSha?: string; } export interface MarkFilesViewedOperation { /** Marks selected changed files as viewed. GitHub authorizes the requested mutation. */ type: "mark_files_viewed"; files?: string[]; tests?: boolean; matchPatterns?: string[]; } export interface AppendJournalOperation { type: "append_journal"; item: string; dryRun?: boolean; } /** Operations run in this exact list order after validation. */ export type ApplyOperation = ReviewMutationsOperation | MarkFilesViewedOperation | AppendJournalOperation; export interface ApplyInput { /** PR shared by every operation in this ordered apply request. */ pr?: PrReference; operations: ApplyOperation[]; } export type ApplyOperationResult = { type: "review_mutations"; result: ResolveResult; } | { type: "mark_files_viewed"; result: MarkFilesAsViewedResult; } | { type: "append_journal"; result: JournalResult; }; export interface ApplyResult { operations: ApplyOperationResult[]; } export interface BuildSuggestionPatchInput { pr?: PrReference; threadId: string; message: string; description?: string; } export interface SuggestionPatchInput { threadId: string; message: string; description?: string; } export interface BuildSuggestionPatchesInput { pr?: PrReference; suggestions: SuggestionPatchInput[]; } export interface PrShepherd { iterate(input?: SingleIterateInput): Promise; iterate(input: AggregateIterateInput): Promise; iterate(input: IterateInput): Promise; apply(input: ApplyInput): Promise; buildSuggestionPatches(input: BuildSuggestionPatchesInput): Promise; /** Compatibility adapter; prefer buildSuggestionPatches. */ buildSuggestionPatch(input: BuildSuggestionPatchInput): Promise; } /** Raised before any API mutation when an input cannot be validated. */ export declare class PrShepherdValidationError extends Error { constructor(message: string); } /** Raised when a later ordered apply operation fails after earlier operations completed. */ export declare class PartialApplyError extends Error { readonly failedIndex: number; readonly completed: ApplyOperationResult[]; constructor(failedIndex: number, completed: ApplyOperationResult[], cause: unknown); } /** * Creates the programmatic API. The returned object intentionally exposes only * read/plan, ordered apply, and suggestion-patch operations. */ export declare function createPrShepherd(options?: CreatePrShepherdOptions): PrShepherd; export {};