perf-lens
Version:
AI-powered frontend performance optimizer
54 lines • 1.85 kB
TypeScript
import { z } from 'zod';
/**
* A single performance finding. Shared by the batch scan and the agent mode —
* both produce findings in this exact shape via structured outputs.
*/
export declare const FindingSchema: z.ZodObject<{
file: z.ZodString;
startLine: z.ZodNumber;
endLine: z.ZodNumber;
severity: z.ZodEnum<{
critical: "critical";
warning: "warning";
suggestion: "suggestion";
}>;
title: z.ZodString;
description: z.ZodString;
impact: z.ZodString;
solution: z.ZodString;
codeExample: z.ZodOptional<z.ZodString>;
}, z.core.$strip>;
export declare const FindingsSchema: z.ZodObject<{
findings: z.ZodArray<z.ZodObject<{
file: z.ZodString;
startLine: z.ZodNumber;
endLine: z.ZodNumber;
severity: z.ZodEnum<{
critical: "critical";
warning: "warning";
suggestion: "suggestion";
}>;
title: z.ZodString;
description: z.ZodString;
impact: z.ZodString;
solution: z.ZodString;
codeExample: z.ZodOptional<z.ZodString>;
}, z.core.$strip>>;
}, z.core.$strip>;
export type Finding = z.infer<typeof FindingSchema>;
/**
* Drops findings that reference files outside the analyzed set or line ranges
* that don't exist. The schema guarantees shape; this guards against hallucinated
* locations.
* @param findings - Findings returned by the model
* @param fileLineCounts - Map of relative file path -> number of lines
*/
export declare function validateFindings(findings: Finding[], fileLineCounts: Record<string, number>): {
valid: Finding[];
dropped: Finding[];
};
/**
* Renders a finding as the markdown block shape the report layer expects.
*/
export declare function findingToMarkdown(finding: Finding): string;
//# sourceMappingURL=schema.d.ts.map