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:
+38
-6
@@ -93,7 +93,11 @@ Download the private key above, then save it:
|
||||
- **Substitution in scripts is shell-safe**: the value is inserted shell-quoted when it
|
||||
contains anything outside `[A-Za-z0-9._/@:=+-]`. The displayed script and the executed
|
||||
script are the same string. One function does this (`core/shellQuote`), nowhere else.
|
||||
- A step with a missing required param shows the script with `{{name}}` highlighted and a disabled Run button.
|
||||
- A step needs exactly the values it uses: every param and runtime value it references, and
|
||||
the required secrets its script reads as `$NAME`/`${NAME}`. While one is missing the script
|
||||
shows `{{name}}` highlighted and Run is disabled. Required params the step does not use never
|
||||
block it, so a guided notebook (§3.7) runs its first steps before later values are entered.
|
||||
Set secrets of the step's notebook are always validated, because all are passed as env vars.
|
||||
|
||||
### 3.3 Step attributes
|
||||
|
||||
@@ -149,12 +153,11 @@ notebook that first creates an LXC container:
|
||||
- `with` sets defaults of the included params, written in the including notebook's
|
||||
namespace. Secrets cannot be bound; they are entered in the form and passed only to
|
||||
steps of their own notebook, under their local name (`$ROOTPW`).
|
||||
- Required params gate only steps of their own notebook (scope); a step also needs every
|
||||
value it references.
|
||||
- Steps are gated only by the values they use (§3.2); an included notebook's empty form
|
||||
never blocks the parent's steps unless they reference its values.
|
||||
- Non-secret defaults may reference captures and builtins (`default: "{{ct.host}}"`). Until
|
||||
the value exists the field shows "Available after the step that sets ct.host". A
|
||||
required param that waits for a capture of its own notebook would block the step
|
||||
producing it; make such params optional.
|
||||
the value exists the field shows "Available after the step that sets ct.host". Only
|
||||
steps that reference such a param wait for it.
|
||||
- `::host{name="{{hostname}}" address="{{address}}" user=root port=22 capture=host}` adds
|
||||
the machine to Hosts (same validation as the Hosts page; never overwrites a different
|
||||
host with that name). `capture` stores the host name as a runtime value so later
|
||||
@@ -163,6 +166,35 @@ notebook that first creates an LXC container:
|
||||
`{{shellbook.public_key}}` is ShellBook's SSH public key. The server sets them on every
|
||||
run; client-sent values are ignored.
|
||||
|
||||
### 3.7 Guided text: parameter fields and groups
|
||||
|
||||
Authors can ask for each value where the text explains it:
|
||||
|
||||
```markdown
|
||||
:::group{title="1. Network" collapsed}
|
||||
Pick the bridge the container joins:
|
||||
|
||||
::param{name=bridge}
|
||||
:::
|
||||
```
|
||||
|
||||
- `::param{name=x}` on its own line shows the input of the declared parameter `x` at that
|
||||
point. It is bound to the same value as the parameter panel, which still lists every
|
||||
parameter. Inside an included notebook the name is namespaced like everything else.
|
||||
- `:::group{title="…" collapsed}` … `:::` is a titled, collapsible container for any
|
||||
blocks, including nested groups. `collapsed` starts it closed; the user's choice is
|
||||
remembered per notebook. The title may use `{{name}}` like prose. Groups are purely
|
||||
presentational: unlike `:::when` they never hide or block steps.
|
||||
- A group's **inputs** are its `::param` fields, the parameters its steps and `::host`
|
||||
blocks reference (those are needed: the step cannot run without them) and, for a
|
||||
`::use` section, the included notebook's parameters. Inactive `:::when` sections and
|
||||
runtime values are ignored. Core `groupInputs` computes the status, shown as the outline
|
||||
color and in words: orange (missing) while a required or needed input is empty or a
|
||||
value is invalid, green (filled) when every input has a value, grey (optional) when
|
||||
only optional inputs are empty or there are none.
|
||||
- Included notebooks (`::use`) are shown as groups with the same status, so a reusable
|
||||
group is a notebook included where it is needed.
|
||||
|
||||
## 4. Execution
|
||||
|
||||
- Scripts run as `bash -euo pipefail -s` with the script on stdin; no TTY.
|
||||
|
||||
Reference in New Issue
Block a user