alvin-bot 4.23.0 → 4.23.1
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/CHANGELOG.md +21 -0
- package/install.sh +53 -72
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,27 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to Alvin Bot are documented here.
|
|
4
4
|
|
|
5
|
+
## [4.23.1] — 2026-05-12
|
|
6
|
+
|
|
7
|
+
### Fixed: install.sh now installs via npm (no more git clone collision)
|
|
8
|
+
|
|
9
|
+
The `install.sh` one-line installer was broken on two counts, both pre-existing and surfaced when end-to-end testing the 4.23.0 install path on a fresh machine:
|
|
10
|
+
|
|
11
|
+
1. **Data-dir collision with `~/.alvin-bot/`.** The installer cloned the alvin-bot source into `~/.alvin-bot/`, but that path is the per-user **data directory** in 4.x (env, memory, logs, cron-jobs.json), created and owned by the bot itself. On any second run, `git pull` in the data dir failed (`fatal: not a git repository`).
|
|
12
|
+
|
|
13
|
+
2. **`npm install --omit=dev` + `npm run build` doesn't work.** TypeScript needs `@types/better-sqlite3` (a `devDependency`), so building from source with prod-only deps fails with 6 `TS7016` errors.
|
|
14
|
+
|
|
15
|
+
Both bugs only mattered on the `install.sh` path; the canonical `npm install -g alvin-bot` was unaffected.
|
|
16
|
+
|
|
17
|
+
**Fix:** `install.sh` now does exactly what the README's Quick Start documents — bootstraps Node (the new code from 4.23.0) and then `npm install -g alvin-bot`. Dropped: `git clone`, `npm run build`, the symlink dance into `/usr/local/bin`, and the `INSTALL_DIR`/`REPO_URL`/`BIN_LINK` machinery. The canonical install lives at `/opt/homebrew/lib/node_modules/alvin-bot/` (Apple Silicon) or `/usr/local/lib/node_modules/alvin-bot/` (Intel/Linux); `~/.alvin-bot/` is reserved exclusively for the bot's own data files.
|
|
18
|
+
|
|
19
|
+
The new flow also:
|
|
20
|
+
- Retries with `sudo` if a non-sudo `npm install -g` fails with EACCES (common on Linux where node lives in `/usr/lib`).
|
|
21
|
+
- Skips the auto-launch of `alvin-bot setup` in non-interactive shells (i.e. raw `curl … | bash`) so we don't dump an interactive wizard into a pipe.
|
|
22
|
+
- Adds a `BASH_SOURCE` guard so the file can be `source`d for unit-testing helpers without firing `main`.
|
|
23
|
+
|
|
24
|
+
End-to-end verified on a fresh Apple Silicon Mac (macOS 26.4.1) with node and brew uninstalled: `curl … | bash` bootstraps Node via brew prompt, installs alvin-bot via npm, lands the binary in `/opt/homebrew/bin/alvin-bot` v4.23.0 — without ever touching `~/.alvin-bot/`.
|
|
25
|
+
|
|
5
26
|
## [4.23.0] — 2026-05-12
|
|
6
27
|
|
|
7
28
|
### Installer: bootstrap Node automatically + optional capability tools
|
package/install.sh
CHANGED
|
@@ -1,7 +1,18 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# ─────────────────────────────────────────────────────────────
|
|
3
3
|
# Alvin Bot — One-Line Installer
|
|
4
|
-
# Usage: curl -fsSL https://
|
|
4
|
+
# Usage: curl -fsSL https://raw.githubusercontent.com/alvbln/Alvin-Bot/main/install.sh | bash
|
|
5
|
+
#
|
|
6
|
+
# This script bootstraps anything missing (Homebrew on macOS, Node.js)
|
|
7
|
+
# and then installs alvin-bot from npm — the same path documented in the
|
|
8
|
+
# README's Quick Start. It does NOT clone the git repo. The canonical
|
|
9
|
+
# install lives at:
|
|
10
|
+
# /opt/homebrew/lib/node_modules/alvin-bot/ (Apple Silicon)
|
|
11
|
+
# /usr/local/lib/node_modules/alvin-bot/ (Intel macOS / Linux)
|
|
12
|
+
#
|
|
13
|
+
# `~/.alvin-bot/` is the per-user data directory (env, memory, logs,
|
|
14
|
+
# cron-jobs.json) and is created/managed by the bot itself — never
|
|
15
|
+
# touched by this installer.
|
|
5
16
|
# ─────────────────────────────────────────────────────────────
|
|
6
17
|
set -euo pipefail
|
|
7
18
|
|
|
@@ -13,9 +24,6 @@ BLUE='\033[0;34m'
|
|
|
13
24
|
BOLD='\033[1m'
|
|
14
25
|
NC='\033[0m' # No Color
|
|
15
26
|
|
|
16
|
-
INSTALL_DIR="$HOME/.alvin-bot"
|
|
17
|
-
REPO_URL="https://github.com/alvbln/alvin-bot.git"
|
|
18
|
-
BIN_LINK="/usr/local/bin/alvin-bot"
|
|
19
27
|
MIN_NODE_VERSION=18
|
|
20
28
|
|
|
21
29
|
# ─── Helpers ────────────────────────────────────────────────
|
|
@@ -25,6 +33,11 @@ ok() { echo -e "${GREEN}✔${NC} $*"; }
|
|
|
25
33
|
warn() { echo -e "${YELLOW}⚠${NC} $*"; }
|
|
26
34
|
fail() { echo -e "${RED}✘${NC} $*"; exit 1; }
|
|
27
35
|
|
|
36
|
+
# Is this shell interactive enough to prompt the user?
|
|
37
|
+
is_interactive() {
|
|
38
|
+
[ -t 0 ] && [ -t 1 ]
|
|
39
|
+
}
|
|
40
|
+
|
|
28
41
|
# ─── OS Detection ──────────────────────────────────────────
|
|
29
42
|
|
|
30
43
|
detect_os() {
|
|
@@ -42,22 +55,7 @@ detect_os() {
|
|
|
42
55
|
ok "Detected OS: ${BOLD}$OS${NC}"
|
|
43
56
|
}
|
|
44
57
|
|
|
45
|
-
# ───
|
|
46
|
-
|
|
47
|
-
check_git() {
|
|
48
|
-
if ! command -v git &>/dev/null; then
|
|
49
|
-
fail "Git is not installed. Please install git first:
|
|
50
|
-
macOS: xcode-select --install
|
|
51
|
-
Linux: sudo apt install git (or yum/pacman equivalent)
|
|
52
|
-
WSL: sudo apt install git"
|
|
53
|
-
fi
|
|
54
|
-
ok "Git found: $(git --version)"
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
# Is this shell interactive enough to prompt the user?
|
|
58
|
-
is_interactive() {
|
|
59
|
-
[ -t 0 ] && [ -t 1 ]
|
|
60
|
-
}
|
|
58
|
+
# ─── Prereqs ────────────────────────────────────────────────
|
|
61
59
|
|
|
62
60
|
# Ensure Homebrew is available on macOS. Offers to auto-install via the
|
|
63
61
|
# official curl|bash sequence. A no-op on non-macOS systems.
|
|
@@ -95,8 +93,7 @@ ensure_brew() {
|
|
|
95
93
|
}
|
|
96
94
|
|
|
97
95
|
# Ensure Node.js >= MIN_NODE_VERSION. Offers to install via brew (macOS) or
|
|
98
|
-
# NodeSource (Debian/Ubuntu) if missing or too old.
|
|
99
|
-
# manual-install message on unsupported platforms.
|
|
96
|
+
# NodeSource (Debian/Ubuntu) if missing or too old.
|
|
100
97
|
ensure_node() {
|
|
101
98
|
if command -v node &>/dev/null; then
|
|
102
99
|
local node_ver
|
|
@@ -169,50 +166,28 @@ check_npm() {
|
|
|
169
166
|
# ─── Installation ──────────────────────────────────────────
|
|
170
167
|
|
|
171
168
|
install_bot() {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
169
|
+
info "Installing alvin-bot from the npm registry..."
|
|
170
|
+
# Try a regular global install first. If that fails with EACCES because
|
|
171
|
+
# the user's npm prefix isn't writable (common on Linux where node was
|
|
172
|
+
# installed via apt to /usr/lib), retry with sudo if available.
|
|
173
|
+
if npm install -g alvin-bot 2>&1; then
|
|
174
|
+
:
|
|
175
|
+
elif command -v sudo &>/dev/null; then
|
|
176
|
+
warn "npm install failed without sudo — retrying with sudo (you may be prompted)..."
|
|
177
|
+
sudo npm install -g alvin-bot || fail "npm install -g alvin-bot failed even with sudo."
|
|
177
178
|
else
|
|
178
|
-
|
|
179
|
-
git clone --depth 1 "$REPO_URL" "$INSTALL_DIR" || fail "Git clone failed. Check your network."
|
|
180
|
-
cd "$INSTALL_DIR"
|
|
179
|
+
fail "npm install -g alvin-bot failed. Re-run with sudo, or fix your npm prefix permissions."
|
|
181
180
|
fi
|
|
182
181
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
}
|
|
191
|
-
|
|
192
|
-
create_symlink() {
|
|
193
|
-
local bin_dir
|
|
194
|
-
bin_dir=$(dirname "$BIN_LINK")
|
|
195
|
-
|
|
196
|
-
# Make CLI executable
|
|
197
|
-
chmod +x "$INSTALL_DIR/bin/cli.js"
|
|
198
|
-
|
|
199
|
-
# Try /usr/local/bin first, fall back to ~/.local/bin
|
|
200
|
-
if [ -w "$bin_dir" ] || [ -w "$BIN_LINK" ] 2>/dev/null; then
|
|
201
|
-
ln -sf "$INSTALL_DIR/bin/cli.js" "$BIN_LINK"
|
|
202
|
-
ok "Symlinked: alvin-bot → $BIN_LINK"
|
|
203
|
-
elif command -v sudo &>/dev/null; then
|
|
204
|
-
info "Creating symlink (requires sudo)..."
|
|
205
|
-
sudo ln -sf "$INSTALL_DIR/bin/cli.js" "$BIN_LINK"
|
|
206
|
-
ok "Symlinked: alvin-bot → $BIN_LINK"
|
|
207
|
-
else
|
|
208
|
-
# Fallback: ~/.local/bin
|
|
209
|
-
local fallback="$HOME/.local/bin"
|
|
210
|
-
mkdir -p "$fallback"
|
|
211
|
-
ln -sf "$INSTALL_DIR/bin/cli.js" "$fallback/alvin-bot"
|
|
212
|
-
warn "Symlinked to $fallback/alvin-bot (add to PATH if not already)"
|
|
213
|
-
warn " export PATH=\"$fallback:\$PATH\""
|
|
214
|
-
BIN_LINK="$fallback/alvin-bot"
|
|
182
|
+
# Verify the binary is reachable. On Apple Silicon with Homebrew, the
|
|
183
|
+
# global bin is /opt/homebrew/bin — we already PATH-loaded brew above
|
|
184
|
+
# via ensure_brew, so this should just work.
|
|
185
|
+
if ! command -v alvin-bot &>/dev/null; then
|
|
186
|
+
warn "alvin-bot installed, but not on PATH yet. Run 'npm prefix -g' to find the bin dir,"
|
|
187
|
+
warn "and add it to your shell PATH. Then re-open this terminal."
|
|
188
|
+
return 0
|
|
215
189
|
fi
|
|
190
|
+
ok "alvin-bot installed: $(alvin-bot version 2>/dev/null | head -1)"
|
|
216
191
|
}
|
|
217
192
|
|
|
218
193
|
# ─── Main ──────────────────────────────────────────────────
|
|
@@ -224,13 +199,11 @@ main() {
|
|
|
224
199
|
echo ""
|
|
225
200
|
|
|
226
201
|
detect_os
|
|
227
|
-
check_git
|
|
228
202
|
ensure_node
|
|
229
203
|
check_npm
|
|
230
204
|
|
|
231
205
|
echo ""
|
|
232
206
|
install_bot
|
|
233
|
-
create_symlink
|
|
234
207
|
|
|
235
208
|
echo ""
|
|
236
209
|
echo -e "─────────────────────────────────────"
|
|
@@ -241,14 +214,22 @@ main() {
|
|
|
241
214
|
echo -e " ${BOLD}alvin-bot start${NC} — Start the bot"
|
|
242
215
|
echo -e " ${BOLD}alvin-bot --help${NC} — Show all commands"
|
|
243
216
|
echo ""
|
|
244
|
-
echo -e " Installed to: ${BLUE}$INSTALL_DIR${NC}"
|
|
245
|
-
echo -e " Command: ${BLUE}$BIN_LINK${NC}"
|
|
246
|
-
echo ""
|
|
247
217
|
|
|
248
|
-
# Run interactive setup
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
218
|
+
# Run interactive setup right away when we have a TTY. In piped/non-
|
|
219
|
+
# interactive mode (`curl ... | bash`) skip — the user can run setup
|
|
220
|
+
# themselves whenever they're ready.
|
|
221
|
+
if is_interactive; then
|
|
222
|
+
info "Starting setup wizard..."
|
|
223
|
+
echo ""
|
|
224
|
+
alvin-bot setup || warn "Setup skipped. Run 'alvin-bot setup' later to configure."
|
|
225
|
+
else
|
|
226
|
+
info "Non-interactive install detected — skipping the setup wizard."
|
|
227
|
+
info "Open a fresh terminal and run: alvin-bot setup"
|
|
228
|
+
fi
|
|
252
229
|
}
|
|
253
230
|
|
|
254
|
-
|
|
231
|
+
# Allow this file to be sourced (e.g. for testing helpers) without
|
|
232
|
+
# triggering main(). When executed directly, BASH_SOURCE[0] equals $0.
|
|
233
|
+
if [[ "${BASH_SOURCE[0]:-$0}" == "${0}" ]]; then
|
|
234
|
+
main "$@"
|
|
235
|
+
fi
|