server.terminal_checks

Page actions AI-ready formats and sharing
Open LLM text
Share with AI
Ask Claude Ask ChatGPT Ask Gemini Ask Copilot

Rich terminal formatting for hypermedia surface checks.

Produces structured, colored output for contract validation results that appear at startup in debug mode. Respects TTY detection — no ANSI codes when piped or…

Rich terminal formatting for hypermedia surface checks.

Produces structured, colored output for contract validation results that appear at startup in debug mode. Respects TTY detection — no ANSI codes when piped or redirected.

Matches the visual language of pounce's startup banner (->arrows, clean indentation) and chirp's terminal error formatting (dash banners, compact diagnostics).

Example output (with color)::

── chirp check ─────────────────────────────────────────────

  5 routes · 3 templates · 12 targets · 8 hx-target selectors

  ▲  hx-target="#main" — no element with id="main" found
     in pokedex.html
     Did you mean "#mainn"?

  ✓  No errors · 1 warning

─────────────────────────────────────────────────────────────

server.terminal_checks

Name Type Default Description
type
qualified_name
element_type
description
source_file
line_number
is_autodoc
autodoc_element
_autodoc_template
_autodoc_url_path
_autodoc_page_type
title
doc_content_hash

Symbols on this page

_use_color
function
def _use_color(stream: object | None = None) -> bool

True if the output stream supports ANSI color.

Parameters

Name Type Default Description
stream object | None None
_Palette
class

ANSI escape sequences — empty strings when color is disabled.

_severity_icon
function
def _severity_icon(severity: Severity, c: _Palette) -> str

Colored icon for an issue severity.

Parameters

Name Type Default Description
severity Severity
c _Palette
_format_issue
function
def _format_issue(issue: ContractIssue, c: _Palette) -> list[str]

Format a single issue as indented lines.

Parameters

Name Type Default Description
issue ContractIssue
c _Palette
_concern_for_category
function
def _concern_for_category(category: str) -> str

Return the terminal output group for a contract category.

Parameters

Name Type Default Description
category str
_format_fragment_registry
function
def _format_fragment_registry(registry: FragmentTargetRegistry, c: _Palette) -> list[str]

Render the fragment target registry grouped by contract.

Returns a list of lines or an empty list when the registry has no registered targets.

Parameters

Name Type Default Description
registry FragmentTargetRegistry
c _Palette
_format_coverage
function
def _format_coverage(result: CheckResult, c: _Palette) -> list[str]

Render high-level contract coverage counters.

Parameters

Name Type Default Description
result CheckResult
c _Palette
format_check_result
function
def format_check_result(result: CheckResult, *, color: bool | None = None, fragment_target_registry: FragmentTargetRegistry | None = None, verbose_registry: bool = False, show_coverage: bool = False) -> str

Format a CheckResult for rich terminal display.

Parameters

Name Type Default Description
result CheckResult The check result to format.
color bool | None None Force color on/off. ``None`` auto-detects from stderr.
fragment_target_registry FragmentTargetRegistry | None None If provided and non-empty, a summary of registered fragment targets is included — one stats entry for contract count, and (when ``verbose_registry`` is True) a full dump grouped by contract before the summary line.
verbose_registry bool False When True, render the full registry dump. Gated by the caller on ``config.debug``.
show_coverage bool False When True, render route/template coverage counters that make form, mounted-page, shell, and OOB contract coverage visible.

View source · /home/runner/work/chirp/chirp/site/../src/chirp/server/terminal_checks.py:1