topmark.cli.emitters.machine¶
topmark / cli / emitters / machine
CLI helpers for emitting machine-readable output.
This module is Click/console-aware and is responsible only for writing already rendered machine-readable output strings (JSON or NDJSON) to the active ConsoleLike.
All shaping and serialization lives in topmark.core.machine.
emit_machine ¶
Emit the serialized machine-readable format to the ConsoleLike.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
serialized
|
str | Iterable[str]
|
The serialized machine data to emit. |
required |
console
|
ConsoleProtocol
|
Console used to emit the already-serialized machine-readable output. |
required |
nl
|
bool
|
If True (default), emit a newline at the end of each line. |
True
|
Source code in src/topmark/cli/emitters/machine.py
emit_probe_results_machine ¶
Emit topmark probe machine-readable output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
console
|
ConsoleProtocol
|
Console used to emit the already-serialized machine-readable output. |
required |
meta
|
MetaPayload
|
The machine metadata payload. |
required |
config
|
FrozenConfig
|
The immutable |
required |
resolved_toml
|
ResolvedTopmarkTomlSources
|
ResolvedTopmarkTomlSources, |
required |
results
|
list[ProcessingContext]
|
Ordered list of per-file probe results. |
required |
fmt
|
OutputFormat
|
Output format ( |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
if |
Source code in src/topmark/cli/emitters/machine.py
emit_processing_results_machine ¶
emit_processing_results_machine(
*,
console,
meta,
config,
resolved_toml,
results,
fmt,
summary_mode,
)
Emit already-rendered machine strings to console.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
console
|
ConsoleProtocol
|
Console used to emit the already-serialized machine-readable output. |
required |
meta
|
MetaPayload
|
The machine metadata payload. |
required |
config
|
FrozenConfig
|
The immutable |
required |
resolved_toml
|
ResolvedTopmarkTomlSources
|
ResolvedTopmarkTomlSources, |
required |
results
|
list[ProcessingContext]
|
Ordered list of per-file processing results. |
required |
fmt
|
OutputFormat
|
Output format ( |
required |
summary_mode
|
bool
|
If True, emit aggregated counts instead of per-file entries. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
if |
Source code in src/topmark/cli/emitters/machine.py
emit_config_machine ¶
Emit the effective Config snapshot in a machine-readable format.
When show_config_layers is enabled, machine-readable output also includes a
config_provenance payload that preserves ordered config layers and the
corresponding source-local TOML fragments.
Shapes
- JSON, default:
- JSON, with provenance:
- NDJSON, default:
- NDJSON, with provenance: {"kind": "config_provenance", "meta": ..., "config_provenance": ...}
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
console
|
ConsoleProtocol
|
Console used to emit the already-serialized machine-readable output. |
required |
meta
|
MetaPayload
|
The machine metadata payload. |
required |
config
|
FrozenConfig
|
Immutable runtime configuration to serialize. |
required |
resolved_toml
|
ResolvedTopmarkTomlSources
|
Resolved TOML sources used to build optional machine-readable config provenance. |
required |
fmt
|
OutputFormat
|
Target machine-readable format (JSON or NDJSON). |
required |
show_config_layers
|
bool
|
If |
False
|
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in src/topmark/cli/emitters/machine.py
emit_config_diagnostics_machine ¶
Emit Config diagnostics in a machine-readable format to ConsoleLike.
Shapes
- JSON: a single object matching ConfigDiagnosticsPayload, wrapped as {"meta": ..., "config_diagnostics": ...}.
- NDJSON: a single line of the form
{"kind": "config_diagnostics", "meta": ..., "config_diagnostics":
}.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
console
|
ConsoleProtocol
|
Console used to emit the already-serialized machine-readable output. |
required |
meta
|
MetaPayload
|
The machine metadata payload. |
required |
config
|
FrozenConfig
|
Immutable runtime configuration providing diagnostics. |
required |
fmt
|
OutputFormat
|
Target machine-readable format (JSON or NDJSON). |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
if |
Source code in src/topmark/cli/emitters/machine.py
emit_config_check_machine ¶
Emit topmark config check results in a machine-readable format.
JSON
- One envelope containing
meta,config,config_diagnostics, andconfig_check.
NDJSON
1) config
2) config_diagnostics (counts-only)
3) config_check (command=config, subcommand=check)
4+) diagnostic (domain=config) one per diagnostic
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
console
|
ConsoleProtocol
|
Console used to emit the already-serialized machine-readable output. |
required |
meta
|
MetaPayload
|
The machine metadata payload. |
required |
config
|
FrozenConfig
|
Immutable runtime configuration providing diagnostics. |
required |
resolved_toml
|
ResolvedTopmarkTomlSources
|
Resolved TOML sources used to include TOML-authored writer options in the config payload. |
required |
strict
|
bool
|
Enforce strict config checking (fail on warning) if True, fail on error otherwise. |
required |
ok
|
bool
|
True if config checking passed, False otherwise. |
required |
fmt
|
OutputFormat
|
Target machine-readable format (JSON or NDJSON). |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
if |
Source code in src/topmark/cli/emitters/machine.py
emit_filetypes_machine ¶
Emit topmark registry filetypes machine-readable output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
console
|
ConsoleProtocol
|
Console used to emit the already-serialized machine-readable output. |
required |
meta
|
MetaPayload
|
The machine metadata payload. |
required |
fmt
|
OutputFormat
|
Target machine-readable format ( |
required |
show_details
|
bool
|
If True, include expanded identity, matching, binding, and policy fields. |
required |
Source code in src/topmark/cli/emitters/machine.py
emit_processors_machine ¶
Emit topmark registry processors machine-readable output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
console
|
ConsoleProtocol
|
Console used to emit the already-serialized machine-readable output. |
required |
meta
|
MetaPayload
|
The machine metadata payload. |
required |
fmt
|
OutputFormat
|
Target machine-readable format ( |
required |
show_details
|
bool
|
If True, include expanded identity, binding, and delimiter fields. |
required |
Source code in src/topmark/cli/emitters/machine.py
emit_bindings_machine ¶
Emit topmark registry bindings machine-readable output.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
console
|
ConsoleProtocol
|
Console used to emit the already-serialized machine-readable output. |
required |
meta
|
MetaPayload
|
The machine metadata payload. |
required |
fmt
|
OutputFormat
|
Target machine-readable format ( |
required |
show_details
|
bool
|
If True, include expanded file type and processor identity metadata for each binding plus structured auxiliary lists. |
required |