Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 37 additions & 25 deletions start.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
Expand All @@ -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 {
Expand All @@ -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
Expand All @@ -56,36 +56,48 @@ 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") {
Comment on lines +61 to +62

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remediation recommended

2. Valid node installs misdetected 🐞 Bug ≡ Correctness

Node detection now accepts only /usr/bin/node, so a valid Linux-native installation under a
user-managed prefix is treated as missing and triggers an unnecessary privileged system
installation. The repository's own TrueForge launcher explicitly supports $HOME/.local/node/bin,
which this check fails to recognize.
Agent Prompt
## Issue description
The WSL Node check hard-codes `/usr/bin/node` and misclassifies supported user-local Linux Node installations.

## Issue Context
Use a login shell or explicitly include repository-supported user-local prefixes, then validate that the resolved executable is Linux-native rather than requiring one fixed path.

## Fix Focus Areas
- start.ps1[61-62]
- scripts/wsl/start-trueforge.sh[24-26]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

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
Comment on lines +61 to +67

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The WSL discovery and installation commands do not validate their exit status. If Ubuntu is unavailable or curl, sudo, or apt fails, $wslLinuxNode may not contain missing, causing the script to print that Node.js was installed or already available and continue to TrueForge setup. Check $LASTEXITCODE after every native wsl invocation and stop with an actionable error when setup fails. [possible bug]

Severity Level: Major ⚠️
- ❌ Clean WSL setup can continue without Node.js.
- ❌ TrueForge launch fails after a misleading success message.
- ⚠️ Users receive no actionable WSL installation error.

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** start.ps1
**Line:** 61:67
**Comment:**
	*Possible Bug: The WSL discovery and installation commands do not validate their exit status. If Ubuntu is unavailable or curl, sudo, or apt fails, `$wslLinuxNode` may not contain `missing`, causing the script to print that Node.js was installed or already available and continue to TrueForge setup. Check `$LASTEXITCODE` after every native `wsl` invocation and stop with an actionable error when setup fails.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +64 to +67

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

1. Install failures report success 🐞 Bug ☼ Reliability

The Node setup runs download, repository setup, and apt installation as independent native commands
without checking any exit code, then unconditionally reports success. A failed download/setup
therefore still runs apt-get install nodejs against the existing Ubuntu repositories and can leave
no Node or the wrong major version while the one-click flow proceeds.
Agent Prompt
## Issue description
The Node installation stages do not short-circuit or validate native exit codes, so failed setup can be reported as a successful Node.js 20 installation.

## Issue Context
Windows PowerShell does not make a native process's nonzero exit status terminating merely because `$ErrorActionPreference` is `Stop`. Keep the setup atomic and verify the resulting Node version before continuing.

## Fix Focus Areas
- start.ps1[64-67]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

} 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
Comment on lines +77 to +78

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: npm install -g is executed as the normal WSL user after installing the apt-provided Node.js, whose global npm prefix is normally root-owned. On a clean Ubuntu installation this commonly fails with a permissions error, but the script still prints that TrueForge was installed and proceeds to launch it. Install into a user-writable prefix, invoke npm with the required privileges, or verify the command succeeds before reporting success. [possible bug]

Severity Level: Major ⚠️
- ❌ First-run TrueForge installation can fail.
- ❌ The advertised TrueForge UI may never start.
- ⚠️ Users receive a false installation-success message.

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** start.ps1
**Line:** 77:78
**Comment:**
	*Possible Bug: `npm install -g` is executed as the normal WSL user after installing the apt-provided Node.js, whose global npm prefix is normally root-owned. On a clean Ubuntu installation this commonly fails with a permissions error, but the script still prints that TrueForge was installed and proceeds to launch it. Install into a user-writable prefix, invoke npm with the required privileges, or verify the command succeeds before reporting success.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

} 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'"

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: The launch bypasses scripts/wsl/start-trueforge.sh, which loads the repository .env, validates OPENAI_API_KEY, adds the supported user-local Node path, binds TrueForge to 0.0.0.0, and explicitly selects port 3000. Running npx from ~ without those settings can start a differently configured or loopback-only server, making it unreachable from the dashboard or lacking the required credentials. [api mismatch]

Severity Level: Major ⚠️
- ❌ Dashboard agent chat may fail to reach TrueForge.
- ❌ Webhook incident sessions may fail authentication.
- ⚠️ Repository `.env` configuration is ignored.

Use CodeAnt Skill Fix in Cursor Fix in VSCode Claude

Prompt for AI Agent 🤖
This is a comment left during a code review.

**Path:** start.ps1
**Line:** 85:85
**Comment:**
	*Api Mismatch: The launch bypasses `scripts/wsl/start-trueforge.sh`, which loads the repository `.env`, validates `OPENAI_API_KEY`, adds the supported user-local Node path, binds TrueForge to `0.0.0.0`, and explicitly selects port 3000. Running `npx` from `~` without those settings can start a differently configured or loopback-only server, making it unreachable from the dashboard or lacking the required credentials.

Validate the correctness of the flagged issue. If correct, How can I resolve this? If you propose a fix, implement it and please make it concise.
Once fix is implemented, also check other comments on the same PR, and ask user if the user wants to fix the rest of the comments as well. if said yes, then fetch all the comments validate the correctness and implement a minimal fix
👍 | 👎

Comment on lines +83 to +85

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Action required

3. Global install ignored at launch 🐞 Bug ≡ Correctness

After installing TrueForge globally, the script launches npx @truefoundry/trueforge from ~
without -y; because the package is not a local project dependency, npx can prompt to fetch another
copy before starting. The supposedly automatic install therefore still requires terminal
confirmation and may run the npx cache copy rather than the globally installed executable that was
just verified.
Agent Prompt
## Issue description
The launch command does not use the globally installed `trueforge` executable and can cause npx to prompt for another installation.

## Issue Context
Launch the detected global binary directly, or intentionally use `npx -y` and remove the redundant global-install/detection flow. Preserve the required PATH and port configuration.

## Fix Focus Areas
- start.ps1[74-85]

ⓘ Copy this prompt and use it to remediate the issue with your preferred AI generation tools

Write-Host " TrueForge terminal opened" -ForegroundColor Green

# Done
Write-Host ""
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
Expand Down