Skip to content

garden code

Code intelligence: search symbols, jump to definitions

Terminal window
garden code

Code intelligence backed by the SCIP index.

Queries run against the default branch’s head by default (your local working commit isn’t indexed yet); target a specific commit with –commit or a PR’s latest revision with –pr.

Find the functions that call a symbol, by name

Terminal window
garden code callers <name>
Flag Type Default Description
--commit string Ref or commit hash to query (default: the default branch’s head)
--json bool Output as JSON
--kind string Disambiguate by kind (function, type, method, …)
-o, --org string Organization slug (defaults to the checkout’s org)
--path string Disambiguate by a path substring
--pr int 0 Query the given PR’s latest revision instead of a commit
-R, --repo string Repository slug (defaults to the current checkout)

Show a symbol’s definition, with source inlined

Terminal window
garden code def <name>

Resolve a symbol by name and print its definition location(s) with the defining source inlined. If several symbols share the name, all are shown — narrow with –kind or –path.

Flag Type Default Description
--commit string Ref or commit hash to query (default: the default branch’s head)
--context int 3 Lines of source context around the definition
--json bool Output as JSON
--kind string Disambiguate by kind (function, type, method, …)
-o, --org string Organization slug (defaults to the checkout’s org)
--path string Disambiguate by a path substring
--pr int 0 Query the given PR’s latest revision instead of a commit
-R, --repo string Repository slug (defaults to the current checkout)

Show a symbol’s documentation / signature, by name

Terminal window
garden code hover <name>
Flag Type Default Description
--commit string Ref or commit hash to query (default: the default branch’s head)
--json bool Output as JSON
--kind string Disambiguate by kind (function, type, method, …)
-o, --org string Organization slug (defaults to the checkout’s org)
--path string Disambiguate by a path substring
--pr int 0 Query the given PR’s latest revision instead of a commit
-R, --repo string Repository slug (defaults to the current checkout)

Find references to a symbol, by name

Terminal window
garden code refs <name>
Flag Type Default Description
--commit string Ref or commit hash to query (default: the default branch’s head)
--include-decl bool Include the declaration itself among the references
--json bool Output as JSON
--kind string Disambiguate by kind (function, type, method, …)
-o, --org string Organization slug (defaults to the checkout’s org)
--path string Disambiguate by a path substring
--pr int 0 Query the given PR’s latest revision instead of a commit
-R, --repo string Repository slug (defaults to the current checkout)

Search symbols by name, container, path, or doc comment

Terminal window
garden code search [query]

Search code symbols across the indexed commit.

A bare query is matched as a case-insensitive substring against every field — symbol name, container, file path, and doc comment — so garden code search Doc finds symbols named, located in, or documented with “Doc”. Narrow with –kind, switch to regex with –regex, or supply a raw AIP-160 expression with –filter.

Flag Type Default Description
--commit string Ref or commit hash to query (default: the default branch’s head)
--filter string Raw AIP-160 filter, overriding the query (e.g. ‘name:“Foo” AND kind=“type”’)
--json bool Output as JSON
--kind string Only symbols of this kind (function, type, method, …)
--limit int 0 Maximum symbols to return
-o, --org string Organization slug (defaults to the checkout’s org)
--pr int 0 Query the given PR’s latest revision instead of a commit
--regex bool Match the query as an RE2 regex instead of a substring
-R, --repo string Repository slug (defaults to the current checkout)