ubx compile runs the full XCL pipeline — lex → parse → typecheck → IR → codegen — and writes the generated Pulumi Python program to .ubx/.
Usage
| Form | Description |
|---|---|
ubx compile | Compile .xcl files in the current directory |
ubx compile ./networking | Compile .xcl files in ./networking |
ubx compile --all . | Compile every stack in the workspace (recursive) |
Output files
All output is written to<path>/.ubx/:
| File | Description |
|---|---|
__main__.py | The Pulumi Python program |
requirements.txt | Provider package dependencies |
Pulumi.yaml | Pulumi project file (stack name = directory name) |
Pipeline phases
The compiler prints a phase line for each stage:- Compile — discover
.xclfiles, lex and parse them - Typecheck — 5-pass typechecker (symbol collection, reference resolution, locals/resource validation, when conditions, input type checking)
- IR — build the intermediate representation
- Output — write
.ubx/__main__.py,requirements.txt,Pulumi.yaml
Error handling
Errors stop the pipeline at the phase where they occur. No output is written when there are parse or typecheck errors. Parse error example:Cross-stack reference discovery
When the stack contains@stackName.outputName references, the compiler:
- Scans for all
@namereferences in the parsed AST - Looks for sibling directories (at
../name/relative to the current stack) - Parses the sibling’s
.xclfiles to extract declared output field names - Validates that every
@name.outputrefers to a real declared output
Single-stack mode (default)
Without--all, ubx compile targets one directory:
.iac files instead of .xcl files, the compiler reports an error and suggests using ubx plan/apply.
If the directory contains both .xcl and .iac files, compilation is aborted with a “mixed pipeline” error.
Workspace mode (—all)
--all, the compiler:
- Recursively discovers all subdirectories containing
.xclfiles - Builds a dependency graph from
@stackNamecross-stack references - Topologically sorts stacks (dependencies compile first)
- Compiles each stack in order, showing
━━━separators and(N/total)counters
Workspace error handling
Individual stack failures do not abort the workspace compile. All stacks are attempted and a summary is printed at the end:Nested workspaces
--all recurses into subdirectories at any depth. Each directory that contains .xcl files is treated as an independent stack. Cross-stack references (@name) resolve via the same-parent rule — the sibling must be in a directory adjacent to the current stack’s parent.
See Multi-stack workspaces for the layout rules.
Stack name
The Pulumi project name (written toPulumi.yaml) is derived from the directory name:
Flags
| Flag | Default | Description |
|---|---|---|
--all | false | Compile every XCL stack in the workspace recursively |

