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

Function checkGhAuth

packages/shared/pr-github.ts:38–47  ·  view source on GitHub ↗
(runtime: PRRuntime, host: string)

Source from the content-addressed store, hash-verified

36// --- Auth ---
37
38export async function checkGhAuth(runtime: PRRuntime, host: string): Promise<void> {
39 const result = await runtime.runCommand("gh", hostnameArgs(host, ["auth", "status"]));
40 if (result.exitCode !== 0) {
41 const stderr = result.stderr.trim();
42 const hostHint = host !== "github.com" ? ` --hostname ${host}` : "";
43 throw new Error(
44 `GitHub CLI not authenticated. Run \`gh auth login${hostHint}\` first.\n${stderr}`,
45 );
46 }
47}
48
49export async function getGhUser(runtime: PRRuntime, host: string): Promise<string | null> {
50 try {

Callers 1

checkAuthFunction · 0.90

Calls 1

hostnameArgsFunction · 0.85

Tested by

no test coverage detected