Skip to content

Self-improving AI Employees for everyone

Modify Scripts

trohitge1c3e4e7f0c1
diff --git a/README.md b/README.md
index 997c2789..32788164 100644
--- a/README.md
+++ b/README.md
@@ -7,16 +7,10 @@ Visual workflow automation platform. Build workflows by connecting nodes - like
**Prerequisites:** Node.js 18+, Python 3.10+
```bash
-# 1. Clone and install
git clone https://github.com/user/MachinaOs.git
cd MachinaOs
npm run build
-
-# 2. Setup config
-cp server/.env.template server/.env
-
-# 3. Run
-npm run dev
+npm run start
```
Open http://localhost:3000 and register your account.
@@ -41,9 +35,9 @@ Open http://localhost:3000 and register your account.
| Command | Description |
|---------|-------------|
-| `npm run dev` | Start development server |
-| `npm run build` | Install all dependencies |
+| `npm run start` | Start all services |
| `npm run stop` | Stop all services |
+| `npm run build` | Install all dependencies |
## Project Structure
diff --git a/package.json b/package.json
index d896444c..43ba8671 100644
--- a/package.json
+++ b/package.json
@@ -15,7 +15,7 @@
"whatsapp:status": "cd server/whatsapp-rpc && npm run status",
"whatsapp:api": "cd server/whatsapp-rpc && npm run api",
"whatsapp:build": "cd server/whatsapp-rpc && npm run build",
- "build": "npm install && cd client && npm install && npm run build && cd ../server && python -m pip install -r requirements.txt && cd whatsapp-rpc && npm install",
+ "build": "node -e \"const fs=require('fs'),p='server/.env';if(!fs.existsSync(p))fs.copyFileSync('server/.env.template',p)\" && npm install && cd client && npm install && npm run build && cd ../server && python -m pip install -r requirements.txt && cd whatsapp-rpc && npm install",
"clean": "node scripts/clean.js",
"start": "node scripts/start.js",
"stop": "node scripts/stop.js",
diff --git a/scripts/clean.js b/scripts/clean.js
index f722675f..30f62384 100644
--- a/scripts/clean.js
+++ b/scripts/clean.js
@@ -13,6 +13,10 @@ const dirsToRemove = [
'.eslintcache'
];
+const filesToRemove = [
+ 'server/.env'
+];
+
const filePatternsToRemove = [
'.db',
'.sqlite',
@@ -52,7 +56,7 @@ async function clean() {
const rootTargets = findCleanTargets('.');
const allDirs = [...dirsToRemove, ...serverTargets.dirs];
- const allFiles = [...serverTargets.files, ...rootTargets.files.filter(f => !f.includes('node_modules'))];
+ const allFiles = [...filesToRemove, ...serverTargets.files, ...rootTargets.files.filter(f => !f.includes('node_modules'))];
console.log('Cleaning build artifacts...');
diff --git a/scripts/start.js b/scripts/start.js
index d581b631..708f6a04 100644
--- a/scripts/start.js
+++ b/scripts/start.js
@@ -2,7 +2,7 @@
import { execSync, spawn } from 'child_process';
import { fileURLToPath } from 'url';
import { dirname, resolve } from 'path';
-import { readFileSync, existsSync } from 'fs';
+import { readFileSync, existsSync, copyFileSync } from 'fs';
const __dirname = dirname(fileURLToPath(import.meta.url));
const ROOT = resolve(__dirname, '..');
@@ -64,13 +64,21 @@ process.env.PYTHONUTF8 = '1';
console.log('\n=== MachinaOS Starting ===\n');
-// Step 1: Free ports
+// Step 1: Create .env if not exists
+const envPath = resolve(ROOT, 'server', '.env');
+const templatePath = resolve(ROOT, 'server', '.env.template');
+if (!existsSync(envPath) && existsSync(templatePath)) {
+ copyFileSync(templatePath, envPath);
+ log('Created server/.env from template');
+}
+
+// Step 2: Free ports
log('Freeing ports...');
for (const port of PORTS) {
killPort(port);
}
log('Ports ready');
-// Step 2: Start dev server
+// Step 3: Start dev server
log('Starting services...');
spawn('npm', ['run', 'dev'], { cwd: ROOT, stdio: 'inherit', shell: true });