#documentation #public-api #coding #ai #symbols #extract #context

bin+lib laibrary

Provides AI coding assistants with public APIs and documentation from dependencies

2 releases

0.1.1 Jan 21, 2025
0.1.0 Jan 21, 2025

#395 in Filesystem

Download history 80/week @ 2025-01-15 102/week @ 2025-01-22

182 downloads per month

MIT license

135KB
3.5K SLoC

laibrary

laibrary extracts public API documentation from a library and outputs it in an LLM-friendly format. The endgame is to provide AI coding agents with all the context they need to use a particular dependency, but for now you can just use it manually on the CLI.

This project was inspired by Aider's repository map.

Features

  • Outputs public symbols (e.g. functions) only.
  • Outputs function signatures and documentation, but not the implementation.
  • Only supports Rust for now, but any language supported by tree-sitter can be supported.
  • Reads the source code directly, so it doesn't process the HTML of the generated documentation, thus keeping the output clean.

CLI Usage

To extract the documentation from a library, pass the name of the language and the path to the library. For example:

laibrary rust /path/to/library

Library Usage

use laibrary::generate_documentation;
use std::path::Path;

let path = Path::new("/path/to/crate");
match generate_documentation("rust", &path) {
    Ok(output) => println!("{}", output),
    Err(e) => eprintln!("Error: {}", e),
}

Supported Languages

Dependencies

~10–18MB
~335K SLoC