Compare commits

..

4 Commits

Author SHA1 Message Date
Jordan Diaz
5bfcee6918 get_web_url: forzar HTTP en forge + documentar ?pruebas=1 obligatorio
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 19:37:27 +00:00
Jordan Diaz
30a62d9a1d Tool get_web_url: devuelve URL correcta del proyecto para fetch/playwright
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 19:33:39 +00:00
Jordan Diaz
50ccc0e2a1 Docs: prohibir navegación a dominio de producción, solo usar ACAI_WEB_URL
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 19:30:49 +00:00
Jordan Diaz
fea9d2bd92 Fix docs: eliminar localhost:8080, usar URL real del proyecto
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 19:26:48 +00:00
4 changed files with 53 additions and 4 deletions

View File

@@ -59,8 +59,9 @@ return [
El Docker debe estar corriendo. Hacer curl al endpoint del hook:
```bash
curl http://localhost:8080/hooks/example_hook/
curl {ACAI_WEB_URL}/hooks/example_hook/
```
(Use the project's actual URL, never localhost:8080)
No usar X-Hooks-Token en desarrollo local.

View File

@@ -4,9 +4,10 @@ This is an Acai CMS website project. Follow these instructions when working with
## Environment
- The site runs in Docker, typically at **http://localhost:8080**
- You can make HTTP requests to test pages, APIs, or form submissions
- If you need to inspect the live site, use browser tools (Playwright MCP) or HTTP requests to localhost:8080
- The site runs in Docker. **Before using fetch or Playwright, call the `get_web_url` tool** to get the correct development URL. Never hardcode or guess URLs.
- **ALWAYS append `?pruebas=1`** to any URL you visit (e.g. `http://.../?pruebas=1`). This query param is required to view the site in development mode.
- **NEVER navigate to the production domain** (e.g. `keepsailing.es`, `tienda.com`). The production site is NOT your development environment.
- **NEVER use localhost:8080 or https://** — use HTTP (not HTTPS) with the URL from `get_web_url`.
## Project Structure

View File

@@ -0,0 +1,45 @@
import { z } from "zod";
import { withAuth, getSessionCredentials } from "../../auth/index.js";
import { handleToolError } from "../helpers/errorHandler.js";
import { withAuthParams } from "../helpers/authSchema.js";
export function registerGetWebUrlTool(server) {
server.tool(
"get_web_url",
`Get the correct URL for the project's development website. Always use this URL for fetch, Playwright, or any HTTP request to the site. Never guess or use production domains.`,
withAuthParams({}),
{ readOnlyHint: true, destructiveHint: false },
withAuth(async (_params, extra) => {
try {
const credentials = await getSessionCredentials(extra.sessionId);
if (!credentials || !credentials.web_url) {
return {
content: [{ type: "text", text: "Error: no web_url available. Run select_project first." }],
isError: true,
};
}
// Inside Docker, HTTPS is not available — force HTTP for internal requests
let webUrl = credentials.web_url;
if (webUrl && webUrl.startsWith("https://") && webUrl.includes(".forge.")) {
webUrl = webUrl.replace("https://", "http://");
}
return {
content: [{
type: "text",
text: JSON.stringify({
web_url: webUrl,
api_web_url: credentials.api_web_url || null,
website: credentials.website || null,
note: "Always use web_url for Playwright/fetch. IMPORTANT: Always append ?pruebas=1 to any URL you visit (e.g. web_url + '/?pruebas=1' or web_url + '/servicios/?pruebas=1'). Never use the production domain directly.",
})
}],
};
} catch (error) {
return handleToolError(error, "get_web_url", {});
}
})
);
}

View File

@@ -1,5 +1,7 @@
import { registerSaveProjectStylesTool } from "./saveStyles.js";
import { registerGetWebUrlTool } from "./getWebUrl.js";
export function registerProjectTools(server) {
registerSaveProjectStylesTool(server);
registerGetWebUrlTool(server);
}