On this page
CLI Reference
The halyard unified command-line tool provides all Halyard development utilities in a single binary.
Installation
See Installation for setup instructions.
Commands
halyard run
Execute a Halyard file or project.
halyard run script.hly # Run a specific file
halyard run # Run halyard.toml main (inside a project directory)
halyard run --audit-log audit.jsonl # Append the run's compliance manifest to audit.jsonl
halyard run --record # Also record the run's IO trace into the manifest's replay_log
With compliance enabled, --audit-log <path> appends the run's compliance manifest as one JSON line, in place of [compliance] output or HALYARD_COMPLIANCE_OUTPUT. A relative path is relative to the current directory. The directory must exist: a missing directory, or an existing file that cannot be written, stops the run before the program runs. A run that fails appends nothing and creates no file.
--record additionally embeds the run's IO trace (replay_log, see compliance) in the manifest, so the run's file reads can be replayed later without the files. Recording needs an HMAC key (HALYARD_COMPLIANCE_HMAC_KEY or [compliance] hmac_key): halyard replay refuses an unsigned manifest, so a key-less recording cannot be replayed.
halyard replay
Re-run a recorded pipeline from its manifest's replay_log, serving each recorded IO.readFile result in order instead of reading the file:
halyard replay audit.jsonl --hmac-key 00ff # replay the last recorded run
halyard replay audit.jsonl --line 3 --hmac-key 00ff # replay the 3rd manifest line (1-based)
The key comes from --hmac-key or, without it, HALYARD_COMPLIANCE_HMAC_KEY. Before anything is served, replay checks two things and refuses the run if either fails: the manifest's signature must verify, and the entry file's source_hash must match the one recorded — a manifest proves nothing about a program that has changed since it was recorded. A run whose IO operations do not match the log (different op, different arguments, or more operations than recorded) fails with a replay error.
What replay intercepts. Every file and directory operation in IO, plus Http.send — so a replayed run reads no files, writes no files and sends no requests. What still runs live: console output (not traced, by design), the DataFrame readers and writers (tracing them would disable their call-site schema check), and Process.* and DateTime.now until debt #847 extends the trace. A pipeline built on DataFrames, the clock or the environment is therefore recorded without those steps and is not hermetic; see compliance.
halyard -f
Shorthand for halyard run:
halyard -f script.hly
halyard repl
Start the interactive REPL.
halyard repl
See Using the REPL for details.
halyard fmt
Format source code.
halyard fmt file.hly # Format in-place
halyard fmt --check file.hly # Check without modifying
halyard fmt --stdout file.hly # Print to stdout
halyard fmt --width 80 file.hly # Custom line width
echo 'let x = 42' | halyard fmt # Format from stdin
See the Formatter page for full documentation.
halyard check
Type-check a Halyard file without executing it.
halyard check script.hly
Exits with code 0 if no errors are found. Useful for CI or editor integrations that want type checking without running the program.
halyard lsp
Start the Language Server Protocol server.
halyard lsp
The server communicates over stdio. See Language Server & Editor Setup for editor configuration.
halyard tui
Open the terminal user interface — an integrated REPL, environment inspector, and DataFrame viewer.
halyard tui
halyard tui --module-root ./src # Set the project root directory
halyard tui --gateway-port 3000 # Expose an HTTP gateway for editor connections
halyard tui --connection-file conn.json # Use an existing Jupyter connection file
halyard init
Initialize a new Halyard project.
halyard init # Initialize in the current directory
halyard init my-project # Create and initialize a new directory
halyard init my-project --template pipeline # Use a specific template
Available templates:
| Template | Description |
|---|---|
minimal | Basic project with a single main file (default) |
pipeline | Data pipeline with run and task |
analysis | Scientific analysis with variables, imputation, and statistics |
halyard templates
List all available project templates.
halyard templates
halyard trace
Inspect compiler pipeline phases for a Halyard file or inline source string — parsed AST, inferred types, bytecode, and VM execution trace.
The argument is treated as a file path if a file by that name exists; otherwise it is compiled directly as halyard source.
halyard trace "1 + 1" # Inline source string
halyard trace script.hly # File path
halyard trace script.hly --types # Only inferred types
halyard trace script.hly --bytecode --exec # Bytecode and execution trace
halyard trace "let x = 42" --focus "42" # Narrow inline source to a fragment
halyard trace script.hly --focus "3:1" # Narrow to line 3, column 1
| Flag | Output |
|---|---|
--ast | Parsed AST as JSON |
--types | Per-binding inferred types |
--bytecode | Bytecode instruction table with source annotations |
--exec | VM execution trace with register snapshots |
--focus <str> | Narrow all output to a source fragment or line:col position |
See Tracing and Debugging for full documentation.
IO Security
File system IO is disabled by default for security.
| Variable | Values | Effect |
|---|---|---|
HALYARD_IO_DISABLED | 0 or false | Enable file/directory IO |
HALYARD_IO_READ_ONLY | 1 or true | Allow only read operations |
HALYARD_IO_SANDBOX | /path/to/dir | Restrict to directory |
Examples
HALYARD_IO_DISABLED=0 halyard run script.hly # Enable IO
HALYARD_IO_DISABLED=0 HALYARD_IO_READ_ONLY=1 halyard run script.hly # Read-only
HALYARD_IO_DISABLED=0 HALYARD_IO_SANDBOX=/tmp/sandbox halyard run script.hly
Console operations (print, println, readLine) are always allowed.
HTTP Security
HTTP requests via the Http module are disabled by default.
| Variable | Values | Effect |
|---|---|---|
HALYARD_HTTP_DISABLED | 0 or false | Enable HTTP requests |
HALYARD_HTTP_ALLOWED_HOSTS | host1,host2 | Restrict to listed hosts |
Examples
HALYARD_HTTP_DISABLED=0 halyard run api-client.hly # Enable HTTP
HALYARD_HTTP_DISABLED=0 HALYARD_HTTP_ALLOWED_HOSTS=api.example.com halyard run client.hly # Restrict hosts
Request construction (Http.get, Http.withHeader, etc.) is always allowed — only Http.send requires HTTP to be enabled.
DataFrame Security
DataFrame file operations (readCsv, readJson, readParquet, writeCsv, writeJson) are enabled by default but can be restricted.
| Variable | Values | Effect |
|---|---|---|
HALYARD_DATAFRAME_DISABLED | 1 or true | Disable DataFrame file operations |
HALYARD_DATAFRAME_SANDBOX | /path/to/dir | Restrict file I/O to directory |
HALYARD_DATAFRAME_MAX_ROWS | 10000 | Limit rows loaded from files |
Examples
HALYARD_DATAFRAME_SANDBOX=/data halyard run analysis.hly # Restrict to /data
HALYARD_DATAFRAME_MAX_ROWS=10000 halyard run analysis.hly # Limit row count
HALYARD_DATAFRAME_DISABLED=1 halyard run untrusted.hly # Disable entirely
In-memory operations (select, filter, groupBy, etc.) are always allowed — only file I/O functions are affected by these controls.
For detailed information, see the IO Security Guide.
DateTime Security
DateTime operations can be disabled for untrusted code.
| Variable | Values | Effect |
|---|---|---|
HALYARD_DATETIME_DISABLED | 1 or true | Disable DateTime operations |
Environment Variables
| Variable | Description |
|---|---|
NO_COLOR | Disable colored output |
RUST_LOG | Enable internal debug logging (e.g. RUST_LOG=debug for halyard trace --exec) |
HALYARD_IO_DISABLED | 0 or false to enable file IO |
HALYARD_IO_READ_ONLY | 1 or true for read-only IO |
HALYARD_IO_SANDBOX | Restrict IO to a directory |
HALYARD_HTTP_DISABLED | 0 or false to enable HTTP requests |
HALYARD_HTTP_ALLOWED_HOSTS | Comma-separated list of allowed HTTP hosts |
HALYARD_DATAFRAME_DISABLED | 1 or true to disable DataFrame operations |
HALYARD_DATAFRAME_SANDBOX | Restrict DataFrame file I/O to a directory |
HALYARD_DATAFRAME_MAX_ROWS | Limit rows loaded from files (e.g. 10000) |
HALYARD_DATETIME_DISABLED | 1 or true to disable DateTime operations |
HALYARD_HIDE_LINEAGE | 1 or true to hide a DataFrame's lineage summary |
A yes/no variable accepts exactly 1, 0, true or false (the words in any case). Any other value, the empty one included, stops halyard with an error naming the variable, its value and the accepted values, before anything runs. See Which setting wins for every variable's accepted values.
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | Compilation error |
| 2 | Runtime error |