sbuilder-mcp 0.98.5 → 0.98.6

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.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,15 @@ All notable changes to this project are documented in this file.
6
6
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
7
7
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
8
 
9
+ ## [0.98.6] - 2026-10-29
10
+
11
+ ### Added
12
+ - `sb_add` and `sb_set` report a `hidden_band` check, once per process, when a node is hidden at base, because that hides it only at 1440px and wider, and name the per-breakpoint writes that hide it at every width.
13
+ - `sb_add`, `sb_set` and `sb_review` report `form_register_phone` for a register form whose phone field is not named `phone`.
14
+
15
+ ### Fixed
16
+ - `sb_set` and `sb_add` write `config.hidden` set at desktop to base, because the renderer reads only base for desktop and never read the desktop slot it was written to.
17
+
9
18
  ## [0.98.5] - 2026-10-29
10
19
 
11
20
  ### Added
package/CHANGELOG.vi.md CHANGED
@@ -6,6 +6,15 @@ Mọi thay đổi đáng chú ý của dự án được ghi lại trong file n
6
6
  Định dạng dựa trên [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
7
7
  và dự án tuân theo [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
8
8
 
9
+ ## [0.98.6] - 2026-10-29
10
+
11
+ ### Added
12
+ - `sb_add` và `sb_set` báo check `hidden_band` (một lần mỗi process) khi node bị ẩn ở base, vì cách đó chỉ ẩn từ 1440px trở lên, và nêu các cách ghi theo từng breakpoint để ẩn ở mọi độ rộng.
13
+ - `sb_add`, `sb_set` và `sb_review` báo `form_register_phone` với form đăng ký có trường số điện thoại không tên `phone`.
14
+
15
+ ### Fixed
16
+ - `sb_set` và `sb_add` ghi `config.hidden` đặt ở desktop vào base, vì renderer chỉ đọc base cho desktop và không bao giờ đọc slot desktop mà giá trị này từng được ghi vào.
17
+
9
18
  ## [0.98.5] - 2026-10-29
10
19
 
11
20
  ### Added
@@ -45,17 +45,25 @@ const EXCEPTIONS = new Set(BASE_ONLY_EXCEPTIONS);
45
45
  export function isBaseOnlyConfig(type, key) {
46
46
  return BASE_ONLY.has(key) && !EXCEPTIONS.has(`${type}:${key}`);
47
47
  }
48
+ /**
49
+ * `config.hidden` AT DESKTOP IS THE BASE KEY. It does not cascade: desktop reads
50
+ * `node.config.hidden` and every narrower band only its own slot
51
+ * (render/css.go hiddenAt, editor trait/display.ts isHiddenAt), so
52
+ * `responsive.desktop.config.hidden` — where a default sb_set landed — is read by
53
+ * nothing. Not reported as base-only: it is not, at any other breakpoint.
54
+ */
55
+ const atBase = (type, key, bp) => isBaseOnlyConfig(type, key) || (key === 'hidden' && bp === 'desktop');
48
56
  /**
49
57
  * Split a config write into the keys that must land at base and the rest.
50
58
  *
51
59
  * Both halves are returned even when one is empty, so the caller writes the same
52
60
  * two patch groups every time rather than branching on which case it is in.
53
61
  */
54
- export function splitBaseOnly(type, keys) {
62
+ export function splitBaseOnly(type, keys, bp) {
55
63
  const base = {};
56
64
  const responsive = {};
57
65
  for (const [k, v] of Object.entries(keys)) {
58
- if (isBaseOnlyConfig(type, k))
66
+ if (atBase(type, k, bp))
59
67
  base[k] = v;
60
68
  else
61
69
  responsive[k] = v;
@@ -63,11 +71,11 @@ export function splitBaseOnly(type, keys) {
63
71
  return { base, responsive };
64
72
  }
65
73
  /** The same split for `unset`, which shares the slot a write lands in. */
66
- export function splitBaseOnlyKeys(type, keys) {
74
+ export function splitBaseOnlyKeys(type, keys, bp) {
67
75
  const base = [];
68
76
  const responsive = [];
69
77
  for (const k of keys) {
70
- if (isBaseOnlyConfig(type, k))
78
+ if (atBase(type, k, bp))
71
79
  base.push(k);
72
80
  else
73
81
  responsive.push(k);
@@ -169,7 +169,7 @@ export function addSubtree(doc, parentId, spec, index, guard) {
169
169
  if (responsive) {
170
170
  responsive = {};
171
171
  for (const [bp, slot] of Object.entries(s.responsive)) {
172
- const split = splitBaseOnly(s.type, slot.config ?? {});
172
+ const split = splitBaseOnly(s.type, slot.config ?? {}, bp);
173
173
  if (Object.keys(split.base).length)
174
174
  config = { ...config, ...split.base };
175
175
  responsive[bp] = { ...slot, ...(slot.config ? { config: split.responsive } : {}) };
@@ -508,9 +508,9 @@ export function setKeys(doc, id, keys, opts) {
508
508
  // routing precedent: the caller's intent is not in doubt, but a caller who
509
509
  // reads the node back must not have to hunt for the keys.
510
510
  const type = doc.node(id).data.type;
511
- const split = namespace === 'config' ? splitBaseOnly(type, keys) : { base: {}, responsive: keys };
511
+ const split = namespace === 'config' ? splitBaseOnly(type, keys, bp) : { base: {}, responsive: keys };
512
512
  const unsetSplit = namespace === 'config'
513
- ? splitBaseOnlyKeys(type, opts.unset ?? [])
513
+ ? splitBaseOnlyKeys(type, opts.unset ?? [], bp)
514
514
  : { base: [], responsive: opts.unset ?? [] };
515
515
  return [
516
516
  ...Object.entries(split.responsive).map(([k, v]) => ({
@@ -179,6 +179,8 @@ export const FIX = {
179
179
  form_booking_dates: 'Keep one date (an appointment) or two (a stay: check-in then check-out) — sb_remove id ' +
180
180
  '"<id>", or ask for it as text. Booking rules (closedDates, min/maxStayNights, capacity) ' +
181
181
  'read only the first two date fields.',
182
+ form_register_phone: 'sb_set id "<id>", namespace specials, keys { "name": "phone", "mapTo": "customer.phone", "inputType": "tel" } ' +
183
+ '— the palette\'s contact-phone row, the one name the sign-up reads.',
182
184
  };
183
185
  /** The template for `code`, with every `<name>` in `vars` substituted. */
184
186
  export function fill(code, vars) {
@@ -170,6 +170,27 @@ export function formFieldFindings(d, formType) {
170
170
  });
171
171
  }
172
172
  }
173
+ // A REGISTER form stores a phone only from the control named exactly `phone`
174
+ // (web_builder 6427c495b, runtime form.ts authValues — the palette's
175
+ // contact-phone row): any other name answers 200 and saves phone "". Silent
176
+ // when some field already posts as `phone`; the re-entry box is not a phone.
177
+ if (formType === 'register') {
178
+ const fields = formFields(d).filter((n) => collectsValue(n.data.type));
179
+ const phoneish = fields.find((n) => {
180
+ const s = n.specials ?? {};
181
+ return s.mapTo === 'customer.phone' || (s.inputType === 'tel' && s.mapTo !== 'customer.confirmPhone');
182
+ });
183
+ if (phoneish && !fields.some((n) => postedName(n) === 'phone')) {
184
+ out.push({
185
+ code: 'form_register_phone',
186
+ nodeId: phoneish.id,
187
+ type: phoneish.data.type,
188
+ key: 'name',
189
+ problem: `A register form saves the customer's phone only from the field named "phone"; this one posts as ` +
190
+ `"${postedName(phoneish)}", so every sign-up stores an empty phone.`,
191
+ });
192
+ }
193
+ }
173
194
  return out;
174
195
  }
175
196
  /** A posted-name suggestion from a label: "Dịch vụ" → "dich_vu". */
@@ -441,6 +441,34 @@ export function cascadeTail(node, written, id) {
441
441
  }
442
442
  return out;
443
443
  }
444
+ /**
445
+ * `config.hidden` IS PER BAND AND NEVER CASCADES (render/css.go hiddenAt,
446
+ * editor trait/display.ts isHiddenAt): base hides the node at ≥1440px ONLY, and
447
+ * laptop / tablet / mobile each read their own slot alone. An agent hiding at
448
+ * base expects it gone everywhere, so say which bands still show it — once per
449
+ * process, since the fact is the same for every node. `node` is AS IT WILL BE.
450
+ */
451
+ export function hiddenBand(node, id) {
452
+ if (node.config?.hidden !== true)
453
+ return [];
454
+ const shown = ['laptop', 'tablet', 'mobile'].filter((bp) => node.responsive?.[bp]?.config?.hidden !== true);
455
+ if (!shown.length)
456
+ return [];
457
+ return [
458
+ {
459
+ once: 'hidden-band',
460
+ note: {
461
+ code: 'hidden_band',
462
+ ...(id ? { id } : {}),
463
+ key: 'config.hidden',
464
+ problem: 'config.hidden does not cascade: at base it hides the node at ≥1440px only; laptop (1025–1439), ' +
465
+ `tablet (768–1024) and mobile (≤767) each read their own slot, so ${shown.join(', ')} still show it.`,
466
+ fix: `To hide it at every width, also write hidden:true at breakpoint ${shown.map((b) => `"${b}"`).join(', ')} — ` +
467
+ 'one sb_set with edits[] (sb_add: responsive.<bp>.config). To drop it from the page instead, sb_remove it.',
468
+ },
469
+ },
470
+ ];
471
+ }
444
472
  /** The same, for every node of a nested `sb_add` spec, as each will be born. */
445
473
  export function specCheck(spec, idOf) {
446
474
  const out = [];
@@ -451,6 +479,8 @@ export function specCheck(spec, idOf) {
451
479
  const born = d?.specials ?? {};
452
480
  if (s.config)
453
481
  out.push(...writeCheck(s.type, 'config', s.config));
482
+ // Born as addSubtree stores it: a desktop-slot `hidden` lands at base.
483
+ out.push(...hiddenBand({ config: { hidden: s.responsive?.desktop?.config?.hidden ?? s.config?.hidden }, responsive: s.responsive }, id));
454
484
  for (const slot of Object.values(s.responsive ?? {}))
455
485
  if (slot.config)
456
486
  out.push(...writeCheck(s.type, 'config', slot.config));
@@ -22,7 +22,7 @@ import { request, redact, watchPageWrites, onPageSourceWrite, onGlobalWrite, onF
22
22
  import { SPEC_GLOBAL_ID, SPEC_GLOBAL_REV, SPEC_OVERLAY_ID, SPEC_OVERLAY_REV, subtreeIds } from '../core/tree.js';
23
23
  import { siteToken } from './credentialpick.js';
24
24
  import { validateForSave } from '../domains/site/validate.js';
25
- import { cascadeTail, formDocChecks, sayChecks, specCheck, writeCheck } from '../domains/site/writecheck.js';
25
+ import { cascadeTail, formDocChecks, hiddenBand, sayChecks, specCheck, writeCheck } from '../domains/site/writecheck.js';
26
26
  import { reviewDesign, REVIEW_NOTICE } from '../domains/site/review.js';
27
27
  import { exampleCopy } from '../domains/site/examplecopy.js';
28
28
  import { compactFindings } from '../domains/site/findings.js';
@@ -1713,7 +1713,17 @@ export function registerPageTools(server, ctx) {
1713
1713
  applyPatches(probe, patches.filter((p) => p.path[0] === 'nodes' && p.path[1] === e.id));
1714
1714
  return cascadeTail(probe.nodes[e.id], { [bp]: e.keys }, e.id);
1715
1715
  });
1716
- const found = sayChecks([...checked, ...tail, ...session.formChecks(patches)], say);
1716
+ // config.hidden at base/desktop hides ≥1440px only — judged on the node
1717
+ // AS IT WILL BE, so a batch that hides every band says nothing.
1718
+ const hidden = batch.flatMap((e) => {
1719
+ const bp = e.breakpoint ?? 'desktop';
1720
+ if (e.namespace !== 'config' || e.state || e.keys.hidden !== true || (!e.base && bp !== 'desktop') || !d.doc.nodes[e.id])
1721
+ return [];
1722
+ const probe = { nodes: { [e.id]: JSON.parse(JSON.stringify(d.doc.nodes[e.id])) } };
1723
+ applyPatches(probe, patches.filter((p) => p.path[0] === 'nodes' && p.path[1] === e.id));
1724
+ return hiddenBand(probe.nodes[e.id], e.id);
1725
+ });
1726
+ const found = sayChecks([...checked, ...tail, ...hidden, ...session.formChecks(patches)], say);
1717
1727
  const checks = found.length ? { checks: found } : {};
1718
1728
  // A FIELD-SKIN KNOB ON THE WRONG NODE renders nowhere. The FORM dresses
1719
1729
  // every field it holds with the input vocabulary; a payment card, choice
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbuilder-mcp",
3
- "version": "0.98.5",
3
+ "version": "0.98.6",
4
4
  "description": "MCP server that designs and operates a Store Builder site — pages, data, theme and publish — through the platform's own API and live-edit protocol.",
5
5
  "mcpName": "io.github.vuluu2k/sbuilder-mcp",
6
6
  "type": "module",