Before you can ask the code graph anything, you have to build it. The vg build command maps your source code into a graph artifact that powers every downstream query. This guide walks through your first build and what to expect.
Prerequisites
You need the Vibgrate CLI installed and a project to analyze. Run the build from the root of the repository you want to map.
Build the graph
From your project root, run:
vg build
The command analyzes your source files and produces the code map. The first build does the full work of parsing and resolving relationships. Subsequent builds are incremental — they update only what changed, so they are much faster.
What the build produces
The result is the code graph artifact: nodes for functions, methods, classes, and files, plus edges for calls, imports, and dependencies. This artifact is what vg show, vg ask, vg impact, vg path, and vg tree all read from.
Confirm it worked
After the build, try a single-node query to confirm the graph is usable:
vg show
vg ask
If those return structured information about your code, the build succeeded and you are ready to explore.
Incremental builds
You do not need to rebuild from scratch as you work. Run vg build again after making changes and it updates the graph incrementally. This keeps the graph aligned with your working tree without a long wait.
vg build
Tips for a clean first build
- Run from the repository root so the graph covers the whole project.
- Build before a big review or refactor so your queries reflect current code.
- Re-run
vg buildwhenever you have made meaningful changes and want fresh answers.
Related
Once the graph exists, read the guide on keeping the graph up to date, then move on to visualizing nodes with vg show and asking natural-language questions with vg ask.