sbuilder-mcp 0.100.1 → 0.100.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 +10 -0
- package/CHANGELOG.vi.md +10 -0
- package/dist/domains/site/findings.js +4 -0
- package/dist/domains/site/review.js +25 -1
- package/dist/tools/live.js +20 -1
- package/dist/vision/measure.js +25 -4
- package/dist/vision/shoot.js +1 -0
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,16 @@ 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.100.2] - 2026-10-29
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- `sb_look` with a `node_id` inside an overlay such as the cart drawer now measures the overlay's subtree in its open state.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- `sb_look` reports `wider_than_viewport` for fixed, sticky or absolute boxes that overflow the viewport by more than 1px, so a 400px cart drawer on a 390px phone is no longer missed.
|
|
16
|
+
- `sb_review` reports `duplicate_binding_field` when two bindings target the same field, naming the binding that is displayed.
|
|
17
|
+
- `sb_bind` on a field with duplicate bindings replaces the first one and drops the later duplicates.
|
|
18
|
+
|
|
9
19
|
## [0.100.1] - 2026-10-29
|
|
10
20
|
|
|
11
21
|
### Changed
|
package/CHANGELOG.vi.md
CHANGED
|
@@ -6,6 +6,16 @@ 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.100.2] - 2026-10-29
|
|
10
|
+
|
|
11
|
+
### Changed
|
|
12
|
+
- `sb_look` với `node_id` nằm trong overlay như cart drawer nay đo cây con của overlay ở trạng thái đang mở.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
- `sb_look` báo `wider_than_viewport` cho hộp fixed, sticky hoặc absolute tràn khung nhìn quá 1px, nên cart drawer 400px trên điện thoại 390px không còn bị bỏ sót.
|
|
16
|
+
- `sb_review` báo `duplicate_binding_field` khi hai binding cùng trỏ vào một field, kèm binding đang được hiển thị.
|
|
17
|
+
- `sb_bind` trên field có binding trùng sẽ thay binding đầu và bỏ các binding trùng phía sau.
|
|
18
|
+
|
|
9
19
|
## [0.100.1] - 2026-10-29
|
|
10
20
|
|
|
11
21
|
### Changed
|
|
@@ -80,7 +80,11 @@ export const FIX = {
|
|
|
80
80
|
// "<key>" here is documentation, not a placeholder: this template is never
|
|
81
81
|
// filled with a key, so the reader sees the form a field must take.
|
|
82
82
|
dead_binding_field: 'Rebind with sb_bind and a field of the form "specials.<key>".',
|
|
83
|
+
duplicate_binding_field: 'Keep one: sb_bind id "<id>" field "<key>" with the source you want — it replaces the binding on ' +
|
|
84
|
+
'that field and drops the duplicates.',
|
|
83
85
|
off_canvas: 'Give it a width that can shrink — sb_set id "<id>", namespace style, keys { "maxWidth": "100%" } at this breakpoint.',
|
|
86
|
+
wider_than_viewport: 'Cap it at the screen: sb_set id "<id>", namespace style, keys { "maxWidth": "100%" }, ' +
|
|
87
|
+
'breakpoint "mobile" (and each other width it overhangs at).',
|
|
84
88
|
text_too_small: 'Raise it for this breakpoint: sb_set id "<id>", namespace style, keys { "fontSize": "16px" }.',
|
|
85
89
|
title_bar_stranded: 'Put the action on the right edge: sb_set id "<id>", namespace style, keys ' +
|
|
86
90
|
'{ "justifyContent": "space-between", "alignItems": "center" }, and sb_set id "<cell>", ' +
|
|
@@ -9,7 +9,7 @@ import { ELEMENTS, BINDING_SOURCES, BOUND_SPECIALS, FIRST_CHILD_ONLY, SATELLITE_
|
|
|
9
9
|
import { fill } from './findings.js';
|
|
10
10
|
import { hrefParamProblems, isRecordSource, isSameSitePath, parseRecordRefAxis, readRecordAggregates, recordAggKeyOf, recordAggregateParams, RECORD_FIELD_ID, RECORD_HTML_SOURCE, RECORD_SOURCE, RECORD_TILES, recordScope, } from './record.js';
|
|
11
11
|
import { formFieldFindings, isFormDocument } from './formdoc.js';
|
|
12
|
-
import { deadNavigation, hasPurchaseBinding, liveEventTable, PAYLOAD_NEEDS, soleNavigationClick } from './navhref.js';
|
|
12
|
+
import { deadNavigation, hasPurchaseBinding, liveEventTable, PAYLOAD_NEEDS, PRODUCT_ACTION_BINDING_ID, soleNavigationClick } from './navhref.js';
|
|
13
13
|
import { unknownValueNote, unknownWriteNote, vocabularyFor, vocabularyForWrite } from './vocabulary.js';
|
|
14
14
|
import { iconNote } from './icons.js';
|
|
15
15
|
import { LINK_COLOUR, unstyledLinks } from './writecheck.js';
|
|
@@ -1537,6 +1537,30 @@ opts = {}) {
|
|
|
1537
1537
|
});
|
|
1538
1538
|
}
|
|
1539
1539
|
}
|
|
1540
|
+
// TWO BINDINGS ON ONE FIELD (TTG gap #62). ApplyBindings
|
|
1541
|
+
// (render/scope/scope.go) walks them IN ORDER and each resolved source
|
|
1542
|
+
// overwrites the special, so the LAST renders and the rest are dead weight
|
|
1543
|
+
// that a reorder silently swaps. The purchase binding is not a field binding.
|
|
1544
|
+
const byField = new Map();
|
|
1545
|
+
for (const b of bindings) {
|
|
1546
|
+
if (!b.field || !b.source || b.id === PRODUCT_ACTION_BINDING_ID)
|
|
1547
|
+
continue;
|
|
1548
|
+
byField.set(b.field, [...(byField.get(b.field) ?? []), b.source]);
|
|
1549
|
+
}
|
|
1550
|
+
for (const [field, sources] of byField) {
|
|
1551
|
+
if (sources.length < 2)
|
|
1552
|
+
continue;
|
|
1553
|
+
const wins = sources[sources.length - 1];
|
|
1554
|
+
out.push({
|
|
1555
|
+
code: 'duplicate_binding_field',
|
|
1556
|
+
nodeId: id,
|
|
1557
|
+
type,
|
|
1558
|
+
key: field,
|
|
1559
|
+
problem: `${sources.length} bindings write ${field} (${sources.join(', ')}); the renderer applies them in ` +
|
|
1560
|
+
`order, so ${wins} renders and the others are dead weight.`,
|
|
1561
|
+
fix: fill('duplicate_binding_field', { id, key: field }),
|
|
1562
|
+
});
|
|
1563
|
+
}
|
|
1540
1564
|
}
|
|
1541
1565
|
// Tagged in ONE place rather than at eight push sites: whether a node sits
|
|
1542
1566
|
// inside an overlay is a fact about where it is, not about what is wrong with
|
package/dist/tools/live.js
CHANGED
|
@@ -29,6 +29,7 @@ import { LiveSession } from '../live/session.js';
|
|
|
29
29
|
import { refuseAppBlockInterior } from '../domains/site/builder.js';
|
|
30
30
|
import { soft } from '../domains/site/guard.js';
|
|
31
31
|
import { hrefPatches, hasPurchaseBinding, liveEventTable, PAYLOAD_NEEDS, PRODUCT_ACTION_BINDING_ID, } from '../domains/site/navhref.js';
|
|
32
|
+
import { subtreeIds } from '../core/tree.js';
|
|
32
33
|
import { offscreenNodes, offscreenRootOf } from '../domains/site/offscreen.js';
|
|
33
34
|
import { searchStock, SearchUnavailable, NO_SEARCH_NEXT } from '../transport/stock.js';
|
|
34
35
|
import { siteFor } from './context.js';
|
|
@@ -157,12 +158,21 @@ export function bindNode(doc, id, source, field, action, guard) {
|
|
|
157
158
|
const at = node.bindings.findIndex((b) => b?.field === field && b.id !== PRODUCT_ACTION_BINDING_ID);
|
|
158
159
|
if (at >= 0) {
|
|
159
160
|
const prev = node.bindings[at];
|
|
161
|
+
// And drop any LATER binding on the same field (TTG gap #62): the renderer
|
|
162
|
+
// applies them in order and the last one wins, so replacing only the first
|
|
163
|
+
// would leave the old source rendering. Highest index first, so each
|
|
164
|
+
// `remove` addresses the list as it still stands.
|
|
165
|
+
const extra = node.bindings
|
|
166
|
+
.map((b, i) => (i > at && b?.field === field && b.id !== PRODUCT_ACTION_BINDING_ID ? i : -1))
|
|
167
|
+
.filter((i) => i >= 0)
|
|
168
|
+
.reverse();
|
|
160
169
|
return [
|
|
161
170
|
{
|
|
162
171
|
op: 'set',
|
|
163
172
|
path: ['nodes', id, 'bindings', String(at)],
|
|
164
173
|
value: { id: prev.id ?? randomBytes(6).toString('hex'), source, field },
|
|
165
174
|
},
|
|
175
|
+
...extra.map((index) => ({ op: 'remove', path: ['nodes', id, 'bindings'], index })),
|
|
166
176
|
];
|
|
167
177
|
}
|
|
168
178
|
return [
|
|
@@ -431,7 +441,16 @@ export function registerLiveTools(server, ctx, session) {
|
|
|
431
441
|
// and judging its geometry produced thirteen false off-canvas findings
|
|
432
442
|
// per page on a site whose pages were correct.
|
|
433
443
|
const skip = offscreenNodes(doc);
|
|
434
|
-
|
|
444
|
+
// A framed look measures nothing — EXCEPT the overlay it opened, the one
|
|
445
|
+
// surface no whole-page look ever shows open (TTG gap #60: a 400px drawer
|
|
446
|
+
// on a 390px phone reported no layout). Judged alone: the page beneath is
|
|
447
|
+
// what a whole-page look is for.
|
|
448
|
+
const opened = openOverlay ? new Set(subtreeIds(doc, openOverlay)) : undefined;
|
|
449
|
+
const visual = opened
|
|
450
|
+
? measure(shots, new Set([...skip].filter((id) => !opened.has(id))), doc).filter((f) => opened.has(f.nodeId))
|
|
451
|
+
: node_id
|
|
452
|
+
? []
|
|
453
|
+
: measure(shots, skip, doc);
|
|
435
454
|
const layout = compactFindings(visual);
|
|
436
455
|
const layoutNotice = visual.length > 0 ? ctx.notices.once('measure', MEASURE_NOTICE) : undefined;
|
|
437
456
|
// The legend rides with the first look only; the shape does not change after.
|
package/dist/vision/measure.js
CHANGED
|
@@ -33,10 +33,29 @@ export function measureShot(shot, skip = new Set(), doc) {
|
|
|
33
33
|
// that is two dozen false positives long is a list nobody reads.
|
|
34
34
|
if (skip.has(b.id))
|
|
35
35
|
continue;
|
|
36
|
-
//
|
|
37
|
-
//
|
|
38
|
-
//
|
|
39
|
-
if (b.
|
|
36
|
+
// A box the browser does not show (a CLOSED drawer is `visibility:hidden`
|
|
37
|
+
// and translated off-screen by its own static CSS) is not a visitor's
|
|
38
|
+
// problem; the same drawer OPENED is (TTG gap #60).
|
|
39
|
+
if (b.hidden)
|
|
40
|
+
continue;
|
|
41
|
+
// A FLOATING BOX PAST THE VIEWPORT (TTG gap #60). A fixed drawer 400px wide
|
|
42
|
+
// on a 390px phone overhangs by 10px with no scrollbar to show it — headless
|
|
43
|
+
// has none, and a 24px padding hides most of it in the picture. Out of the
|
|
44
|
+
// flow nothing shrinks it, so the fix is a cap, said with the widths.
|
|
45
|
+
if ((b.position === 'fixed' || b.position === 'sticky' || b.position === 'absolute') &&
|
|
46
|
+
(b.x < -1 || b.x + b.w > shot.width + 1)) {
|
|
47
|
+
out.push({
|
|
48
|
+
code: 'wider_than_viewport',
|
|
49
|
+
nodeId: b.id,
|
|
50
|
+
width: shot.width,
|
|
51
|
+
problem: `${b.position} box ${b.w}px wide on a ${shot.width}px viewport, overhanging it (${b.x} → ${b.x + b.w}).`,
|
|
52
|
+
fix: fill('wider_than_viewport', { id: b.id }),
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
else if (b.x < -SLOP || b.x + b.w > shot.width + SLOP) {
|
|
56
|
+
// OFF-CANVAS. A negative x, or a right edge past the viewport, is content
|
|
57
|
+
// the visitor cannot reach — and on a phone it also drags a horizontal
|
|
58
|
+
// scrollbar across the whole page.
|
|
40
59
|
out.push({
|
|
41
60
|
code: 'off_canvas',
|
|
42
61
|
nodeId: b.id,
|
|
@@ -74,6 +93,8 @@ export function measureShot(shot, skip = new Set(), doc) {
|
|
|
74
93
|
continue;
|
|
75
94
|
if (a.w === 0 || a.h === 0 || b.w === 0 || b.h === 0)
|
|
76
95
|
continue;
|
|
96
|
+
if (a.hidden || b.hidden)
|
|
97
|
+
continue;
|
|
77
98
|
// AND THE COMMENT ABOVE IS NOW IMPLEMENTED. It has always said that "an
|
|
78
99
|
// absolutely-positioned decoration over a band is a design choice", and
|
|
79
100
|
// nothing checked: `Box` carried no `position`, so the rule could not tell
|
package/dist/vision/shoot.js
CHANGED
|
@@ -364,6 +364,7 @@ async function shootOne(page, url, width, format, opts) {
|
|
|
364
364
|
hasText: own.length > 0,
|
|
365
365
|
position: cs.position,
|
|
366
366
|
...(layer ? { layer } : {}),
|
|
367
|
+
...(cs.visibility !== 'visible' || el.closest('[aria-hidden="true"]') ? { hidden: true } : {}),
|
|
367
368
|
};
|
|
368
369
|
});
|
|
369
370
|
}));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sbuilder-mcp",
|
|
3
|
-
"version": "0.100.
|
|
3
|
+
"version": "0.100.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",
|