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 inblast-radius.md§6). Pure, no I/O: the host computes the radius (viacrate::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). - hub_
fetch - Fetches the Hub component library over the network into a per-user cache, when there is no
in-repo
hub/components/to prefer instead (see the crate’sin_repo_hub_dirhelper andcrate::default_component_sources).
Structs§
- Builtin
Context Resolver - The context kinds this checkout resolves without help:
wren_projectandraw_source(read natively),external(read nothing) andprepared(read a projection the host already resolved). A host that needs another kind wraps this — delegating the ones it knows and handling its own. - Component
Source - One explicitly-configured place a mounted component’s files may live:
components_diris a directory whose immediate children are<id>/component.yml(+ itssteps/*). The host builds the full ordered/kinded list up front (seecompile_project_to_ir_with_sources) — resolution never discovers sources on its own (no ancestor/filesystem-root walk).
Enums§
- Source
Kind - The precedence class a
ComponentSourcebelongs to. Precedence is a fixed rule between kinds —Localalways outranksHub— 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_dirtreats that as ambiguous rather than guessing (e.g. “first in the list wins”), because nothing declares which of two equally-ranked sources should win.
Traits§
- Context
Resolver - Turns a parsed
context/binding.ymlinto theContextLoaderthe compiler probes.
Functions§
- blast_
radius_ for_ project - Compute the
warble::BlastRadiusofnodein a Warble project’s bound wren project. Resolves the project the same waycompile_project_to_irdoes (profile.yml → context binding → wren project →MdlContext), but stops short of a full compile — just the lineage query. - blast_
radius_ for_ project_ with - As
blast_radius_for_project, resolving the context binding through a caller-suppliedContextResolver. Kept in step withcompile_project_to_ir_withso a host kind is bindable on both paths — a lineage query over a context only the host can load is no less valid than a compile over it. - check_
compliance_ ir_ version warble_eval_runner::ComplianceIr(the typeeval compliancedeserializes into) is deliberately narrower thanWarbleIr— its own doc comment says so, so a compiled-inwarble_ir_versionfield never belongs on that type. Buteval complianceis not fed an arbitrary subset: every real caller hands it the same completeir.jsondispatch/manifestconsume (confirmed byeval/golden/compliance/ground_truth.yaml’s own comment — its two golden IRs,examples/mutate-agent/ir.golden.jsonandexamples/analysis-agent/ir.golden.json, are “reused as-is, not new fixtures”). So the version gate belongs here, at the CLI boundary, checked on the raw JSON beforeComplianceIrever sees it — against the samewarble_claude_code::ir::SUPPORTED_IR_VERSIONthat the binary’s ownload_iralready gatesdispatch/manifestagainst, so every CLI-level IR consumer rejects an out-of-range version the same way.- compile_
project_ to_ ir - Compile a Warble project directory into its IR JSON, using the real MDL
ContextLoaderover the bound wren project and the default component source list (project-localcomponents/+ this checkout’s Hub — seedefault_component_sources). This is what every in-repo example/eval profile and integration test compiles through. - compile_
project_ to_ ir_ with - As
compile_project_to_ir_with_sources, resolving the context binding through a caller-suppliedContextResolverinstead ofBuiltinContextResolver. This is the seam a host uses to bind a context kind this checkout cannot read — the context-side counterpart of passing your ownComponentSourcelist. - 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 resolvedHashMap<String, ComponentFile>built below. - default_
component_ sources - The default two-source list used by
compile_project_to_ir: the project’s owncomponents/(Local, highest precedence — lets a profile deliberately diverge from the Hub, e.g. an eval/demo substrate with intentionally different anatomy) plus the Hub (Hub, fallback) — see the crate’s privatedefault_hub_sourcehelper for how the Hub source itself is resolved. A host mounting an additional local component library (e.g. a product-specific one, alongside the Hub) extends this list — seecompile_project_to_ir_with_sources. - default_
component_ sources_ with_ hub_ version - Same as
default_component_sources, but lets the caller pick which Hub version to fetch when default resolution needs the network (i.e. no in-repohub/componentson disk). This is the seam the CLI’s--hub-versionflag threads through;Nonemeans “this binary’s own version”, the ordinary default.