Files
Maximilian Roos ab9cecb171 Fix demo command tracking and simplify Try it copy (#4546)
Demoshell's guide needs Bash to report command exit status before it can
verify successful steps. Put the command-tracker prompt and OSC 133 exit
markers in the startup rcfile, skipping the initial prompt so Studio
does not mistake it for the app exiting. Keep the recipe and published
guide representation aligned with the working demo.

Shorten the Try it page to the introduction, loading note, full-page
fallback, attribution, and install link. This follows
[#4280](https://github.com/max-sixty/worktrunk/pull/4280).

Validation: ARM64 Alpine recipe and guide walkthrough; startup,
failed-command, and successful-command marker checks; published demo
walkthrough; docs sync test and build; rendered copy review.

The full local gate ran 5,392 tests: 5,389 passed and three PowerShell
tests failed because the installed PowerShell 7.5.2 crashes with `Stack
overflow.` even on `pwsh -NoProfile -Command '1 + 1'` outside the
repository. Pre-commit checks pass separately.

> _This was written by Codex on behalf of max-sixty_
2026-10-22 00:36:59 -07:00
..

Try it demo

The Try it page embeds a Demoshell VM: Alpine Linux on an emulated arm64 CPU, running in the visitor's browser with wt installed. docs/src/pages/try-it.astro mounts it by its Demoshell reference.

The VM's definition is kept here and entered into the Demoshell studio, where the VM is built and saved:

File Studio field
recipe.sh Base image script
after-load.sh Files → /root/after-load.sh
guide.json Guide: title, order, finish card, and steps

guide.json uses the field names Demoshell's embed API serves for a guide. Command steps tick when the visitor runs pattern, and output_contains must appear in its output, so check those strings against real output when changing the recipe or wt's messages. The optional interactive picker uses a manual step: Demoshell does not detect completion when it leaves the terminal's alternate screen.

Set When a visitor opens the VM → Start an app to bash --rcfile /root/after-load.sh. Demoshell's shell-prompt mode runs ash even if the recipe changes root's login shell. Starting bash explicitly loads Worktrunk's shell integration so switching and merging move the visitor's shell.

after-load.sh supplies the prompt prefix Demoshell uses to identify commands and an OSC 133 exit-status marker so the guide can verify whether they succeeded.

To check the full recipe before a Studio build, run this from the repository root with Docker:

docker run --rm -it --platform linux/arm64 \
  -v "$PWD/docs/demos/demoshell:/demo:ro" \
  alpine:latest sh -ec 'sh -e /demo/recipe.sh; exec bash --rcfile /demo/after-load.sh'

In the container, run each command step's pattern from guide.json, then try the optional picker as described. Check that each command step's output_contains appears and that merging returns the shell to /root/acme with the updated price. This exercises the release download and Alpine shell setup as well as the guide commands; the Studio build and automatic guide completion still need checking in Demoshell.

Demoshell rebuilds the VM when a Worktrunk release is published, so the recipe installs the latest release rather than a pinned version.