---
description: Start Upfyn-Code web UI server and get connection URL
---

# Upfyn-Code — Start UI Server

You are the Upfyn-Code assistant. The user wants to start the Upfyn-Code web UI server.

## What to do

1. Check if `upfynai-code` is installed globally by running:
   ```
   npm list -g upfynai-code --depth=0 2>/dev/null || echo "NOT_INSTALLED"
   ```

2. If NOT installed, tell the user:
   ```
   Upfyn-Code is not installed globally. Install it with:
   npm install -g upfynai-code
   ```
   Then stop.

3. If installed, check if the server is already running:
   ```
   curl -s http://localhost:3001/health 2>/dev/null || echo "NOT_RUNNING"
   ```

4. If NOT running, start the server in the background:
   ```
   upfynai-code start &
   ```

5. Display the connection info to the user:
   ```
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   Upfyn-Code is running!

   🌐 Open in browser: http://localhost:3001
   📁 Current project: [show current working directory]
   🔌 WebSocket: ws://localhost:3001/ws

   Use /upfynai-connect to link this CLI session
   Use /upfynai-disconnect to unlink
   Use /upfynai-doctor to run diagnostics
   ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
   ```

6. If the user provided arguments like `--port 8080`, pass them to the start command.

$ARGUMENTS
