This library is in flux. APIs may change without notice. Generated from source with koruc 0.1.7 on 8/19/2026.
Explain
~import std/explainexplain.kz — the `explain` COMMAND for Koru
explain.kz · 1 tors · ~[comptime]
explain.kz — the `explain` COMMAND for Koru · 23 more lines
explain.kz — the `explain` COMMAND for Koru
The SQL-`EXPLAIN` move, lifted to the compiler: a library optionally ships a
comptime *explainer* that reads the program AST and explains how the library
interpreted YOUR program's use of ITS OWN facilities — not generic docs, but
"given this config and these call sites, here is what I decided about THIS
code." std/store, for instance, would report per-store: which layout the
current config elected, where it's watched, where it's updated.
koruc main.k explain # human-readable (text)
koruc main.k explain json # machine-readable
koruc main.k explain html # rich page
The `explain` command is the ONLY caller of explainers. Libraries *provide*
explainers; they never invoke them. Like `deps` and `parser:generate`, this
command runs INSTEAD of compilation with full AST access — the backend
dispatches it before koru_coordinate, so no pipeline pass fires. It sees the
freshly-parsed, pre-analysis AST (closest to original source).
STATUS: the command registers and dispatches; koruc generates
`koru_explain_gather` (calls every discovered `[explainer]` once), and
`std/runtime` ships the first explainer — the scope registry's manifest,
reported per registered scope as the served contract bytes.
~[comptime|command] pub tor explain {
program: *const Program,
allocator: __koru_std.mem.Allocator,
argv: []const []const u8
}