-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·171 lines (156 loc) · 6.41 KB
/
install.sh
File metadata and controls
executable file
·171 lines (156 loc) · 6.41 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#!/usr/bin/env bash
# install.sh — Install claude-team-cli profiles and CLI
# Usage: bash install.sh
#
# What this does:
# 1. Copies team member profiles to ~/.claude/team/
# 2. Installs the claude-team CLI to ~/.local/bin/
# 3. Checks that ~/.local/bin is on your PATH
# 4. Optionally enables the coordinator (proactive team check-ins)
set -euo pipefail
REPO_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
PROFILES_SRC="$REPO_DIR/profiles"
PROFILES_DST="$HOME/.claude/team"
COMMANDS_SRC="$REPO_DIR/commands"
COMMANDS_DST="$HOME/.claude/commands"
BIN_SRC="$REPO_DIR/bin/claude-team"
BIN_DST="$HOME/.local/bin/claude-team"
BRANCHES_INDEX="$HOME/.claude/branches/INDEX.md"
WORKTREES_ROOT="$HOME/.claude/worktrees"
bold() { printf '\033[1m%s\033[0m' "$*"; }
green() { printf '\033[32m%s\033[0m' "$*"; }
yellow(){ printf '\033[33m%s\033[0m' "$*"; }
dim() { printf '\033[2m%s\033[0m' "$*"; }
echo ""
echo "$(bold "claude-team-cli installer")"
echo "────────────────────────────────────"
echo ""
# 1. Install profiles
echo "Installing profiles to $PROFILES_DST ..."
mkdir -p "$PROFILES_DST"
cp "$PROFILES_SRC"/*.md "$PROFILES_DST/"
echo "$(green "✓") Profiles installed:"
for f in "$PROFILES_DST"/*.md; do
echo " $(dim "$f")"
done
echo ""
# 2. Install slash commands
echo "Installing slash commands to $COMMANDS_DST ..."
mkdir -p "$COMMANDS_DST"
cp "$COMMANDS_SRC"/*.md "$COMMANDS_DST/"
echo "$(green "✓") Slash commands installed:"
for f in "$COMMANDS_DST"/*.md; do
echo " $(dim "$f")"
done
echo ""
# 3. Install CLI (symlink so updates in the repo take effect immediately)
echo "Installing CLI to $BIN_DST ..."
mkdir -p "$(dirname "$BIN_DST")"
ln -sf "$BIN_SRC" "$BIN_DST"
chmod +x "$BIN_SRC"
echo "$(green "✓") CLI symlinked: $(dim "$BIN_DST → $BIN_SRC")"
echo ""
# 4. Create branch index if it doesn't exist
if [[ ! -f "$BRANCHES_INDEX" ]]; then
mkdir -p "$(dirname "$BRANCHES_INDEX")"
printf '# Branch Index\n\n| Date | Project | Branch | Plan Slug | Status | Notes |\n|---|---|---|---|---|---|\n' \
> "$BRANCHES_INDEX"
echo "$(green "✓") Branch index created: $(dim "$BRANCHES_INDEX")"
else
echo "$(green "✓") Branch index already exists: $(dim "$BRANCHES_INDEX")"
fi
echo ""
# 5. Create worktrees root
mkdir -p "$WORKTREES_ROOT"
echo "$(green "✓") Worktrees root ready: $(dim "$WORKTREES_ROOT")"
echo ""
# 6. PATH check
if echo "$PATH" | grep -q "$HOME/.local/bin"; then
echo "$(green "✓") ~/.local/bin is already on your PATH."
else
echo "$(yellow "!") ~/.local/bin is not on your PATH."
echo ""
echo " Add it by appending one of the following to your shell config:"
echo ""
echo " $(dim "# ~/.zshrc or ~/.bashrc")"
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
echo ""
echo " Then reload your shell:"
echo " source ~/.zshrc $(dim "# or ~/.bashrc")"
fi
# 7. Coordinator setup
echo ""
echo "$(bold "Coordinator") — proactive team check-ins"
echo ""
echo " $(bold "casual") (default): commit directly to main — no branch enforcement."
echo " $(bold "prod"): branch required before any code; worktrees + MR/PR flow."
echo ""
printf " Enable the coordinator now? [casual/prod/n] (default: casual) "
read -r coord_answer
coord_answer="${coord_answer:-casual}"
CLAUDE_MD="$HOME/.claude/CLAUDE.md"
COORD_START="<!-- CLAUDE-COORDINATOR:START -->"
COORD_END="<!-- CLAUDE-COORDINATOR:END -->"
_install_coord() {
local coord_file="$1"
local label="$2"
local content
content=$(cat "$coord_file")
local block
block=$(printf '%s\n%s\n%s' "$COORD_START" "$content" "$COORD_END")
if grep -qF "$COORD_START" "$CLAUDE_MD"; then
local tmp
tmp=$(mktemp)
awk "/$COORD_START/{exit} {print}" "$CLAUDE_MD" > "$tmp"
printf '%s\n%s\n%s\n' "$COORD_START" "$content" "$COORD_END" >> "$tmp"
awk "/$COORD_END/{found=1; next} found{print}" "$CLAUDE_MD" >> "$tmp"
mv "$tmp" "$CLAUDE_MD"
else
printf '\n%s\n' "$block" >> "$CLAUDE_MD"
fi
echo " $(green "✓") Coordinator enabled ($label mode)."
}
touch "$CLAUDE_MD"
case "$(echo "$coord_answer" | tr '[:upper:]' '[:lower:]')" in
prod)
_install_coord "$PROFILES_DST/coordinator-prod.md" "prod"
;;
n|no)
echo " $(dim "Skipped. Enable later with: claude-team coordinator on")"
;;
*)
_install_coord "$PROFILES_DST/coordinator.md" "casual"
;;
esac
echo ""
echo "$(bold "Done!") Your Claude dev team is ready."
echo ""
echo "Quick start:"
echo " claude-team list $(dim "# see your team")"
echo " claude-team use robin $(dim "# activate Robin (Testing)")"
echo " claude-team use akira $(dim "# activate Akira (Backend)")"
echo " claude-team use sasha $(dim "# activate Sasha (Frontend)")"
echo " claude-team use toni $(dim "# activate Toni (Product Marketing)")"
echo " claude-team use river $(dim "# activate River (Product)")"
echo " claude-team use sage $(dim "# activate Sage (Business Advisor)")"
echo " claude-team use kai $(dim "# activate Kai (UX Design)")"
echo " claude-team coordinator on $(dim "# casual mode (commit to main, no branch enforcement)")"
echo " claude-team coordinator prod $(dim "# prod mode (branch required before code)")"
echo " claude-team coordinator off $(dim "# disable coordinator")"
echo " claude-team reset $(dim "# return to default Claude")"
echo ""
echo "Parallel sessions (worktrees — preferred for multi-session work):"
echo " claude-team session start feat/<name> $(dim "# create isolated worktree + branch")"
echo " claude-team session status $(dim "# show current session details")"
echo " claude-team session done $(dim "# close session, remove worktree")"
echo " claude-team session list $(dim "# list all active sessions")"
echo ""
echo "Branch hygiene (single-session):"
echo " claude-team branch start feat/<name> $(dim "# register a branch before working")"
echo " claude-team branch done $(dim "# mark merged, print delete commands")"
echo " claude-team branch abandon $(dim "# mark abandoned")"
echo " claude-team branch guard install $(dim "# block accidental commits on main")"
echo ""
echo "Slash commands $(dim "(switch personas mid-session, no restart needed)"):"
echo " /robin /akira /sasha /toni /river /sage /kai /team /branch /session"
echo ""