import type { Octokit } from '@octokit/rest'; import type { Severity, SeverityThreshold, ConfidenceThreshold, Finding, SkillReport, UsageStats, AuxiliaryUsageMap } from '../types/index.js'; /** * GitHub Check annotation for inline code comments. */ export interface CheckAnnotation { path: string; start_line: number; end_line: number; annotation_level: 'failure' | 'warning' | 'notice'; message: string; title?: string; } /** * Possible conclusions for a GitHub Check run. */ export type CheckConclusion = 'success' | 'failure' | 'neutral' | 'cancelled'; /** * Options for creating/updating checks. */ export interface CheckOptions { owner: string; repo: string; headSha: string; } /** * Options for updating a skill check. */ export interface UpdateSkillCheckOptions extends CheckOptions { failOn?: SeverityThreshold; /** Only include findings at or above this severity level in annotations */ reportOn?: SeverityThreshold; /** Only include findings at or above this confidence level in annotations */ minConfidence?: ConfidenceThreshold; /** Whether to fail the check run when findings exceed failOn. Default: false */ failCheck?: boolean; /** Optional check conclusion override for intentional no-op runs. */ conclusion?: CheckConclusion; /** Optional check output title override. */ title?: string; } /** * Options for creating a completed skill check. */ export interface CreateCompletedSkillCheckOptions extends UpdateSkillCheckOptions { /** Optional check run name override. Defaults to the report skill name. */ checkName?: string; } /** * Summary data for the core warden check. */ export interface CoreCheckSummaryData { /** Optional check output title override. */ title?: string; /** Optional message shown when there are no findings to summarize. */ message?: string; totalSkills: number; totalFindings: number; findingsBySeverity: Record; totalDurationMs?: number; totalUsage?: UsageStats; /** All findings from all skills */ findings: Finding[]; /** Aggregate auxiliary usage from all skills */ totalAuxiliaryUsage?: AuxiliaryUsageMap; skillResults: { name: string; findingCount: number; conclusion: CheckConclusion; durationMs?: number; usage?: UsageStats; auxiliaryUsage?: AuxiliaryUsageMap; }[]; } /** * Result from creating a check run. */ export interface CreateCheckResult { checkRunId: number; url: string; } /** * Map severity levels to GitHub annotation levels. * high -> failure, medium -> warning, low -> notice */ export declare function severityToAnnotationLevel(severity: Severity): CheckAnnotation['annotation_level']; /** * Convert findings to GitHub Check annotations. * Only findings with locations can be converted to annotations. * Returns at most MAX_ANNOTATIONS_PER_REQUEST annotations. * If reportOn is specified, only include findings at or above that severity. */ export declare function findingsToAnnotations(findings: Finding[], reportOn?: SeverityThreshold, minConfidence?: ConfidenceThreshold): CheckAnnotation[]; /** * Determine the check conclusion based on findings and failOn threshold. * - No findings: success * - Findings, none >= failOn: neutral * - Findings >= failOn threshold: failure */ export declare function determineConclusion(findings: Finding[], failOn?: SeverityThreshold, failCheck?: boolean): CheckConclusion; /** * Create a check run for a skill. * The check is created with status: in_progress. */ export declare function createSkillCheck(octokit: Octokit, skillName: string, options: CheckOptions): Promise; /** * Create a completed skill check with results. */ export declare function createCompletedSkillCheck(octokit: Octokit, report: SkillReport, options: CreateCompletedSkillCheckOptions): Promise; /** * Update a skill check with results. * Completes the check with conclusion, summary, and annotations. */ export declare function updateSkillCheck(octokit: Octokit, checkRunId: number, report: SkillReport, options: UpdateSkillCheckOptions): Promise; /** * Mark a skill check as failed due to execution error. */ export declare function failSkillCheck(octokit: Octokit, checkRunId: number, error: unknown, options: CheckOptions): Promise; /** * Create a completed failed skill check without first creating an in-progress check. */ export declare function createFailedSkillCheck(octokit: Octokit, skillName: string, error: unknown, options: CheckOptions): Promise; /** * Create the core warden check run. * The check is created with status: in_progress. */ export declare function createCoreCheck(octokit: Octokit, options: CheckOptions): Promise; /** * Create a completed core warden check with overall summary. */ export declare function createCompletedCoreCheck(octokit: Octokit, summaryData: CoreCheckSummaryData, conclusion: CheckConclusion, options: CheckOptions): Promise; /** * Update the core warden check with overall summary. */ export declare function updateCoreCheck(octokit: Octokit, checkRunId: number, summaryData: CoreCheckSummaryData, conclusion: CheckConclusion, options: Omit): Promise; /** * Aggregate severity counts from multiple reports. */ export declare function aggregateSeverityCounts(reports: SkillReport[]): Record; //# sourceMappingURL=github-checks.d.ts.map