otro
This commit is contained in:
29
CLAUDE.md
29
CLAUDE.md
@@ -115,30 +115,6 @@ Do NOT modify web-base files — they are shared across all projects.
|
|||||||
10. `enlace` (link) fields already include slashes — **NEVER modify an existing enlace** unless explicitly asked
|
10. `enlace` (link) fields already include slashes — **NEVER modify an existing enlace** unless explicitly asked
|
||||||
11. **NEVER modify the `controlador` field** of existing records — it defines whether a page is Builder or Standard
|
11. **NEVER modify the `controlador` field** of existing records — it defines whether a page is Builder or Standard
|
||||||
|
|
||||||
## Project Styles
|
|
||||||
|
|
||||||
When creating new modules, you need to match the visual style of the existing project. To avoid re-exploring modules every time:
|
|
||||||
|
|
||||||
1. **If `docs/project-styles.md` exists** → read it. It contains the project's color palette, typography, spacing, and design patterns. Use it directly.
|
|
||||||
2. **If it does NOT exist and there are 3+ modules** → explore the existing modules to understand the style, then **generate `docs/project-styles.md`** with a summary for future use.
|
|
||||||
3. **If it does NOT exist and there are few modules** → create the module based on the user's description without exploring. The style will be defined as modules are created.
|
|
||||||
|
|
||||||
**When exploring modules for style reference:**
|
|
||||||
- Only look at modules that have a `builder.json` file (these are builder modules)
|
|
||||||
- Skip modules whose directory name starts with `custom-` (these are general sections, not visual modules)
|
|
||||||
- Read `index-base.tpl` and `style.css` of 3-4 representative modules
|
|
||||||
- Summarize: color palette, typography, spacing, Tailwind patterns, common CSS classes, design conventions
|
|
||||||
|
|
||||||
**When generating `docs/project-styles.md`**, include:
|
|
||||||
- Primary/secondary/accent colors (hex values)
|
|
||||||
- Font families and sizes used
|
|
||||||
- Spacing scale (padding/margin patterns)
|
|
||||||
- Common Tailwind classes and custom CSS patterns
|
|
||||||
- Button styles, card styles, section layouts
|
|
||||||
- Any recurring design patterns (gradients, shadows, borders, etc.)
|
|
||||||
|
|
||||||
**Update `docs/project-styles.md`** after creating a module if the project has grown significantly since the last update (e.g. 5+ new modules).
|
|
||||||
|
|
||||||
## MCP Tools
|
## MCP Tools
|
||||||
|
|
||||||
This project has MCP tools for managing modules, records, media, and more. **Before starting any task, consult the tools reference for the correct workflow.**
|
This project has MCP tools for managing modules, records, media, and more. **Before starting any task, consult the tools reference for the correct workflow.**
|
||||||
@@ -146,9 +122,9 @@ 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**: `create_module` → `add_module_to_record` → `set_module_config_vars` → images
|
- **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
|
||||||
- **Edit module**: read vars → edit `index-base.tpl` → `compile_module`
|
- **Edit module**: read vars → edit `index-base.tpl` → `compile_module`
|
||||||
- **Add images**: `get_module_config_vars` → `upload_record_image` (fieldName from builder.json relations)
|
- **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
|
||||||
|
|
||||||
## Documentation
|
## Documentation
|
||||||
@@ -163,4 +139,5 @@ Key workflows:
|
|||||||
- [docs/vue-builder-rules.md](docs/vue-builder-rules.md) — CMS-VUE rules (tabs, colorpicker, components)
|
- [docs/vue-builder-rules.md](docs/vue-builder-rules.md) — CMS-VUE rules (tabs, colorpicker, components)
|
||||||
- [docs/vue-builder-examples.md](docs/vue-builder-examples.md) — Vue builder examples (Banner Slideshow, etc.)
|
- [docs/vue-builder-examples.md](docs/vue-builder-examples.md) — Vue builder examples (Banner Slideshow, etc.)
|
||||||
- [docs/pages-and-records.md](docs/pages-and-records.md) — Page types (Builder vs Standard), sections, visibility, critical rules
|
- [docs/pages-and-records.md](docs/pages-and-records.md) — Page types (Builder vs Standard), sections, visibility, critical rules
|
||||||
|
- [docs/module-creation-guide.md](docs/module-creation-guide.md) — Module creation workflow, style reference, field types
|
||||||
- [docs/mcp-tools-reference.md](docs/mcp-tools-reference.md) — MCP tools reference, available tools, workflows
|
- [docs/mcp-tools-reference.md](docs/mcp-tools-reference.md) — MCP tools reference, available tools, workflows
|
||||||
|
|||||||
77
docs/module-creation-guide.md
Normal file
77
docs/module-creation-guide.md
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
# Module Creation Guide
|
||||||
|
|
||||||
|
## Style Reference
|
||||||
|
|
||||||
|
When creating new modules, you MUST match the visual style of the existing project. Follow these steps IN ORDER:
|
||||||
|
|
||||||
|
### Step 1: Check for `docs/project-styles.md`
|
||||||
|
- If the file exists → read it and use it as your style reference. DONE — skip to module creation.
|
||||||
|
- If the file does NOT exist → continue to Step 2.
|
||||||
|
|
||||||
|
### Step 2: Determine if exploration is needed
|
||||||
|
- Count modules in `template/estandar/modulos/` that have `builder.json` and do NOT start with `custom-`
|
||||||
|
- If 3+ qualifying modules exist → continue to Step 3
|
||||||
|
- If fewer than 3 → skip exploration, create the module based on the user's description. The style will be defined as modules are created.
|
||||||
|
|
||||||
|
### Step 3: Explore and GENERATE the style guide (MANDATORY)
|
||||||
|
- Read `index-base.tpl` and `style.css` of 3-4 representative modules (only those with `builder.json`, skip `custom-*`)
|
||||||
|
- **You MUST then create the file `docs/project-styles.md`** with:
|
||||||
|
- Primary/secondary/accent colors (hex values)
|
||||||
|
- Font families and sizes used
|
||||||
|
- Spacing scale (padding/margin patterns)
|
||||||
|
- Common Tailwind classes and custom CSS patterns
|
||||||
|
- Button styles, card styles, section layouts
|
||||||
|
- Any recurring design patterns (gradients, shadows, borders, etc.)
|
||||||
|
- This file will be used by future module creation tasks to avoid re-exploring every time.
|
||||||
|
|
||||||
|
**After creating a module:** if `docs/project-styles.md` does not exist yet and there are now 3+ modules, generate it.
|
||||||
|
|
||||||
|
## Module Structure
|
||||||
|
|
||||||
|
Each module lives in `template/estandar/modulos/<moduleId>/` with:
|
||||||
|
- `index-base.tpl` — Twig template (source — EDIT THIS)
|
||||||
|
- `style.css` — Module styles
|
||||||
|
- `script.js` — Module JavaScript
|
||||||
|
- `builder.json` — Compiled builder vars (auto-generated, do NOT edit)
|
||||||
|
- `index.tpl` / `index-twig.tpl` — Compiled (auto-generated, do NOT edit)
|
||||||
|
|
||||||
|
## Creating a Module — Full Workflow
|
||||||
|
|
||||||
|
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`.
|
||||||
|
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.
|
||||||
|
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.
|
||||||
|
6. **`navigate_browser`** — Navigate to the page so the user can see the result.
|
||||||
|
|
||||||
|
## HTML Field Types
|
||||||
|
|
||||||
|
Use these `data-field-type` attributes in `index-base.tpl`:
|
||||||
|
|
||||||
|
| Attribute | Purpose | Example |
|
||||||
|
|-----------|---------|---------|
|
||||||
|
| `headfield` | Editable heading | `<h2 data-field-type="headfield">Title</h2>` |
|
||||||
|
| `textfield` | Short editable text | `<span data-field-type="textfield">Text</span>` |
|
||||||
|
| `wysiwyg` | Rich text editor | `<div data-field-type="wysiwyg">Content</div>` |
|
||||||
|
| `upload` | Image upload | `<img data-field-type="upload" src="...">` |
|
||||||
|
| `list` | Select dropdown | `<div data-field-type="list" data-options="opt1,opt2">` |
|
||||||
|
| `multiv2` | Repeater/records | `<div data-field-type="multiv2">...</div>` |
|
||||||
|
| `checkbox` | Toggle | `<div data-field-type="checkbox">` |
|
||||||
|
| `colorpicker` | Color picker | `<div data-field-type="colorpicker">` |
|
||||||
|
|
||||||
|
## MJML Modules
|
||||||
|
|
||||||
|
Modules with `MJMLModule: true` in their schema are email modules:
|
||||||
|
- Only appear when the page table is `mail_marketing`
|
||||||
|
- For `mail_marketing` tables, only MJML modules are shown
|
||||||
|
- Use MJML markup instead of standard HTML
|
||||||
|
|
||||||
|
## Key Rules
|
||||||
|
|
||||||
|
- Always use Tailwind CSS as primary styling
|
||||||
|
- Use `section_id` variable for unique anchors/scoping
|
||||||
|
- Use `interno` variable to detect CMS editor vs public view
|
||||||
|
- Include other modules with: `<module_id :param1="value1"></module_id>`
|
||||||
|
- After editing `index-base.tpl`, ALWAYS call `compile_module`
|
||||||
|
- Twig uses filters (with `|`), never functions
|
||||||
|
- Twig concatenation uses `~`: `'value=' ~ variable`
|
||||||
Reference in New Issue
Block a user