Custom Analyzers
Implementing a Custom Analyzer
Section titled “Implementing a Custom Analyzer”Implement the Analyzer trait:
use crawlkit_core::analyzers::{Analyzer, AnalysisContext, Finding, Severity};use crawlkit_core::CrawlConfig;
pub struct MyCustomAnalyzer;
impl Analyzer for MyCustomAnalyzer { fn name(&self) -> &str { "my-custom" }
fn analyze(&self, ctx: &AnalysisContext, _config: &CrawlConfig) -> Vec<Finding> { let mut findings = Vec::new();
if ctx.page.title.is_none() { findings.push(Finding { category: "custom".into(), severity: Severity::Warning, code: "CUSTOM001".into(), title: "Missing title".into(), description: "Page has no title tag".into(), element: None, recommendation: "Add a <title> tag".into(), }); }
findings }}Registering the Analyzer
Section titled “Registering the Analyzer”use crawlkit_core::analyzers::AnalyzerRegistry;
let mut registry = AnalyzerRegistry::new(&config);registry.register(Box::new(MyCustomAnalyzer));Plugin System
Section titled “Plugin System”For dynamic loading without recompilation, use the WASM-based plugin system. See crawlkit_core::plugin and PLUGIN_ARCHITECTURE.md for the plugin interface specification.