topmark.presentation.shared.registry¶
topmark / presentation / shared / registry
Shared Click-free preparers for human-facing registry output.
This module prepares typed, human-facing report models for registry-related CLI commands. The prepared data is intentionally Click-free and reused by:
- TEXT renderers under
topmark.presentation.text(ANSI/console styling), and - Markdown renderers under
topmark.presentation.markdown(documentation-friendly output).
TEXT renderers may use verbosity_level and styled; Markdown renderers treat
Markdown as document-oriented output and use show_details as the shared detail-depth control.
Notes
This is a "human output" layer. It is distinct from
topmark.registry.machine, which targets JSON/NDJSON machine
formats.
See Also:
- topmark.registry
- topmark.core.machine
FileTypePolicyHumanItem
dataclass
¶
FileTypePolicyHumanItem(
*,
supports_shebang,
encoding_line_regex,
pre_header_blank_after_block,
ensure_blank_after_header,
blank_collapse_mode,
blank_collapse_extra,
)
Stable metadata describing header insertion/stripping policy for a file type.
These attributes are optional; processors read them to adapt behavior without hard-coding language specifics. Defaults are conservative and aim to preserve user-authored whitespace while keeping round-trips stable.
Attributes:
| Name | Type | Description |
|---|---|---|
supports_shebang |
bool
|
Whether this file type commonly starts with a POSIX
shebang (e.g., |
encoding_line_regex |
str | None
|
Optional regex (string) that matches an encoding declaration line immediately after a shebang (e.g., Python PEP 263). When provided and a shebang was skipped, a matching line is also skipped for placement. |
pre_header_blank_after_block |
int
|
Number of blank lines to place between a preamble block (shebang/encoding or similar) and the header. Typically 1. |
ensure_blank_after_header |
bool
|
Ensure exactly one blank line follows the header when body content follows. No extra blank is added at EOF. |
blank_collapse_mode |
str
|
How to identify and collapse blank
lines around the header during insert/strip repairs. See
|
blank_collapse_extra |
str
|
Additional characters to treat as blank in
addition to those covered by |
FileTypeHumanItem
dataclass
¶
FileTypeHumanItem(
*,
local_key,
namespace,
qualified_key,
description,
bound,
extensions,
filenames,
patterns,
skip_processing,
has_content_matcher,
has_insert_checker,
policy,
)
Click-free, human-facing view of one file type.
Attributes:
| Name | Type | Description |
|---|---|---|
local_key |
str
|
File type local key. |
namespace |
str
|
Namespace that owns the file type. |
qualified_key |
str
|
Canonical qualified file type key. |
description |
str
|
Human-readable file type description. |
bound |
bool
|
Whether the file type currently has an effective processor binding. |
extensions |
tuple[str, ...]
|
Registered filename extensions. |
filenames |
tuple[str, ...]
|
Exact registered filenames. |
patterns |
tuple[str, ...]
|
Registered path or glob patterns. |
skip_processing |
bool
|
Whether TopMark recognizes but never mutates this type. |
has_content_matcher |
bool
|
Whether a content matcher is configured. |
has_insert_checker |
bool
|
Whether a pre-insert checker is configured. |
policy |
FileTypePolicyHumanItem
|
Structured header policy metadata for human-facing rendering. |
FileTypesHumanReport
dataclass
¶
Click-free, human-facing report for topmark registry filetypes.
BindingHumanItem
dataclass
¶
BindingHumanItem(
*,
file_type_key,
file_type_local_key,
file_type_namespace,
processor_key,
processor_local_key,
processor_namespace,
file_type_description,
processor_description,
)
Click-free, human-facing view of one effective binding.
Attributes:
| Name | Type | Description |
|---|---|---|
file_type_key |
str
|
Canonical file type key. |
file_type_local_key |
str
|
File type local key. |
file_type_namespace |
str
|
Namespace that owns the file type. |
processor_key |
str
|
Canonical processor key. |
processor_local_key |
str
|
Processor local key. |
processor_namespace |
str
|
Namespace that owns the processor. |
file_type_description |
str
|
Human-readable file type description. |
processor_description |
str
|
Human-readable processor description. |
ProcessorHumanItem
dataclass
¶
ProcessorHumanItem(
*,
local_key,
namespace,
qualified_key,
description,
bound,
line_indent,
line_prefix,
line_suffix,
block_prefix,
block_suffix,
)
Click-free, human-facing view of one header processor.
Attributes:
| Name | Type | Description |
|---|---|---|
local_key |
str
|
Processor local key. |
namespace |
str
|
Namespace that owns the processor. |
qualified_key |
str
|
Canonical processor key. |
description |
str
|
Human-readable processor description. |
bound |
bool
|
Whether the processor currently participates in at least one effective binding. |
line_indent |
str
|
Line comment indent (if applicable). |
line_prefix |
str
|
Line comment prefix (if applicable). |
line_suffix |
str
|
Line comment suffix (if applicable). |
block_prefix |
str
|
Block comment prefix (if applicable). |
block_suffix |
str
|
Block comment suffix (if applicable). |
UnboundFileTypeHumanItem
dataclass
¶
Click-free, human-facing view of an unbound file type.
Attributes:
| Name | Type | Description |
|---|---|---|
name |
str
|
Qualified file type identifier shown in human-facing output. |
description |
str
|
Human-readable file type description. |
ProcessorsHumanReport
dataclass
¶
Click-free, human-facing report for topmark registry processors.
BindingsHumanReport
dataclass
¶
BindingsHumanReport(
*,
show_details,
verbosity_level,
bindings,
unbound_filetypes,
unused_processors,
styled,
)
Click-free, human-facing report for topmark registry bindings.
build_filetypes_human_report ¶
Build a Click-free report used by TEXT and MARKDOWN.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
show_details
|
bool
|
Whether consumers intend to display extended details. |
required |
verbosity_level
|
int
|
Effective TEXT verbosity; Markdown renderers ignore it. |
required |
styled
|
bool
|
Whether TEXT renderers should apply styling; Markdown renderers ignore it. |
required |
Returns:
| Type | Description |
|---|---|
FileTypesHumanReport
|
A |
Source code in src/topmark/presentation/shared/registry.py
build_processors_human_report ¶
Build a Click-free report used by TEXT and MARKDOWN for processors.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
show_details
|
bool
|
Whether consumers intend to display extended details. |
required |
verbosity_level
|
int
|
Effective TEXT verbosity; Markdown renderers ignore it. |
required |
styled
|
bool
|
Whether TEXT renderers should apply styling; Markdown renderers ignore it. |
required |
Returns:
| Type | Description |
|---|---|
ProcessorsHumanReport
|
A |
Source code in src/topmark/presentation/shared/registry.py
build_bindings_human_report ¶
Build a Click-free report used by TEXT and MARKDOWN for bindings.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
show_details
|
bool
|
Whether consumers intend to display extended details. |
required |
verbosity_level
|
int
|
Effective TEXT verbosity; Markdown renderers ignore it. |
required |
styled
|
bool
|
Whether TEXT renderers should apply styling; Markdown renderers ignore it. |
required |
Returns:
| Type | Description |
|---|---|
BindingsHumanReport
|
A |
BindingsHumanReport
|
currently unused processors. |