bricks-builder-mcp 3.11.3 → 3.11.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/server.js +21 -5
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "bricks-builder-mcp",
4
- "version": "3.11.3",
4
+ "version": "3.11.4",
5
5
  "description": "Serveur MCP pour piloter Bricks Builder (WordPress) depuis Claude — édition de pages, gestion d'éléments, réordonnancement des sections, vérification visuelle (verify_element), upload optimisé WebP. Communauté Discord : https://discord.gg/rX22zHRzH",
6
6
  "homepage": "https://discord.gg/rX22zHRzH",
7
7
  "main": "server.js",
package/server.js CHANGED
@@ -2310,26 +2310,42 @@ mcpServer.setRequestHandler(CallToolRequestSchema, async (request) => {
2310
2310
 
2311
2311
  // === Empty containers ===
2312
2312
  if (cfg.empty_containers) {
2313
+ // v3.11.4 — debug : on remonte le outerHTML pour identifier les faux positifs
2314
+ let debugCount = 0;
2313
2315
  allBrxe.forEach(b => {
2314
2316
  const rect = b.getBoundingClientRect();
2315
2317
  if (rect.width < 50 || rect.height < 50) return;
2316
2318
  const area = rect.width * rect.height;
2317
2319
  if (area < 2500) return;
2318
- // Ignorer les éléments en dehors du viewport rendu (hauteur fullpage)
2319
2320
  const hasText = (b.textContent || '').trim().length > 0;
2320
- const hasMedia = b.querySelector('img, picture, svg, video, iframe') !== null;
2321
+ const hasMedia = b.querySelector('img, picture, svg, video, iframe, canvas') !== null;
2321
2322
  const hasInteractive = b.querySelector('a, button, input, select, textarea') !== null;
2322
2323
  const bcs = getComputedStyle(b);
2323
2324
  const hasBgImg = bcs.backgroundImage && bcs.backgroundImage !== 'none';
2324
- if (!hasText && !hasMedia && !hasInteractive && !hasBgImg) {
2325
- issues.push({
2325
+ // v3.11.4 détecte AUSSI les background-image sur les descendants directs (Bricks rend souvent
2326
+ // l'image en CSS bg sur un enfant, pas sur le wrapper)
2327
+ const hasChildBgImg = !hasBgImg && Array.from(b.children).some(c => {
2328
+ const ccs = getComputedStyle(c);
2329
+ return ccs.backgroundImage && ccs.backgroundImage !== 'none';
2330
+ });
2331
+ if (!hasText && !hasMedia && !hasInteractive && !hasBgImg && !hasChildBgImg) {
2332
+ const issue = {
2326
2333
  type: 'empty_container',
2327
2334
  severity: 'warning',
2328
2335
  element: b.id || (Array.from(b.classList).find(c => c.startsWith('brxe-')) || '?'),
2329
2336
  label: `Container vide ${Math.round(rect.width)}×${Math.round(rect.height)}px`,
2330
2337
  hint: "Bloc visible sans contenu — souvent un wrapper écrasé par align-items: stretch. Fixer aspect-ratio ou ajouter du contenu.",
2331
2338
  bbox: absBbox(rect),
2332
- });
2339
+ };
2340
+ // DEBUG : 3 premiers seulement (sinon trop verbeux)
2341
+ if (debugCount < 3) {
2342
+ issue._debugOuterHTML = (b.outerHTML || '').substring(0, 400);
2343
+ issue._debugTagName = b.tagName;
2344
+ issue._debugChildrenCount = b.children.length;
2345
+ issue._debugChildren = Array.from(b.children).slice(0, 3).map(c => `<${c.tagName.toLowerCase()}${c.id ? '#' + c.id : ''}${c.className ? '.' + (typeof c.className === 'string' ? c.className.split(' ').slice(0,2).join('.') : '') : ''}>`);
2346
+ debugCount++;
2347
+ }
2348
+ issues.push(issue);
2333
2349
  }
2334
2350
  });
2335
2351
  }