Self-hosted, Self-Improving, Federated Everything App — dev management, agent orchestration, persistent mind, digital twin, second brain, and creative pipeline from a single dashboard over Tailscale to port the user into the OS
JavaScript ai-agentsdashboarddeveloper-toolsdigital-twinquantified-selfsecond-brainself-hostedtailscale
fix: make npm run dev idempotent with clean PM2 restart
[._.]/ Adam Eivy96b00fc8da88
diff --git a/package.json b/package.jsonindex 9abf185469..1290fa894c 100644--- a/package.json+++ b/package.json@@ -7,7 +7,8 @@"license": "MIT","type": "module","scripts": {- "dev": "node ./node_modules/pm2/bin/pm2 start ecosystem.config.cjs && node ./node_modules/pm2/bin/pm2 logs",+ "dev": "node scripts/dev-start.js",+ "dev:stop": "node ./node_modules/pm2/bin/pm2 stop ecosystem.config.cjs","build": "cd client && npm run build","start": "cd server && npm start","pm2:start": "node ./node_modules/pm2/bin/pm2 start ecosystem.config.cjs",diff --git a/scripts/dev-start.js b/scripts/dev-start.jsnew file mode 100644index 0000000000..4b925248ee--- /dev/null+++ b/scripts/dev-start.js@@ -0,0 +1,26 @@+/**+ * Dev start script — cleanly (re)starts all PM2 processes.+ * Handles lingering processes, port conflicts, and fresh starts.+ */+import { execSync, spawn } from 'child_process';+import { dirname, join } from 'path';+import { fileURLToPath } from 'url';++const __dirname = dirname(fileURLToPath(import.meta.url));+const PM2 = join(__dirname, '..', 'node_modules', 'pm2', 'bin', 'pm2');+const ECO = 'ecosystem.config.cjs';++function pm2(args) {+ execSync(`node "${PM2}" ${args}`, { stdio: 'inherit' });+}++// Stop and delete existing PortOS processes (ignore errors if none exist)+try { pm2(`stop ${ECO}`); } catch {}+try { pm2(`delete ${ECO}`); } catch {}++// Brief pause for port release+await new Promise(r => setTimeout(r, 1500));++// Start fresh and tail logs+pm2(`start ${ECO}`);+spawn(process.execPath, [PM2, 'logs'], { stdio: 'inherit' });