MCPcopy Create free account
hub / github.com/ReviewStage/stage-cli / getGitHubViewer

Function getGitHubViewer

packages/cli/src/github/viewer.ts:19–32  ·  view source on GitHub ↗
(repoRoot: string)

Source from the content-addressed store, hash-verified

17 * callers fall back to a local identity.
18 */
19export async function getGitHubViewer(repoRoot: string): Promise<GitHubViewer | null> {
20 try {
21 const stdout = await gh(["api", "user", "--jq", "{login,avatar_url}"], repoRoot);
22 const parsed = GhViewerSchema.safeParse(JSON.parse(stdout));
23 if (!parsed.success) return null;
24 const { login, avatar_url } = parsed.data;
25 return {
26 login,
27 avatarUrl: avatar_url || `https://github.com/${encodeURIComponent(login)}.png`,
28 };
29 } catch {
30 return null;
31 }
32}

Callers 1

resolveViewerFunction · 0.85

Calls 1

ghFunction · 0.85

Tested by

no test coverage detected