get_web_url: forzar HTTP en forge + documentar ?pruebas=1 obligatorio

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jordan Diaz
2026-04-06 19:37:27 +00:00
parent 30a62d9a1d
commit 5bfcee6918
2 changed files with 11 additions and 5 deletions

View File

@@ -4,10 +4,10 @@ This is an Acai CMS website project. Follow these instructions when working with
## Environment ## Environment
- The site runs in Docker. The development URL is provided via `ACAI_WEB_URL` environment variable (e.g. `https://username_domain.forge.acaisuite.com/`) - 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.
- **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 navigate to the production domain** (e.g. `keepsailing.es`, `tienda.com`). The production site is NOT your development environment.
- **NEVER use localhost:8080** — that does not resolve in this environment. - **NEVER use localhost:8080 or https://** — use HTTP (not HTTPS) with the URL from `get_web_url`.
## Project Structure ## Project Structure

View File

@@ -20,14 +20,20 @@ export function registerGetWebUrlTool(server) {
}; };
} }
// 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 { return {
content: [{ content: [{
type: "text", type: "text",
text: JSON.stringify({ text: JSON.stringify({
web_url: credentials.web_url, web_url: webUrl,
api_web_url: credentials.api_web_url || null, api_web_url: credentials.api_web_url || null,
website: credentials.website || null, website: credentials.website || null,
note: "Always use web_url for Playwright/fetch. Never use the production domain directly.", 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.",
}) })
}], }],
}; };