Skip to content

Query Language

CapsaicinBunny edited this page Jun 21, 2026 · 2 revisions

Query Language

A small text query language for selecting and isolating subgraphs — available in the app's query bar and as saved searches. It's a real parser (lib/graph/query-language/: tokenizeparseevaluate over the graph + computed metrics), not substring matching.

Quick examples

incoming:>5                                   # high fan-in modules
kind:function | kind:method  incoming:>0      # the public API surface
role:react-component                          # the React rendering tree
depends-on:"database"                         # anything reaching a "database" node
cycle:true                                    # nodes participating in a cycle

Fields

A predicate is field:value (or field:OP value for numeric comparisons).

Field Matches
kind Node kind — kind:class, kind:function, … (see The Graph Model)
role Framework/paradigm role — role:react-component, role:angular-service, …
language / lang Source language — lang:rust
path File path glob — path:src/ui/**
package / pkg Enclosing package
environment / env client / server
runtime Detected runtime tag
category UI-vs-feature category
dependency-type / dep For externals — dependency / devDependency / peer / undeclared
incoming In-degree — numeric (incoming:>5)
outgoing Out-degree — numeric
calls Call-edge count — numeric
cycle cycle:true — participates in a cycle
depends-on: Reachability — selects everything that can reach the matched target(s)

Anything that isn't a known field is treated as a text match against node labels, so UserService on its own works.

Operators

  • Numeric comparisons: >, <, >=, <=, = — e.g. outgoing:>=10.
  • Boolean: and (also implicit — juxtaposition means and), or (or |), not (or -).
  • Grouping: parentheses — (kind:function | kind:method) incoming:>0.
  • Path queries: A -> B — selects paths from nodes matching A to nodes matching B.

Grammar (informal)

query   := orExpr ( "->" orExpr )?
orExpr  := andExpr ( ("|" | "or") andExpr )*
andExpr := unary ( ["and"] unary )*
unary   := ("-" | "not") unary | atom
atom    := "(" orExpr ")" | predicate | text

Presets

Common questions ship as presets (presets.ts) you can pick and tweak:

Preset Query
Public API (kind:function | kind:method | kind:class | kind:interface) incoming:>0
High-impact modules incoming:>5
React rendering tree role:react-component | kind:component
Database access depends-on:"database" | depends-on:"db"
Circular dependencies cycle:true

How it relates to filters

Filters are coarse, checkbox-driven narrowing (by kind, language, folder…). The query language is for structured, composable selection — degree thresholds, reachability, paths, boolean logic — that filters can't express. The result is a subgraph you can then lay out, export, or save as a workspace.

Clone this wiki locally