Skip to main content

Module plan

Module plan 

Source
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§

PlannedStatement
One statement of a planned program: its Plan and where it sits among the planned statements.
StatementPlan
One statement’s plan.

Constants§

KAISH_BUILD_DATE
The UTC date kaish was built, YYYY-MM-DD. Reported alongside KAISH_VERSION in every plan document, success or error. Unlike KAISH_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 .git checkout 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 .git to read, and kaish-kernel/build.rs falls back to this literal string. Reported alongside KAISH_VERSION in every plan document, success or error.
KAISH_VERSION
The kaish version reported alongside a plan document.

Functions§

plan_program
Plan every statement of source without executing anything.
planned_commands
Every command the statement contains, in source order.