Files
devclaw-gitea/lib/providers/provider.ts
Lauren ten Hoor 371e760d94 feat: enhance workflow and testing infrastructure
- Introduced ExecutionMode type for project execution modes (parallel, sequential).
- Updated SetupOpts to use ExecutionMode instead of string literals.
- Enhanced workflow states to include a new "In Review" state with appropriate transitions.
- Implemented TestHarness for end-to-end testing, including command interception and workspace setup.
- Created TestProvider for in-memory issue tracking during tests.
- Refactored project registration and setup tools to utilize ExecutionMode.
- Updated various tools to ensure compatibility with new workflow and execution modes.
- Added new dependencies: cockatiel for resilience and zod for schema validation.
2026-02-16 13:27:14 +08:00

67 lines
2.0 KiB
TypeScript

/**
* 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<void>;
ensureAllStateLabels(): Promise<void>;
createIssue(title: string, description: string, label: StateLabel, assignees?: string[]): Promise<Issue>;
listIssuesByLabel(label: StateLabel): Promise<Issue[]>;
getIssue(issueId: number): Promise<Issue>;
listComments(issueId: number): Promise<IssueComment[]>;
transitionLabel(issueId: number, from: StateLabel, to: StateLabel): Promise<void>;
closeIssue(issueId: number): Promise<void>;
reopenIssue(issueId: number): Promise<void>;
hasStateLabel(issue: Issue, expected: StateLabel): boolean;
getCurrentStateLabel(issue: Issue): StateLabel | null;
hasMergedMR(issueId: number): Promise<boolean>;
getMergedMRUrl(issueId: number): Promise<string | null>;
getPrStatus(issueId: number): Promise<PrStatus>;
addComment(issueId: number, body: string): Promise<void>;
healthCheck(): Promise<boolean>;
}