sbuilder-mcp 0.7.1 → 0.7.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 CHANGED
@@ -6,6 +6,12 @@ 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.7.2] - 2026-09-08
10
+
11
+ ### Fixed
12
+ - sb_import no longer classifies a short block-level link as a button; it previously stopped at "not inline", so a documentation sidebar's list of navigation links came back as dozens of buttons. A real call to action must now be painted with a fill or a border, and a border only counts when it has width, since a Tailwind-built page sets `border-style: solid; border-width: 0` on every element.
13
+ - sb_import's page capture no longer waits a flat 600ms before reading the page; it now reuses sb_look's own settle check, which waits until the page actually stops changing rather than a fixed delay that is too long for a static page and too short for one that builds itself with scripts.
14
+
9
15
  ## [0.7.1] - 2026-09-08
10
16
 
11
17
  ### Added
package/CHANGELOG.vi.md CHANGED
@@ -6,6 +6,12 @@ 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.7.2] - 2026-09-08
10
+
11
+ ### Fixed
12
+ - sb_import không còn xếp một liên kết block-level ngắn vào loại button; trước đây rule chỉ dừng ở "không phải inline", nên danh sách liên kết điều hướng trong sidebar tài liệu bị trả về thành hàng chục button. Giờ một call-to-action thật phải được "tô" bằng màu nền hoặc viền, và viền chỉ được tính khi có độ dày, vì một trang dựng bằng Tailwind đặt `border-style: solid; border-width: 0` trên mọi phần tử.
13
+ - Bước capture trang của sb_import không còn chờ cố định 600ms trước khi đọc trang; giờ nó dùng lại chính cơ chế chờ ổn định (settle) của sb_look, chờ đến khi trang thực sự ngừng thay đổi thay vì một khoảng chờ cố định vừa quá dài với trang tĩnh vừa quá ngắn với trang tự dựng bằng script.
14
+
9
15
  ## [0.7.1] - 2026-09-08
10
16
 
11
17
  ### Added
@@ -1,4 +1,5 @@
1
1
  import { chromium } from 'playwright-core';
2
+ import { settleDom } from './shoot.js';
2
3
  /**
3
4
  * The in-page walk, as a string the browser evaluates.
4
5
  *
@@ -41,11 +42,26 @@ function capturePage(limits) {
41
42
  // label in a box with a background. Everything else is prose with a link in
42
43
  // it, and turning those into buttons produces a page of buttons.
43
44
  const looksLikeButton = (el) => {
45
+ const t = clean(el.textContent);
46
+ if (t.length === 0 || t.length > 32)
47
+ return false;
44
48
  const cls = typeof el.className === 'string' ? el.className.toLowerCase() : '';
45
49
  if (/\b(btn|button|cta)\b/.test(cls))
46
50
  return true;
47
- const t = clean(el.textContent);
48
- return t.length > 0 && t.length <= 32 && getComputedStyle(el).display !== 'inline';
51
+ // A SHORT BLOCK-LEVEL LINK IS USUALLY NAVIGATION, not a call to action. The
52
+ // rule used to stop at "not inline" and a documentation sidebar came back as
53
+ // 38 buttons — a page of pink pills where the source had a list of links.
54
+ // A real CTA is PAINTED: it has a fill or a border. Nav links have neither.
55
+ const cs = getComputedStyle(el);
56
+ const filled = cs.backgroundColor !== '' &&
57
+ cs.backgroundColor !== 'transparent' &&
58
+ !cs.backgroundColor.startsWith('rgba(0, 0, 0, 0)');
59
+ // A BORDER NEEDS WIDTH, not just a style. Tailwind's preflight sets
60
+ // `border-style: solid; border-width: 0` on every element, so "has a border
61
+ // style" is true of an entire site built with it — which is how a
62
+ // documentation sidebar came back as 38 buttons even after the first fix.
63
+ const bordered = cs.borderStyle !== '' && cs.borderStyle !== 'none' && parseFloat(cs.borderWidth || '0') > 0;
64
+ return cs.display !== 'inline' && (filled || bordered);
49
65
  };
50
66
  const IGNORE = new Set([
51
67
  'SCRIPT', 'STYLE', 'NOSCRIPT', 'TEMPLATE', 'SVG', 'PATH', 'IFRAME', 'CANVAS',
@@ -182,7 +198,13 @@ export async function capture(url, opts = {}) {
182
198
  try {
183
199
  page = await browser.newPage({ viewport: { width: opts.width ?? 1440, height: 900 } });
184
200
  await page.goto(url, { waitUntil: 'load', timeout: 30_000 });
185
- await page.waitForTimeout(600);
201
+ // THE SAME SETTLE `sb_look` USES, not a flat sleep. A fixed 600ms is wrong
202
+ // at both ends: example.com is finished long before it, and a page that
203
+ // builds itself with scripts is not finished after it — which is exactly the
204
+ // page an import is most likely to be pointed at. `settleDom` asks the
205
+ // question actually being asked (has the page stopped changing) and answers
206
+ // when it becomes true, bounded so a page that never settles is still read.
207
+ await settleDom(page);
186
208
  return (await page.evaluate(capturePage, limits));
187
209
  }
188
210
  finally {
@@ -161,7 +161,7 @@ export async function shoot(url, opts = {}) {
161
161
  * polling widget from holding the shot forever. A page that never settles is
162
162
  * photographed anyway — a late picture beats none.
163
163
  */
164
- async function settleDom(page) {
164
+ export async function settleDom(page) {
165
165
  await page
166
166
  .evaluate(({ quiet, cap }) => new Promise((resolve) => {
167
167
  const start = Date.now();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbuilder-mcp",
3
- "version": "0.7.1",
3
+ "version": "0.7.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",