/** * IssueProvider — Abstract interface for issue tracker operations. * * Implementations: GitHub (gh CLI), GitLab (glab CLI). */ /** * StateLabel type — string for flexibility with custom workflows. */ export type StateLabel = string; // --------------------------------------------------------------------------- // Issue types // --------------------------------------------------------------------------- export type Issue = { iid: number; title: string; description: string; labels: string[]; state: string; web_url: string; }; export type IssueComment = { author: string; body: string; created_at: string; }; /** Built-in PR states. */ export const PrState = { OPEN: "open", APPROVED: "approved", MERGED: "merged", CLOSED: "closed", } as const; export type PrState = (typeof PrState)[keyof typeof PrState]; export type PrStatus = { state: PrState; url: string | null; }; // --------------------------------------------------------------------------- // Provider interface // --------------------------------------------------------------------------- export interface IssueProvider { ensureLabel(name: string, color: string): Promise; ensureAllStateLabels(): Promise; createIssue(title: string, description: string, label: StateLabel, assignees?: string[]): Promise; listIssuesByLabel(label: StateLabel): Promise; getIssue(issueId: number): Promise; listComments(issueId: number): Promise; transitionLabel(issueId: number, from: StateLabel, to: StateLabel): Promise; closeIssue(issueId: number): Promise; reopenIssue(issueId: number): Promise; hasStateLabel(issue: Issue, expected: StateLabel): boolean; getCurrentStateLabel(issue: Issue): StateLabel | null; hasMergedMR(issueId: number): Promise; getMergedMRUrl(issueId: number): Promise; getPrStatus(issueId: number): Promise; mergePr(issueId: number): Promise; addComment(issueId: number, body: string): Promise; healthCheck(): Promise; }