g1t/apps/web/public/install/claude.sh
| 1 | #!/bin/sh |
| 2 | # Connects Claude Code on this machine to g1t, so the sessions of your own |
| 3 | # agent are recorded onto the pull requests they belong to: |
| 4 | # |
| 5 | # curl -fsSL https://g1t.sh/install/claude.sh | sh |
| 6 | # |
| 7 | # It downloads two small scripts into ~/.g1t, signs you in through the |
| 8 | # browser, and adds a hook to ~/.claude/settings.json. Needs Node 18 or |
| 9 | # later, which Claude Code itself runs on. |
| 10 | set -eu |
| 11 | |
| 12 | BASE="${G1T_SITE:-https://g1t.sh}" |
| 13 | |
| 14 | if ! command -v node >/dev/null 2>&1; then |
| 15 | echo "g1t: Node 18 or later is needed (Claude Code runs on it too)." >&2 |
| 16 | exit 1 |
| 17 | fi |
| 18 | |
| 19 | mkdir -p "$HOME/.g1t" |
| 20 | curl -fsSL "$BASE/install/hook.mjs" -o "$HOME/.g1t/hook.mjs" |
| 21 | curl -fsSL "$BASE/install/setup.mjs" -o "$HOME/.g1t/setup.mjs" |
| 22 | # Read from the terminal, not from the pipe this script arrived on. |
| 23 | node "$HOME/.g1t/setup.mjs" < /dev/tty |