-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathsetup.sh
More file actions
302 lines (267 loc) · 10.5 KB
/
Copy pathsetup.sh
File metadata and controls
302 lines (267 loc) · 10.5 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
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
#!/usr/bin/env bash
# =============================================================================
# Setup & Update - AI Project Rules Generator
# =============================================================================
# Install: curl -sL <raw-url>/setup.sh | bash
# Update: ./setup.sh --update
# =============================================================================
set -euo pipefail
REPO_RAW="https://raw.githubusercontent.com/naravid19/ai-project-rules-generator/main"
WORKFLOW_FILE="SKILL.md"
VERBOSE=false
NON_INTERACTIVE=false
SKILL_SOURCE=""
SKILL_ROOT=".agent"
UNINSTALL=false
# ─── Parse Arguments ─────────────────────────────────────────────────────────
ACTION="install"
while [[ $# -gt 0 ]]; do
case "$1" in
--update|-u) ACTION="update"; shift ;;
--uninstall) UNINSTALL=true; shift ;;
--non-interactive) NON_INTERACTIVE=true; shift ;;
--verbose|-v) VERBOSE=true; shift ;;
--skill-source) SKILL_SOURCE="$2"; shift 2 ;;
--skill-root) SKILL_ROOT="$2"; shift 2 ;;
*) shift ;;
esac
done
log_debug() {
if $VERBOSE; then
echo "[DEBUG] $1"
fi
}
get_workflow_version() {
local path="$1"
awk '/^version:[[:space:]]*/ { print "v" $2; found=1; exit } END { if (!found) print "unknown" }' "$path"
}
clone_or_update_repo() {
local repo_url="$1"
local target_path="$2"
local label="$3"
if [[ -d "$target_path/.git" ]]; then
echo "Updating $label..."
git -C "$target_path" pull --ff-only
return
fi
if [[ -d "$target_path" ]] && [[ -n "$(ls -A "$target_path" 2>/dev/null)" ]]; then
echo "Skip $label: target exists and is not an empty git repo ($target_path)."
return
fi
echo "Cloning $label..."
git clone --depth 1 "$repo_url" "$target_path"
}
install_skill() {
local key="$1"
local repo_url=""
local target_suffix=""
local label=""
case "$key" in
antigravity)
repo_url="https://github.com/sickn33/antigravity-awesome-skills.git"
target_suffix="skills"
label="sickn33/antigravity-awesome-skills"
;;
claude)
repo_url="https://github.com/ComposioHQ/awesome-claude-skills.git"
target_suffix="awesome-claude-skills"
label="ComposioHQ/awesome-claude-skills"
;;
anthropic)
repo_url="https://github.com/anthropics/skills.git"
target_suffix="anthropic-skills"
label="anthropics/skills"
;;
techleads)
repo_url="https://github.com/tech-leads-club/agent-skills.git"
target_suffix="techleads-agent-skills"
label="tech-leads-club/agent-skills"
;;
jeffallan)
repo_url="https://github.com/Jeffallan/claude-skills.git"
target_suffix="jeffallan-claude-skills"
label="Jeffallan/claude-skills"
;;
ui-ux-pro-max)
repo_url="https://github.com/nextlevelbuilder/ui-ux-pro-max-skill.git"
target_suffix="ui-ux-pro-max-skill"
label="nextlevelbuilder/ui-ux-pro-max-skill"
;;
othmanadi)
repo_url="https://github.com/OthmanAdi/planning-with-files.git"
target_suffix="othman-planning-with-files"
label="OthmanAdi/planning-with-files"
;;
scientific)
repo_url="https://github.com/K-Dense-AI/claude-scientific-skills.git"
target_suffix="claude-scientific-skills"
label="K-Dense-AI/claude-scientific-skills"
;;
karpathy)
repo_url="https://github.com/forrestchang/andrej-karpathy-skills.git"
target_suffix="andrej-karpathy-skills"
label="forrestchang/andrej-karpathy-skills"
;;
superpowers)
repo_url="https://github.com/obra/superpowers.git"
target_suffix="superpowers-skills"
label="obra/superpowers"
;;
all)
for k in antigravity claude anthropic techleads jeffallan ui-ux-pro-max othmanadi scientific karpathy superpowers; do
install_skill "$k"
done
return
;;
*)
echo "Unknown skill source: $key. Options: antigravity, claude, anthropic, techleads, jeffallan, ui-ux-pro-max, othmanadi, scientific, karpathy, superpowers, all"
return 1
;;
esac
clone_or_update_repo "$repo_url" "$SKILL_ROOT/$target_suffix" "$label"
}
# ─── Prerequisite Check ─────────────────────────────────────────────────────
check_prerequisites() {
# Check Git
if ! command -v git &>/dev/null; then
echo "❌ Git is required but not found."
echo " Install: https://git-scm.com/downloads"
echo " Or: brew install git / apt install git"
exit 1
fi
log_debug "Git found: $(git --version)"
# Check curl
if ! command -v curl &>/dev/null; then
echo "❌ curl is required but not found."
exit 1
fi
log_debug "curl found: $(curl --version | head -1)"
# Check internet
if ! curl -sL --connect-timeout 5 "https://github.com" >/dev/null 2>&1; then
echo "❌ Cannot reach GitHub. Check your internet connection."
exit 1
fi
log_debug "Internet connectivity OK"
}
# ─── Uninstall ───────────────────────────────────────────────────────────────
if $UNINSTALL; then
echo "AI Project Rules Generator - Uninstall"
echo "======================================="
echo
for file in "$WORKFLOW_FILE" "${WORKFLOW_FILE}.backup"; do
if [[ -f "$file" ]]; then
rm -f "$file"
echo " Removed: $file"
fi
done
# Remove empty directories
if [[ -d ".agent" ]] && [[ -z "$(ls -A .agent 2>/dev/null)" ]]; then
rmdir ".agent"
echo " Removed empty: .agent/"
fi
echo
echo "Uninstall complete."
echo "Note: Skill sources (.agent/skills/, shared skill roots, etc.) were NOT removed."
echo " Remove them manually if desired."
echo "======================================="
exit 0
fi
# ─── Update ──────────────────────────────────────────────────────────────────
if [[ "$ACTION" == "update" ]]; then
echo "AI Project Rules Generator - Update"
echo "==================================="
echo
check_prerequisites
if [[ ! -f "$WORKFLOW_FILE" ]]; then
echo "❌ Workflow not found at $WORKFLOW_FILE"
echo "Run without --update to install first."
exit 1
fi
cp "$WORKFLOW_FILE" "${WORKFLOW_FILE}.backup"
echo "Backed up current workflow to ${WORKFLOW_FILE}.backup"
echo "Downloading latest workflow..."
curl -sL -o "$WORKFLOW_FILE" "${REPO_RAW}/SKILL.md"
version="$(get_workflow_version "$WORKFLOW_FILE")"
echo "✅ Workflow updated successfully."
echo "Current version: $version"
echo "Backup saved at: ${WORKFLOW_FILE}.backup"
echo
echo "Tip: Your .cursorrules and AGENTS.md are NOT affected."
echo "Re-run /create-project-rules to regenerate with latest workflow."
echo "==================================="
exit 0
fi
# ─── Install ─────────────────────────────────────────────────────────────────
echo "AI Project Rules Generator - Quick Start Setup"
echo "==============================================="
echo
check_prerequisites
echo "Creating .agent/ directory structure..."
mkdir -p "$SKILL_ROOT"
if [[ "$SKILL_ROOT" != ".agent" ]]; then
echo "Using shared skill root: $SKILL_ROOT"
echo "Keeping workflow local at $WORKFLOW_FILE"
fi
echo "Downloading workflow..."
curl -sL -o "$WORKFLOW_FILE" "${REPO_RAW}/SKILL.md"
version="$(get_workflow_version "$WORKFLOW_FILE")"
echo "✅ Workflow installed at $WORKFLOW_FILE (version: $version)"
echo
# ─── Skill Source Selection ──────────────────────────────────────────────────
if [[ -n "$SKILL_SOURCE" ]]; then
install_skill "$SKILL_SOURCE" || true
elif $NON_INTERACTIVE; then
echo "Non-interactive mode: skipping skill source selection."
echo "Use --skill-source <name> to install skill sources."
echo "Use --skill-root <path> to install sources into a shared skill root."
else
echo "Recommended skill sources (optional):"
echo "Install root for skill sources: $SKILL_ROOT"
echo " 1) sickn33 / antigravity-awesome-skills (CATALOG, large catalog index)"
echo " 2) ComposioHQ / awesome-claude-skills (FOLDER, community skill packs)"
echo " 3) anthropics / skills (FOLDER, official Anthropic skills)"
echo " 4) tech-leads-club / agent-skills (FOLDER, curated registry)"
echo " 5) Jeffallan / claude-skills (FOLDER, broad full-stack set)"
echo " 6) nextlevelbuilder / ui-ux-pro-max (WORKFLOW, UI/UX design intel)"
echo " 7) OthmanAdi / planning-with-files (FOLDER, planning persistence)"
echo " 8) K-Dense-AI / claude-scientific-skills (FOLDER, scientific/research workflows)"
echo " 9) forrestchang / andrej-karpathy-skills (FOLDER, Andrej Karpathy's skills/workflows)"
echo " 10) obra / superpowers (FOLDER, advanced agent skills)"
echo " 11) All of the above"
echo " 12) Skip (add your own later)"
echo
read -r -p "Choose [1-12]: " choice < /dev/tty
case "$choice" in
1) install_skill "antigravity" ;;
2) install_skill "claude" ;;
3) install_skill "anthropic" ;;
4) install_skill "techleads" ;;
5) install_skill "jeffallan" ;;
6) install_skill "ui-ux-pro-max" ;;
7) install_skill "othmanadi" ;;
8) install_skill "scientific" ;;
9) install_skill "karpathy" ;;
10) install_skill "superpowers" ;;
11) install_skill "all" ;;
12) echo "Skipping skill source installation." ;;
*) echo "Invalid choice, skipping skill source installation." ;;
esac
fi
echo
echo "==============================================="
echo "✅ Setup complete."
echo
echo "Next steps:"
echo " 1) Open your project in your AI assistant"
echo " 2) Run: /create-project-rules"
echo " 3) Get tailored .cursorrules + AGENTS.md"
echo
echo "Options:"
echo " Update: ./setup.sh --update"
echo " Uninstall: ./setup.sh --uninstall"
echo " CI/CD mode: ./setup.sh --non-interactive --skill-source all"
echo " Shared root: ./setup.sh --skill-source all --skill-root /shared/.agent"
echo " Verbose: ./setup.sh --verbose"
echo
echo "Docs: https://github.com/naravid19/ai-project-rules-generator"
echo "==============================================="