sbuilder-mcp 0.98.2 → 0.98.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.
- package/CHANGELOG.md +14 -0
- package/CHANGELOG.vi.md +14 -0
- package/dist/domains/site/review.js +28 -12
- package/dist/domains/site/writecheck.js +72 -8
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,20 @@ 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.4] - 2026-10-29
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- `sb_review` and `sb_add` report `rich_dropped` for `specials.textHtml` links whose `href` hides `javascript:` or `data:` behind numeric or named character references, and no longer flag malformed references such as `javascript&colonalert(1)`.
|
|
13
|
+
- `sb_review` and `sb_add` no longer report `rich_dropped` for a `<!` sequence inside a quoted attribute value or for attributes on a closing tag, and treat `</` followed by a non-letter as a comment.
|
|
14
|
+
- `sb_review` no longer treats `product.priceCents` as filled by a cart line, because each cart line renders a placeholder value for it.
|
|
15
|
+
|
|
16
|
+
## [0.98.3] - 2026-10-28
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- `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`.
|
|
20
|
+
- `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.
|
|
21
|
+
- `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.
|
|
22
|
+
|
|
9
23
|
## [0.98.2] - 2026-10-28
|
|
10
24
|
|
|
11
25
|
### Added
|
package/CHANGELOG.vi.md
CHANGED
|
@@ -6,6 +6,20 @@ 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.4] - 2026-10-29
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- `sb_review` và `sb_add` báo `rich_dropped` cho liên kết trong `specials.textHtml` có `href` giấu `javascript:` hoặc `data:` sau tham chiếu ký tự số hoặc tên, và không còn báo nhầm các tham chiếu sai cú pháp như `javascript&colonalert(1)`.
|
|
13
|
+
- `sb_review` và `sb_add` không còn báo `rich_dropped` cho chuỗi `<!` nằm trong giá trị thuộc tính có ngoặc hoặc cho thuộc tính trên thẻ đóng, và coi `</` theo sau bởi ký tự không phải chữ là comment.
|
|
14
|
+
- `sb_review` không còn coi `product.priceCents` là key được dòng giỏ hàng điền, vì mỗi dòng hiển thị giá trị placeholder cho key này.
|
|
15
|
+
|
|
16
|
+
## [0.98.3] - 2026-10-28
|
|
17
|
+
|
|
18
|
+
### Fixed
|
|
19
|
+
- `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`.
|
|
20
|
+
- `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.
|
|
21
|
+
- `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.
|
|
22
|
+
|
|
9
23
|
## [0.98.2] - 2026-10-28
|
|
10
24
|
|
|
11
25
|
### Added
|
|
@@ -187,6 +187,14 @@ 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 drives per line. Only cart-order paints its row
|
|
192
|
+
* (cart-order/html.go: kids[0] + PlaceholderCartLine), and only these plus the
|
|
193
|
+
* stepper get a row directive (render/html.go rowDirectiveFor). CartLineContext
|
|
194
|
+
* fills product.priceCents too, but no directive carries it, so an element bound
|
|
195
|
+
* to it alone keeps the placeholder line's value on every line.
|
|
196
|
+
*/
|
|
197
|
+
const CART_LINE_KEYS = new Set(['product.title', 'product.image', 'product.price']);
|
|
190
198
|
/** Does this node sit inside an element of `type`? */
|
|
191
199
|
function insideType(d, id, type) {
|
|
192
200
|
for (let x = d.nodes[id]?.data.parent; x && d.nodes[x]; x = d.nodes[x].data.parent) {
|
|
@@ -605,24 +613,32 @@ opts = {}) {
|
|
|
605
613
|
// Overlays are skipped: one drawer serves every page type.
|
|
606
614
|
if (opts.pageType !== undefined && !inRepeater.get(id) && !inOverlay.has(id)) {
|
|
607
615
|
const entities = PAGE_ENTITIES[opts.pageType] ?? [];
|
|
608
|
-
const
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
// A
|
|
612
|
-
//
|
|
613
|
-
//
|
|
614
|
-
const
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
616
|
+
const sources = (n.bindings ?? []).map((b) => String(b?.source ?? ''));
|
|
617
|
+
// A CART LINE DRIVES SOME PRODUCT KEYS: `rowDirectiveFor` carries
|
|
618
|
+
// product.title/image/price per line rather than a cartLine.*
|
|
619
|
+
// twin. A node the line drives (one of those, or the row's own stepper)
|
|
620
|
+
// is supplied; its seeded extras (compareAtPrice, product.id) render
|
|
621
|
+
// empty in a line, which is what the platform's own drawer seed ships.
|
|
622
|
+
const inLine = insideType(d, id, 'cart-item') && insideType(d, id, 'cart-order');
|
|
623
|
+
const lineDriven = inLine && (type === 'quantity-dataset' || sources.some((s) => CART_LINE_KEYS.has(s)));
|
|
624
|
+
const missing = sources
|
|
625
|
+
.map((s) => s.split('.')[0])
|
|
626
|
+
.find((e) => RECORD_ENTITIES.has(e) &&
|
|
627
|
+
!entities.includes(e) &&
|
|
628
|
+
!(e === 'product' && lineDriven) &&
|
|
629
|
+
!(ROW_SUPPLIER[e] && insideType(d, id, ROW_SUPPLIER[e])));
|
|
630
|
+
if (missing && !pinnedAbove(d, id)) {
|
|
618
631
|
out.push({
|
|
619
632
|
code: 'no_data_context',
|
|
620
633
|
nodeId: id,
|
|
621
634
|
type,
|
|
622
635
|
problem: (ROW_SUPPLIER[missing]
|
|
623
636
|
? `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
|
-
'
|
|
637
|
+
: missing === 'product' && inLine
|
|
638
|
+
? 'Bound to a product field a cart line does not fill — a line supplies only ' +
|
|
639
|
+
`${[...CART_LINE_KEYS].join(', ')}, so it renders the same empty value on every line.`
|
|
640
|
+
: `Bound to a ${missing} record, but it sits in no repeater and a "${opts.pageType}" ` +
|
|
641
|
+
'page supplies none — it renders its placeholder on the published page.'),
|
|
626
642
|
key: missing,
|
|
627
643
|
fix: fill('no_data_context', { id, key: missing }),
|
|
628
644
|
});
|
|
@@ -121,29 +121,92 @@ 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
|
-
|
|
134
|
-
|
|
133
|
+
const TAG = /<(\/?)([a-zA-Z][\w-]*)((?:"[^"]*"|'[^']*'|[^"'>])*)>/g;
|
|
134
|
+
// Go reads `<!`, `<?` and `</` + a non-letter as a comment — but only in
|
|
135
|
+
// TEXT, so tags (and the quoted values inside them) are blanked first.
|
|
136
|
+
if (/<[!?]|<\/[^a-zA-Z]/.test(v.replace(TAG, ' ')))
|
|
137
|
+
out.add('<!-- -->');
|
|
138
|
+
for (const m of v.matchAll(TAG)) {
|
|
139
|
+
const tag = m[2].toLowerCase();
|
|
135
140
|
if (!tags.includes(tag)) {
|
|
136
141
|
out.add(`<${tag}>`);
|
|
137
142
|
continue;
|
|
138
143
|
}
|
|
139
|
-
for
|
|
144
|
+
// The tokenizer returns no attributes for an END tag (TagAttr).
|
|
145
|
+
if (m[1])
|
|
146
|
+
continue;
|
|
147
|
+
for (const a of m[3].matchAll(/([^\s=/>"']+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+)))?/g)) {
|
|
140
148
|
const name = a[1].toLowerCase();
|
|
141
|
-
if (!globalAttrs.includes(name) && !tagAttrs[tag]?.includes(name))
|
|
149
|
+
if (!globalAttrs.includes(name) && !tagAttrs[tag]?.includes(name)) {
|
|
142
150
|
out.add(`<${tag} ${name}>`);
|
|
151
|
+
continue;
|
|
152
|
+
}
|
|
153
|
+
const scheme = name === 'href' ? unsafeScheme(a[2] ?? a[3] ?? a[4] ?? '') : null;
|
|
154
|
+
if (scheme !== null)
|
|
155
|
+
out.add(`<${tag} href="${scheme}:…">`);
|
|
143
156
|
}
|
|
144
157
|
}
|
|
145
158
|
return [...out];
|
|
146
159
|
}
|
|
160
|
+
/**
|
|
161
|
+
* The named references whose decoding can move safeURL's verdict — every entry
|
|
162
|
+
* of x/net/html's table (v0.56.0) that yields `:` `/` `?` `#` or a character
|
|
163
|
+
* strings.TrimSpace strips. Any other reference changes no verdict: undecoded
|
|
164
|
+
* or decoded, it is not a scheme letter, so leaving it verbatim is exact.
|
|
165
|
+
*/
|
|
166
|
+
const VERDICT_ENTITIES = {
|
|
167
|
+
'colon;': ':', 'sol;': '/', 'quest;': '?', 'num;': '#', 'Tab;': '\t', 'NewLine;': '\n',
|
|
168
|
+
'nbsp;': '\u00a0', nbsp: '\u00a0', 'NonBreakingSpace;': '\u00a0', 'ensp;': '\u2002', 'emsp;': '\u2003',
|
|
169
|
+
'emsp13;': '\u2004', 'emsp14;': '\u2005', 'numsp;': '\u2007', 'puncsp;': '\u2008', 'thinsp;': '\u2009',
|
|
170
|
+
'ThinSpace;': '\u2009', 'hairsp;': '\u200a', 'VeryThinSpace;': '\u200a', 'MediumSpace;': '\u205f',
|
|
171
|
+
'ThickSpace;': '\u205f\u200a',
|
|
172
|
+
};
|
|
173
|
+
/**
|
|
174
|
+
* html.unescape(val, attribute=true), one pass: a numeric reference with or
|
|
175
|
+
* without `;`; a named one only as spelled in the table, and one with no `;`
|
|
176
|
+
* left alone when `=` follows (unescapeEntity's attribute rule).
|
|
177
|
+
*/
|
|
178
|
+
function unescapeAttr(s) {
|
|
179
|
+
return s.replace(/&(?:#[xX]([0-9a-fA-F]+);?|#(\d+);?|([a-zA-Z0-9]+;?))/g, (all, hex, dec, name, at) => {
|
|
180
|
+
if (name !== undefined) {
|
|
181
|
+
const ch = VERDICT_ENTITIES[name];
|
|
182
|
+
return ch === undefined || (!name.endsWith(';') && s[at + all.length] === '=') ? all : ch;
|
|
183
|
+
}
|
|
184
|
+
const x = parseInt(hex ?? dec, hex ? 16 : 10);
|
|
185
|
+
// 0x80–0x9F is remapped through Windows-1252 in Go; no target is a verdict
|
|
186
|
+
// character, so the replacement character stands in for all of them.
|
|
187
|
+
const bad = x === 0 || (x >= 0x80 && x <= 0x9f) || (x >= 0xd800 && x <= 0xdfff) || x > 0x10ffff;
|
|
188
|
+
return String.fromCodePoint(bad ? 0xfffd : x);
|
|
189
|
+
});
|
|
190
|
+
}
|
|
191
|
+
/** strings.TrimSpace's set (unicode.IsSpace) — U+0085 in, U+FEFF out, unlike String#trim. */
|
|
192
|
+
const GO_TRIM = /^[\t\n\v\f\r \u0085\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000]+|[\t\n\v\f\r \u0085\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000]+$/g;
|
|
193
|
+
/**
|
|
194
|
+
* server/pkg/sanitize safeURL on the value the tokenizer hands it: null when
|
|
195
|
+
* relative, http(s), mailto, tel or data:image/; else the decoded scheme.
|
|
196
|
+
*/
|
|
197
|
+
function unsafeScheme(raw) {
|
|
198
|
+
const t = unescapeAttr(raw).replace(GO_TRIM, '');
|
|
199
|
+
const colon = t.indexOf(':');
|
|
200
|
+
if (colon < 0)
|
|
201
|
+
return null;
|
|
202
|
+
const i = t.search(/[/?#]/);
|
|
203
|
+
if (i >= 0 && i < colon)
|
|
204
|
+
return null;
|
|
205
|
+
const scheme = t.slice(0, colon).toLowerCase();
|
|
206
|
+
if (['http', 'https', 'mailto', 'tel'].includes(scheme))
|
|
207
|
+
return null;
|
|
208
|
+
return scheme === 'data' && t.toLowerCase().startsWith('data:image/') ? null : t.slice(0, colon);
|
|
209
|
+
}
|
|
147
210
|
/**
|
|
148
211
|
* Check one write. `specials` is the node's specials AS THEY WILL BE after the
|
|
149
212
|
* write, for the precondition question (a pair is legal or not together).
|
|
@@ -201,7 +264,8 @@ export function writeCheck(type, namespace, keys, opts = {}) {
|
|
|
201
264
|
if (bad.length) {
|
|
202
265
|
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
266
|
`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.'
|
|
267
|
+
'never <p>/<div>, and put a separate block in its own node. A link goes to http(s), mailto, tel or a ' +
|
|
268
|
+
'relative path; no comments.');
|
|
205
269
|
}
|
|
206
270
|
if (namespace === 'specials') {
|
|
207
271
|
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.4",
|
|
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",
|