feat: chained notebooks with when sections and host blocks (#11)

A notebook can include another one and continue with what it produced:

- core: parse :::when{param=a,b}, ::use{notebook= as= with=} and
  ::host{name= address= user= port= capture=}; composeNotebook namespaces
  an included notebook's params, steps, captures and templates by alias
  (cycles, missing files, depth > 4 and child errors are reported on the
  use line). Defaults may reference captures and builtins
  ({{shellbook.public_key}}); required params and secrets gate only steps
  of their own scope; secretEnv passes a scope's secrets under local names.
- protocol: NotebookResponse gains includes and builtins.
- server: compose includes on load, inject builtins (client values are
  ignored), refuse steps in inactive when sections.
- web: render when/use/host blocks, group included params in the form,
  add a created machine to Hosts and capture its name, reload when an
  included notebook changes, run all checks only for active steps,
  authoring snippets for when, use and host.
This commit is contained in:
Florian Schmidt
2026-11-16 11:42:12 +01:00
parent 28e806d641
commit 845d6c828e
24 changed files with 1407 additions and 136 deletions
+42
View File
@@ -152,6 +152,25 @@ main {
.params b {
color: var(--accent);
}
.params {
max-height: 40vh;
overflow-y: auto;
}
.params fieldset {
flex-basis: 100%;
display: flex;
flex-wrap: wrap;
gap: 12px;
margin: 0;
border: 1px solid var(--line);
border-radius: 6px;
padding: 8px 12px 12px;
}
.params legend {
font-size: 12px;
color: var(--muted);
padding: 0 4px;
}
.notebook {
max-width: 1100px;
margin: auto;
@@ -279,6 +298,29 @@ a {
border-left: 3px solid var(--accent);
padding-left: 18px;
}
/* Chained notebooks (::use): the included notebook, collapsible. */
.included {
border: 1px dashed var(--line);
border-radius: 7px;
padding: 4px 18px;
margin: 20px 0;
}
.included > summary {
cursor: pointer;
padding: 10px 0;
font-weight: 600;
}
.included > summary small {
font-weight: normal;
color: var(--muted);
margin-left: 8px;
}
.host-block > p {
margin: 10px 16px;
}
.host-block > button {
margin: 10px 16px;
}
.banner {
padding: 14px 24px;
background: var(--panel);