Skip to content
Beskid Platform specification

Beskid

Jump to a Beskid service

Beskid

Jump to a Beskid service

ANSI escape model

Platform spec feature

ANSI escape model

Spec standingStandard

Owner
Piotr Mikstacki
Submitter
Piotr Mikstacki

What this feature specifies

Normative terminal escape framing for corelib_console: how Ansi.Escape, Ansi.Cursor, Ansi.Erase, Ansi.Sgr, Ansi.Screen, and Ansi.Osc compose bytes that terminals interpret. Tables in the design model article match repository ANSI.md; this hub states package boundaries and emission rules shared with Console capabilities.

Contract statement

  • ESC is ASCII U+001B (decimal 27). Implementations must use a single-byte ESC; language-specific \e escapes are informative only.
  • CSI sequences must use the form ESC [ + parameter bytes + final byte (semicolon-separated numeric parameters; optional spaces may appear between parameters and are ignored when parsing).
  • Private CSI modes use ? before parameters and final byte h (set) or l (reset).
  • DEC single-character sequences (ESC 7 / ESC 8 save/restore cursor) are the preferred save/restore form; SCO ESC[s / ESC[u are not required in v1.
  • User-visible emission must pass through Ansi.Escape.WhenEnabled (or builders that call it) so non-TTY and NO_COLOR hosts receive empty styled output, not raw escapes.
  • Sequences marked de-facto in ANSI.md but not implemented in corelib may be emitted only via raw Csi/OscSequence helpers; they are not conformance-tested until listed in contracts and edge cases.

Implementation anchors

  • compiler/corelib/packages/console/src/Ansi/
  • Informative aggregate reference: repository root ANSI.md
  • Golden tests: compiler/corelib/beskid_corelib/tests/corelib_tests/src/console/AnsiEscapeTests.bd, AnsiSgrGoldenTests.bd

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

Articles