Bengal includes a comprehensive health check system that validates builds across all components.
Health Check (bengal/health/health_check.py)
- Purpose: Orchestrates validators and produces unified health reports
- Features:
- Modular validator architecture
- Fast execution (< 100ms per validator)
- Configurable per-validator enable/disable
- Console and JSON report formats
- Integration with build stats
- Usage:
1 2 3 4 5
from bengal.health import HealthCheck health = HealthCheck(site) report = health.run(build_stats=stats) print(report.format_console())
Base Validator (bengal/health/base.py)
- Purpose: Abstract base class for all validators
- Interface:
validate(site) -> List[CheckResult] - Features:
- Independent execution (no validator dependencies)
- Error handling and crash recovery
- Performance tracking per validator
- Configuration-based enablement
Health Report (bengal/health/report.py)
- Purpose: Unified reporting structure for health check results
- Components:
CheckStatus: SUCCESS, INFO, WARNING, ERRORCheckResult: Individual check result with recommendationValidatorReport: Results from a single validatorHealthReport: Aggregated report from all validators
- Formats:
- Console output (colored, formatted)
- JSON output (machine-readable)
- Summary statistics (pass/warning/error counts)
Validators (bengal/health/validators/)
All Validators (14 total):
Basic Validation:
| Validator | Validates |
|---|---|
| ConfigValidatorWrapper | Configuration validity, essential fields, common issues |
| OutputValidator | Page sizes, asset presence, directory structure |
| MenuValidator | Menu structure integrity, circular reference detection |
| LinkValidatorWrapper | Broken links detection (internal and external) |
Content Validation:
| Validator | Validates |
|---|---|
| NavigationValidator | Page navigation (next/prev, breadcrumbs, ancestors) |
| TaxonomyValidator | Tags, categories, archives, pagination integrity |
| RenderingValidator | HTML quality, template function usage, SEO metadata |
| DirectiveValidator | Directive syntax, completeness, and performance |
Advanced Validation:
| Validator | Validates |
|---|---|
| ConnectivityValidator | Page connectivity using semantic link model and weighted scoring |
| CacheValidator | Incremental build cache integrity and consistency |
| PerformanceValidator | Build performance metrics and bottleneck detection |
Production-Ready Validation:
| Validator | Validates |
|---|---|
| RSSValidator | RSS feed quality, XML validity, URL formatting |
| SitemapValidator | Sitemap.xml validity for SEO, no duplicate URLs |
| FontValidator | Font downloads, CSS generation, file sizes |
| AssetValidator | Asset optimization, minification hints, size analysis |
Connectivity Validator
The Connectivity Validator uses a semantic link model with weighted scoring to provide nuanced page connectivity analysis beyond binary orphan detection.
Link Types and Weights:
| Link Type | Weight | Description |
|---|---|---|
| Explicit | 1.0 | Human-authored markdown links |
| Menu | 10.0 | Navigation menu items (high editorial intent) |
| Taxonomy | 1.0 | Shared tags/categories |
| Related | 0.75 | Algorithm-computed related posts |
| Topical | 0.5 | Section hierarchy (parent → child) |
| Sequential | 0.25 | Next/prev navigation |
Connectivity Levels:
| Level | Score Range | Status |
|---|---|---|
| 🟢 Well-Connected | ≥ 2.0 | No action needed |
| 🟡 Adequately Linked | 1.0 - 2.0 | Could improve |
| 🟠 Lightly Linked | 0.25 - 1.0 | Should improve (only structural links) |
| 🔴 Isolated | < 0.25 | Needs attention |
Configuration:
1 2 3 4 5 6 7 8 9 10 11 12 13 | |
CLI Commands:
1 2 3 4 5 6 7 8 9 10 11 | |
Configuration
Health checks can be configured viabengal.toml:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | |
Integration
Health checks run automatically after builds in strict mode and can be triggered manually:
1 2 3 4 5 6 7 8 | |