Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
65295c9fe1 |
@@ -4,9 +4,9 @@ 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 on Acai Forge — get the live editable URL with the `get_web_url` MCP tool (never assume a fixed domain)
|
||||
- You can make HTTP requests to test pages, APIs, or form submissions against that URL
|
||||
- If you need to inspect the live site, use browser tools (Playwright MCP) or HTTP requests to the Forge URL
|
||||
|
||||
## Project Structure
|
||||
|
||||
@@ -28,13 +28,7 @@ This is an Acai CMS website project. Follow these instructions when working with
|
||||
│ ├── data/schema/ # Database table schemas (JSON)
|
||||
│ ├── lib/plugins/ # CMS plugins
|
||||
│ └── uploads/ # Uploaded media files
|
||||
├── .acai # Project config (domain, tokens, DB credentials)
|
||||
├── .docker/
|
||||
│ ├── .env # Docker environment (DB credentials)
|
||||
│ ├── docker-compose.yml
|
||||
│ ├── tunnel-url.txt # Public tunnel URL (if active)
|
||||
│ └── bore-db-url.txt # Database tunnel URL (if active)
|
||||
└── database.sql # Database dump
|
||||
└── .acai # Project config (domain, tokens, DB credentials)
|
||||
```
|
||||
|
||||
## Key Concepts
|
||||
@@ -89,28 +83,9 @@ Rule of thumb:
|
||||
|
||||
See [docs/hooks-and-api.md](docs/hooks-and-api.md) for usage.
|
||||
|
||||
## Database Access
|
||||
|
||||
When the site is running in Docker, you can connect to the database:
|
||||
|
||||
- **Host:** `127.0.0.1`
|
||||
- **Port:** Check `.docker/docker-compose.yml` for the mapped port (usually 3307+)
|
||||
- **Credentials:** Read from `.docker/.env`:
|
||||
- `DB_USERNAME`
|
||||
- `DB_PASSWORD`
|
||||
- `DB_DATABASE`
|
||||
|
||||
```bash
|
||||
docker exec -it dw-<project-name>-db mysql -u root -p<password> <database>
|
||||
```
|
||||
|
||||
**Important:** Table names in CmsApi/Twig do NOT use the `cms_` prefix. The primary key is always `num`, never `id`.
|
||||
|
||||
## Acai Core (web-base)
|
||||
|
||||
The project workspace contains only the **customization layer** (modules, hooks, schemas, uploads). The CMS core (routing, rendering engine, admin panel, APIs) lives in a separate directory called **web-base** that is mounted as a Docker volume.
|
||||
|
||||
The web-base path can be obtained via: `GET http://localhost:9090/api/web-base-path`
|
||||
The project workspace contains only the **customization layer** (modules, hooks, schemas, uploads). The CMS core (routing, rendering engine, admin panel, APIs) lives in a separate, shared directory called **web-base**.
|
||||
|
||||
Do NOT modify web-base files — they are shared across all projects.
|
||||
|
||||
|
||||
@@ -471,7 +471,7 @@ El nombre del campo de imagen viene de `builder.json` → `vars.NOMBRE.relations
|
||||
- `tableName`: `"builder_custom"` (siempre, sin prefijo cms_)
|
||||
- `recordId`: el `recordNum` del paso 1 (ej: `"778"`)
|
||||
- `fieldName`: el campo de relations del builder.json (ej: `"image1"`)
|
||||
- `imageUrl`: URL completa accesible desde Docker
|
||||
- `imageUrl`: URL completa y públicamente accesible
|
||||
3. `reorder_record_uploads` si es necesario — pasar array de upload IDs en el orden deseado
|
||||
4. `list_record_uploads` para verificar
|
||||
|
||||
|
||||
@@ -56,13 +56,15 @@ return [
|
||||
|
||||
### Testing Hooks
|
||||
|
||||
El Docker debe estar corriendo. Hacer curl al endpoint del hook:
|
||||
Usa la URL editable de Forge del proyecto (`get_web_url`) — no hace falta ningún servidor local. Haz
|
||||
`curl` al endpoint del hook contra esa URL:
|
||||
|
||||
```bash
|
||||
curl http://localhost:8080/hooks/example_hook/
|
||||
curl https://<tu-url-de-forge>/hooks/example_hook/
|
||||
```
|
||||
|
||||
No usar X-Hooks-Token en desarrollo local.
|
||||
Para diagnosticar sin depender del enrutado HTTP directo (que en Forge puede dar 404 — ver más abajo),
|
||||
usa el patrón vía filtro `| hook` desde un módulo/página temporal.
|
||||
|
||||
### Cómo Llamar Hooks
|
||||
|
||||
|
||||
@@ -13,8 +13,6 @@
|
||||
| `acai-line-replace` | Archivos | Reemplaza un bloque concreto en un archivo existente |
|
||||
| `acai-write` | Archivos | Crea o reescribe un archivo completo. Antes de usarlo, lee la doc correspondiente según el tipo de archivo (`module-creation-guide`, `builder-fields`, `css-js-conventions`, `hooks-and-api`) |
|
||||
| `acai-delete` | Archivos | Borra un archivo del proyecto |
|
||||
| `get_layout_field` | Layout global | Lee header/footer/CSS global/JS global (`field: header\|footer\|style\|javascript`) — NO son ficheros normales, ver [docs/modular-system.md](modular-system.md) |
|
||||
| `set_layout_field` | Layout global | Escribe header/footer/CSS global/JS global — **reemplazo destructivo del contenido completo**, no hay line-replace; verificar `compile_ok` en la respuesta |
|
||||
| `list_page_modules` | Registros | Lista módulos de una página |
|
||||
| `add_module_to_record` | Registros | Añade módulo a una página |
|
||||
| `remove_module_from_record` | Registros | Elimina módulo de una página |
|
||||
|
||||
@@ -89,28 +89,6 @@ Use `<set>` tag to create variables from queries:
|
||||
<set :featured="'productos' | get({destacado: 1}, 'orden ASC', 3)"></set>
|
||||
```
|
||||
|
||||
### Header, footer, and site-wide style/JS — NOT regular files
|
||||
|
||||
`template/estandar/modulos/custom-header-twig/index-base.tpl` and the equivalent `custom-footer-twig`
|
||||
one are **not editable as files** — `acai-write`/`acai-line-replace` reject them with
|
||||
`"Forbidden path: ... es un artefacto generado del layout global"`. They're special general sections
|
||||
(the header/footer of the **entire site**). The `.tpl` on disk is only a generated copy for fast reading
|
||||
(`acai-view` works fine on it), but the real source lives in `layout.json` and is edited with the
|
||||
`get_layout_field`/`set_layout_field` MCP tools (see
|
||||
[docs/mcp-tools-reference.md](mcp-tools-reference.md)):
|
||||
|
||||
- `field: 'header'` / `field: 'footer'` — the header/footer templates themselves.
|
||||
- `field: 'style'` — global CSS for the whole site.
|
||||
- `field: 'javascript'` — global JS for the whole site (delegated listeners shared by every page live
|
||||
here, not in any `.js` file in the repo — a `grep` of the repo for "how does X work in the header"
|
||||
can find nothing even though X works fine in production).
|
||||
|
||||
Workflow for a header/footer/global-CSS/global-JS change: `get_layout_field({field: '...'})` → edit the
|
||||
**full** string (there's no line-replace for this — `set_layout_field` is a destructive full-content
|
||||
replace) → `set_layout_field({field: '...', content: ...})`. The response includes `compile_ok` —
|
||||
verify it, same as any other write-op (see the reliability warning in
|
||||
[docs/mcp-tools-reference.md](mcp-tools-reference.md)).
|
||||
|
||||
|
||||
## Repeatable Content (multiv2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user