/** * TaskManager — Abstract interface for issue tracker operations. * * GitHub (via gh CLI) and GitLab (via glab CLI) are the current implementations. * Future providers: Jira (via API). * * All DevClaw tools operate through this interface, making it possible * to swap issue trackers without changing tool logic. */ export const STATE_LABELS = [ "Planning", "To Do", "Doing", "To Test", "Testing", "Done", "To Improve", "Refining", ] as const; export type StateLabel = (typeof STATE_LABELS)[number]; export const LABEL_COLORS: Record = { Planning: "#6699cc", "To Do": "#428bca", Doing: "#f0ad4e", "To Test": "#5bc0de", Testing: "#9b59b6", Done: "#5cb85c", "To Improve": "#d9534f", Refining: "#f39c12", }; export type Issue = { iid: number; title: string; description: string; labels: string[]; state: string; web_url: string; }; export interface TaskManager { /** Create a label if it doesn't exist (idempotent). */ ensureLabel(name: string, color: string): Promise; /** Create all 8 state labels (idempotent). */ ensureAllStateLabels(): Promise; /** Create a new issue. */ createIssue(title: string, description: string, label: StateLabel, assignees?: string[]): Promise; /** List issues with a specific state label. */ listIssuesByLabel(label: StateLabel): Promise; /** Fetch a single issue by ID. */ getIssue(issueId: number): Promise; /** Transition an issue from one state label to another (atomic unlabel + label). */ transitionLabel(issueId: number, from: StateLabel, to: StateLabel): Promise; /** Close an issue. */ closeIssue(issueId: number): Promise; /** Reopen an issue. */ reopenIssue(issueId: number): Promise; /** Check if an issue has a specific state label. */ hasStateLabel(issue: Issue, expected: StateLabel): boolean; /** Get the current state label of an issue. */ getCurrentStateLabel(issue: Issue): StateLabel | null; /** Check if any merged MR/PR exists for a specific issue. */ hasMergedMR(issueId: number): Promise; /** Verify the task manager is working (CLI available, auth valid, repo accessible). */ healthCheck(): Promise; } /** * Compatibility alias for backward compatibility. * @deprecated Use TaskManager instead. */ export type IssueProvider = TaskManager;