sbuilder-mcp 0.98.2 → 0.98.3
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 +7 -0
- package/CHANGELOG.vi.md +7 -0
- package/dist/domains/site/review.js +27 -12
- package/dist/domains/site/writecheck.js +28 -6
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,13 @@ 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.3] - 2026-10-28
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- `sb_review` reports `no_data_context` for a cart-item only when it sits outside a cart-order or binds keys a cart line does not fill, because a cart line supplies just `product.title`, `product.image`, `product.price` and `product.priceCents`.
|
|
13
|
+
- `sb_review` no longer reports `no_data_context` for pricing or media seed keys inside a cart line that also binds a key the line fills.
|
|
14
|
+
- `sb_review` and `sb_add` report `rich_dropped` for `specials.textHtml` containing `javascript:` or non-image `data:` URLs, entity-encoded colons, comments and doctypes, and tags hidden behind `>` inside quoted attribute values.
|
|
15
|
+
|
|
9
16
|
## [0.98.2] - 2026-10-28
|
|
10
17
|
|
|
11
18
|
### Added
|
package/CHANGELOG.vi.md
CHANGED
|
@@ -6,6 +6,13 @@ 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.3] - 2026-10-28
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- `sb_review` chỉ báo `no_data_context` cho cart-item khi nó nằm ngoài cart-order hoặc gắn các key mà dòng giỏ hàng không điền, vì dòng giỏ hàng chỉ cung cấp `product.title`, `product.image`, `product.price` và `product.priceCents`.
|
|
13
|
+
- `sb_review` không còn báo `no_data_context` cho các key seed của pricing hoặc media trong dòng giỏ hàng có gắn thêm một key mà dòng đó điền.
|
|
14
|
+
- `sb_review` và `sb_add` báo `rich_dropped` cho `specials.textHtml` chứa URL `javascript:` hoặc `data:` không phải ảnh, dấu `:` mã hóa thực thể, comment và doctype, cùng thẻ ẩn sau `>` trong giá trị thuộc tính có ngoặc.
|
|
15
|
+
|
|
9
16
|
## [0.98.2] - 2026-10-28
|
|
10
17
|
|
|
11
18
|
### Added
|
|
@@ -187,6 +187,13 @@ function contrast(a, b) {
|
|
|
187
187
|
const RECORD_ENTITIES = new Set(['product', 'category', 'course', 'article', 'blogCategory', 'brand', 'cartLine']);
|
|
188
188
|
/** A record only one element type's rows supply, which is not a dataset repeater. */
|
|
189
189
|
const ROW_SUPPLIER = { cartLine: 'cart-order' };
|
|
190
|
+
/**
|
|
191
|
+
* The product keys a cart line fills (scope.CartLineContext). Only cart-order
|
|
192
|
+
* paints its row with one (cart-order/html.go: kids[0] + PlaceholderCartLine),
|
|
193
|
+
* and the row drives just these plus the stepper (rowDirectiveFor) — any other
|
|
194
|
+
* product.* there renders the same empty value on every line.
|
|
195
|
+
*/
|
|
196
|
+
const CART_LINE_KEYS = new Set(['product.title', 'product.image', 'product.price', 'product.priceCents']);
|
|
190
197
|
/** Does this node sit inside an element of `type`? */
|
|
191
198
|
function insideType(d, id, type) {
|
|
192
199
|
for (let x = d.nodes[id]?.data.parent; x && d.nodes[x]; x = d.nodes[x].data.parent) {
|
|
@@ -605,24 +612,32 @@ opts = {}) {
|
|
|
605
612
|
// Overlays are skipped: one drawer serves every page type.
|
|
606
613
|
if (opts.pageType !== undefined && !inRepeater.get(id) && !inOverlay.has(id)) {
|
|
607
614
|
const entities = PAGE_ENTITIES[opts.pageType] ?? [];
|
|
608
|
-
const
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
// A
|
|
612
|
-
//
|
|
613
|
-
//
|
|
614
|
-
const
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
615
|
+
const sources = (n.bindings ?? []).map((b) => String(b?.source ?? ''));
|
|
616
|
+
// A CART LINE FILLS SOME PRODUCT KEYS: `scope.CartLineContext` writes
|
|
617
|
+
// product.title/image/price/priceCents per line rather than a cartLine.*
|
|
618
|
+
// twin. A node the line drives (one of those, or the row's own stepper)
|
|
619
|
+
// is supplied; its seeded extras (compareAtPrice, product.id) render
|
|
620
|
+
// empty in a line, which is what the platform's own drawer seed ships.
|
|
621
|
+
const inLine = insideType(d, id, 'cart-item') && insideType(d, id, 'cart-order');
|
|
622
|
+
const lineDriven = inLine && (type === 'quantity-dataset' || sources.some((s) => CART_LINE_KEYS.has(s)));
|
|
623
|
+
const missing = sources
|
|
624
|
+
.map((s) => s.split('.')[0])
|
|
625
|
+
.find((e) => RECORD_ENTITIES.has(e) &&
|
|
626
|
+
!entities.includes(e) &&
|
|
627
|
+
!(e === 'product' && lineDriven) &&
|
|
628
|
+
!(ROW_SUPPLIER[e] && insideType(d, id, ROW_SUPPLIER[e])));
|
|
629
|
+
if (missing && !pinnedAbove(d, id)) {
|
|
618
630
|
out.push({
|
|
619
631
|
code: 'no_data_context',
|
|
620
632
|
nodeId: id,
|
|
621
633
|
type,
|
|
622
634
|
problem: (ROW_SUPPLIER[missing]
|
|
623
635
|
? `Bound to a ${missing} field, but it sits outside any ${ROW_SUPPLIER[missing]} — only its line rows supply one, so it renders its placeholder on the published page.`
|
|
624
|
-
:
|
|
625
|
-
'
|
|
636
|
+
: missing === 'product' && inLine
|
|
637
|
+
? 'Bound to a product field a cart line does not fill — a line supplies only ' +
|
|
638
|
+
`${[...CART_LINE_KEYS].join(', ')}, so it renders the same empty value on every line.`
|
|
639
|
+
: `Bound to a ${missing} record, but it sits in no repeater and a "${opts.pageType}" ` +
|
|
640
|
+
'page supplies none — it renders its placeholder on the published page.'),
|
|
626
641
|
key: missing,
|
|
627
642
|
fix: fill('no_data_context', { id, key: missing }),
|
|
628
643
|
});
|
|
@@ -121,29 +121,50 @@ const MARKUP = /<\/?(?:b|strong|i|em|u|s|span|br|a|p|div|small|mark|sup|sub|h[1-
|
|
|
121
121
|
/**
|
|
122
122
|
* What in a gated rich special `sanitize.IsInlineRepresentable` refuses: a tag
|
|
123
123
|
* outside the editor schema's inline vocabulary, or an attribute outside the
|
|
124
|
-
* global/per-tag allowlists
|
|
125
|
-
*
|
|
126
|
-
*
|
|
124
|
+
* global/per-tag allowlists, an href whose scheme can run script, or a
|
|
125
|
+
* comment/doctype. Any one and `GateInlineRichSpecials` deletes the WHOLE value.
|
|
126
|
+
* Held to the platform's shared fixture by test/storefront-defects-1028.
|
|
127
127
|
*/
|
|
128
128
|
function richOffenders(v) {
|
|
129
129
|
const out = new Set();
|
|
130
130
|
const tags = INLINE_RICH.tags;
|
|
131
131
|
const globalAttrs = INLINE_RICH.globalAttrs;
|
|
132
132
|
const tagAttrs = INLINE_RICH.tagAttrs;
|
|
133
|
-
|
|
133
|
+
if (/<[!?]/.test(v))
|
|
134
|
+
out.add('<!-- -->');
|
|
135
|
+
for (const m of v.matchAll(/<\/?([a-zA-Z][\w-]*)((?:"[^"]*"|'[^']*'|[^"'>])*)>/g)) {
|
|
134
136
|
const tag = m[1].toLowerCase();
|
|
135
137
|
if (!tags.includes(tag)) {
|
|
136
138
|
out.add(`<${tag}>`);
|
|
137
139
|
continue;
|
|
138
140
|
}
|
|
139
|
-
for (const a of m[2].matchAll(/([^\s=/>"']+)(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^\s>]+))?/g)) {
|
|
141
|
+
for (const a of m[2].matchAll(/([^\s=/>"']+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)) {
|
|
140
142
|
const name = a[1].toLowerCase();
|
|
143
|
+
const val = a[2] ?? a[3] ?? a[4] ?? '';
|
|
141
144
|
if (!globalAttrs.includes(name) && !tagAttrs[tag]?.includes(name))
|
|
142
145
|
out.add(`<${tag} ${name}>`);
|
|
146
|
+
else if (name === 'href' && !safeURL(val))
|
|
147
|
+
out.add(`<${tag} href="${val.split(':')[0].trim()}:…">`);
|
|
143
148
|
}
|
|
144
149
|
}
|
|
145
150
|
return [...out];
|
|
146
151
|
}
|
|
152
|
+
/** server/pkg/sanitize safeURL: relative, http(s), mailto, tel, or data:image/. */
|
|
153
|
+
function safeURL(raw) {
|
|
154
|
+
// The Go tokenizer unescapes attribute values first; an encoded colon is the
|
|
155
|
+
// one entity that changes the verdict.
|
|
156
|
+
const t = raw.replace(/&(?:colon|#0*58|#x0*3a);?/gi, ':').trim();
|
|
157
|
+
const colon = t.indexOf(':');
|
|
158
|
+
if (colon < 0)
|
|
159
|
+
return true;
|
|
160
|
+
const i = t.search(/[/?#]/);
|
|
161
|
+
if (i >= 0 && i < colon)
|
|
162
|
+
return true;
|
|
163
|
+
const scheme = t.slice(0, colon).toLowerCase();
|
|
164
|
+
if (['http', 'https', 'mailto', 'tel'].includes(scheme))
|
|
165
|
+
return true;
|
|
166
|
+
return scheme === 'data' && t.toLowerCase().startsWith('data:image/');
|
|
167
|
+
}
|
|
147
168
|
/**
|
|
148
169
|
* Check one write. `specials` is the node's specials AS THEY WILL BE after the
|
|
149
170
|
* write, for the precondition question (a pair is legal or not together).
|
|
@@ -201,7 +222,8 @@ export function writeCheck(type, namespace, keys, opts = {}) {
|
|
|
201
222
|
if (bad.length) {
|
|
202
223
|
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
224
|
`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.'
|
|
225
|
+
'never <p>/<div>, and put a separate block in its own node. A link goes to http(s), mailto, tel or a ' +
|
|
226
|
+
'relative path; no comments.');
|
|
205
227
|
}
|
|
206
228
|
if (namespace === 'specials') {
|
|
207
229
|
const un = unsupportedSettingNote(type, k, v);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sbuilder-mcp",
|
|
3
|
-
"version": "0.98.
|
|
3
|
+
"version": "0.98.3",
|
|
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",
|