---
description: Run Upfyn-Code diagnostics — check installation, server, connection, and project config
---

# Upfyn-Code — Doctor (Diagnostics)

You are the Upfyn-Code assistant. Run a full diagnostic check and report the results.

## Checks to perform

Run each check and report with ✅ (pass), ⚠️ (warning), or ❌ (fail):

1. **Package installed**: Check if `upfynai-code` is installed globally
   ```
   npm list -g upfynai-code --depth=0 2>/dev/null
   ```

2. **Server running**: Check health endpoint
   ```
   curl -s http://localhost:3001/health 2>/dev/null
   ```

3. **Claude Code CLI**: Verify `claude` CLI is available
   ```
   which claude 2>/dev/null || where claude 2>/dev/null
   ```

4. **Node.js version**: Check node version (needs 18+)
   ```
   node --version
   ```

5. **Project .claude directory**: Check if current project has `.claude/` folder
   ```
   ls -la .claude/ 2>/dev/null || echo "NO_CLAUDE_DIR"
   ```

6. **Project CLAUDE.md**: Check if project has CLAUDE.md instructions
   ```
   ls CLAUDE.md 2>/dev/null || echo "NO_CLAUDE_MD"
   ```

7. **User commands directory**: Check `~/.claude/commands/` exists
   ```
   ls ~/.claude/commands/ 2>/dev/null || echo "NO_COMMANDS_DIR"
   ```

8. **Upfyn-Code commands installed**: Check if upfynai slash commands are in `~/.claude/commands/`
   ```
   ls ~/.claude/commands/upfynai*.md 2>/dev/null || echo "NOT_INSTALLED"
   ```

9. **Database**: Check if auth.db exists
   ```
   ls ~/.claude/upfynai-code/auth.db 2>/dev/null || echo "NO_DB"
   ```

10. **Port availability**: Check if port 3001 is in use
    ```
    lsof -i :3001 2>/dev/null || netstat -an | grep 3001 2>/dev/null || echo "PORT_FREE"
    ```

11. **MCP servers**: Check if any MCP servers are configured in `.claude/`
    ```
    cat .claude/mcp.json 2>/dev/null || echo "NO_MCP"
    ```

12. **Settings**: Check Claude settings
    ```
    cat ~/.claude/settings.json 2>/dev/null || echo "NO_SETTINGS"
    ```

## Output format

```
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
Upfyn-Code Doctor — Diagnostics Report
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

[✅/❌] Package installed:     [version or NOT FOUND]
[✅/❌] Server running:        [status]
[✅/❌] Claude CLI:            [path]
[✅/❌] Node.js:               [version]
[✅/⚠️] Project .claude/:     [found/missing]
[✅/⚠️] CLAUDE.md:            [found/missing]
[✅/❌] Commands directory:    [path]
[✅/⚠️] Upfyn-Code commands:     [installed/missing]
[✅/⚠️] Database:             [path/missing]
[✅/⚠️] Port 3001:            [in use/free]
[✅/⚠️] MCP servers:          [count or none]
[✅/⚠️] Settings:             [found/missing]

Summary: X passed, Y warnings, Z failed

[If any failures, suggest fixes]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
```

$ARGUMENTS
