| 1 | #!/bin/sh |
| 2 | # Connects Claude Code on this machine to g1t. g1t's Claude Code plugin |
| 3 | # records your sessions on g1t, loads an issue's work context, and adds |
| 4 | # g1t's MCP server and commands; this prints the two commands that install |
| 5 | # it. With --cli it also installs the g1t CLI, which the plugin's hooks use: |
| 6 | # |
| 7 | # curl -fsSL https://g1t.sh/install/claude.sh | sh |
| 8 | # curl -fsSL https://g1t.sh/install/claude.sh | sh -s -- --cli |
| 9 | # |
| 10 | # It changes nothing else. An earlier version of this script installed a |
| 11 | # hook in ~/.g1t; if that is there, it is brought up to date, and you can |
| 12 | # remove it once the plugin is installed (see below). |
| 13 | set -eu |
| 14 | |
| 15 | BASE="${G1T_SITE:-https://g1t.sh}" |
| 16 | |
| 17 | if [ "${1:-}" = "--cli" ]; then |
| 18 | curl -fsSL "$BASE/install" | sh |
| 19 | fi |
| 20 | |
| 21 | if [ -f "$HOME/.g1t/hook.mjs" ]; then |
| 22 | curl -fsSL "$BASE/install/hook.mjs" -o "$HOME/.g1t/hook.mjs" |
| 23 | echo "Updated the earlier g1t hook in ~/.g1t/hook.mjs. The plugin replaces it:" |
| 24 | echo "once the plugin is installed, remove the \`node \"$HOME/.g1t/hook.mjs\"\`" |
| 25 | echo "entries from ~/.claude/settings.json, so a session is not recorded twice." |
| 26 | echo |
| 27 | fi |
| 28 | |
| 29 | cat <<EOF |
| 30 | Install g1t's plugin for Claude Code: |
| 31 | |
| 32 | claude plugin marketplace add $BASE/flagon-io/g1t.git |
| 33 | claude plugin install g1t@g1t |
| 34 | |
| 35 | The plugin's hooks use the g1t CLI. If you do not have it yet, install it |
| 36 | (curl -fsSL $BASE/install | sh) and sign in with \`g1t auth login\`. |
| 37 | Then, in Claude Code, run /mcp and choose g1t to sign its tools in. |
| 38 | |
| 39 | Guide: https://docs.g1t.sh/guides/claude-code-plugin/ |
| 40 | EOF |