Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DgBEW6qAwgn2fcQbA2f4ZQ
144 lines
3.8 KiB
TypeScript
144 lines
3.8 KiB
TypeScript
export const LIST_QUERY = /* GraphQL */ `
|
|
query List($q: String!, $cursor: String) {
|
|
rateLimit { cost remaining resetAt }
|
|
search(query: $q, type: ISSUE, first: 50, after: $cursor) {
|
|
issueCount
|
|
pageInfo { hasNextPage endCursor }
|
|
nodes {
|
|
... on PullRequest {
|
|
id
|
|
number
|
|
title
|
|
url
|
|
isDraft
|
|
updatedAt
|
|
author { login }
|
|
headRefName
|
|
headRefOid
|
|
repository { nameWithOwner }
|
|
commits(last: 1) { nodes { commit { statusCheckRollup { state } } } }
|
|
reviewThreads(first: 50) { totalCount nodes { isResolved } }
|
|
comments(first: 1) { totalCount }
|
|
reviews(first: 1) { totalCount }
|
|
latestReviews(first: 10) { nodes { author { login } state submittedAt url } }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export interface ListPr {
|
|
id: string;
|
|
number: number;
|
|
title: string;
|
|
url: string;
|
|
isDraft: boolean;
|
|
updatedAt: string;
|
|
author: { login: string } | null;
|
|
headRefName: string;
|
|
headRefOid: string;
|
|
repository: { nameWithOwner: string };
|
|
commits: { nodes: { commit: { statusCheckRollup: { state: string } | null } }[] };
|
|
reviewThreads: { totalCount: number; nodes: { isResolved: boolean }[] };
|
|
comments: { totalCount: number };
|
|
reviews: { totalCount: number };
|
|
latestReviews: {
|
|
nodes: { author: { login: string } | null; state: string; submittedAt: string; url: string }[];
|
|
};
|
|
}
|
|
|
|
export interface ListResult {
|
|
search: {
|
|
issueCount: number;
|
|
pageInfo: { hasNextPage: boolean; endCursor: string | null };
|
|
nodes: (ListPr | Record<string, never>)[];
|
|
};
|
|
}
|
|
|
|
export const DETAIL_QUERY = /* GraphQL */ `
|
|
query Details($ids: [ID!]!) {
|
|
rateLimit { cost remaining resetAt }
|
|
nodes(ids: $ids) {
|
|
... on PullRequest {
|
|
id
|
|
commits(last: 1) {
|
|
nodes {
|
|
commit {
|
|
oid
|
|
statusCheckRollup {
|
|
state
|
|
contexts(first: 100) {
|
|
nodes {
|
|
__typename
|
|
... on CheckRun { name status conclusion detailsUrl startedAt }
|
|
... on StatusContext { context state targetUrl }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
comments(last: 50) {
|
|
nodes { id author { login } bodyText createdAt updatedAt url }
|
|
}
|
|
reviews(last: 30) {
|
|
nodes { id author { login } state bodyText submittedAt url }
|
|
}
|
|
reviewThreads(first: 100) {
|
|
nodes {
|
|
id
|
|
isResolved
|
|
path
|
|
comments(first: 30) {
|
|
nodes { id author { login } bodyText createdAt updatedAt url }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
`;
|
|
|
|
export type CheckContext =
|
|
| { __typename: 'CheckRun'; name: string; status: string; conclusion: string | null; detailsUrl: string | null; startedAt: string | null }
|
|
| { __typename: 'StatusContext'; context: string; state: string; targetUrl: string | null };
|
|
|
|
export interface DetailComment {
|
|
id: string;
|
|
author: { login: string } | null;
|
|
bodyText: string;
|
|
createdAt: string;
|
|
updatedAt: string;
|
|
url: string;
|
|
}
|
|
|
|
export interface DetailPr {
|
|
id: string;
|
|
commits: {
|
|
nodes: {
|
|
commit: {
|
|
oid: string;
|
|
statusCheckRollup: { state: string; contexts: { nodes: CheckContext[] } } | null;
|
|
};
|
|
}[];
|
|
};
|
|
comments: { nodes: DetailComment[] };
|
|
reviews: {
|
|
nodes: {
|
|
id: string;
|
|
author: { login: string } | null;
|
|
state: string;
|
|
bodyText: string;
|
|
submittedAt: string | null;
|
|
url: string;
|
|
}[];
|
|
};
|
|
reviewThreads: {
|
|
nodes: { id: string; isResolved: boolean; path: string | null; comments: { nodes: DetailComment[] } }[];
|
|
};
|
|
}
|
|
|
|
export interface DetailResult {
|
|
nodes: (DetailPr | null)[];
|
|
}
|