Docs: create_module es legacy, acai_write es el flujo estándar
El server compila automáticamente al guardar index-base.tpl via acai_write — no necesita create_module ni compile_module manual. - mcp-tools-reference.md: flujo actualizado, create_module marcado legacy - module-creation-guide.md: paso 2 usa acai_write - ACAI-CLAUDE.md: key workflows actualizados - coder.py: system prompt alineado Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -105,7 +105,7 @@ Do NOT modify web-base files — they are shared across all projects.
|
|||||||
1. **Before working with any area (hooks, modules, templates, CSS/JS, etc.), read the corresponding documentation in `docs/` first.** Do not guess or assume — always consult the docs before taking action.
|
1. **Before working with any area (hooks, modules, templates, CSS/JS, etc.), read the corresponding documentation in `docs/` first.** Do not guess or assume — always consult the docs before taking action.
|
||||||
2. **NEVER use `mkdir` to create directories.** Instead, use the `Write` tool to create the first file inside the directory — this creates parent directories automatically. For example, to create a new module, directly write the `index-base.tpl` file.
|
2. **NEVER use `mkdir` to create directories.** Instead, use the `Write` tool to create the first file inside the directory — this creates parent directories automatically. For example, to create a new module, directly write the `index-base.tpl` file.
|
||||||
3. Only edit `index-base.tpl` in modules — `index.tpl`, `index-twig.tpl`, and `builder.json` are auto-generated
|
3. Only edit `index-base.tpl` in modules — `index.tpl`, `index-twig.tpl`, and `builder.json` are auto-generated
|
||||||
3. **After editing any `index-base.tpl`, ALWAYS call the `compile_module` MCP tool** to compile the module/section. This is mandatory — without compilation, changes won't take effect in the CMS.
|
3. **Edit `index-base.tpl` using `acai_write` or `acai_line_replace`** — the server compiles automatically when the file is saved. No need to call `compile_module` manually.
|
||||||
4. Use Twig **filters** (with `|`), never Twig functions
|
4. Use Twig **filters** (with `|`), never Twig functions
|
||||||
5. Table names without `cms_` prefix everywhere
|
5. Table names without `cms_` prefix everywhere
|
||||||
6. Primary key is `num`, never `id`
|
6. Primary key is `num`, never `id`
|
||||||
@@ -122,8 +122,8 @@ This project has MCP tools for managing modules, records, media, and more. **Bef
|
|||||||
See [docs/mcp-tools-reference.md](docs/mcp-tools-reference.md) for the complete list of available tools and step-by-step workflows.
|
See [docs/mcp-tools-reference.md](docs/mcp-tools-reference.md) for the complete list of available tools and step-by-step workflows.
|
||||||
|
|
||||||
Key workflows:
|
Key workflows:
|
||||||
- **Create module**: Read [docs/module-creation-guide.md](docs/module-creation-guide.md) first → `create_module` → `add_module_to_record` (returns sectionId) → `set_module_config_vars` (returns uploadFields) → images via uploadFields
|
- **Create module**: Read [docs/module-creation-guide.md](docs/module-creation-guide.md) first → Write `index-base.tpl` via `acai_write` → `add_module_to_record` (returns sectionId) → `set_module_config_vars` (returns uploadFields) → images via uploadFields
|
||||||
- **Edit module**: read vars → edit `index-base.tpl` → `compile_module`
|
- **Edit module**: read vars → edit `index-base.tpl` with `acai_write` or `acai_line_replace` (server compiles automatically)
|
||||||
- **Add images**: use `uploadFields` from `set_module_config_vars` response → `upload_record_image`
|
- **Add images**: use `uploadFields` from `set_module_config_vars` response → `upload_record_image`
|
||||||
- **Generate images**: `generate_image` → `upload_record_image` with returned URL
|
- **Generate images**: `generate_image` → `upload_record_image` with returned URL
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
|
|
||||||
| Tool | Categoría | Acción |
|
| Tool | Categoría | Acción |
|
||||||
|------|-----------|--------|
|
|------|-----------|--------|
|
||||||
| `create_module` | Módulos | Crea módulo nuevo (directorio + archivos + compila) |
|
| `create_module` | Módulos | (Legacy) Alternativa para crear módulo — preferir acai_write |
|
||||||
| `compile_module` | Módulos | Compila módulo tras editar index-base.tpl |
|
| `compile_module` | Módulos | Compila módulo tras editar index-base.tpl |
|
||||||
| `check_module` | Módulos | Preview de cómo renderiza un módulo |
|
| `check_module` | Módulos | Preview de cómo renderiza un módulo |
|
||||||
| `check_module_usage` | Módulos | Qué páginas usan un módulo |
|
| `check_module_usage` | Módulos | Qué páginas usan un módulo |
|
||||||
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
### Crear un módulo nuevo desde cero
|
### Crear un módulo nuevo desde cero
|
||||||
|
|
||||||
1. `create_module` — Crea el directorio con index-base.tpl, style.css, script.js y compila
|
1. `acai_write` — Escribe `index-base.tpl` en `template/estandar/modulos/NOMBRE/`. El server crea la carpeta si no existe, compila y genera todos los archivos derivados (index-twig.tpl, index.tpl, builder.json, screenshots)
|
||||||
2. `add_module_to_record` — Añade el módulo a una página (tabla padre, ej: `apartados`)
|
2. `add_module_to_record` — Añade el módulo a una página (tabla padre, ej: `apartados`)
|
||||||
3. `set_module_config_vars` — Rellena las variables con contenido (textos, colores, opciones). **OBLIGATORIO** — sin esto el módulo no muestra nada. Devuelve:
|
3. `set_module_config_vars` — Rellena las variables con contenido (textos, colores, opciones). **OBLIGATORIO** — sin esto el módulo no muestra nada. Devuelve:
|
||||||
- `configVars`: mapa de variables → recordNums
|
- `configVars`: mapa de variables → recordNums
|
||||||
@@ -46,12 +46,13 @@
|
|||||||
4. Para imágenes: `generate_image` o `upload_record_image` usando el `recordNum` y `fieldName` del `uploadFields` devuelto en el paso 3
|
4. Para imágenes: `generate_image` o `upload_record_image` usando el `recordNum` y `fieldName` del `uploadFields` devuelto en el paso 3
|
||||||
5. Verificar con `check_module` o recargando la página
|
5. Verificar con `check_module` o recargando la página
|
||||||
|
|
||||||
|
> **Nota:** `create_module` es una alternativa legacy que hace lo mismo pero con menos control sobre el contenido del template.
|
||||||
|
|
||||||
### Editar un módulo existente
|
### Editar un módulo existente
|
||||||
|
|
||||||
1. `get_module_config_vars` — Leer el estado actual del módulo (variables, recordNums)
|
1. `get_module_config_vars` — Leer el estado actual del módulo (variables, recordNums)
|
||||||
2. Editar `index-base.tpl` con la tool `Write` o `Edit`
|
2. Editar `index-base.tpl` con `acai_write` o `acai_line_replace` — el server compila automáticamente al guardar
|
||||||
3. `compile_module` — **OBLIGATORIO** tras cada edición de index-base.tpl
|
3. Si cambias variables: `set_module_config_vars` para actualizar valores
|
||||||
4. Si cambias variables: `set_module_config_vars` para actualizar valores
|
|
||||||
|
|
||||||
### Añadir/modificar imágenes de un módulo
|
### Añadir/modificar imágenes de un módulo
|
||||||
|
|
||||||
|
|||||||
@@ -38,7 +38,7 @@ Each module lives in `template/estandar/modulos/<moduleId>/` with:
|
|||||||
## Creating a Module — Full Workflow
|
## Creating a Module — Full Workflow
|
||||||
|
|
||||||
1. **Read style reference** (steps above)
|
1. **Read style reference** (steps above)
|
||||||
2. **`create_module`** — Creates the directory with index-base.tpl, style.css, script.js and compiles. Use descriptive `moduleId` and clear `label`.
|
2. **`acai_write`** — Write `index-base.tpl` to `template/estandar/modulos/MODULE_ID/index-base.tpl`. The server automatically creates the directory, compiles and generates all derived files. `create_module` is a legacy alternative.
|
||||||
3. **`add_module_to_record`** — Adds the module to a page. Response includes `sectionId` — use it directly in the next step.
|
3. **`add_module_to_record`** — Adds the module to a page. Response includes `sectionId` — use it directly in the next step.
|
||||||
4. **`set_module_config_vars`** — Fill variables with content. Response includes `uploadFields` with `{ fieldName, recordNum }` for each upload variable.
|
4. **`set_module_config_vars`** — Fill variables with content. Response includes `uploadFields` with `{ fieldName, recordNum }` for each upload variable.
|
||||||
5. **Upload images** — Use `generate_image` then `upload_record_image` with the `recordNum` and `fieldName` from step 4's `uploadFields`. No need to read builder.json or call get_module_config_vars.
|
5. **Upload images** — Use `generate_image` then `upload_record_image` with the `recordNum` and `fieldName` from step 4's `uploadFields`. No need to read builder.json or call get_module_config_vars.
|
||||||
@@ -72,6 +72,6 @@ Modules with `MJMLModule: true` in their schema are email modules:
|
|||||||
- Use `section_id` variable for unique anchors/scoping
|
- Use `section_id` variable for unique anchors/scoping
|
||||||
- Use `interno` variable to detect CMS editor vs public view
|
- Use `interno` variable to detect CMS editor vs public view
|
||||||
- Include other modules with: `<module_id :param1="value1"></module_id>`
|
- Include other modules with: `<module_id :param1="value1"></module_id>`
|
||||||
- After editing `index-base.tpl`, ALWAYS call `compile_module`
|
- After editing `index-base.tpl` with `acai_write` or `acai_line_replace`, the server compiles automatically — no need to call `compile_module`
|
||||||
- Twig uses filters (with `|`), never functions
|
- Twig uses filters (with `|`), never functions
|
||||||
- Twig concatenation uses `~`: `'value=' ~ variable`
|
- Twig concatenation uses `~`: `'value=' ~ variable`
|
||||||
|
|||||||
@@ -17,10 +17,10 @@ CODER_SYSTEM_PROMPT = """Eres un Agente Programador de Acai CMS. Tu rol es ejecu
|
|||||||
|
|
||||||
## Uso de herramientas
|
## Uso de herramientas
|
||||||
- CONSULTA la Knowledge Base ANTES de actuar — tiene la referencia completa de tools y flujos de trabajo.
|
- CONSULTA la Knowledge Base ANTES de actuar — tiene la referencia completa de tools y flujos de trabajo.
|
||||||
- Para CREAR MÓDULOS usa `create_module` (crea archivos en filesystem), NUNCA `create_or_update_record` en tabla modulos.
|
- Para CREAR/EDITAR MÓDULOS usa `acai_write` sobre `template/estandar/modulos/NOMBRE/index-base.tpl`. El server crea la carpeta si no existe, compila y genera todos los archivos derivados automáticamente. NO necesitas compile_module.
|
||||||
|
- `create_module` es legacy — funciona pero `acai_write` es el flujo estándar.
|
||||||
- Para GESTIONAR REGISTROS de tablas (apartados, travesias, etc.) usa `create_or_update_record`.
|
- Para GESTIONAR REGISTROS de tablas (apartados, travesias, etc.) usa `create_or_update_record`.
|
||||||
- Para ESCRIBIR ARCHIVOS usa `acai_write` o `acai_line_replace`.
|
- Flujo de módulo nuevo: acai_write index-base.tpl → add_module_to_record → set_module_config_vars.
|
||||||
- Tras crear un módulo, SIEMPRE sigue el flujo: create_module → add_module_to_record → set_module_config_vars.
|
|
||||||
- tableName siempre SIN prefijo cms_ (ej: apartados, NO cms_apartados).
|
- tableName siempre SIN prefijo cms_ (ej: apartados, NO cms_apartados).
|
||||||
- La primary key es siempre `num`, nunca `id`.
|
- La primary key es siempre `num`, nunca `id`.
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user