- Refactor reviewPass function to identify states with review checks instead of specific review types. - Introduce review policies (HUMAN, AGENT, AUTO) to control PR review processes based on developer levels. - Update projectTick to handle review policies and step routing labels for reviewers and testers. - Add detailed reviewer instructions to templates for clarity on review responsibilities. - Implement role:level label management, allowing dynamic creation of labels based on project configuration. - Enhance task_update tool to support state and level updates, ensuring at least one parameter is provided. - Update work_finish tool to include reviewer actions (approve, reject) in task completion. - Modify work_start tool to utilize role-level detection for better level assignment. - Add tests for new functionalities, including review routing and level detection from labels.
71 lines
2.2 KiB
TypeScript
71 lines
2.2 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>;
|
|
addLabel(issueId: number, label: string): Promise<void>;
|
|
removeLabels(issueId: number, labels: string[]): 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>;
|
|
mergePr(issueId: number): Promise<void>;
|
|
getPrDiff(issueId: number): Promise<string | null>;
|
|
addComment(issueId: number, body: string): Promise<void>;
|
|
healthCheck(): Promise<boolean>;
|
|
}
|