MCPcopy
hub / github.com/cursor/community-plugins / fetchGitHubRepoMeta

Function fetchGitHubRepoMeta

apps/cursor/src/lib/github-plugin/parse.ts:255–285  ·  view source on GitHub ↗
(
  owner: string,
  repo: string,
  opts: FetchOptions = {},
)

Source from the content-addressed store, hash-verified

253}
254
255export async function fetchGitHubRepoMeta(
256 owner: string,
257 repo: string,
258 opts: FetchOptions = {},
259): Promise<GitHubRepoMeta | null> {
260 try {
261 const res = await fetchWithRateLimit(
262 `https://api.github.com/repos/${owner}/${repo}`,
263 {
264 cache: "no-store",
265 headers: {
266 Accept: "application/vnd.github.v3+json",
267 ...githubAuthHeaders(),
268 },
269 maxWaitMs: opts.maxWaitMs,
270 },
271 );
272 if (!res.ok) return null;
273 const data = await res.json();
274 return {
275 id: Number(data.id),
276 stars: Number(data.stargazers_count ?? 0),
277 fork: Boolean(data.fork),
278 archived: Boolean(data.archived),
279 default_branch: String(data.default_branch ?? "HEAD"),
280 license_spdx: data.license?.spdx_id ?? null,
281 };
282 } catch {
283 return null;
284 }
285}
286
287export async function parseGitHubPlugin(
288 url: string,

Callers 3

mainFunction · 0.90
parseGitHubPluginFunction · 0.85

Calls 2

fetchWithRateLimitFunction · 0.85
githubAuthHeadersFunction · 0.85

Tested by

no test coverage detected