-
Notifications
You must be signed in to change notification settings - Fork 45
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·211 lines (193 loc) · 6.57 KB
/
Copy pathinstall.sh
File metadata and controls
executable file
·211 lines (193 loc) · 6.57 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
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
#!/bin/bash
# vibecosystem installer
# Merges ecosystem files without overwriting your existing setup
set -e
REPO_DIR="$(cd "$(dirname "$0")" && pwd)"
CLAUDE_DIR="$HOME/.claude"
FORCE=false
ADDED=0
SKIPPED=0
# Parse flags
for arg in "$@"; do
case $arg in
--force) FORCE=true ;;
--non-interactive) NON_INTERACTIVE=true ;;
--help|-h)
echo "Usage: ./install.sh [--force] [--non-interactive]"
echo ""
echo " --force Overwrite existing files (default: skip existing)"
echo " --non-interactive Skip confirmation prompt"
echo ""
echo "Without --force, only NEW files are added. Your existing agents,"
echo "skills, hooks, and rules are preserved."
exit 0
;;
esac
done
echo "vibecosystem installer"
echo "======================"
echo ""
echo "This will install into ~/.claude/:"
echo " - 138 agents -> ~/.claude/agents/"
echo " - 296 skills -> ~/.claude/skills/"
echo " - 74 hooks -> ~/.claude/hooks/"
echo " - 20 rules -> ~/.claude/rules/"
echo ""
if [ "$FORCE" = true ]; then
echo "Mode: OVERWRITE (--force) — existing files will be replaced"
else
echo "Mode: MERGE (default) — existing files will be preserved"
fi
echo ""
if [ "$NON_INTERACTIVE" != true ]; then
read -p "Continue? (y/N) " -n 1 -r
echo
[[ $REPLY =~ ^[Yy]$ ]] || exit 0
fi
# Backup (only in force mode, since merge mode doesn't touch existing files)
if [ "$FORCE" = true ]; then
if [ -d "$CLAUDE_DIR/agents" ] || [ -d "$CLAUDE_DIR/skills" ]; then
BACKUP="$CLAUDE_DIR/backup-$(date +%Y%m%d-%H%M%S)"
echo "Backing up existing files to: $BACKUP"
mkdir -p "$BACKUP"
[ -d "$CLAUDE_DIR/agents" ] && cp -r "$CLAUDE_DIR/agents" "$BACKUP/"
[ -d "$CLAUDE_DIR/skills" ] && cp -r "$CLAUDE_DIR/skills" "$BACKUP/"
[ -d "$CLAUDE_DIR/hooks" ] && cp -r "$CLAUDE_DIR/hooks" "$BACKUP/"
[ -d "$CLAUDE_DIR/rules" ] && cp -r "$CLAUDE_DIR/rules" "$BACKUP/"
echo ""
fi
fi
# Smart copy function: skip existing files unless --force
smart_copy_file() {
local src="$1"
local dest="$2"
if [ "$FORCE" = true ] || [ ! -e "$dest" ]; then
cp "$src" "$dest"
ADDED=$((ADDED + 1))
else
SKIPPED=$((SKIPPED + 1))
fi
}
smart_copy_dir() {
local src="$1"
local dest="$2"
if [ "$FORCE" = true ] || [ ! -e "$dest" ]; then
cp -r "$src" "$dest"
ADDED=$((ADDED + 1))
else
SKIPPED=$((SKIPPED + 1))
fi
}
# Agents
echo "Installing agents..."
mkdir -p "$CLAUDE_DIR/agents"
for f in "$REPO_DIR/agents/"*.md; do
name=$(basename "$f")
smart_copy_file "$f" "$CLAUDE_DIR/agents/$name"
done
# Skills
echo "Installing skills..."
mkdir -p "$CLAUDE_DIR/skills"
for d in "$REPO_DIR/skills/"*/; do
name=$(basename "$d")
[ "$name" = "*" ] && continue
smart_copy_dir "$d" "$CLAUDE_DIR/skills/$name"
done
# Hooks (pre-built dist/ — no npm/node required)
echo "Installing hooks..."
mkdir -p "$CLAUDE_DIR/hooks/dist"
mkdir -p "$CLAUDE_DIR/hooks/src/shared"
# Copy pre-built .mjs files (ready to use, no build needed)
for f in "$REPO_DIR/hooks/dist/"*.mjs; do
name=$(basename "$f")
smart_copy_file "$f" "$CLAUDE_DIR/hooks/dist/$name"
done
# Copy source files (for users who want to customize and rebuild)
for f in "$REPO_DIR/hooks/src/"*.ts; do
name=$(basename "$f")
smart_copy_file "$f" "$CLAUDE_DIR/hooks/src/$name"
done
for f in "$REPO_DIR/hooks/src/shared/"*.ts; do
name=$(basename "$f")
smart_copy_file "$f" "$CLAUDE_DIR/hooks/src/shared/$name"
done
[ -f "$REPO_DIR/hooks/package.json" ] && cp "$REPO_DIR/hooks/package.json" "$CLAUDE_DIR/hooks/package.json"
[ -f "$REPO_DIR/hooks/tsconfig.json" ] && cp "$REPO_DIR/hooks/tsconfig.json" "$CLAUDE_DIR/hooks/tsconfig.json"
HOOK_COUNT=$(ls "$CLAUDE_DIR/hooks/dist/"*.mjs 2>/dev/null | wc -l | tr -d ' ')
# Register hooks in ~/.claude/settings.json (copied hooks never fire without this)
echo "Registering hooks in settings.json..."
if command -v node >/dev/null 2>&1; then
node "$REPO_DIR/tools/register-hooks.mjs" "$REPO_DIR/hooks/hooks.json" "$CLAUDE_DIR/settings.json" "$CLAUDE_DIR" || \
echo " WARNING: hook registration failed - merge hooks/hooks.json into settings.json manually"
else
echo " WARNING: node not found - hooks copied but NOT registered."
echo " Install Node.js and re-run, or merge hooks/hooks.json into ~/.claude/settings.json manually."
fi
# Rules
echo "Installing rules..."
mkdir -p "$CLAUDE_DIR/rules"
for f in "$REPO_DIR/rules/"*.md; do
name=$(basename "$f")
smart_copy_file "$f" "$CLAUDE_DIR/rules/$name"
done
# Tools (dashboard etc.)
echo "Installing tools..."
mkdir -p "$CLAUDE_DIR/tools/dashboard"
for f in "$REPO_DIR/tools/dashboard/"*; do
[ -f "$f" ] || continue
name=$(basename "$f")
smart_copy_file "$f" "$CLAUDE_DIR/tools/dashboard/$name"
done
# Scripts (MCP etc.)
echo "Installing scripts/mcp..."
mkdir -p "$CLAUDE_DIR/scripts/mcp"
for f in "$REPO_DIR/scripts/mcp/"*; do
[ -f "$f" ] || continue
name=$(basename "$f")
smart_copy_file "$f" "$CLAUDE_DIR/scripts/mcp/$name"
done
# GitHub Workflows (templates - copy to your project's .github/workflows/ manually)
if [ -d "$REPO_DIR/.github/workflows" ]; then
echo "Installing GitHub workflow templates..."
mkdir -p "$CLAUDE_DIR/.github/workflows"
for f in "$REPO_DIR/.github/workflows/"claude-*.yml; do
[ -f "$f" ] || continue
name=$(basename "$f")
smart_copy_file "$f" "$CLAUDE_DIR/.github/workflows/$name"
done
echo " Note: Copy claude-*.yml to your project's .github/workflows/ to activate"
fi
# Profiles
echo "Installing profiles..."
mkdir -p "$CLAUDE_DIR/profiles"
for f in "$REPO_DIR/profiles/"*.json; do
[ -f "$f" ] || continue
name=$(basename "$f")
smart_copy_file "$f" "$CLAUDE_DIR/profiles/$name"
done
# vibeco CLI
echo "Setting up vibeco CLI..."
VIBECO_SRC="$REPO_DIR/tools/vibeco/vibeco.mjs"
if [ -f "$VIBECO_SRC" ]; then
mkdir -p "$HOME/.local/bin"
chmod +x "$VIBECO_SRC"
ln -sf "$VIBECO_SRC" "$HOME/.local/bin/vibeco"
if echo "$PATH" | grep -q "$HOME/.local/bin"; then
echo " vibeco CLI ready"
else
echo " Add to PATH: export PATH=\"\$HOME/.local/bin:\$PATH\""
fi
fi
echo ""
echo "Installation complete!"
echo " Added: $ADDED files"
echo " Skipped: $SKIPPED files (already existed)"
echo ""
echo " Agents: $(ls "$CLAUDE_DIR/agents/"*.md 2>/dev/null | wc -l | tr -d ' ')"
echo " Skills: $(find "$CLAUDE_DIR/skills/" -mindepth 1 -maxdepth 1 -type d 2>/dev/null | wc -l | tr -d ' ')"
echo " Hooks: ${HOOK_COUNT:-$(ls "$CLAUDE_DIR/hooks/dist/"*.mjs 2>/dev/null | wc -l | tr -d ' ')}"
echo " Rules: $(ls "$CLAUDE_DIR/rules/"*.md 2>/dev/null | wc -l | tr -d ' ')"
echo ""
if [ $SKIPPED -gt 0 ]; then
echo "Tip: Use ./install.sh --force to overwrite existing files."
fi