@invisiblecities/sidequest-cqo
Version:
Configuration-agnostic TypeScript and ESLint orchestrator with real-time watch mode, SQLite persistence, and intelligent terminal detection
130 lines • 4.03 kB
TypeScript
/**
* @fileoverview Code Archaeology Engine
*
* Comprehensive code archaeology system that bundles ts-prune and jscpd
* to detect unused exports, dead code, and code duplication patterns.
* Positions SideQuest as a technical debt relief system.
*/
import { BaseAuditEngine } from "./base-engine.js";
import type { Violation, EngineConfig, ViolationCategory, ArchaeologyReport } from "../utils/violation-types.js";
/**
* Configuration interface for CodeArchaeologyEngine
*/
export interface ArchaeologyEngineConfig extends EngineConfig {
options: {
targetPath: string;
deadCode?: {
enabled: boolean;
ignorePatterns?: string[];
includeTests?: boolean;
};
duplication?: {
enabled: boolean;
minLines?: number;
minTokens?: number;
threshold?: number;
};
};
}
/**
* Code Archaeology Engine for detecting technical debt
*
* Integrates ts-prune for dead code detection and jscpd for duplication analysis.
* Provides comprehensive code health insights and actionable remediation suggestions.
*/
export declare class CodeArchaeologyEngine extends BaseAuditEngine {
constructor(config: ArchaeologyEngineConfig);
/**
* Create a dead code violation with specific metadata
*/
private createDeadCodeViolation;
/**
* Create a code duplication violation with specific metadata
*/
private createDuplicationViolation;
/**
* Generate appropriate message for dead code violations
*/
private getDeadCodeMessage;
/**
* Assess the impact of removing dead code
*/
private assessRemovalImpact;
/**
* Suggest refactoring approach based on duplication characteristics
*/
private suggestRefactoringApproach;
/**
* Assess effort required to fix duplication
*/
private assessFixEffort;
/**
* Check if code has archaeology exclusion annotations
*/
private checkArchaeologyAnnotations;
/**
* Parse archaeology exclusion annotation from JSDoc content
*/
private parseArchaeologyAnnotation;
/**
* Check if a temporary annotation should trigger a recheck
*/
private shouldRecheckAnnotation;
/**
* Get current project version from package.json
*/
private getCurrentVersion;
/**
* Simple version comparison (could be enhanced with semver library)
*/
private compareVersions;
/**
* Calculate confidence score for dead code detection
*/
private calculateDeadCodeConfidence;
/**
* Main analysis method that orchestrates dead code and duplication detection
*/
protected analyze(targetPath: string, _options?: Record<string, unknown>): Promise<Violation[]>;
/**
* Detect unused exports and dead code using ts-prune
*/
analyzeDeadCode(targetPath: string): Promise<Violation[]>;
/**
* Detect code duplication using jscpd
*/
analyzeDuplication(targetPath: string): Promise<Violation[]>;
/**
* Parse ts-prune output into violations
*/
private parseTsPruneOutput;
/**
* Parse jscpd output into violations
*/
private parseJscpdOutput;
/**
* Run a command and return its output
*/
private runCommand;
/**
* Generate fix suggestions for archaeology violations
*/
protected generateFixSuggestion(category: ViolationCategory, rule?: string, _code?: string): string | undefined;
/**
* Generate comprehensive archaeology report
*/
generateArchaeologyReport(targetPath: string): Promise<ArchaeologyReport>;
/**
* Generate actionable recommendations based on violations
*/
private generateRecommendations;
/**
* Calculate file-level duplication metrics
*/
private calculateFileMetrics;
/**
* Estimate time required to fix all violations
*/
private estimateFixTime;
}
//# sourceMappingURL=code-archaeology-engine.d.ts.map