bricks-builder-mcp 3.11.1 → 3.11.2

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 +32 -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.1",
4
+ "version": "3.11.2",
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
@@ -229,9 +229,15 @@ function buildSiblingCoherenceChecks(audit) {
229
229
  const all = [audit.self, ...siblings];
230
230
 
231
231
  // 1) text-align mixé entre frères directs
232
- // Si un seul frère a un text-align différent, c'est souvent un bug visuel
233
- // (ex: H2 left + sous-titre center sans intention design).
234
- const aligns = [...new Set(all.map(s => s['text-align']).filter(Boolean))];
232
+ // v3.11.2 : `start` et `left` sont équivalents en LTR (idem `end`/`right`),
233
+ // on les normalise avant de comparer pour éviter les faux positifs.
234
+ // (LTR par défaut, le check est sur des sites WordPress majoritairement français)
235
+ const normalizeAlign = (val) => {
236
+ if (val === 'start') return 'left';
237
+ if (val === 'end') return 'right';
238
+ return val;
239
+ };
240
+ const aligns = [...new Set(all.map(s => normalizeAlign(s['text-align'])).filter(Boolean))];
235
241
  if (aligns.length > 1) {
236
242
  checks.push({
237
243
  ok: false,
@@ -2254,7 +2260,7 @@ mcpServer.setRequestHandler(CallToolRequestSchema, async (request) => {
2254
2260
  await page.waitForLoadState('networkidle', { timeout: 8000 });
2255
2261
  } catch {} // pas grave si certaines requêtes restent en cours
2256
2262
  await page.waitForTimeout(1500);
2257
- // Scroll bottom puis top pour déclencher les lazy-load
2263
+ // Scroll bottom puis top pour déclencher les lazy-load IntersectionObserver
2258
2264
  await page.evaluate(() => {
2259
2265
  return new Promise(resolve => {
2260
2266
  const totalHeight = document.documentElement.scrollHeight;
@@ -2271,6 +2277,15 @@ mcpServer.setRequestHandler(CallToolRequestSchema, async (request) => {
2271
2277
  }, 100);
2272
2278
  });
2273
2279
  });
2280
+ // v3.11.2 — attendre que TOUTES les <img> soient chargées avant l'audit
2281
+ // sinon les lazy-loaded apparaissent comme "container vide"
2282
+ try {
2283
+ await page.waitForFunction(
2284
+ () => Array.from(document.images).every(i => i.complete),
2285
+ { timeout: 10000 }
2286
+ );
2287
+ } catch {} // si une img reste cassée, on continue (elle sera flaggée en broken_image)
2288
+ await page.waitForTimeout(500);
2274
2289
 
2275
2290
  // 3) Collecte d'issues globales sur toute la page
2276
2291
  const auditResult = await page.evaluate((cfg) => {
@@ -2341,13 +2356,25 @@ mcpServer.setRequestHandler(CallToolRequestSchema, async (request) => {
2341
2356
 
2342
2357
  // === Sibling coherence ===
2343
2358
  if (cfg.sibling_coherence) {
2359
+ // v3.11.2 : start === left, end === right en LTR (équivalents CSS)
2360
+ const dir = getComputedStyle(document.documentElement).direction || 'ltr';
2361
+ const normalizeAlign = (val) => {
2362
+ if (dir === 'ltr') {
2363
+ if (val === 'start') return 'left';
2364
+ if (val === 'end') return 'right';
2365
+ } else {
2366
+ if (val === 'start') return 'right';
2367
+ if (val === 'end') return 'left';
2368
+ }
2369
+ return val;
2370
+ };
2344
2371
  allBrxe.forEach(parent => {
2345
2372
  const realChildren = Array.from(parent.children).filter(c =>
2346
2373
  (c.id && c.id.startsWith('brxe-')) ||
2347
2374
  Array.from(c.classList).some(cls => cls.startsWith('brxe-'))
2348
2375
  );
2349
2376
  if (realChildren.length < 2) return;
2350
- const aligns = [...new Set(realChildren.map(c => getComputedStyle(c).textAlign))];
2377
+ const aligns = [...new Set(realChildren.map(c => normalizeAlign(getComputedStyle(c).textAlign)))];
2351
2378
  if (aligns.length > 1) {
2352
2379
  const rect = parent.getBoundingClientRect();
2353
2380
  issues.push({