# Module /tty

Terminal capability detection, dimensions, raw mode controls, and interactive prompt helpers.

```tangu
(use /tty)
```

## Functions & symbols

### ask

`(tty/ask) -> String | ()`

Writes an optional prompt to active `*out*`, flushes, and reads a single line from active `*in*`.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `prompt` | `Any` | no | Optional prompt displayed before reading a line |

```tangu
(let name (tty/ask "Name: "))
```

### color-enabled?

`(tty/color-enabled?) -> Bool`

Returns `true` if ANSI color output should be enabled for the target stream, honoring `NO_COLOR`, `FORCE_COLOR`, `TERM=dumb`, and TTY status.

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `stream` | `Any | Symbol` | no | Optional stream value or port symbol (`:out-port`, `:err-port`, `:in-port`); defaults to active `*out*` |

```tangu
(tty/color-enabled?)
(tty/color-enabled? :err-port)
```

### is-tty?

`(tty/is-tty?) -> Bool`

Returns `true` if the target stream (defaults to active `*out*`) is attached to an interactive OS terminal (TTY).

| Parameter | Type | Optional | Description |
| :--- | :--- | :--- | :--- |
| `stream` | `Any | Symbol` | no | Optional stream value (such as `out-port`, `*out*`, or `Buffer`) or port symbol (`:out-port`, `:err-port`, `:in-port`); defaults to active `*out*` |

```tangu
(tty/is-tty?)
(tty/is-tty? :err-port)
```

### size

`(tty/size) -> Map | ()`

Returns `{:cols Int :rows Int}` when attached to a terminal, or `()` when not attached to a TTY.

```tangu
(let dims (tty/size))
```
