Rustcmdpev
A command-line Rust Postgres query visualizer, heavily inspired by the excellent (web-based) pev. It started out being ported from gocmdpev
Demo

Documentation
- Docs site source:
docs/ - Docs site instructions:
docs/README.md - Build the docs site (requires
mdbook):
Installation
Use the crates.io install path once a tagged release is published:
For local checkout work before a release is published, install from the workspace:
If you prefer not to install globally, a source-first build still works:
- Install Rust
- Build the workspace:
- Run the binary:
Tagged releases publish platform archives with checksums through .github/workflows/release.yml.
Release tags follow semantic versioning: use vMAJOR.MINOR.PATCH for stable releases and
vMAJOR.MINOR.PATCH-PRERELEASE for pre-release builds.
Stability:
rustcmdpevandrustcmdpev-coreare currently in the0.xseries and should be treated as pre-stable. Both the CLI surface and the library API may change between0.MINORreleases; patch releases remain backward-compatible bug fixes. Seedocs/src/versioning.mdfor the full pre-1.0 stability posture. The0.1.0on crates.io is the legacy 2020 release of the original port; the rewrite ships as0.2.0(seedocs/src/adr-0001-v0.2.0-supersedes-0.1.0.md).
Homebrew is not published yet; the roadmap is to add a tap/formula after v1.0.0 release automation
and install smoke verification are stable. Until then, use cargo install or the tagged release archives.
Quickstart
- Build the CLI:
- Run the bundled example plan:
- Or use the reproducible demo alias:
Overview
Usage
Generate a query plan with all the trimmings by prefixing your query with:
EXPLAIN (ANALYZE, COSTS, VERBOSE, BUFFERS, FORMAT JSON)
Then pipe the resulting query plan into rustcmdpev.
On MacOS you can just grab a query on your clipboard and run this one-liner:
| | |
Cross-platform psql examples for Linux, macOS, PowerShell, and CMD are documented in docs/src/workflows.md.
Quickstart with a bundled example:
Reproducible local demo alias:
Stdin JSON contract (MVP parity)
- When
--inputis not provided, stdin must contain JSON text. - Top-level JSON must be an array with at least one object containing
Plan. - Empty stdin, invalid JSON, or unsupported top-level shape are contract errors and should exit non-zero.
Source of truth: docs/src/parity.md -> "MVP v1 stdin JSON contract".
CLI flags
--input, -i <PATH>: read EXPLAIN JSON from a file instead of stdin--format: output format (pretty,json,table)--color: color policy (alwaysforce ANSI,neverdisable,auto= TTY-detect and respectNO_COLOR)--width: tree render width (default:60)--compat: parity-target mode (--format prettyonly, legacy width60)-v, --verbose: increase log verbosity (warndefault,-v=info,-vv+ =debug)-q, --quiet: reduce logs toerroronlyRUST_LOG: override log filter viatracing-subscriberenv filter syntax
Exit codes
0: success2: input read error (stdin/file)3: invalid/contract-violating input payload4: invalid compatibility flag combination5: output serialization error6: core processing/render error
Run help:
Examples
example.json: canonical bundled sample plan for docs, CI smoke tests, and install verification.examples/basic_seq_scan.json: smallest useful sample plan for smoke tests and docs.examples/hash_join.json: nested tree sample for demos and screenshots.
Local development
View sample output
Testing
To see output from print statements, run with nocapture flag:
cargo test -- --nocapture
Project hygiene commands:
cargo fmt --all -- --checkcargo clippy --workspace --all-targets -- -D warningscargo deny check --all-featuresgit cliff --config cliff.toml