@vigilbase/cli
Version:
Vigilbase CLI — security scanners, agent tools, and Vigilbase One from the terminal.
78 lines (77 loc) • 4.17 kB
TypeScript
export type CliConfig = {
/** Public tools API origin (vigilbase.com / apps/com). */
publicBaseUrl: string;
/** Authenticated Vigilbase One origin (one.vigilbase.com / apps/one). */
oneBaseUrl: string;
/** OAuth client_id for Better Auth device authorization. */
clientId: string;
/** Explicit Identity issuer (--auth-url / VIGILBASE_AUTH_URL). One's discovery must name it; unset, only production Identity is trusted. */
identityBaseUrl?: string;
authProvider?: import('../auth/provider.js').AuthProvider;
/**
* Directory for credentials and local config (~/.config/vigilbase). Not validated when the config is built:
* the credential store rejects a relative path itself, so commands that never use it work whatever it holds.
*/
configDir: string;
userAgent: string;
timeoutMs: number;
};
/** @deprecated Prefer `publicBaseUrl`. Kept for library callers. */
export type CliConfigLegacy = CliConfig & {
baseUrl: string;
};
export declare function parseOrigin(raw: string, option: string): string;
/** Default request timeout; also used when library callers omit `timeoutMs`. */
export declare const DEFAULT_TIMEOUT_MS = 60000;
/** localhost, 127.0.0.0/8 or [::1]: the hosts every origin option accepts for local development. */
export declare function isLoopbackHostname(hostname: string): boolean;
export declare function resolvePublicBaseUrl(explicit?: string | null): string;
export declare function resolveOneBaseUrl(explicit?: string | null): string;
/** Validate at transport boundaries too: library callers may construct config objects. */
export declare function validateOneOrigin(raw: string): string;
/** Production Identity: the only issuer trusted unless --auth-url / VIGILBASE_AUTH_URL names another. */
export declare const DEFAULT_IDENTITY_ISSUER = "https://auth.vigilbase.com";
/** Internal: accepted when named explicitly, but not offered to users (it isn't deployed publicly). */
export declare const STAGING_IDENTITY_ISSUER = "https://identity-staging.vigilbase.com";
export declare function resolveIdentityBaseUrl(raw: string): string;
/**
* The one Identity issuer this configuration trusts: --auth-url / VIGILBASE_AUTH_URL
* when set, otherwise production. Staging is trusted only when configured explicitly.
* Validated here too because library callers may construct config objects.
*/
export declare function trustedIdentityIssuer(config: Pick<CliConfig, 'oneBaseUrl' | 'identityBaseUrl'>): string;
export declare function resolveClientId(explicit?: string | null): string;
/** Why a config directory that isn't absolute was refused, naming the variable it came from. */
export declare function relativeConfigDirProblem(configDir: string, env?: NodeJS.ProcessEnv): {
reason: string;
remedy: string;
};
/** The config directory, which must be absolute. */
export declare function resolveConfigDir(explicit?: string | null, env?: NodeJS.ProcessEnv): string;
export declare function createConfig(options?: {
baseUrl?: string | null;
publicBaseUrl?: string | null;
oneBaseUrl?: string | null;
clientId?: string | null;
identityBaseUrl?: string | null;
configDir?: string | null;
timeoutMs?: number;
/**
* Which origins to validate now; both by default. The CLI leaves out those a command never contacts, so a bad
* value for them cannot fail it. Every One and Identity transport validates its origin again at use.
*/
checkOrigins?: {
public: boolean;
one: boolean;
};
}): CliConfigLegacy;
/**
* Config for `vigilbase local …` and `vigilbase cloudflare-checkup`. Local
* checkups resolve their own submit origin (resolveSubmitOrigin) and never
* read VIGILBASE_* URLs. They resolve the config directory themselves, and
* only when they need it (the managed cf install, the default snapshot path),
* so malformed values cannot block offline commands such as `inspect`.
*/
export declare function createLocalCommandConfig(timeoutMs?: number): CliConfigLegacy;
/** Back-compat helper used by older call sites / tests. */
export declare function resolveBaseUrl(explicit?: string | null): string;