MCPcopy Index your code
hub / github.com/daipendency/daipendency

github.com/daipendency/daipendency @main

Chat with this repo
repository ↗ · DeepWiki ↗ · + Follow
71 symbols 216 edges 9 files 2 documented · 3%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Daipendency

Daipendency extracts narrative and API documentation from a library and outputs it in an LLM-friendly format. This specific project allows you to use the functionality programmatically or via the CLI, so if you just want to integrate it into your favourite AI coding agent, check out daipendency-mcp.

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

daipendency extract-dep: Extract the documentation of a dependency

To extract the documentation of a dependency of the project in the current directory, pass the name of the dependency. For example:

daipendency extract-dep thiserror

Alternatively, you can specify the path to the project that contains the dependency with the --dependant option. For example:

daipendency extract-dep --dependant=/path/to/your/crate thiserror

This command will honour the version of the dependency specified in the manifest file, like Cargo.toml in the case of a Rust crate.

daipendency extract: Extract the documentation of a library

To extract the documentation from a library, pass the path to it. For example:

daipendency extract /path/to/library

Library Usage

You can use the daipendency crate in your own Rust project.

Firstly, you need to load the library from which you want to extract the documentation using Library::load_dependency or Library::load. For example:

use daipendency::{Library, Language};
use std::path::Path;

let library = Library::load_dependency(
    "thiserror",
    Path::new("/path/to/crate"),
    Some(Language::Rust),
)?;

Library instances contain all the symbols (e.g. functions) in the library, grouped into namespaces (e.g. Rust modules, Java packages). You can extract the namespaces and symbols in which you're interested and process them however you want, or you can use the generate_markdown_documentation function to generate a Markdown file as follows:

use daipendency::generate_markdown_documentation;

let documentation = generate_markdown_documentation(&library);

Automatic Language Detection

Daipendency can automatically detect the language of a library if you don't specify it in the CLI with the --language option or in the Library function. However, you should try to specify the language explicitly, since auto-detection can get slow as we add more languages.

Development

Adding Support for a New Language

To add support for a new language, you need to:

  1. Implement the daipendency_extractor::Extractor trait for the language. See daipendency-extractor-rust for an example.
  2. Release your crate. Note that only MIT- or Apache-2.0-licensed crates are eligible for inclusion in Daipendency.
  3. Integrate your crate in src/languages.rs.

Core symbols most depended-on inside this repo

generate_markdown_documentation
called by 14
src/markdown_formatting.rs
create_library
called by 14
src/markdown_formatting.rs
create_namespace
called by 10
src/markdown_formatting.rs
create_temp_library
called by 7
src/library.rs
discover_extractor
called by 5
src/extractors.rs
make_command_parser
called by 5
src/cli/mod.rs
make_extract_subcommand
called by 5
src/cli/extract.rs
get_extractor
called by 4
src/extractors.rs

Shape

Function 59
Method 6
Class 3
Enum 3

Languages

Rust100%

Modules by API surface

src/markdown_formatting.rs22 symbols
src/library.rs12 symbols
src/languages.rs10 symbols
src/extractors.rs9 symbols
src/cli/extract.rs6 symbols
src/cli/mod.rs5 symbols
src/cli/extract_dependency.rs4 symbols
src/main.rs3 symbols

For agents

$ claude mcp add daipendency \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact