#!/usr/bin/env bash
set -euo pipefail
checkout=$1
scenario_home=$2
workspace="$scenario_home/workspace"
mkdir -p "$workspace"
cat > "$workspace/selection.md" <<'MARKDOWN'
# Field notes

Only this paragraph belongs to the file.

- [ ] Review the field notes

End of file.
MARKDOWN
git -C "$workspace" init --quiet --initial-branch=main
git -C "$workspace" add selection.md
git -C "$workspace" -c user.name=Scenario -c user.email=scenario@example.invalid commit --quiet -m 'Add field notes'
cd "$checkout"
node apps/server/src/bin.ts project add "$workspace" --title 'Markdown demo' --base-dir "$scenario_home"
node apps/server/src/bin.ts thread start "$workspace" 'This conversation must never be copied with the file.' --title 'Surrounding conversation' --provider devReplay --model multi-turn --wait --json --base-dir "$scenario_home"
