Draxl Docs

Quick Start

Run the Draxl Rust profile examples, patch a source file, and check conflicts.

These commands assume a checkout of the Draxl source workspace. Run them from the workspace that contains Cargo.toml, crates/, and examples/.

Run The Example Loop

Validate the smallest example:

cargo run -p draxl-cli -- validate examples/01_add.rs.dx

Print canonical Draxl source:

cargo run -p draxl-cli -- fmt examples/01_add.rs.dx

Inspect the typed IR as JSON:

cargo run -p draxl-cli -- dump-json examples/01_add.rs.dx

Lower the annotated source to Rust:

cargo run -p draxl-cli -- lower examples/01_add.rs.dx

The lower-rust command is also available for the Rust profile:

cargo run -p draxl-cli -- lower-rust examples/01_add.rs.dx

Apply A Patch Stream

Patch streams use semantic operations over node ids and slots. This patch renames function @f1:

// Rename the example entrypoint.
set @f1.name = add_one_fast

Save it as /tmp/rename.dxpatch, then run:

cargo run -p draxl-cli -- patch examples/01_add.rs.dx /tmp/rename.dxpatch

The command prints the patched Draxl source. Add --in-place to rewrite the source file:

cargo run -p draxl-cli -- patch --in-place examples/01_add.rs.dx /tmp/rename.dxpatch

Patch comments that start with // are review notes inside the patch stream. They are ignored during parsing, resolution, and execution.

Check Two Patch Streams

Conflict analysis compares two patch streams against the same base file:

cargo run -p draxl-cli -- conflicts \
  examples/01_add.rs.dx \
  /tmp/left.dxpatch \
  /tmp/right.dxpatch

The command emits structured JSON for humans and agents. Hard conflicts report replay failures or incompatible operations. Semantic conflicts report structurally mergeable edits that still touch coupled meaning-bearing regions.

Use The Agent Server

Draxl can generate a workspace-local Codex MCP configuration:

cargo run -p draxl-cli -- mcp setup --client codex --root .

The stdio MCP server can also run directly:

cargo run -p draxl-cli -- mcp serve --root .

The server exposes tools for inspection, node replacement, statement insertion, scalar field updates, raw patch application, and conflict checks.

Example Files

The current example set is a guided tour of the Rust profile:

  • examples/01_add.rs.dx shows stable ids, ranks, comments, and lowering.
  • examples/02_shapes.rs.dx shows ranked struct fields and enum variants.
  • examples/03_match.rs.dx shows match arms, guards, <, and unary minus.
  • examples/04_ranks.rs.dx shows lexicographic ranks inside a block.
  • examples/05_use_tree_group.rs.dx shows grouped use trees and paths.

Read Syntax for the file format and Patching for the patch language.

On this page