Skip to main content

Module interface

Module interface 

Source
Expand description

Interface command - Public API extraction

Extracts the public interface (API surface) from source files. Supports all languages with tree-sitter grammars: Python, Rust, Go, TypeScript, JavaScript, Java, C, C++, Ruby, C#, Scala, PHP, Lua, Luau, Elixir, and OCaml.

§Features

  • Extracts public functions (language-appropriate visibility rules)
  • Extracts public classes/structs/traits with their public methods
  • Captures export declarations when present (e.g., Python __all__)
  • Marks async functions/methods
  • Includes function signatures with type annotations
  • Includes docstrings/doc comments when present

§Example

tldr interface src/api.py
tldr interface src/lib.rs
tldr interface src/ --format text

Structs§

InterfaceArgs
Arguments for the interface command.

Functions§

extract_all_exports
Extract the contents of __all__ if defined in the module (Python only).
extract_class_info
Extract class/struct/trait information from a definition node.
extract_function_info
Extract function information from a function definition node.
extract_function_signature
Extract the function signature from a definition node.
extract_interface
Extract the public interface from a source file.
extract_interface_with_lang
Extract the public interface from a source file with an explicit language.
format_interface_text
Format interface info as human-readable text.
is_public_name
Check if a name is public based on language conventions.
run
Run the interface command.