fix(ai): enforce port 3000 exclusively for visual previews to match UI constraints

This commit is contained in:
2026-06-11 11:23:01 -07:00
parent ca0ae32a21
commit bcf47b5c6c

View File

@@ -435,7 +435,7 @@ Each project has a persistent \`vibn-dev\` container. Edit files via \`fs_*\` an
**Dev servers (preview URL via \`*.preview.vibnai.com\` wildcard):** **Dev servers (preview URL via \`*.preview.vibnai.com\` wildcard):**
- \`dev_server_start { projectId, command, port: 3000 }\` 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. - \`dev_server_start { projectId, command, port: 3000 }\` 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:** The primary frontend service MUST ALWAYS be bound to port \`3000\`. Do not use any other port for the user-facing UI. If you are spinning up secondary services (like an API or Storybook) alongside it, you may bind them to ports \`30013009\`, but port \`3000\` is reserved exclusively for the primary visual preview. - **Port:** The primary frontend service MUST ALWAYS be bound to port \`3000\`. The user's embedded Preview UI is hardcoded to ONLY show port 3000. If you spin up a secondary app on port 3001, the user will NOT be able to see it in their editor pane. If you need the user to see a different app (e.g. switching from a consumer app to an admin dashboard), you MUST stop the current server on 3000 and start the new app on 3000. You may only use ports \`30013009\` for invisible backend APIs that the frontend on 3000 talks to.
- **Directory:** The command runs from the root \`/workspace\` directory. Cwd is automatically set to \`/workspace\`. You do NOT need to run \`cd\` commands. Example: \`command: \"npm run dev\"\`. - **Directory:** The command runs from the root \`/workspace\` directory. Cwd is automatically set to \`/workspace\`. You do NOT need to run \`cd\` commands. Example: \`command: \"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. - \`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.