gabriel / muse public
create_wire_test_repo.sh bash
89 lines 3.0 KB
Raw
sha256:f6cd81bc71702f5c1c6890bd39aaba994fe58c75f019d7c03934724fa2739bb4 fix: carry dev changes harmony dropped in merge — detached … Sonnet 4.6 minor ⚠ breaking 16 days ago
1 #!/usr/bin/env bash
2 # create_wire_test_repo.sh <N> [--large]
3 #
4 # Creates (or resets) ~/ecosystem/muse-wire-test with exactly N files.
5 # Without --large: each file is ~1 KB of deterministic pseudorandom content.
6 # With --large: each file is ~400 KB (forces OC-frame chunking via Phase 14B).
7 #
8 # After reset, configures staging + direct remotes and creates the repo on
9 # MuseHub staging if it does not already exist.
10 #
11 # Usage:
12 # bash create_wire_test_repo.sh 2000
13 # bash create_wire_test_repo.sh 10 --large
14
15 set -euo pipefail
16
17 N=${1:-10}
18 LARGE=0
19 for arg in "${@:2}"; do
20 [[ "$arg" == "--large" ]] && LARGE=1
21 done
22
23 REPO_DIR="$HOME/ecosystem/muse-wire-test"
24 STAGING_URL="https://staging.musehub.ai/gabriel/muse-wire-test"
25 DIRECT_URL="http://23.22.27.39:1337/gabriel/muse-wire-test"
26
27 echo "==> Resetting $REPO_DIR with N=$N files ($([ $LARGE -eq 1 ] && echo 'LARGE ~400KB' || echo 'small ~1KB') each)"
28
29 # Remove and reinitialise
30 rm -rf "$REPO_DIR"
31 mkdir -p "$REPO_DIR"
32 muse -C "$REPO_DIR" init --json > /dev/null
33
34 # Generate N files with deterministic content — single Python invocation
35 echo "==> Generating $N files..."
36 python3 - "$REPO_DIR" "$N" "$LARGE" <<'PYEOF'
37 import sys, hashlib, os
38 repo_dir, n, large = sys.argv[1], int(sys.argv[2]), sys.argv[3] == "1"
39 for i in range(n):
40 fname = os.path.join(repo_dir, f"file_{i:06d}.txt")
41 if large:
42 lines = []
43 for line in range(400):
44 seed = f"wire-test-large-{i}-{line}"
45 h = hashlib.sha256(seed.encode()).hexdigest()
46 lines.append((h * 32)[:1024])
47 content = "\n".join(lines) + "\n"
48 else:
49 h = hashlib.sha256(f"wire-test-{i}".encode()).hexdigest()
50 content = (h * 32)[:1024] + "\n"
51 with open(fname, "w") as f:
52 f.write(content)
53 PYEOF
54
55 # Stage and commit
56 echo "==> Staging and committing..."
57 muse -C "$REPO_DIR" code add . --json > /dev/null
58 muse -C "$REPO_DIR" commit \
59 -m "test: $N $([ $LARGE -eq 1 ] && echo 'large' || echo 'small') objects for wire protocol testing" \
60 --agent-id claude-code \
61 --model-id claude-sonnet-4-6 \
62 --sign \
63 --json > /dev/null
64
65 # Configure remotes (add or update)
66 echo "==> Configuring remotes..."
67 muse -C "$REPO_DIR" remote add staging "$STAGING_URL" --json > /dev/null 2>&1 || \
68 muse -C "$REPO_DIR" remote set-url staging "$STAGING_URL" --json > /dev/null
69 muse -C "$REPO_DIR" remote add direct "$DIRECT_URL" --json > /dev/null 2>&1 || \
70 muse -C "$REPO_DIR" remote set-url direct "$DIRECT_URL" --json > /dev/null
71
72 # Create repo on MuseHub staging if missing
73 echo "==> Ensuring gabriel/muse-wire-test exists on staging..."
74 muse -C "$REPO_DIR" hub repo read \
75 --hub https://staging.musehub.ai --json > /dev/null 2>&1 || \
76 muse -C "$REPO_DIR" hub repo create \
77 --name muse-wire-test \
78 --visibility public \
79 --hub https://staging.musehub.ai \
80 --json > /dev/null
81
82 echo ""
83 echo "==> Done. $REPO_DIR ready with $N files."
84 echo " Remotes:"
85 muse -C "$REPO_DIR" remote --json | python3 -c "
86 import sys, json
87 for r in json.load(sys.stdin)['remotes']:
88 print(f' {r[\"name\"]}: {r[\"url\"]}')
89 "
File History 2 commits
sha256:43c82f6d4fa2e85dd9ed9dd1a31199ec6b481191517aba66dfa9da275dbfa1af Merge branch 'dev' into main Human 2 days ago
sha256:fb67fed5a4d3e40de84bdd163de94ef1386570bef1dd1a020a732c8a038962ce Merge branch 'dev' into main Human 21 days ago