sbuilder-mcp 0.98.3 → 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 +7 -0
- package/CHANGELOG.vi.md +7 -0
- package/dist/domains/site/review.js +8 -7
- package/dist/domains/site/writecheck.js +59 -17
- 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.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
|
+
|
|
9
16
|
## [0.98.3] - 2026-10-28
|
|
10
17
|
|
|
11
18
|
### Fixed
|
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.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
|
+
|
|
9
16
|
## [0.98.3] - 2026-10-28
|
|
10
17
|
|
|
11
18
|
### Fixed
|
|
@@ -188,12 +188,13 @@ const RECORD_ENTITIES = new Set(['product', 'category', 'course', 'article', 'bl
|
|
|
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
190
|
/**
|
|
191
|
-
* The product keys a cart line
|
|
192
|
-
*
|
|
193
|
-
*
|
|
194
|
-
* product
|
|
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.
|
|
195
196
|
*/
|
|
196
|
-
const CART_LINE_KEYS = new Set(['product.title', 'product.image', 'product.price'
|
|
197
|
+
const CART_LINE_KEYS = new Set(['product.title', 'product.image', 'product.price']);
|
|
197
198
|
/** Does this node sit inside an element of `type`? */
|
|
198
199
|
function insideType(d, id, type) {
|
|
199
200
|
for (let x = d.nodes[id]?.data.parent; x && d.nodes[x]; x = d.nodes[x].data.parent) {
|
|
@@ -613,8 +614,8 @@ opts = {}) {
|
|
|
613
614
|
if (opts.pageType !== undefined && !inRepeater.get(id) && !inOverlay.has(id)) {
|
|
614
615
|
const entities = PAGE_ENTITIES[opts.pageType] ?? [];
|
|
615
616
|
const sources = (n.bindings ?? []).map((b) => String(b?.source ?? ''));
|
|
616
|
-
// A CART LINE
|
|
617
|
-
// product.title/image/price
|
|
617
|
+
// A CART LINE DRIVES SOME PRODUCT KEYS: `rowDirectiveFor` carries
|
|
618
|
+
// product.title/image/price per line rather than a cartLine.*
|
|
618
619
|
// twin. A node the line drives (one of those, or the row's own stepper)
|
|
619
620
|
// is supplied; its seeded extras (compareAtPrice, product.id) render
|
|
620
621
|
// empty in a line, which is what the platform's own drawer seed ships.
|
|
@@ -130,40 +130,82 @@ function richOffenders(v) {
|
|
|
130
130
|
const tags = INLINE_RICH.tags;
|
|
131
131
|
const globalAttrs = INLINE_RICH.globalAttrs;
|
|
132
132
|
const tagAttrs = INLINE_RICH.tagAttrs;
|
|
133
|
-
|
|
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, ' ')))
|
|
134
137
|
out.add('<!-- -->');
|
|
135
|
-
for (const m of v.matchAll(
|
|
136
|
-
const tag = m[
|
|
138
|
+
for (const m of v.matchAll(TAG)) {
|
|
139
|
+
const tag = m[2].toLowerCase();
|
|
137
140
|
if (!tags.includes(tag)) {
|
|
138
141
|
out.add(`<${tag}>`);
|
|
139
142
|
continue;
|
|
140
143
|
}
|
|
141
|
-
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)) {
|
|
142
148
|
const name = a[1].toLowerCase();
|
|
143
|
-
|
|
144
|
-
if (!globalAttrs.includes(name) && !tagAttrs[tag]?.includes(name))
|
|
149
|
+
if (!globalAttrs.includes(name) && !tagAttrs[tag]?.includes(name)) {
|
|
145
150
|
out.add(`<${tag} ${name}>`);
|
|
146
|
-
|
|
147
|
-
|
|
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}:…">`);
|
|
148
156
|
}
|
|
149
157
|
}
|
|
150
158
|
return [...out];
|
|
151
159
|
}
|
|
152
|
-
/**
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
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, '');
|
|
157
199
|
const colon = t.indexOf(':');
|
|
158
200
|
if (colon < 0)
|
|
159
|
-
return
|
|
201
|
+
return null;
|
|
160
202
|
const i = t.search(/[/?#]/);
|
|
161
203
|
if (i >= 0 && i < colon)
|
|
162
|
-
return
|
|
204
|
+
return null;
|
|
163
205
|
const scheme = t.slice(0, colon).toLowerCase();
|
|
164
206
|
if (['http', 'https', 'mailto', 'tel'].includes(scheme))
|
|
165
|
-
return
|
|
166
|
-
return scheme === 'data' && t.toLowerCase().startsWith('data:image/');
|
|
207
|
+
return null;
|
|
208
|
+
return scheme === 'data' && t.toLowerCase().startsWith('data:image/') ? null : t.slice(0, colon);
|
|
167
209
|
}
|
|
168
210
|
/**
|
|
169
211
|
* Check one write. `specials` is the node's specials AS THEY WILL BE after the
|
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",
|