-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·128 lines (101 loc) · 3.11 KB
/
install.sh
File metadata and controls
executable file
·128 lines (101 loc) · 3.11 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
#!/bin/sh
set -e
# Kindling installer
# Usage: curl -fsSL https://raw.githubusercontent.com/eddacraft/kindling/main/install.sh | sh
PACKAGE="@eddacraft/kindling-cli"
MIN_NODE_MAJOR=20
# --- helpers ---
info() { printf '\033[1;34m==>\033[0m %s\n' "$1"; }
warn() { printf '\033[1;33mwarning:\033[0m %s\n' "$1"; }
error() { printf '\033[1;31merror:\033[0m %s\n' "$1" >&2; exit 1; }
command_exists() { command -v "$1" >/dev/null 2>&1; }
# --- checks ---
check_node() {
if ! command_exists node; then
error "Node.js is not installed. Install Node.js >= ${MIN_NODE_MAJOR} from https://nodejs.org or use a version manager (fnm, nvm, mise)"
fi
local version major
version=$(node --version)
major=$(printf '%s' "$version" | sed 's/^v//' | cut -d. -f1)
if [ "$major" -lt "$MIN_NODE_MAJOR" ] 2>/dev/null; then
error "Node.js ${version} is too old. Kindling requires Node.js >= ${MIN_NODE_MAJOR}. Update via https://nodejs.org or your version manager"
fi
info "Found Node.js ${version}"
}
detect_package_manager() {
if command_exists pnpm; then
printf 'pnpm'
elif command_exists yarn; then
printf 'yarn'
elif command_exists bun; then
printf 'bun'
elif command_exists npm; then
printf 'npm'
else
error "No package manager found. Install one of: pnpm, yarn, bun, npm"
fi
}
# --- install ---
install_kindling() {
local pm="$1"
info "Installing ${PACKAGE} with ${pm}..."
case "$pm" in
pnpm) pnpm add -g "$PACKAGE" ;;
yarn) yarn global add "$PACKAGE" ;;
bun) bun add -g "$PACKAGE" ;;
npm) npm install -g "$PACKAGE" ;;
*) error "Unknown package manager: ${pm}" ;;
esac
if ! command_exists kindling; then
warn "kindling command not found in PATH after install"
warn "You may need to configure your shell for global packages from ${pm}"
fi
}
# --- setup ---
setup_claude_code() {
if ! command_exists kindling; then
warn "Skipping setup: kindling not found in PATH"
return
fi
printf '\n'
printf ' Configure Claude Code integration?\n'
printf ' This adds Kindling hooks to your Claude Code config.\n'
printf '\n'
printf ' Enable Claude Code integration? [y/N] '
local answer
read answer </dev/tty || answer="n"
case "$answer" in
[yY]|[yY][eE][sS])
info "Running kindling init --claude-code..."
kindling init --claude-code
;;
*)
info "Running kindling init..."
kindling init
;;
esac
}
# --- main ---
main() {
printf '\n'
printf ' \360\237\224\245 Kindling Installer\n'
printf ' Local memory for AI-assisted development\n'
printf '\n'
check_node
local pm
pm=$(detect_package_manager)
info "Using package manager: ${pm}"
install_kindling "$pm"
setup_claude_code
printf '\n'
printf ' \342\234\223 Kindling installed successfully!\n'
printf '\n'
printf ' Get started:\n'
printf ' kindling status Show database status\n'
printf ' kindling log "note" Capture an observation\n'
printf ' kindling search "query" Search your memory\n'
printf '\n'
printf ' Documentation: https://docs.eddacraft.ai/kindling/overview\n'
printf '\n'
}
main