UNPKG

@kya-os/cli

Version:

CLI for MCP-I setup and management

49 lines 2.1 kB
/** * Thin wrapper around the GitHub CLI (`gh`). We deliberately shell out to gh * instead of handling OAuth tokens ourselves: the user's existing gh auth is * the credential, and it never passes through this process beyond gh's own * environment. */ export declare const SIGNING_KEY_SCOPE = "admin:ssh_signing_key"; export declare const SCOPE_REFRESH_COMMAND = "gh auth refresh -h github.com -s admin:ssh_signing_key"; export declare class GhNotInstalledError extends Error { constructor(); } /** * The default gh token does not include the admin:ssh_signing_key scope, so * both listing and uploading signing keys fail until the user refreshes. * GitHub reports the missing scope as HTTP 404 on these endpoints. */ export declare class GhScopeError extends Error { readonly refreshCommand = "gh auth refresh -h github.com -s admin:ssh_signing_key"; constructor(); } export interface GhUser { login: string; id: number; name?: string | null; } export interface SigningKeyEntry { id: number; key: string; title: string; } export declare function isGhInstalled(): Promise<boolean>; export declare function isGhAuthenticated(): Promise<boolean>; export declare function getGhUser(): Promise<GhUser>; /** GitHub's commit-attribution noreply address for the authenticated user. */ export declare function githubNoreplyEmail(user: GhUser): string; export declare function listSigningKeys(): Promise<SigningKeyEntry[]>; export declare function uploadSigningKey(publicKeyLine: string, title: string): Promise<void>; /** * Compare the base64 body of an authorized_keys style line against uploaded * keys. GitHub returns keys without comments, so comparing the full line * would always miss. */ export declare function signingKeyAlreadyUploaded(keys: SigningKeyEntry[], publicKeyLine: string): boolean; /** * Run `gh auth refresh` interactively so the user can grant the signing key * scope without leaving the flow. Requires a TTY; the caller must check. */ export declare function refreshAuthScope(): Promise<boolean>; //# sourceMappingURL=github.d.ts.map