MCPcopy Create free account
hub / github.com/anomalyco/opencode-bench / fetchComparisonDiff

Function fetchComparisonDiff

src/util/github.ts:18–47  ·  view source on GitHub ↗
(
  owner: string,
  repo: string,
  from: string,
  to: string,
)

Source from the content-addressed store, hash-verified

16}
17
18export async function fetchComparisonDiff(
19 owner: string,
20 repo: string,
21 from: string,
22 to: string,
23) {
24 const client = getRequestClient();
25
26 const response = await client(
27 "GET /repos/{owner}/{repo}/compare/{base}...{head}",
28 {
29 owner,
30 repo,
31 base: from,
32 head: to,
33 headers: {
34 accept: DIFF_ACCEPT_HEADER,
35 },
36 },
37 );
38
39 const diff = String(response.data);
40
41 if (diff.trim().length === 0)
42 throw new Error(
43 `GitHub comparison diff for ${owner}/${repo} between ${from} and ${to} was empty.`,
44 );
45
46 return diff;
47}
48
49export interface CommitDiff {
50 sha: string;

Callers 1

generateFunction · 0.85

Calls 1

getRequestClientFunction · 0.85

Tested by

no test coverage detected