It would have helped potential readers to know that this project is both in, and for, JavaScript, unlike the PMD project that I mentioned which offers that same XPath querying but for a bunch of target languages
for work, i wrote a tool that takes an astroid AST tree and translates it into XML (in memory), which are very close in spirit since they're both tree-like structures. this lets one write linter tools using familiar XPath queries and assert on the results. it's good for some kinds of pattern/anti-pattern enforcement.
It does other things too, but one of the key features is reading the AST. It's a bit of a prototype but if you want to jam together on a project I'd be open to it.
Your tool is _much_ more powerful than what I've been doing. I've been looking at things like 'what proportion of functions have docstrings, and what format are they in?' or 'how much of our codebase is using typing?'
Yours is much more ambitious, if I understand it correctly?
I hope in addition to the cute operators they also support actual XPath, since it'd be less reinventing the wheel for those who already know XPath
Also, prior art for static analysis using XPath: https://pmd.github.io/pmd-6.47.0/