UNPKG

@phren/cli

Version:

Knowledge layer for AI agents - CLI, MCP server, and data layer

46 lines (45 loc) • 2.27 kB
import type { GitHost } from "./git-hosts.js"; /** Tokens for the git hosts the Hook reads over HTTP (GitLab, gitboy). GitHub * goes through gh, which keeps its own sign-in. * * A token comes from, in order: the host's own environment variable, the * Hook's git-hosts.json (machine config like elevenlabs.json: mode 600, never * in the synced store), then the host's CLI where it has one (glab). The Hook * runs as a service that doesn't see shell env, so the file is the durable * source, written by `phren bridge git-host set` or the desktop's Connect. */ export type TokenHostKind = "gitlab" | "gitboy"; export type TokenSource = "environment" | "file" | "cli"; export interface HostToken { token: string; source: TokenSource; user?: string; agent?: true; } export declare function gitHostsFile(): string; /** Store (or, with an empty token, forget) one domain's token. */ export declare function writeHostToken(domain: string, kind: TokenHostKind, token: string, user?: string, file?: string, agent?: boolean): Promise<void>; export interface TokenLookup { env?: NodeJS.ProcessEnv; file?: string; cli?: boolean; } export declare function resolveHostToken(kind: TokenHostKind, domain: string, options?: TokenLookup): Promise<HostToken | undefined>; /** * The gitboy agent token for a domain: only a token `phren bridge git-host set` * marked `agent: true` and that carries the `gba_` prefix. Keyed dispatches * use this and nothing else. */ export declare function resolveAgentToken(domain: string, file?: string): Promise<HostToken | undefined>; /** Each stored domain with its kind and who it signs in as. Never a token. */ export declare function listHostTokens(file?: string): Promise<{ domain: string; kind: TokenHostKind; user?: string; savedAt?: string; agent?: true; }[] | "unsafe">; /** Credential fingerprint only: raw credentials never enter lookup keys. * gh logout/switch-user rewrites hosts.yml even when its token is in a keychain. */ /** The lines of gh's hosts.yml under one host key (its user, protocol and any plain token). */ export declare function ghHostBlock(hostsYml: string, domain: string): string; export declare function hostCredentialIdentity(host: GitHost): Promise<string>;