repo-graph

v0.5.4
io.github.James-Chahwan/repo-graph Checked 4 days ago Published 1 month ago

Structural graph map of any codebase so LLMs navigate by structure, not guesswork.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

orient

Get the lay of the land — ALWAYS the first call on a codebase. With no arguments: a counts + entry-points overview plus a `blind spots` note flagging which (language, edge-kind) extractions are partial so you know where to fall back to grep. With `seed=<node>`: the dense structural map scoped to that node's neighbourhood. With `full=true`: the whole-repo dense map (the full context dump). Orient first, then `find` to jump to nodes, `impact` for blast radius, `trace` for flows.

ParameterTypeDescription
budgetintegerMax chars in the result. 0 = default cap (~50k for the full map, uncapped otherwise).
fullbooleanWith no seed: return the whole-repo dense structural map instead of the counts overview. Ignored when seed is given.
seedstringOptional node/qname to scope the map around (its activated neighbourhood). Blank = repo overview.

find

Turn any text into the ranked nodes that matter — the on-ramp to the graph. A symbol or keyword returns matching nodes; a pasted stacktrace / failing-test id / diff is resolved to the code it implicates and ranked by relevance. Set `expand=true` to fan out to the surrounding neighbourhood (spreading activation). Every row carries `path:line`, so `read` the top hits directly — no grep.

ParameterTypeDescription
query *stringWhat to locate: a symbol/keyword (e.g. `User`, `checkout`), OR a failure signal — paste a raw stacktrace, a failing-test id (path::test), or a unified diff / changed-file list.
budgetintegerMax chars in the result. 0 = no cap.
expandbooleanReturn the relevant neighbourhood (Personalized-PageRank ranked) around the matches, not just the matches themselves. Use to discover what surrounds a seed.
kindstringForce the signal type: 'symbol', 'stacktrace', 'test', 'diff', or 'auto' (sniff the shape).
top_kintegerMax results. Default 20.

impact

Blast radius in one call: fan out from one or more nodes to everything they affect (forward) or depend on / are used by (backward), returned as a deduped, ranked, located closure. Ranking is co-change first where the repo has git history synced, then Personalized PageRank. Each row carries `path:line`, the edge `via` reason it's in scope, and a `⊘` when the engine finds it unreachable from any entry point (likely dead). Structural import/containment fan-out is excluded, so there's no noise. A large radius comes back as the top rows plus the areas and files the rest fall in; page with `offset…

ParameterTypeDescription
nodes *stringOne or more node names/qnames, comma-separated. A diff touching N symbols is one call.
budgetintegerMax chars in the result. 0 = no cap.
depthintegerHow many hops to fan out. Default 4.
directionstring'forward' (what it affects), 'backward' (what it depends on / who uses it), or 'both'. (Aliases: downstream=forward, upstream=backward.)
fullbooleanEvery row, uncut. Can be thousands of rows on a hub node; prefer scope/offset.
live_onlybooleanDrop nodes not reachable from any entry point (likely-dead code). Default False = show all, marking dead ones ⊘.
offsetintegerSkip the first N ranked rows to read the next page. The footer names the next offset.
scopestringOnly rows under this repo-relative path or project label. Use an area's scope from the footer to drill into it.
top_kintegerRows to return. 0 = the engine's overview: the top 25 rows plus the areas the rest fall in, so you can drill down with `scope`.

trace

Follow the code across boundaries. One argument: trace a feature end-to-end — the ordered path from entry through the stack, each hop labelled with its mechanism (call / HTTP / queue / event / data), crossing service boundaries (frontend→backend). Two arguments: the shortest path between two specific nodes, hop by hop. This is where the graph beats reading many files — it knows the cross-stack links grep can't see.

ParameterTypeDescription
from_node *stringA feature/keyword to trace end-to-end (one arg), OR the start node when tracing a path to `to_node`.
budgetintegerMax chars in the result. 0 = no cap.
depthintegerMax hops for the cross-stack feature trace. Default 6.
to_nodestringOptional target node. Given → shortest path from_node→to_node. Blank → trace `from_node` as a feature across the stack.

read

Return the source code for one or more nodes, sliced from their files by the graph's line spans. Use after `find`/`impact` to read the exact code without grepping — comma-separate several node names to read the whole ranked set in a single call. Each node is a code block headed by its qname and `path:start-end`, plus a `context:` footer with structural facts the source alone doesn't show: HTTP method, cross-stack callers (or, on a WS / gRPC / GraphQL / tRPC client, the host it dials), covering tests, and intent/decision/constraint cells when present.

ParameterTypeDescription
node *stringNode name or qname to read. Comma-separate several (e.g. the top-ranked nodes from `find`/`impact`) to slice them all in one call.
budgetintegerMax chars in the result (shared across all nodes when several are given). 0 = no cap.
context_linesintegerLines of padding above and below the node's span. Default 0.

refresh

(Re)build the structural graph with tree-sitter AST parsing across 20 languages, running the cross-stack resolvers (HTTP, gRPC, GraphQL, WebSocket, queues, events, CLI). Incremental by default — only changed files re-parse — so it's cheap to call after edits; set `full=true` to force a clean reparse. Accepts a local path or a git URL (cloned on demand). Call after a major refactor; routine edits are picked up automatically by the file watcher.

ParameterTypeDescription
fullbooleanForce a full reparse instead of reusing the per-file parse cache. Default False (incremental — only changed files re-parse, so this is cheap after edits).
repo_pathstringPath or git URL to (re)scan. Blank = the repo the server is serving. A different path/URL retargets the server at it.