Documentation

Docs / Command line

Graph query commands

query <term> [path], callers <target> [path] and impact <target> [path] accept --repository like status and --json. Repository ID precedence is flag, root's graphvein.yaml, directory basename; see configuration. Storage uses GRAPHVEIN_SQLITE_PATH or explicitly configured GRAPHVEIN_POSTGRES_URL. These commands require an existing current-schema store, open it read-only, and never index or migrate. With SQLite, a read that meets the lock of a running graphvein index waits up to 3 s for it before failing as locked (ADR 0043). Freshness uses status's scan and ignore rules; stale facts produce a warning and successful reads remain exit 0. For external snapshots, this reflects Graphvein's scan rather than the producer's own file inventory.

Query supports --kind, --file (exact relative path), and positive --limit (default 50); total counts every match, and the text form ends with "N more not shown; raise --limit" when the limit cut the list. A term matches a canonical identity, exact display/qualified name, or case-sensitive qualified-name suffix. A callers or impact target is the one match that the term names: an identity, a name, or a suffix that starts at a name boundary (save or .save for User.save, db::open for crate::db::open). A suffix that starts inside a name (Items for listItems) never resolves: with no other match the answer is "no matching target" and lists those nodes as candidates ("names that end with this term inside a name"); several matches are "ambiguous target" with every candidate. Callers walks incoming calls to positive --depth (default 1); impact walks incoming calls/imports/references to positive depth (default 3). Both run on the shared breadth-first walk of change impact and the architecture chain (internal/traverse): depth at most 10 (6 before T042; a project allows 10 too; usage error above it), at most 2,000 reached nodes and at most 200 new nodes from one node per step; every cap that binds is reported (caps, bounds), so a cut never reads as "nothing beyond". Impact also follows outgoing exposes_route, incoming calls_route and incoming contains from a client_call to its owner. Route callers include their client calls and owners (two edge distances even at default depth one). File impact seeds all recursively contained symbols. Traversal is cycle-safe and returns each reached node once at its shortest distance. Ties choose the first path in kind/source/target order; results sort by distance then identity. Targets and file seed symbols are excluded from reached results.

Target lookup with no match or multiple matches exits 1. Ambiguity lists canonical identities to retry. Usage errors exit 2; storage/scan errors exit 1. Queries with no matching nodes return an empty list successfully.

Stable JSON shape

One UTF-8 JSON object followed by LF, with freshness first. Always-present fields are:

target is a wrapped v1 node and appears only on successful traversal target resolution. Wrapped nodes retain every v1 field and add sibling ide: {"link":"vscode://file/...:1:1","line":1,"column":1,"exact":true}, plus "line_only":true (with exact false) when the link names the line without a column (the jetbrains preset on a line with a tab before the node, or on a file that changed since indexing), and "caveat" when a link converted from unchanged source is still not exact: tab_size_unknown (the line-only link after a tab) or column_unit_assumed (the cursor preset, whose column unit is assumed from VS Code). Both are omitted otherwise. Nodes without source spans have ide: null. Indexer contract records remain unchanged. See IDE configuration for units, encoding and inexact fallback behavior. error appears only for failed target resolution (no matching target or ambiguous target). Lookup errors still include freshness. Other operational errors go to stderr and do not emit a response. Empty arrays are always []. Human output starts with freshness, prints IDE links on node lines, includes evidence locations and an inferred confidence label on reached result lines. Impact ends with the matched count and up to 20 call sites as file:line. Additional sites point to --json; missing data is explicitly reported as unavailable. Field meanings and the six fixture responses per language are pinned by CLI/backend golden tests.

Project scope (--project)

callers and impact take --project MANIFEST (the manifest file or its directory; T022, ADR 0075 "Query, impact and change journal"). They then read the project store and traverse every member of the project:

graphvein callers <target> --project MANIFEST [--repository MEMBER] [--depth N] [--json]
graphvein impact <target> --project MANIFEST [--repository MEMBER] [--depth N] [--json]

graphvein changes

graphvein changes [path] shows what a change did to the stored facts and what depends on them (ADR 0056, claim contract in the T019 task record (internal)). It takes --repository like the query commands and opens the store read-only, except where noted.

graphvein changes [path] [--base previous|run:ID|pin:NAME|ref:BASE[..HEAD]]
                  [--group G] [--change C] [--cause C] [--kind K] [--tests] [--raw] [--json]
graphvein changes impact ID [path] [--base B] [--depth N] [--json]
graphvein changes pin NAME [path] [--run ID]
graphvein changes unpin NAME [path]
graphvein changes --project MANIFEST [--base previous|pass:N] [--json]
graphvein changes impact ID --project MANIFEST [--repository MEMBER] [--base B] [--depth N] [--json]

Exit codes: 0 on success, 2 for usage errors (an unknown base form, a missing ID), 1 for everything else, including the first run (no previous run to compare with), an unknown or expired base, an unknown pin, a held index lock and git or ref errors.

Report a problem with this pageSource: docs/cli/queries.md