|
1 | 1 | import { |
2 | 2 | CommandId, |
3 | 3 | type OrchestrationProjectShell, |
| 4 | + type PullRequestState, |
4 | 5 | type OrchestrationV2ThreadShell, |
5 | 6 | type ThreadId, |
6 | 7 | type ThreadPullRequestLink, |
@@ -85,9 +86,11 @@ function pullRequestListPosition(link: ThreadPullRequestLink): string { |
85 | 86 | export function listThreadPullRequests( |
86 | 87 | thread: Pick<OrchestrationV2ThreadShell, "pullRequests">, |
87 | 88 | cursor?: string, |
| 89 | + states?: ReadonlyArray<PullRequestState>, |
88 | 90 | ): ListThreadPullRequestsResult { |
89 | 91 | const chains = resolveThreadPullRequestChains(thread.pullRequests ?? []); |
90 | 92 | const after = visibleThreadPullRequests(thread.pullRequests ?? []) |
| 93 | + .filter((link) => states === undefined || states.includes(link.snapshot?.state ?? "open")) |
91 | 94 | .map((link) => ({ link, position: pullRequestListPosition(link) })) |
92 | 95 | .filter(({ position }) => cursor === undefined || position > cursor) |
93 | 96 | .toSorted((left, right) => (left.position < right.position ? -1 : 1)); |
@@ -426,7 +429,7 @@ const make = Effect.gen(function* () { |
426 | 429 | ), |
427 | 430 | list_thread_pull_requests: McpToolAccess.reads((input) => |
428 | 431 | requireThread(PullRequestListFailedError, input.threadId).pipe( |
429 | | - Effect.map((thread) => listThreadPullRequests(thread, input.cursor)), |
| 432 | + Effect.map((thread) => listThreadPullRequests(thread, input.cursor, input.states)), |
430 | 433 | ), |
431 | 434 | ), |
432 | 435 | watch_pull_request: writesThread((input) => setWatching(input, true)), |
|
0 commit comments