I didn’t find how can I clear console, set cursor position and check terminal height and width (in symbols). For example in js i can do it with stdout/readlin, in C# Console class.
Take a look at this example: stdin, stdout, stderr - Beginner - Haxe programming language cookbook
On top of that, the ANSI library has helpers to move the cursor , clear the screen and set colors
Also for things like getting the cursor position, put the terminal into raw mode.