topmark.cli.console.protocols¶
topmark / cli / console / protocols
Framework-agnostic console protocol for user-facing CLI output.
This module defines the small behavioral surface used by CLI commands and presentation emitters to write user-facing text through explicit console objects. It deliberately stays separate from internal logging and avoids coupling command code to Click, Rich, or stdlib stream implementations.
ConsoleProtocol ¶
Bases: Protocol
Minimal behavioral protocol for user-facing CLI console output.
Implementations may be backed by Click, Rich, or plain stdlib streams. The protocol intentionally stays small so commands depend only on core output behavior, not on framework-specific details. Console instances are created during CLI state initialization and passed explicitly to commands and emitters; this protocol does not imply ownership of global stdout/stderr.
is_console_protocol ¶
Return whether value exposes the console protocol methods.
This helper performs a lightweight runtime guard for dynamically supplied console objects. It intentionally checks only that the expected methods are callable; static type checkers remain responsible for validating signatures.