Skip to content

Repository files navigation

ManT

CI codecov OpenSSF Scorecard crates.io License: Apache-2.0

ManT is a local-first documentation reader and query engine. It turns native man/mdoc pages and Markdown libraries into one navigable catalog for people, scripts, and agents.

One native mant executable provides a full-screen TUI, deterministic Markdown/text/JSON output, generated schemas, and a read-only MCP server. Every interface consumes the same typed document model. Bundled libmandoc gives Linux with glibc, macOS, and Windows the same manual-page parser without requiring a system man or mandoc executable at runtime.

ManT reading its own Markdown manual with a tldr quick reference and semantic outline

Install

Install or update the latest release.

Unix (Linux with glibc, or macOS)

curl --proto '=https' --tlsv1.2 -LsSf https://raw.githubusercontent.com/BryanHeBY/ManT/main/scripts/install.sh | sh

Windows (PowerShell)

irm https://raw.githubusercontent.com/BryanHeBY/ManT/main/scripts/install.ps1 | iex

All options, uninstallation, and alternative methods are in the installation guide.

Agent prompt

Read https://raw.githubusercontent.com/BryanHeBY/ManT/main/docs/installation.md
and install or update the latest ManT release for this system. Use its
recommended user-scoped method, verify the installation, and report any PATH
change still needed.

One binary, one model, three interfaces

Interface Entry point Designed for
Interactive TUI mant NAME in a terminal, or --ui Hierarchical reading, document discovery, typed links, history, search, mouse input, and tldr quick references
Structured CLI Projection options, --format, or redirection Outlines, excerpts, semantic explanations, location-aware search, and stable Markdown/text/JSON
Read-only MCP mant --mcp Local discovery and focused document retrieval for agents over stdio

A complete query automatically opens the reader only when both standard input and output are terminals. Redirection remains useful and predictable:

mant git > git.md
mant git | less

Use --ui to require the reader or --format markdown to require output, independent of terminal detection.

Why ManT

  • Navigate a documentation library, not just one page. A single catalog covers personal Markdown, installed sources, and native manual sections; typed links and bounded back/forward history connect them.
  • Address structure directly. Sections, options, commands, variables, and environment variables are semantic nodes, so --exclude can be retrieved without searching or copying the complete page.
  • Get the same interpretation everywhere. The TUI, CLI renderers, search, generated schemas, and MCP tools consume one normalized Rust document model.
  • Keep automation predictable. Outlines and excerpts use explicit selectors; search results include reusable nodes and generated-Markdown coordinates.
  • Stay local-first. Ordinary reading and querying need no network service, and the bundled parser avoids a runtime dependency on host manual tools.
  • Treat Markdown as documentation, not a second-class fallback. It receives the same hierarchy, links, semantic entries, search, output, and agent access as native manuals.

Interactive reader

mant git
mant --input README.md
mant tar --ui

The sidebar mirrors nested sections and reveals normalized options, commands, variables, and environment variables on demand. Selecting an entry places it at the top of the content pane; after scrolling settles, the sidebar follows the first visible section.

  • j / k or arrow keys move through visible nodes.
  • h / l collapse and expand branches.
  • d / u or page keys scroll the document.
  • Ctrl+O opens a live finder for registered Markdown and native manuals.
  • Alt+Left / Alt+Right move backward and forward through document jumps.
  • Ctrl+F or / opens confirmed full-page search.
  • n and Shift+N select the next and previous matches.
  • F10 opens the menu, ? opens help, and q quits.

The mouse can select and fold navigation entries, follow underlined in-page, cross-document, and web/email links, scroll both panes, drag scrollbars, and resize the sidebar. Markdown links stay inside their registered source; man and mdoc references select an exact manual section.

Structured discovery and queries

Discover installed Markdown and native manuals without opening each document:

mant --list
mant --find process
mant --find '^git' --regex --kind manual --format json

--list exposes one tree rooted at documents/, sources/<source>/, and manual/<section>/. --find emits stable tab-separated canonical paths by default, making it suitable for filtering and shell pipelines. Literal discovery ranks exact paths or leaf names first, then component suffixes, prefixes, and other substring matches; stable path order breaks ties. A query containing / also matches the complete canonical path.

Start with an outline and retrieve only the section or option that matters:

mant gcc --outline
mant git --tldr
mant gcc --node 4.2 --format markdown
mant tar --node acls --format json
mant tar --explain=--exclude

Heading paths are one-based. Path 0 and selector tldr are reserved for an available quick reference; --tldr is the concise equivalent of --node tldr. On a color terminal its default output uses the same semantic styles as the TUI; pipes, NO_COLOR, and TERM=dumb receive plain text. --color always|never overrides detection, while an explicit --format continues to select Markdown, text, or JSON.

Search returns the nearest reusable outline node and exact generated-Markdown coordinates:

mant tar --search=--acls --context 1
mant gcc --search 'worktree|branch' --regex --case smart

Full output supports Markdown, text, and JSON. Native roff manuals additionally support --format man, which emits manual-only plain text without tldr content:

mant git --format markdown
mant --input README.md --format text
mant git --format json --compact

Discover machine contracts from the installed binary rather than copying request shapes from documentation:

mant --schema request
mant --schema all --compact
mant --protocol-version
mant --version

The JSON protocol and Schema reference documents every versioned request and response projection, normalized IR node, coordinate rule, and MCP tool.

Build a local documentation library

mant --list presents one logical tree regardless of where a document came from:

documents/                  personal Markdown
sources/<source>/           installed Markdown collections
manual/<section>/           native man and mdoc pages

Exact catalog paths are unambiguous. Short selectors use root documents first, then configured sources, then native manuals; unique component suffixes make a deep path such as languages/en/tool convenient without hiding collisions.

Native manuals

ManT indexes raw, gzip, and zstd pages from traditional man<section>/ directories and flat roots containing files such as widget.1. Project-local collections can use MANT_MANPATH as a complete override:

mkdir -p ./project-man/man1
cp ./widget.1 ./project-man/man1/widget.1
MANT_MANPATH="$PWD/project-man" mant widget --manual

The same index works on Linux with glibc, macOS, and Windows. Logical queries accept mant 1 git, mant 'git(1)', mant git --man-section 1, and the canonical path mant manual/1/git. Manual aliases and parser I/O remain bounded to their indexed collection; the complete lookup and .so policy is documented in the mant manual.

Markdown collections

Personal .md and .markdown files below ManT's documents/ directory keep their extension-free relative hierarchy. Configured Git repositories and direct archive URLs are installed below documents/sources/ without mixing their files into the personal tree:

[team]
repo = "https://github.com/example/cli-docs.git"
branch = "main"
path = "manuals"
priority = 10

Run mant --update-docs to install or update configured sources and mant --prune-docs --dry-run before explicitly removing orphaned source data. Windows selectors try an exact documented executable name before following PATHEXT, so packages can retain canonical names such as tool.exe.md while mant tool remains convenient. The document-source guide defines platform paths, archive configuration, selection, precedence, and transactional update behavior.

Markdown headings, prose, code, links, lists, tables, and selected semantic definition lists enter the same model as native manuals. Unsupported syntax remains visible with a diagnostic instead of being silently discarded. The shipped mant manual is both the complete syntax reference and a self-hosted ManT document.

One-off input and quick references

Physical files are deliberately separate from logical catalog selectors:

mant --input README.md
mant --input /usr/share/man/man1/git.1.gz --outline
cat guide.md | mant --input - --input-format markdown
cat widget.1 | mant --input - --input-format roff

When compatible local tldr data exists, an ordinary query places its quick reference before the full document as reserved node 0. mant git --tldr selects only that presentation, while --manual and --man-section select only native manual content. ManT reads installed-client caches or its private cache, which mant --update-tldr can update. Markdown authors may also embed a document-owned quick reference using the format described in the mant manual.

MCP

Run the same executable as a read-only MCP server:

mant --mcp

Configure the client command as mant with arguments ["--mcp"]. The server exposes local discovery, outline, content, semantic explanation, and search tools over stdio. Each call reads the files currently visible in documents/, configured installed sources, and native manual paths. MCP has no update, network, or mutation tool and does not promise a session snapshot across calls. Lowering diagnostics remain available through ordinary CLI JSON queries.

Architecture

ManT architecture: source adapters enter mant-engine, which contains the mant-ir semantic center; the TUI and human renderers consume it directly, while external consumers cross mant-protocol

mant-ir is the semantic center nested inside the mant-engine execution layer. Interactive use passes its in-memory ResolvedContent directly to mant-ui, and human renderers operate on the same model. External process consumers cross the versioned mant-protocol boundary instead. Git and archive updates are an optional native CLI capability layered on mant-sources, not part of document reads or MCP.

Documentation

License

ManT-authored work is licensed under the Apache License 2.0. Rust dependencies, bundled parser sources, cached tldr-pages content, real-world test fixtures, and screenshot fonts retain their upstream terms; upstream tldr pages are CC BY 4.0 and are attributed at render time. See the third-party notice map. Native releases include a CycloneDX SBOM and signed GitHub provenance/SBOM attestations. Please report vulnerabilities through the private process in the security policy.

About

Turn Unix manuals and Markdown into structured, navigable documents for people and agents — native TUI, CLI, and MCP in one Rust binary.

Topics

Resources

Security policy

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages