UNPKG

@vigilbase/cli

Version:

Vigilbase CLI — security scanners, agent tools, and Vigilbase One from the terminal.

47 lines (46 loc) • 2.88 kB
import { z } from 'zod'; import { type CommandContext } from './helpers.js'; /** A flag or argument the CLI rejected before any request; `--json` reports it as code INVALID_ARGUMENT. */ export declare class InvalidArgumentError extends Error { readonly code = "INVALID_ARGUMENT"; constructor(message: string); } /** * Exactly `count` positional arguments. When some are missing, they are named from the trailing `<placeholders>` * of `usage` (for example `vigilbase run <tool> <target>`), so `usage` lists only positional placeholders. * An empty or whitespace-only argument counts as missing. */ export declare function validateArguments(ctx: CommandContext, count: number, flags?: readonly string[], usage?: string): void; /** "Missing <target>. Usage: vigilbase headers <url>", or a pointer to --help without a usage. */ export declare function missingArguments(command: string, missingCount: number, usage?: string): string; /** 'Unknown security command "x". Run `vigilbase security --help` for usage.' The pointer names the top-level group. */ export declare function unknownSubcommand(group: string, subcommand: string): Error; /** Parses user input with `schema`, throwing `message` instead of Zod's issue list. */ export declare function parseArgument<T>(schema: z.ZodType<T>, value: unknown, message: string): T; /** An integer already checked as digits, within [min, max]. */ export declare function inRange(label: string, value: number, min: number, max: number): number; export declare function oneOf<const T extends readonly string[]>(label: string, values: T, value: string | undefined): T[number] | undefined; /** A trimmed, non-empty flag value of at most `max` characters. */ export declare function textValue(label: string, value: string | undefined, max: number): string | undefined; export declare function isoDateTime(label: string, value: string): string; export declare function limitValue(raw: string | undefined, fallback: number, max: number): number; export declare const invitationSchema: z.ZodObject<{ email: z.ZodString; role: z.ZodDefault<z.ZodEnum<{ readonly: "readonly"; admin: "admin"; member: "member"; partner_owner: "partner_owner"; partner_sales: "partner_sales"; partner_operations: "partner_operations"; partner_finance: "partner_finance"; partner_readonly: "partner_readonly"; billing_only: "billing_only"; sales_only: "sales_only"; }>>; }, z.core.$strip>; export declare function invitationValue(email: string | undefined, role: string | undefined): z.infer<typeof invitationSchema>; export declare const toolNameSchema: z.ZodString; export declare function toolNameValue(value: string): string; /** A scan target: trimmed, 1-2048 characters, no control characters. */ export declare function targetValue(value: string): string;