/** * `resolveCockpitIdentity` — resolve the GitHub identity used by cockpit * subcommands (queue, advance), mirroring `packages/orchestrator/src/services/ * identity.ts` precedence so App-credentialed clusters don't 403 on `gh api user`. * * Precedence (first non-null / non-empty / non-throwing tier wins): * 1a. `flag` — `--assignee ` CLI flag * 1b. `configAssignee` — `cockpit.assignee` in `.generacy/config.yaml` * 2a. `env.CLUSTER_GITHUB_USERNAME` — cluster-wide env * 2b. `env.GH_USERNAME` — cluster-wide env (wizard-delivered) * 3. `gh.getCurrentUser()` — `gh api user` * * Two modes: * - `required` — throws `LoudIdentityError` naming all four knobs on all-miss. * - `optional` — logs a warning naming all four knobs and returns * `{ login: undefined, source: 'none' }`. */ import type { GhWrapper } from '@generacy-ai/cockpit'; export type IdentitySource = 'flag' | 'config' | 'CLUSTER_GITHUB_USERNAME' | 'GH_USERNAME' | 'gh-api' | 'none'; export interface ResolveCockpitIdentityInput { flag?: string; configAssignee?: string; gh: Pick; logger: { warn(msg: string): void; info?(msg: string): void; }; verb: string; mode: 'required' | 'optional'; env?: NodeJS.ProcessEnv; } export type ResolveCockpitIdentityResult = { login: string; source: Exclude; } | { login: undefined; source: 'none'; }; export declare class LoudIdentityError extends Error { readonly code: "IDENTITY_UNRESOLVED"; readonly verb: string; constructor(verb: string, message: string); } export declare function resolveCockpitIdentity(input: ResolveCockpitIdentityInput & { mode: 'required'; }): Promise<{ login: string; source: Exclude; }>; export declare function resolveCockpitIdentity(input: ResolveCockpitIdentityInput & { mode: 'optional'; }): Promise; export declare function resolveCockpitIdentity(input: ResolveCockpitIdentityInput): Promise; //# sourceMappingURL=identity.d.ts.map