Chained notebooks: include a notebook, conditional sections, add hosts from a notebook #11

Closed
opened 2026-11-16 11:23:09 +01:00 by schmidt.florian · 1 comment
Owner

A service notebook can choose 'Use LXC' and then embed the 'Set up LXC container' notebook inline, with that notebook's parameters editable in the same page.

Format (stays readable Markdown):

  • ::use{notebook="infra/lxc-container.md" as=ct with="hostname={{service}}"} embeds another workspace notebook inline; its params/steps/captures are namespaced (ct.hostname, {{ct.address}}). Cycles, missing files and depth > 4 are errors.
  • :::when{target=lxc} ... ::: shows a section (and allows its steps to run) only for that choice.
  • ::host{name=... address=... user=root capture=host} adds the new machine to Hosts from the notebook (existing host API, TOFU stays).
  • Param defaults may reference captured values (default: "{{ct.host}}").
  • Built-in {{shellbook.public_key}} so a notebook can install ShellBook's key (e.g. pct create --ssh-public-keys).

Done when: core/server/web support the above with tests, authoring toolbar can insert the new directives, spec and workspace CLAUDE.md document it, and the workspace templates ship 'Set up an LXC container (Proxmox)' plus one example service notebook that uses it.

A service notebook can choose 'Use LXC' and then embed the 'Set up LXC container' notebook inline, with that notebook's parameters editable in the same page. Format (stays readable Markdown): - `::use{notebook="infra/lxc-container.md" as=ct with="hostname={{service}}"}` embeds another workspace notebook inline; its params/steps/captures are namespaced (`ct.hostname`, `{{ct.address}}`). Cycles, missing files and depth > 4 are errors. - `:::when{target=lxc}` ... `:::` shows a section (and allows its steps to run) only for that choice. - `::host{name=... address=... user=root capture=host}` adds the new machine to Hosts from the notebook (existing host API, TOFU stays). - Param defaults may reference captured values (`default: "{{ct.host}}"`). - Built-in `{{shellbook.public_key}}` so a notebook can install ShellBook's key (e.g. pct create --ssh-public-keys). Done when: core/server/web support the above with tests, authoring toolbar can insert the new directives, spec and workspace CLAUDE.md document it, and the workspace templates ship 'Set up an LXC container (Proxmox)' plus one example service notebook that uses it.
Author
Owner

Done in 845d6c8, 85afd10, 5411528.

  • :::when{param=a,b}, ::use{notebook= as= with=} and ::host{…} are parsed and composed in core. Included notebooks are namespaced by their alias (ct.hostname, {{ct.address}}). Required params gate only their own notebook. Builtins: {{shellbook.public_key}}.
  • The server composes includes and injects builtins (it ignores client values). It refuses steps in inactive when sections.
  • Web: included notebooks render inline with their own parameter group. A host block adds the created machine to Hosts and stores its name. The page reloads when an included file changes. The authoring toolbar has snippets for when, use and host.
  • Templates: infra/lxc-container.md (Proxmox pct) and services/web-server.md (nginx on an existing host or a new LXC). Spec §3.6 and the workspace format guide are updated.
  • shellbook-update now adds new templates to existing workspaces once. It never overwrites files or restores deleted ones.

Verified: typecheck; tests (core 69, web 67, server 191 + 1 skipped); build; deploy static tests (9/5/5).
Not verified: a real Proxmox pct create run, real OpenSSH, or a real browser.

Done in 845d6c8, 85afd10, 5411528. - `:::when{param=a,b}`, `::use{notebook= as= with=}` and `::host{…}` are parsed and composed in core. Included notebooks are namespaced by their alias (`ct.hostname`, `{{ct.address}}`). Required params gate only their own notebook. Builtins: `{{shellbook.public_key}}`. - The server composes includes and injects builtins (it ignores client values). It refuses steps in inactive `when` sections. - Web: included notebooks render inline with their own parameter group. A host block adds the created machine to Hosts and stores its name. The page reloads when an included file changes. The authoring toolbar has snippets for when, use and host. - Templates: `infra/lxc-container.md` (Proxmox `pct`) and `services/web-server.md` (nginx on an existing host or a new LXC). Spec §3.6 and the workspace format guide are updated. - `shellbook-update` now adds new templates to existing workspaces once. It never overwrites files or restores deleted ones. Verified: typecheck; tests (core 69, web 67, server 191 + 1 skipped); build; deploy static tests (9/5/5). Not verified: a real Proxmox `pct create` run, real OpenSSH, or a real browser.
Sign in to join this conversation.
No labels
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: FinalFactory/ShellBook#11