-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
572 lines (483 loc) · 21.6 KB
/
Copy pathsetup.sh
File metadata and controls
572 lines (483 loc) · 21.6 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
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
#!/usr/bin/env bash
# PhantomQA Setup Wizard
# Beautiful interactive installer for all supported platforms
# Usage: ./setup.sh or curl -sSL https://raw.githubusercontent.com/KyleBuildsAI/phantom-qa/main/setup.sh | bash
set -e
VERSION="1.0.0"
# ── Color & Formatting ──────────────────────────────────────────
setup_colors() {
if [ -t 1 ] && [ "${TERM:-}" != "dumb" ]; then
BOLD='\033[1m'
DIM='\033[2m'
RESET='\033[0m'
GREEN='\033[0;32m'
RED='\033[0;31m'
YELLOW='\033[0;33m'
CYAN='\033[0;36m'
WHITE='\033[1;37m'
CHECK="${GREEN}✓${RESET}"
CROSS="${RED}✗${RESET}"
DASH="${DIM}-${RESET}"
ARROW="${CYAN}>${RESET}"
else
BOLD='' DIM='' RESET='' GREEN='' RED='' YELLOW='' CYAN='' WHITE=''
CHECK="[OK]" CROSS="[!!]" DASH="[-]" ARROW=">"
fi
}
# ── Helper Functions ─────────────────────────────────────────────
print_banner() {
echo ""
echo -e "${CYAN} +===============================================+${RESET}"
echo -e "${CYAN} | |${RESET}"
echo -e "${CYAN} |${WHITE} P H A N T O M Q A ${CYAN}|${RESET}"
echo -e "${CYAN} | |${RESET}"
echo -e "${CYAN} |${RESET} Autonomous QA for AI Coding Agents ${CYAN}|${RESET}"
echo -e "${CYAN} |${DIM} v${VERSION} ${RESET}${CYAN}|${RESET}"
echo -e "${CYAN} | |${RESET}"
echo -e "${CYAN} +===============================================+${RESET}"
echo ""
}
print_step() {
local step="$1" total="$2" msg="$3"
echo -e " ${CYAN}[${step}/${total}]${RESET} ${BOLD}${msg}${RESET}"
echo ""
}
print_ok() { echo -e " ${CHECK} $1"; }
print_fail() { echo -e " ${CROSS} $1"; }
print_warn() { echo -e " ${YELLOW}!${RESET} $1"; }
print_skip() { echo -e " ${DASH} $1"; }
print_info() { echo -e " ${ARROW} $1"; }
print_item() { echo -e " ├── $1"; }
print_last() { echo -e " └── $1"; }
# ── Dependency Check ─────────────────────────────────────────────
check_dependencies() {
print_step 1 5 "Checking dependencies"
if command -v node &>/dev/null; then
local node_ver
node_ver=$(node --version 2>/dev/null)
print_ok "node ${DIM}${node_ver}${RESET}"
HAS_NODE=true
else
print_warn "node not found ${DIM}(test harness won't run, skills still install)${RESET}"
HAS_NODE=false
fi
if command -v git &>/dev/null; then
local git_ver
git_ver=$(git --version 2>/dev/null | awk '{print $3}')
print_ok "git ${DIM}${git_ver}${RESET}"
else
print_skip "git not found ${DIM}(optional)${RESET}"
fi
echo ""
}
# ── Platform Detection ───────────────────────────────────────────
DETECTED_ANTIGRAVITY=false
DETECTED_OPENCLAW=false
DETECTED_CLAUDE=false
DETECTED_CURSOR=false
DETECTED_WINDSURF=false
detect_platforms() {
print_step 2 5 "Detecting installed platforms"
# Google Antigravity
if [ -d "$HOME/.gemini" ]; then
print_ok "Google Antigravity ${DIM}(detected)${RESET}"
DETECTED_ANTIGRAVITY=true
else
print_skip "Google Antigravity ${DIM}(not found)${RESET}"
fi
# OpenClaw
if [ -d "$HOME/.openclaw" ]; then
print_ok "OpenClaw ${DIM}(detected)${RESET}"
DETECTED_OPENCLAW=true
else
print_skip "OpenClaw ${DIM}(not found)${RESET}"
fi
# Claude Code
if command -v claude &>/dev/null || [ -d "$HOME/.claude" ]; then
print_ok "Claude Code ${DIM}(detected)${RESET}"
DETECTED_CLAUDE=true
else
print_skip "Claude Code ${DIM}(not found)${RESET}"
fi
# Cursor
if command -v cursor &>/dev/null || [ -d "$HOME/.cursor" ]; then
print_ok "Cursor ${DIM}(detected)${RESET}"
DETECTED_CURSOR=true
else
print_skip "Cursor ${DIM}(not found)${RESET}"
fi
# Windsurf
if command -v windsurf &>/dev/null || [ -d "$HOME/.windsurf" ] || [ -d "$HOME/.codeium" ]; then
print_ok "Windsurf ${DIM}(detected)${RESET}"
DETECTED_WINDSURF=true
else
print_skip "Windsurf ${DIM}(not found)${RESET}"
fi
echo ""
}
# ── Interactive Menu ─────────────────────────────────────────────
SEL_ANTIGRAVITY=false
SEL_OPENCLAW=false
SEL_CLAUDE=false
SEL_CURSOR=false
SEL_WINDSURF=false
show_menu() {
# Pre-select all detected platforms (all are global installs)
SEL_ANTIGRAVITY=$DETECTED_ANTIGRAVITY
SEL_OPENCLAW=$DETECTED_OPENCLAW
SEL_CLAUDE=$DETECTED_CLAUDE
SEL_CURSOR=$DETECTED_CURSOR
SEL_WINDSURF=$DETECTED_WINDSURF
print_step 3 5 "Choose where to install"
echo -e " Detected platforms are pre-selected."
echo -e " Enter numbers to toggle, then press ${BOLD}Enter${RESET} to continue."
echo ""
while true; do
local mark_a="[ ]" mark_o="[ ]" mark_c="[ ]" mark_u="[ ]" mark_w="[ ]"
$SEL_ANTIGRAVITY && mark_a="${GREEN}[x]${RESET}"
$SEL_OPENCLAW && mark_o="${GREEN}[x]${RESET}"
$SEL_CLAUDE && mark_c="${GREEN}[x]${RESET}"
$SEL_CURSOR && mark_u="${GREEN}[x]${RESET}"
$SEL_WINDSURF && mark_w="${GREEN}[x]${RESET}"
echo -e " ${mark_a} 1. Google Antigravity ${DIM}(global: ~/.gemini/antigravity/skills/)${RESET}\033[K"
echo -e " ${mark_o} 2. OpenClaw ${DIM}(global: ~/.openclaw/workspace/skills/)${RESET}\033[K"
echo -e " ${mark_c} 3. Claude Code ${DIM}(global: ~/.claude/skills/)${RESET}\033[K"
echo -e " ${mark_u} 4. Cursor ${DIM}(global: ~/.cursor/skills/)${RESET}\033[K"
echo -e " ${mark_w} 5. Windsurf ${DIM}(global: ~/.codeium/windsurf/skills/)${RESET}\033[K"
echo ""
read -p " Toggle [1-5], Enter to continue, q to quit: " choice
case "$choice" in
1) $SEL_ANTIGRAVITY && SEL_ANTIGRAVITY=false || SEL_ANTIGRAVITY=true ;;
2) $SEL_OPENCLAW && SEL_OPENCLAW=false || SEL_OPENCLAW=true ;;
3) $SEL_CLAUDE && SEL_CLAUDE=false || SEL_CLAUDE=true ;;
4) $SEL_CURSOR && SEL_CURSOR=false || SEL_CURSOR=true ;;
5) $SEL_WINDSURF && SEL_WINDSURF=false || SEL_WINDSURF=true ;;
q|Q) echo ""; echo " Cancelled."; echo ""; exit 0 ;;
"") break ;;
*) ;;
esac
# Move cursor up to redraw menu (5 options + 1 blank + 1 prompt = 7 lines)
printf '\033[7A'
done
echo ""
}
# ── Installation Functions ───────────────────────────────────────
INSTALLED_COUNT=0
do_install_antigravity() {
local skills_dir="$HOME/.gemini/antigravity/skills"
local rules_dir="$HOME/.gemini/antigravity"
echo -e " ${BOLD}Installing to Antigravity...${RESET}"
mkdir -p "$skills_dir/continuous-qa/scripts"
mkdir -p "$skills_dir/software-tester/scripts"
mkdir -p "$skills_dir/phantom-depth/scripts"
cp "$SCRIPT_DIR/.agent/skills/continuous-qa/SKILL.md" "$skills_dir/continuous-qa/SKILL.md"
print_item "Copying continuous-qa skill... ${CHECK}"
cp "$SCRIPT_DIR/.agent/skills/continuous-qa/scripts/test-harness.js" "$skills_dir/continuous-qa/scripts/test-harness.js"
print_item "Copying test harness... ${CHECK}"
cp "$SCRIPT_DIR/.agent/skills/software-tester/SKILL.md" "$skills_dir/software-tester/SKILL.md"
print_item "Copying software-tester skill... ${CHECK}"
cp "$SCRIPT_DIR/.agent/skills/phantom-depth/SKILL.md" "$skills_dir/phantom-depth/SKILL.md"
print_item "Copying phantom-depth skill... ${CHECK}"
# Install rules
local rules_file="$rules_dir/GEMINI.md"
if [ -f "$rules_file" ] && [ -s "$rules_file" ]; then
if [ -t 0 ]; then
echo ""
echo -e " ${YELLOW}!${RESET} GEMINI.md already exists at ${DIM}$rules_file${RESET}"
echo " 1) Append (Recommended) 2) Replace 3) Skip"
read -p " Choice [1/2/3]: " rc
case $rc in
1|"") echo "" >> "$rules_file"; cat "$SCRIPT_DIR/GEMINI.md" >> "$rules_file"; print_last "Rules appended ${CHECK}" ;;
2) cp "$SCRIPT_DIR/GEMINI.md" "$rules_file"; print_last "Rules replaced ${CHECK}" ;;
*) print_last "Rules skipped ${DASH}" ;;
esac
else
cp "$SCRIPT_DIR/GEMINI.md" "$rules_file"
print_last "Rules installed ${CHECK}"
fi
else
mkdir -p "$rules_dir"
cp "$SCRIPT_DIR/GEMINI.md" "$rules_file"
print_last "Rules installed ${CHECK}"
fi
INSTALLED_COUNT=$((INSTALLED_COUNT + 1))
echo ""
}
do_install_openclaw() {
local skills_dir=""
if [ -d "$HOME/.openclaw/workspace/skills" ]; then
skills_dir="$HOME/.openclaw/workspace/skills"
elif [ -d "$HOME/.openclaw/skills" ]; then
skills_dir="$HOME/.openclaw/skills"
elif [ -d "$HOME/.openclaw" ]; then
skills_dir="$HOME/.openclaw/workspace/skills"
fi
echo -e " ${BOLD}Installing to OpenClaw...${RESET}"
mkdir -p "$skills_dir/phantom-qa/scripts"
mkdir -p "$skills_dir/phantom-qa-tester"
mkdir -p "$skills_dir/phantom-depth/scripts"
cp "$SCRIPT_DIR/.openclaw/skills/phantom-qa/skill.md" "$skills_dir/phantom-qa/skill.md"
print_item "Copying phantom-qa skill... ${CHECK}"
cp "$SCRIPT_DIR/.openclaw/skills/phantom-qa/scripts/test-harness.js" "$skills_dir/phantom-qa/scripts/test-harness.js"
print_item "Copying test harness... ${CHECK}"
cp "$SCRIPT_DIR/.openclaw/skills/phantom-qa-tester/skill.md" "$skills_dir/phantom-qa-tester/skill.md"
print_item "Copying phantom-qa-tester skill... ${CHECK}"
cp "$SCRIPT_DIR/.openclaw/skills/phantom-depth/skill.md" "$skills_dir/phantom-depth/skill.md"
print_last "Copying phantom-depth skill... ${CHECK}"
INSTALLED_COUNT=$((INSTALLED_COUNT + 1))
echo ""
}
do_install_claude() {
local skills_dir="$HOME/.claude/skills"
echo -e " ${BOLD}Installing to Claude Code...${RESET}"
mkdir -p "$skills_dir/continuous-qa/scripts"
mkdir -p "$skills_dir/software-tester/scripts"
mkdir -p "$skills_dir/phantom-depth/scripts"
cp "$SCRIPT_DIR/.agent/skills/continuous-qa/SKILL.md" "$skills_dir/continuous-qa/SKILL.md"
print_item "Copying continuous-qa skill... ${CHECK}"
cp "$SCRIPT_DIR/.agent/skills/continuous-qa/scripts/test-harness.js" "$skills_dir/continuous-qa/scripts/test-harness.js"
print_item "Copying test harness... ${CHECK}"
cp "$SCRIPT_DIR/.agent/skills/software-tester/SKILL.md" "$skills_dir/software-tester/SKILL.md"
print_item "Copying software-tester skill... ${CHECK}"
cp "$SCRIPT_DIR/.agent/skills/phantom-depth/SKILL.md" "$skills_dir/phantom-depth/SKILL.md"
print_item "Copying phantom-depth skill... ${CHECK}"
# Install rules
local rules_file="$HOME/.claude/CLAUDE.md"
if [ -f "$rules_file" ] && [ -s "$rules_file" ]; then
if [ -t 0 ]; then
echo ""
echo -e " ${YELLOW}!${RESET} CLAUDE.md already exists at ${DIM}$rules_file${RESET}"
echo " 1) Append (Recommended) 2) Replace 3) Skip"
read -p " Choice [1/2/3]: " rc
case $rc in
1|"") echo "" >> "$rules_file"; cat "$SCRIPT_DIR/GEMINI.md" >> "$rules_file"; print_last "Rules appended ${CHECK}" ;;
2) cp "$SCRIPT_DIR/GEMINI.md" "$rules_file"; print_last "Rules replaced ${CHECK}" ;;
*) print_last "Rules skipped ${DASH}" ;;
esac
else
cp "$SCRIPT_DIR/GEMINI.md" "$rules_file"
print_last "Rules installed ${CHECK}"
fi
else
mkdir -p "$HOME/.claude"
cp "$SCRIPT_DIR/GEMINI.md" "$rules_file"
print_last "Rules installed ${CHECK}"
fi
INSTALLED_COUNT=$((INSTALLED_COUNT + 1))
echo ""
}
do_install_cursor() {
local skills_dir="$HOME/.cursor/skills"
echo -e " ${BOLD}Installing to Cursor...${RESET}"
mkdir -p "$skills_dir/continuous-qa/scripts"
mkdir -p "$skills_dir/software-tester/scripts"
mkdir -p "$skills_dir/phantom-depth/scripts"
cp "$SCRIPT_DIR/.agent/skills/continuous-qa/SKILL.md" "$skills_dir/continuous-qa/SKILL.md"
print_item "Copying continuous-qa skill... ${CHECK}"
cp "$SCRIPT_DIR/.agent/skills/continuous-qa/scripts/test-harness.js" "$skills_dir/continuous-qa/scripts/test-harness.js"
print_item "Copying test harness... ${CHECK}"
cp "$SCRIPT_DIR/.agent/skills/software-tester/SKILL.md" "$skills_dir/software-tester/SKILL.md"
print_item "Copying software-tester skill... ${CHECK}"
cp "$SCRIPT_DIR/.agent/skills/phantom-depth/SKILL.md" "$skills_dir/phantom-depth/SKILL.md"
print_last "Copying phantom-depth skill... ${CHECK}"
INSTALLED_COUNT=$((INSTALLED_COUNT + 1))
echo ""
}
do_install_windsurf() {
local skills_dir="$HOME/.codeium/windsurf/skills"
echo -e " ${BOLD}Installing to Windsurf...${RESET}"
mkdir -p "$skills_dir/continuous-qa/scripts"
mkdir -p "$skills_dir/software-tester/scripts"
mkdir -p "$skills_dir/phantom-depth/scripts"
cp "$SCRIPT_DIR/.agent/skills/continuous-qa/SKILL.md" "$skills_dir/continuous-qa/SKILL.md"
print_item "Copying continuous-qa skill... ${CHECK}"
cp "$SCRIPT_DIR/.agent/skills/continuous-qa/scripts/test-harness.js" "$skills_dir/continuous-qa/scripts/test-harness.js"
print_item "Copying test harness... ${CHECK}"
cp "$SCRIPT_DIR/.agent/skills/software-tester/SKILL.md" "$skills_dir/software-tester/SKILL.md"
print_item "Copying software-tester skill... ${CHECK}"
cp "$SCRIPT_DIR/.agent/skills/phantom-depth/SKILL.md" "$skills_dir/phantom-depth/SKILL.md"
print_item "Copying phantom-depth skill... ${CHECK}"
# Install rules to Windsurf's global rules file
local rules_file="$HOME/.codeium/windsurf/memories/global_rules.md"
if [ -f "$rules_file" ] && [ -s "$rules_file" ]; then
if [ -t 0 ]; then
echo ""
echo -e " ${YELLOW}!${RESET} global_rules.md already exists at ${DIM}$rules_file${RESET}"
echo " 1) Append (Recommended) 2) Replace 3) Skip"
read -p " Choice [1/2/3]: " rc
case $rc in
1|"") echo "" >> "$rules_file"; cat "$SCRIPT_DIR/GEMINI.md" >> "$rules_file"; print_last "Rules appended ${CHECK}" ;;
2) cp "$SCRIPT_DIR/GEMINI.md" "$rules_file"; print_last "Rules replaced ${CHECK}" ;;
*) print_last "Rules skipped ${DASH}" ;;
esac
else
cp "$SCRIPT_DIR/GEMINI.md" "$rules_file"
print_last "Rules installed ${CHECK}"
fi
else
mkdir -p "$HOME/.codeium/windsurf/memories"
cp "$SCRIPT_DIR/GEMINI.md" "$rules_file"
print_last "Rules installed ${CHECK}"
fi
INSTALLED_COUNT=$((INSTALLED_COUNT + 1))
echo ""
}
run_installations() {
print_step 4 5 "Installing"
$SEL_ANTIGRAVITY && do_install_antigravity
$SEL_OPENCLAW && do_install_openclaw
$SEL_CLAUDE && do_install_claude
$SEL_CURSOR && do_install_cursor
$SEL_WINDSURF && do_install_windsurf
if [ "$INSTALLED_COUNT" -eq 0 ]; then
echo -e " ${YELLOW}No platforms selected. Nothing installed.${RESET}"
echo ""
fi
}
# ── Completion Summary ───────────────────────────────────────────
print_summary() {
print_step 5 5 "Setup complete!"
local stat_a stat_o stat_c stat_u stat_w
$SEL_ANTIGRAVITY && stat_a="${CHECK} Antigravity 3 skills + rules" || stat_a="${DASH} Antigravity skipped"
$SEL_OPENCLAW && stat_o="${CHECK} OpenClaw 3 skills + harness" || stat_o="${DASH} OpenClaw skipped"
$SEL_CLAUDE && stat_c="${CHECK} Claude Code 3 skills + rules" || stat_c="${DASH} Claude Code skipped"
$SEL_CURSOR && stat_u="${CHECK} Cursor 3 skills" || stat_u="${DASH} Cursor skipped"
$SEL_WINDSURF && stat_w="${CHECK} Windsurf 3 skills + rules" || stat_w="${DASH} Windsurf skipped"
echo -e " ${CYAN}+===============================================+${RESET}"
echo -e " ${CYAN}|${RESET} ${BOLD}Installation Summary${RESET} ${CYAN}|${RESET}"
echo -e " ${CYAN}+===============================================+${RESET}"
echo ""
echo -e " ${stat_a}"
echo -e " ${stat_o}"
echo -e " ${stat_c}"
echo -e " ${stat_u}"
echo -e " ${stat_w}"
echo ""
echo -e " ${BOLD}Next steps:${RESET}"
echo -e " ${DIM}--------------------------------------------${RESET}"
echo " 1. Open your project in your AI coding agent"
echo " 2. Say: \"Run a full QA pass on this project\""
echo " 3. The agent will find, fix, and verify everything"
echo ""
echo -e " ${BOLD}Run test harness manually:${RESET}"
if $SEL_ANTIGRAVITY; then
echo -e " ${DIM}node ~/.gemini/antigravity/skills/continuous-qa/scripts/test-harness.js${RESET}"
elif $SEL_OPENCLAW; then
echo -e " ${DIM}node ~/.openclaw/workspace/skills/phantom-qa/scripts/test-harness.js${RESET}"
elif $SEL_CLAUDE; then
echo -e " ${DIM}node ~/.claude/skills/continuous-qa/scripts/test-harness.js${RESET}"
elif $SEL_CURSOR; then
echo -e " ${DIM}node ~/.cursor/skills/continuous-qa/scripts/test-harness.js${RESET}"
elif $SEL_WINDSURF; then
echo -e " ${DIM}node ~/.codeium/windsurf/skills/continuous-qa/scripts/test-harness.js${RESET}"
fi
echo ""
echo -e " ${DIM}Docs: https://github.com/KyleBuildsAI/phantom-qa${RESET}"
echo ""
}
# ── Source Resolution ────────────────────────────────────────────
# When run via curl|bash, we need to clone the repo first
resolve_source() {
# Check if we're running from the repo (local files exist)
if [ -f "${BASH_SOURCE[0]:-}" ]; then
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
if [ -d "$SCRIPT_DIR/.agent/skills" ] && [ -d "$SCRIPT_DIR/.openclaw/skills" ]; then
return 0
fi
fi
# Running from pipe or files missing -- clone to temp
echo -e " ${DIM}Downloading PhantomQA...${RESET}"
TEMP_DIR=$(mktemp -d 2>/dev/null || mktemp -d -t 'phantomqa')
SCRIPT_DIR="$TEMP_DIR/phantom-qa"
git clone --depth 1 --quiet https://github.com/KyleBuildsAI/phantom-qa.git "$SCRIPT_DIR" 2>/dev/null
CLEANUP_TEMP=true
echo -e " ${CHECK} Downloaded"
echo ""
}
cleanup() {
if [ "${CLEANUP_TEMP:-false}" = true ] && [ -n "${TEMP_DIR:-}" ]; then
rm -rf "$TEMP_DIR"
fi
}
trap cleanup EXIT
# ── Non-Interactive Mode (CLI flags) ─────────────────────────────
parse_flags() {
INTERACTIVE=true
FLAG_ALL=false
while [[ $# -gt 0 ]]; do
case $1 in
--all) FLAG_ALL=true; INTERACTIVE=false; shift ;;
--antigravity) SEL_ANTIGRAVITY=true; INTERACTIVE=false; shift ;;
--openclaw) SEL_OPENCLAW=true; INTERACTIVE=false; shift ;;
--claude) SEL_CLAUDE=true; INTERACTIVE=false; shift ;;
--cursor) SEL_CURSOR=true; INTERACTIVE=false; shift ;;
--windsurf) SEL_WINDSURF=true; INTERACTIVE=false; shift ;;
--help)
echo ""
echo " PhantomQA Setup Wizard v${VERSION}"
echo ""
echo " Usage: ./setup.sh [OPTIONS]"
echo ""
echo " Interactive (default):"
echo " ./setup.sh Launch the setup wizard"
echo ""
echo " Non-interactive:"
echo " --all Install to all detected platforms"
echo " --antigravity Install to Google Antigravity"
echo " --openclaw Install to OpenClaw"
echo " --claude Install to Claude Code"
echo " --cursor Install to Cursor"
echo " --windsurf Install to Windsurf"
echo ""
echo " One-liner install:"
echo " curl -sSL https://raw.githubusercontent.com/KyleBuildsAI/phantom-qa/main/setup.sh | bash"
echo ""
exit 0
;;
*) shift ;;
esac
done
# --all selects everything detected
if $FLAG_ALL; then
SEL_ANTIGRAVITY=$DETECTED_ANTIGRAVITY
SEL_OPENCLAW=$DETECTED_OPENCLAW
SEL_CLAUDE=$DETECTED_CLAUDE
SEL_CURSOR=$DETECTED_CURSOR
SEL_WINDSURF=$DETECTED_WINDSURF
fi
# If piped (no TTY on stdin), use non-interactive mode
if ! [ -t 0 ]; then
INTERACTIVE=false
# Default: install to all detected platforms
if ! $SEL_ANTIGRAVITY && ! $SEL_OPENCLAW && ! $SEL_CLAUDE && ! $SEL_CURSOR && ! $SEL_WINDSURF; then
SEL_ANTIGRAVITY=$DETECTED_ANTIGRAVITY
SEL_OPENCLAW=$DETECTED_OPENCLAW
SEL_CLAUDE=$DETECTED_CLAUDE
SEL_CURSOR=$DETECTED_CURSOR
SEL_WINDSURF=$DETECTED_WINDSURF
fi
fi
}
# ── Main ─────────────────────────────────────────────────────────
main() {
setup_colors
print_banner
resolve_source
check_dependencies
detect_platforms
parse_flags "$@"
if $INTERACTIVE; then
show_menu
else
print_step 3 5 "Selected platforms"
$SEL_ANTIGRAVITY && print_ok "Google Antigravity"
$SEL_OPENCLAW && print_ok "OpenClaw"
$SEL_CLAUDE && print_ok "Claude Code"
$SEL_CURSOR && print_ok "Cursor"
$SEL_WINDSURF && print_ok "Windsurf"
echo ""
fi
run_installations
print_summary
}
main "$@"