#!/usr/bin/env bash # Builds chess-episode22/ for Episode 22 ("Build Something Weird With # Muse") -- the season finale. Uses `muse-dev`, not plain `muse`: the # chess domain plugin was built live for this episode and committed to # muse's dev branch, but has not gone through a published release yet # (see docs/agent-guide.md's muse-vs-muse-dev section). Re-run to # regenerate; never hand-edit the repo directory directly. set -euo pipefail HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" REPO="$HERE/chess-episode22" rm -rf "$REPO" mkdir -p "$REPO" cd "$REPO" echo "=== Part 1: a brand new domain, zero special-casing ===" muse-dev init --domain chess --json | python3 -m json.tool printf 'e4\ne5\n' > game.moves muse-dev status --json | python3 -c "import json,sys; print('added:', json.load(sys.stdin)['added'])" muse-dev commit -m "1. e4 e5 -- the open game" \ --agent-id claude-code --model-id claude-sonnet-5 --sign echo echo "=== Part 2: two real variations, diverging from the same position ===" muse-dev checkout -b variation/italian --intent "explore 3. Bc4, the Italian Game" --resumable printf 'e4\ne5\nBc4\n' > game.moves muse-dev commit -m "3. Bc4 -- the Italian Game" \ --agent-id claude-code --model-id claude-sonnet-5 --sign muse-dev switch main muse-dev checkout -b variation/spanish --intent "explore 3. Nf3 heading toward the Ruy Lopez" --resumable printf 'e4\ne5\nNf3\n' > game.moves muse-dev commit -m "3. Nf3 -- heading toward the Ruy Lopez" \ --agent-id claude-code --model-id claude-sonnet-5 --sign echo echo "=== Part 3: the real structured delta -- position-addressed moves ===" muse-dev read variation/italian --json --manifest | python3 -c " import json, sys d = json.load(sys.stdin) print(json.dumps(d['structured_delta'], indent=2)) " echo echo "=== Part 4: fast-forward merge (spanish extends main cleanly) ===" muse-dev switch main muse-dev merge variation/spanish --json | python3 -m json.tool | head -12 echo echo "=== Part 5: the real merge conflict -- a genuine 'variation' ===" muse-dev merge variation/italian --json | python3 -m json.tool || true echo "--- working tree conflict markers ---" cat game.moves echo echo "=== Part 6: not every conflict needs forcing -- both lines live on ===" muse-dev merge --abort muse-dev branch --json | python3 -c " import json, sys for b in json.load(sys.stdin): print(b['name'], '--', b.get('intent') or '(no intent)') " echo echo "=== Part 7: chess, registered exactly like every other domain ===" muse-dev domains --json | python3 -c " import json, sys d = json.load(sys.stdin) print([x['domain'] for x in d['domains']]) " echo echo "Demo built at $REPO"