sbuilder-mcp 0.107.0 → 0.107.1

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.107.1] - 2026-11-18
10
+
11
+ ### Fixed
12
+ - `sb_store` `site_template` works with only a site API key, reading the template's eligibility and assigned categories from the site's own template route instead of the session-only category list.
13
+ - `sb_store` `site_template` falls back to the shared category list when the server does not report `fileable`, so it no longer wrongly says the site is not in the platform organization.
14
+
9
15
  ## [0.107.0] - 2026-11-18
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.107.1] - 2026-11-18
10
+
11
+ ### Fixed
12
+ - `sb_store` `site_template` chạy được chỉ với API key của site, đọc khả năng đánh dấu mẫu và các danh mục đang gán từ route template của chính site thay vì danh sách danh mục chỉ nhận phiên đăng nhập.
13
+ - `sb_store` `site_template` quay về danh sách danh mục chung khi máy chủ chưa trả `fileable`, nên không còn báo nhầm site không thuộc tổ chức nền tảng.
14
+
9
15
  ## [0.107.0] - 2026-11-18
10
16
 
11
17
  ### Added
@@ -917,15 +917,40 @@ export async function markSiteTemplate(ctx, siteId, name, opts) {
917
917
  throw new Error('sbuilder: this site belongs to no organization, and a template is an organization\'s — pass org_id (the platform organization\'s, for the public gallery).');
918
918
  }
919
919
  const org = (attach ?? orgId);
920
- const listed = await get(`/api/templates/categories?locale=${encodeURIComponent(opts.language ?? 'vi')}&orgId=${encodeURIComponent(org)}`);
921
- // The current filing, read behind the site's own membership check.
922
- const filed = site?.isTemplate && listed.fileable
923
- ? ((await get(`${sitePath}/template`).catch(() => ({ template: undefined }))).template?.categories ?? [])
924
- : [];
925
- const cats = listed.categories ?? [];
920
+ const locale = encodeURIComponent(opts.language ?? 'vi');
921
+ // Already in its org: ONE site-scoped read answers the catalogue, whether it
922
+ // files, and the current filing — and it takes the site's API key, which the
923
+ // session-only /api/templates/categories refuses (an agent of the platform org
924
+ // connected by key could not mark at all). Attaching needs a session anyway (a
925
+ // key cannot move a site between orgs), so only that path reads the global list.
926
+ let cats = [];
927
+ let fileable = false;
928
+ let filed = [];
929
+ const global = async () => {
930
+ const listed = await get(`/api/templates/categories?locale=${locale}&orgId=${encodeURIComponent(org)}`);
931
+ cats = listed.categories ?? [];
932
+ fileable = !!listed.fileable;
933
+ };
934
+ if (attach) {
935
+ await global();
936
+ }
937
+ else {
938
+ const { template: t } = await get(`${sitePath}/template?locale=${locale}`);
939
+ if (site?.isTemplate)
940
+ filed = t?.categories ?? [];
941
+ if (typeof t?.fileable === 'boolean') {
942
+ cats = t.available ?? [];
943
+ fileable = t.fileable;
944
+ }
945
+ else {
946
+ // A platform older than web_builder v1.0.275 does not say: ask the global
947
+ // list rather than call a platform author "not the platform organization".
948
+ await global();
949
+ }
950
+ }
926
951
  // Only the platform org's templates reach the gallery; refusing HERE keeps a
927
952
  // mark from landing with a filing the server would then reject.
928
- if (opts.categories?.length && !listed.fileable) {
953
+ if (opts.categories?.length && !fileable) {
929
954
  throw new Error(`sbuilder: organization ${org} is not the platform organization, so its templates have no gallery categories — drop categories (its members see the template on their own shelf).`);
930
955
  }
931
956
  const chosen = opts.categories?.length
@@ -949,7 +974,7 @@ export async function markSiteTemplate(ctx, siteId, name, opts) {
949
974
  ...state,
950
975
  ...(attach ? { would_attach_to: attach } : {}),
951
976
  would_mark: { name: name?.trim(), description, categories: chosen?.map((c) => c.slug) },
952
- ...(listed.fileable
977
+ ...(fileable
953
978
  ? { categories_available: catalogue(cats) }
954
979
  : { categories_available: [], note: 'not the platform organization — no gallery categories; the template goes on its members\' shelf' }),
955
980
  write: 'Name the template for the business it starts ("Shop thời trang nữ", not "Template 1"), write ONE sentence ' +
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sbuilder-mcp",
3
- "version": "0.107.0",
3
+ "version": "0.107.1",
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",