sbuilder-mcp 0.98.0 → 0.98.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.
package/CHANGELOG.md CHANGED
@@ -6,6 +6,23 @@ 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.2] - 2026-10-28
10
+
11
+ ### Added
12
+ - `sb_review` and `sb_add` report `rich_dropped` when `specials.textHtml` contains tags or attributes outside the platform's inline allowlist, because the platform drops the whole value and renders plain escaped `text`.
13
+
14
+ ### Changed
15
+ - `sb_add` and `sb_set` explain `base_only` once and list the affected keys instead of repeating the explanation per key.
16
+
17
+ ### Fixed
18
+ - `sb_review` no longer reports `no_data_context` for `product.*` bindings inside a cart-item, because each cart line supplies its own product keys.
19
+ - `sb_add` no longer shows position-dependent inert hints (accordion-content, menu-drawer, satellite) when the parent is already the owning node.
20
+
21
+ ## [0.98.1] - 2026-10-28
22
+
23
+ ### Fixed
24
+ - `sb_set` can re-source an element whose stored `kind` is an empty string, because an empty `kind` now reads as the element's default kind instead of an unknown one.
25
+
9
26
  ## [0.98.0] - 2026-10-28
10
27
 
11
28
  ### Added
package/CHANGELOG.vi.md CHANGED
@@ -6,6 +6,23 @@ 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.2] - 2026-10-28
10
+
11
+ ### Added
12
+ - `sb_review` và `sb_add` báo `rich_dropped` khi `specials.textHtml` chứa thẻ hoặc thuộc tính ngoài allowlist inline của nền tảng, vì nền tảng bỏ nguyên giá trị và hiển thị `text` thường đã escape.
13
+
14
+ ### Changed
15
+ - `sb_add` và `sb_set` giải thích `base_only` một lần và liệt kê các key bị ảnh hưởng thay vì lặp lại lời giải thích cho từng key.
16
+
17
+ ### Fixed
18
+ - `sb_review` không còn báo `no_data_context` cho binding `product.*` trong cart-item, vì mỗi dòng giỏ hàng tự cung cấp các key product.
19
+ - `sb_add` không còn hiện gợi ý inert phụ thuộc vị trí (accordion-content, menu-drawer, satellite) khi cha đã là node chủ.
20
+
21
+ ## [0.98.1] - 2026-10-28
22
+
23
+ ### Fixed
24
+ - `sb_set` đổi được nguồn của element có `kind` lưu là chuỗi rỗng, vì `kind` rỗng giờ được đọc như kind mặc định của element thay vì kind lạ.
25
+
9
26
  ## [0.98.0] - 2026-10-28
10
27
 
11
28
  ### Added
@@ -1,6 +1,6 @@
1
1
  export const DEAD_KEY_SOURCE = {
2
- "files": 6029,
3
- "identifiers": 110826,
2
+ "files": 6030,
3
+ "identifiers": 110841,
4
4
  "seededKeys": 460,
5
5
  "dead": 0
6
6
  };
@@ -0,0 +1,52 @@
1
+ // GENERATED by scripts/gen-catalog.ts — do not edit by hand.
2
+ // Source: <WB_REPO>/server/pkg/sanitize/inline.go (InlineRichSpecials) and
3
+ // server/pkg/sanitize/sanitize.go (inlineTags, globalAttrs, tagAttrs), the
4
+ // allowlists sanitize.IsInlineRepresentable checks for scope.GateInlineRichSpecials.
5
+ /**
6
+ * A rich special (`specials.<key>`) holding a tag or attribute outside these
7
+ * lists is DELETED at render, whole, and the node shows its escaped plain text.
8
+ */
9
+ export const INLINE_RICH = {
10
+ "specials": [
11
+ "textHtml"
12
+ ],
13
+ "tags": [
14
+ "strong",
15
+ "b",
16
+ "em",
17
+ "i",
18
+ "u",
19
+ "s",
20
+ "sup",
21
+ "sub",
22
+ "mark",
23
+ "span",
24
+ "a",
25
+ "br"
26
+ ],
27
+ "globalAttrs": [
28
+ "title",
29
+ "style"
30
+ ],
31
+ "tagAttrs": {
32
+ "a": [
33
+ "href",
34
+ "target",
35
+ "rel"
36
+ ],
37
+ "img": [
38
+ "src",
39
+ "alt",
40
+ "width",
41
+ "height"
42
+ ],
43
+ "td": [
44
+ "colspan",
45
+ "rowspan"
46
+ ],
47
+ "th": [
48
+ "colspan",
49
+ "rowspan"
50
+ ]
51
+ }
52
+ };
@@ -1,7 +1,7 @@
1
1
  // GENERATED by scripts/gen-catalog.ts — do not edit by hand.
2
2
  // The platform commit every other generated file here describes.
3
3
  export const PLATFORM_SOURCE = {
4
- "commit": "530eb851417cce34c8255789e5efa454004955cc",
5
- "committedAt": "2026-10-28T15:42:20+07:00",
4
+ "commit": "ffe952be6a095440ae6498761718e4fcb9cac336",
5
+ "committedAt": "2026-10-28T17:25:38+07:00",
6
6
  "dirty": false
7
7
  };
@@ -1,3 +1,53 @@
1
+ /**
2
+ * ELEMENTS THAT RENDER CONVINCINGLY WHILE DOING NOTHING.
3
+ *
4
+ * The ordinary silent failure in this platform is a value stored where nothing
5
+ * reads it. This is the other shape: the element renders, looks finished, and is
6
+ * wired to nothing — so neither `sb_review` (which reads the tree, and the tree
7
+ * is correct) nor `sb_look` (which photographs the page, and the page looks
8
+ * right) can see it. The only moment the fact is cheap to deliver is the moment
9
+ * the element is ADDED, which is what this table is for.
10
+ *
11
+ * Each entry names what the element still NEEDS, because in every case the first
12
+ * write — dropping it on the page — succeeds completely. For most that is a
13
+ * second WRITE: a config key to point at a host, an id to reference, a setting
14
+ * to turn on. For a few it is a CONDITION the agent cannot write at all —
15
+ * `rating-stars` renders zero pixels until the store has published reviews, and
16
+ * says so rather than offering a fix that does not exist. Both shapes belong;
17
+ * the header used to promise only the first, which stopped being true the day
18
+ * the table was audited from three entries to twenty.
19
+ *
20
+ * NOT every element that can render empty belongs here. A list with no products
21
+ * yet is a CORRECT list waiting for data — it shows its own honest empty state,
22
+ * and the catalogue check already reports it. What belongs is narrower: a
23
+ * competent author who did the first, obvious thing would be SURPRISED, because
24
+ * nothing anywhere — not the tree, not the screenshot, not an error — says so.
25
+ *
26
+ * This table is hand-kept, and it will go stale on the next platform release —
27
+ * `quickview` was the proof once already: it arrived with the element, and this
28
+ * table did not know. It cannot be generated today. Fourteen of the eighteen
29
+ * element types that appear in some parent's `childAllows` genuinely need one
30
+ * (`tab-content`, `list-item`, …) and four are just general elements a permissive
31
+ * parent happens to accept (`heading` inside `search-input`, `image` inside
32
+ * `image-marquee`) — nothing on the meta separates the two. `locked` is true for
33
+ * only some of the entries below and false on others that belong just as much
34
+ * (`bundle-items`, `chat-widget`); `hideInLayer` is false on all of them; and
35
+ * `category` puts a real trap (`accordion-content`) in the same bucket as
36
+ * ordinary content (`heading`) that is not one. The durable fix is upstream: a
37
+ * flag on the element meta saying it renders only through a host, or only once
38
+ * a named condition (an app, a locale count, a signed grant) is met — until the
39
+ * platform declares that, this table is the only place the fact lives.
40
+ *
41
+ * The staleness is DETECTED now, even though the table still cannot be
42
+ * generated: `scripts/inert-drift.ts` runs on every codegen and every
43
+ * `codegen:check`, matching each element's own prose against the render language
44
+ * every kept entry here uses ("only renders inside/through/as"), and warning
45
+ * about any that is in neither this table nor its `AUDIT_REJECTED` ledger. It
46
+ * catches 15 of the 21 below — enough to warn, nowhere near enough to generate —
47
+ * and it would have caught `quickview`. An element REJECTED after being read
48
+ * against the criterion above belongs in that ledger with its reason, not here.
49
+ */
50
+ import { SATELLITE_RULES } from '../../catalog/elements.generated.js';
1
51
  export const INERT_ON_ADD = {
2
52
  // `localeSwitchPayload` returns "" below two languages, and the renderer's
3
53
  // fallback is a FABRICATED chip — `sample = {Code: "VI", Name: "Tiếng Việt",
@@ -181,6 +231,7 @@ export const INERT_ON_ADD = {
181
231
  'other container it is accepted (nothing refuses it) and, per its own AVOID, does not ' +
182
232
  'render there. Add it only as a child of an accordion; for a standalone section use ' +
183
233
  'flex-section instead.',
234
+ host: 'accordion',
184
235
  },
185
236
  // hamburger-menu is a container with NO childAllows restriction, so it
186
237
  // accepts a menu-drawer anywhere in the page just as readily as inside
@@ -191,6 +242,7 @@ export const INERT_ON_ADD = {
191
242
  'drawer placed elsewhere on the page, and per its own AVOID it then "only renders as that ' +
192
243
  "element's panel,\" i.e. never. Add it under the hamburger-menu it should belong to, not " +
193
244
  'beside it.',
245
+ host: 'hamburger-menu',
194
246
  },
195
247
  // `menu` itself cannot hold children at all (isContainer: false), so a
196
248
  // menu-panel is wired from the MENU ENTRY's own configuration, never from
@@ -207,12 +259,23 @@ export const INERT_ON_ADD = {
207
259
  export function inertHint(type) {
208
260
  return INERT_ON_ADD[type]?.note ?? null;
209
261
  }
210
- /** Every distinct hint for the types in a subtree spec, deduped, in add order. */
211
- export function inertHintsFor(types) {
262
+ /** Does `type` render under a parent of `parent`'s type (its host, or a satellite owner)? */
263
+ function hosted(type, parent) {
264
+ if (!parent)
265
+ return false;
266
+ return INERT_ON_ADD[type]?.host === parent || !!SATELLITE_RULES[parent]?.some((r) => r.type === type);
267
+ }
268
+ /**
269
+ * Every distinct hint for the nodes of a subtree spec, deduped, in add order.
270
+ * A node may carry its parent's TYPE, which silences a hint about placement
271
+ * when the placement is the right one.
272
+ */
273
+ export function inertHintsFor(placed) {
212
274
  const seen = new Set();
213
275
  const out = [];
214
- for (const t of types) {
215
- if (seen.has(t))
276
+ for (const p of placed) {
277
+ const { type: t, parent } = typeof p === 'string' ? { type: p, parent: undefined } : p;
278
+ if (seen.has(t) || hosted(t, parent))
216
279
  continue;
217
280
  const note = inertHint(t);
218
281
  if (!note)
@@ -59,7 +59,8 @@ export function bindingsForConfig(type, config) {
59
59
  return null;
60
60
  // An absent kind is the element's default kind — the factory's own reading.
61
61
  const defaults = ELEMENTS[type]?.defaults.config ?? {};
62
- const kind = String(config?.kind ?? defaults.kind ?? '');
62
+ // An EMPTY kind is no choice either, so a stored `kind: ""` can still be re-sourced.
63
+ const kind = String(config?.kind || defaults.kind || '');
63
64
  const source = String(config?.datasetSource ?? (kind && kind !== String(defaults.kind ?? '') ? (defaults.datasetSource ?? 'product') : ''));
64
65
  if (!source)
65
66
  return null;
@@ -608,7 +608,12 @@ opts = {}) {
608
608
  const missing = (n.bindings ?? [])
609
609
  .map((b) => String(b?.source ?? '').split('.')[0])
610
610
  .find((e) => RECORD_ENTITIES.has(e) && !entities.includes(e));
611
- const supplied = missing && ROW_SUPPLIER[missing] ? insideType(d, id, ROW_SUPPLIER[missing]) : false;
611
+ // A CART LINE FILLS THE PRODUCT KEYS: `scope.CartLineContext` writes
612
+ // product.title/image/price per line rather than a cartLine.* twin, so a
613
+ // product-bound element in a cart row is supplied on any page type.
614
+ const supplied = missing && ROW_SUPPLIER[missing]
615
+ ? insideType(d, id, ROW_SUPPLIER[missing])
616
+ : missing === 'product' && insideType(d, id, 'cart-item');
612
617
  if (missing && !supplied && !pinnedAbove(d, id)) {
613
618
  out.push({
614
619
  code: 'no_data_context',
@@ -5,6 +5,7 @@ import { fill } from './findings.js';
5
5
  import { collectsValue, formFieldFindings, formFields, nameFromLabel } from './formdoc.js';
6
6
  import { ICON_KEYS } from '../../catalog/icons.generated.js';
7
7
  import { TRANSLATABLE_SPECIALS } from '../../catalog/translations.generated.js';
8
+ import { INLINE_RICH } from '../../catalog/richtext.generated.js';
8
9
  import { iconNote } from './icons.js';
9
10
  import { animationNote, deadKeyNote, preconditionNotes, unknownValueNote, unknownWriteNote, unsupportedSettingNote, } from './vocabulary.js';
10
11
  /**
@@ -117,6 +118,32 @@ export function bindableFields(type) {
117
118
  }
118
119
  /** A tag a writer means as formatting, not a stray `<` in copy ("Giá < 100k"). */
119
120
  const MARKUP = /<\/?(?:b|strong|i|em|u|s|span|br|a|p|div|small|mark|sup|sub|h[1-6])(?:\s[^>]*)?\/?>/i;
121
+ /**
122
+ * What in a gated rich special `sanitize.IsInlineRepresentable` refuses: a tag
123
+ * outside the editor schema's inline vocabulary, or an attribute outside the
124
+ * global/per-tag allowlists. Any one and `GateInlineRichSpecials` deletes the
125
+ * WHOLE value. ponytail: tags and attribute names only — an unsafe href scheme
126
+ * or an HTML comment is refused too and not named here.
127
+ */
128
+ function richOffenders(v) {
129
+ const out = new Set();
130
+ const tags = INLINE_RICH.tags;
131
+ const globalAttrs = INLINE_RICH.globalAttrs;
132
+ const tagAttrs = INLINE_RICH.tagAttrs;
133
+ for (const m of v.matchAll(/<\/?([a-zA-Z][\w-]*)([^>]*)>/g)) {
134
+ const tag = m[1].toLowerCase();
135
+ if (!tags.includes(tag)) {
136
+ out.add(`<${tag}>`);
137
+ continue;
138
+ }
139
+ for (const a of m[2].matchAll(/([^\s=/>"']+)(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?/g)) {
140
+ const name = a[1].toLowerCase();
141
+ if (!globalAttrs.includes(name) && !tagAttrs[tag]?.includes(name))
142
+ out.add(`<${tag} ${name}>`);
143
+ }
144
+ }
145
+ return [...out];
146
+ }
120
147
  /**
121
148
  * Check one write. `specials` is the node's specials AS THEY WILL BE after the
122
149
  * write, for the precondition question (a pair is legal or not together).
@@ -166,6 +193,16 @@ export function writeCheck(type, namespace, keys, opts = {}) {
166
193
  if (namespace === 'specials' && typeof v === 'string' && MARKUP.test(v) && TRANSLATABLE_SPECIALS[type]?.includes(`${k}Html`)) {
167
194
  push(`text-markup:${type}.${k}`, 'text_markup', k, `specials.${k} holds HTML tags, and ${type} renders it ESCAPED — the tags show as literal text on the page.`, `Write the markup to specials.${k}Html (the renderer prefers it) and keep a plain specials.${k} without tags beside it.`);
168
195
  }
196
+ // A RICH SPECIAL THE RENDER GATE DROPS WHOLE (scope.GateInlineRichSpecials):
197
+ // one block tag and the node shows its escaped plain text — measured live
198
+ // with <p> in textHtml, every bit of formatting gone and no error anywhere.
199
+ const rich = INLINE_RICH.specials;
200
+ const bad = namespace === 'specials' && typeof v === 'string' && rich.includes(k) ? richOffenders(v) : [];
201
+ if (bad.length) {
202
+ push(`rich-dropped:${type}.${k}:${bad.join(',')}`, 'rich_dropped', k, `specials.${k} holds ${bad.join(', ')}, which the editor's inline rich-text schema cannot produce — so the ` +
203
+ `platform DROPS the whole value at render and shows the escaped plain specials.${k.replace(/Html$/, '')} instead, with no error.`, `Keep to ${INLINE_RICH.tags.map((t) => `<${t}>`).join(' ')}; break a paragraph with <br> (or <br><br>), ` +
204
+ 'never <p>/<div>, and put a separate block in its own node.');
205
+ }
169
206
  if (namespace === 'specials') {
170
207
  const un = unsupportedSettingNote(type, k, v);
171
208
  if (un)
@@ -1468,17 +1468,20 @@ export function registerPageTools(server, ctx) {
1468
1468
  // right, so neither sb_review nor sb_look can see the gap — the moment
1469
1469
  // the element is added is the only cheap place to say it. In the dry run
1470
1470
  // too, so the caller is not told after committing.
1471
- const types = [];
1472
- const walkSpec = (n) => {
1473
- types.push(n.type);
1471
+ // Each node with its PARENT's type, so a hint about placement stays silent
1472
+ // when the placement is right (accordion-content under an accordion).
1473
+ const placed = [];
1474
+ const walkSpec = (n, parent) => {
1475
+ placed.push({ type: n.type, parent });
1474
1476
  for (const c of n.children ?? [])
1475
- walkSpec(c);
1477
+ walkSpec(c, n.type);
1476
1478
  };
1477
- walkSpec(spec);
1479
+ walkSpec(spec, d.doc.nodes[parent_id]?.data.type);
1480
+ const types = placed.map((p) => p.type);
1478
1481
  // A DRY RUN PEEKS: it must show what the real write will show, and the
1479
1482
  // real write must still have it to show.
1480
1483
  const say = noticeFor(ctx, dry_run);
1481
- const inert = inertHintsFor(types)
1484
+ const inert = inertHintsFor(placed)
1482
1485
  .map((h) => say(`inert:${h.type}`, h.note))
1483
1486
  .filter((n) => !!n)
1484
1487
  .join(' ');
@@ -1499,8 +1502,11 @@ export function registerPageTools(server, ctx) {
1499
1502
  walkMoved(c);
1500
1503
  };
1501
1504
  walkMoved(spec);
1502
- const moved = [...movedKeys].map(([k, bp]) => say(`base-only:${k}`, baseOnlyNote([k], bp))).filter((n) => !!n);
1503
- const base_only = moved.length ? { base_only: moved.join(' ') } : {};
1505
+ // Still once per KEY per process, but ONE explanation listing the new keys.
1506
+ const fresh = [...movedKeys].filter(([k]) => say(`base-only:${k}`, k));
1507
+ const base_only = fresh.length
1508
+ ? { base_only: baseOnlyNote(fresh.map(([k]) => k), [...new Set(fresh.map(([, bp]) => bp))].join('", "')) }
1509
+ : {};
1504
1510
  // A FILTER'S ROWS ARE WHAT IT RENDERS, and the editor writes them on save
1505
1511
  // from the facet read — so a filter added here was an empty box. Gated on
1506
1512
  // the spec naming a filter type, so no other add pays for the preview or
@@ -1641,10 +1647,9 @@ export function registerPageTools(server, ctx) {
1641
1647
  for (const k of baseOnlyKeys(d, e.id, e.keys, e))
1642
1648
  movedToBase.add(k);
1643
1649
  }
1644
- const baseNote = [...movedToBase]
1645
- .map((k) => say(`base-only:${k}`, baseOnlyNote([k], batch[0].breakpoint ?? 'desktop')))
1646
- .filter((n) => !!n)
1647
- .join(' ');
1650
+ // Spent per key, said ONCE: three keys used to carry the paragraph three times.
1651
+ const freshBase = [...movedToBase].filter((k) => say(`base-only:${k}`, k));
1652
+ const baseNote = freshBase.length ? baseOnlyNote(freshBase, batch[0].breakpoint ?? 'desktop') : '';
1648
1653
  // A LITERAL OVER A PRESET DETACHES THE NODE FROM THE THEME, permanently.
1649
1654
  // The node's own slot outranks its preset, so this is how one button
1650
1655
  // differs from the rest — an ordinary, correct thing to do. What is not
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbuilder-mcp",
3
- "version": "0.98.0",
3
+ "version": "0.98.2",
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",