Ripdoc
Ripdoc prints a syntactical outline of a crate's public API and documentation. The CLI provides on-demand access to these resources from any source (local filesystem or through crates.io), perfect for AI agent usage.
See AGENTS.md for an example of context & usage to provide to AI agents. There is no MCP server for this tool, as I think MCP is a garbage spec and on it's way out soon as hinted by Anthropic themselves.
Search Mode
Use the --search|-s flag with the print command to query specific items instead of printing an entire crate. The query returns public API and their ancestors for context.
# Show methods and fields matching "status" within the reqwest crate
By default the query matches the name, doc, and signature domains, case-insensitively.
Add --direct-match-only|-d when you want container matches (modules, structs, traits) to stay collapsed and show only the exact hits.
Listing Mode
Use the list subcommand to print a concise catalog of crate items instead of rendering Rust code. Each line reports the item kind and its fully qualified path, e.g.:
Filter listing output with --search. The listing honours --private and feature flags. Each row includes the source file and line.
Below is an example from the pandoc crate showing how Ripdoc prints the same snippet in Markdown (default) and in the raw Rust skeleton (--format rs):
Markdown preview (default):
```rust
impl Pandoc {
```
Get a new Pandoc object This function returns a builder object to configure the Pandoc execution.
```rust
pub fn new() -> Pandoc {}
```
Add a path hint to search for the LaTeX executable.
The supplied path is searched first for the latex executable, then the environment variable `PATH`, then some hard-coded location hints.
```rust
pub fn add_latex_path_hint<T: AsRef<Path> + ?Sized>(&mut self, path: &T) -> &mut Pandoc {}
```
Add a path hint to search for the Pandoc executable.
The supplied path is searched first for the Pandoc executable, then the environment variable `PATH`, then some hard-coded location hints.
```rust
pub fn add_pandoc_path_hint<T: AsRef<Path> + ?Sized>(&mut self, path: &T) -> &mut Pandoc {}
// Set or overwrite the document-class.
pub fn set_doc_class(&mut self, class: DocumentClass) -> &mut Pandoc {}
```
Rust preview (--format rs):
Ripdoc prints Markdown by default as it is more token efficient. The output is immediately usable for feeding to LLMs.
Print READMEs
In addition to printing crate API, Ripdoc can also fetch and print the README file for a crate.
Other Features
- Character highlighting for query hits
- Print raw JSON data for usage with
jqor similar - Cache rustdoc JSON on disk automatically (override location via
RIPDOC_CACHE_DIR)
Requirements
Ripdoc requires the Rust nightly toolchain for its operation:
- Nightly toolchain: Required for unstable rustdoc features used to generate JSON documentation
Install the nightly toolchain:
Usage
Basic usage:
# Print (default if no subcommand is provided)
See the help output for all options:
Ripdoc has a flexible target specification that tries to do the right thing in a wide set of circumstances.
# Current project
# If we're in a workspace and we have a crate mypackage
# A dependency of the current project, else we fetch from crates.io
# A sub-path within a crate
# Path to a crate
# A module within that crate
# A crate from crates.io with a specific version
# Search for "status" across names, signatures and doc comments
# Search for "status" in only names and signatures
# Search for "status" in docs only
# List public API items
# Print Markdown output with stripped doc comment markers
Attribution
This crate is a forked and re-worked version of cortesi's ruskel. Much of its core code is still in use.
License
This project is licensed under the MIT License. See the LICENSE file for details.