# ados-term
[](https://crates.io/crates/ados-term)
[](https://docs.rs/ados-term)
[](#license)
[](https://github.com/altnautica/ADOSDroneAgent/blob/main/crates/Cargo.toml)
**Full-screen terminal toolkit for installers and deploy wizards: amber-on-charcoal theme with color tiers, frame compositor, raw tty backends, live step-progress renderers and a streaming command runner.**
An installer that runs as `curl … | sudo bash` cannot read the keyboard from stdin (stdin is the script) and cannot assume the terminal can show color, Unicode or even a cursor. This crate is the terminal layer for that kind of tool: a theme that degrades from truecolor to plain text and from Unicode glyphs to ASCII, a pure frame compositor whose every line is exactly the terminal width, a `/dev/tty` raw-mode backend that works under a piped stdin and a crossterm stdio backend for every OS, wizard widgets, and a step-progress UI that renders full-screen, as an inline sticky block, or as grep-friendly plain lines.
```rust
use ados_term::render::{fit_to, visible_width};
use ados_term::theme::{ColorTier, Theme};
let theme = Theme { ascii: false, tier: ColorTier::Truecolor };
let styled = theme.accent("ready");
// Width math ignores the color escapes, so styled text still lines up.
assert_eq!(visible_width(&styled), 5);
let row = fit_to(&styled, 12);
assert_eq!(visible_width(&row), 12);
// Overflow is stripped of styling and clipped with an ellipsis.
assert_eq!(fit_to("installing dependencies", 10), "installin…");
```
## Highlights
- Color tiers: truecolor, xterm-256, basic 16-color and none (`NO_COLOR`, `TERM=dumb`), with an ASCII glyph tier for non-UTF-8 locales. Styled spans reset only the foreground, so a painted background survives padding.
- A pure compositor: `frame::compose` returns the whole screen as `rows` strings of exactly `cols` visible columns, so layouts are snapshot-tested without a terminal.
- Two terminal backends behind one `tty::Tty`: `/dev/tty` with termios raw mode, `poll`, `SIGWINCH` and `SIGINT` handling (Linux), and crossterm raw mode on stdio (macOS, Windows, Linux). Both restore the terminal on drop and from a panic hook.
- Wizard widgets: confirm, one-of-N, review-and-choose, checklist, sanitized text input and masked passphrase input, each returning `Flow::{Value, Back, Abort}`.
- Step progress: a `ProgressSink` the step engine emits into, rendered full-screen (checklist plus live detail pane), as an inline block on stderr, or as plain lines; a `SummaryView` trait for the closing card; a tracing layer that forwards log lines into the view.
- Asset export: the same composed grid becomes a standalone SVG, an HTML `<pre>` or an animated HTML player.
- `exec`: synchronous command runners that capture output, write secrets to stdin instead of argv, or stream stdout and stderr line by line (splitting on `\r` too) while keeping a bounded tail for error messages.
## How it works
Every screen is a grid of pre-styled lines. `render` measures and pads by visible width (skipping SGR escapes), `frame` places a header, a progress rail, a centered panel and a footer into a grid, and `frame::to_ansi` turns the grid into one buffer with absolute cursor placement, written in a single syscall. A repaint at the same size overwrites in place; a resize clears first.
`progress::detect_mode` picks the renderer from the output flags and stderr: a terminal gets the inline block, CI or a pipe gets plain lines. `progress::resolve_live_mode` upgrades the inline block to full-screen when a `Tty` can be opened, or reuses one a wizard already holds so the wizard and the progress view share one alternate-screen session. The renderer thread owns the terminal; producers only send events, so nothing else writes to it.
## Part of ADOS
Used in production by the [ADOS Drone Agent](https://github.com/altnautica/ADOSDroneAgent), the onboard software of the ADOS software-defined drone platform.
[All ADOS crates](https://github.com/altnautica/ADOSDroneAgent/tree/main/crates#published-crates) · [Docs](https://docs.altnautica.com) · [Discord](https://discord.gg/uxbvuD4d5q)
### Other ADOS crates
<!-- ados-family:crates -->
**Platform (versioned with the ADOS Drone Agent)**
| Crate | What it does | Docs |
|---|---|---|
| [`ados-protocol`](https://crates.io/crates/ados-protocol) | Wire contracts of the ADOS Drone Agent: IPC framing, plugin RPC envelope, capability tokens and the vision frame bus. | [docs.rs](https://docs.rs/ados-protocol) |
| [`ados-sdk`](https://crates.io/crates/ados-sdk) | Write Rust plugins for the ADOS Drone Agent: IPC client, plugin context, driver traits and lifecycle runner. | [docs.rs](https://docs.rs/ados-sdk) |
| [`ados-vision`](https://crates.io/crates/ados-vision) | Single-object visual tracker: Kalman motion model, appearance re-identification and YOLOv8 head decoding. | [docs.rs](https://docs.rs/ados-vision) |
| [`ados-gpio`](https://crates.io/crates/ados-gpio) | Drive status buzzers and LEDs on Linux GPIO lines, with bounded software-PWM beep patterns. | [docs.rs](https://docs.rs/ados-gpio) |
| [`ados-hal-probe`](https://crates.io/crates/ados-hal-probe) | Find out what a board's hardware can really do by probing it, plus bundled board profiles. | [docs.rs](https://docs.rs/ados-hal-probe) |
**Standalone**
| Crate | What it does | Docs |
|---|---|---|
| [`ados-sensorhub`](https://crates.io/crates/ados-sensorhub) | Sensor hub wire protocol: COBS framing, CRC-16 and fixed-layout IMU, baro, mag and GNSS packets. no_std. | [docs.rs](https://docs.rs/ados-sensorhub) |
| [`ados-offload`](https://crates.io/crates/ados-offload) | Choose where perception runs (onboard, offloaded or hybrid) and hold the vehicle when results go stale. | [docs.rs](https://docs.rs/ados-offload) |
| [`ados-macpin`](https://crates.io/crates/ados-macpin) | Stable MAC addresses for Linux network adapters that randomize theirs every boot. | [docs.rs](https://docs.rs/ados-macpin) |
| [`ados-lora`](https://crates.io/crates/ados-lora) | LoRa transmit governor with cited regional band plans, duty cycle, dwell time and airtime accounting. | [docs.rs](https://docs.rs/ados-lora) |
| [`ados-crsf-codec`](https://crates.io/crates/ados-crsf-codec) | no_std CRSF / ExpressLRS codec for RC channels, telemetry and parameter frames. | [docs.rs](https://docs.rs/ados-crsf-codec) |
| [`ados-positioning`](https://crates.io/crates/ados-positioning) | Split mixed UBX, NMEA and RTCM3 GNSS streams, configure u-blox receivers and run an RTK base survey-in. | [docs.rs](https://docs.rs/ados-positioning) |
| [`ados-rtcm`](https://crates.io/crates/ados-rtcm) | RTCM3 framing, CRC-24Q and MAVLink GPS_RTCM_DATA fragmentation for RTK corrections. | [docs.rs](https://docs.rs/ados-rtcm) |
| [`ados-clock`](https://crates.io/crates/ados-clock) | Map remote clocks onto the host clock: least-squares and envelope fits, TIMESYNC and a chrony sink. | [docs.rs](https://docs.rs/ados-clock) |
| [`ados-swarm`](https://crates.io/crates/ados-swarm) | Swarm control laws: separation, flocking, formations, CBBA task allocation and a point-mass simulator. | [docs.rs](https://docs.rs/ados-swarm) |
| [`ados-mavlink-tunnel`](https://crates.io/crates/ados-mavlink-tunnel) | Send large messages over MAVLink TUNNEL frames with chunking and bounded reassembly. | [docs.rs](https://docs.rs/ados-mavlink-tunnel) |
| [`ados-display-driver`](https://crates.io/crates/ados-display-driver) | Small-display output on Linux: SSD1306/SH1106 OLED over I2C, pixel packers and a framebuffer writer. | [docs.rs](https://docs.rs/ados-display-driver) |
| [`ados-hmi`](https://crates.io/crates/ados-hmi) | Front-panel input: touchscreen calibration and gestures, button presses and rotary encoders. | [docs.rs](https://docs.rs/ados-hmi) |
<!-- /ados-family:crates -->
### ADOS repositories
<!-- ados-family:repos -->
| Repo | Runs on | What it does | Link |
|---|---|---|---|
| ADOS Mission Control | Browser, desktop (Electron) | Ground control station: FC setup, mission planning, flight, 3D simulation, fleet | [ADOSMissionControlGCS](https://github.com/altnautica/ADOSMissionControlGCS) |
| ADOS Drone Agent | Companion computer on the drone, or a ground node | Onboard agent: MAVLink routing, HD video, long-range radio link, plugins, remote control | [ADOSDroneAgent](https://github.com/altnautica/ADOSDroneAgent) |
| ADOS Android GCS | Android phones and tablets | Native ground control app for agents on the LAN, direct flight controllers and the cloud | [ADOSAndroidGCS](https://github.com/altnautica/ADOSAndroidGCS) |
| ADOS Extensions | Drone Agent and Mission Control | First-party signed plugins, each with an agent half and a GCS half | [ADOSExtensions](https://github.com/altnautica/ADOSExtensions) |
| ADOS MCP | Your machine | Model Context Protocol server that lets AI clients operate ADOS drones under scopes and a safety gate | [ADOS-MCP](https://github.com/altnautica/ADOS-MCP) |
| Documentation | docs.altnautica.com | Public docs for every ADOS product | [Documentation](https://github.com/altnautica/Documentation) |
<!-- /ados-family:repos -->
## License
Licensed under either of [Apache License, Version 2.0](LICENSE-APACHE) or [MIT license](LICENSE-MIT) at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this crate by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.