#!/usr/bin/env bash # genesis installer - the single command. # # curl -fsSL https://rw.zo.space/api/genesis | bash # # Downloads the bundle into /home/workspace/infra/skills/genesis and stops. # It deliberately does NOT scaffold anything: what gets written depends on four # questions the agent has to ask first, and a workspace scaffolded against # guessed answers is worse than an empty one. # # Flags: # --root install somewhere other than /home/workspace # --update overwrite an existing install set -euo pipefail ROOT="/home/workspace" BUNDLE_URL="${GENESIS_BUNDLE_URL:-https://rw.zo.space/api/genesis/bundle}" UPDATE=0 while [ $# -gt 0 ]; do case "$1" in --root) ROOT="$2"; shift 2 ;; --update) UPDATE=1; shift ;; *) echo "unknown flag: $1" >&2; exit 2 ;; esac done DEST="$ROOT/infra/skills/genesis" if [ -d "$DEST" ] && [ "$UPDATE" -eq 0 ]; then echo "genesis is already installed at $DEST" echo "Re-run with --update to replace it." exit 0 fi command -v bun >/dev/null 2>&1 || { echo "bun is required and is normally pre-installed on Zo" >&2; exit 1; } TMP="$(mktemp -d)" trap 'rm -rf "$TMP"' EXIT echo "Fetching genesis..." curl -fsSL "$BUNDLE_URL" -o "$TMP/genesis.tar.gz" mkdir -p "$DEST" tar -xzf "$TMP/genesis.tar.gz" -C "$DEST" --strip-components=1 chmod +x "$DEST/install.sh" "$DEST/scripts/"*.ts 2>/dev/null || true VERSION="$(grep -o '"version": *"[^"]*"' "$DEST/manifest.json" 2>/dev/null | head -1 | cut -d'"' -f4 || echo "?")" cat <