@invisiblecities/sidequest-cqo
Version:
Configuration-agnostic TypeScript and ESLint orchestrator with real-time watch mode, SQLite persistence, and intelligent terminal detection
135 lines • 4.42 kB
TypeScript
/**
* @fileoverview TypeScript Compilation Engine
*
* Runs the client's TypeScript compiler configuration without imposing opinions.
* Reports compilation errors exactly as TypeScript reports them.
* Respects the client's tsconfig.json and compiler options.
*/
import { BaseAuditEngine } from "./base-engine.js";
import type { Violation, ViolationCategory } from "../utils/violation-types.js";
/**
* Engine for TypeScript compilation validation
*
* Runs `tsc --noEmit` using the client's tsconfig.json without modification.
* Reports TypeScript compiler errors without categorization or opinion.
* Optional: Includes pattern-based checks for unknown/any usage.
*/
export declare class TypeScriptAuditEngine extends BaseAuditEngine {
private readonly baseDir;
constructor(config?: {
enabled?: boolean;
options?: {
includeAny?: boolean;
strict?: boolean;
targetPath?: string;
checkCompilation?: boolean;
enableCustomScripts?: boolean;
customScriptPreset?: string;
};
priority?: number;
timeout?: number;
allowFailure?: boolean;
});
/**
* Analyze TypeScript files for compilation errors and optional pattern violations
*/
protected analyze(targetPath: string, options?: Record<string, unknown>): Promise<Violation[]>;
/**
* Run TypeScript compiler to detect compilation errors
*/
private checkTypeScriptCompilation;
/**
* Find tsconfig.json starting from search path and moving up
*/
private findTsConfig;
/**
* Run tsc directly on directory when no tsconfig found
*/
private runTscOnDirectory;
/**
* Parse TypeScript compiler error output into violations
*/
private parseTypeScriptErrors;
/**
* Cache TypeScript configuration in database for fast access during watch mode
*/
private cacheTypeScriptConfig;
/**
* Get category for rule from database mapping or create new mapping
* Uses dynamic database-driven approach instead of hard-coded mappings
*/
private getCategoryForRule;
/**
* Pattern-based fallback for rule categorization until database is integrated
*/
private getDefaultCategoryFromPattern;
/**
* Run pattern-based checks for unknown/any usage (legacy functionality)
*/
private checkPatternViolations;
/**
* Get search patterns for ripgrep based on configuration
*/
private getSearchPatterns;
/**
* Determine if a pattern violation should be skipped based on filtering rules
*/
private shouldSkipViolation;
/**
* Check if unknown/any usage is legitimate based on established patterns
*/
private isLegitimateUsage;
/**
* Categorize pattern-based violations (legacy functionality)
*/
private categorizePatternViolation;
/**
* Generate human-readable violation messages for pattern violations
*/
private generatePatternViolationMessage;
/**
* Provide fix suggestions for TypeScript violations
*/
protected generateFixSuggestion(category: ViolationCategory, rule?: string, _code?: string): string | undefined;
/**
* Detect and run custom TypeScript quality scripts
*/
private runCustomTypeScriptScripts;
/**
* Detect custom TypeScript scripts in package.json
*/
private detectCustomTypeScriptScripts;
/**
* Check if the project has a custom TypeScript quality system
*/
private hasCustomTypeScriptSystem;
/**
* Select the best custom script to run based on preset and user configuration
*/
private selectBestCustomScript;
/**
* Execute a custom TypeScript script and parse its output
*/
private executeCustomTypeScriptScript;
/**
* Parse output from custom TypeScript scripts
*/
private parseCustomScriptOutput;
/**
* Create a violation from custom script output
*/
private createCustomScriptViolation;
/**
* Determine severity for custom script violations
*/
private determineCustomScriptSeverity;
/**
* Categorize custom script violations
*/
private categorizeCustomScriptViolation;
/**
* Detect the package manager being used
*/
private detectPackageManager;
}
//# sourceMappingURL=typescript-engine.d.ts.map