Search by

cresset / magequery

pingiun

A fast Magento 2 codebase inspector: DI resolution, plugins, events, cron, routes, config across scopes, and live DB introspection. Fetches a prebuilt Rust binary on demand.

Package info

github.com/cresset-tools/magequery

Language:Rust

pkg:composer/cresset/magequery

Statistics

Installs: 22

Dependents: 0

Suggesters: 0

Stars: 9

Open Issues: 3

v0.24.1 2020-01-01 00:00 UTC

README

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:compile and setup:static-content:deploy, reimplemented in Rust.

Install

$ curl -LsSf https://bougie.tools/magequery.sh | sh     # Linux, macOS
> irm https://bougie.tools/magequery.ps1 | iex          # Windows

Run from the Magento root, or pass --root <path>.

Without installing (bgx)

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 compile

magequery: for AI agents and CI

magequery 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 default

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.md

Run 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: build without PHP

$ magecommand di compile                   # generated/code + generated/metadata
$ magecommand static deploy en_US nl_NL    # pub/static

The 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 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.

License

EUPL-1.2.