param( [switch]$FrontendOnly, [switch]$BackendOnly, [switch]$AdminOnly, [switch]$McpOnly, [switch]$WithMcp, [string]$DatabaseUrl = "postgres://postgres:postgres%402025%21@10.0.0.2:5432/termi-api_development" ) $ErrorActionPreference = "Stop" $repoRoot = Split-Path -Parent $MyInvocation.MyCommand.Path $frontendScript = Join-Path $repoRoot "start-frontend.ps1" $backendScript = Join-Path $repoRoot "start-backend.ps1" $adminScript = Join-Path $repoRoot "start-admin.ps1" $mcpScript = Join-Path $repoRoot "start-mcp.ps1" if (@($FrontendOnly, $BackendOnly, $AdminOnly, $McpOnly).Where({ $_ }).Count -gt 1) { throw "Use only one of -FrontendOnly, -BackendOnly, -AdminOnly, or -McpOnly." } if ($FrontendOnly) { & $frontendScript exit $LASTEXITCODE } if ($BackendOnly) { & $backendScript -DatabaseUrl $DatabaseUrl exit $LASTEXITCODE } if ($AdminOnly) { & $adminScript exit $LASTEXITCODE } if ($McpOnly) { & $mcpScript exit $LASTEXITCODE } $services = if ($WithMcp) { "frontend, admin, backend, and MCP" } else { "frontend, admin, and backend" } Write-Host "[monorepo] Starting $services in separate PowerShell windows..." -ForegroundColor Cyan Start-Process powershell -ArgumentList @( "-NoExit", "-ExecutionPolicy", "Bypass", "-File", $frontendScript ) Start-Process powershell -ArgumentList @( "-NoExit", "-ExecutionPolicy", "Bypass", "-File", $backendScript, "-DatabaseUrl", $DatabaseUrl ) Start-Process powershell -ArgumentList @( "-NoExit", "-ExecutionPolicy", "Bypass", "-File", $adminScript ) if ($WithMcp) { Start-Process powershell -ArgumentList @( "-NoExit", "-ExecutionPolicy", "Bypass", "-File", $mcpScript ) } $servicesStarted = if ($WithMcp) { "Frontend, admin, backend, and MCP windows started." } else { "Frontend, admin, and backend windows started." } Write-Host "[monorepo] $servicesStarted" -ForegroundColor Green