import { createPromptCommandOutput } from "#setup/cli/index.js"; import { type VercelCaptureFailure } from "#setup/primitives/index.js"; import { z } from "zod"; import type { ProjectResolution } from "./project-resolution.js"; import type { Prompter } from "./prompter.js"; import type { ResolvedVercelProjectSpec } from "./state.js"; declare const VercelTeamListEntrySchema: z.ZodObject<{ name: z.ZodString; slug: z.ZodString; current: z.ZodBoolean; }, z.core.$strip>; type VercelTeamListEntry = z.infer; declare const VercelProjectListEntrySchema: z.ZodObject<{ name: z.ZodString; id: z.ZodString; }, z.core.$strip>; type VercelProjectListEntry = z.infer; declare const VercelProjectReferenceSchema: z.ZodObject<{ id: z.ZodString; name: z.ZodString; }, z.core.$strip>; type VercelProjectReference = z.infer; export interface VercelProjectOperationOptions { signal?: AbortSignal; } export interface PickProjectOptions extends VercelProjectOperationOptions { /** Whether an empty project list may fall back to entering a name to create. */ allowCreateWhenEmpty?: boolean; } export declare function unresolvedProject(): ProjectResolution; /** * Runs a network reach behind a section-like spinner so the user sees the CLI * is working, not hung. The spinner clears whether the work resolves or throws, * and degrades to nothing when the prompter has no spinner (headless/test). */ export declare function withNetworkSpinner(prompter: Prompter, message: string, task: () => Promise): Promise; /** Resolves the linked project id from a resolution, if any. */ export declare function projectIdFromResolution(project: ProjectResolution): string | undefined; /** Lists the Vercel scopes available to the current CLI user. */ export declare function listTeams(projectRoot: string, options?: VercelProjectOperationOptions): Promise; /** Lists Vercel projects available under an explicit team or personal scope. */ export declare function listProjects(projectRoot: string, team: string, options?: VercelProjectOperationOptions): Promise; /** Resolves one project by exact name or id through the Vercel API. */ export declare function resolveProjectByNameOrId(projectRoot: string, team: string, projectNameOrId: string, options?: VercelProjectOperationOptions): Promise; export declare function assertNewProjectNameAvailable(projectRoot: string, team: string, projectName: string, options?: VercelProjectOperationOptions): Promise; /** * Throws the login action. When the underlying `vercel whoami` failure is * known, its diagnostic is folded into the reason: without it the agent only * ever hears "log in", even when the real fault is a missing CLI or a transient * API error and the user is already authenticated. */ export declare function requireVercelLogin(failure?: VercelCaptureFailure): never; /** * Throws the right outcome for a failed `vercel whoami`. ENOENT means the * binary isn't installed (its own action, not a login that would fail * identically); the explicit not-authenticated diagnostic is a login action; * anything else is a transient fault surfaced as a plain error, so the caller * reports "try again" rather than mislabeling it "log in". */ export declare function requireVercelAuth(failure: VercelCaptureFailure): never; /** * The Vercel auth state, read-only. `cli-missing` (ENOENT) and `unavailable` (a * transient network/API fault) are each kept distinct from `logged-out` so a * caller never tells the user to log in when the real cause is a missing CLI or * an unreachable network. `logged-out` is claimed only from the explicit * not-authenticated diagnostic. */ export type VercelAuthStatus = "authenticated" | "logged-out" | "cli-missing" | "unavailable"; export declare function getVercelAuthStatus(projectRoot: string, options?: VercelProjectOperationOptions): Promise; /** * Throws the re-auth action for a forbidden scope. The session is logged in, * but a scoped command was denied — the SSO/SAML or non-membership case. The * remedy is still `vercel login` (it completes the team's SSO and refreshes the * token), so the dev TUI routes it to `/login`; the reason names the membership * fallback for the case re-auth cannot fix. */ export declare function requireVercelTeamAccess(failure: VercelCaptureFailure): never; /** * Ensures Vercel authentication before any provisioning. `vercel whoami` exits * non-zero when not logged in; any other failure (a missing CLI, a transient * API error) is surfaced verbatim rather than mislabeled as a login problem. */ export declare function requireAuth(projectRoot: string, prompter?: Prompter, options?: VercelProjectOperationOptions): Promise; /** * Non-throwing auth probe: whether the Vercel CLI has a logged-in user. Used * where authentication changes a decision (e.g. adopting an existing link) * rather than being a precondition to enforce. */ export declare function isVercelAuthenticated(projectRoot: string, options?: VercelProjectOperationOptions): Promise; /** * Resolves a passed team slug, or the current scope when unset, to a concrete * slug so every provisioning command can pass an explicit `--scope`. */ export declare function resolveTeam(projectRoot: string, team: string | undefined, options?: VercelProjectOperationOptions): Promise; /** * Validates a passed team slug against the account's teams, failing fast. * * When the slug is provided and the account's teams are listable, an unknown * slug throws so the run stops before any project mutation. When Vercel returns * an empty list, validation does not block and the later scoped command * surfaces any real scope error itself. * * `prompter` is accepted so callers can pass it uniformly across the team * resolution helpers; it is unused now that an invalid slug throws. */ export declare function validateTeam(prompter: Prompter, projectRoot: string, team: string | undefined, options?: VercelProjectOperationOptions): Promise; /** * Picks the Vercel team (scope). A passed slug is validated and resolved; with * zero or one team the current scope is used without prompting; otherwise the * user filters and chooses from the list with a single-selection picker. */ export declare function pickTeam(prompter: Prompter, projectRoot: string, presetTeam: string | undefined, options?: VercelProjectOperationOptions): Promise; /** * A picked Vercel project. `exists` distinguishes a project the user selected * from the existing list (link it) from a name they typed because none exist * yet (create it), so the caller can build the right `new` vs `existing` plan. */ export interface ArgsPickedProject { /** Project slug: an existing project's name, or a name to create. */ project: string; /** True for a selected existing project; false for a typed-in name to create. */ exists: boolean; } /** Picks an existing project under a team, or a name to create when none exist. */ export declare function pickProject(prompter: Prompter, projectRoot: string, team: string, options?: PickProjectOptions): Promise; /** Returns a project name for a new Vercel project, prompting when the default exists. */ export declare function pickNewProjectName(prompter: Prompter, projectRoot: string, team: string, defaultProjectName: string, options?: VercelProjectOperationOptions): Promise; /** * Ensures the concrete project exists (creating it for a `new` plan) and links * this directory to it. Pure executor: it acts on a fully-resolved spec and * never prompts for a team or project. Returns whether the link succeeded. */ export declare function linkProject(prompter: Prompter, projectRoot: string, spec: ResolvedVercelProjectSpec, onOutput: ReturnType, options?: VercelProjectOperationOptions): Promise; export {};