Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

Console capabilities

Platform spec feature

Console capabilities

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki

What this feature specifies

Console.Capabilities and Platform.Terminal probe whether styled output is appropriate: TTY detection on fd 1, environment flags (NO_COLOR, FORCE_COLOR, COLORTERM, TERM), and the effective color model used by Ansi.Sgr downgrade logic.

Contract statement

  • ShouldEmitAnsi() must return false when NO_COLOR is set (non-empty value per EnvFlagSet).
  • When not forced, non-TTY stdout must suppress ANSI emission.
  • FORCE_COLOR must enable emission even when stdout is not a TTY.
  • EffectiveColorModel must return Basic16 when color is stripped, otherwise the probed model (Basic8, Basic16, Indexed256, TrueColor).
  • Platform.Terminal.ForcePlainText() should align with dumb terminals (TERM=dumb) and piped stdout unless FORCE_COLOR is set.

Implementation anchors

  • compiler/corelib/packages/console/src/Console/Capabilities.bd
  • compiler/corelib/packages/console/src/Platform/Terminal.bd
  • Tests: CapabilitiesTests.bd

No open decisions. Closed choices are normative ADRs under adr/ (D-CORE-TERM-0020D-CORE-TERM-0022); use the reader ADRs tab for expandable detail.

Articles