fix(mcp): resolve external preview routing failures and correct monorepo git paths

This commit is contained in:
2026-05-14 14:56:29 -07:00
parent 7d085f57f2
commit c3b06b61fc
3 changed files with 4 additions and 4 deletions

View File

@@ -203,7 +203,7 @@ Each project has a persistent \`vibn-dev\` container. Edit files via \`fs_*\` an
**Dev servers (preview URL via \`*.preview.vibnai.com\` wildcard):**
- \`dev_server_start { projectId, command, port?, name? }\` is a **one-shot** call. It kills old processes on the port, checks the port is free, sets HOST=0.0.0.0 + PORT, launches your command, and returns a clickable \`previewUrl\`. Do NOT pre-flight with \`devcontainer_status\`, \`fs_list\`, \`dev_server_logs\`, or manual \`shell_exec\` kills — the function handles all of that. Just call it. The error tells you what to fix: \`PORT_BUSY\` → pick 30013009; \`npm: command not found\` → project needs \`npm install\` first.
- \`port\` defaults to 3000, range 30003009 (10 Traefik routers pre-allocated per project).
- **Monorepos:** if the project has packages/apps, start inside the frontend directory. Pass \`name: "frontend"\` so the Preview tab picks it. The command runs from \`/workspace\`, so if the frontend is at \`/workspace/apps/web\`, use \`command: "cd apps/web && npm run dev"\`.
- **Directory:** The command runs from the root \`/workspace\` directory, but your project code is inside \`/workspace/${activeProject.slug ?? "<slug>"}/\`. You MUST \`cd\` into your project folder first! Example: \`command: "cd ${activeProject.slug ?? "<slug>"} && npm run dev"\`.
- \`dev_server_stop\` / \`dev_server_list\` / \`dev_server_logs\` — use only AFTER a failed start, and only to diagnose the error the function returned. Never on success.
**HMR through the proxy (apply when scaffolding):**

View File

@@ -4960,7 +4960,7 @@ async function toolShip(principal: Principal, params: Record<string, any>) {
// Capture the resulting HEAD SHA on stdout in a parseable form so we
// can return it to the caller without a second exec round-trip.
const cmd = `set -e
cd /workspace
cd /workspace/${project.slug}
if [ ! -d .git ]; then
git init -q
git checkout -b ${shq(branch)}