<img src="https://raw.githubusercontent.com/morgenthum/bevy_xray/main/logo.png" alt="Bevy X-Ray" width="480">
[](https://github.com/morgenthum/bevy_xray/actions/workflows/ci.yml)
[](https://crates.io/crates/bevy_xray)
[](LICENSE-MIT)
[](https://www.rust-lang.org)
A static analysis tool that visualizes <a href="https://bevyengine.org/">Bevy</a> game engine internals — state hierarchies, plugin dependencies, schedule configurations, and system set ordering.
## Screenshots
<figure>
<img src="https://raw.githubusercontent.com/morgenthum/bevy_xray/main/tui_states.png" alt="TUI — State Hierarchies" width="720">
<figcaption><em>TUI — State hierarchy with sub-states, computed states, and related plugins (source: Wild Spikes, theme: rose-pine)</em></figcaption>
</figure>
<figure>
<img src="https://raw.githubusercontent.com/morgenthum/bevy_xray/main/tui_plugins.png" alt="TUI — Plugin Dependencies" width="720">
<figcaption><em>TUI — Plugin details with sub-plugins, schedule usage, and system ordering (source: <a href="https://github.com/bevyengine/bevy">Bevy</a>, theme: dawn)</em></figcaption>
</figure>
<figure>
<img src="https://raw.githubusercontent.com/morgenthum/bevy_xray/main/html_systemsets.jpg" alt="HTML — System Sets" width="720">
<figcaption><em>HTML export — System set ordering with chain constraints and schedule grouping (source: <a href="https://github.com/avianphysics/avian">Avian Physics</a>, theme: moon)</em></figcaption>
</figure>
## Features
- **State Hierarchies** — Extracts `States`, `SubStates`, and `ComputedStates` with their relationships
- **Plugin Dependencies** — Maps plugin registrations, sub-plugins, and plugin groups
- **Schedule Configurations** — Parses `Update`, `FixedUpdate`, and custom schedules with system ordering
- **System Sets** — Tracks set definitions and ordering constraints (`before`, `after`, `chain`)
- **Multiple Output Formats** — Interactive TUI, JSON export, and self-contained HTML visualization
## Installation
```sh
cargo install bevy_xray
```
## Usage
Point `bevy-xray` at a Bevy workspace:
```sh
# Launch interactive TUI
bevy-xray --path /path/to/bevy/workspace
# Export as JSON
bevy-xray --path /path/to/bevy/workspace --json
# Export as self-contained HTML
bevy-xray --path /path/to/bevy/workspace --html > output.html
# Use a different theme (rose-pine, moon, dawn)
bevy-xray --path /path/to/bevy/workspace --theme dawn
```
### CLI Options
| `--path` | Path to Bevy workspace root | `.` |
| `--json` | Export as JSON | — |
| `--html` | Export as self-contained HTML | — |
| `--theme` | Color theme: `rose-pine`, `moon`, `dawn` | `rose-pine` |
## Compatibility
| bevy_xray | bevy |
> **Note:** bevy_xray uses static analysis using `syn`, so it may need updates when Bevy introduces new API patterns.
## Project Structure
```
crates/
├── bevy_xray/ # TUI application and CLI
└── bevy_xray_parser/ # Static analysis and parsing library
```
## License
Licensed under either of
- Apache License, Version 2.0 ([LICENSE-APACHE](LICENSE-APACHE) or <http://www.apache.org/licenses/LICENSE-2.0>)
- MIT license ([LICENSE-MIT](LICENSE-MIT) or <http://opensource.org/licenses/MIT>)
at your option.