Fast Magento 2 tooling that reads the source directly: no PHP, no database, no booting the framework. Two binaries:
- magequery answers how a codebase is wired (DI, plugins, events, routes, config, …), each result citing the file and line it came from.
- magecommand builds it:
setup:di:compileandsetup:static-content:deploy, reimplemented in Rust.
$ curl -LsSf https://bougie.tools/magequery.sh | sh # Linux, macOS
> irm https://bougie.tools/magequery.ps1 | iex # WindowsRun from the Magento root, or pass --root <path>.
bougie's bgx (like npx) runs either tool in an isolated,
globally-cached environment without adding it to your project. Everything after the package is
forwarded straight to the tool:
$ bgx cresset/magequery doctor
$ bgx cresset/magequery di 'Magento\Catalog\Api\ProductRepositoryInterface'
$ bgx cresset/magecommand di compilemagequery doctor checks every config reference in the codebase against what is on disk:
missing classes, cycles, forgotten wiring. It runs in milliseconds and exits non-zero on
errors, so it works as a CI gate:
- uses: cresset-tools/magequery-action@v1 # runs doctor by defaultOn an existing shop, magequery doctor --generate-baseline accepts today's findings into
magequery-baseline.json (commit it), so CI fails only on new ones, as with phpstan's
baseline.
The agent skill teaches a coding agent to ask magequery wiring questions instead of grepping or booting Magento:
$ mkdir -p .claude/skills/magequery
$ magequery skill > .claude/skills/magequery/SKILL.mdRun magequery --help for the other commands (di, plugins, events, config, sql, …).
magequery lsp is a language server for the XML config layer; see editors/.
$ magecommand di compile # generated/code + generated/metadata
$ magecommand static deploy en_US nl_NL # pub/staticThe output matches a real bin/magento run; di verify and static verify diff it against
one. di digest gives a CI cache key for generated/, and di watch keeps it compiled while
you edit. magecommand db status, config status, theme status and queue status tell a
deploy whether setup:upgrade or app:config:import has work to do, with bin/magento's exit
codes (2 = work to do) and no PHP bootstrap. In development, magecommand dev upgrade replaces
bin/magento setup:upgrade: it does the upgrade natively, and runs PHP only for PHP code (a
third-party recurring setup script, or the whole command for a schema change or patch). Without PHP
it tells you what is left. magecommand skill prints its agent skill.
In a PHP project, composer require --dev cresset/magecommand gives you
vendor/bin/magecommand (cresset/magequery ships both tools).
For a whole deploy build in one step (composer install, DI compile, and static deploy, run in parallel), use magebuild.