Skip to main content

Module code

Module code 

Source
Expand description

Code structure graph — code.graph, code.query, code.affected_by, fragment.search.

Port of the v26 CodeStructureGraph surface: scan a project, extract symbols (functions, classes, methods, imports) and edges (calls, imports, inheritance), then answer structural questions:

  • code.graph — build (or refresh) the graph for a project root
  • code.query — natural-language queries: “what calls X”, “what does X call”, “path from A to B”, “explain X”, “god nodes”, “search X”
  • code.affected_by — everything transitively affected by changing a symbol (reverse call-graph BFS)
  • fragment.search — locate the file/line fragments mentioning a query

Extraction is regex-based per language (no parser dependency), bounded by file count and file size, and the graph is shared across calls so a single code.graph build serves many queries.

Structs§

CodeAffectedByTool
code.affected_by — find symbols affected by a change.
CodeEdge
A directed relationship between two nodes.
CodeGraph
The shared code structure graph.
CodeGraphTool
code.graph — build (or refresh) the code structure graph.
CodeNode
A symbol in the code graph.
CodeQueryTool
code.query — natural-language queries against the code graph.
FragmentSearchTool
fragment.search — locate code fragments mentioning a query.

Functions§

register_code
Register the code tools (4) against a shared graph.