Skip to main content

Module routes

Module routes 

Source
Expand description

API route definitions and handlers for the ICB server.

§Overview

This module exposes a REST API consumed by the ICB dashboard. All routes are mounted under /api and operate on a shared CodePropertyGraph that is built once at startup and held in an Arc<Mutex<…>>.

§Endpoints

MethodPathDescription
GET/api/graphSubgraph filtered by kind, focus, depth, max nodes, cycle/dead highlights
GET/api/nodeDetailed information about a single function
GET/api/functionsAll function metrics
GET/api/classesAll class metrics
GET/api/filesPer‑file aggregate metrics
GET/api/diffCompare two projects or cached graphs
POST/api/loadLoad a new project, auto‑detecting its language
POST/api/uploadUpload a ZIP archive and analyse it
GET/api/call-treeCall tree from a root function or forest of all roots (*)

§Security

In its current form the server is intended for local use. The diff endpoint can read arbitrary files reachable from the server process; restrict network access appropriately.

Structs§

CallTreeQuery 🔒
Parameters for the call‑tree endpoint.
DiffQuery 🔒
Parameters for the diff endpoint.
GraphQuery 🔒
Parameters for the graph endpoint.
LoadRequest 🔒
Payload for the load endpoint.
TreeNode 🔒
A single node in the call tree returned to the client.

Functions§

build_call_tree 🔒
Recursively build a call tree from node_idx.
configure
find_node_index_by_name 🔒
Look up a node index by name (linear scan, used only for annotations).
find_root_functions 🔒
Collect every function (or class) that has no incoming Edge::Call edges – i.e. the roots of the call forest.
focal_graph 🔒
Build a subgraph centred on a specific function.
get_call_tree 🔒
Return a call tree (or forest) starting from the requested root.
get_classes 🔒
Return all class metrics.
get_diff 🔒
Compare two projects or cached graphs and return a diff report.
get_files 🔒
Return per‑file aggregate metrics.
get_functions 🔒
Return all function metrics.
get_graph 🔒
Return a subgraph of the main CPG, filtered by the given parameters.
get_node_detail 🔒
Return detailed information about a single function.
post_load 🔒
Load a new project, auto‑detecting its language.
subgraph_by_kind 🔒
Build a subgraph limited to nodes of a given kind.