Repository navigation
Expand file tree
/
Copy pathlaunch.ps1
More file actions
54 lines (44 loc) · 2.65 KB
/
Copy pathlaunch.ps1
File metadata and controls
54 lines (44 loc) · 2.65 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
Write-Host "================================================" -ForegroundColor Cyan
Write-Host " PulseLab Pentesting Suite - Orchestrator " -ForegroundColor White
Write-Host "================================================" -ForegroundColor Cyan
Write-Host "[Mode: Full Interactive Suite]" -ForegroundColor Gray
Write-Host ""
# 1. Setup Environment and Paths
# Use the automatic $PSScriptRoot (set by PowerShell when running .ps1 files).
# Fallback to Split-Path only when $PSScriptRoot is empty (e.g., interactive shell).
if (-not $PSScriptRoot) {
$PSScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition
}
Set-Location $PSScriptRoot
Write-Host "[*] Checking environment..." -ForegroundColor Gray
# Local development orchestrator runs in the isolated lab profile.
# Production/webapp service runs should omit this override and use webapp_legal.
$env:PULSELAB_SCM_MODE = "lab_free"
Write-Host "[*] SCM mode: lab_free (isolated development lab)" -ForegroundColor Cyan
# Activate Virtual Environment if exists
if (Test-Path ".venv\Scripts\Activate.ps1") {
Write-Host "[*] Activating virtual environment (.venv)..." -ForegroundColor Cyan
& .venv\Scripts\Activate.ps1
}
if (-not (Get-Command python -ErrorAction SilentlyContinue)) {
Write-Host "[!] Error: Python not found. Please ensure your venv is active or Python is in PATH." -ForegroundColor Red
exit
}
# 2. Start the API Bridge in the background (new window)
# NOTE: Start-Process launches a NEW PowerShell process that does NOT inherit the
# venv activation from the parent. We must re-activate inside each child command.
$VenvActivate = "$PSScriptRoot\.venv\Scripts\Activate.ps1"
Write-Host "[*] Starting API Bridge on port 8321..." -ForegroundColor Yellow
$BridgeCmd = "Set-Location '$PSScriptRoot'; `$env:PULSELAB_SERVICE_CONTEXT='bridge'; if (Test-Path '$VenvActivate') { & '$VenvActivate' }; python bridge/main.py"
Start-Process powershell -ArgumentList "-NoExit", "-Command", "`$host.ui.RawUI.WindowTitle='PulseLab Bridge'; $BridgeCmd" -WindowStyle Normal
# 3. Wait for Bridge to initialize
Write-Host "[*] Waiting for services to warm up..." -ForegroundColor Gray
Start-Sleep -s 5
# 4. Launch the React Vite Webapp in the background
Write-Host "[*] Starting React UI (Vite) on port 5173..." -ForegroundColor Yellow
$UICmd = "Set-Location '$PSScriptRoot\ui'; npm run dev"
Start-Process powershell -ArgumentList "-NoExit", "-Command", "`$host.ui.RawUI.WindowTitle='PulseLab UI'; $UICmd" -WindowStyle Normal
# 5. Launch the Interactive Console
Write-Host "[*] Launching MCP Interactive Console..." -ForegroundColor Green
python mcp_console.py
Write-Host "`n[!] Session ended." -ForegroundColor Yellow