Output docs/assets/workspace-first-run.gif

Require uv
Require python3

Set Shell "zsh"
Set FontSize 18
Set Width 1400
Set Height 860
Set Theme "Dracula"
Set TypingSpeed 35ms
Set Padding 24
Set WindowBar Colorful

Hide
Type "cd /home/thales/projects/personal/pyro"
Enter
Type "setopt interactivecomments"
Enter
Type "export UV_CACHE_DIR=.uv-cache"
Enter
Type "export PYRO_ENVIRONMENT_CACHE_DIR=$(mktemp -d)"
Enter
Type "alias pyro='uv run pyro'"
Enter
Type "SEED_DIR=$(mktemp -d)"
Enter
Type "SYNC_DIR=$(mktemp -d)"
Enter
Type "EXPORT_DIR=$(mktemp -d)"
Enter
Type 'printf "%s\n" "hello from seed" > "$SEED_DIR/note.txt"'
Enter
Type 'printf "%s\n" "hello from sync" > "$SYNC_DIR/note.txt"'
Enter
Type "pyro env pull debian:12 >/dev/null"
Enter
Show

Type "# Create a stable workspace from host content and capture its id"
Enter
Sleep 700ms
Type 'pyro workspace create debian:12 --seed-path "$SEED_DIR" --json | tee /tmp/pyro-workspace.json'
Enter
Sleep 2200ms

Hide
Type 'export WORKSPACE_ID=$(python3 -c "import json; print(json.load(open(\"/tmp/pyro-workspace.json\", encoding=\"utf-8\"))[\"workspace_id\"])")'
Enter
Show

Type "# Push a later host-side change into the same workspace"
Enter
Sleep 700ms
Type 'pyro workspace sync push "$WORKSPACE_ID" "$SYNC_DIR"'
Enter
Sleep 1800ms

Type "# Run inside the live workspace"
Enter
Sleep 700ms
Type 'pyro workspace exec "$WORKSPACE_ID" -- cat note.txt'
Enter
Sleep 2000ms

Type "# Capture a checkpoint, then start one long-running service"
Enter
Sleep 700ms
Type 'pyro workspace snapshot create "$WORKSPACE_ID" checkpoint'
Enter
Sleep 1800ms
Type 'pyro workspace service start "$WORKSPACE_ID" web --ready-file .web-ready -- sh -lc "touch .web-ready && while true; do sleep 60; done"'
Enter
Sleep 2200ms

Type "# Reset the full sandbox back to that checkpoint"
Enter
Sleep 700ms
Type 'pyro workspace reset "$WORKSPACE_ID" --snapshot checkpoint'
Enter
Sleep 2200ms

Type "# Export one file back to the host and inspect it locally"
Enter
Sleep 700ms
Type 'pyro workspace export "$WORKSPACE_ID" note.txt --output "$EXPORT_DIR/note.txt"'
Enter
Sleep 1800ms
Type 'cat "$EXPORT_DIR/note.txt"'
Enter
Sleep 1800ms

Type "# Remove the workspace when the loop is done"
Enter
Sleep 700ms
Type 'pyro workspace delete "$WORKSPACE_ID"'
Enter
Sleep 2000ms
