# `WorkflowStem.Pipeline.Builder`
[🔗](https://github.com/fosferon/workflow_stem/blob/main/lib/workflow_stem/pipeline/builder.ex#L1)

Emits a runtime-compiled ALF pipeline module from a spec's compiled
descriptors.

Takes descriptors produced by `WorkflowStem.Compiler.components_for/1`
plus the spec's `:routing` table, and generates an Elixir module that:

  * does `use ALF.DSL`
  * exposes `@components [...]` matching the descriptor list
  * carries `defdelegate` entries for every routing name, so ALF's
    `switch`/`goto` components resolve via `apply(pipeline_mod, name, args)`

The generated module is compiled into the current BEAM via
`Code.compile_quoted/1`. Callers get back `{:ok, module_name}`; the
module is callable immediately.

Typical usage:

    {:ok, mod} =
      WorkflowStem.Pipeline.Builder.build(
        MyAgent.Pipeline.SomeWorkflow,
        Compiler.components_for(spec),
        Map.get(spec, :routing, %{})
      )

    :ok = mod.start()
    result = mod.call(event)

## Scope in this iteration

AST emission is implemented for: `stage`, `switch`, `composer`, `goto`,
`goto_point`, `done`, `dead_end`, `from`, `tbd`. Support for `plug_with`
follows the same pattern but is not yet emitted — a descriptor of
`{:plug_with, ...}` will raise here. (The Compiler accepts and validates
it; Builder just hasn't rendered the AST yet.)

# `build`

```elixir
@spec build(module(), [tuple()], map()) :: {:ok, module()}
```

Build and compile a pipeline module. Returns `{:ok, module}` on success.

Raises `ArgumentError` if a descriptor has no AST emitter yet
(currently `:plug_with`).

---

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