@vigilbase/cli
Version:
Vigilbase CLI — security scanners, agent tools, and Vigilbase One from the terminal.
48 lines (47 loc) • 2.22 kB
TypeScript
/**
* Collecting a Cloudflare account through cf (spec §F5, §D3).
*
* Every read goes through the frozen allowlist and the shared scheduler (four
* workers, the request budget, auth pauses and retries). Each response is
* projected immediately by the vendored contract and the raw text discarded.
* Lists are paged with `--page N` until an empty page, because cf strips
* `result_info`: a final page and a server-clamped page look the same.
*/
import { type CollectedEntry, type CloudflareCheckupSnapshotV1, type SnapshotCollector, type ZoneData } from './contract.js';
import { type ProfileArgs } from './cf/allowlist.js';
import { type CfScheduler } from './cf/auth-lifecycle.js';
export declare const WORKER_COUNT = 4;
export type CollectEnv = {
scheduler: CfScheduler;
auth: ProfileArgs;
/** Template IDs, or `zone_setting:<id>`, whose dry-run mapping did not match. */
unavailable: ReadonlySet<string>;
concurrency?: number;
onProgress?: (progress: CollectProgress) => void;
};
export type CollectProgress = {
zonesDone: number;
zonesTotal: number;
requests: number;
};
export type AccountSummary = {
id: string;
name: string;
};
/** `accounts list --per-page 50 --page N` until an empty page. */
export declare function listAccounts(env: CollectEnv): Promise<AccountSummary[]>;
/** Requests for N zones: about 19 + extra pages + N × (33 + rulesets per zone). */
export declare function estimateRequests(zoneCount: number, rulesetsPerZone?: number): number;
/**
* Collect every snapshot entry for one account. Aborts (no file) when the
* account read fails other than 400/403/404, when the zone list fails, when it
* holds more than 100 zones, or when the account is invisible and has no zones.
*/
export declare function collectAccount(env: CollectEnv, accountId: string, hooks?: {
onZones?: (zones: readonly ZoneData[]) => void;
}): Promise<CollectedEntry[]>;
/** Assemble, validate and serialise; the returned text is exactly what is written and uploaded. */
export declare function buildSnapshot(accountId: string, collector: SnapshotCollector, entries: readonly CollectedEntry[]): {
snapshot: CloudflareCheckupSnapshotV1;
text: string;
};