|
| 1 | +# AGENTS.md |
| 2 | + |
| 3 | +## Spec-driven development |
| 4 | + |
| 5 | +- Specs in `specs/` are the source of truth. Code conforms to specs, |
| 6 | + not the other way around. |
| 7 | + |
| 8 | +- Never add, remove, or change a public API in code without first |
| 9 | + updating the relevant spec and getting explicit approval from the |
| 10 | + user. This includes changes to `Term`, `createTerm`, `render()`, |
| 11 | + directive constructors (`open`, `close`, `text`), sizing helpers |
| 12 | + (`grow`, `fixed`, `fit`), and any future spec'd interfaces. |
| 13 | + |
| 14 | +- The workflow is: propose the spec change, wait for approval, |
| 15 | + then implement. Do not combine spec changes with implementation |
| 16 | + in a single step. |
| 17 | + |
| 18 | +- The renderer and input parser are specified separately |
| 19 | + (`renderer-spec.md` and `input-spec.md`). They are architecturally |
| 20 | + independent. Do not introduce dependencies between them. |
| 21 | + |
| 22 | +- Each test file tests exactly one spec. Do not put tests for one |
| 23 | + spec into another spec's test file. |
| 24 | + |
| 25 | +## Rendering invariants |
| 26 | + |
| 27 | +- The renderer MUST NOT perform IO. It produces bytes; the caller |
| 28 | + writes them. |
| 29 | + |
| 30 | +- The renderer MUST NOT manage terminal state (alternate buffer, |
| 31 | + cursor visibility, mouse reporting, keyboard protocol modes). |
| 32 | + |
| 33 | +- Each frame is a complete snapshot. The renderer carries no UI tree |
| 34 | + state between frames — only cell buffers for diffing. |
| 35 | + |
| 36 | +- Directives are plain objects. No classes, no methods, no prototype |
| 37 | + chains. The flat array pattern is normative. |
0 commit comments