Skip to main content
ubx compile runs the full XCL pipeline (lex → parse → typecheck → IR → plugin Compile RPC) and writes the generated code artifact — but does not deploy. It’s useful for previewing generated output, artifact caching in CI, and debugging.

Usage

ubx compile [path] [flags]

Flags

FlagDescription
--allCompile all stacks in the workspace (topology order)
--out <dir>Write output to this directory instead of .ubx/
--planWrite an --out-style plan JSON alongside the artifact
--target <binding>Limit compilation to specific resource bindings (repeatable)

Examples

ubx compile                        # compile current stack
ubx compile --all                  # compile all stacks
ubx compile --out ./artifacts      # write to custom directory
ubx compile --target networking.vpc  # compile with only specific targets
ubx compile --plan                 # write plan JSON alongside artifact

Generated artifacts

For pulumi + python engine, ubx compile writes to .ubx/:
.ubx/
├── __main__.py        # Pulumi Python program
├── requirements.txt   # pulumi>=3.0.0,<4.0.0 + provider packages
└── Pulumi.yaml        # project metadata (stack name from dir name)
The stack name in Pulumi.yaml is derived from filepath.Base(dir). requirements.txt format:
pulumi>=3.0.0,<4.0.0
pulumi-aws>=1.0.0
pulumi-kubernetes>=1.0.0
For terraform/opentofu engine:
.ubx/
└── main.tf

Workspace vs single-stack

  • Without --all: single-stack path — invokes the plugin’s Compile RPC
  • With --all: workspace path — compiles all stacks in topological order; native engine stacks use in-process codegen

Exit codes

CodeMeaning
0Compilation succeeded
1Parse errors, typecheck errors, or plugin error