sbuilder-mcp 0.73.0 → 0.74.0

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,11 @@ 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.74.0] - 2026-09-28
10
+
11
+ ### Added
12
+ - `sb_review` gains an `unreachablePage` readiness gap: since a menu is a record separate from the page it links, a site can publish a page that no menu item and no href in the shared header, footer, or open page points at, so the address resolves and the sitemap lists it while no visitor ever arrives; it checks only published content pages (never the home page) and stays silent until both the menus and the shared sections have been read.
13
+
9
14
  ## [0.73.0] - 2026-09-28
10
15
 
11
16
  ### Added
package/CHANGELOG.vi.md CHANGED
@@ -6,6 +6,11 @@ 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.74.0] - 2026-09-28
10
+
11
+ ### Added
12
+ - `sb_review` có thêm gap readiness `unreachablePage`: vì menu là một bản ghi riêng biệt với trang mà nó trỏ tới, một site có thể publish một trang mà không mục menu nào và không href nào trong header/footer dùng chung hay trên trang đang mở trỏ tới, nên địa chỉ vẫn vào được và sitemap vẫn liệt kê trong khi không khách nào tới được; gap này chỉ xét các trang nội dung đã publish (không tính trang chủ) và im lặng cho tới khi cả menu lẫn các section dùng chung đều đã đọc được.
13
+
9
14
  ## [0.73.0] - 2026-09-28
10
15
 
11
16
  ### Added
@@ -24,7 +24,7 @@ export async function gatherReadiness(ctx, siteId, pageNodes, openPageId) {
24
24
  }
25
25
  };
26
26
  const site = encodeURIComponent(siteId);
27
- const [pageList, gateways, shipping, globals, productList, categoryList, pageLinks, formList, articleList, blogCategoryList, courseList, siteRecord, overlayList, settings] = await Promise.all([
27
+ const [pageList, gateways, shipping, globals, productList, categoryList, pageLinks, formList, articleList, blogCategoryList, courseList, siteRecord, overlayList, settings, menuList] = await Promise.all([
28
28
  get(`/api/sites/${site}/pages`),
29
29
  get(`/api/sites/${site}/payment-gateways`),
30
30
  get(`/api/sites/${site}/shipping-methods`),
@@ -67,6 +67,9 @@ export async function gatherReadiness(ctx, siteId, pageNodes, openPageId) {
67
67
  get(`/api/sites/${site}/overlays`),
68
68
  // `<html lang>` is served from this; see siteLanguage in readiness.ts.
69
69
  get(`/api/sites/${site}/settings`),
70
+ // THE MENUS, for what a visitor can reach: a page nothing links to is
71
+ // published, listed in the sitemap, and never arrived at.
72
+ get(`/api/sites/${site}/menus`),
70
73
  ]);
71
74
  // A gateway counts only when it is BOTH enabled and configured — the editor's
72
75
  // `live` getter also filters by the store's currency, which is a narrowing:
@@ -111,8 +114,33 @@ export async function gatherReadiness(ctx, siteId, pageNodes, openPageId) {
111
114
  // A page an entity links to is that entity's own; only the shared template
112
115
  // counts as the category template, and a row without the flag is read as one.
113
116
  const open = openPageId ? pageList?.pages?.find((p) => p.id === openPageId) : undefined;
117
+ // Every level of every menu: page references by id, url links by address.
118
+ const menuLinks = Array.isArray(menuList?.menus)
119
+ ? (() => {
120
+ const pageIds = [];
121
+ const hrefs = [];
122
+ const walk = (items) => {
123
+ if (!Array.isArray(items))
124
+ return;
125
+ for (const it of items) {
126
+ if (!it || typeof it !== 'object')
127
+ continue;
128
+ const r = it;
129
+ if (r.link?.type === 'page' && typeof r.link.pageId === 'string')
130
+ pageIds.push(r.link.pageId);
131
+ if (r.link?.type === 'url' && typeof r.link.url === 'string')
132
+ hrefs.push(r.link.url);
133
+ walk(r.items);
134
+ }
135
+ };
136
+ for (const m of menuList.menus)
137
+ walk(m?.items);
138
+ return { pageIds, hrefs };
139
+ })()
140
+ : null;
114
141
  return {
115
142
  pages: pageList?.pages ?? null,
143
+ menuLinks,
116
144
  openPageType: open && open.isDefaultTemplate !== false ? open.type : undefined,
117
145
  products,
118
146
  liveGateways,
@@ -81,6 +81,34 @@ const drafted = (pages, type) => pages.some((p) => p.type === type && p.status !
81
81
  * different question asked second. Shared chrome is a different question asked
82
82
  * FIRST, because it is true of every site and not only of a store.
83
83
  */
84
+ /** "/about/", "/about?x=1" and "/about" are one address; "" is the home page. */
85
+ function normalizePath(p) {
86
+ const s = p.split(/[?#]/)[0].replace(/\/+$/, '');
87
+ return s === '' ? '/' : s;
88
+ }
89
+ /** Every href a set of nodes carries: `specials.href`, and a menu node's own snapshot rows. */
90
+ function hrefsIn(nodes) {
91
+ const out = new Set();
92
+ const rows = (items) => {
93
+ if (!Array.isArray(items))
94
+ return;
95
+ for (const it of items) {
96
+ if (!it || typeof it !== 'object')
97
+ continue;
98
+ const r = it;
99
+ if (typeof r.href === 'string' && r.href !== '')
100
+ out.add(normalizePath(r.href));
101
+ rows(r.items);
102
+ }
103
+ };
104
+ for (const n of nodes) {
105
+ const h = n.specials?.href;
106
+ if (typeof h === 'string' && h !== '')
107
+ out.add(normalizePath(h));
108
+ rows(n.specials?.menuItems);
109
+ }
110
+ return out;
111
+ }
84
112
  export function readinessGaps(input) {
85
113
  const gaps = [];
86
114
  const pages = input.pages;
@@ -112,6 +140,44 @@ export function readinessGaps(input) {
112
140
  });
113
141
  }
114
142
  }
143
+ // A PAGE NO VISITOR CAN GET TO.
144
+ //
145
+ // Every tool here authors one page and a menu is a separate record, so a
146
+ // site can carry a published About page that nothing links to: the sitemap
147
+ // lists it, the address works, and no visitor ever arrives. Reachable means
148
+ // a menu item references the page or its path, or something in the shared
149
+ // chrome or on the open page carries its path as an href (a `menu` node's
150
+ // own snapshot included). Content pages only, never the home page, and only
151
+ // when both the menus and the shared sections were read — a footer link
152
+ // this rule could not see must not become a finding.
153
+ if (pages && input.menuLinks && input.globalNodes) {
154
+ const reach = new Set(input.menuLinks.hrefs.map(normalizePath));
155
+ for (const h of hrefsIn([...input.globalNodes, ...input.pageNodes]))
156
+ reach.add(h);
157
+ const byId = new Set(input.menuLinks.pageIds);
158
+ const orphans = pages.filter((p) => p.status === 'published' &&
159
+ INDEXED_PAGE_TYPES.has(p.type) &&
160
+ p.isHomepage !== true &&
161
+ typeof p.id === 'string' &&
162
+ typeof p.path === 'string' &&
163
+ !byId.has(p.id) &&
164
+ !reach.has(normalizePath(p.path)));
165
+ if (orphans.length > 0) {
166
+ const named = orphans.map((p) => p.name).filter((n) => !!n).slice(0, 3);
167
+ gaps.push({
168
+ id: 'unreachablePage',
169
+ draft: false,
170
+ problem: `${orphans.length} published page${orphans.length === 1 ? '' : 's'}` +
171
+ (named.length ? ` (${named.join(', ')}${orphans.length > named.length ? ', …' : ''})` : '') +
172
+ ' that no menu item and no link in the shared header or footer points at. The address ' +
173
+ 'works and the sitemap lists it; no visitor ever arrives.',
174
+ fix: 'Add it to the site menu — read GET /api/sites/{siteId}/menus, append ' +
175
+ '{ label, link: { type: "page", pageId } } and PUT the menu back; every bound menu ' +
176
+ 'node follows. Or link it from the footer with sb_event go_to_url. A page kept out ' +
177
+ 'on purpose (a landing page for ads) can stay out — say so.',
178
+ });
179
+ }
180
+ }
115
181
  // A SITE WITH NO SHARED SECTION IS NOT A SITE, IT IS A STACK OF PAGES.
116
182
  //
117
183
  // Nothing asked this. Every tool here authors ONE page, so a build that never
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbuilder-mcp",
3
- "version": "0.73.0",
3
+ "version": "0.74.0",
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",