sbuilder-mcp 0.95.2 → 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 +5 -0
- package/CHANGELOG.vi.md +5 -0
- package/dist/domains/site/builder.js +15 -2
- package/dist/domains/site/writecheck.js +3 -0
- package/dist/tools/page.js +30 -4
- package/package.json +1 -1
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.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
|
+
|
|
9
14
|
## [0.95.2] - 2026-10-27
|
|
10
15
|
|
|
11
16
|
### Fixed
|
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.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
|
+
|
|
9
14
|
## [0.95.2] - 2026-10-27
|
|
10
15
|
|
|
11
16
|
### 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
|
*
|
|
@@ -1475,6 +1485,21 @@ export function registerPageTools(server, ctx) {
|
|
|
1475
1485
|
// node of the nested spec, as each will be born. Warned, still written.
|
|
1476
1486
|
const found = sayChecks([...specCheck(spec), ...session.formChecks(patches)], say);
|
|
1477
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(' ') } : {};
|
|
1478
1503
|
if (dry_run !== false) {
|
|
1479
1504
|
const refuse = session.wouldRefuse(patches);
|
|
1480
1505
|
return text({
|
|
@@ -1484,11 +1509,12 @@ export function registerPageTools(server, ctx) {
|
|
|
1484
1509
|
...(refuse ? { would_refuse: refuse } : {}),
|
|
1485
1510
|
...(inert ? { inert } : {}),
|
|
1486
1511
|
...checks,
|
|
1512
|
+
...base_only,
|
|
1487
1513
|
...forced,
|
|
1488
1514
|
});
|
|
1489
1515
|
}
|
|
1490
1516
|
await session.applyAndSave(patches);
|
|
1491
|
-
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 });
|
|
1492
1518
|
});
|
|
1493
1519
|
server.registerTool('sb_set', {
|
|
1494
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",
|