feat(core): parameter fields in text, groups and gating by used values (#16)
- `::param{name=x}` places a parameter's input inside the text.
- `:::group{title="…" collapsed}` is a collapsible container for anything;
groups are presentational and never gate steps. Included notebooks
namespace field names and group titles.
- `groupInputs` reports a container's input status (missing, filled,
optional, none) from its fields, the parameters its steps use and, for
`::use`, the included notebook's parameters.
- A step is gated only by the values it uses: referenced parameters, the
required secrets its script reads and valid set secrets of its scope.
Unused required parameters no longer block early steps of a guided
runbook.
- Spec §3.2/§3.6/§3.7, workspace format guide and a guided admin-user
example notebook.
This commit is contained in:
@@ -48,7 +48,9 @@ Non-secret defaults may reference other parameters.
|
||||
Use `{{name}}` in prose, attributes and scripts. Script substitution is already
|
||||
shell-quoted by ShellBook's core: write `id {{user}}`, not `id '{{user}}'`.
|
||||
Do not invent escaping rules or assume templates expand like shell variables.
|
||||
Missing required parameters disable execution. In shell strings use ordinary
|
||||
A step runs once every value it uses is set: its `{{…}}` references and the required
|
||||
secrets its script reads as `$NAME`. Unused required parameters do not block it, so
|
||||
early steps can run before later values are known. In shell strings use ordinary
|
||||
shell variables where needed, e.g. `destination={{destination}}` then `"$destination"`.
|
||||
|
||||
## Step syntax and every attribute
|
||||
@@ -135,5 +137,26 @@ apt-get install -y nginx
|
||||
offers to add a created machine to Hosts and stores its name in `{{host}}`.
|
||||
- `{{shellbook.public_key}}` is ShellBook's SSH public key, e.g. for `pct create --ssh-public-keys`.
|
||||
|
||||
## Guided text: fields and groups
|
||||
|
||||
````markdown
|
||||
:::group{title="1. Network" collapsed}
|
||||
Pick the bridge the container joins:
|
||||
|
||||
::param{name=bridge}
|
||||
|
||||
```sh {check host="{{host}}" id=bridge-exists}
|
||||
ip link show {{bridge}}
|
||||
```
|
||||
:::
|
||||
````
|
||||
|
||||
- `::param{name=x}` on its own line shows parameter `x`'s input at that point (same
|
||||
value as the parameter panel). Use it to ask for each value where it is explained.
|
||||
- `:::group{title="…"}` … `:::` is a collapsible section for anything (text, fields,
|
||||
steps, nested groups); `collapsed` starts it closed. Its outline is orange while a
|
||||
required field or a parameter its steps use is empty, green when all its inputs are
|
||||
filled, grey otherwise. Groups never hide or block steps; use `:::when` for that.
|
||||
|
||||
See the notebooks for complete SSH-key, read-only hardening, Debian package, LXC
|
||||
container (`infra/lxc-container.md`) and chained service (`services/web-server.md`) examples.
|
||||
|
||||
Reference in New Issue
Block a user