···2233## Spec-driven development
4455-- Specs in `specs/` are the source of truth. Code conforms to specs,
66- not the other way around.
55+- Specs in `specs/` are the source of truth. Code conforms to specs, not the
66+ other way around.
7788-- Never add, remove, or change a public API in code without first
99- updating the relevant spec and getting explicit approval from the
1010- user. This includes changes to `Term`, `createTerm`, `render()`,
1111- directive constructors (`open`, `close`, `text`), sizing helpers
1212- (`grow`, `fixed`, `fit`), and any future spec'd interfaces.
88+- Never add, remove, or change a public API in code without first updating the
99+ relevant spec and getting explicit approval from the user. This includes
1010+ changes to `Term`, `createTerm`, `render()`, directive constructors (`open`,
1111+ `close`, `text`), sizing helpers (`grow`, `fixed`, `fit`), and any future
1212+ spec'd interfaces.
13131414-- The workflow is: propose the spec change, wait for approval,
1515- then implement. Do not combine spec changes with implementation
1616- in a single step.
1414+- The workflow is: propose the spec change, wait for approval, then implement.
1515+ Do not combine spec changes with implementation in a single step.
17161818-- The renderer and input parser are specified separately
1919- (`renderer-spec.md` and `input-spec.md`). They are architecturally
2020- independent. Do not introduce dependencies between them.
1717+- The renderer and input parser are specified separately (`renderer-spec.md` and
1818+ `input-spec.md`). They are architecturally independent. Do not introduce
1919+ dependencies between them.
21202222-- Each test file tests exactly one spec. Do not put tests for one
2323- spec into another spec's test file.
2121+- Each test file tests exactly one spec. Do not put tests for one spec into
2222+ another spec's test file.
24232524## Rendering invariants
26252727-- The renderer MUST NOT perform IO. It produces bytes; the caller
2828- writes them.
2626+- The renderer MUST NOT perform IO. It produces bytes; the caller writes them.
29273030-- The renderer MUST NOT manage terminal state (alternate buffer,
3131- cursor visibility, mouse reporting, keyboard protocol modes).
2828+- The renderer MUST NOT manage terminal state (alternate buffer, cursor
2929+ visibility, mouse reporting, keyboard protocol modes).
32303333-- Each frame is a complete snapshot. The renderer carries no UI tree
3434- state between frames — only cell buffers for diffing.
3131+- Each frame is a complete snapshot. The renderer carries no UI tree state
3232+ between frames — only cell buffers for diffing.
35333636-- Directives are plain objects. No classes, no methods, no prototype
3737- chains. The flat array pattern is normative.
3434+- Directives are plain objects. No classes, no methods, no prototype chains. The
3535+ flat array pattern is normative.