aetherlight-analyzer
Version:
Code analysis tool to generate ÆtherLight sprint plans from any codebase
230 lines • 5.9 kB
TypeScript
/**
* DESIGN DECISION: Shared types for all analyzers
* WHY: Consistent data model enables composition of analysis results
*
* REASONING CHAIN:
* 1. Multiple analyzers (architecture, complexity, debt, dependency)
* 2. Need common output format for aggregation
* 3. Create analysis-agnostic types (AnalysisResult, Issue, Metric)
* 4. Each analyzer produces structured output
* 5. Result: Sprint generator consumes unified analysis data
*
* PATTERN: Pattern-ANALYZER-001 (AST-Based Code Analysis)
*/
export interface AnalysisResult {
analyzers: AnalyzerResult[];
summary: AnalysisSummary;
issues: Issue[];
metrics: Record<string, number>;
recommendations: Recommendation[];
timestamp: string;
}
export interface AnalyzerResult {
name: string;
version: string;
executionTimeMs: number;
data: any;
}
export interface AnalysisSummary {
totalFiles: number;
totalLinesOfCode: number;
languages: Record<string, number>;
parseErrors: number;
analysisErrors: number;
}
export interface Issue {
type: IssueType;
severity: IssueSeverity;
location: IssueLocation;
message: string;
recommendation?: string;
effort?: IssueEffort;
impact?: IssueImpact;
}
export declare enum IssueType {
ARCHITECTURE = "architecture",
COMPLEXITY = "complexity",
DEBT = "debt",
DEPENDENCY = "dependency",
PERFORMANCE = "performance",
SECURITY = "security"
}
export declare enum IssueSeverity {
HIGH = "high",
MEDIUM = "medium",
LOW = "low",
INFO = "info"
}
export declare enum IssueEffort {
HIGH = "high",// >1 week
MEDIUM = "medium",// 1-3 days
LOW = "low"
}
export declare enum IssueImpact {
HIGH = "high",// Critical business/performance impact
MEDIUM = "medium",// Moderate improvement
LOW = "low"
}
export interface IssueLocation {
filePath: string;
line?: number;
column?: number;
endLine?: number;
endColumn?: number;
context?: string;
}
export interface Recommendation {
title: string;
description: string;
rationale: string;
reasoning: string[];
pattern?: string;
effort: IssueEffort;
impact: IssueImpact;
tasks: RecommendationTask[];
}
export interface RecommendationTask {
id: string;
title: string;
description: string;
estimatedHours: number;
dependencies: string[];
files: string[];
}
export interface ArchitectureAnalysis {
pattern: ArchitecturePattern;
confidence: number;
layers: ArchitectureLayer[];
components: Component[];
relationships: Relationship[];
diagram: string;
}
export declare enum ArchitecturePattern {
MVC = "MVC",
MVVM = "MVVM",
CLEAN = "Clean Architecture",
HEXAGONAL = "Hexagonal Architecture",
LAYERED = "Layered Architecture",
MICROSERVICES = "Microservices",
MONOLITH = "Monolith",
UNKNOWN = "Unknown"
}
export interface ArchitectureLayer {
name: string;
files: string[];
linesOfCode: number;
complexity: 'high' | 'medium' | 'low';
dependencies: string[];
}
export interface Component {
name: string;
type: ComponentType;
files: string[];
responsibilities: string[];
dependencies: string[];
}
export declare enum ComponentType {
CONTROLLER = "controller",
SERVICE = "service",
MODEL = "model",
REPOSITORY = "repository",
VIEW = "view",
UTILITY = "utility",
MIDDLEWARE = "middleware",
ROUTER = "router"
}
export interface Relationship {
from: string;
to: string;
type: RelationshipType;
strength: number;
}
export declare enum RelationshipType {
USES = "uses",
EXTENDS = "extends",
IMPLEMENTS = "implements",
DEPENDS_ON = "depends_on",
AGGREGATES = "aggregates"
}
export interface ComplexityAnalysis {
averageComplexity: number;
medianComplexity: number;
maxComplexity: number;
functionsOverThreshold: ComplexityIssue[];
heatmap: ComplexityHeatmap[];
}
export interface ComplexityIssue {
functionName: string;
filePath: string;
line: number;
complexity: number;
threshold: number;
recommendation: string;
}
export interface ComplexityHeatmap {
filePath: string;
averageComplexity: number;
maxComplexity: number;
functionCount: number;
}
export interface TechnicalDebtAnalysis {
totalIssues: number;
highPriority: number;
mediumPriority: number;
lowPriority: number;
categories: Record<string, number>;
issues: TechnicalDebtIssue[];
score: number;
}
export interface TechnicalDebtIssue {
category: TechnicalDebtCategory;
severity: IssueSeverity;
location: IssueLocation;
description: string;
recommendation: string;
}
export declare enum TechnicalDebtCategory {
TODO = "todo",
FIXME = "fixme",
HACK = "hack",
MAGIC_NUMBER = "magic_number",
HARDCODED_STRING = "hardcoded_string",
MISSING_ERROR_HANDLING = "missing_error_handling",
DEPRECATED_API = "deprecated_api",
DUPLICATE_CODE = "duplicate_code",
LONG_METHOD = "long_method",
GOD_CLASS = "god_class"
}
export interface DependencyAnalysis {
graph: DependencyGraph;
cycles: DependencyCycle[];
orphans: string[];
hubs: DependencyHub[];
}
export interface DependencyGraph {
nodes: DependencyNode[];
edges: DependencyEdge[];
}
export interface DependencyNode {
id: string;
label: string;
type: 'file' | 'module' | 'package';
linesOfCode: number;
}
export interface DependencyEdge {
from: string;
to: string;
type: 'import' | 'require' | 'dynamic_import';
count: number;
}
export interface DependencyCycle {
files: string[];
severity: IssueSeverity;
recommendation: string;
}
export interface DependencyHub {
filePath: string;
dependentCount: number;
recommendation: string;
}
//# sourceMappingURL=types.d.ts.map