Compiler Architecture Validator
Validates Fakt compiler plugin follows industry-standard architectural patterns.
Instructions
1. Determine Scope
Extract from conversation:
- Specific component: "validate UnifiedFaktIrGenerationExtension"
- General check: "validate architecture"
- Default: validate ALL components
Components:
- CompilerPluginRegistrar — Plugin registration
- IrGenerationExtension — IR generation logic
- FirExtensionRegistrar — FIR phase detection
- Context Pattern — FaktSharedContext / IrFaktContext
- Error Handling — Diagnostic patterns
2. Validate CompilerPluginRegistrar
Read compiler/src/main/kotlin/com/rsicarelli/fakt/compiler/FaktCompilerPluginRegistrar.kt
- Extends
CompilerPluginRegistrar -
override val supportsK2: Boolean = true - Options loading pattern (FaktOptions.load())
- FIR extension registration (FirExtensionRegistrarAdapter)
- IR extension registration (IrGenerationExtension)
- Proper enabled check before registration
3. Validate IrGenerationExtension
Read compiler/src/main/kotlin/com/rsicarelli/fakt/compiler/ir/UnifiedFaktIrGenerationExtension.kt
- Extends
IrGenerationExtension - Creates context object
- Separates
generate()and internal logic - Proper moduleFragment traversal
- Error handling with diagnostics
4. Validate Context Pattern
Grep pattern="class.*Context" compiler/src/main/kotlin/com/rsicarelli/fakt/compiler/
- Dedicated context class
- Bundles pluginContext, messageCollector, options
- Provides context-specific utilities
5. Validate FIR Phase
Read compiler/src/main/kotlin/com/rsicarelli/fakt/compiler/fir/FaktFirExtensionRegistrar.kt
- FirExtensionRegistrar implementation
- @Fake annotation detection
- Validation before IR phase
- Proper error reporting
6. Validate Error Handling
Grep pattern="(messageCollector|reportError|reportWarning)" compiler/src/main/kotlin/com/rsicarelli/fakt/compiler/
- MessageCollector usage
- Error reporting with source location
- Graceful failures (no crashes)
7. Generate Report
ARCHITECTURE VALIDATION REPORT
1. CompilerPluginRegistrar: {score}%
2. IrGenerationExtension: {score}%
3. Context Pattern: {score}%
4. FIR Phase: {score}%
5. Error Handling: {score}%
Strengths: {list}
Deviations: {list with explanations}
Recommendations: {actionable items}
Related Skills
kotlin-api-consultant— Validate Kotlin API usagedocs-navigator— Access architecture documentation
Converted and distributed by TomeVault — claim your Tome and manage your conversions.