UNPKG

@capgo/cli

Version:
59 lines (58 loc) 2.63 kB
import type { OutcomeOptions, PrescanReport, Severity } from './types'; export interface PrescanCommandOptions { platform?: string; path?: string; apikey?: string; androidFlavor?: string; iosDist?: 'app_store' | 'ad_hoc'; json?: boolean; failOnWarnings?: boolean; ignoreFatal?: boolean; verbose?: boolean; supaHost?: string; supaAnon?: string; /** * pre-merged credentials (CLI flags + env + saved file) when invoked from * build request's gate — the scan must validate the exact set the build * will use, not a fresh saved-file/env merge. */ credentials?: Record<string, string>; } export declare function validateFlags(opts: Pick<PrescanCommandOptions, 'failOnWarnings' | 'ignoreFatal'>): void; export declare function exitCodeFor(counts: Record<Severity, number>, opts: OutcomeOptions): number; export interface PrescanExecution { report: PrescanReport; /** apikey actually used for the scan (flag or saved key); undefined when remote checks were skipped */ apikey?: string; } /** Shared scan runner used by both the standalone command and build request's gate. */ export declare function executePrescan(appId: string | undefined, options: PrescanCommandOptions): Promise<PrescanExecution>; export declare function prescanCommand(appId: string | undefined, options: PrescanCommandOptions): Promise<void>; export interface PrescanGateOptions { enabled: boolean; ignoreFatal?: boolean; failOnWarnings?: boolean; /** test seam; defaults to canPromptInteractively() (via resolveWarningGate) at call time */ interactive?: boolean; silent?: boolean; /** * Output sink for the report / crash notice. Callers that own the terminal * (Ink onboarding, SDK, MCP stdio) pass their BuildLogger here; raw clack * writes would corrupt their rendering or the JSON-RPC stdout channel. * Defaults to clack when not silent, and to no output when silent. */ print?: (msg: string) => void; warn?: (msg: string) => void; } export interface PrescanGateResult { decision: 'proceed' | 'block'; /** null when the gate was disabled or the scan crashed (no scan ran) */ report: PrescanReport | null; crashed: boolean; } /** * Used by build request. Runs the scan via the provided thunk, prints the report, * and resolves to 'proceed' | 'block'. NEVER throws: a crashing scanner proceeds with a notice * (the scanner must never be worse than no scanner). */ export declare function runPrescanGate(opts: PrescanGateOptions, scan: () => Promise<PrescanReport>): Promise<PrescanGateResult>;