Expand description
The statement plan: an AST rendered back to shell text, unexpanded.
A plan is parse information. It is built after validation and before
execution, so ${HOME} and $(...) appear exactly as written — an
embedder judges what was asked, not what it resolved to, and the
substitution that would resolve them has not run.
Two products, one AST walk each: render_stmt produces the text, and
planned_commands produces one PlannedCommand per command the
statement contains — control-structure bodies, if conditions, and
command substitutions included, because every one of them is a command
this statement would run.
The same walk collects the statement’s variables: the names it reads
(free_variables) and the names it writes (bound_variables). A name
that is both lands bound, never free.
Structs§
- Planned
Statement - One statement of a planned program: its
Planand where it sits among the planned statements. - Statement
Plan - One statement’s plan.
Constants§
- KAISH_
BUILD_ DATE - The UTC date kaish was built,
YYYY-MM-DD. Reported alongsideKAISH_VERSIONin every plan document, success or error. UnlikeKAISH_GIT_HASH, this is always the real build date — it comes from the build script’s clock, not from git, so it does not depend on a.gitcheckout being present. - KAISH_
GIT_ HASH - The git commit kaish was built from, short form, or
"unknown"when none was available at build time — a crates.io tarball build has no.gitto read, andkaish-kernel/build.rsfalls back to this literal string. Reported alongsideKAISH_VERSIONin every plan document, success or error. - KAISH_
VERSION - The kaish version reported alongside a plan document.
Functions§
- plan_
program - Plan every statement of
sourcewithout executing anything. - planned_
commands - Every command the statement contains, in source order.