diff --git a/test/cli.sh b/test/cli.sh index 12e113b..edebf57 100644 --- a/test/cli.sh +++ b/test/cli.sh @@ -130,15 +130,110 @@ check "install.sh: still no-ops on an existing install (#66)" 0 "" \ grep -qF 'already installed' "$ROOT/install.sh" # --------------------------------------------------------------------------- -# Templates — #65 tmux. `box tmux` runs `tmux new-session` INSIDE the box, so a -# template that never installs tmux fails with "tmux: command not found". Every -# template must carry it in its cloud-init package list. +# Templates — DYNAMIC over templates/*/ (#68): the loop discovers every +# template directory, so a new template cannot ship without passing these (the +# old hardcoded blank/claude/codex/grok list let exactly that happen). The +# box.env parse is proven against the REAL allowlist: load_template is +# extracted from bin/box and DRIVEN against each template — the same +# source-the-pure-function trick install.sh's DEST block and box_tier get +# below — so an unknown key, a missing BOX_IMAGE/BOX_USER, or a line that is +# not KEY="value" fails HERE, not at mint time on a host. # --------------------------------------------------------------------------- -for t in blank claude codex grok; do +TPLFN="$(mktemp)" +awk '/^load_template\(\) \{/,/^\}/' "$ROOT/bin/box" > "$TPLFN" +check "load_template: extracted from bin/box (guards the awk)" 0 "unknown key" cat "$TPLFN" +check "load_template: the extracted function is valid bash" 0 "" bash -n "$TPLFN" + +# tpl