Code graph
bee graph answers code questions from a local graph of the current Git checkout.
It needs no MongoDB connection or bee init, and stores its output outside the
repository under Bee’s local home.
Build and inspect
Section titled “Build and inspect”Run these commands inside a Git checkout:
bee graph build --jsonbee graph status --check --jsonbee graph skillskill prints guidance you can give an agent; it does not install a hook or write
files. status --check exits 0 for a fresh graph, 6 for a stale graph and
3 when none exists. Use --root /path/to/repo to select another checkout.
Find source ranges with outline
Section titled “Find source ranges with outline”bee graph outline src/Catalog/Product.cs --jsonOutput is JSON, with up to 100 declarations and 12,000 UTF-16 characters by default. Use --limit 1..1000 and --budget 2048..65536 to adjust it. Freshness checks hash the full source tree and project context; the reported inspectionMs shows that work. The ten-second acceptance budget is not a hard I/O timeout. Omitted declarations are incomplete even when the source is fresh; inspect counts. Compact output can share and sample context notes with exact omission counts. Exit codes are 0 complete, 3 missing graph/path, 4 invalid usage and 5 stale, incomplete or unsupported.
Use an existing repository-relative file path. outline lists declarations in
source order with their start and end lines, so an agent can read the relevant
range instead of the whole file. Partial declarations retain their individual
locations. Source bodies are not included.
C# compiler-generated members without their own source declaration are excluded.
Written constructors, positional record properties and members in generated source
files remain available. result.counts.excludedSynthesized reports this separate
count; total, shown and omitted refer to source declarations after filtering.
The command reads the stored graph without building, refreshing or updating its
query timestamp. Check source identity, freshness, coverage and omitted counts
before using the ranges. A missing or older graph may need an explicit
bee graph build; an unknown source identity is not a freshness guarantee.
See bee graph outline --help for output limits. Graph coverage includes C#, Vue/TypeScript/TSX and Swift/Kotlin declarations.
Mobile declaration graphs and compiler analysis are separate capabilities.
C# callers, callees and impact
Section titled “C# callers, callees and impact”Roslyn resolves declarations and call relationships per C# project, including interface and override dispatch. Replace the example symbol with a symbol in your checkout; ambiguous names return candidates instead of guessing.
bee graph callers 'OrderService.Save' --jsonbee graph callees 'OrderService.Save' --jsonbee graph explain 'OrderService.Save' --jsonbee graph impact 'OrderService.Save' --jsonEvery answer includes coverage and freshness. Missing restore outputs or reference
assemblies can reduce resolution; read the reported coverage before treating an
answer as complete. Bee does not run dotnet restore for you.
Compact answers and whole-output budgets
Section titled “Compact answers and whole-output budgets”From beta.11, callers, callees, impact and explain accept these opt-in options:
bee graph callers 'OrderService.Save' --json --compact --output-budget-chars 8000bee graph explain 'src/App.vue' --json --compact --output-budget-chars 8000--compact omits descriptive fields such as display, project and test
from result list items. --output-budget-chars N caps the
entire stdout JSON plus its final newline in UTF-16 code units, with a minimum of
256. Both require --json; either can be used alone. They do not change the
legacy --budget query option, graph coverage or refresh policy.
A successful answer keeps graph/source identity, freshness and coverage.
Read output.truncated, output.omittedItems and output.omittedByPath before
assuming all relationships are present. If the required metadata cannot fit,
the command returns output_budget_too_small and exits 4. Increase the budget.
This is not a token limit or a guarantee of faster queries. With neither option,
the existing JSON format is unchanged.
Vue, TypeScript and TSX
Section titled “Vue, TypeScript and TSX”The graph extracts declarations and static import relationships from .vue, .ts
and .tsx. Vue <script> and <script setup> declarations keep their original
source-file line numbers. Imports can resolve through tsconfig baseUrl, paths
and inheritance, common tsconfig.app.json references and supported literal Vite
aliases. Dynamic configuration is not executed; unsupported imports stay unresolved.
For a checkout containing src/App.vue:
bee graph explain 'src/App.vue' --jsonexplain shows imports and reverse imports. With two existing files or symbol IDs,
path can follow those import edges:
bee graph path 'src/App.vue' 'src/components/Welcome.vue' --jsonUse paths that exist in your checkout. Vue/TS coverage reports calls: "none":
these are declarations and imports, not TypeScript or Vue semantic call targets.
The syntax graph does not reproduce the TypeScript compiler’s source set.
Swift and Kotlin declarations
Section titled “Swift and Kotlin declarations”From beta.12, .swift, .kt and .kts files participate in graph builds and outlines. Run bee graph build --json, then bee graph outline Sources/App.swift --json with a path that exists in your checkout. No Swift compiler, Kotlin compiler or JVM is needed for this parser.
The supported subset includes types, functions, properties and type aliases, with file/type containment and physical line ranges. Imports and inheritance/conformance are syntax relationships. A dependency may be symbolic; cross-file type binding, extension-member merging and semantic calls are not implemented. Coverage explicitly reports calls:none.
Read each file’s parseStatus: parsed means the supported subset was scanned without a diagnostic, not that the program compiles. partial or error retains surviving declarations, reports the limitation and returns exit 5. Sources are limited to 16 MiB, 250,000 tokens and 128 nested scopes. Unsupported syntax must not be treated as an empty, complete file. Existing graphs rebuild for the new extractor version on the next build.
Keep answers current
Section titled “Keep answers current”Source and configuration changes participate in freshness checks. For the
relationship queries, missing graphs
are built on demand; stale graphs may refresh automatically within a bounded time.
--fresh forces refresh and --no-refresh reads the stored graph without rebuilding.
An answer may be labelled stale when a refresh exceeds that bound.
Adding, removing or renaming script modules triggers a full rebuild so an import cannot keep a target that disappeared. Reads and edges remain inside the current checkout. Shell graphs and semantic Vue/TS calls are not included in beta.4.