machinaos 0.0.6 → 0.0.7
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 +21 -3
- package/install.ps1 +308 -0
- package/install.sh +343 -0
- package/package.json +6 -3
- package/scripts/build.js +23 -8
- package/server/whatsapp-rpc/bin/whatsapp-rpc-server +0 -0
package/README.md
CHANGED
|
@@ -4,7 +4,21 @@ Open-source workflow automation platform with AI agents, React Flow, and n8n-ins
|
|
|
4
4
|
|
|
5
5
|
## Quick Start
|
|
6
6
|
|
|
7
|
-
### Option 1:
|
|
7
|
+
### Option 1: One-Line Install (Recommended)
|
|
8
|
+
|
|
9
|
+
**Linux/macOS:**
|
|
10
|
+
```bash
|
|
11
|
+
curl -fsSL https://raw.githubusercontent.com/trohitg/MachinaOS/main/install.sh | bash
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
**Windows (PowerShell):**
|
|
15
|
+
```powershell
|
|
16
|
+
iwr -useb https://raw.githubusercontent.com/trohitg/MachinaOS/main/install.ps1 | iex
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
This automatically installs all dependencies (Node.js, Python, uv, Go) and MachinaOS.
|
|
20
|
+
|
|
21
|
+
### Option 2: Clone & Run
|
|
8
22
|
|
|
9
23
|
```bash
|
|
10
24
|
git clone https://github.com/trohitg/MachinaOS.git
|
|
@@ -13,14 +27,16 @@ npm run build
|
|
|
13
27
|
npm run start
|
|
14
28
|
```
|
|
15
29
|
|
|
16
|
-
### Option
|
|
30
|
+
### Option 3: npm Global Install
|
|
17
31
|
|
|
18
32
|
```bash
|
|
19
33
|
npm install -g machinaos
|
|
20
34
|
machinaos start
|
|
21
35
|
```
|
|
22
36
|
|
|
23
|
-
|
|
37
|
+
Requires Node.js 18+, Python 3.11+, uv, and Go 1.21+ to be pre-installed.
|
|
38
|
+
|
|
39
|
+
### Option 4: Docker
|
|
24
40
|
|
|
25
41
|
```bash
|
|
26
42
|
git clone https://github.com/trohitg/MachinaOS.git
|
|
@@ -32,6 +48,8 @@ Open http://localhost:3000
|
|
|
32
48
|
|
|
33
49
|
## Prerequisites
|
|
34
50
|
|
|
51
|
+
The install script handles these automatically, but for manual installation:
|
|
52
|
+
|
|
35
53
|
- **Node.js 18+** - https://nodejs.org/
|
|
36
54
|
- **Python 3.11+** - https://python.org/
|
|
37
55
|
- **uv** - `curl -LsSf https://astral.sh/uv/install.sh | sh`
|
package/install.ps1
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
# MachinaOS Installer for Windows
|
|
2
|
+
# Usage: iwr -useb https://raw.githubusercontent.com/trohitg/MachinaOS/main/install.ps1 | iex
|
|
3
|
+
#
|
|
4
|
+
# This script installs MachinaOS and its dependencies:
|
|
5
|
+
# - Node.js 18+ (via winget/choco)
|
|
6
|
+
# - Python 3.11+ (via winget/choco)
|
|
7
|
+
# - uv (Python package manager)
|
|
8
|
+
# - Go 1.21+ (for WhatsApp service)
|
|
9
|
+
|
|
10
|
+
$ErrorActionPreference = "Stop"
|
|
11
|
+
|
|
12
|
+
# Configuration
|
|
13
|
+
$REPO_URL = "https://github.com/trohitg/MachinaOS.git"
|
|
14
|
+
$INSTALL_DIR = if ($env:MACHINAOS_HOME) { $env:MACHINAOS_HOME } else { "$env:USERPROFILE\.machinaos" }
|
|
15
|
+
$MIN_NODE_VERSION = 18
|
|
16
|
+
$MIN_PYTHON_VERSION = "3.11"
|
|
17
|
+
$MIN_GO_VERSION = "1.21"
|
|
18
|
+
|
|
19
|
+
# Colors
|
|
20
|
+
function Write-Color {
|
|
21
|
+
param([string]$Text, [string]$Color = "White")
|
|
22
|
+
Write-Host $Text -ForegroundColor $Color
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
function Info { Write-Color "[INFO] $args" "Cyan" }
|
|
26
|
+
function Success { Write-Color "[OK] $args" "Green" }
|
|
27
|
+
function Warn { Write-Color "[WARN] $args" "Yellow" }
|
|
28
|
+
function Error-Exit { Write-Color "[ERROR] $args" "Red"; exit 1 }
|
|
29
|
+
|
|
30
|
+
# Banner
|
|
31
|
+
Write-Host ""
|
|
32
|
+
Write-Color " __ __ _ _ ___ ____ " "Cyan"
|
|
33
|
+
Write-Color " | \/ | __ _ ___| |__ (_)_ __ __ _/ _ \/ ___| " "Cyan"
|
|
34
|
+
Write-Color " | |\/| |/ _`` |/ __| '_ \| | '_ \ / _`` | | | \___ \ " "Cyan"
|
|
35
|
+
Write-Color " | | | | (_| | (__| | | | | | | | (_| | |_| |___) |" "Cyan"
|
|
36
|
+
Write-Color " |_| |_|\__,_|\___|_| |_|_|_| |_|\__,_|\___/|____/ " "Cyan"
|
|
37
|
+
Write-Host ""
|
|
38
|
+
Write-Host "Open-source workflow automation with AI agents"
|
|
39
|
+
Write-Host ""
|
|
40
|
+
|
|
41
|
+
# Check if command exists
|
|
42
|
+
function Has-Command {
|
|
43
|
+
param([string]$Command)
|
|
44
|
+
$null -ne (Get-Command $Command -ErrorAction SilentlyContinue)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
# Get package manager
|
|
48
|
+
function Get-PackageManager {
|
|
49
|
+
if (Has-Command "winget") { return "winget" }
|
|
50
|
+
if (Has-Command "choco") { return "choco" }
|
|
51
|
+
return $null
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
# =============================================================================
|
|
55
|
+
# Dependency Checks and Installation
|
|
56
|
+
# =============================================================================
|
|
57
|
+
|
|
58
|
+
function Check-Node {
|
|
59
|
+
if (Has-Command "node") {
|
|
60
|
+
$version = (node --version) -replace "v", ""
|
|
61
|
+
$major = [int]($version.Split(".")[0])
|
|
62
|
+
if ($major -ge $MIN_NODE_VERSION) {
|
|
63
|
+
Success "Node.js v$version"
|
|
64
|
+
return $true
|
|
65
|
+
}
|
|
66
|
+
Warn "Node.js v$version is too old (need v$MIN_NODE_VERSION+)"
|
|
67
|
+
}
|
|
68
|
+
return $false
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function Install-Node {
|
|
72
|
+
Info "Installing Node.js..."
|
|
73
|
+
$pm = Get-PackageManager
|
|
74
|
+
|
|
75
|
+
switch ($pm) {
|
|
76
|
+
"winget" {
|
|
77
|
+
winget install OpenJS.NodeJS.LTS --accept-package-agreements --accept-source-agreements
|
|
78
|
+
}
|
|
79
|
+
"choco" {
|
|
80
|
+
choco install nodejs-lts -y
|
|
81
|
+
}
|
|
82
|
+
default {
|
|
83
|
+
Error-Exit "Please install winget or chocolatey, or install Node.js manually from https://nodejs.org/"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
# Refresh PATH
|
|
88
|
+
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
|
89
|
+
|
|
90
|
+
if (-not (Check-Node)) {
|
|
91
|
+
Error-Exit "Failed to install Node.js. Please install manually and restart PowerShell."
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function Check-Python {
|
|
96
|
+
foreach ($cmd in @("python", "python3")) {
|
|
97
|
+
if (Has-Command $cmd) {
|
|
98
|
+
$version = & $cmd --version 2>&1 | Select-String -Pattern "\d+\.\d+" | ForEach-Object { $_.Matches.Value }
|
|
99
|
+
if ($version -ge $MIN_PYTHON_VERSION) {
|
|
100
|
+
Success "Python $version ($cmd)"
|
|
101
|
+
$script:PYTHON_CMD = $cmd
|
|
102
|
+
return $true
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
Warn "Python $MIN_PYTHON_VERSION+ not found"
|
|
107
|
+
return $false
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
function Install-Python {
|
|
111
|
+
Info "Installing Python..."
|
|
112
|
+
$pm = Get-PackageManager
|
|
113
|
+
|
|
114
|
+
switch ($pm) {
|
|
115
|
+
"winget" {
|
|
116
|
+
winget install Python.Python.3.12 --accept-package-agreements --accept-source-agreements
|
|
117
|
+
}
|
|
118
|
+
"choco" {
|
|
119
|
+
choco install python312 -y
|
|
120
|
+
}
|
|
121
|
+
default {
|
|
122
|
+
Error-Exit "Please install winget or chocolatey, or install Python manually from https://python.org/"
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
# Refresh PATH
|
|
127
|
+
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
|
128
|
+
|
|
129
|
+
if (-not (Check-Python)) {
|
|
130
|
+
Error-Exit "Failed to install Python. Please install manually and restart PowerShell."
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
function Check-Uv {
|
|
135
|
+
if (Has-Command "uv") {
|
|
136
|
+
$version = (uv --version) -replace "uv ", ""
|
|
137
|
+
Success "uv $version"
|
|
138
|
+
return $true
|
|
139
|
+
}
|
|
140
|
+
return $false
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function Install-Uv {
|
|
144
|
+
Info "Installing uv (Python package manager)..."
|
|
145
|
+
Invoke-RestMethod https://astral.sh/uv/install.ps1 | Invoke-Expression
|
|
146
|
+
|
|
147
|
+
# Add to PATH for current session
|
|
148
|
+
$env:Path = "$env:USERPROFILE\.local\bin;$env:Path"
|
|
149
|
+
|
|
150
|
+
if (-not (Check-Uv)) {
|
|
151
|
+
Error-Exit "Failed to install uv"
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
function Check-Go {
|
|
156
|
+
if (Has-Command "go") {
|
|
157
|
+
$versionOutput = go version
|
|
158
|
+
if ($versionOutput -match "go(\d+\.\d+)") {
|
|
159
|
+
$version = $Matches[1]
|
|
160
|
+
if ($version -ge $MIN_GO_VERSION) {
|
|
161
|
+
Success "Go $version"
|
|
162
|
+
return $true
|
|
163
|
+
}
|
|
164
|
+
Warn "Go $version is too old (need $MIN_GO_VERSION+)"
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
return $false
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
function Install-Go {
|
|
171
|
+
Info "Installing Go..."
|
|
172
|
+
$pm = Get-PackageManager
|
|
173
|
+
|
|
174
|
+
switch ($pm) {
|
|
175
|
+
"winget" {
|
|
176
|
+
winget install GoLang.Go --accept-package-agreements --accept-source-agreements
|
|
177
|
+
}
|
|
178
|
+
"choco" {
|
|
179
|
+
choco install golang -y
|
|
180
|
+
}
|
|
181
|
+
default {
|
|
182
|
+
Error-Exit "Please install winget or chocolatey, or install Go manually from https://go.dev/dl/"
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
# Refresh PATH
|
|
187
|
+
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
|
188
|
+
|
|
189
|
+
if (-not (Check-Go)) {
|
|
190
|
+
Error-Exit "Failed to install Go. Please install manually and restart PowerShell."
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
function Check-Git {
|
|
195
|
+
if (Has-Command "git") {
|
|
196
|
+
$version = (git --version) -replace "git version ", ""
|
|
197
|
+
Success "Git $version"
|
|
198
|
+
return $true
|
|
199
|
+
}
|
|
200
|
+
return $false
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
function Install-Git {
|
|
204
|
+
Info "Installing Git..."
|
|
205
|
+
$pm = Get-PackageManager
|
|
206
|
+
|
|
207
|
+
switch ($pm) {
|
|
208
|
+
"winget" {
|
|
209
|
+
winget install Git.Git --accept-package-agreements --accept-source-agreements
|
|
210
|
+
}
|
|
211
|
+
"choco" {
|
|
212
|
+
choco install git -y
|
|
213
|
+
}
|
|
214
|
+
default {
|
|
215
|
+
Error-Exit "Please install winget or chocolatey, or install Git manually from https://git-scm.com/"
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
# Refresh PATH
|
|
220
|
+
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User")
|
|
221
|
+
|
|
222
|
+
if (-not (Check-Git)) {
|
|
223
|
+
Error-Exit "Failed to install Git. Please install manually and restart PowerShell."
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
# =============================================================================
|
|
228
|
+
# MachinaOS Installation
|
|
229
|
+
# =============================================================================
|
|
230
|
+
|
|
231
|
+
function Install-MachinaOS {
|
|
232
|
+
Write-Host ""
|
|
233
|
+
Info "Installing MachinaOS to $INSTALL_DIR..."
|
|
234
|
+
|
|
235
|
+
# Create install directory
|
|
236
|
+
if (-not (Test-Path $INSTALL_DIR)) {
|
|
237
|
+
New-Item -ItemType Directory -Path $INSTALL_DIR -Force | Out-Null
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
# Clone or update repository
|
|
241
|
+
if (Test-Path "$INSTALL_DIR\.git") {
|
|
242
|
+
Info "Updating existing installation..."
|
|
243
|
+
Push-Location $INSTALL_DIR
|
|
244
|
+
git pull origin main
|
|
245
|
+
} else {
|
|
246
|
+
Info "Cloning repository..."
|
|
247
|
+
git clone $REPO_URL $INSTALL_DIR
|
|
248
|
+
Push-Location $INSTALL_DIR
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
# Run build
|
|
252
|
+
Info "Building MachinaOS..."
|
|
253
|
+
npm run build
|
|
254
|
+
|
|
255
|
+
Pop-Location
|
|
256
|
+
|
|
257
|
+
# Add to PATH suggestion
|
|
258
|
+
$binPath = "$INSTALL_DIR\bin"
|
|
259
|
+
if ($env:Path -notlike "*$binPath*") {
|
|
260
|
+
Warn "Add MachinaOS to your PATH:"
|
|
261
|
+
Write-Host ""
|
|
262
|
+
Write-Host " # Run this command to add to PATH permanently:"
|
|
263
|
+
Write-Host " [Environment]::SetEnvironmentVariable('Path', `$env:Path + ';$binPath', 'User')"
|
|
264
|
+
Write-Host ""
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
# =============================================================================
|
|
269
|
+
# Main Installation Flow
|
|
270
|
+
# =============================================================================
|
|
271
|
+
|
|
272
|
+
function Main {
|
|
273
|
+
Write-Host ""
|
|
274
|
+
Info "Checking dependencies..."
|
|
275
|
+
Write-Host ""
|
|
276
|
+
|
|
277
|
+
# Check and install dependencies
|
|
278
|
+
if (-not (Check-Git)) { Install-Git }
|
|
279
|
+
if (-not (Check-Node)) { Install-Node }
|
|
280
|
+
if (-not (Check-Python)) { Install-Python }
|
|
281
|
+
if (-not (Check-Uv)) { Install-Uv }
|
|
282
|
+
if (-not (Check-Go)) { Install-Go }
|
|
283
|
+
|
|
284
|
+
# Install MachinaOS
|
|
285
|
+
Install-MachinaOS
|
|
286
|
+
|
|
287
|
+
Write-Host ""
|
|
288
|
+
Write-Color "============================================" "Green"
|
|
289
|
+
Write-Color " MachinaOS installed successfully!" "Green"
|
|
290
|
+
Write-Color "============================================" "Green"
|
|
291
|
+
Write-Host ""
|
|
292
|
+
Write-Host " Start MachinaOS:"
|
|
293
|
+
Write-Host " cd $INSTALL_DIR"
|
|
294
|
+
Write-Host " npm run start"
|
|
295
|
+
Write-Host ""
|
|
296
|
+
Write-Host " Or use the CLI:"
|
|
297
|
+
Write-Host " node $INSTALL_DIR\bin\cli.js start"
|
|
298
|
+
Write-Host ""
|
|
299
|
+
Write-Host " Open in browser:"
|
|
300
|
+
Write-Host " http://localhost:3000"
|
|
301
|
+
Write-Host ""
|
|
302
|
+
Write-Host " Documentation:"
|
|
303
|
+
Write-Host " https://github.com/trohitg/MachinaOS"
|
|
304
|
+
Write-Host ""
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
# Run main
|
|
308
|
+
Main
|
package/install.sh
ADDED
|
@@ -0,0 +1,343 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
# MachinaOS Installer
|
|
3
|
+
# Usage: curl -fsSL https://raw.githubusercontent.com/trohitg/MachinaOS/main/install.sh | bash
|
|
4
|
+
#
|
|
5
|
+
# This script installs MachinaOS and its dependencies:
|
|
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)
|
|
10
|
+
|
|
11
|
+
set -e
|
|
12
|
+
|
|
13
|
+
# Colors
|
|
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"
|
|
43
|
+
echo ""
|
|
44
|
+
|
|
45
|
+
# Detect OS
|
|
46
|
+
detect_os() {
|
|
47
|
+
case "$(uname -s)" in
|
|
48
|
+
Linux*) OS="linux";;
|
|
49
|
+
Darwin*) OS="macos";;
|
|
50
|
+
MINGW*|MSYS*|CYGWIN*) OS="windows";;
|
|
51
|
+
*) error "Unsupported operating system: $(uname -s)";;
|
|
52
|
+
esac
|
|
53
|
+
|
|
54
|
+
# Detect architecture
|
|
55
|
+
case "$(uname -m)" in
|
|
56
|
+
x86_64|amd64) ARCH="x64";;
|
|
57
|
+
arm64|aarch64) ARCH="arm64";;
|
|
58
|
+
*) error "Unsupported architecture: $(uname -m)";;
|
|
59
|
+
esac
|
|
60
|
+
|
|
61
|
+
info "Detected: $OS ($ARCH)"
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
# Check if command exists
|
|
65
|
+
has_cmd() {
|
|
66
|
+
command -v "$1" &> /dev/null
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
# Get version number from string
|
|
70
|
+
get_version() {
|
|
71
|
+
echo "$1" | grep -oE '[0-9]+\.[0-9]+' | head -1
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
# Compare versions (returns 0 if $1 >= $2)
|
|
75
|
+
version_gte() {
|
|
76
|
+
[ "$(printf '%s\n' "$2" "$1" | sort -V | head -n1)" = "$2" ]
|
|
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
|
+
}
|
|
194
|
+
|
|
195
|
+
install_go() {
|
|
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
|
|
322
|
+
|
|
323
|
+
echo ""
|
|
324
|
+
echo -e "${GREEN}============================================${NC}"
|
|
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
|
+
}
|
|
341
|
+
|
|
342
|
+
# Run main
|
|
343
|
+
main "$@"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "machinaos",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.7",
|
|
4
4
|
"description": "Open source workflow automation platform with AI agents, React Flow, and n8n-inspired architecture",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"keywords": [
|
|
@@ -38,7 +38,9 @@
|
|
|
38
38
|
"client/",
|
|
39
39
|
"server/",
|
|
40
40
|
".env.template",
|
|
41
|
-
"README.md"
|
|
41
|
+
"README.md",
|
|
42
|
+
"install.sh",
|
|
43
|
+
"install.ps1"
|
|
42
44
|
],
|
|
43
45
|
"workspaces": [
|
|
44
46
|
"client"
|
|
@@ -68,7 +70,8 @@
|
|
|
68
70
|
"docker:prod:logs": "docker-compose -f docker-compose.prod.yml logs -f",
|
|
69
71
|
"deploy": "bash deploy.sh",
|
|
70
72
|
"deploy:gcp": "bash deploy.sh",
|
|
71
|
-
"prepublishOnly": "node -e \"const p=require('./package.json'); if(!p.bin||!p.version){process.exit(1)}\""
|
|
73
|
+
"prepublishOnly": "node -e \"const p=require('./package.json'); if(!p.bin||!p.version){process.exit(1)}\"",
|
|
74
|
+
"postinstall": "node scripts/build.js"
|
|
72
75
|
},
|
|
73
76
|
"dependencies": {
|
|
74
77
|
"concurrently": "^9.2.1",
|
package/scripts/build.js
CHANGED
|
@@ -20,6 +20,19 @@ const ROOT = resolve(__dirname, '..');
|
|
|
20
20
|
const isWindows = process.platform === 'win32';
|
|
21
21
|
const isMac = process.platform === 'darwin';
|
|
22
22
|
|
|
23
|
+
// Environment detection
|
|
24
|
+
// - postinstall: npm already installed root deps, skip to avoid infinite loop
|
|
25
|
+
// - CI: GitHub Actions handles build separately, skip postinstall entirely
|
|
26
|
+
const isPostInstall = process.env.npm_lifecycle_event === 'postinstall';
|
|
27
|
+
const isCI = process.env.CI === 'true' || process.env.GITHUB_ACTIONS === 'true';
|
|
28
|
+
|
|
29
|
+
// Skip build entirely in CI (workflows handle this)
|
|
30
|
+
if (isCI && isPostInstall) {
|
|
31
|
+
console.log('CI environment detected, skipping postinstall build.');
|
|
32
|
+
process.exit(0);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
|
|
23
36
|
// Ensure Python UTF-8 encoding
|
|
24
37
|
process.env.PYTHONUTF8 = '1';
|
|
25
38
|
|
|
@@ -49,11 +62,9 @@ function log(step, msg) {
|
|
|
49
62
|
}
|
|
50
63
|
|
|
51
64
|
function npmInstall(cwd = ROOT) {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
execSync('npm install', { cwd, stdio: 'inherit', shell: true });
|
|
56
|
-
}
|
|
65
|
+
// Use npm install directly with visible output
|
|
66
|
+
// npm ci requires package-lock.json which may not exist in all directories
|
|
67
|
+
execSync('npm install', { cwd, stdio: 'inherit', shell: true });
|
|
57
68
|
}
|
|
58
69
|
|
|
59
70
|
// ============================================================================
|
|
@@ -231,9 +242,13 @@ try {
|
|
|
231
242
|
log('0/5', 'Created .env from template');
|
|
232
243
|
}
|
|
233
244
|
|
|
234
|
-
// Step 1: Install root dependencies
|
|
235
|
-
|
|
236
|
-
|
|
245
|
+
// Step 1: Install root dependencies (skip if postinstall - npm already did this)
|
|
246
|
+
if (!isPostInstall) {
|
|
247
|
+
log('1/6', 'Installing root dependencies...');
|
|
248
|
+
npmInstall(ROOT);
|
|
249
|
+
} else {
|
|
250
|
+
log('1/6', 'Root dependencies already installed by npm');
|
|
251
|
+
}
|
|
237
252
|
|
|
238
253
|
// Step 2: Install client dependencies
|
|
239
254
|
log('2/6', 'Installing client dependencies...');
|
|
Binary file
|