sbuilder-mcp 0.95.1 → 0.95.3
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/builder.js +15 -2
- package/dist/domains/site/writecheck.js +3 -0
- package/dist/tools/page.js +45 -6
- 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.95.3] - 2026-10-27
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- `sb_add` keeps per-breakpoint `responsive` styles and config (desktop, laptop, tablet, mobile) instead of silently dropping them, routes a base-only config key to base and reports it as `base_only`, and refuses keys it cannot apply, such as `events` and `states`, with a message pointing to `sb_event`, `sb_bind` or `sb_set`.
|
|
13
|
+
|
|
14
|
+
## [0.95.2] - 2026-10-27
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- `sb_page_open` reviews a record detail page with its page type, so record-bound tiles and the page's own relation list are no longer reported as `no_data_context` or `record_relation_orphan`.
|
|
18
|
+
|
|
9
19
|
## [0.95.1] - 2026-10-27
|
|
10
20
|
|
|
11
21
|
### Fixed
|
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.95.3] - 2026-10-27
|
|
10
|
+
|
|
11
|
+
### Fixed
|
|
12
|
+
- `sb_add` giữ lại style và config `responsive` theo từng breakpoint (desktop, laptop, tablet, mobile) thay vì âm thầm bỏ đi, chuyển key config chỉ áp dụng ở base về base và báo `base_only`, và từ chối các key không áp dụng được như `events` và `states` kèm thông báo chỉ tới `sb_event`, `sb_bind` hoặc `sb_set`.
|
|
13
|
+
|
|
14
|
+
## [0.95.2] - 2026-10-27
|
|
15
|
+
|
|
16
|
+
### Fixed
|
|
17
|
+
- `sb_page_open` review trang chi tiết record theo đúng loại trang, nên các tile gắn record và danh sách quan hệ của chính trang không còn bị báo `no_data_context` hay `record_relation_orphan`.
|
|
18
|
+
|
|
9
19
|
## [0.95.1] - 2026-10-27
|
|
10
20
|
|
|
11
21
|
### Fixed
|
|
@@ -145,13 +145,26 @@ export function addSubtree(doc, parentId, spec, index, guard) {
|
|
|
145
145
|
const ids = [];
|
|
146
146
|
const build = (s, parentNodeId) => {
|
|
147
147
|
refuseComposedStamp(s.specials);
|
|
148
|
+
// A base-only config key in a breakpoint slot is read from BASE alone, so
|
|
149
|
+
// it is routed there exactly as sb_set routes it (trap 4).
|
|
150
|
+
let config = s.config;
|
|
151
|
+
let responsive = s.responsive;
|
|
152
|
+
if (responsive) {
|
|
153
|
+
responsive = {};
|
|
154
|
+
for (const [bp, slot] of Object.entries(s.responsive)) {
|
|
155
|
+
const split = splitBaseOnly(s.type, slot.config ?? {});
|
|
156
|
+
if (Object.keys(split.base).length)
|
|
157
|
+
config = { ...config, ...split.base };
|
|
158
|
+
responsive[bp] = { ...slot, ...(slot.config ? { config: split.responsive } : {}) };
|
|
159
|
+
}
|
|
160
|
+
}
|
|
148
161
|
const n = createNode(s.type, {
|
|
149
162
|
name: s.name,
|
|
150
163
|
parent: parentNodeId,
|
|
151
164
|
style: s.style,
|
|
152
|
-
config
|
|
165
|
+
config,
|
|
153
166
|
specials: s.specials,
|
|
154
|
-
responsive
|
|
167
|
+
responsive,
|
|
155
168
|
states: s.states,
|
|
156
169
|
});
|
|
157
170
|
// A child the element declares as a SATELLITE (an icon's cart-count, a
|
|
@@ -299,6 +299,9 @@ export function specCheck(spec) {
|
|
|
299
299
|
const born = ELEMENTS[s.type]?.defaults.specials ?? {};
|
|
300
300
|
if (s.config)
|
|
301
301
|
out.push(...writeCheck(s.type, 'config', s.config));
|
|
302
|
+
for (const slot of Object.values(s.responsive ?? {}))
|
|
303
|
+
if (slot.config)
|
|
304
|
+
out.push(...writeCheck(s.type, 'config', slot.config));
|
|
302
305
|
if (s.specials)
|
|
303
306
|
out.push(...writeCheck(s.type, 'specials', s.specials, { specials: { ...born, ...s.specials } }));
|
|
304
307
|
for (const c of s.children ?? [])
|
package/dist/tools/page.js
CHANGED
|
@@ -10,7 +10,7 @@ import { canvasVerdict, driftOf } from '../domains/site/pagestate.js';
|
|
|
10
10
|
import { PageDoc } from '../domains/site/document.js';
|
|
11
11
|
import { canonicalRoot, PAGE_ROOT_ID } from '../domains/site/ids.js';
|
|
12
12
|
import { addSubtree, setMany, baseOnlyKeys, moveNode, removeNode, duplicateNode, copyNodeInto, } from '../domains/site/builder.js';
|
|
13
|
-
import { baseOnlyNote } from '../domains/site/baseonly.js';
|
|
13
|
+
import { baseOnlyNote, splitBaseOnly } from '../domains/site/baseonly.js';
|
|
14
14
|
import { detachNote, presetIdOf, presetLayer } from '../domains/site/theme.js';
|
|
15
15
|
import { inertHintsFor } from '../domains/site/inert.js';
|
|
16
16
|
import { emptyEntityTemplateNote, hasSeed, layoutDocument, seedDocument, seedSummary, seededTypes, } from '../domains/site/storepage.js';
|
|
@@ -1043,14 +1043,24 @@ function heldTree(rootId, nodes) {
|
|
|
1043
1043
|
function formDocPath(siteId, formId) {
|
|
1044
1044
|
return `/api/sites/${encodeURIComponent(siteId)}/forms/${encodeURIComponent(formId)}/document`;
|
|
1045
1045
|
}
|
|
1046
|
-
|
|
1046
|
+
// STRICT. A plain z.object strips what it does not name, so `responsive` (a
|
|
1047
|
+
// nav hidden on phones) was dropped in silence, and so was an `events` list
|
|
1048
|
+
// the builder never reads: the node saved, looked right on desktop, and was
|
|
1049
|
+
// wrong everywhere else. An unknown key is now a refusal. `states` stays out:
|
|
1050
|
+
// a hover's home differs per element (config.stateHover on a button), which
|
|
1051
|
+
// sb_set routes and a raw spec slot would not.
|
|
1052
|
+
const slotSchema = z.object({ style: z.record(z.unknown()).optional(), config: z.record(z.unknown()).optional() }).strict();
|
|
1053
|
+
const specSchema = z.lazy(() => z
|
|
1054
|
+
.object({
|
|
1047
1055
|
type: z.string(),
|
|
1048
1056
|
name: z.string().optional(),
|
|
1049
1057
|
style: z.record(z.unknown()).optional(),
|
|
1050
1058
|
config: z.record(z.unknown()).optional(),
|
|
1051
1059
|
specials: z.record(z.unknown()).optional(),
|
|
1060
|
+
responsive: z.record(z.enum(['desktop', 'laptop', 'tablet', 'mobile']), slotSchema).optional(),
|
|
1052
1061
|
children: z.array(specSchema).optional(),
|
|
1053
|
-
})
|
|
1062
|
+
})
|
|
1063
|
+
.strict('spec keys are type, name, style, config, specials, responsive, children — a click is sb_event, data sb_bind, a hover sb_set with state'));
|
|
1054
1064
|
/**
|
|
1055
1065
|
* THE SITE'S OWN HEADER AND FOOTER, read off the page that already answers it.
|
|
1056
1066
|
*
|
|
@@ -1227,7 +1237,20 @@ export function registerPageTools(server, ctx) {
|
|
|
1227
1237
|
'Republish the page placing the form to show an edit.');
|
|
1228
1238
|
return text({ form: form_id, outline, ...(note ? { note } : {}), ...reviewField(ctx, session.current(), undefined, undefined, session.formType()) });
|
|
1229
1239
|
}
|
|
1230
|
-
const
|
|
1240
|
+
const siteId = siteFor(ctx, given);
|
|
1241
|
+
// The page TYPE says which record the page itself supplies — a `record`
|
|
1242
|
+
// detail page binds its tiles outside any list. The source read does not
|
|
1243
|
+
// carry it, and without it the open-time review flagged every tile of a
|
|
1244
|
+
// correctly rendering detail page. A failed read reviews as before.
|
|
1245
|
+
const typeRead = request({
|
|
1246
|
+
base: ctx.base,
|
|
1247
|
+
method: 'GET',
|
|
1248
|
+
path: `/api/sites/${encodeURIComponent(siteId)}/pages/${encodeURIComponent(page_id)}`,
|
|
1249
|
+
token: siteToken(ctx),
|
|
1250
|
+
fetchImpl: ctx.fetchImpl,
|
|
1251
|
+
}).then((r) => r?.page?.type, () => undefined);
|
|
1252
|
+
const outline = await session.open(siteId, page_id);
|
|
1253
|
+
const pageType = await typeRead;
|
|
1231
1254
|
// `open` joined the room on the way through — this only reports what it did.
|
|
1232
1255
|
const live = session.liveStatus();
|
|
1233
1256
|
const doc = session.current();
|
|
@@ -1267,7 +1290,7 @@ export function registerPageTools(server, ctx) {
|
|
|
1267
1290
|
...(blank_page_repair ? { blank_page_repair } : {}),
|
|
1268
1291
|
...(seeded_empty ? { seeded_empty } : {}),
|
|
1269
1292
|
...(warnings.length ? { compose_warnings: warnings } : {}),
|
|
1270
|
-
...reviewField(ctx, doc),
|
|
1293
|
+
...reviewField(ctx, doc, undefined, typeof pageType === 'string' ? pageType : undefined),
|
|
1271
1294
|
});
|
|
1272
1295
|
});
|
|
1273
1296
|
server.registerTool('sb_page_repair', {
|
|
@@ -1462,6 +1485,21 @@ export function registerPageTools(server, ctx) {
|
|
|
1462
1485
|
// node of the nested spec, as each will be born. Warned, still written.
|
|
1463
1486
|
const found = sayChecks([...specCheck(spec), ...session.formChecks(patches)], say);
|
|
1464
1487
|
const checks = found.length ? { checks: found } : {};
|
|
1488
|
+
// A base-only key in a breakpoint slot lands at BASE (addSubtree routes it,
|
|
1489
|
+
// as sb_set does) and so reaches every width — routed AND said.
|
|
1490
|
+
const movedKeys = new Map();
|
|
1491
|
+
const walkMoved = (n) => {
|
|
1492
|
+
for (const [bp, slot] of Object.entries(n.responsive ?? {})) {
|
|
1493
|
+
for (const k of Object.keys(splitBaseOnly(n.type, slot.config ?? {}).base))
|
|
1494
|
+
if (!movedKeys.has(k))
|
|
1495
|
+
movedKeys.set(k, bp);
|
|
1496
|
+
}
|
|
1497
|
+
for (const c of n.children ?? [])
|
|
1498
|
+
walkMoved(c);
|
|
1499
|
+
};
|
|
1500
|
+
walkMoved(spec);
|
|
1501
|
+
const moved = [...movedKeys].map(([k, bp]) => say(`base-only:${k}`, baseOnlyNote([k], bp))).filter((n) => !!n);
|
|
1502
|
+
const base_only = moved.length ? { base_only: moved.join(' ') } : {};
|
|
1465
1503
|
if (dry_run !== false) {
|
|
1466
1504
|
const refuse = session.wouldRefuse(patches);
|
|
1467
1505
|
return text({
|
|
@@ -1471,11 +1509,12 @@ export function registerPageTools(server, ctx) {
|
|
|
1471
1509
|
...(refuse ? { would_refuse: refuse } : {}),
|
|
1472
1510
|
...(inert ? { inert } : {}),
|
|
1473
1511
|
...checks,
|
|
1512
|
+
...base_only,
|
|
1474
1513
|
...forced,
|
|
1475
1514
|
});
|
|
1476
1515
|
}
|
|
1477
1516
|
await session.applyAndSave(patches);
|
|
1478
|
-
return text({ added: ids, rev: d.rev, ...(inert ? { inert } : {}), ...checks, ...forced });
|
|
1517
|
+
return text({ added: ids, rev: d.rev, ...(inert ? { inert } : {}), ...checks, ...base_only, ...forced });
|
|
1479
1518
|
});
|
|
1480
1519
|
server.registerTool('sb_set', {
|
|
1481
1520
|
description: 'Write style, config or specials keys on one node, or on many through edits (one ' +
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sbuilder-mcp",
|
|
3
|
-
"version": "0.95.
|
|
3
|
+
"version": "0.95.3",
|
|
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",
|