@automagik/genie 0.260203.205 → 0.260203.435
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/claudio.js +1 -1
- package/dist/genie.js +1 -1
- package/dist/term.js +1 -1
- package/install.sh +146 -776
- package/package.json +1 -1
- package/plugins/automagik-genie/agents/fix.md +70 -0
- package/plugins/automagik-genie/agents/git.md +157 -0
- package/plugins/automagik-genie/agents/refactor.md +140 -0
- package/plugins/automagik-genie/agents/tests.md +192 -0
- package/src/lib/version.ts +1 -1
package/install.sh
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
#
|
|
6
6
|
# Usage:
|
|
7
7
|
# curl -fsSL https://raw.githubusercontent.com/namastexlabs/genie-cli/main/install.sh | bash
|
|
8
|
-
# curl
|
|
8
|
+
# curl -fsSL https://raw.githubusercontent.com/namastexlabs/genie-cli/main/install.sh | bash -s -- uninstall
|
|
9
9
|
#
|
|
10
10
|
# Exit codes:
|
|
11
11
|
# 0 - Success
|
|
@@ -21,23 +21,17 @@ set -euo pipefail
|
|
|
21
21
|
# Constants
|
|
22
22
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
23
23
|
|
|
24
|
-
readonly VERSION="
|
|
24
|
+
readonly VERSION="2.0.0"
|
|
25
25
|
readonly PACKAGE_NAME="@automagik/genie"
|
|
26
|
-
readonly REPO_URL="https://github.com/namastexlabs/genie-cli.git"
|
|
27
26
|
readonly RAW_REPO_URL="https://raw.githubusercontent.com/namastexlabs/genie-cli"
|
|
28
|
-
readonly NPM_REGISTRY="https://registry.npmjs.org"
|
|
29
27
|
|
|
30
28
|
readonly GENIE_HOME="${GENIE_HOME:-$HOME/.genie}"
|
|
31
|
-
readonly GENIE_SRC="$GENIE_HOME/src"
|
|
32
|
-
readonly GENIE_BIN="$GENIE_HOME/bin"
|
|
33
|
-
readonly LOCAL_BIN="$HOME/.local/bin"
|
|
34
29
|
|
|
35
30
|
# Colors (disabled if not a terminal)
|
|
36
31
|
if [[ -t 1 ]]; then
|
|
37
32
|
readonly RED='\033[0;31m'
|
|
38
33
|
readonly GREEN='\033[0;32m'
|
|
39
34
|
readonly YELLOW='\033[1;33m'
|
|
40
|
-
readonly CYAN='\033[0;36m'
|
|
41
35
|
readonly BLUE='\033[0;34m'
|
|
42
36
|
readonly BOLD='\033[1m'
|
|
43
37
|
readonly DIM='\033[2m'
|
|
@@ -46,7 +40,6 @@ else
|
|
|
46
40
|
readonly RED=''
|
|
47
41
|
readonly GREEN=''
|
|
48
42
|
readonly YELLOW=''
|
|
49
|
-
readonly CYAN=''
|
|
50
43
|
readonly BLUE=''
|
|
51
44
|
readonly BOLD=''
|
|
52
45
|
readonly DIM=''
|
|
@@ -57,55 +50,35 @@ fi
|
|
|
57
50
|
DOWNLOADER=""
|
|
58
51
|
PLATFORM=""
|
|
59
52
|
ARCH=""
|
|
60
|
-
|
|
61
|
-
INSTALL_MODE="auto"
|
|
62
|
-
INSTALL_METHOD=""
|
|
63
|
-
TARGET_VERSION="stable"
|
|
64
|
-
AUTO_YES=false
|
|
65
|
-
CLEANUP_NEEDED=false
|
|
66
|
-
TEMP_DIR=""
|
|
67
|
-
|
|
68
|
-
# Optional component flags (default: install all)
|
|
69
|
-
INSTALL_CLAUDE=true
|
|
70
|
-
INSTALL_PLUGIN=true
|
|
71
|
-
INSTALL_TMUX=true
|
|
72
|
-
INSTALL_RG=true
|
|
73
|
-
INSTALL_JQ=true
|
|
53
|
+
INSTALL_MODE="install"
|
|
74
54
|
|
|
75
55
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
76
56
|
# Utility Functions
|
|
77
57
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
78
58
|
|
|
79
59
|
log() {
|
|
80
|
-
echo -e "${GREEN}▸${NC} $1"
|
|
60
|
+
echo -e " ${GREEN}▸${NC} $1"
|
|
81
61
|
}
|
|
82
62
|
|
|
83
63
|
warn() {
|
|
84
|
-
echo -e "${YELLOW}⚠${NC} $1" >&2
|
|
64
|
+
echo -e " ${YELLOW}⚠${NC} $1" >&2
|
|
85
65
|
}
|
|
86
66
|
|
|
87
67
|
error() {
|
|
88
|
-
echo -e "${RED}✖${NC} $1" >&2
|
|
68
|
+
echo -e " ${RED}✖${NC} $1" >&2
|
|
89
69
|
}
|
|
90
70
|
|
|
91
71
|
success() {
|
|
92
|
-
echo -e "${GREEN}✔${NC} $1"
|
|
72
|
+
echo -e " ${GREEN}✔${NC} $1"
|
|
93
73
|
}
|
|
94
74
|
|
|
95
75
|
info() {
|
|
96
|
-
echo -e "${BLUE}ℹ${NC} $1"
|
|
76
|
+
echo -e " ${BLUE}ℹ${NC} $1"
|
|
97
77
|
}
|
|
98
78
|
|
|
99
79
|
header() {
|
|
100
80
|
echo
|
|
101
81
|
echo -e "${BOLD}$1${NC}"
|
|
102
|
-
echo
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
# Run a command with visible output
|
|
106
|
-
run() {
|
|
107
|
-
echo -e "${DIM}$ $*${NC}"
|
|
108
|
-
"$@"
|
|
109
82
|
}
|
|
110
83
|
|
|
111
84
|
# Check if a command exists
|
|
@@ -113,46 +86,29 @@ check_command() {
|
|
|
113
86
|
command -v "$1" &>/dev/null
|
|
114
87
|
}
|
|
115
88
|
|
|
116
|
-
# Prompt user for confirmation
|
|
89
|
+
# Prompt user for confirmation (Y is default)
|
|
117
90
|
confirm() {
|
|
118
91
|
local prompt="$1"
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
echo -en "${YELLOW}?${NC} $prompt [y/N] "
|
|
123
|
-
read -r response < /dev/tty
|
|
124
|
-
[[ "$response" =~ ^[Yy]$ ]]
|
|
92
|
+
echo -en "${YELLOW}?${NC} $prompt [Y/n] "
|
|
93
|
+
read -r response < /dev/tty || response=""
|
|
94
|
+
[[ -z "$response" || "$response" =~ ^[Yy]$ ]]
|
|
125
95
|
}
|
|
126
96
|
|
|
127
|
-
#
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
if [[ -n "$TEMP_DIR" && -d "$TEMP_DIR" ]]; then
|
|
134
|
-
rm -rf "$TEMP_DIR"
|
|
135
|
-
fi
|
|
136
|
-
if [[ "$CLEANUP_NEEDED" == true && $exit_code -ne 0 ]]; then
|
|
137
|
-
warn "Installation failed. Cleaning up..."
|
|
138
|
-
# Don't remove existing installations on update failure
|
|
139
|
-
if [[ "$INSTALL_MODE" != "update" && -d "$GENIE_SRC" ]]; then
|
|
140
|
-
rm -rf "$GENIE_SRC"
|
|
141
|
-
fi
|
|
142
|
-
fi
|
|
143
|
-
exit $exit_code
|
|
97
|
+
# Prompt user for confirmation (N is default)
|
|
98
|
+
confirm_no() {
|
|
99
|
+
local prompt="$1"
|
|
100
|
+
echo -en "${YELLOW}?${NC} $prompt [y/N] "
|
|
101
|
+
read -r response < /dev/tty || response=""
|
|
102
|
+
[[ "$response" =~ ^[Yy]$ ]]
|
|
144
103
|
}
|
|
145
104
|
|
|
146
|
-
trap cleanup EXIT
|
|
147
|
-
|
|
148
105
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
149
106
|
# Platform Detection
|
|
150
107
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
151
108
|
|
|
152
109
|
detect_platform() {
|
|
153
|
-
local os arch
|
|
110
|
+
local os arch
|
|
154
111
|
|
|
155
|
-
# Detect OS
|
|
156
112
|
case "$(uname -s)" in
|
|
157
113
|
Darwin)
|
|
158
114
|
os="darwin"
|
|
@@ -169,7 +125,6 @@ detect_platform() {
|
|
|
169
125
|
;;
|
|
170
126
|
esac
|
|
171
127
|
|
|
172
|
-
# Detect architecture
|
|
173
128
|
case "$(uname -m)" in
|
|
174
129
|
x86_64|amd64)
|
|
175
130
|
arch="x64"
|
|
@@ -186,27 +141,10 @@ detect_platform() {
|
|
|
186
141
|
;;
|
|
187
142
|
esac
|
|
188
143
|
|
|
189
|
-
# Detect libc (Linux only)
|
|
190
|
-
libc=""
|
|
191
|
-
if [[ "$os" == "linux" ]]; then
|
|
192
|
-
# Check for musl (Alpine, etc.)
|
|
193
|
-
if ldd --version 2>&1 | grep -qi musl; then
|
|
194
|
-
libc="musl"
|
|
195
|
-
elif [[ -f /etc/alpine-release ]]; then
|
|
196
|
-
libc="musl"
|
|
197
|
-
fi
|
|
198
|
-
fi
|
|
199
|
-
|
|
200
144
|
PLATFORM="$os"
|
|
201
145
|
ARCH="$arch"
|
|
202
|
-
LIBC="$libc"
|
|
203
146
|
|
|
204
|
-
|
|
205
|
-
if [[ -n "$LIBC" ]]; then
|
|
206
|
-
platform_str="$platform_str-$LIBC"
|
|
207
|
-
fi
|
|
208
|
-
|
|
209
|
-
log "Detected platform: $platform_str"
|
|
147
|
+
log "Detected platform: ${BOLD}$PLATFORM-$ARCH${NC}"
|
|
210
148
|
}
|
|
211
149
|
|
|
212
150
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -237,36 +175,6 @@ download() {
|
|
|
237
175
|
esac
|
|
238
176
|
}
|
|
239
177
|
|
|
240
|
-
# Download a file to a path
|
|
241
|
-
download_file() {
|
|
242
|
-
local url="$1"
|
|
243
|
-
local dest="$2"
|
|
244
|
-
case "$DOWNLOADER" in
|
|
245
|
-
curl)
|
|
246
|
-
curl -fsSL -o "$dest" "$url"
|
|
247
|
-
;;
|
|
248
|
-
wget)
|
|
249
|
-
wget -q -O "$dest" "$url"
|
|
250
|
-
;;
|
|
251
|
-
esac
|
|
252
|
-
}
|
|
253
|
-
|
|
254
|
-
# Parse a JSON field (jq with bash fallback)
|
|
255
|
-
parse_json_field() {
|
|
256
|
-
local json="$1"
|
|
257
|
-
local field="$2"
|
|
258
|
-
|
|
259
|
-
if check_command jq; then
|
|
260
|
-
echo "$json" | jq -r ".$field // empty"
|
|
261
|
-
else
|
|
262
|
-
# Bash regex fallback for simple cases
|
|
263
|
-
local pattern="\"$field\"[[:space:]]*:[[:space:]]*\"([^\"]*)\""
|
|
264
|
-
if [[ $json =~ $pattern ]]; then
|
|
265
|
-
echo "${BASH_REMATCH[1]}"
|
|
266
|
-
fi
|
|
267
|
-
fi
|
|
268
|
-
}
|
|
269
|
-
|
|
270
178
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
271
179
|
# Package Manager Detection
|
|
272
180
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -297,8 +205,6 @@ install_package() {
|
|
|
297
205
|
local pm
|
|
298
206
|
pm=$(detect_package_manager)
|
|
299
207
|
|
|
300
|
-
log "Installing $package..."
|
|
301
|
-
|
|
302
208
|
case "$pm" in
|
|
303
209
|
brew)
|
|
304
210
|
brew install "$package"
|
|
@@ -322,7 +228,6 @@ install_package() {
|
|
|
322
228
|
sudo zypper install -y "$package"
|
|
323
229
|
;;
|
|
324
230
|
*)
|
|
325
|
-
warn "Unknown package manager. Please install $package manually."
|
|
326
231
|
return 1
|
|
327
232
|
;;
|
|
328
233
|
esac
|
|
@@ -332,8 +237,22 @@ install_package() {
|
|
|
332
237
|
# Prerequisite Installation
|
|
333
238
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
334
239
|
|
|
240
|
+
install_git_if_needed() {
|
|
241
|
+
if check_command git; then
|
|
242
|
+
success "git found"
|
|
243
|
+
return 0
|
|
244
|
+
fi
|
|
245
|
+
|
|
246
|
+
log "Installing git..."
|
|
247
|
+
if install_package "git" && check_command git; then
|
|
248
|
+
success "git installed"
|
|
249
|
+
else
|
|
250
|
+
error "git is required but could not be installed"
|
|
251
|
+
exit 3
|
|
252
|
+
fi
|
|
253
|
+
}
|
|
254
|
+
|
|
335
255
|
install_node_if_needed() {
|
|
336
|
-
# Check if Node 20+ is already available
|
|
337
256
|
if check_command node; then
|
|
338
257
|
local node_version
|
|
339
258
|
node_version=$(node --version 2>/dev/null | sed 's/v//' | cut -d. -f1)
|
|
@@ -343,22 +262,17 @@ install_node_if_needed() {
|
|
|
343
262
|
fi
|
|
344
263
|
fi
|
|
345
264
|
|
|
346
|
-
log "Node.js
|
|
265
|
+
log "Installing Node.js..."
|
|
347
266
|
|
|
348
|
-
# Check if nvm is installed
|
|
349
267
|
export NVM_DIR="${NVM_DIR:-$HOME/.nvm}"
|
|
350
268
|
|
|
351
269
|
if [[ ! -d "$NVM_DIR" ]]; then
|
|
352
|
-
log "Installing nvm..."
|
|
353
270
|
download "https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh" | bash
|
|
354
271
|
fi
|
|
355
272
|
|
|
356
|
-
# Source nvm
|
|
357
273
|
# shellcheck source=/dev/null
|
|
358
274
|
[[ -s "$NVM_DIR/nvm.sh" ]] && \. "$NVM_DIR/nvm.sh"
|
|
359
275
|
|
|
360
|
-
# Install Node 22
|
|
361
|
-
log "Installing Node.js 22 via nvm..."
|
|
362
276
|
nvm install 22
|
|
363
277
|
nvm use 22
|
|
364
278
|
nvm alias default 22
|
|
@@ -375,7 +289,6 @@ install_bun_if_needed() {
|
|
|
375
289
|
log "Installing Bun..."
|
|
376
290
|
download "https://bun.sh/install" | bash
|
|
377
291
|
|
|
378
|
-
# Add bun to PATH for this session
|
|
379
292
|
export BUN_INSTALL="${BUN_INSTALL:-$HOME/.bun}"
|
|
380
293
|
export PATH="$BUN_INSTALL/bin:$PATH"
|
|
381
294
|
|
|
@@ -389,100 +302,60 @@ install_bun_if_needed() {
|
|
|
389
302
|
|
|
390
303
|
install_tmux_if_needed() {
|
|
391
304
|
if check_command tmux; then
|
|
392
|
-
success "tmux
|
|
305
|
+
success "tmux installed"
|
|
393
306
|
return 0
|
|
394
307
|
fi
|
|
395
308
|
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
if install_package "$pkg"; then
|
|
403
|
-
if check_command tmux; then
|
|
404
|
-
success "tmux installed"
|
|
405
|
-
return 0
|
|
406
|
-
fi
|
|
309
|
+
log "Installing tmux..."
|
|
310
|
+
if install_package "tmux" && check_command tmux; then
|
|
311
|
+
success "tmux installed"
|
|
312
|
+
else
|
|
313
|
+
warn "Could not install tmux automatically"
|
|
407
314
|
fi
|
|
408
|
-
|
|
409
|
-
warn "Could not install tmux. Please install it manually."
|
|
410
|
-
warn "Visit: https://github.com/tmux/tmux/wiki/Installing"
|
|
411
|
-
return 1
|
|
412
315
|
}
|
|
413
316
|
|
|
414
317
|
install_jq_if_needed() {
|
|
415
318
|
if check_command jq; then
|
|
416
|
-
success "jq
|
|
319
|
+
success "jq installed"
|
|
417
320
|
return 0
|
|
418
321
|
fi
|
|
419
322
|
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
323
|
+
log "Installing jq..."
|
|
324
|
+
if install_package "jq" && check_command jq; then
|
|
325
|
+
success "jq installed"
|
|
326
|
+
else
|
|
327
|
+
warn "Could not install jq automatically"
|
|
425
328
|
fi
|
|
426
|
-
|
|
427
|
-
warn "Could not install jq. JSON parsing will use fallback method."
|
|
428
|
-
return 1
|
|
429
329
|
}
|
|
430
330
|
|
|
431
331
|
install_rg_if_needed() {
|
|
432
332
|
if check_command rg; then
|
|
433
|
-
success "ripgrep
|
|
333
|
+
success "ripgrep installed"
|
|
434
334
|
return 0
|
|
435
335
|
fi
|
|
436
336
|
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
if install_package "$pkg"; then
|
|
444
|
-
if check_command rg; then
|
|
445
|
-
success "ripgrep installed"
|
|
446
|
-
return 0
|
|
447
|
-
fi
|
|
448
|
-
fi
|
|
449
|
-
|
|
450
|
-
warn "Could not install ripgrep. Some features may be limited."
|
|
451
|
-
return 1
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
install_git_if_needed() {
|
|
455
|
-
if check_command git; then
|
|
456
|
-
success "git found"
|
|
457
|
-
return 0
|
|
458
|
-
fi
|
|
459
|
-
|
|
460
|
-
if install_package "git"; then
|
|
461
|
-
if check_command git; then
|
|
462
|
-
success "git installed"
|
|
463
|
-
return 0
|
|
464
|
-
fi
|
|
337
|
+
log "Installing ripgrep..."
|
|
338
|
+
if install_package "ripgrep" && check_command rg; then
|
|
339
|
+
success "ripgrep installed"
|
|
340
|
+
else
|
|
341
|
+
warn "Could not install ripgrep automatically"
|
|
465
342
|
fi
|
|
466
|
-
|
|
467
|
-
error "git is required but could not be installed"
|
|
468
|
-
exit 3
|
|
469
343
|
}
|
|
470
344
|
|
|
471
345
|
install_claude_if_needed() {
|
|
472
346
|
if check_command claude; then
|
|
473
|
-
success "Claude Code CLI
|
|
347
|
+
success "Claude Code CLI installed"
|
|
474
348
|
return 0
|
|
475
349
|
fi
|
|
476
350
|
|
|
477
351
|
log "Installing Claude Code CLI..."
|
|
478
352
|
|
|
479
|
-
# Prefer bun for installation
|
|
480
353
|
if check_command bun; then
|
|
481
354
|
bun install -g @anthropic-ai/claude-code
|
|
482
355
|
elif check_command npm; then
|
|
483
356
|
npm install -g @anthropic-ai/claude-code
|
|
484
357
|
else
|
|
485
|
-
warn "Neither bun nor npm found
|
|
358
|
+
warn "Neither bun nor npm found"
|
|
486
359
|
return 1
|
|
487
360
|
fi
|
|
488
361
|
|
|
@@ -495,26 +368,14 @@ install_claude_if_needed() {
|
|
|
495
368
|
}
|
|
496
369
|
|
|
497
370
|
install_plugin_if_needed() {
|
|
498
|
-
if [[ "$INSTALL_PLUGIN" != true ]]; then
|
|
499
|
-
return 0
|
|
500
|
-
fi
|
|
501
|
-
|
|
502
|
-
# Check if already installed
|
|
503
371
|
if claude plugin list 2>/dev/null | grep -q "automagik-genie"; then
|
|
504
372
|
success "automagik-genie plugin already installed"
|
|
505
373
|
return 0
|
|
506
374
|
fi
|
|
507
375
|
|
|
508
|
-
# Requires Claude CLI
|
|
509
|
-
if ! check_command claude; then
|
|
510
|
-
warn "Claude Code CLI required for plugin - installing first"
|
|
511
|
-
install_claude_if_needed || return 1
|
|
512
|
-
fi
|
|
513
|
-
|
|
514
376
|
log "Installing automagik-genie plugin..."
|
|
515
377
|
if claude plugin install namastexlabs/automagik-genie; then
|
|
516
378
|
success "automagik-genie plugin installed"
|
|
517
|
-
info "Restart Claude Code to activate the plugin"
|
|
518
379
|
else
|
|
519
380
|
warn "Plugin installation failed"
|
|
520
381
|
info "Try manually: claude plugin install namastexlabs/automagik-genie"
|
|
@@ -523,549 +384,136 @@ install_plugin_if_needed() {
|
|
|
523
384
|
}
|
|
524
385
|
|
|
525
386
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
526
|
-
#
|
|
527
|
-
# ─────────────────────────────────────────────────────────────────────────────
|
|
528
|
-
|
|
529
|
-
# Write install method to ~/.genie/config.json
|
|
530
|
-
write_install_method() {
|
|
531
|
-
local method="$1"
|
|
532
|
-
local config_file="$GENIE_HOME/config.json"
|
|
533
|
-
|
|
534
|
-
mkdir -p "$GENIE_HOME"
|
|
535
|
-
|
|
536
|
-
if [[ -f "$config_file" ]]; then
|
|
537
|
-
# Update existing config
|
|
538
|
-
if check_command jq; then
|
|
539
|
-
jq --arg m "$method" '.installMethod = $m' "$config_file" > "$config_file.tmp" && mv "$config_file.tmp" "$config_file"
|
|
540
|
-
else
|
|
541
|
-
# Fallback: read file, check if it has content
|
|
542
|
-
local content
|
|
543
|
-
content=$(cat "$config_file" 2>/dev/null || echo "{}")
|
|
544
|
-
if [[ "$content" == "{}" || -z "$content" ]]; then
|
|
545
|
-
echo "{\"installMethod\":\"$method\"}" > "$config_file"
|
|
546
|
-
else
|
|
547
|
-
# Simple sed to add installMethod before closing brace
|
|
548
|
-
# Remove existing installMethod if present, then add new one
|
|
549
|
-
content=$(echo "$content" | sed 's/,"installMethod":"[^"]*"//g' | sed 's/"installMethod":"[^"]*",//g' | sed 's/"installMethod":"[^"]*"//g')
|
|
550
|
-
# Handle empty object case after removal
|
|
551
|
-
if [[ "$content" == "{}" ]]; then
|
|
552
|
-
echo "{\"installMethod\":\"$method\"}" > "$config_file"
|
|
553
|
-
else
|
|
554
|
-
# Add installMethod before final }
|
|
555
|
-
echo "$content" | sed 's/}$/,"installMethod":"'"$method"'"}/' > "$config_file"
|
|
556
|
-
fi
|
|
557
|
-
fi
|
|
558
|
-
fi
|
|
559
|
-
else
|
|
560
|
-
echo "{\"installMethod\":\"$method\"}" > "$config_file"
|
|
561
|
-
fi
|
|
562
|
-
|
|
563
|
-
log "Install method '$method' saved to config"
|
|
564
|
-
}
|
|
565
|
-
|
|
566
|
-
# Prompt user for install method choice
|
|
567
|
-
prompt_install_method() {
|
|
568
|
-
if [[ "$AUTO_YES" == true ]]; then
|
|
569
|
-
# Default to bun for auto mode
|
|
570
|
-
INSTALL_METHOD="bun"
|
|
571
|
-
return
|
|
572
|
-
fi
|
|
573
|
-
|
|
574
|
-
echo
|
|
575
|
-
echo -e "${BOLD}How would you like to install Genie CLI?${NC}"
|
|
576
|
-
echo
|
|
577
|
-
echo " 1) source - Clone from GitHub (developer mode)"
|
|
578
|
-
echo " 2) npm - Install via npm -g"
|
|
579
|
-
echo " 3) bun - Install via bun -g (recommended)"
|
|
580
|
-
echo
|
|
581
|
-
echo -en "${YELLOW}?${NC} Choose [1-3] (default: 3): "
|
|
582
|
-
read -r choice < /dev/tty
|
|
583
|
-
|
|
584
|
-
case "$choice" in
|
|
585
|
-
1) INSTALL_METHOD="source" ;;
|
|
586
|
-
2) INSTALL_METHOD="npm" ;;
|
|
587
|
-
*) INSTALL_METHOD="bun" ;;
|
|
588
|
-
esac
|
|
589
|
-
}
|
|
590
|
-
|
|
591
|
-
# Prompt user for optional components
|
|
592
|
-
prompt_optional_components() {
|
|
593
|
-
if [[ "$AUTO_YES" == true ]]; then
|
|
594
|
-
return # Install all by default
|
|
595
|
-
fi
|
|
596
|
-
|
|
597
|
-
echo
|
|
598
|
-
echo -e "${BOLD}Optional Components:${NC}"
|
|
599
|
-
echo
|
|
600
|
-
echo " 1) Claude Code CLI - Required for plugin"
|
|
601
|
-
echo " 2) Claude Code Plugin - automagik-genie (skills, agents, hooks)"
|
|
602
|
-
echo " 3) tmux - Terminal multiplexing"
|
|
603
|
-
echo " 4) ripgrep - Fast code search"
|
|
604
|
-
echo " 5) jq - JSON processing"
|
|
605
|
-
echo
|
|
606
|
-
echo -en "${YELLOW}?${NC} Select components [1-5, all, none] (default: all): "
|
|
607
|
-
read -r choices < /dev/tty
|
|
608
|
-
|
|
609
|
-
# Reset all to false if user makes selections
|
|
610
|
-
if [[ -n "$choices" && "$choices" != "all" ]]; then
|
|
611
|
-
INSTALL_CLAUDE=false
|
|
612
|
-
INSTALL_PLUGIN=false
|
|
613
|
-
INSTALL_TMUX=false
|
|
614
|
-
INSTALL_RG=false
|
|
615
|
-
INSTALL_JQ=false
|
|
616
|
-
|
|
617
|
-
if [[ "$choices" == "none" ]]; then
|
|
618
|
-
return
|
|
619
|
-
fi
|
|
620
|
-
|
|
621
|
-
# Parse selections (comma or space separated)
|
|
622
|
-
for choice in $(echo "$choices" | tr ',' ' '); do
|
|
623
|
-
case "$choice" in
|
|
624
|
-
1) INSTALL_CLAUDE=true ;;
|
|
625
|
-
2) INSTALL_PLUGIN=true; INSTALL_CLAUDE=true ;; # Plugin requires Claude
|
|
626
|
-
3) INSTALL_TMUX=true ;;
|
|
627
|
-
4) INSTALL_RG=true ;;
|
|
628
|
-
5) INSTALL_JQ=true ;;
|
|
629
|
-
esac
|
|
630
|
-
done
|
|
631
|
-
fi
|
|
632
|
-
}
|
|
633
|
-
|
|
634
|
-
# ─────────────────────────────────────────────────────────────────────────────
|
|
635
|
-
# Installation Methods
|
|
387
|
+
# Genie CLI Installation
|
|
636
388
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
637
389
|
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
local version_arg=""
|
|
641
|
-
if [[ "$TARGET_VERSION" != "stable" && "$TARGET_VERSION" != "latest" ]]; then
|
|
642
|
-
version_arg="@$TARGET_VERSION"
|
|
643
|
-
elif [[ "$TARGET_VERSION" == "latest" ]]; then
|
|
644
|
-
version_arg="@latest"
|
|
645
|
-
fi
|
|
390
|
+
install_genie_cli() {
|
|
391
|
+
log "Installing $PACKAGE_NAME..."
|
|
646
392
|
|
|
647
|
-
local used_method=""
|
|
648
393
|
if check_command bun; then
|
|
649
|
-
|
|
650
|
-
used_method="bun"
|
|
394
|
+
bun install -g "$PACKAGE_NAME"
|
|
651
395
|
elif check_command npm; then
|
|
652
|
-
|
|
653
|
-
|
|
396
|
+
npm install -g "$PACKAGE_NAME"
|
|
397
|
+
else
|
|
398
|
+
error "Neither bun nor npm found"
|
|
399
|
+
exit 3
|
|
654
400
|
fi
|
|
655
401
|
|
|
656
|
-
|
|
402
|
+
success "$PACKAGE_NAME installed"
|
|
657
403
|
}
|
|
658
404
|
|
|
659
|
-
#
|
|
660
|
-
|
|
661
|
-
|
|
405
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
406
|
+
# Claudio Setup
|
|
407
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
662
408
|
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
409
|
+
run_claudio_setup() {
|
|
410
|
+
log "Running claudio setup..."
|
|
411
|
+
if check_command claudio; then
|
|
412
|
+
claudio setup
|
|
413
|
+
else
|
|
414
|
+
warn "claudio command not found"
|
|
415
|
+
info "Run 'claudio setup' after restarting your shell"
|
|
667
416
|
fi
|
|
668
|
-
|
|
669
|
-
log "Installing $PACKAGE_NAME globally..."
|
|
670
|
-
install_via_pm
|
|
671
|
-
|
|
672
|
-
success "Genie CLI installed via package manager"
|
|
673
417
|
}
|
|
674
418
|
|
|
675
|
-
#
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
CLEANUP_NEEDED=true
|
|
419
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
420
|
+
# Main Install Flow
|
|
421
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
680
422
|
|
|
423
|
+
run_install() {
|
|
424
|
+
# Required prerequisites
|
|
681
425
|
header "Installing prerequisites..."
|
|
682
|
-
|
|
683
426
|
install_git_if_needed
|
|
684
427
|
install_node_if_needed
|
|
685
428
|
install_bun_if_needed
|
|
429
|
+
install_tmux_if_needed
|
|
430
|
+
install_jq_if_needed
|
|
431
|
+
install_rg_if_needed
|
|
686
432
|
|
|
687
|
-
#
|
|
688
|
-
prompt_optional_components
|
|
689
|
-
|
|
690
|
-
# Install optional components based on selections
|
|
691
|
-
[[ "$INSTALL_TMUX" == true ]] && install_tmux_if_needed || true
|
|
692
|
-
[[ "$INSTALL_JQ" == true ]] && install_jq_if_needed || true
|
|
693
|
-
[[ "$INSTALL_RG" == true ]] && install_rg_if_needed || true
|
|
694
|
-
[[ "$INSTALL_CLAUDE" == true ]] && install_claude_if_needed || true
|
|
695
|
-
|
|
433
|
+
# Genie CLI (required)
|
|
696
434
|
header "Installing Genie CLI..."
|
|
435
|
+
install_genie_cli
|
|
697
436
|
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
CLEANUP_NEEDED=true
|
|
713
|
-
|
|
714
|
-
header "Installing prerequisites..."
|
|
715
|
-
|
|
716
|
-
install_git_if_needed
|
|
717
|
-
install_node_if_needed
|
|
718
|
-
install_bun_if_needed
|
|
719
|
-
|
|
720
|
-
# Prompt for optional components
|
|
721
|
-
prompt_optional_components
|
|
722
|
-
|
|
723
|
-
# Install optional components based on selections
|
|
724
|
-
[[ "$INSTALL_TMUX" == true ]] && install_tmux_if_needed || true
|
|
725
|
-
[[ "$INSTALL_JQ" == true ]] && install_jq_if_needed || true
|
|
726
|
-
[[ "$INSTALL_RG" == true ]] && install_rg_if_needed || true
|
|
727
|
-
[[ "$INSTALL_CLAUDE" == true ]] && install_claude_if_needed || true
|
|
728
|
-
|
|
729
|
-
header "Cloning repository..."
|
|
730
|
-
|
|
731
|
-
if [[ -d "$GENIE_SRC" ]]; then
|
|
732
|
-
if confirm "Existing source installation found at $GENIE_SRC. Remove and reinstall?"; then
|
|
733
|
-
rm -rf "$GENIE_SRC"
|
|
734
|
-
else
|
|
735
|
-
error "Installation cancelled"
|
|
736
|
-
exit 1
|
|
437
|
+
# Optional: Claude Code CLI
|
|
438
|
+
echo
|
|
439
|
+
info "AI-powered coding assistant from Anthropic"
|
|
440
|
+
if confirm "Install Claude Code CLI?"; then
|
|
441
|
+
install_claude_if_needed
|
|
442
|
+
|
|
443
|
+
# Optional: Genie Plugin (only if Claude installed)
|
|
444
|
+
if check_command claude; then
|
|
445
|
+
echo
|
|
446
|
+
info "Adds skills, agents, and hooks to Claude Code"
|
|
447
|
+
if confirm "Install Genie plugin for Claude Code?"; then
|
|
448
|
+
install_plugin_if_needed
|
|
449
|
+
fi
|
|
737
450
|
fi
|
|
738
451
|
fi
|
|
739
452
|
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
log "Checking out version $TARGET_VERSION..."
|
|
746
|
-
cd "$GENIE_SRC"
|
|
747
|
-
git checkout "v$TARGET_VERSION" 2>/dev/null || git checkout "$TARGET_VERSION"
|
|
748
|
-
fi
|
|
749
|
-
|
|
750
|
-
header "Building..."
|
|
751
|
-
|
|
752
|
-
cd "$GENIE_SRC"
|
|
753
|
-
run bun install
|
|
754
|
-
run bun run build
|
|
755
|
-
|
|
756
|
-
header "Installing binaries..."
|
|
757
|
-
|
|
758
|
-
install_binaries
|
|
759
|
-
|
|
760
|
-
# Save install method to config
|
|
761
|
-
write_install_method "source"
|
|
762
|
-
|
|
763
|
-
# Install plugin after source build
|
|
764
|
-
install_plugin_if_needed || true
|
|
765
|
-
|
|
766
|
-
CLEANUP_NEEDED=false
|
|
767
|
-
success "Genie CLI built and installed from source"
|
|
768
|
-
}
|
|
769
|
-
|
|
770
|
-
# Update existing installation
|
|
771
|
-
install_update() {
|
|
772
|
-
header "Update"
|
|
773
|
-
|
|
774
|
-
# Detect installation type
|
|
775
|
-
local install_type=""
|
|
776
|
-
|
|
777
|
-
if [[ -d "$GENIE_SRC/.git" ]]; then
|
|
778
|
-
install_type="source"
|
|
779
|
-
elif check_command genie; then
|
|
780
|
-
# Check if installed via npm/bun
|
|
781
|
-
local genie_path
|
|
782
|
-
genie_path=$(which genie 2>/dev/null || true)
|
|
783
|
-
if [[ "$genie_path" == *"node_modules"* || "$genie_path" == *".bun"* ]]; then
|
|
784
|
-
install_type="npm"
|
|
785
|
-
elif [[ "$genie_path" == "$LOCAL_BIN/genie" || "$genie_path" == "$GENIE_BIN/"* ]]; then
|
|
786
|
-
install_type="source"
|
|
787
|
-
else
|
|
788
|
-
install_type="npm"
|
|
789
|
-
fi
|
|
790
|
-
else
|
|
791
|
-
error "No existing Genie CLI installation found"
|
|
792
|
-
info "Run without 'update' to perform a fresh install"
|
|
793
|
-
exit 1
|
|
453
|
+
# Optional: Claudio setup
|
|
454
|
+
echo
|
|
455
|
+
info "Manage multiple Claude API configurations"
|
|
456
|
+
if confirm "Configure Claudio profiles?"; then
|
|
457
|
+
run_claudio_setup
|
|
794
458
|
fi
|
|
795
459
|
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
case "$install_type" in
|
|
799
|
-
source)
|
|
800
|
-
update_source
|
|
801
|
-
;;
|
|
802
|
-
npm)
|
|
803
|
-
update_npm
|
|
804
|
-
;;
|
|
805
|
-
esac
|
|
460
|
+
print_success
|
|
806
461
|
}
|
|
807
462
|
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
if [[ ! -d "$GENIE_SRC/.git" ]]; then
|
|
812
|
-
error "Source directory not found at $GENIE_SRC"
|
|
813
|
-
exit 1
|
|
814
|
-
fi
|
|
815
|
-
|
|
816
|
-
cd "$GENIE_SRC"
|
|
463
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
464
|
+
# Main Uninstall Flow
|
|
465
|
+
# ─────────────────────────────────────────────────────────────────────────────
|
|
817
466
|
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
467
|
+
run_uninstall() {
|
|
468
|
+
echo
|
|
469
|
+
echo -e "${BOLD}Genie CLI Uninstaller${NC}"
|
|
470
|
+
echo -e "${DIM}────────────────────────────────────${NC}"
|
|
471
|
+
echo
|
|
821
472
|
|
|
822
|
-
if
|
|
823
|
-
|
|
824
|
-
|
|
473
|
+
if ! confirm_no "Remove Genie CLI and all components?"; then
|
|
474
|
+
info "Cancelled"
|
|
475
|
+
exit 0
|
|
825
476
|
fi
|
|
826
477
|
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
run bun run build
|
|
830
|
-
|
|
831
|
-
install_binaries
|
|
832
|
-
|
|
833
|
-
success "Source installation updated"
|
|
834
|
-
}
|
|
835
|
-
|
|
836
|
-
update_npm() {
|
|
837
|
-
log "Updating npm/bun installation..."
|
|
478
|
+
echo
|
|
479
|
+
log "Removing..."
|
|
838
480
|
|
|
839
|
-
|
|
840
|
-
if
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
481
|
+
# Remove plugin
|
|
482
|
+
if check_command claude; then
|
|
483
|
+
if claude plugin uninstall namastexlabs/automagik-genie 2>/dev/null; then
|
|
484
|
+
success "Claude Code plugin removed"
|
|
485
|
+
fi
|
|
844
486
|
fi
|
|
845
487
|
|
|
488
|
+
# Remove genie-cli
|
|
846
489
|
if check_command bun; then
|
|
847
|
-
|
|
848
|
-
elif check_command npm; then
|
|
849
|
-
run npm install -g "${PACKAGE_NAME}${version_arg}"
|
|
850
|
-
else
|
|
851
|
-
error "Neither bun nor npm found"
|
|
852
|
-
exit 3
|
|
490
|
+
bun remove -g "$PACKAGE_NAME" 2>/dev/null || true
|
|
853
491
|
fi
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
}
|
|
857
|
-
|
|
858
|
-
# Auto-detect best installation mode
|
|
859
|
-
install_auto() {
|
|
860
|
-
log "Auto-detecting best installation mode..."
|
|
861
|
-
|
|
862
|
-
# Check for existing installation
|
|
863
|
-
if [[ -d "$GENIE_SRC/.git" ]]; then
|
|
864
|
-
log "Found existing source installation"
|
|
865
|
-
INSTALL_MODE="update"
|
|
866
|
-
install_update
|
|
867
|
-
return
|
|
868
|
-
fi
|
|
869
|
-
|
|
870
|
-
if check_command genie; then
|
|
871
|
-
log "Found existing genie installation"
|
|
872
|
-
INSTALL_MODE="update"
|
|
873
|
-
install_update
|
|
874
|
-
return
|
|
875
|
-
fi
|
|
876
|
-
|
|
877
|
-
# Fresh install: prompt user for install method
|
|
878
|
-
prompt_install_method
|
|
879
|
-
|
|
880
|
-
case "$INSTALL_METHOD" in
|
|
881
|
-
source)
|
|
882
|
-
INSTALL_MODE="source"
|
|
883
|
-
install_source
|
|
884
|
-
;;
|
|
885
|
-
npm)
|
|
886
|
-
if check_command npm; then
|
|
887
|
-
INSTALL_MODE="quick"
|
|
888
|
-
install_quick_pm "npm"
|
|
889
|
-
else
|
|
890
|
-
log "npm not found, using full install"
|
|
891
|
-
INSTALL_MODE="full"
|
|
892
|
-
install_full
|
|
893
|
-
fi
|
|
894
|
-
;;
|
|
895
|
-
bun)
|
|
896
|
-
if check_command bun; then
|
|
897
|
-
INSTALL_MODE="quick"
|
|
898
|
-
install_quick_pm "bun"
|
|
899
|
-
else
|
|
900
|
-
log "bun not found, using full install"
|
|
901
|
-
INSTALL_MODE="full"
|
|
902
|
-
install_full
|
|
903
|
-
fi
|
|
904
|
-
;;
|
|
905
|
-
esac
|
|
906
|
-
}
|
|
907
|
-
|
|
908
|
-
# Plugin-only install
|
|
909
|
-
install_plugin_only() {
|
|
910
|
-
header "Plugin Install"
|
|
911
|
-
|
|
912
|
-
INSTALL_PLUGIN=true
|
|
913
|
-
install_plugin_if_needed
|
|
914
|
-
}
|
|
915
|
-
|
|
916
|
-
# Quick install via specific package manager
|
|
917
|
-
install_quick_pm() {
|
|
918
|
-
local pm="$1"
|
|
919
|
-
header "Quick Install ($pm)"
|
|
920
|
-
|
|
921
|
-
if ! check_command "$pm"; then
|
|
922
|
-
error "$pm is not installed."
|
|
923
|
-
info "Use 'full' mode to install all dependencies: curl ... | bash -s -- full"
|
|
924
|
-
exit 3
|
|
492
|
+
if check_command npm; then
|
|
493
|
+
npm uninstall -g "$PACKAGE_NAME" 2>/dev/null || true
|
|
925
494
|
fi
|
|
495
|
+
success "Genie CLI removed"
|
|
926
496
|
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
version_arg="@$TARGET_VERSION"
|
|
932
|
-
elif [[ "$TARGET_VERSION" == "latest" ]]; then
|
|
933
|
-
version_arg="@latest"
|
|
497
|
+
# Clean config
|
|
498
|
+
if [[ -d "$GENIE_HOME" ]]; then
|
|
499
|
+
rm -rf "$GENIE_HOME"
|
|
500
|
+
success "Configuration cleaned"
|
|
934
501
|
fi
|
|
935
502
|
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
success "Genie CLI installed via $pm"
|
|
939
|
-
}
|
|
940
|
-
|
|
941
|
-
# ─────────────────────────────────────────────────────────────────────────────
|
|
942
|
-
# Binary Installation (for source installs)
|
|
943
|
-
# ─────────────────────────────────────────────────────────────────────────────
|
|
944
|
-
|
|
945
|
-
install_binaries() {
|
|
946
|
-
log "Installing binaries..."
|
|
947
|
-
|
|
948
|
-
mkdir -p "$GENIE_BIN"
|
|
949
|
-
mkdir -p "$LOCAL_BIN"
|
|
950
|
-
|
|
951
|
-
# Copy built files
|
|
952
|
-
cp "$GENIE_SRC/dist/genie.js" "$GENIE_BIN/"
|
|
953
|
-
cp "$GENIE_SRC/dist/term.js" "$GENIE_BIN/"
|
|
954
|
-
cp "$GENIE_SRC/dist/claudio.js" "$GENIE_BIN/"
|
|
955
|
-
chmod +x "$GENIE_BIN"/*.js
|
|
956
|
-
|
|
957
|
-
# Create symlinks
|
|
958
|
-
ln -sf "$GENIE_BIN/genie.js" "$LOCAL_BIN/genie"
|
|
959
|
-
ln -sf "$GENIE_BIN/term.js" "$LOCAL_BIN/term"
|
|
960
|
-
ln -sf "$GENIE_BIN/claudio.js" "$LOCAL_BIN/claudio"
|
|
961
|
-
|
|
962
|
-
success "Binaries installed to $GENIE_BIN"
|
|
503
|
+
echo
|
|
504
|
+
success "Done"
|
|
963
505
|
}
|
|
964
506
|
|
|
965
507
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
966
|
-
#
|
|
508
|
+
# Success Message
|
|
967
509
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
968
510
|
|
|
969
|
-
ensure_path() {
|
|
970
|
-
local needs_path=false
|
|
971
|
-
local shell_profile=""
|
|
972
|
-
|
|
973
|
-
# Check various PATH locations
|
|
974
|
-
if [[ ":$PATH:" != *":$LOCAL_BIN:"* ]]; then
|
|
975
|
-
needs_path=true
|
|
976
|
-
fi
|
|
977
|
-
|
|
978
|
-
# Also check for bun path
|
|
979
|
-
if [[ -d "$HOME/.bun/bin" && ":$PATH:" != *":$HOME/.bun/bin:"* ]]; then
|
|
980
|
-
needs_path=true
|
|
981
|
-
fi
|
|
982
|
-
|
|
983
|
-
if [[ "$needs_path" == true ]]; then
|
|
984
|
-
# Detect shell profile
|
|
985
|
-
if [[ -n "${ZSH_VERSION:-}" ]] || [[ "$SHELL" == *"zsh"* ]]; then
|
|
986
|
-
shell_profile="$HOME/.zshrc"
|
|
987
|
-
elif [[ -n "${BASH_VERSION:-}" ]] || [[ "$SHELL" == *"bash"* ]]; then
|
|
988
|
-
if [[ -f "$HOME/.bashrc" ]]; then
|
|
989
|
-
shell_profile="$HOME/.bashrc"
|
|
990
|
-
else
|
|
991
|
-
shell_profile="$HOME/.bash_profile"
|
|
992
|
-
fi
|
|
993
|
-
fi
|
|
994
|
-
|
|
995
|
-
echo
|
|
996
|
-
warn "Some paths may not be in your PATH"
|
|
997
|
-
echo
|
|
998
|
-
echo "Add these to your shell profile ($shell_profile):"
|
|
999
|
-
echo -e "${CYAN} export PATH=\"\$HOME/.local/bin:\$HOME/.bun/bin:\$PATH\"${NC}"
|
|
1000
|
-
echo
|
|
1001
|
-
echo "Then reload your shell:"
|
|
1002
|
-
echo -e "${CYAN} source $shell_profile${NC}"
|
|
1003
|
-
echo
|
|
1004
|
-
fi
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
run_setup() {
|
|
1008
|
-
# Skip for updates
|
|
1009
|
-
if [[ "$INSTALL_MODE" == "update" ]]; then
|
|
1010
|
-
return 0
|
|
1011
|
-
fi
|
|
1012
|
-
|
|
1013
|
-
# Check if already configured
|
|
1014
|
-
if [[ -f "$GENIE_HOME/config.json" ]]; then
|
|
1015
|
-
local complete
|
|
1016
|
-
if check_command jq; then
|
|
1017
|
-
complete=$(jq -r '.setupComplete // false' "$GENIE_HOME/config.json" 2>/dev/null)
|
|
1018
|
-
else
|
|
1019
|
-
# Fallback: simple grep check
|
|
1020
|
-
if grep -q '"setupComplete"[[:space:]]*:[[:space:]]*true' "$GENIE_HOME/config.json" 2>/dev/null; then
|
|
1021
|
-
complete="true"
|
|
1022
|
-
else
|
|
1023
|
-
complete="false"
|
|
1024
|
-
fi
|
|
1025
|
-
fi
|
|
1026
|
-
if [[ "$complete" == "true" ]]; then
|
|
1027
|
-
log "Setup already complete, skipping"
|
|
1028
|
-
return 0
|
|
1029
|
-
fi
|
|
1030
|
-
fi
|
|
1031
|
-
|
|
1032
|
-
# Run setup
|
|
1033
|
-
if [[ "$AUTO_YES" == true ]]; then
|
|
1034
|
-
if check_command genie; then
|
|
1035
|
-
log "Running genie setup (quick mode)..."
|
|
1036
|
-
genie setup --quick 2>/dev/null || true
|
|
1037
|
-
elif [[ -x "$GENIE_BIN/genie.js" ]]; then
|
|
1038
|
-
log "Running genie setup (quick mode)..."
|
|
1039
|
-
"$GENIE_BIN/genie.js" setup --quick 2>/dev/null || true
|
|
1040
|
-
fi
|
|
1041
|
-
else
|
|
1042
|
-
if confirm "Run genie setup now?"; then
|
|
1043
|
-
if check_command genie; then
|
|
1044
|
-
genie setup
|
|
1045
|
-
elif [[ -x "$GENIE_BIN/genie.js" ]]; then
|
|
1046
|
-
"$GENIE_BIN/genie.js" setup
|
|
1047
|
-
fi
|
|
1048
|
-
else
|
|
1049
|
-
info "Skipped. Run 'genie setup' later to configure."
|
|
1050
|
-
fi
|
|
1051
|
-
fi
|
|
1052
|
-
}
|
|
1053
|
-
|
|
1054
511
|
print_success() {
|
|
1055
512
|
echo
|
|
1056
513
|
echo -e "${DIM}────────────────────────────────────${NC}"
|
|
1057
514
|
echo -e "${GREEN}${BOLD}Genie CLI installed successfully!${NC}"
|
|
1058
515
|
echo -e "${DIM}────────────────────────────────────${NC}"
|
|
1059
516
|
echo
|
|
1060
|
-
echo "Commands available:"
|
|
1061
|
-
echo -e " ${CYAN}genie${NC} - Setup and utilities"
|
|
1062
|
-
echo -e " ${CYAN}term${NC} - Terminal orchestration"
|
|
1063
|
-
echo -e " ${CYAN}claudio${NC} - Claude profile manager"
|
|
1064
|
-
echo
|
|
1065
|
-
echo "Get started:"
|
|
1066
|
-
echo -e " ${CYAN}genie --help${NC}"
|
|
1067
|
-
echo -e " ${CYAN}term --help${NC}"
|
|
1068
|
-
echo
|
|
1069
517
|
}
|
|
1070
518
|
|
|
1071
519
|
# ─────────────────────────────────────────────────────────────────────────────
|
|
@@ -1074,73 +522,24 @@ print_success() {
|
|
|
1074
522
|
|
|
1075
523
|
print_usage() {
|
|
1076
524
|
cat <<EOF
|
|
1077
|
-
Genie CLI Installer
|
|
525
|
+
Genie CLI Installer
|
|
1078
526
|
|
|
1079
527
|
Usage:
|
|
1080
528
|
curl -fsSL $RAW_REPO_URL/main/install.sh | bash
|
|
1081
|
-
curl
|
|
1082
|
-
|
|
1083
|
-
Modes:
|
|
1084
|
-
auto Auto-detect best installation method (default)
|
|
1085
|
-
quick Use bun/npm global install (requires node/bun)
|
|
1086
|
-
full Install all dependencies first, then global install
|
|
1087
|
-
source Clone repo and build locally (developer mode)
|
|
1088
|
-
update Update existing installation
|
|
1089
|
-
|
|
1090
|
-
Options:
|
|
1091
|
-
--version=VERSION Install specific version (stable, latest, or semver)
|
|
1092
|
-
--yes, -y Auto-approve all prompts
|
|
1093
|
-
--plugin-only Only install the automagik-genie Claude Code plugin
|
|
1094
|
-
--no-plugin Skip plugin installation
|
|
1095
|
-
--help, -h Show this help message
|
|
1096
|
-
|
|
1097
|
-
Examples:
|
|
1098
|
-
# Fresh install (auto-detect)
|
|
1099
|
-
curl -fsSL $RAW_REPO_URL/main/install.sh | bash
|
|
1100
|
-
|
|
1101
|
-
# Quick install (requires bun/npm)
|
|
1102
|
-
curl ... | bash -s -- quick
|
|
1103
|
-
|
|
1104
|
-
# Full install with all dependencies
|
|
1105
|
-
curl ... | bash -s -- full
|
|
1106
|
-
|
|
1107
|
-
# Developer mode (source build)
|
|
1108
|
-
curl ... | bash -s -- source
|
|
1109
|
-
|
|
1110
|
-
# Update existing installation
|
|
1111
|
-
curl ... | bash -s -- update
|
|
1112
|
-
|
|
1113
|
-
# Install specific version
|
|
1114
|
-
curl ... | bash -s -- --version=0.260202.0002
|
|
529
|
+
curl -fsSL $RAW_REPO_URL/main/install.sh | bash -s -- uninstall
|
|
1115
530
|
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
curl ... | bash -s -- full --no-plugin
|
|
1121
|
-
|
|
1122
|
-
# Only install the Claude Code plugin
|
|
1123
|
-
curl ... | bash -s -- --plugin-only
|
|
531
|
+
Commands:
|
|
532
|
+
(default) Interactive install
|
|
533
|
+
uninstall Remove Genie CLI and components
|
|
534
|
+
--help Show this help message
|
|
1124
535
|
EOF
|
|
1125
536
|
}
|
|
1126
537
|
|
|
1127
538
|
parse_args() {
|
|
1128
539
|
while [[ $# -gt 0 ]]; do
|
|
1129
540
|
case "$1" in
|
|
1130
|
-
|
|
1131
|
-
INSTALL_MODE="
|
|
1132
|
-
;;
|
|
1133
|
-
--plugin-only)
|
|
1134
|
-
INSTALL_MODE="plugin-only"
|
|
1135
|
-
;;
|
|
1136
|
-
--no-plugin)
|
|
1137
|
-
INSTALL_PLUGIN=false
|
|
1138
|
-
;;
|
|
1139
|
-
--version=*)
|
|
1140
|
-
TARGET_VERSION="${1#*=}"
|
|
1141
|
-
;;
|
|
1142
|
-
--yes|-y)
|
|
1143
|
-
AUTO_YES=true
|
|
541
|
+
uninstall)
|
|
542
|
+
INSTALL_MODE="uninstall"
|
|
1144
543
|
;;
|
|
1145
544
|
--help|-h)
|
|
1146
545
|
print_usage
|
|
@@ -1169,46 +568,17 @@ main() {
|
|
|
1169
568
|
echo -e "${DIM}────────────────────────────────────${NC}"
|
|
1170
569
|
echo
|
|
1171
570
|
|
|
1172
|
-
# Initialize
|
|
1173
571
|
init_downloader
|
|
1174
572
|
detect_platform
|
|
1175
573
|
|
|
1176
|
-
# Create temp directory
|
|
1177
|
-
TEMP_DIR=$(mktemp -d)
|
|
1178
|
-
|
|
1179
|
-
# Route to appropriate installer
|
|
1180
574
|
case "$INSTALL_MODE" in
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
;;
|
|
1184
|
-
quick)
|
|
1185
|
-
install_quick
|
|
1186
|
-
;;
|
|
1187
|
-
full)
|
|
1188
|
-
install_full
|
|
575
|
+
install)
|
|
576
|
+
run_install
|
|
1189
577
|
;;
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
;;
|
|
1193
|
-
update)
|
|
1194
|
-
install_update
|
|
1195
|
-
;;
|
|
1196
|
-
plugin-only)
|
|
1197
|
-
install_plugin_only
|
|
578
|
+
uninstall)
|
|
579
|
+
run_uninstall
|
|
1198
580
|
;;
|
|
1199
581
|
esac
|
|
1200
|
-
|
|
1201
|
-
# Post-install steps
|
|
1202
|
-
if [[ "$INSTALL_MODE" == "source" ]]; then
|
|
1203
|
-
ensure_path
|
|
1204
|
-
fi
|
|
1205
|
-
|
|
1206
|
-
# Run setup for non-update installs
|
|
1207
|
-
if [[ "$INSTALL_MODE" != "update" ]]; then
|
|
1208
|
-
run_setup
|
|
1209
|
-
fi
|
|
1210
|
-
|
|
1211
|
-
print_success
|
|
1212
582
|
}
|
|
1213
583
|
|
|
1214
584
|
main "$@"
|