Skip to content

rtb-docs

Ships a tool's documentation inside the binary and makes it browsable offline — a two-pane TUI, a loopback HTML server, and full-text search, all over a markdown tree carried by rtb-assets. Airgap-friendly: the binary needs no network to render its own docs.

Part of the phpboyscout Rust toolkit; released in lockstep with rtb-cli from this repo.

Public API

use std::collections::HashMap;
use rtb_docs::{DocsBrowser, Index};

# fn build(index: Index, pages: HashMap<String, String>) -> Result<DocsBrowser, rtb_docs::DocsError> {
// `new(index, pages)` builds the browser from the doc index and the
// rendered page bodies. It's a ratatui widget — drive `render()`
// from your own event loop (or let the `docs` command do it).
let browser = DocsBrowser::new(index, pages)?;
# Ok(browser)
# }
Item Purpose
DocsBrowser Two-pane ratatui widget. Left: index from _index.yaml (filesystem-scan fallback); right: tui-markdown-rendered page.
DocsServer Loopback-only HTTP server rendering the same tree as HTML.
[Index], [IndexEntry] The navigable doc index model.
[search] tantivy full-text search over rendered bodies + fuzzy-matcher title search.
[DocsError] thiserror + miette::Diagnostic error enum.

CLI

The docs command is a default-enabled runtime feature, registered into BUILTIN_COMMANDS and dispatched by rtb-cli with subcommands list / show / browse / serve / ask.

Streaming AI Q&A

The ai module is a trait seam for streaming question-answering over the docs corpus, gated on the ai Cargo feature and backed by rtb-chat (formerly rtb-ai) — see configure an AI provider. Tools that want a different implementation can leave the feature off and supply their own AiAnswerStream.

Design record