make-mist-episode20-demo.sh bash
61 lines 2.7 KB
Raw
sha256:5472be4fece32b606c308fad9d57295ce327955fb2b87b8beec6ea1626050473 Add published YouTube URL to Episode 00 Sonnet 5 1 hour ago
1 #!/usr/bin/env bash
2 # Drives real muse mist commands for Episode 20 ("Mist"). Requires the
3 # local MuseHub dev stack running. Re-run to regenerate; each run creates
4 # fresh Mists (content-addressed IDs derived from a timestamp-salted file).
5 set -euo pipefail
6
7 HUB="https://localhost:1337"
8 DIR="$(mktemp -d)"
9 cd "$DIR"
10
11 echo "=== Part 1: create, sign, and push a real Mist (fast path) ==="
12 cat > validate_assignee.py <<EOF
13 def validate_assignee(handle: str, collaborators: set[str]) -> bool:
14 """Return True if handle is a valid assignee for this repo."""
15 return handle in collaborators
16
17 # episode-20 salt: $(date +%s)
18 EOF
19 CREATE_JSON=$(muse mist create validate_assignee.py --title "Validate assignee helper" \
20 --description "A tiny reusable snippet, shared as a Mist." \
21 --sign --push --hub "$HUB" --json)
22 echo "$CREATE_JSON" | python3 -m json.tool
23 MIST_ID=$(echo "$CREATE_JSON" | python3 -c "import json,sys; print(json.load(sys.stdin)['mist_id'])")
24
25 echo
26 echo "=== Part 2: read it back -- real symbol anchoring, no VCS lineage ==="
27 muse mist read "gabriel/$MIST_ID" --hub "$HUB" --json | python3 -m json.tool
28
29 echo
30 echo "=== Part 3: the honest part -- the documented manual push workflow crashes ==="
31 mkdir -p vcs-repo && cd vcs-repo
32 muse init --domain mist --json > /dev/null
33 echo "A four-note motif, described in prose: C, E, G, C (up an octave)." > motif.txt
34 muse commit -m "Add motif description" --agent-id claude-code --model-id claude-sonnet-5 --sign --json > /dev/null
35 echo "--- muse mist push (exactly as --help documents) ---"
36 muse mist push --remote local --branch main 2>&1 | tail -8 || true
37 cd ..
38
39 echo
40 echo "=== Part 4: fork -- real, works correctly ==="
41 FORK_JSON=$(muse mist fork "gabriel/$MIST_ID" --hub "$HUB" --json)
42 echo "$FORK_JSON" | python3 -m json.tool
43 echo "--- forkCount on the original, confirmed real ---"
44 muse mist read "gabriel/$MIST_ID" --hub "$HUB" --json | python3 -c "import json,sys; print('forkCount:', json.load(sys.stdin)['forkCount'])"
45
46 echo
47 echo "=== Part 5: the second honest part -- muse mist forks silently returns {} ==="
48 echo "--- via the CLI ---"
49 muse mist forks "gabriel/$MIST_ID" --hub "$HUB" --json
50 echo "--- the same query, raw curl + hand-signed header ---"
51 HEADER=$(muse sign header --method GET --path "/api/mists/$MIST_ID/forks" --hub "$HUB" --json | python3 -c "import json,sys; print(json.load(sys.stdin)['header_value'])")
52 curl -sk "$HUB/api/mists/$MIST_ID/forks" -H "Authorization: $HEADER"
53
54 echo
55 echo "=== Part 6: embed and raw -- both real, both work ==="
56 muse mist embed "gabriel/$MIST_ID" --hub "$HUB" --json | python3 -m json.tool
57 echo "--- raw bytes ---"
58 muse mist raw "gabriel/$MIST_ID" --hub "$HUB"
59
60 echo
61 echo "Demo complete. (scratch dir: $DIR)"
File History 1 commit
sha256:5472be4fece32b606c308fad9d57295ce327955fb2b87b8beec6ea1626050473 Add published YouTube URL to Episode 00 Sonnet 5 1 hour ago