Repository navigation
Expand file tree
/
Copy pathsetup
More file actions
executable file
·92 lines (82 loc) · 3.71 KB
/
Copy pathsetup
File metadata and controls
executable file
·92 lines (82 loc) · 3.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#!/usr/bin/env bash
# gstack-loops installer. Verifies deps, registers slash commands, puts `gloop`
# on PATH. Run from the cloned repo: cd ~/.claude/skills/gstack-loops && ./setup
set -euo pipefail
HERE="$(cd "$(dirname "$0")" && pwd)"
SKILLS_DIR="$HOME/.claude/skills"
BIN_DIR="$HOME/.local/bin"
TEAM=0
[ "${1:-}" = "--team" ] && TEAM=1
say() { printf '%s\n' "$*"; }
ok() { printf ' \033[32m✓\033[0m %s\n' "$*"; }
warn(){ printf ' \033[33m!\033[0m %s\n' "$*"; }
die() { printf '\033[31m✗ %s\033[0m\n' "$*" >&2; exit 1; }
say ""
say "Installing gstack-loops from $HERE"
say ""
# 1. Hard dependency: gstack. Offer to install it (official one-liner) if missing,
# so a teammate gets the whole stack in one flow.
GSTACK_REPO="https://github.com/garrytan/gstack.git"
install_gstack() {
git clone --depth 1 "$GSTACK_REPO" "$SKILLS_DIR/gstack"
( cd "$SKILLS_DIR/gstack" && ./setup )
}
if [ ! -d "$SKILLS_DIR/gstack/bin" ]; then
warn "gstack not found at $SKILLS_DIR/gstack"
if [ -t 0 ] && [ "${GLOOP_AUTO_GSTACK:-}" != "0" ]; then
printf " Install gstack now (git clone + ./setup)? [Y/n] "
read -r ans
case "${ans:-Y}" in
[Nn]*) die "gstack is required. Install it, then re-run: $GSTACK_REPO" ;;
*) install_gstack ;;
esac
elif [ "${GLOOP_AUTO_GSTACK:-}" = "1" ]; then
install_gstack
else
die "gstack is required but not found.
Install it first:
git clone --depth 1 $GSTACK_REPO ~/.claude/skills/gstack
cd ~/.claude/skills/gstack && ./setup
(or re-run this with GLOOP_AUTO_GSTACK=1 to auto-install). Then re-run."
fi
fi
[ -d "$SKILLS_DIR/gstack/bin" ] || die "gstack install did not complete — check the output above."
ok "gstack ready"
# gstack best-practice nudges (non-blocking): proactive skills on, browse over chrome MCP.
if [ -x "$SKILLS_DIR/gstack/bin/gstack-config" ]; then
_pro="$("$SKILLS_DIR/gstack/bin/gstack-config" get proactive 2>/dev/null || echo true)"
[ "$_pro" = "false" ] && warn "gstack 'proactive' is off — loops rely on skill routing; enable with: gstack-config set proactive true"
fi
# 2. node (required to run gloop).
command -v node >/dev/null 2>&1 || die "node not found on PATH (need >=18)."
ok "node $(node --version)"
# 3. Soft deps: gh + claude (needed for shipping / the headless driver).
command -v gh >/dev/null 2>&1 && ok "gh found" || warn "gh not found — /ship and 'gloop reap' need it (https://cli.github.com/)"
command -v claude >/dev/null 2>&1 && ok "claude CLI found" || warn "claude CLI not found — the headless driver ('gloop run --mode bypass|autonomous') needs it"
# 4. Register slash-command skills by symlinking them to the top-level skills dir.
mkdir -p "$SKILLS_DIR"
for d in "$HERE"/skills/*/; do
name="$(basename "$d")"
ln -sfn "$d" "$SKILLS_DIR/$name"
done
ok "registered slash commands: $(cd "$HERE/skills" && ls -d */ | tr -d / | tr '\n' ' ')"
# 5. Put gloop on PATH.
mkdir -p "$BIN_DIR"
ln -sfn "$HERE/bin/gloop" "$BIN_DIR/gloop"
chmod +x "$HERE/bin/gloop"
if printf '%s' ":$PATH:" | grep -q ":$BIN_DIR:"; then
ok "gloop linked into $BIN_DIR (on PATH)"
else
warn "gloop linked into $BIN_DIR — add it to PATH: export PATH=\"\$HOME/.local/bin:\$PATH\""
fi
say ""
if [ "$TEAM" = "1" ]; then
say "Team mode: in each workspace, run 'gloop init' and commit the generated loops.json +"
say "CLAUDE.md so teammates who clone it just run this installer once and are ready."
say "For gstack's own team enforcement (per repo), also see: gstack-team-init required"
fi
say "Done — gstack + gstack-loops are set up. Next:"
say " cd <your workspace with 1+ git repos>"
say " gloop init # detect repos → loops.json + CLAUDE.md conventions"
say " gloop new my-feature # create paired worktrees on feat/my-feature"
say ""