/** * @fileoverview Core finding and result types for fitness checks * * CheckResult carries Signal[]. Factory functions * (createResultWithSignals, createErrorResult) provide * the standard way to construct check results. */ import type { DirectiveEntry } from '../framework/directive-inventory.js'; import type { Signal } from '@opensip-cli/core'; /** * Severity level for findings and violations. */ export type FindingSeverity = 'error' | 'warning'; /** * Alias for FindingSeverity — used by simplified check.ts types. */ export type Severity = FindingSeverity; /** * A single finding from a fitness check (output format). */ export interface Finding { readonly message: string; readonly severity: Severity; readonly filePath?: string; readonly line?: number; readonly column?: number; readonly suggestion?: string; readonly metadata?: Record; } /** * Output from a tool-based check. */ export interface ToolOutput { readonly stdout: string; readonly stderr: string; readonly exitCode: number; } /** * Check info for display. */ export interface CheckInfo { /** Summary label (e.g., "142/150 files compliant") */ readonly label: string; } /** * Metadata about a check run. */ export interface CheckResultMetadata { /** Total items scanned */ readonly totalItems: number; /** Signals (same reference as top-level) */ readonly signals: readonly Signal[]; /** Duration in milliseconds */ readonly durationMs?: number; /** Number of files scanned from filesystem */ readonly filesScanned?: number; /** Item type (e.g., 'files', 'modules') */ readonly itemType?: string; /** Extra metadata */ readonly extra?: Record; } /** * Result of running a fitness check. * Now carries universal Signal[] instead of domain-specific violations. */ export interface CheckResult { /** Whether the check passed (no errors) */ readonly passed: boolean; /** Number of error-level signals */ readonly errors: number; /** Number of warning-level signals */ readonly warnings: number; /** All signals */ readonly signals: readonly Signal[]; /** Display info */ readonly info: CheckInfo; /** Run metadata */ readonly metadata: CheckResultMetadata; /** Count of violations ignored via directives */ readonly ignoredCount?: number; /** Directives that actually suppressed signals during this check's execution */ readonly appliedDirectives?: readonly DirectiveEntry[]; } /** * Item types for check info display. */ export type ItemType = 'files' | 'modules' | 'packages' | 'functions' | 'classes' | 'components' | 'tests' | 'endpoints' | 'dependencies' | 'issues' | 'violations' | 'rules' | 'recipes' | 'checks'; /** * Get a human-readable label for an item type. */ export declare function getItemTypeLabel(type: ItemType, count: number): string; /** * Factory for creating CheckInfo objects. */ export declare const CheckInfoFactory: Readonly<{ compliance(compliantItems: number, totalItems: number, unit: string): CheckInfo; violations(count: number, unit: string): CheckInfo; }>; /** * Create a result with signals. */ export declare function createResultWithSignals(info: CheckInfo, signals: readonly Signal[], totalItems: number, options?: { ignoredCount?: number; durationMs?: number; filesScanned?: number; itemType?: string; extra?: Record; }): CheckResult; /** * Create an error result (for check failures). */ export declare function createErrorResult(message: string, error?: Error): CheckResult; //# sourceMappingURL=findings.d.ts.map