Module

cli.commands.health

Health check commands for Bengal.

Commands:

bengal health linkcheck - Check internal and external links

Functions

health_cli 2 None
Health check and validation commands.
def health_cli(ctx: click.Context, dashboard: bool) -> None
Parameters
Name Type Description
ctx click.Context
dashboard bool
linkcheck 14 None
Check internal and external links in the site. **Validates that all links in y…
def linkcheck(external_only: bool, internal_only: bool, max_concurrency: int | None, per_host_limit: int | None, timeout: float | None, retries: int | None, retry_backoff: float | None, exclude: tuple[str, ...], exclude_domain: tuple[str, ...], ignore_status: tuple[str, ...], output_format: str, output_file: str | None, traceback: str | None, source: str) -> None

Check internal and external links in the site.

Validates that all links in your site work correctly:

  • Internal links point to existing pages and anchors
  • External links return successful HTTP status codes

The site must be built before checking internal links. Use --format json with --output to generate a report file for CI/CD integration.

See also: bengal site build - Build the site before checking internal links

Parameters
Name Type Description
external_only bool
internal_only bool
max_concurrency int | None
per_host_limit int | None
timeout float | None
retries int | None
retry_backoff float | None
exclude tuple[str, ...]
exclude_domain tuple[str, ...]
ignore_status tuple[str, ...]
output_format str
output_file str | None
traceback str | None
source str
_ensure_site_built 2 None
Ensure the site is built before checking links. Checks if output directory exi…
def _ensure_site_built(site: Site, cli: CLIOutput) -> None

Ensure the site is built before checking links.

Checks if output directory exists and contains recent files. If not, automatically builds the site.

Parameters
Name Type Description
site Site

Site instance

cli CLIOutput

CLI output helper

_build_config 9 dict[str, Any]
Build linkcheck config from CLI flags and site config.
def _build_config(site_config: dict[str, Any], max_concurrency: int | None, per_host_limit: int | None, timeout: float | None, retries: int | None, retry_backoff: float | None, exclude: tuple[str, ...], exclude_domain: tuple[str, ...], ignore_status: tuple[str, ...]) -> dict[str, Any]
Parameters
Name Type Description
site_config dict[str, Any]
max_concurrency int | None
per_host_limit int | None
timeout float | None
retries int | None
retry_backoff float | None
exclude tuple[str, ...]
exclude_domain tuple[str, ...]
ignore_status tuple[str, ...]
Returns
dict[str, Any]