@invisiblecities/sidequest-cqo
Version:
Configuration-agnostic TypeScript and ESLint orchestrator with real-time watch mode, SQLite persistence, and intelligent terminal detection
70 lines • 2.67 kB
TypeScript
/**
* @fileoverview Base audit engine abstract class
*
* Provides the common interface and utilities that all audit engines must implement.
* Handles error recovery, timing, and standardized result formatting.
*/
import type { Violation, EngineResult, EngineConfig, ViolationSource, ViolationCategory, ViolationSeverity } from "../utils/violation-types.js";
/**
* Abstract base class for all audit engines
*
* Each engine is responsible for:
* - Analyzing code for specific types of violations
* - Handling errors gracefully without breaking the orchestrator
* - Providing consistent violation format
* - Implementing timeout and cancellation support
*/
export declare abstract class BaseAuditEngine {
protected readonly engineName: string;
protected readonly source: ViolationSource;
protected config: EngineConfig;
protected abortController: AbortController | undefined;
constructor(engineName: string, source: ViolationSource, config: EngineConfig);
/**
* Execute the audit engine analysis
*
* @param targetPath - Directory or file to analyze
* @param options - Engine-specific options
* @returns Promise resolving to engine results
*/
execute(targetPath: string, options?: Record<string, unknown>): Promise<EngineResult>;
/**
* Check if the engine can be aborted
*/
get canAbort(): boolean;
/**
* Abort the current analysis
*/
abort(): void;
/**
* Abstract method that each engine must implement
* Contains the actual analysis logic
*
* @param targetPath - Path to analyze
* @param options - Engine-specific options
* @returns Array of violations found
*/
protected abstract analyze(_targetPath: string, _options: Record<string, unknown>): Promise<Violation[]>;
/**
* Helper method to create standardized violations
*/
protected createViolation(file: string, line: number, code: string, category: ViolationCategory, severity: ViolationSeverity, rule?: string, message?: string, column?: number): Violation;
/**
* Optional method for engines to provide fix suggestions
* Override in subclasses to provide engine-specific suggestions
*/
protected generateFixSuggestion?(_category: ViolationCategory, _rule?: string, _code?: string): string | undefined;
/**
* Update engine configuration
*/
updateConfig(newConfig: Partial<EngineConfig>): void;
/**
* Get current engine configuration
*/
getConfig(): EngineConfig;
/**
* Get engine metadata
*/
getMetadata(): Record<string, unknown>;
}
//# sourceMappingURL=base-engine.d.ts.map