import { Command } from "commander";
import { MeshCliError } from "../utils/errors.js";
import type { RegistryTokenState } from "../utils/auth-preflight.js";
import { type RegistryBrokerFailure, type RegistryGrant } from "../utils/registry-broker.js";
import { readRegistrySession } from "../utils/registry-identity.js";
export declare function codeartifactLogin(env?: Record<string, string>): boolean;
export declare function resolvePublisherRoleArn({ roleArnFlag, ssmArn, }: {
    roleArnFlag?: string;
    ssmArn?: string;
}): string;
export declare function resolveCredentials(context?: string, roleArn?: string): Record<string, string>;
export declare function applyGrantToUserNpmrc(grant: RegistryGrant, npmrcPath?: string): {
    path: string;
};
export declare function describeBrokerFailure(failure: RegistryBrokerFailure): {
    message: string;
    hint?: string;
    fatal: boolean;
};
export declare class RegistryNotAuthorizedError extends MeshCliError {
    constructor(message: string);
}
export declare function registrySignInAllowed(opts: Pick<RegistryLoginOptions, "device">, hasTty?: boolean): boolean;
export declare function shouldRemintAfter(failure: RegistryBrokerFailure): boolean;
export declare const NOT_AUTHORIZED_RERUN = "Once granted, run: mesh registry login   (it re-mints your sign-in; still refused? mesh registry logout && mesh registry login)";
export declare const CONTEXT_IGNORED_NOTICE = "The registry is global \u2014 the context argument is no longer needed (ignored).";
export type BrokerOutcome = {
    kind: "skipped-profile";
    profile: string;
} | {
    kind: "skipped-flag";
    flag: string;
} | {
    kind: "unavailable";
    detail: string;
} | {
    kind: "no-session";
    detail: string;
};
export declare function shouldRepairUserNpmrc(opts: Pick<RegistryLoginOptions, "ci">): boolean;
export declare function repairUnscopedRegistry(npmrcPath?: string): {
    removed: string | null;
    backupPath?: string;
    error?: string;
};
export interface RegistryTokenCheck {
    valid: boolean;
    state: RegistryTokenState;
    endpoint?: string;
    reason?: string;
    hijackLine?: string;
}
export declare function renderRegistrySessionLine(session: {
    email: string;
    expiresAt: string;
} | null, now?: number): string;
export declare function checkExistingToken(): Promise<RegistryTokenCheck>;
export declare function runRegistryStatus(opts?: {
    check?: () => Promise<RegistryTokenCheck>;
    session?: ReturnType<typeof readRegistrySession>;
}): Promise<number>;
export interface RegistryLoginOptions {
    role?: string;
    ci?: boolean;
    skipNpmrc?: boolean;
    profile?: string;
    publish?: boolean;
    broker?: boolean;
    device?: boolean;
}
export declare function runRegistryLogin(context: string | undefined, opts: RegistryLoginOptions): Promise<void>;
export declare function describeAwsChainFailure(outcome: BrokerOutcome): string;
export declare function registerRegistryCommands(program: Command): void;
