Build a Code Graph from Your Repository with Vibgrate Graph
Build your first code graph with vg build and confirm it is ready. The graph artifact powers every downstream Vibgrate Graph query, fully offline after the first build.
Vibgrate Graph turns your source tree into a structural graph artifact — nodes for functions, classes, and modules, edges for calls and imports. That graph is the foundation for every other query: vg show, vg ask, vg impact, vg path, vg tree, and the map-level insights. This tutorial builds your first graph.
Prerequisites
- A source repository you can scan
- Node.js installed
Steps
1. Install the Vibgrate CLI
npm i -g @vibgrate/cli
Prefer no install? Use npx @vibgrate/cli for any command.
2. Initialize Vibgrate in the project
vg init
This creates the .vibgrate directory and config file so artifacts have a home.
3. Build the code graph
vg build
vg build maps your source code into a graph artifact incrementally. The first run indexes the whole tree; later runs only reprocess what changed. The artifact powers all downstream queries — fully offline after this point.
4. Check graph status
vg status
vg status reports graph freshness, node and edge counts, staleness, and the resolver rungs used. It compares the committed graph against your current working tree so you can see whether the graph is up to date.
5. Rebuild incrementally after edits
After you change code, run:
vg build
The incremental build keeps the graph current without a full re-index, so it stays fast on large repositories.
Verification
Run vg status and confirm node and edge counts are non-zero and that staleness reports the graph matches your working tree. A healthy build means downstream commands like vg show and vg ask will return results immediately.
Next Steps
- Explain a single node with
vg show - Ask the graph a question with
vg ask - Map architectural hubs with
vg hubs
Prerequisites
- A source repository
- Node.js installed
Steps
- 1Install the Vibgrate CLI
- 2Initialize Vibgrate in the project
- 3Build the code graph
- 4Check graph status
- 5Rebuild incrementally after edits