MCPcopy Index your code
hub / github.com/estools/esquery

github.com/estools/esquery @v1.6.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v1.6.0 ↗ · + Follow
114 symbols 287 edges 36 files 16 documented · 14%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

ESQuery is a library for querying the AST output by Esprima for patterns of syntax using a CSS style selector system. Check out the demo:

demo

The following selectors are supported: * AST node type: ForStatement * wildcard: * * attribute existence: [attr] * attribute value: [attr="foo"] or [attr=123] * attribute regex: [attr=/foo.*/] or (with flags) [attr=/foo.*/is] * attribute conditions: [attr!="foo"], [attr>2], [attr<3], [attr>=2], or [attr<=3] * nested attribute: [attr.level2="foo"] * field: FunctionDeclaration > Identifier.id * First or last child: :first-child or :last-child * nth-child (no ax+b support): :nth-child(2) * nth-last-child (no ax+b support): :nth-last-child(1) * descendant: ancestor descendant * child: parent > child * following sibling: node ~ sibling * adjacent sibling: node + adjacent * negation: :not(ForStatement) * has: :has(ForStatement), :has(> ForStatement) * matches-any: :matches([attr] > :first-child, :last-child) * subject indicator: !IfStatement > [name="foo"] * class of AST node: :statement, :expression, :declaration, :function, or :pattern

Build Status

Core symbols most depended-on inside this repo

peg$fail
called by 76
parser.js
peg$parse_
called by 36
parser.js
peg$literalExpectation
called by 26
parser.js
getMatcher
called by 12
esquery.js
getPath
called by 11
esquery.js
peg$classExpectation
called by 9
parser.js
peg$parseidentifierName
called by 9
parser.js
getRollupObject
called by 6
rollup.config.js

Shape

Function 114

Languages

TypeScript100%

Modules by API surface

parser.js92 symbols
esquery.js17 symbols
tests/querySubject.js1 symbols
tests/queryPseudoChild.js1 symbols
tests/queryClass.js1 symbols
tests/matches.js1 symbols
rollup.config.js1 symbols

For agents

$ claude mcp add esquery \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact