MCPcopy Create free account
hub / github.com/backnotprop/plannotator / fetchGhPRList

Function fetchGhPRList

packages/shared/pr-github.ts:803–835  ·  view source on GitHub ↗
(
  runtime: PRRuntime,
  ref: GhPRRef,
)

Source from the content-addressed store, hash-verified

801// --- PR List ---
802
803export async function fetchGhPRList(
804 runtime: PRRuntime,
805 ref: GhPRRef,
806): Promise<PRListItem[]> {
807 const result = await runtime.runCommand("gh", [
808 "pr", "list",
809 "--repo", repoFlag(ref),
810 "--json", "number,title,author,url,baseRefName,state",
811 "--limit", "30",
812 "--state", "all",
813 ]);
814
815 if (result.exitCode !== 0) return [];
816
817 const raw = JSON.parse(result.stdout) as Array<{
818 number: number;
819 title: string;
820 author: { login: string };
821 url: string;
822 baseRefName: string;
823 state: string;
824 }>;
825
826 return raw.map((pr) => ({
827 id: String(pr.number),
828 number: pr.number,
829 title: pr.title,
830 author: pr.author.login,
831 url: pr.url,
832 baseBranch: pr.baseRefName,
833 state: (pr.state === "OPEN" ? "open" : pr.state === "MERGED" ? "merged" : "closed") as PRListItem["state"],
834 }));
835}

Callers 1

fetchPRListFunction · 0.90

Calls 2

repoFlagFunction · 0.85
parseMethod · 0.80

Tested by

no test coverage detected