From b13da965ab59880d223f02bcb99916c51777b3be Mon Sep 17 00:00:00 2001 From: ADITYA-tp01 Date: Sun, 30 Aug 2026 04:10:41 +0530 Subject: [PATCH] feat: one-click start handles WSL Node.js + TrueForge install --- start.ps1 | 62 +++++++++++++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 25 deletions(-) diff --git a/start.ps1 b/start.ps1 index e5c2faf..e9912b0 100644 --- a/start.ps1 +++ b/start.ps1 @@ -8,7 +8,7 @@ Write-Host "=========================================" Write-Host "" # Step 1: Check Docker -Write-Host "[1/5] Checking Docker..." -ForegroundColor Yellow +Write-Host "[1/6] Checking Docker..." -ForegroundColor Yellow try { docker info > $null 2>&1 if ($LASTEXITCODE -ne 0) { throw } @@ -24,12 +24,12 @@ try { } # Step 2: Start containers -Write-Host "[2/5] Starting containers..." -ForegroundColor Yellow +Write-Host "[2/6] Starting containers..." -ForegroundColor Yellow docker compose up -d --build 2>&1 | Out-Null Write-Host " PostgreSQL, Redis, MCP server started" -ForegroundColor Green # Step 3: Wait for health -Write-Host "[3/5] Waiting for MCP server..." -ForegroundColor Yellow +Write-Host "[3/6] Waiting for MCP server..." -ForegroundColor Yellow $retries = 0 while ($retries -lt 15) { try { @@ -46,7 +46,7 @@ if ($retries -ge 15) { } # Step 4: Start dashboard -Write-Host "[4/5] Starting dashboard..." -ForegroundColor Yellow +Write-Host "[4/6] Starting dashboard..." -ForegroundColor Yellow $dashboardDir = Join-Path $PSScriptRoot "apps\dashboard" if (-not (Test-Path "$dashboardDir\node_modules")) { Push-Location $dashboardDir @@ -56,20 +56,34 @@ if (-not (Test-Path "$dashboardDir\node_modules")) { Start-Process powershell -ArgumentList "-NoExit", "-Command", "cd '$dashboardDir'; npm run dev" Write-Host " Dashboard starting on http://localhost:3001" -ForegroundColor Green -# Step 5: Setup WSL for TrueForge -Write-Host "[5/5] Setting up TrueForge in WSL..." -ForegroundColor Yellow -$wslNode = wsl -d Ubuntu -- bash -c "which node 2>/dev/null" -if (-not $wslNode) { - Write-Host " Installing Node.js in WSL..." -ForegroundColor Yellow - wsl -d Ubuntu -- bash -c "curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash - && sudo apt-get install -y nodejs" 2>&1 | Out-Null +# Step 5: Setup WSL - install Linux-native Node.js +Write-Host "[5/6] Setting up WSL..." -ForegroundColor Yellow +$wslLinuxNode = wsl -d Ubuntu -- bash -c 'test -f /usr/bin/node && echo ok || echo missing' +if ($wslLinuxNode -match "missing") { + Write-Host " Installing Node.js 20 in WSL (first time only)..." -ForegroundColor Yellow + wsl -d Ubuntu -- bash -c 'curl -fsSL https://deb.nodesource.com/setup_20.x -o /tmp/ns.sh' + wsl -d Ubuntu -- bash -c 'sudo bash /tmp/ns.sh' + wsl -d Ubuntu -- bash -c 'sudo apt-get install -y nodejs' + Write-Host " Node.js installed in WSL" -ForegroundColor Green +} else { + Write-Host " WSL Node.js already installed" -ForegroundColor Green } -$wslTf = wsl -d Ubuntu -- bash -c "which trueforge 2>/dev/null" -if (-not $wslTf) { - Write-Host " Installing TrueForge in WSL..." -ForegroundColor Yellow - wsl -d Ubuntu -- bash -c "npm install -g @truefoundry/trueforge" 2>&1 | Out-Null + +# Step 6: Setup WSL - install TrueForge +Write-Host "[6/6] Setting up TrueForge in WSL..." -ForegroundColor Yellow +$wslTf = wsl -d Ubuntu -- bash -c 'command -v trueforge 2>/dev/null || echo missing' +if ($wslTf -match "missing") { + Write-Host " Installing TrueForge in WSL (first time only)..." -ForegroundColor Yellow + wsl -d Ubuntu -- bash -c 'export PATH=/usr/bin:/usr/local/bin:$PATH && npm install -g @truefoundry/trueforge' + Write-Host " TrueForge installed in WSL" -ForegroundColor Green +} else { + Write-Host " TrueForge already installed in WSL" -ForegroundColor Green } -Start-Process powershell -ArgumentList "-NoExit", "-Command", "wsl -d Ubuntu" -Write-Host " TrueForge terminal opened (WSL)" -ForegroundColor Green + +# Launch TrueForge in WSL +Write-Host " Launching TrueForge in WSL..." -ForegroundColor Yellow +Start-Process powershell -ArgumentList "-NoExit", "-Command", "wsl -d Ubuntu -- bash -c 'export PATH=/usr/bin:/usr/local/bin:`$PATH && cd ~ && npx @truefoundry/trueforge'" +Write-Host " TrueForge terminal opened" -ForegroundColor Green # Done Write-Host "" @@ -77,15 +91,13 @@ Write-Host "=========================================" -ForegroundColor Green Write-Host " Everything is running!" -ForegroundColor Green Write-Host "=========================================" -ForegroundColor Green Write-Host "" -Write-Host " Next steps in the WSL terminal:" -ForegroundColor Cyan -Write-Host " npx @truefoundry/trueforge" -ForegroundColor White -Write-Host "" -Write-Host " Then in TrueForge UI (http://localhost:3000):" -ForegroundColor Cyan -Write-Host " 1. Add your OpenAI API key" -ForegroundColor White -Write-Host " 2. Add MCP server -> http://localhost:8000/mcp" -ForegroundColor White -Write-Host " 3. Create agent 'missioncontrol'" -ForegroundColor White -Write-Host " 4. Use agent/system-prompt.md as system prompt" -ForegroundColor White -Write-Host " 5. Enable approval for rollback_deploy, restart_service" -ForegroundColor White +Write-Host " Next steps in the WSL TrueForge terminal:" -ForegroundColor Cyan +Write-Host " 1. Open http://localhost:3000" -ForegroundColor White +Write-Host " 2. Add your OpenAI API key" -ForegroundColor White +Write-Host " 3. Add MCP server -> http://localhost:8000/mcp" -ForegroundColor White +Write-Host " 4. Create agent 'missioncontrol'" -ForegroundColor White +Write-Host " 5. Use agent/system-prompt.md as system prompt" -ForegroundColor White +Write-Host " 6. Enable approval for rollback_deploy, restart_service" -ForegroundColor White Write-Host "" Write-Host " Dashboard: http://localhost:3001" -ForegroundColor Cyan Write-Host " MCP Server: http://localhost:8001" -ForegroundColor Cyan