sbuilder-mcp 0.100.2 → 0.100.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 +16 -0
- package/CHANGELOG.vi.md +16 -0
- package/dist/catalog/deadkeys.generated.js +2 -2
- package/dist/catalog/elements.generated.js +10 -9
- package/dist/catalog/overlays.generated.js +7 -4
- package/dist/catalog/source.generated.js +2 -2
- package/dist/catalog/storepages.generated.js +5 -5
- package/dist/catalog/theme.generated.js +4 -4
- package/dist/domains/site/findings.js +3 -3
- package/dist/domains/site/review.js +14 -11
- package/dist/domains/site/writecheck.js +11 -8
- package/dist/tools/page.js +11 -9
- package/dist/tools/theme.js +7 -5
- package/dist/vision/capture.js +21 -12
- package/dist/vision/imagediff.js +3 -1
- package/dist/vision/shoot.js +114 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,22 @@ 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.4] - 2026-10-29
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- `sb_look` and `sb_import` no longer wait indefinitely on a hung Chrome: launching a browser or opening a tab times out after 15 seconds, and the stalled Chrome is replaced and retried once before an error is reported.
|
|
13
|
+
- Closing the browser after `sb_look` or `sb_import` waits at most 3 seconds and then kills the Chrome process group, so a busy machine no longer adds 10–24 seconds after the result is ready.
|
|
14
|
+
|
|
15
|
+
## [0.100.3] - 2026-10-29
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Element seeds, the starter theme presets and the `sb_store` overlay seeds now use `var(--wb-ts-<slug>-family, Inter)` instead of a hard-coded "Inter", following platform v1.0.187.
|
|
19
|
+
- The cart drawer seed now sets `maxWidth: "100%"`, including in the cart overlay seeds.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
- `sb_review` reports `link_colour` only for buttons, because links in text and heading elements now inherit the text colour and are underlined.
|
|
23
|
+
- `sb_review` reports `default_font` for nodes that still hold the old seeded "Inter" fallback, compared with the font family of the element's own text style, and never for `var()` values.
|
|
24
|
+
|
|
9
25
|
## [0.100.2] - 2026-10-29
|
|
10
26
|
|
|
11
27
|
### Changed
|
package/CHANGELOG.vi.md
CHANGED
|
@@ -6,6 +6,22 @@ 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.4] - 2026-10-29
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- `sb_look` và `sb_import` không còn chờ vô hạn một Chrome bị treo: mở trình duyệt hoặc mở tab có hạn 15 giây, Chrome kẹt được thay mới và thử lại một lần trước khi báo lỗi.
|
|
13
|
+
- Việc đóng trình duyệt sau `sb_look` hoặc `sb_import` chỉ chờ tối đa 3 giây rồi kết thúc cưỡng bức process group của Chrome, nên máy bận không còn bị chậm thêm 10–24 giây sau khi đã có kết quả.
|
|
14
|
+
|
|
15
|
+
## [0.100.3] - 2026-10-29
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
- Seed của element, preset theme khởi đầu và seed overlay của `sb_store` nay dùng `var(--wb-ts-<slug>-family, Inter)` thay cho "Inter" cứng, theo platform v1.0.187.
|
|
19
|
+
- Seed cart drawer nay đặt `maxWidth: "100%"`, kể cả trong seed overlay giỏ hàng.
|
|
20
|
+
|
|
21
|
+
### Fixed
|
|
22
|
+
- `sb_review` chỉ báo `link_colour` cho button, vì link trong text và heading nay kế thừa màu chữ và có gạch chân.
|
|
23
|
+
- `sb_review` báo `default_font` cho node còn giữ font gieo cũ "Inter" làm fallback, so với họ font của text style của chính element, và không bao giờ báo với giá trị `var()`.
|
|
24
|
+
|
|
9
25
|
## [0.100.2] - 2026-10-29
|
|
10
26
|
|
|
11
27
|
### Changed
|
|
@@ -4080,7 +4080,7 @@ export const ELEMENTS = {
|
|
|
4080
4080
|
"width": "fit-content",
|
|
4081
4081
|
"height": "fit-content",
|
|
4082
4082
|
"padding": "8px 16px",
|
|
4083
|
-
"fontFamily": "Inter",
|
|
4083
|
+
"fontFamily": "var(--wb-ts-heading-4-family, Inter)",
|
|
4084
4084
|
"color": "#000000"
|
|
4085
4085
|
},
|
|
4086
4086
|
"specials": {
|
|
@@ -10980,7 +10980,7 @@ export const ELEMENTS = {
|
|
|
10980
10980
|
"width": "100%",
|
|
10981
10981
|
"height": "fit-content",
|
|
10982
10982
|
"textAlign": "left",
|
|
10983
|
-
"fontFamily": "Inter",
|
|
10983
|
+
"fontFamily": "var(--wb-ts-text-1-family, Inter)",
|
|
10984
10984
|
"gap": "16px",
|
|
10985
10985
|
"padding": "0px",
|
|
10986
10986
|
"margin": "0px",
|
|
@@ -12069,7 +12069,7 @@ export const ELEMENTS = {
|
|
|
12069
12069
|
"backgroundColor": "var(--wb-sc-border, #f5f5f5)",
|
|
12070
12070
|
"color": "var(--wb-sc-heading, #171717)",
|
|
12071
12071
|
"textAlign": "left",
|
|
12072
|
-
"fontFamily": "Inter",
|
|
12072
|
+
"fontFamily": "var(--wb-ts-text-2-family, Inter)",
|
|
12073
12073
|
"fontSize": "14px",
|
|
12074
12074
|
"padding": "12px 16px"
|
|
12075
12075
|
},
|
|
@@ -12239,7 +12239,7 @@ export const ELEMENTS = {
|
|
|
12239
12239
|
"width": "100%",
|
|
12240
12240
|
"height": "fit-content",
|
|
12241
12241
|
"textAlign": "left",
|
|
12242
|
-
"fontFamily": "Inter",
|
|
12242
|
+
"fontFamily": "var(--wb-ts-text-1-family, Inter)",
|
|
12243
12243
|
"lineHeight": "140%",
|
|
12244
12244
|
"gap": "8px",
|
|
12245
12245
|
"color": "#111111",
|
|
@@ -13061,6 +13061,7 @@ export const ELEMENTS = {
|
|
|
13061
13061
|
"display": "flex",
|
|
13062
13062
|
"flexDirection": "column",
|
|
13063
13063
|
"width": "400px",
|
|
13064
|
+
"maxWidth": "100%",
|
|
13064
13065
|
"gap": "8px",
|
|
13065
13066
|
"padding": "20px 24px",
|
|
13066
13067
|
"backgroundColor": "#ffffff",
|
|
@@ -17265,7 +17266,7 @@ export const ELEMENTS = {
|
|
|
17265
17266
|
"childAllows": [],
|
|
17266
17267
|
"defaults": {
|
|
17267
17268
|
"style": {
|
|
17268
|
-
"fontFamily": "Inter",
|
|
17269
|
+
"fontFamily": "var(--wb-ts-heading-6-family, Inter)",
|
|
17269
17270
|
"color": "var(--wb-sc-heading, #000000)",
|
|
17270
17271
|
"lineHeight": "1.3",
|
|
17271
17272
|
"fontWeight": "700",
|
|
@@ -17389,7 +17390,7 @@ export const ELEMENTS = {
|
|
|
17389
17390
|
}
|
|
17390
17391
|
},
|
|
17391
17392
|
"style": {
|
|
17392
|
-
"fontFamily": "Inter",
|
|
17393
|
+
"fontFamily": "var(--wb-ts-text-1-family, Inter)",
|
|
17393
17394
|
"fontSize": "16px",
|
|
17394
17395
|
"color": "var(--wb-sc-link, #171717)",
|
|
17395
17396
|
"lineHeight": "1.3",
|
|
@@ -33839,7 +33840,7 @@ export const ELEMENTS = {
|
|
|
33839
33840
|
"color": "#111111",
|
|
33840
33841
|
"fontSize": "16px",
|
|
33841
33842
|
"textAlign": "left",
|
|
33842
|
-
"fontFamily": "Inter",
|
|
33843
|
+
"fontFamily": "var(--wb-ts-text-1-family, Inter)",
|
|
33843
33844
|
"--wb-cl-cols": "3",
|
|
33844
33845
|
"--wb-cl-gap": "24px",
|
|
33845
33846
|
"--wb-cl-grow": "0"
|
|
@@ -39776,7 +39777,7 @@ export const ELEMENT_SEEDS = {
|
|
|
39776
39777
|
"fontSize": "16px",
|
|
39777
39778
|
"lineHeight": "140%",
|
|
39778
39779
|
"textAlign": "left",
|
|
39779
|
-
"fontFamily": "Inter"
|
|
39780
|
+
"fontFamily": "var(--wb-ts-text-1-family, Inter)"
|
|
39780
39781
|
},
|
|
39781
39782
|
"config": {
|
|
39782
39783
|
"kind": "price"
|
|
@@ -39789,7 +39790,7 @@ export const ELEMENT_SEEDS = {
|
|
|
39789
39790
|
"fontSize": "16px",
|
|
39790
39791
|
"lineHeight": "140%",
|
|
39791
39792
|
"textAlign": "left",
|
|
39792
|
-
"fontFamily": "Inter"
|
|
39793
|
+
"fontFamily": "var(--wb-ts-text-1-family, Inter)"
|
|
39793
39794
|
},
|
|
39794
39795
|
"config": {
|
|
39795
39796
|
"kind": "compare_price"
|
|
@@ -31,6 +31,7 @@ export const OVERLAY_SEEDS = {
|
|
|
31
31
|
"display": "flex",
|
|
32
32
|
"flexDirection": "column",
|
|
33
33
|
"width": "400px",
|
|
34
|
+
"maxWidth": "100%",
|
|
34
35
|
"gap": "8px",
|
|
35
36
|
"padding": "20px 24px",
|
|
36
37
|
"backgroundColor": "#ffffff",
|
|
@@ -1470,7 +1471,7 @@ export const OVERLAY_SEEDS = {
|
|
|
1470
1471
|
"fontSize": "16px",
|
|
1471
1472
|
"lineHeight": "140%",
|
|
1472
1473
|
"textAlign": "left",
|
|
1473
|
-
"fontFamily": "Inter"
|
|
1474
|
+
"fontFamily": "var(--wb-ts-text-1-family, Inter)"
|
|
1474
1475
|
},
|
|
1475
1476
|
"config": {
|
|
1476
1477
|
"kind": "price",
|
|
@@ -1538,7 +1539,7 @@ export const OVERLAY_SEEDS = {
|
|
|
1538
1539
|
"fontSize": "16px",
|
|
1539
1540
|
"lineHeight": "140%",
|
|
1540
1541
|
"textAlign": "left",
|
|
1541
|
-
"fontFamily": "Inter"
|
|
1542
|
+
"fontFamily": "var(--wb-ts-text-1-family, Inter)"
|
|
1542
1543
|
},
|
|
1543
1544
|
"config": {
|
|
1544
1545
|
"kind": "compare_price",
|
|
@@ -1682,7 +1683,7 @@ export const OVERLAY_SEEDS = {
|
|
|
1682
1683
|
"custom": {}
|
|
1683
1684
|
},
|
|
1684
1685
|
"style": {
|
|
1685
|
-
"fontFamily": "Inter",
|
|
1686
|
+
"fontFamily": "var(--wb-ts-heading-6-family, Inter)",
|
|
1686
1687
|
"color": "var(--wb-sc-heading, #000000)",
|
|
1687
1688
|
"lineHeight": "1.3",
|
|
1688
1689
|
"fontWeight": "700",
|
|
@@ -1707,7 +1708,7 @@ export const OVERLAY_SEEDS = {
|
|
|
1707
1708
|
"custom": {}
|
|
1708
1709
|
},
|
|
1709
1710
|
"style": {
|
|
1710
|
-
"fontFamily": "Inter",
|
|
1711
|
+
"fontFamily": "var(--wb-ts-text-1-family, Inter)",
|
|
1711
1712
|
"fontSize": "16px",
|
|
1712
1713
|
"color": "var(--wb-sc-link, #171717)",
|
|
1713
1714
|
"lineHeight": "1.3",
|
|
@@ -2080,6 +2081,7 @@ export const CART_SEEDS = {
|
|
|
2080
2081
|
"display": "flex",
|
|
2081
2082
|
"flexDirection": "column",
|
|
2082
2083
|
"width": "400px",
|
|
2084
|
+
"maxWidth": "100%",
|
|
2083
2085
|
"gap": "8px",
|
|
2084
2086
|
"padding": "20px 24px",
|
|
2085
2087
|
"backgroundColor": "#ffffff",
|
|
@@ -2917,6 +2919,7 @@ export const CART_SEEDS = {
|
|
|
2917
2919
|
"display": "flex",
|
|
2918
2920
|
"flexDirection": "column",
|
|
2919
2921
|
"width": "400px",
|
|
2922
|
+
"maxWidth": "100%",
|
|
2920
2923
|
"gap": "8px",
|
|
2921
2924
|
"padding": "20px 24px",
|
|
2922
2925
|
"backgroundColor": "#ffffff",
|
|
@@ -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": "
|
|
5
|
-
"committedAt": "2026-10-
|
|
4
|
+
"commit": "ab273ce14722dcc17f81176e01415a1892e5d878",
|
|
5
|
+
"committedAt": "2026-10-29T18:33:35+07:00",
|
|
6
6
|
"dirty": false
|
|
7
7
|
};
|
|
@@ -531,7 +531,7 @@ export const PAGE_LAYOUT_SEEDS = {
|
|
|
531
531
|
"backgroundColor": "var(--wb-sc-border, #f5f5f5)",
|
|
532
532
|
"color": "var(--wb-sc-heading, #171717)",
|
|
533
533
|
"textAlign": "left",
|
|
534
|
-
"fontFamily": "Inter",
|
|
534
|
+
"fontFamily": "var(--wb-ts-text-2-family, Inter)",
|
|
535
535
|
"fontSize": "14px",
|
|
536
536
|
"padding": "12px 16px"
|
|
537
537
|
},
|
|
@@ -2183,7 +2183,7 @@ export const STORE_PAGE_SEEDS = {
|
|
|
2183
2183
|
"fontSize": "16px",
|
|
2184
2184
|
"lineHeight": "140%",
|
|
2185
2185
|
"textAlign": "left",
|
|
2186
|
-
"fontFamily": "Inter"
|
|
2186
|
+
"fontFamily": "var(--wb-ts-text-1-family, Inter)"
|
|
2187
2187
|
},
|
|
2188
2188
|
"config": {
|
|
2189
2189
|
"kind": "price",
|
|
@@ -2251,7 +2251,7 @@ export const STORE_PAGE_SEEDS = {
|
|
|
2251
2251
|
"fontSize": "16px",
|
|
2252
2252
|
"lineHeight": "140%",
|
|
2253
2253
|
"textAlign": "left",
|
|
2254
|
-
"fontFamily": "Inter"
|
|
2254
|
+
"fontFamily": "var(--wb-ts-text-1-family, Inter)"
|
|
2255
2255
|
},
|
|
2256
2256
|
"config": {
|
|
2257
2257
|
"kind": "compare_price",
|
|
@@ -2395,7 +2395,7 @@ export const STORE_PAGE_SEEDS = {
|
|
|
2395
2395
|
"custom": {}
|
|
2396
2396
|
},
|
|
2397
2397
|
"style": {
|
|
2398
|
-
"fontFamily": "Inter",
|
|
2398
|
+
"fontFamily": "var(--wb-ts-heading-6-family, Inter)",
|
|
2399
2399
|
"color": "var(--wb-sc-heading, #000000)",
|
|
2400
2400
|
"lineHeight": "1.3",
|
|
2401
2401
|
"fontWeight": "700",
|
|
@@ -2420,7 +2420,7 @@ export const STORE_PAGE_SEEDS = {
|
|
|
2420
2420
|
"custom": {}
|
|
2421
2421
|
},
|
|
2422
2422
|
"style": {
|
|
2423
|
-
"fontFamily": "Inter",
|
|
2423
|
+
"fontFamily": "var(--wb-ts-text-1-family, Inter)",
|
|
2424
2424
|
"fontSize": "16px",
|
|
2425
2425
|
"color": "var(--wb-sc-link, #171717)",
|
|
2426
2426
|
"lineHeight": "1.3",
|
|
@@ -263,7 +263,7 @@ export const STARTER_THEME = {
|
|
|
263
263
|
"padding": "10px 24px",
|
|
264
264
|
"textAlign": "center",
|
|
265
265
|
"fontSize": "14px",
|
|
266
|
-
"fontFamily": "Inter",
|
|
266
|
+
"fontFamily": "var(--wb-ts-text-2-family, Inter)",
|
|
267
267
|
"lineHeight": "20px"
|
|
268
268
|
},
|
|
269
269
|
"responsive": {
|
|
@@ -556,7 +556,7 @@ export const STARTER_THEME = {
|
|
|
556
556
|
"base": {
|
|
557
557
|
"textAlign": "left",
|
|
558
558
|
"lineHeight": "130%",
|
|
559
|
-
"fontFamily": "Inter",
|
|
559
|
+
"fontFamily": "var(--wb-ts-heading-1-family, Inter)",
|
|
560
560
|
"fontSize": "48px",
|
|
561
561
|
"color": "var(--wb-sc-heading, var(--wb-color-heading))"
|
|
562
562
|
},
|
|
@@ -642,7 +642,7 @@ export const STARTER_THEME = {
|
|
|
642
642
|
"base": {
|
|
643
643
|
"textAlign": "left",
|
|
644
644
|
"lineHeight": "140%",
|
|
645
|
-
"fontFamily": "Inter",
|
|
645
|
+
"fontFamily": "var(--wb-ts-text-1-family, Inter)",
|
|
646
646
|
"fontSize": "16px",
|
|
647
647
|
"color": "var(--wb-sc-text, var(--wb-color-text))"
|
|
648
648
|
}
|
|
@@ -654,7 +654,7 @@ export const STARTER_THEME = {
|
|
|
654
654
|
"base": {
|
|
655
655
|
"textAlign": "left",
|
|
656
656
|
"lineHeight": "140%",
|
|
657
|
-
"fontFamily": "Inter",
|
|
657
|
+
"fontFamily": "var(--wb-ts-text-1-family, Inter)",
|
|
658
658
|
"fontSize": "16px",
|
|
659
659
|
"color": "var(--wb-sc-text, var(--wb-color-text))"
|
|
660
660
|
}
|
|
@@ -30,9 +30,9 @@ export const FIX = {
|
|
|
30
30
|
'A figure, a delivery or return promise, or a customer quote must be TRUE for this shop — ' +
|
|
31
31
|
'if you do not know it, remove the element (sb_remove) rather than guess.',
|
|
32
32
|
link_colour: 'Colour each link inline: sb_set id "<id>", namespace specials, keys { "textHtml": … } with ' +
|
|
33
|
-
'<a href="…" style="color:inherit">
|
|
34
|
-
default_font: 'Wear the
|
|
35
|
-
'
|
|
33
|
+
'<a href="…" style="color:inherit"> — or drop the inner link and give the button its own href.',
|
|
34
|
+
default_font: 'Wear the theme\'s font again: sb_set id "<id>", namespace style, base true, keys { "fontFamily": ' +
|
|
35
|
+
'<the var(--wb-ts-…) the problem names> } — the element\'s seed today, so it follows the theme.',
|
|
36
36
|
default_seed_copy: 'Write it in the shop\'s own language and ink: sb_set id "<id>", namespace specials, ' +
|
|
37
37
|
'keys { "<key>": … }. It is a seeded satellite (an empty state, an element\'s chrome), ' +
|
|
38
38
|
'so it only appears when the list is empty or the control is idle — sb_outline lists it ' +
|
|
@@ -12,7 +12,7 @@ import { formFieldFindings, isFormDocument } from './formdoc.js';
|
|
|
12
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
|
-
import { LINK_COLOUR, unstyledLinks } from './writecheck.js';
|
|
15
|
+
import { LINK_COLOUR, LINK_INHERITS, unstyledLinks } from './writecheck.js';
|
|
16
16
|
/**
|
|
17
17
|
* A defect somebody looking at the page would see.
|
|
18
18
|
*
|
|
@@ -529,27 +529,30 @@ opts = {}) {
|
|
|
529
529
|
});
|
|
530
530
|
}
|
|
531
531
|
}
|
|
532
|
-
// A LINK IN RICH TEXT IS THE BROWSER'S BLUE — see writecheck LINK_COLOUR
|
|
532
|
+
// A LINK IN A BUTTON'S RICH TEXT IS THE BROWSER'S BLUE — see writecheck LINK_COLOUR.
|
|
533
533
|
const html = (n.specials ?? {}).textHtml;
|
|
534
|
-
if (typeof html === 'string' && unstyledLinks(html)) {
|
|
534
|
+
if (typeof html === 'string' && !LINK_INHERITS.has(type) && unstyledLinks(html)) {
|
|
535
535
|
out.push({ code: 'link_colour', nodeId: id, type, key: 'textHtml', problem: LINK_COLOUR.problem, fix: fill('link_colour', { id }) });
|
|
536
536
|
}
|
|
537
|
-
//
|
|
538
|
-
//
|
|
539
|
-
//
|
|
540
|
-
//
|
|
541
|
-
//
|
|
542
|
-
//
|
|
537
|
+
// A NODE STILL ON THE OLD LITERAL SEED FONT (TTG gap #51). Until web_builder
|
|
538
|
+
// v1.0.187 (e8900e4d9) a few elements seeded a LITERAL "Inter"; they now seed
|
|
539
|
+
// `var(--wb-ts-<slug>-family, Inter)`. A node created before that still holds
|
|
540
|
+
// the bare fallback, so on a site set in Be Vietnam Pro it renders in Inter.
|
|
541
|
+
// Flag only that exact residue — the stored value equals the fallback of the
|
|
542
|
+
// element's own seed var — against the family of the text style that var
|
|
543
|
+
// names. A var() is never flagged; a deliberate literal is the author's.
|
|
543
544
|
const ff = n.style?.fontFamily;
|
|
544
545
|
const seedFont = meta.defaults.style?.fontFamily;
|
|
546
|
+
const seed = typeof seedFont === 'string' ? /^var\(--wb-ts-([a-z0-9-]+)-family,\s*(.+)\)$/.exec(seedFont) : null;
|
|
547
|
+
const themed = seed ? opts.fonts?.[seed[1]] : undefined;
|
|
545
548
|
// A family set at any breakpoint is the author's answer too.
|
|
546
549
|
const perBp = Object.values(n.responsive ?? {}).some((r) => r?.style?.fontFamily !== undefined);
|
|
547
|
-
if (
|
|
550
|
+
if (seed && themed && !perBp && typeof ff === 'string' && family(ff) === family(seed[2]) && !ff.includes('var(') && family(ff) !== family(themed)) {
|
|
548
551
|
out.push({
|
|
549
552
|
code: 'default_font',
|
|
550
553
|
nodeId: id,
|
|
551
554
|
type,
|
|
552
|
-
problem: `Still the element's
|
|
555
|
+
problem: `Still the element's old literal seed font "${ff}", while the site's ${seed[1]} text style is "${family(themed, true)}" — it renders in a typeface nothing else on the page uses. The element now seeds ${seedFont}.`,
|
|
553
556
|
fix: fill('default_font', { id }),
|
|
554
557
|
});
|
|
555
558
|
}
|
|
@@ -273,11 +273,12 @@ export function writeCheck(type, namespace, keys, opts = {}) {
|
|
|
273
273
|
'never <p>/<div>, and put a separate block in its own node. A link goes to http(s), mailto, tel or a ' +
|
|
274
274
|
'relative path; no comments.');
|
|
275
275
|
}
|
|
276
|
-
// A LINK IN RICH TEXT IS THE BROWSER'S BLUE.
|
|
277
|
-
//
|
|
278
|
-
//
|
|
279
|
-
//
|
|
280
|
-
|
|
276
|
+
// A LINK IN A BUTTON'S RICH TEXT IS THE BROWSER'S BLUE. Since web_builder
|
|
277
|
+
// v1.0.187 (a8097f59e) `.wb-text a` / `.wb-heading a` inherit the text
|
|
278
|
+
// colour, underlined — TTG gap #50 is closed there. `button` renders
|
|
279
|
+
// textHtml too (nodes.RichText) and its static CSS styles no `a`, so an <a>
|
|
280
|
+
// with no colour of its own still paints rgb(0,0,238) inside one.
|
|
281
|
+
if (namespace === 'specials' && typeof v === 'string' && rich.includes(k) && !bad.length && !LINK_INHERITS.has(type) && unstyledLinks(v)) {
|
|
281
282
|
push(`link-colour:${type}.${k}`, 'link_colour', k, LINK_COLOUR.problem, LINK_COLOUR.fix);
|
|
282
283
|
}
|
|
283
284
|
if (namespace === 'specials') {
|
|
@@ -303,10 +304,12 @@ export function writeCheck(type, namespace, keys, opts = {}) {
|
|
|
303
304
|
export function unstyledLinks(html) {
|
|
304
305
|
return (html.match(/<a\b[^>]*>/gi) ?? []).filter((tag) => !/style\s*=\s*["'](?:[^"']*[;\s])?color\s*:/i.test(tag)).length;
|
|
305
306
|
}
|
|
307
|
+
/** Elements whose static CSS gives an <a> in textHtml the text's own colour (web_builder a8097f59e). */
|
|
308
|
+
export const LINK_INHERITS = new Set(['heading', 'text']);
|
|
306
309
|
export const LINK_COLOUR = {
|
|
307
|
-
problem: "A link in this rich text has no colour of its own, so it renders in the browser's default link blue " +
|
|
308
|
-
'(rgb(0,0,238))
|
|
309
|
-
fix: 'Give each <a> its colour inline: <a href="…" style="color:inherit"
|
|
310
|
+
problem: "A link in this button's rich text has no colour of its own, so it renders in the browser's default link blue " +
|
|
311
|
+
'(rgb(0,0,238)) — text and heading make a link inherit their colour; a button styles no <a>.',
|
|
312
|
+
fix: 'Give each <a> its colour inline: <a href="…" style="color:inherit">, or drop the inner link and give the button its own href.',
|
|
310
313
|
};
|
|
311
314
|
/**
|
|
312
315
|
* `specials.formRules` on a form root, judged against the open form document.
|
package/dist/tools/page.js
CHANGED
|
@@ -49,8 +49,8 @@ import { FILTER_VALUE_TYPES, RESOURCE_KEYS, filterPatches, wantsRows } from '../
|
|
|
49
49
|
* copies of a directive is how one of them quietly loses it. The fix for each
|
|
50
50
|
* KIND is sent once under `fixes`, and the directive once per process.
|
|
51
51
|
*/
|
|
52
|
-
export function reviewField(ctx, doc, formTypes, pageType, formDocType, formRedirects, siteLocale,
|
|
53
|
-
const all = reviewDesign(doc, { formTypes, pageType, formDocType, formRedirects, siteLocale,
|
|
52
|
+
export function reviewField(ctx, doc, formTypes, pageType, formDocType, formRedirects, siteLocale, fonts) {
|
|
53
|
+
const all = reviewDesign(doc, { formTypes, pageType, formDocType, formRedirects, siteLocale, fonts });
|
|
54
54
|
if (all.length === 0)
|
|
55
55
|
return {};
|
|
56
56
|
// MAINTENANCE IS ADVICE, kept out of `findings`: it works for a visitor, so
|
|
@@ -2041,19 +2041,21 @@ export function registerPageTools(server, ctx) {
|
|
|
2041
2041
|
catch {
|
|
2042
2042
|
// Readiness is additional information, never the reason a review fails.
|
|
2043
2043
|
}
|
|
2044
|
-
// The site's
|
|
2045
|
-
// is set in Inter, so it can never disagree with an
|
|
2046
|
-
|
|
2044
|
+
// The site's font per text style, for `default_font` — a SITE theme only: the
|
|
2045
|
+
// starter is set in Inter, so it can never disagree with an old literal Inter.
|
|
2046
|
+
const fonts = {};
|
|
2047
2047
|
try {
|
|
2048
2048
|
const { theme, from } = await siteTheme(ctx, session.site());
|
|
2049
|
-
const
|
|
2050
|
-
|
|
2051
|
-
|
|
2049
|
+
for (const t of from === 'site' ? theme.textStyles : []) {
|
|
2050
|
+
const f = t.base?.fontFamily;
|
|
2051
|
+
if (typeof f === 'string' && f && !f.includes('var('))
|
|
2052
|
+
fonts[t.slug] = f;
|
|
2053
|
+
}
|
|
2052
2054
|
}
|
|
2053
2055
|
catch {
|
|
2054
2056
|
// A theme that cannot be read is a finding nobody gets, never a failed review.
|
|
2055
2057
|
}
|
|
2056
|
-
const field = reviewField(ctx, doc, formTypes, pageType, session.formType(), formRedirects, siteLocale,
|
|
2058
|
+
const field = reviewField(ctx, doc, formTypes, pageType, session.formType(), formRedirects, siteLocale, fonts);
|
|
2057
2059
|
// Clean = no finding a visitor meets; `advice` (maintenance) rides beside the verdict.
|
|
2058
2060
|
const clean = !field.findings;
|
|
2059
2061
|
return text({
|
package/dist/tools/theme.js
CHANGED
|
@@ -278,11 +278,13 @@ export function registerThemeTools(server, ctx) {
|
|
|
278
278
|
for (const [id, decls] of Object.entries(presets ?? {})) {
|
|
279
279
|
patchLayers(theme.presets.find((p) => p.id === id), decls, `presets.${id}`, changes);
|
|
280
280
|
}
|
|
281
|
-
// A FAMILY ON A TEXT STYLE REACHES NOTHING A PRESET PINS.
|
|
282
|
-
//
|
|
283
|
-
//
|
|
284
|
-
//
|
|
285
|
-
//
|
|
281
|
+
// A FAMILY ON A TEXT STYLE REACHES NOTHING A PRESET PINS. A site theme saved
|
|
282
|
+
// before web_builder v1.0.187 carries a literal `fontFamily: "Inter"` on
|
|
283
|
+
// heading-default, text-default, text-dataset-default and button-default
|
|
284
|
+
// (the starter now seeds `var(--wb-ts-…-family, Inter)`), so changing the
|
|
285
|
+
// style's family changed nothing on headings or buttons — measured on a
|
|
286
|
+
// live storefront. Named, not fixed: which presets should follow is the
|
|
287
|
+
// caller's design decision.
|
|
286
288
|
const families = new Set(Object.values(text_styles ?? {})
|
|
287
289
|
.map((d) => d.fontFamily)
|
|
288
290
|
.filter((f) => typeof f === 'string'));
|
package/dist/vision/capture.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { settleDom } from './shoot.js';
|
|
1
|
+
import { ChromeStalled, deadline, launchChrome, release, settleDom } from './shoot.js';
|
|
3
2
|
/**
|
|
4
3
|
* The in-page walk, as a string the browser evaluates.
|
|
5
4
|
*
|
|
@@ -1378,15 +1377,13 @@ function capturePage(limits) {
|
|
|
1378
1377
|
async function withBrowser(fn) {
|
|
1379
1378
|
let browser;
|
|
1380
1379
|
try {
|
|
1381
|
-
//
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
handleSIGINT: false,
|
|
1385
|
-
handleSIGTERM: false,
|
|
1386
|
-
handleSIGHUP: false,
|
|
1387
|
-
});
|
|
1380
|
+
// shoot.ts's launcher (no Playwright signal handlers — `src/index.ts` owns
|
|
1381
|
+
// them), but a FRESH Chrome, never the pool, and bounded by `deadline`.
|
|
1382
|
+
browser = await launchChrome();
|
|
1388
1383
|
}
|
|
1389
1384
|
catch (e) {
|
|
1385
|
+
if (e instanceof ChromeStalled)
|
|
1386
|
+
throw e;
|
|
1390
1387
|
throw new Error('sbuilder: could not start Chrome to read that page. This server uses the SYSTEM ' +
|
|
1391
1388
|
`browser (playwright-core, channel "chrome") and did not find one: ${e.message}`);
|
|
1392
1389
|
}
|
|
@@ -1394,7 +1391,9 @@ async function withBrowser(fn) {
|
|
|
1394
1391
|
return await fn(browser);
|
|
1395
1392
|
}
|
|
1396
1393
|
finally {
|
|
1397
|
-
|
|
1394
|
+
// `release`, not `close`: the result is already in hand, and a busy machine
|
|
1395
|
+
// made the close alone cost 10-24s (see `release` in shoot.ts).
|
|
1396
|
+
await release(browser);
|
|
1398
1397
|
}
|
|
1399
1398
|
}
|
|
1400
1399
|
/**
|
|
@@ -1423,7 +1422,7 @@ const NAV_TIMEOUT_MS = 30_000;
|
|
|
1423
1422
|
async function readPage(browser, url, width, work, navMs = NAV_TIMEOUT_MS, settleMs) {
|
|
1424
1423
|
let page;
|
|
1425
1424
|
try {
|
|
1426
|
-
page = await browser.newPage({ viewport: { width, height: 900 } });
|
|
1425
|
+
page = await deadline(browser.newPage({ viewport: { width, height: 900 } }), 'open a tab');
|
|
1427
1426
|
// `domcontentloaded`, NOT `load`, and `settleDom` does the rest.
|
|
1428
1427
|
//
|
|
1429
1428
|
// `load` waits for every SUBRESOURCE — including third-party iframes, which
|
|
@@ -1496,7 +1495,14 @@ function readFailure(e) {
|
|
|
1496
1495
|
/** Open a URL and capture it. */
|
|
1497
1496
|
export async function capture(url, opts = {}) {
|
|
1498
1497
|
const limits = limitsFrom(opts);
|
|
1499
|
-
|
|
1498
|
+
const read = () => withBrowser((browser) => readPage(browser, url, opts.width ?? 1440, (page) => page.evaluate(capturePage, limits), opts.navTimeoutMs, opts.settleMs));
|
|
1499
|
+
// A wedged Chrome (see `deadline` in shoot.ts) is released by `withBrowser`;
|
|
1500
|
+
// a fresh one reads the page once more.
|
|
1501
|
+
return read().catch((e) => {
|
|
1502
|
+
if (e instanceof ChromeStalled)
|
|
1503
|
+
return read();
|
|
1504
|
+
throw e;
|
|
1505
|
+
});
|
|
1500
1506
|
}
|
|
1501
1507
|
/**
|
|
1502
1508
|
* Capture several pages through one browser.
|
|
@@ -1517,6 +1523,9 @@ export async function captureMany(urls, opts = {}) {
|
|
|
1517
1523
|
out.push({ url, ok: true, result });
|
|
1518
1524
|
}
|
|
1519
1525
|
catch (e) {
|
|
1526
|
+
// ponytail: a wedged Chrome (`ChromeStalled`) fails this page AND each later
|
|
1527
|
+
// one after its own 15s deadline, rather than hanging the run; relaunch
|
|
1528
|
+
// mid-loop if a site import is ever seen doing that.
|
|
1520
1529
|
out.push({ url, ok: false, why: readFailure(e) });
|
|
1521
1530
|
}
|
|
1522
1531
|
}
|
package/dist/vision/imagediff.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { chromium } from 'playwright-core';
|
|
2
|
+
import { release } from './shoot.js';
|
|
2
3
|
/**
|
|
3
4
|
* ITS OWN BROWSER, not `shoot.ts`'s pooled one.
|
|
4
5
|
*
|
|
@@ -18,7 +19,8 @@ async function browser() {
|
|
|
18
19
|
export async function closeDiffBrowser() {
|
|
19
20
|
const b = shared;
|
|
20
21
|
shared = null;
|
|
21
|
-
|
|
22
|
+
if (b)
|
|
23
|
+
await release(b);
|
|
22
24
|
}
|
|
23
25
|
export async function diffImages(a, b, opts = {}) {
|
|
24
26
|
const width = opts.width ?? 480;
|
package/dist/vision/shoot.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { setTimeout as sleep } from 'node:timers/promises';
|
|
1
2
|
import { chromium } from 'playwright-core';
|
|
2
3
|
/** The three widths the platform's own breakpoints care about. */
|
|
3
4
|
export const DEFAULT_WIDTHS = [1440, 768, 390];
|
|
@@ -21,9 +22,11 @@ const JPEG_QUALITY = 80;
|
|
|
21
22
|
*/
|
|
22
23
|
async function launch() {
|
|
23
24
|
try {
|
|
24
|
-
return await
|
|
25
|
+
return await launchChrome();
|
|
25
26
|
}
|
|
26
27
|
catch (err) {
|
|
28
|
+
if (err instanceof ChromeStalled)
|
|
29
|
+
throw err;
|
|
27
30
|
throw new Error('sbuilder: could not launch Google Chrome for the screenshot. sb_look needs Chrome ' +
|
|
28
31
|
`installed — playwright-core bundles no browser. Underlying error: ${String(err)}`);
|
|
29
32
|
}
|
|
@@ -50,6 +53,46 @@ let launcher = realLauncher;
|
|
|
50
53
|
export function setLauncherForTest(fn) {
|
|
51
54
|
launcher = fn ?? realLauncher;
|
|
52
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* A FRESH Chrome — not the pool — bounded by `deadline`, its pid noted while it
|
|
58
|
+
* still answers. `capture.ts` launches through this too, so one launcher (and
|
|
59
|
+
* one test seam) serves both, while each keeps a browser of its own.
|
|
60
|
+
*/
|
|
61
|
+
export async function launchChrome() {
|
|
62
|
+
const b = await deadline(launcher(), 'start');
|
|
63
|
+
void pidOf(b);
|
|
64
|
+
return b;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* A CHROME STEP THAT NEVER ANSWERS MEANS A WEDGED CHROME, and nothing else bounds it.
|
|
68
|
+
*
|
|
69
|
+
* MEASURED in the full browser suite on a busy machine: a `launch` that never
|
|
70
|
+
* returned, and a `newPage` that never answered — not one stderr line from that
|
|
71
|
+
* Chrome afterwards — while a fresh Chrome a moment later answered at once.
|
|
72
|
+
* `newPage` takes no timeout and `launch` defaults to 180s, so the caller simply
|
|
73
|
+
* hung: a test to its 60s limit, the pool's every later shot behind the same
|
|
74
|
+
* handle, and in the server every later tool call, because calls run one at a
|
|
75
|
+
* time. Healthy, the same steps took ≤3.7s at a load average of 47; the deadline
|
|
76
|
+
* is four times that, and missing it costs a relaunch, not a failure.
|
|
77
|
+
*/
|
|
78
|
+
let stallMs = 15_000;
|
|
79
|
+
/** Tests only: shorten the stall deadline. Pass nothing to restore it. */
|
|
80
|
+
export function setStallForTest(ms = 15_000) {
|
|
81
|
+
stallMs = ms;
|
|
82
|
+
}
|
|
83
|
+
export class ChromeStalled extends Error {
|
|
84
|
+
}
|
|
85
|
+
/** `step`, or `ChromeStalled` once it has not answered for `ms`. */
|
|
86
|
+
export function deadline(step, what, ms = stallMs) {
|
|
87
|
+
return Promise.race([
|
|
88
|
+
step,
|
|
89
|
+
// `ref: false`: a pending deadline never keeps a finished process alive.
|
|
90
|
+
sleep(ms, undefined, { ref: false }).then(() => {
|
|
91
|
+
throw new ChromeStalled(`sbuilder: Chrome did not ${what} within ${ms / 1000}s. A busy machine can wedge one, ` +
|
|
92
|
+
'and a fresh one usually answers at once: repeat the call.');
|
|
93
|
+
}),
|
|
94
|
+
]);
|
|
95
|
+
}
|
|
53
96
|
/**
|
|
54
97
|
* ONE Chrome per process, launched on first use and kept.
|
|
55
98
|
*
|
|
@@ -87,7 +130,63 @@ export async function closeBrowser() {
|
|
|
87
130
|
return;
|
|
88
131
|
const b = await p.catch(() => undefined);
|
|
89
132
|
if (b)
|
|
90
|
-
await b
|
|
133
|
+
await release(b);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* The OS pid of a launched Chrome, asked ONCE and kept — ideally right after the
|
|
137
|
+
* launch, while it still answers; the one that needs killing is the one that has
|
|
138
|
+
* stopped answering. `launch()` has no `browser.process()`, and CDP's
|
|
139
|
+
* `SystemInfo.getProcessInfo` is the door.
|
|
140
|
+
*/
|
|
141
|
+
const pids = new WeakMap();
|
|
142
|
+
export function pidOf(b) {
|
|
143
|
+
let pid = pids.get(b);
|
|
144
|
+
if (!pid) {
|
|
145
|
+
// Inside `then`, so a handle that cannot open a CDP session (a test double, a
|
|
146
|
+
// non-Chromium browser) rejects into the catch rather than throwing past it.
|
|
147
|
+
pid = Promise.resolve()
|
|
148
|
+
.then(() => b.newBrowserCDPSession())
|
|
149
|
+
.then((s) => s.send('SystemInfo.getProcessInfo'))
|
|
150
|
+
.then((r) => r.processInfo.find((p) => p.type === 'browser')?.id)
|
|
151
|
+
.catch(() => undefined);
|
|
152
|
+
pids.set(b, pid);
|
|
153
|
+
}
|
|
154
|
+
return pid;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* CLOSE A THROWAWAY CHROME WITHOUT WAITING OUT ITS TEARDOWN.
|
|
158
|
+
*
|
|
159
|
+
* `browser.close()` waits for Chrome to EXIT, with no deadline of its own. On a
|
|
160
|
+
* busy machine Chrome's graceful shutdown stalls until its own watchdog fires —
|
|
161
|
+
* MEASURED in the full browser suite: "Teardown watchdog expired; recording dump
|
|
162
|
+
* and terminating" exactly 10.1s after the close, then a crash dump, exit code 2,
|
|
163
|
+
* 10-24s per close. Every import paid it after its result was already in hand,
|
|
164
|
+
* and a 10s test hook could never outlast it. Unloaded, the same close is 0.25s.
|
|
165
|
+
*
|
|
166
|
+
* Every Chrome here runs on a temporary profile Playwright deletes afterwards, so
|
|
167
|
+
* a graceful exit saves nothing. A healthy close is still waited for; one that
|
|
168
|
+
* outlives `graceMs` is SIGKILLed as a process GROUP (Playwright spawns Chrome
|
|
169
|
+
* detached, so its pid leads the group and the helpers go with it), and
|
|
170
|
+
* Playwright's own exit handler then removes the profile.
|
|
171
|
+
*/
|
|
172
|
+
export async function release(b, graceMs = 3_000) {
|
|
173
|
+
// Bounded too: a wedged Chrome may not answer the question either.
|
|
174
|
+
const pid = await Promise.race([pidOf(b), sleep(graceMs, undefined, { ref: false })]);
|
|
175
|
+
const closing = b.close().catch(() => { });
|
|
176
|
+
const stalled = await Promise.race([closing.then(() => false), sleep(graceMs, true, { ref: false })]);
|
|
177
|
+
// No pid, no kill: Chrome's own watchdog still ends it, just not on our clock.
|
|
178
|
+
if (!stalled || !pid)
|
|
179
|
+
return;
|
|
180
|
+
for (const target of [-pid, pid]) {
|
|
181
|
+
try {
|
|
182
|
+
process.kill(target, 'SIGKILL');
|
|
183
|
+
break;
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
// Not a group leader (or Windows, which has no groups): the pid alone.
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
await closing;
|
|
91
190
|
}
|
|
92
191
|
/**
|
|
93
192
|
* A kept browser is a child process, and a child process outlives a parent that
|
|
@@ -128,15 +227,26 @@ export async function closeBrowser() {
|
|
|
128
227
|
* and a second failing width may go unmentioned.
|
|
129
228
|
*/
|
|
130
229
|
export async function shoot(url, opts = {}) {
|
|
230
|
+
try {
|
|
231
|
+
return await shootWith(await browser(), url, opts);
|
|
232
|
+
}
|
|
233
|
+
catch (e) {
|
|
234
|
+
if (!(e instanceof ChromeStalled))
|
|
235
|
+
throw e;
|
|
236
|
+
// The pool would hand every later call this same wedged handle: replace it, once.
|
|
237
|
+
await closeBrowser();
|
|
238
|
+
return shootWith(await browser(), url, opts);
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
async function shootWith(b, url, opts) {
|
|
131
242
|
const widths = opts.widths ?? DEFAULT_WIDTHS;
|
|
132
243
|
const format = opts.format ?? DEFAULT_FORMAT;
|
|
133
|
-
const b = await browser();
|
|
134
244
|
// Each page closes in ITS OWN finally. A list of pages closed after
|
|
135
245
|
// Promise.all would miss a page whose `newPage` resolved after the first
|
|
136
246
|
// rejection — and now that the browser lives for the whole process, a leaked
|
|
137
247
|
// tab is leaked forever rather than until the next call.
|
|
138
248
|
return Promise.all(widths.map(async (width) => {
|
|
139
|
-
const page = await b.newPage({ viewport: { width, height: 900 } });
|
|
249
|
+
const page = await deadline(b.newPage({ viewport: { width, height: 900 } }), 'open a tab');
|
|
140
250
|
try {
|
|
141
251
|
return await shootOne(page, url, width, format, opts);
|
|
142
252
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sbuilder-mcp",
|
|
3
|
-
"version": "0.100.
|
|
3
|
+
"version": "0.100.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",
|