Skip to Content

references

List everything that references a symbol or type — calls, type usage, heritage, instantiation, and value reads. Broader than who-calls, which only follows CALLS.

Source: src/commands/references_command.ts · query: GraphQuery.references in src/query/graph_query.ts

Synopsis

npx codespine references <id> [options]

Arguments

ArgumentRequiredDescription
<id>yesNode id of the symbol or type to inspect. Obtain it from find --json.

Options

OptionDefaultDescription
-o, --output-folder <dir>./.codespineOutput folder; the Kùzu database is read from <dir>/graph.kuzu.
--jsonfalseEmit raw JSON instead of the formatted table.

What it does

Returns every node with a reference-kind edge pointing inbound at the target:

MATCH (n:GraphNode {id: $id})<-[e:Edge]-(other:GraphNode) WHERE e.kind IN ['CALLS', 'IMPLEMENTS', 'EXTENDS', 'USES_TYPE', 'RETURNS', 'PARAM_TYPE', 'INSTANTIATES', 'READS'] RETURN other.*, e.kind AS edgeKind ORDER BY edgeKind, filePath, startLine

Reference-kind edges

The ten edge kinds that count as a “reference” are:

EdgeMeaning
CALLSthe symbol is called
IMPLEMENTSa class implements this interface
EXTENDSa class/interface extends this one
USES_TYPEthis type is used in a type position
RETURNSa function returns this type
PARAM_TYPEa parameter has this type
INSTANTIATESthis class is constructed (new)
READSthis value identifier is read
OVERRIDESa method overrides this base member
HANDLESan HTTP endpoint is routed to this handler

Structural, mutation, and the system-level config/HTTP edges — CONTAINS, IMPORTS, EXPORTS, WRITES, READS_CONFIG, CALLS_EXTERNAL — are deliberately not counted as references. This is the same set dead-exports uses to decide whether a symbol is unused.

All reference edges require a --semantic extraction.

Output

Formatted (default) — each line shows direction (always inbound, <-), the edge kind, and the referencing symbol:

<- CALLS run src/store/kuzu_store.ts:49 <- USES_TYPE load src/store/kuzu_store.ts:80 2 edge(s)

JSON (--json) — an array of NeighborRef objects: a SymbolRef plus edgeKind and direction ("in"). No references yields (no neighbours) / [].

Examples

# every reference to a type alias — calls, type usage, heritage, reads npx codespine references 'TypeAliasDeclaration:src/schema/node.ts#GraphNode@37' # machine-readable npx codespine references 'TypeAliasDeclaration:src/schema/node.ts#GraphNode@37' --json
QuestionCommand
Who calls this (CALLS only)?who-calls
Who references this in any way (8 reference kinds)?references
Every edge touching this, both directions, all kinds?neighbors

Use references to judge whether a symbol is safe to remove: zero references (member-aware) is what makes a symbol dead.

Notes and caveats

  • Only static references are captured. Dynamic access (string-keyed lookups, reflection) is invisible, so “zero references” means “no static references”.
  • Empty results may also mean a stale id — re-run find to confirm.

See also

  • who-calls — the narrower, calls-only view.
  • dead-exports — applies this reference set across all exports.
  • neighbors — all edges, both directions.
Last updated on