machinaos 0.0.16 → 0.0.18
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/README.md +1 -1
- package/client/package.json +1 -1
- package/install.sh +44 -332
- package/package.json +1 -1
- package/scripts/build.js +15 -74
- package/scripts/install.js +12 -72
- package/server/pyproject.toml +1 -0
- package/server/requirements.txt +1 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MachinaOS
|
|
2
2
|
|
|
3
|
-
Open-source Platform to Build Your Own Personal AI Assistant, mashup of clawdbot and
|
|
3
|
+
Open-source Platform to Build Your Own Personal AI Assistant, mashup of clawdbot/Openclaw and N8N, but Better UI and Proper Visibility of each Action and Restricted Control Access.
|
|
4
4
|
|
|
5
5
|
# Full Capabilities.
|
|
6
6
|
|
package/client/package.json
CHANGED
package/install.sh
CHANGED
|
@@ -1,343 +1,55 @@
|
|
|
1
1
|
#!/usr/bin/env bash
|
|
2
2
|
# MachinaOS Installer
|
|
3
|
-
#
|
|
3
|
+
# Prerequisites: Node.js 20+, Python 3.11+
|
|
4
4
|
#
|
|
5
|
-
#
|
|
6
|
-
# - Node.js 18+ (if not installed)
|
|
7
|
-
# - Python 3.11+ (if not installed)
|
|
8
|
-
# - uv (Python package manager)
|
|
9
|
-
# - Go 1.21+ (for WhatsApp service)
|
|
5
|
+
# Usage: curl -fsSL https://raw.githubusercontent.com/trohitg/MachinaOS/main/install.sh | bash
|
|
10
6
|
|
|
11
7
|
set -e
|
|
12
8
|
|
|
13
|
-
|
|
14
|
-
RED='\033[0;31m'
|
|
15
|
-
GREEN='\033[0;32m'
|
|
16
|
-
YELLOW='\033[1;33m'
|
|
17
|
-
BLUE='\033[0;34m'
|
|
18
|
-
CYAN='\033[0;36m'
|
|
19
|
-
NC='\033[0m' # No Color
|
|
20
|
-
|
|
21
|
-
# Configuration
|
|
22
|
-
REPO_URL="https://github.com/trohitg/MachinaOS.git"
|
|
23
|
-
INSTALL_DIR="${MACHINAOS_HOME:-$HOME/.machinaos}"
|
|
24
|
-
MIN_NODE_VERSION=18
|
|
25
|
-
MIN_PYTHON_VERSION="3.11"
|
|
26
|
-
MIN_GO_VERSION="1.21"
|
|
27
|
-
|
|
28
|
-
# Logging functions
|
|
29
|
-
info() { echo -e "${BLUE}[INFO]${NC} $1"; }
|
|
30
|
-
success() { echo -e "${GREEN}[OK]${NC} $1"; }
|
|
31
|
-
warn() { echo -e "${YELLOW}[WARN]${NC} $1"; }
|
|
32
|
-
error() { echo -e "${RED}[ERROR]${NC} $1"; exit 1; }
|
|
33
|
-
|
|
34
|
-
# Banner
|
|
35
|
-
echo -e "${CYAN}"
|
|
36
|
-
echo " __ __ _ _ ___ ____ "
|
|
37
|
-
echo " | \/ | __ _ ___| |__ (_)_ __ __ _/ _ \/ ___| "
|
|
38
|
-
echo " | |\/| |/ _\` |/ __| '_ \| | '_ \ / _\` | | | \___ \\ "
|
|
39
|
-
echo " | | | | (_| | (__| | | | | | | | (_| | |_| |___) |"
|
|
40
|
-
echo " |_| |_|\__,_|\___|_| |_|_|_| |_|\__,_|\___/|____/ "
|
|
41
|
-
echo -e "${NC}"
|
|
42
|
-
echo "Open-source workflow automation with AI agents"
|
|
9
|
+
echo "Installing MachinaOS..."
|
|
43
10
|
echo ""
|
|
44
11
|
|
|
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
|
-
# Dependency Checks and Installation
|
|
81
|
-
# =============================================================================
|
|
82
|
-
|
|
83
|
-
check_node() {
|
|
84
|
-
if has_cmd node; then
|
|
85
|
-
NODE_VERSION=$(node --version | sed 's/v//')
|
|
86
|
-
NODE_MAJOR=$(echo "$NODE_VERSION" | cut -d. -f1)
|
|
87
|
-
if [ "$NODE_MAJOR" -ge "$MIN_NODE_VERSION" ]; then
|
|
88
|
-
success "Node.js v$NODE_VERSION"
|
|
89
|
-
return 0
|
|
90
|
-
else
|
|
91
|
-
warn "Node.js v$NODE_VERSION is too old (need v$MIN_NODE_VERSION+)"
|
|
92
|
-
fi
|
|
93
|
-
fi
|
|
94
|
-
return 1
|
|
95
|
-
}
|
|
96
|
-
|
|
97
|
-
install_node() {
|
|
98
|
-
info "Installing Node.js..."
|
|
99
|
-
|
|
100
|
-
if [ "$OS" = "macos" ]; then
|
|
101
|
-
if has_cmd brew; then
|
|
102
|
-
brew install node@20
|
|
103
|
-
else
|
|
104
|
-
error "Please install Homebrew first: https://brew.sh/"
|
|
105
|
-
fi
|
|
106
|
-
elif [ "$OS" = "linux" ]; then
|
|
107
|
-
# Use NodeSource for latest Node.js
|
|
108
|
-
if has_cmd curl; then
|
|
109
|
-
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
|
|
110
|
-
sudo apt-get install -y nodejs
|
|
111
|
-
else
|
|
112
|
-
error "curl is required. Install with: sudo apt install curl"
|
|
113
|
-
fi
|
|
114
|
-
fi
|
|
115
|
-
|
|
116
|
-
check_node || error "Failed to install Node.js"
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
check_python() {
|
|
120
|
-
local py_cmd=""
|
|
121
|
-
|
|
122
|
-
# Try python3 first, then python
|
|
123
|
-
for cmd in python3 python; do
|
|
124
|
-
if has_cmd "$cmd"; then
|
|
125
|
-
PY_VERSION=$($cmd --version 2>&1 | grep -oE '[0-9]+\.[0-9]+')
|
|
126
|
-
if version_gte "$PY_VERSION" "$MIN_PYTHON_VERSION"; then
|
|
127
|
-
success "Python $PY_VERSION ($cmd)"
|
|
128
|
-
PYTHON_CMD="$cmd"
|
|
129
|
-
return 0
|
|
130
|
-
fi
|
|
131
|
-
fi
|
|
132
|
-
done
|
|
133
|
-
|
|
134
|
-
warn "Python $MIN_PYTHON_VERSION+ not found"
|
|
135
|
-
return 1
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
install_python() {
|
|
139
|
-
info "Installing Python..."
|
|
140
|
-
|
|
141
|
-
if [ "$OS" = "macos" ]; then
|
|
142
|
-
if has_cmd brew; then
|
|
143
|
-
brew install python@3.12
|
|
144
|
-
else
|
|
145
|
-
error "Please install Homebrew first: https://brew.sh/"
|
|
146
|
-
fi
|
|
147
|
-
elif [ "$OS" = "linux" ]; then
|
|
148
|
-
if has_cmd apt; then
|
|
149
|
-
sudo apt update
|
|
150
|
-
sudo apt install -y python3.12 python3.12-venv python3-pip
|
|
151
|
-
elif has_cmd dnf; then
|
|
152
|
-
sudo dnf install -y python3.12
|
|
153
|
-
elif has_cmd pacman; then
|
|
154
|
-
sudo pacman -S --noconfirm python
|
|
155
|
-
else
|
|
156
|
-
error "Please install Python manually from https://python.org/"
|
|
157
|
-
fi
|
|
158
|
-
fi
|
|
159
|
-
|
|
160
|
-
check_python || error "Failed to install Python"
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
check_uv() {
|
|
164
|
-
if has_cmd uv; then
|
|
165
|
-
UV_VERSION=$(uv --version | grep -oE '[0-9]+\.[0-9]+\.[0-9]+')
|
|
166
|
-
success "uv $UV_VERSION"
|
|
167
|
-
return 0
|
|
168
|
-
fi
|
|
169
|
-
return 1
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
install_uv() {
|
|
173
|
-
info "Installing uv (Python package manager)..."
|
|
174
|
-
curl -LsSf https://astral.sh/uv/install.sh | sh
|
|
175
|
-
|
|
176
|
-
# Add to PATH for current session
|
|
177
|
-
export PATH="$HOME/.local/bin:$PATH"
|
|
178
|
-
|
|
179
|
-
check_uv || error "Failed to install uv"
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
check_go() {
|
|
183
|
-
if has_cmd go; then
|
|
184
|
-
GO_VERSION=$(go version | grep -oE 'go[0-9]+\.[0-9]+' | sed 's/go//')
|
|
185
|
-
if version_gte "$GO_VERSION" "$MIN_GO_VERSION"; then
|
|
186
|
-
success "Go $GO_VERSION"
|
|
187
|
-
return 0
|
|
188
|
-
else
|
|
189
|
-
warn "Go $GO_VERSION is too old (need $MIN_GO_VERSION+)"
|
|
190
|
-
fi
|
|
191
|
-
fi
|
|
192
|
-
return 1
|
|
193
|
-
}
|
|
12
|
+
# Check Node.js
|
|
13
|
+
if ! command -v node &> /dev/null; then
|
|
14
|
+
echo "Error: Node.js 20+ is required"
|
|
15
|
+
echo " Install from: https://nodejs.org/"
|
|
16
|
+
exit 1
|
|
17
|
+
fi
|
|
18
|
+
echo " Node.js: $(node --version)"
|
|
19
|
+
|
|
20
|
+
# Check Python
|
|
21
|
+
if command -v python3 &> /dev/null; then
|
|
22
|
+
PY=python3
|
|
23
|
+
elif command -v python &> /dev/null; then
|
|
24
|
+
PY=python
|
|
25
|
+
else
|
|
26
|
+
echo "Error: Python 3.11+ is required"
|
|
27
|
+
echo " Install from: https://python.org/"
|
|
28
|
+
exit 1
|
|
29
|
+
fi
|
|
30
|
+
echo " Python: $($PY --version)"
|
|
31
|
+
|
|
32
|
+
# Ensure pip is available (use ensurepip if missing)
|
|
33
|
+
if ! $PY -m pip --version &> /dev/null; then
|
|
34
|
+
echo " Installing pip..."
|
|
35
|
+
$PY -m ensurepip --upgrade
|
|
36
|
+
fi
|
|
37
|
+
|
|
38
|
+
# Install uv via pip if not found
|
|
39
|
+
if ! command -v uv &> /dev/null; then
|
|
40
|
+
echo " Installing uv..."
|
|
41
|
+
$PY -m pip install uv
|
|
42
|
+
fi
|
|
43
|
+
echo " uv: $(uv --version)"
|
|
194
44
|
|
|
195
|
-
|
|
196
|
-
info "Installing Go..."
|
|
197
|
-
|
|
198
|
-
if [ "$OS" = "macos" ]; then
|
|
199
|
-
if has_cmd brew; then
|
|
200
|
-
brew install go
|
|
201
|
-
else
|
|
202
|
-
error "Please install Homebrew first: https://brew.sh/"
|
|
203
|
-
fi
|
|
204
|
-
elif [ "$OS" = "linux" ]; then
|
|
205
|
-
if has_cmd apt; then
|
|
206
|
-
sudo apt update
|
|
207
|
-
sudo apt install -y golang-go
|
|
208
|
-
elif has_cmd dnf; then
|
|
209
|
-
sudo dnf install -y golang
|
|
210
|
-
elif has_cmd pacman; then
|
|
211
|
-
sudo pacman -S --noconfirm go
|
|
212
|
-
else
|
|
213
|
-
# Manual install
|
|
214
|
-
GO_TAR="go1.21.13.linux-${ARCH}.tar.gz"
|
|
215
|
-
curl -LO "https://go.dev/dl/$GO_TAR"
|
|
216
|
-
sudo rm -rf /usr/local/go
|
|
217
|
-
sudo tar -C /usr/local -xzf "$GO_TAR"
|
|
218
|
-
rm "$GO_TAR"
|
|
219
|
-
export PATH="$PATH:/usr/local/go/bin"
|
|
220
|
-
fi
|
|
221
|
-
fi
|
|
222
|
-
|
|
223
|
-
check_go || error "Failed to install Go"
|
|
224
|
-
}
|
|
225
|
-
|
|
226
|
-
check_git() {
|
|
227
|
-
if has_cmd git; then
|
|
228
|
-
GIT_VERSION=$(git --version | grep -oE '[0-9]+\.[0-9]+')
|
|
229
|
-
success "Git $GIT_VERSION"
|
|
230
|
-
return 0
|
|
231
|
-
fi
|
|
232
|
-
return 1
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
install_git() {
|
|
236
|
-
info "Installing Git..."
|
|
237
|
-
|
|
238
|
-
if [ "$OS" = "macos" ]; then
|
|
239
|
-
xcode-select --install 2>/dev/null || true
|
|
240
|
-
elif [ "$OS" = "linux" ]; then
|
|
241
|
-
if has_cmd apt; then
|
|
242
|
-
sudo apt update && sudo apt install -y git
|
|
243
|
-
elif has_cmd dnf; then
|
|
244
|
-
sudo dnf install -y git
|
|
245
|
-
elif has_cmd pacman; then
|
|
246
|
-
sudo pacman -S --noconfirm git
|
|
247
|
-
fi
|
|
248
|
-
fi
|
|
249
|
-
|
|
250
|
-
check_git || error "Failed to install Git"
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
# =============================================================================
|
|
254
|
-
# MachinaOS Installation
|
|
255
|
-
# =============================================================================
|
|
256
|
-
|
|
257
|
-
install_machinaos() {
|
|
258
|
-
echo ""
|
|
259
|
-
info "Installing MachinaOS to $INSTALL_DIR..."
|
|
260
|
-
|
|
261
|
-
# Create install directory
|
|
262
|
-
mkdir -p "$INSTALL_DIR"
|
|
263
|
-
|
|
264
|
-
# Clone or update repository
|
|
265
|
-
if [ -d "$INSTALL_DIR/.git" ]; then
|
|
266
|
-
info "Updating existing installation..."
|
|
267
|
-
cd "$INSTALL_DIR"
|
|
268
|
-
git pull origin main
|
|
269
|
-
else
|
|
270
|
-
info "Cloning repository..."
|
|
271
|
-
git clone "$REPO_URL" "$INSTALL_DIR"
|
|
272
|
-
cd "$INSTALL_DIR"
|
|
273
|
-
fi
|
|
274
|
-
|
|
275
|
-
# Run build
|
|
276
|
-
info "Building MachinaOS..."
|
|
277
|
-
npm run build
|
|
278
|
-
|
|
279
|
-
# Create symlink for global command
|
|
280
|
-
info "Creating global command..."
|
|
281
|
-
|
|
282
|
-
SYMLINK_DIR="$HOME/.local/bin"
|
|
283
|
-
mkdir -p "$SYMLINK_DIR"
|
|
284
|
-
|
|
285
|
-
# Remove old symlink if exists
|
|
286
|
-
rm -f "$SYMLINK_DIR/machinaos"
|
|
287
|
-
|
|
288
|
-
# Create new symlink
|
|
289
|
-
ln -s "$INSTALL_DIR/bin/cli.js" "$SYMLINK_DIR/machinaos"
|
|
290
|
-
chmod +x "$INSTALL_DIR/bin/cli.js"
|
|
291
|
-
|
|
292
|
-
# Check if PATH includes ~/.local/bin
|
|
293
|
-
if [[ ":$PATH:" != *":$SYMLINK_DIR:"* ]]; then
|
|
294
|
-
warn "Add $SYMLINK_DIR to your PATH:"
|
|
295
|
-
echo ""
|
|
296
|
-
echo " # Add to ~/.bashrc or ~/.zshrc:"
|
|
297
|
-
echo " export PATH=\"\$HOME/.local/bin:\$PATH\""
|
|
298
|
-
echo ""
|
|
299
|
-
fi
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
# =============================================================================
|
|
303
|
-
# Main Installation Flow
|
|
304
|
-
# =============================================================================
|
|
305
|
-
|
|
306
|
-
main() {
|
|
307
|
-
detect_os
|
|
308
|
-
|
|
309
|
-
echo ""
|
|
310
|
-
info "Checking dependencies..."
|
|
311
|
-
echo ""
|
|
312
|
-
|
|
313
|
-
# Check and install dependencies
|
|
314
|
-
check_git || install_git
|
|
315
|
-
check_node || install_node
|
|
316
|
-
check_python || install_python
|
|
317
|
-
check_uv || install_uv
|
|
318
|
-
check_go || install_go
|
|
319
|
-
|
|
320
|
-
# Install MachinaOS
|
|
321
|
-
install_machinaos
|
|
45
|
+
echo ""
|
|
322
46
|
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
echo -e "${GREEN} MachinaOS installed successfully!${NC}"
|
|
326
|
-
echo -e "${GREEN}============================================${NC}"
|
|
327
|
-
echo ""
|
|
328
|
-
echo " Start MachinaOS:"
|
|
329
|
-
echo " cd $INSTALL_DIR && npm run start"
|
|
330
|
-
echo ""
|
|
331
|
-
echo " Or use the global command (after adding to PATH):"
|
|
332
|
-
echo " machinaos start"
|
|
333
|
-
echo ""
|
|
334
|
-
echo " Open in browser:"
|
|
335
|
-
echo " http://localhost:3000"
|
|
336
|
-
echo ""
|
|
337
|
-
echo " Documentation:"
|
|
338
|
-
echo " https://github.com/trohitg/MachinaOS"
|
|
339
|
-
echo ""
|
|
340
|
-
}
|
|
47
|
+
# Install machinaos from npm (includes whatsapp-rpc)
|
|
48
|
+
npm install -g machinaos
|
|
341
49
|
|
|
342
|
-
|
|
343
|
-
|
|
50
|
+
echo ""
|
|
51
|
+
echo "MachinaOS installed successfully!"
|
|
52
|
+
echo ""
|
|
53
|
+
echo " Start: machinaos start"
|
|
54
|
+
echo " Open: http://localhost:3000"
|
|
55
|
+
echo ""
|
package/package.json
CHANGED
package/scripts/build.js
CHANGED
|
@@ -16,10 +16,6 @@ import { fileURLToPath } from 'url';
|
|
|
16
16
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
17
17
|
const ROOT = resolve(__dirname, '..');
|
|
18
18
|
|
|
19
|
-
// Platform detection
|
|
20
|
-
const isWindows = process.platform === 'win32';
|
|
21
|
-
const isMac = process.platform === 'darwin';
|
|
22
|
-
|
|
23
19
|
// Environment detection
|
|
24
20
|
// - postinstall: npm already installed root deps, skip to avoid infinite loop
|
|
25
21
|
// - CI: GitHub Actions handles build separately, skip postinstall entirely
|
|
@@ -61,70 +57,23 @@ function npmInstall(cwd = ROOT) {
|
|
|
61
57
|
}
|
|
62
58
|
|
|
63
59
|
// ============================================================================
|
|
64
|
-
//
|
|
60
|
+
// Install dependencies via pip
|
|
65
61
|
// ============================================================================
|
|
66
62
|
|
|
67
|
-
function
|
|
68
|
-
|
|
69
|
-
if (
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
} else if (runSilent('choco --version')) {
|
|
73
|
-
run('choco install python312 -y');
|
|
74
|
-
} else {
|
|
75
|
-
console.log(' Error: Please install Python manually from https://python.org/');
|
|
76
|
-
console.log(' Or install winget/chocolatey first.');
|
|
77
|
-
process.exit(1);
|
|
78
|
-
}
|
|
79
|
-
} else if (isMac) {
|
|
80
|
-
if (runSilent('brew --version')) {
|
|
81
|
-
run('brew install python@3.12');
|
|
82
|
-
} else {
|
|
83
|
-
console.log(' Error: Please install Homebrew first: https://brew.sh/');
|
|
84
|
-
process.exit(1);
|
|
85
|
-
}
|
|
86
|
-
} else {
|
|
87
|
-
// Linux package managers
|
|
88
|
-
if (runSilent('apk --version')) {
|
|
89
|
-
// Alpine Linux
|
|
90
|
-
run('apk add --no-cache python3 py3-pip');
|
|
91
|
-
} else if (runSilent('apt --version')) {
|
|
92
|
-
run('sudo apt update && sudo apt install -y python3.12 python3.12-venv');
|
|
93
|
-
} else if (runSilent('dnf --version')) {
|
|
94
|
-
run('sudo dnf install -y python3.12');
|
|
95
|
-
} else if (runSilent('pacman --version')) {
|
|
96
|
-
run('sudo pacman -S --noconfirm python');
|
|
97
|
-
} else {
|
|
98
|
-
console.log(' Error: Please install Python manually from https://python.org/');
|
|
99
|
-
process.exit(1);
|
|
100
|
-
}
|
|
63
|
+
function ensurePip(pythonCmd) {
|
|
64
|
+
// Check if pip exists, install via ensurepip if missing
|
|
65
|
+
if (!runSilent(`${pythonCmd} -m pip --version`)) {
|
|
66
|
+
console.log(' Installing pip via ensurepip...');
|
|
67
|
+
run(`${pythonCmd} -m ensurepip --upgrade`);
|
|
101
68
|
}
|
|
102
69
|
}
|
|
103
70
|
|
|
104
71
|
function installUv(pythonCmd) {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
run(`${pythonCmd} -m pip install uv`);
|
|
109
|
-
} else if (isMac) {
|
|
110
|
-
// macOS: use pip (no PEP 668 issues with Homebrew Python)
|
|
111
|
-
run(`${pythonCmd} -m pip install uv`);
|
|
112
|
-
} else if (runSilent('apk --version')) {
|
|
113
|
-
// Alpine: use pip with --break-system-packages
|
|
114
|
-
run(`${pythonCmd} -m pip install uv --break-system-packages`);
|
|
115
|
-
} else {
|
|
116
|
-
// Other Linux: try pip first, fall back to curl installer
|
|
117
|
-
if (runSilent(`${pythonCmd} -m pip install uv --break-system-packages`)) {
|
|
118
|
-
// pip worked
|
|
119
|
-
} else {
|
|
120
|
-
run('curl -LsSf https://astral.sh/uv/install.sh | sh');
|
|
121
|
-
process.env.PATH = `${process.env.HOME}/.local/bin:${process.env.PATH}`;
|
|
122
|
-
}
|
|
123
|
-
}
|
|
72
|
+
ensurePip(pythonCmd);
|
|
73
|
+
console.log(' Installing uv via pip...');
|
|
74
|
+
run(`${pythonCmd} -m pip install uv`);
|
|
124
75
|
}
|
|
125
76
|
|
|
126
|
-
// Go is no longer required - whatsapp-rpc is an npm package with pre-built binaries
|
|
127
|
-
|
|
128
77
|
// ============================================================================
|
|
129
78
|
// Check and Install Dependencies
|
|
130
79
|
// ============================================================================
|
|
@@ -137,7 +86,7 @@ console.log(` Node.js: ${nodeVersion}`);
|
|
|
137
86
|
const npmVersion = getVersion('npm --version');
|
|
138
87
|
console.log(` npm: ${npmVersion}`);
|
|
139
88
|
|
|
140
|
-
// Python
|
|
89
|
+
// Python (required, user must install)
|
|
141
90
|
let pyCmd = null;
|
|
142
91
|
if (runSilent('python --version')) {
|
|
143
92
|
pyCmd = 'python';
|
|
@@ -154,13 +103,14 @@ if (pyCmd) {
|
|
|
154
103
|
console.log(` ${pyVersion}`);
|
|
155
104
|
} else {
|
|
156
105
|
console.log(` ${pyVersion} (too old, need 3.11+)`);
|
|
157
|
-
|
|
106
|
+
console.log(' Error: Please install Python 3.11+ from https://python.org/');
|
|
107
|
+
process.exit(1);
|
|
158
108
|
}
|
|
159
109
|
}
|
|
160
110
|
} else {
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
111
|
+
console.log(' Error: Python 3.11+ is required.');
|
|
112
|
+
console.log(' Install from: https://python.org/downloads/');
|
|
113
|
+
process.exit(1);
|
|
164
114
|
}
|
|
165
115
|
|
|
166
116
|
// uv
|
|
@@ -179,15 +129,6 @@ if (uvVersion) {
|
|
|
179
129
|
}
|
|
180
130
|
}
|
|
181
131
|
|
|
182
|
-
// Go is optional (whatsapp-rpc uses pre-built binaries)
|
|
183
|
-
const goVersionFull = getVersion('go version');
|
|
184
|
-
if (goVersionFull) {
|
|
185
|
-
const goVersion = goVersionFull.match(/go\d+\.\d+(\.\d+)?/)?.[0] || 'go';
|
|
186
|
-
console.log(` Go: ${goVersion} (optional)`);
|
|
187
|
-
} else {
|
|
188
|
-
console.log(' Go: not installed (optional - whatsapp-rpc uses pre-built binaries)');
|
|
189
|
-
}
|
|
190
|
-
|
|
191
132
|
console.log('\nAll dependencies ready.\n');
|
|
192
133
|
|
|
193
134
|
// ============================================================================
|
package/scripts/install.js
CHANGED
|
@@ -20,9 +20,6 @@ process.env.MACHINAOS_INSTALLING = 'true';
|
|
|
20
20
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
21
21
|
const ROOT = resolve(__dirname, '..');
|
|
22
22
|
|
|
23
|
-
const isWindows = process.platform === 'win32';
|
|
24
|
-
const isMac = process.platform === 'darwin';
|
|
25
|
-
|
|
26
23
|
process.env.PYTHONUTF8 = '1';
|
|
27
24
|
|
|
28
25
|
function run(cmd, cwd = ROOT, timeoutMs = 300000) {
|
|
@@ -72,62 +69,18 @@ function checkUv() {
|
|
|
72
69
|
return getVersion('uv --version');
|
|
73
70
|
}
|
|
74
71
|
|
|
75
|
-
function
|
|
76
|
-
|
|
77
|
-
if (
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (runSilent('choco --version')) {
|
|
81
|
-
run('choco install python312 -y');
|
|
82
|
-
} else if (runSilent('winget --version')) {
|
|
83
|
-
run('winget install Python.Python.3.12 --accept-package-agreements --accept-source-agreements --disable-interactivity');
|
|
84
|
-
} else {
|
|
85
|
-
console.log('ERROR: Cannot auto-install Python. Please install manually:');
|
|
86
|
-
console.log(' https://python.org/downloads/');
|
|
87
|
-
process.exit(1);
|
|
88
|
-
}
|
|
89
|
-
} else if (isMac) {
|
|
90
|
-
if (runSilent('brew --version')) {
|
|
91
|
-
run('brew install python@3.12');
|
|
92
|
-
} else {
|
|
93
|
-
console.log('ERROR: Homebrew not found. Install it first:');
|
|
94
|
-
console.log(' /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"');
|
|
95
|
-
process.exit(1);
|
|
96
|
-
}
|
|
97
|
-
} else {
|
|
98
|
-
// Linux - try package managers
|
|
99
|
-
if (runSilent('apt-get --version')) {
|
|
100
|
-
run('apt-get update && apt-get install -y python3 python3-venv python3-pip curl');
|
|
101
|
-
} else if (runSilent('dnf --version')) {
|
|
102
|
-
run('dnf install -y python3 python3-pip');
|
|
103
|
-
} else if (runSilent('pacman --version')) {
|
|
104
|
-
run('pacman -S --noconfirm python python-pip');
|
|
105
|
-
} else if (runSilent('apk --version')) {
|
|
106
|
-
run('apk add --no-cache python3 py3-pip');
|
|
107
|
-
} else {
|
|
108
|
-
console.log('ERROR: Cannot auto-install Python. Please install manually:');
|
|
109
|
-
console.log(' https://python.org/downloads/');
|
|
110
|
-
process.exit(1);
|
|
111
|
-
}
|
|
72
|
+
function ensurePip(pythonCmd) {
|
|
73
|
+
// Check if pip exists, install via ensurepip if missing
|
|
74
|
+
if (!runSilent(`${pythonCmd} -m pip --version`)) {
|
|
75
|
+
console.log('Installing pip via ensurepip...');
|
|
76
|
+
run(`${pythonCmd} -m ensurepip --upgrade`);
|
|
112
77
|
}
|
|
113
78
|
}
|
|
114
79
|
|
|
115
80
|
function installUv(pythonCmd) {
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
run(`${pythonCmd} -m pip install uv`);
|
|
120
|
-
} else if (isMac) {
|
|
121
|
-
// Use pip on macOS (no PEP 668 issues with Homebrew Python)
|
|
122
|
-
run(`${pythonCmd} -m pip install uv`);
|
|
123
|
-
} else if (runSilent('apk --version')) {
|
|
124
|
-
// Alpine: use pip (apk doesn't have uv package)
|
|
125
|
-
run(`${pythonCmd} -m pip install uv --break-system-packages`);
|
|
126
|
-
} else {
|
|
127
|
-
// Linux: use official installer (avoids PEP 668 externally-managed-environment)
|
|
128
|
-
run('curl -LsSf https://astral.sh/uv/install.sh | sh');
|
|
129
|
-
process.env.PATH = `${process.env.HOME}/.local/bin:${process.env.PATH}`;
|
|
130
|
-
}
|
|
81
|
+
ensurePip(pythonCmd);
|
|
82
|
+
console.log('Installing uv via pip...');
|
|
83
|
+
run(`${pythonCmd} -m pip install uv`);
|
|
131
84
|
}
|
|
132
85
|
|
|
133
86
|
// ============================================================================
|
|
@@ -140,19 +93,14 @@ console.log('');
|
|
|
140
93
|
console.log(` Node.js: ${getVersion('node --version')}`);
|
|
141
94
|
console.log(` npm: ${getVersion('npm --version')}`);
|
|
142
95
|
|
|
143
|
-
// Check
|
|
96
|
+
// Check Python (required, user must install)
|
|
144
97
|
let python = checkPython();
|
|
145
98
|
if (python) {
|
|
146
99
|
console.log(` Python: ${python.version}`);
|
|
147
100
|
} else {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
console.log(` Python: ${python.version}`);
|
|
152
|
-
} else {
|
|
153
|
-
console.log('ERROR: Python installation failed');
|
|
154
|
-
process.exit(1);
|
|
155
|
-
}
|
|
101
|
+
console.log('ERROR: Python 3.11+ is required.');
|
|
102
|
+
console.log(' Install from: https://python.org/downloads/');
|
|
103
|
+
process.exit(1);
|
|
156
104
|
}
|
|
157
105
|
|
|
158
106
|
// Check/Install uv
|
|
@@ -170,14 +118,6 @@ if (uvVersion) {
|
|
|
170
118
|
}
|
|
171
119
|
}
|
|
172
120
|
|
|
173
|
-
// Go is optional (whatsapp-rpc uses pre-built binaries via npm)
|
|
174
|
-
const goVersion = getVersion('go version');
|
|
175
|
-
if (goVersion) {
|
|
176
|
-
console.log(` Go: ${goVersion.match(/go\d+\.\d+(\.\d+)?/)?.[0] || 'installed'} (optional)`);
|
|
177
|
-
} else {
|
|
178
|
-
console.log(' Go: not installed (optional - whatsapp-rpc uses pre-built binaries)');
|
|
179
|
-
}
|
|
180
|
-
|
|
181
121
|
console.log('');
|
|
182
122
|
console.log('Installing...');
|
|
183
123
|
console.log('');
|
package/server/pyproject.toml
CHANGED