#!/bin/sh # 0G Builder Hub installer. # # curl -fsSL https://build.0g.ai/install | sh # # Puts the 0G agent skills in ./.0g-skills so your coding assistant can read # them, and prints the one line to add to your assistant's instructions file. # # Nothing happens until you say yes, and it never rewrites CLAUDE.md, # .cursorrules, copilot-instructions.md, or any settings file. Those belong to # you. It writes ./.0g-skills, and one line in .gitignore if you agree to it. # # POSIX sh. No bashisms, no sudo, no eval of anything fetched. set -eu REPO="https://github.com/0gfoundation/0g-agent-skills" DIR=".0g-skills" RPC_TESTNET="https://evmrpc-testnet.0g.ai" INDEXER_TESTNET="https://indexer-storage-testnet-turbo.0g.ai" ATTESTOR_TESTNET="https://agenticid.0g.ai" PC_INSTALL="curl -fsSL https://pc.0g.ai/install | bash -s claude --key -" TAGLINE="Build on the trust layer for AI" AGENT="" OTHER_NAME="" ASSUME_YES=0 PARTS="" WANT_COMPUTE=0 WANT_STORAGE=0 WANT_CHAIN=0 WANT_INFT=0 # --------------------------------------------------------------------------- # Presentation # # Colour and box-drawing only when a terminal is there to render them. stdout # is the terminal even when this script arrives through a pipe, so -t 1 is the # right test. NO_COLOR and TERM=dumb are honoured. # --------------------------------------------------------------------------- if [ -t 1 ] && [ -z "${NO_COLOR:-}" ] && [ "${TERM:-dumb}" != "dumb" ]; then C_RESET=$(printf '\033[0m') C_BOLD=$(printf '\033[1m') C_DIM=$(printf '\033[2m') # Hero Purple, #B75FFF, the same accent the site uses. Truecolor when the # terminal advertises it, the nearest xterm-256 purple when it does not, and # plain magenta as the last resort. case "${COLORTERM:-}" in truecolor|24bit) C_ACCENT=$(printf '\033[38;2;183;95;255m') ;; *) case "${TERM:-}" in *256color*) C_ACCENT=$(printf '\033[38;5;141m') ;; *) C_ACCENT=$(printf '\033[35m') ;; esac ;; esac C_OK=$(printf '\033[32m') FANCY=1 else C_RESET=""; C_BOLD=""; C_DIM=""; C_ACCENT=""; C_OK="" FANCY=0 fi COLS=$(tput cols 2>/dev/null || printf '80') case "$COLS" in ''|*[!0-9]*) COLS=80 ;; esac [ "$COLS" -ge 40 ] || COLS=40 [ "$COLS" -le 100 ] || COLS=100 say() { printf '%s\n' "$1"; } pad() { # pad : spaces, without relying on printf field widths i=0 while [ "$i" -lt "$1" ]; do printf ' ' i=$((i + 1)) done } centre() { # centre : width is passed in because ${#text} # counts bytes, not columns, in most shells, and the logo is UTF-8. offset=$(((COLS - $1) / 2)) [ "$offset" -ge 0 ] || offset=0 pad "$offset" printf '%s\n' "$2" } rule() { width=$((COLS - 4)) printf '%s ' "$C_DIM" i=0 while [ "$i" -lt "$width" ]; do if [ "$FANCY" -eq 1 ]; then printf '─'; else printf '-'; fi i=$((i + 1)) done printf '%s\n' "$C_RESET" } header() { say "" if [ "$FANCY" -eq 1 ]; then # "0G", 19 columns wide on every line printf '%s' "$C_ACCENT" centre 19 ' ██████╗ ██████╗ ' centre 19 '██╔═══██╗ ██╔════╝ ' centre 19 '██║ ██║ ██║ ███╗' centre 19 '██║ ██║ ██║ ██║' centre 19 '╚██████╔╝ ╚██████╔╝' centre 19 ' ╚═════╝ ╚═════╝ ' printf '%s' "$C_RESET" say "" printf '%s' "$C_BOLD" centre 31 "$TAGLINE" printf '%s' "$C_RESET" else say " 0G BUILDER HUB" say " $TAGLINE" fi say "" rule say "" } field() { # field