I provide static analysis data for GT visualization.
I use :xref to extract module-level call graphs from compiled
BEAM files and GtBridge.Beam.docs/1 for documentation coverage.
I return raw data — GT builds the views.
Sibling modules cover related subsystems split out from this one:
GtBridge.HotReload (hot_reload + compile dep edges),
GtBridge.DepGraph (app dep trees + root_apps),
GtBridge.Mnesia (table introspection),
GtBridge.Supervision (process tree), and
GtBridge.Eval.Preamble (editor session import-loading).
Summary
Functions
I return all function definitions with complete line ranges.
I return per-module doc coverage with function-level detail for an app.
I return example dependency data for a module that uses ExExample.
I return exported functions for a module (works for both Elixir and Erlang).
I answer whether the Functions view should show a tab for mod, without
building or serializing the full function list.
I return per-module metadata for an application.
I return application names matching a substring query.
I return exported functions matching a query within an app.
I return module names matching a substring query, limited to max results.
I return documentation coverage grouped by application.
I return system info for the Overview view.
I return aggregate stats across all loaded applications.
Functions
I return all function definitions with complete line ranges.
Each entry includes :start (extended back to include @doc/@spec),
:end_line, :name, :arity, :kind, :sig, and :source
(the source text for that function including annotations).
AST entries are merged with runtime exports from __info__(:functions)
so macro-generated functions (e.g. defview, defstruct field
accessors, etc.) are visible. Runtime-only entries get default
start: 0, end_line: 0, kind: :def, and a placeholder source.
Type rows come from the source alone: a module with no readable source (an OTP beam compiled elsewhere) lists only its exported functions.
I return per-module doc coverage with function-level detail for an app.
Each entry has :module, :has_mod_doc, and :functions (list of
%{name: String.t(), has_doc: boolean()}).
I return example dependency data for a module that uses ExExample.
I return exported functions for a module (works for both Elixir and Erlang).
I answer whether the Functions view should show a tab for mod, without
building or serializing the full function list.
A public (non-__) function guarantees all_functions/1 is non-empty:
its runtime-export branch reads the same __info__(:functions), so any
such function ends up in the result. That check settles the common
module in ~1ms. Only when there's no public function do I fall back to
the source-parsing all_functions/1, which also finds defp-only,
macro-only, and struct modules. So the answer is identical to
all_functions(mod) != [] — just cheaper for the common case.
I return per-module metadata for an application.
@spec search_apps(String.t(), pos_integer()) :: [String.t()]
I return application names matching a substring query.
@spec search_functions(atom(), String.t(), pos_integer()) :: [map()]
I return exported functions matching a query within an app.
@spec search_modules(String.t(), pos_integer()) :: [String.t()]
I return module names matching a substring query, limited to max results.
@spec system_doc_coverage() :: [map()]
I return documentation coverage grouped by application.
Each entry has :app (string name) and :modules (list of
%{name: String.t(), has_doc: boolean()}). Used by the GT-side
doc coverage heatmap.
@spec system_info() :: map()
I return system info for the Overview view.
@spec system_stats() :: map()
I return aggregate stats across all loaded applications.
Returns a map with :apps, :modules, :functions,
:with_docs, and :with_source counts.