documentation
CLI Reference
This page documents the current Opal command-line surface directly from the implementation.
#CLI Reference
This page documents the current Opal command-line surface directly from the implementation.
#Global options
#--log-level <level>
- Default:
info - Supported values:
tracedebuginfowarnerror
Example:
opal --log-level debug plan#Commands
#opal run
Runs a pipeline locally.
#Options
#-p, --pipeline <path>
- Which
.gitlab-ci.ymlfile to use - Defaults to
<workdir>/.gitlab-ci.yml
#-w, --workdir <path>
- Context directory
- Defaults to the current working directory
#-b, --base-image <image>
- Optional fallback image when the pipeline/job does not define one
#-E, --env <glob>
- Repeatable
- Forwards selected host environment variables into every job
- Uses
globsetglob syntax
Examples:
opal run -E CI_* -E 'AWS_ACCESS_KEY_ID' -E 'APP_??'#--max-parallel-jobs <n>
- Default:
5 - Maximum number of pipeline jobs Opal runs concurrently in a single invocation
#--trace-scripts
- Enables shell tracing with
set -xin generated job scripts
#--engine <engine>
- Default:
auto - Accepted values:
autocontainerdockerpodmannerdctlorbstacksandbox
Notes:
- On macOS,
autouses Applecontainer. - On Linux,
autousespodman. - On macOS,
nerdctlis treated as Linux-oriented rather than as a first-class host engine. sandboxmaps to Anthropic'ssrtCLI and runs scripts in a sandboxed local process model rather than container-image flags.- Use
.opal/config.toml[sandbox]/[[jobs]].sandbox_*settings to controlsrt --settings, debug mode, and generated network/filesystem/policy settings. - You can override the
autodefault in config with[engine].default.
#--no-tui
- Disables the Ratatui interface and prints plain terminal output instead
- Parallel jobs still run in parallel in this mode.
- When multiple jobs emit logs concurrently, Opal prefixes each streamed line with the job name so interleaved output stays attributable.
#--gitlab-base-url <url>
- Optional GitLab API base URL
- Default when used with GitLab features:
https://gitlab.com - Also available through
OPAL_GITLAB_BASE_URL
#--gitlab-token <token>
- Optional GitLab personal access token
- Used for cross-project artifact/include features that require GitLab API access
- Also available through
OPAL_GITLAB_TOKEN
#--job <name>
- Repeatable
- Limits execution to selected jobs plus their required upstream dependency closure
Examples:
opal run --job rust-checks
opal run --job package-linux --job deploy-summary#opal plan
Builds the evaluated execution plan without starting containers.
When opal plan runs in an interactive terminal, it opens the formatted plan in your pager by default.
#Options
#-p, --pipeline <path>
- Which
.gitlab-ci.ymlfile to inspect - Defaults to
<workdir>/.gitlab-ci.yml
#-w, --workdir <path>
- Context directory
- Defaults to the current working directory
#--gitlab-base-url <url>
- Optional GitLab API base URL for GitLab-backed include resolution
- Also available through
OPAL_GITLAB_BASE_URL
#--gitlab-token <token>
- Optional GitLab token for GitLab-backed include resolution
- Also available through
OPAL_GITLAB_TOKEN
#--job <name>
- Repeatable
- Limits the printed plan to selected jobs plus their required upstream dependency closure
#--no-pager
- Prints the formatted plan directly to stdout instead of opening a pager
#--json
- Emits the execution plan as JSON
- Disables pager behavior automatically
Example:
opal plan --job package-linux
opal plan --no-pager --job package-linux
opal plan --json --job package-linux#opal view
Opens the history/log browser for previous runs.
#Options
#-w, --workdir <path>
- Context directory
- Defaults to the current working directory
#opal completions <shell>
Prints a shell completion script to stdout.
Supported shells:
bashelvishfishpowershellzsh
Examples:
opal completions zsh > "${fpath[1]}/_opal"
opal completions fish > ~/.config/fish/completions/opal.fish
opal completions bash > ~/.local/share/bash-completion/completions/opal#opal mcp
Starts the MCP server over stdio.
This command is intended for MCP clients that launch Opal as a subprocess and speak JSON-RPC over stdin/stdout.
The current MCP tool surface includes opal_plan, opal_run, opal_run_status, opal_view, opal_history_list, opal_failed_jobs, opal_run_diff, opal_logs_search, opal_job_rerun, opal_plan_explain, and opal_engine_status. opal_run, opal_job_rerun, and opal_logs_search start background operations; opal_view also uses the same background path when include_log or include_runtime_summary is requested. Poll these operations with opal_run_status. opal_history_list supports status, job, branch, pipeline-file, and RFC3339 date-range filters. MCP history, latest-run lookup, and resources are scoped to the current checkout instead of showing unrelated runs from the same $XDG_DATA_HOME/opal tree.
Example:
opal mcp#Related environment variables
These are not command-line flags, but they change CLI/runtime behavior and are worth knowing:
OPAL_GITLAB_BASE_URL- fallback for
--gitlab-base-url
- fallback for
OPAL_GITLAB_TOKEN- fallback for
--gitlab-token
- fallback for
XDG_DATA_HOME- sets the data root as
$XDG_DATA_HOME/opalfor runs, logs, artifacts, cache, and history
- sets the data root as
XDG_CONFIG_HOME- sets the global config path as
$XDG_CONFIG_HOME/opal/config.toml
- sets the global config path as
OPAL_RUN_MANUAL=1- makes manual jobs auto-run in contexts that respect manual-run toggling
OPAL_DEBUG=1- enables script tracing like
--trace-scripts
- enables script tracing like
#Common examples
Run the default repo pipeline locally:
opal runRerun one recorded job name from the latest Opal history entry against the current checkout:
opal run --rerun-job rust-checksRerun a job name from a specific recorded run:
opal run --rerun-job ui-docs-check --rerun-run-id gitlab-ci-70212f44Run one job plus required upstreams:
opal run --no-tui --job rust-checksPreview the evaluated DAG only:
opal planInspect a subgraph:
opal plan --job package-linuxGenerate a completion script:
opal completions zsh