Skip to main content

Crate warble_cli

Crate warble_cli 

Source
Expand description

warble_cli — the native host library behind the warble binary.

Holds the pieces the binary and the golden integration tests share. The headline is compile_project_to_ir: the real front-end host path — read a Warble project’s files, build the MDL ContextLoader over the bound wren project, and run the sans-IO core compiler with it injected. (The binary’s dispatch/render/manifest/eval subcommands stay in main.rs.)

blast_radius_for_project reuses the same project-resolution path to answer a blast_radius query without running a full compile — the host side of the warble blast-radius subcommand.

Component resolution — turning a profile’s use: <id> mount into a directory to read component.yml/steps from — is entirely a host concern (see ComponentSource / resolve_component_dir): the core compiler never touches a filesystem, it only ever sees the already-resolved HashMap<String, ComponentFile> this module builds.

This is the crate that becomes the warble binary itself — end users install just this one. It links in both dispatcher back-ends (warble-claude-code, warble-vercel) and the warble-mdl-context binding directly; none of those three crates is a standalone tool, and warble dispatch --target ... simply selects which linked-in back-end handles the compiled IR.

Modules§

gate
Gate-decision policy over an already-computed warble::BlastRadius (Phase 4a — the mutating guardrail described in blast-radius.md §6). Pure, no I/O: the host computes the radius (via crate::blast_radius_for_project), then this module turns it plus a threshold into a decision the host can act on (allow the apply, escalate to human approval, or hard-block it).

Structs§

ComponentSource
One explicitly-configured place a mounted component’s files may live: components_dir is a directory whose immediate children are <id>/component.yml (+ its steps/*). The host builds the full ordered/kinded list up front (see compile_project_to_ir_with_sources) — resolution never discovers sources on its own (no ancestor/filesystem-root walk).

Enums§

SourceKind
The precedence class a ComponentSource belongs to. Precedence is a fixed rule between kinds — Local always outranks Hub — not derived from the order sources happen to be listed in. There is deliberately no rule within a kind: if the same component id is found in two sources of the same kind, resolve_component_dir treats that as ambiguous rather than guessing (e.g. “first in the list wins”), because nothing declares which of two equally-ranked sources should win.

Functions§

blast_radius_for_project
Compute the warble::BlastRadius of node in a Warble project’s bound wren project. Resolves the project the same way compile_project_to_ir does (profile.yml → context binding → wren project → MdlContext), but stops short of a full compile — just the lineage query.
compile_project_to_ir
Compile a Warble project directory into its IR JSON, using the real MDL ContextLoader over the bound wren project and the default component source list (project-local components/ + this checkout’s Hub — see default_component_sources). This is what every in-repo example/eval profile and integration test compiles through.
compile_project_to_ir_with_sources
Compile a Warble project directory into its IR JSON, resolving mounted components against an explicit, caller-supplied source list instead of the in-repo default (see ComponentSource). This is the seam a host outside this checkout uses to mount its own local component library alongside (or instead of) the Hub — e.g. [ComponentSource::local(my_components), ComponentSource::hub(path_to_warble_hub)]. All filesystem reads happen here; the core compiler stays sans-IO — it only ever receives the resolved HashMap<String, ComponentFile> built below.
default_component_sources
The default two-source list used by compile_project_to_ir: the project’s own components/ (Local, highest precedence — lets a profile deliberately diverge from the Hub, e.g. an eval/demo substrate with intentionally different anatomy) plus this checkout’s Hub (Hub, fallback). A host mounting an additional local component library (e.g. a product-specific one, alongside the Hub) extends this list — see compile_project_to_ir_with_sources.