Build a text representation of a single graph node
Source:R/context_assemble.R
build_node_context.RdReturns a character string representing node_name. Two modes
are supported:
Usage
build_node_context(node_name, graph, mode = c("auto", "full", "compressed"))Details
- full (seed / primary nodes)
Full function signature, Roxygen comment block (if present), and body text. Used for the core nodes that the LLM must understand in detail.
- compressed (supporting nodes / package nodes)
A compact representation consisting of the signature, a one-line description, a Calls list, and a Called by list. Targets a compression ratio \(\geq 3\times\) vs.\ the full source (measured in approximate token units).
Package nodes (type "package") always use compressed mode,
regardless of the mode argument.
Examples
if (FALSE) { # \dontrun{
g <- build_rrlm_graph("mypkg")
cat(build_node_context("utils::load_data", g, mode = "full"))
cat(build_node_context("utils::clean_data", g, mode = "compressed"))
} # }