/** * Per-cluster representative artifact bundles. * * `failure-artifacts.ts` writes one bundle per failing page, which is the * right granularity for reproducing a specific failure but the wrong one * for issue-writing: a cluster with 30 pages produces 30 directories the * triager has to skim. The cluster bundle picks ONE representative page * per cluster and copies its evidence (HTML, trace, repro.sh) into * `/clusters//`, alongside a `errors.json` filtered to * the cluster's own errors and an `info.json` with cluster metadata. * * Designed to run post-hoc against an already-written failure-artifacts * directory: takes the final report + the directory and produces the * cluster bundles without needing the crawler in the loop. That makes * the operation re-runnable and re-targetable (different output dirs, * different filtering) from a saved report. */ import type { CrawlReport } from "./types.js"; /** Files copied verbatim from the representative page bundle. */ declare const COPYABLE_FILES: readonly ["page.html", "trace.jsonl", "repro.sh", "screenshot.png"]; type CopyableFile = (typeof COPYABLE_FILES)[number]; export interface WriteClusterArtifactsOptions { /** Directory where per-page failure bundles live (i.e. failureArtifacts.dir). */ bundleDir: string; /** * Output directory for cluster bundles. Defaults to `/clusters`. * Keeping the default under bundleDir means the existing artefact upload * step in CI picks up both per-page and per-cluster bundles for free. */ outputDir?: string; /** Maximum cluster bundles to emit. Defaults to all clusters. */ maxClusters?: number; /** * Skip clusters whose count is below this threshold. Defaults to 1 * (no filtering). Useful when triaging a noisy run — `--min-count 5` * surfaces only the recurring failures. */ minCount?: number; } export interface ClusterArtifactResult { clusterKey: string; /** Directory written, relative to outputDir. */ bundlePath: string; /** Page URL chosen as representative (cluster.urls[0]). */ representativeUrl: string | null; /** True when an existing per-page bundle was found and copied from. */ representativeBundleFound: boolean; /** Files actually copied (subset of COPYABLE_FILES). */ copiedFiles: CopyableFile[]; } /** * Write one cluster bundle per cluster in the report. Returns metadata * about each emitted bundle so the caller can log / surface counts. */ export declare function writeClusterArtifacts(report: CrawlReport, options: WriteClusterArtifactsOptions): ClusterArtifactResult[]; export {}; //# sourceMappingURL=cluster-artifacts.d.ts.map