Files
paperclip-harness/bin/layout

34 lines
1.3 KiB
Bash
Executable File

#!/usr/bin/env bash
# Build the project's pages in TUIOS, in a fixed order, without closing anything.
#
# Workspace 1 keeps a shell: it is the pane that never exits, so the session
# cannot lose its first workspace. Each screen then gets a workspace named after
# it, in this order. Running this again adopts what is already there.
#
# bin/layout # the default project
# bin/layout spike-2026-11-10 AUD-162
set -euo pipefail
SESSION="${PAPERCLIP_HARNESS_SESSION:-paperclip-harness}"
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
project="${1:-spike-2026-11-10}"
task="${2:-AUD-162}"
# Resolve workspace 1 by name, never by number.
first_name="$(tuios list-workspaces -s "$SESSION" --json |
python3 -c 'import json,sys; w=json.load(sys.stdin)["workspaces"]; print(next((x["name"] for x in w if x["workspace"]==1), ""))')"
if [ -z "$first_name" ]; then
tuios set-workspace-name 1 shell -s "$SESSION" >/dev/null
echo "named workspace 1 shell"
fi
"$ROOT/bin/screen" tree "$project"
"$ROOT/bin/screen" reply "$task"
tuios list-workspaces -s "$SESSION" --json | python3 -c '
import json,sys
for w in json.load(sys.stdin)["workspaces"]:
if w["window_count"]:
print(" workspace %d %-8s %d pane(s)" % (w["workspace"], w["name"] or "(unnamed)", w["window_count"]))
'