@phren/cli
Version:
Knowledge layer for AI agents - CLI, MCP server, and data layer
90 lines (89 loc) • 2.56 kB
TypeScript
import { ForgeError } from "./errors.js";
export { ForgeError } from "./errors.js";
export { parseRepo, parseRepoForProject, repoForProject } from "./repositories.js";
export type ForgeKind = "gitboy" | "github";
/** A repository in the form domain/owner/name. */
export type RepoRef = string;
export interface IssueRef {
repo: RepoRef;
number: number;
}
export interface ChecklistItem {
text: string;
done: boolean;
}
export interface Issue {
repo: RepoRef;
number: number;
url: string;
title: string;
body: string;
state: "open" | "closed";
labels: string[];
assignees: string[];
checklist: ChecklistItem[];
claimedBy?: {
user?: string;
computer?: string;
};
updatedAt: string;
createdAt: string;
}
export interface IssueQuery {
repos?: RepoRef[];
state?: "open" | "closed" | "all";
assignee?: string;
label?: string;
search?: string;
/** Defaults to 50 and caps at 200. */
limit?: number;
}
export interface NewIssue {
repo: RepoRef;
title: string;
body?: string;
checklist?: string[];
labels?: string[];
}
export interface IssueEdit {
title?: string;
body?: string;
checklist?: ChecklistItem[];
checklistChanges?: {
done: number[];
added: string[];
};
addLabels?: string[];
removeLabels?: string[];
state?: "open" | "closed";
}
export interface IssueProvider {
readonly kind: ForgeKind;
list(query: IssueQuery & {
repos: RepoRef[];
}): Promise<Issue[]>;
get(ref: IssueRef): Promise<Issue>;
create(input: NewIssue): Promise<Issue>;
edit(ref: IssueRef, edit: IssueEdit): Promise<Issue>;
comment(ref: IssueRef, body: string): Promise<{
url: string;
}>;
/** Assign to the signed-in user if another computer has no claim. Release only acts on this computer's label. */
claim(ref: IssueRef, computer: string, release?: boolean): Promise<Issue>;
close(ref: IssueRef, comment?: string): Promise<Issue>;
}
export declare function providerFor(repo: RepoRef): IssueProvider;
export interface IssueListFailure {
repo: RepoRef;
code: ForgeError["code"];
error: string;
}
export interface IssueList {
issues: Issue[];
errors: IssueListFailure[];
}
export declare class IssueListError extends ForgeError {
errors: [IssueListFailure, ...IssueListFailure[]];
constructor(errors: [IssueListFailure, ...IssueListFailure[]]);
}
export declare function listAcross(query: IssueQuery): Promise<IssueList>;