-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·96 lines (78 loc) · 2.76 KB
/
install.sh
File metadata and controls
executable file
·96 lines (78 loc) · 2.76 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
#!/bin/bash
# Mini-Agent Installer
# Usage: curl -fsSL https://raw.githubusercontent.com/miles990/mini-agent/main/install.sh | bash
set -e
REPO="https://github.com/miles990/mini-agent.git"
INSTALL_DIR="$HOME/.mini-agent"
MIN_NODE_VERSION=20
# Colors (disable if not terminal)
if [ -t 1 ]; then
GREEN='\033[0;32m'; RED='\033[0;31m'; DIM='\033[2m'; RESET='\033[0m'
else
GREEN=''; RED=''; DIM=''; RESET=''
fi
step() { echo -e "\n${GREEN}[$1/4]${RESET} $2"; }
fail() { echo -e "${RED}Error:${RESET} $1"; exit 1; }
echo "mini-agent installer"
echo "===================="
# --- Step 1: Check dependencies ---
step 1 "Checking dependencies..."
# Git
command -v git >/dev/null 2>&1 || fail "git is required"
# Node.js 20+
command -v node >/dev/null 2>&1 || fail "Node.js $MIN_NODE_VERSION+ is required — https://nodejs.org"
NODE_VERSION=$(node -e "console.log(process.versions.node.split('.')[0])")
[ "$NODE_VERSION" -ge "$MIN_NODE_VERSION" ] 2>/dev/null || fail "Node.js $MIN_NODE_VERSION+ required (found v$NODE_VERSION)"
# pnpm — auto-enable via corepack (built into Node 20+)
if ! command -v pnpm >/dev/null 2>&1; then
echo -e " ${DIM}pnpm not found, enabling via corepack...${RESET}"
corepack enable 2>/dev/null || npm install -g pnpm
fi
command -v pnpm >/dev/null 2>&1 || fail "Could not install pnpm"
# Claude CLI
if ! command -v claude >/dev/null 2>&1; then
echo ""
echo -e " ${RED}Claude CLI not found.${RESET}"
echo " Install it first:"
echo ""
echo " npm install -g @anthropic-ai/claude-code"
echo ""
echo " Then run this installer again."
exit 1
fi
echo -e " node v$NODE_VERSION ${DIM}✓${RESET}"
echo -e " pnpm $(pnpm --version 2>/dev/null) ${DIM}✓${RESET}"
echo -e " claude CLI ${DIM}✓${RESET}"
# --- Step 2: Clone or update ---
step 2 "Getting source code..."
if [ -d "$INSTALL_DIR/.git" ]; then
echo -e " ${DIM}Updating existing installation...${RESET}"
cd "$INSTALL_DIR" && git pull --ff-only
else
if [ -d "$INSTALL_DIR" ]; then
fail "$INSTALL_DIR exists but is not a git repo. Remove it first."
fi
git clone "$REPO" "$INSTALL_DIR"
cd "$INSTALL_DIR"
fi
# --- Step 3: Build ---
step 3 "Installing dependencies and building..."
pnpm install --frozen-lockfile 2>/dev/null || pnpm install
pnpm build
# --- Step 4: Link globally ---
step 4 "Linking mini-agent command..."
npm link 2>/dev/null || {
echo -e " ${DIM}npm link failed, trying with sudo...${RESET}"
sudo npm link
}
echo ""
echo "============================="
echo -e " ${GREEN}✓ mini-agent installed!${RESET}"
echo "============================="
echo ""
echo " mini-agent # Interactive chat"
echo " mini-agent up -d # Start in background"
echo " mini-agent status # Check status"
echo ""
echo -e " ${DIM}Installed to: $INSTALL_DIR${RESET}"
echo ""