# `Condukt.Workflows.Compiler`
[🔗](https://github.com/tuist/condukt/blob/1.5.1/lib/condukt/workflows/compiler.ex#L1)

Normalizes `.exs` workflow files to workflow documents.

An `.exs` workflow is an Elixir script whose final expression
evaluates to a map describing the workflow. This is a low-level
generation escape hatch. Human-authored workflow files should
generally use HCL and let `Condukt.Workflows.HCLCompiler` produce the
same map.

Atom keys and atom values (other than `nil`, `true`, `false`) are
normalized to strings; the rest of the data must already match the
workflow document shape.

Standard Elixir features (`def` inside a `defmodule`, anonymous
functions, `for`, `if`, comprehensions, `Enum`, etc.) are available
for document generation. References between steps are
written as plain `${...}` expression strings.

    # hello.exs
    %{
      inputs: %{name: %{type: :string}},
      steps: %{greet: %{kind: :cmd, argv: ["echo", "Hello, ${inputs.name}"]}},
      output: "${steps.greet.stdout}"
    }

# `compile`

Reads, evaluates, and normalizes an `.exs` workflow file.

Returns `{:ok, decoded_map}` where the map is ready for workflow
document validation.

# `compile_string`

Evaluates an `.exs` workflow source string. `path` is used only for
error reporting.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
