@wix/mcp 1.0.32 → 1.0.33
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/build/bin-standalone.js +244 -1
- package/build/bin-standalone.js.map +4 -4
- package/build/cjs/index.cjs +53 -54
- package/build/cjs/index.cjs.map +2 -2
- package/build/dts/site-widget-tools/edit-site-tool/index.d.ts.map +1 -1
- package/build/dts/site-widget-tools/edit-site-tool/index.js +4 -2
- package/build/dts/site-widget-tools/edit-site-tool/index.js.map +1 -1
- package/build/dts/site-widget-tools/site-builder-tool/index.d.ts.map +1 -1
- package/build/dts/site-widget-tools/site-builder-tool/index.js +4 -2
- package/build/dts/site-widget-tools/site-builder-tool/index.js.map +1 -1
- package/build/dts/toolkit.d.ts +5 -10
- package/build/dts/toolkit.d.ts.map +1 -1
- package/build/dts/toolkit.js +4 -4
- package/build/dts/toolkit.js.map +1 -1
- package/build/dts/toolkit.test.js +41 -0
- package/build/dts/toolkit.test.js.map +1 -1
- package/build/dts/wixel/index.d.ts.map +1 -1
- package/build/dts/wixel/index.js +4 -2
- package/build/dts/wixel/index.js.map +1 -1
- package/build/esm/index.js +53 -54
- package/build/esm/index.js.map +2 -2
- package/package.json +3 -3
package/build/bin-standalone.js
CHANGED
|
@@ -11210,8 +11210,251 @@ var defaultReadmeDocs = [
|
|
|
11210
11210
|
}
|
|
11211
11211
|
];
|
|
11212
11212
|
|
|
11213
|
+
// ../dynamic-context-enricher/build/index.mjs
|
|
11214
|
+
var __defProp2 = Object.defineProperty;
|
|
11215
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
11216
|
+
var __esm2 = (fn, res) => function __init() {
|
|
11217
|
+
return fn && (res = (0, fn[__getOwnPropNames2(fn)[0]])(fn = 0)), res;
|
|
11218
|
+
};
|
|
11219
|
+
var __export2 = (target, all) => {
|
|
11220
|
+
for (var name in all)
|
|
11221
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
11222
|
+
};
|
|
11223
|
+
var enrich_exports = {};
|
|
11224
|
+
__export2(enrich_exports, {
|
|
11225
|
+
enrichDynamicContext: () => enrichDynamicContext
|
|
11226
|
+
});
|
|
11227
|
+
function snakeToCamel(obj) {
|
|
11228
|
+
if (Array.isArray(obj)) return obj.map(snakeToCamel);
|
|
11229
|
+
if (obj !== null && typeof obj === "object") {
|
|
11230
|
+
const result = {};
|
|
11231
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
11232
|
+
const camelKey = key.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
|
|
11233
|
+
result[camelKey] = snakeToCamel(value);
|
|
11234
|
+
}
|
|
11235
|
+
return result;
|
|
11236
|
+
}
|
|
11237
|
+
return obj;
|
|
11238
|
+
}
|
|
11239
|
+
function formatTimestamp(value) {
|
|
11240
|
+
if (!value) return "";
|
|
11241
|
+
try {
|
|
11242
|
+
const date = new Date(value);
|
|
11243
|
+
return date.toLocaleDateString("en-US", {
|
|
11244
|
+
month: "short",
|
|
11245
|
+
day: "2-digit",
|
|
11246
|
+
year: "numeric",
|
|
11247
|
+
hour: "2-digit",
|
|
11248
|
+
minute: "2-digit",
|
|
11249
|
+
hour12: false,
|
|
11250
|
+
timeZone: "UTC"
|
|
11251
|
+
});
|
|
11252
|
+
} catch {
|
|
11253
|
+
return value;
|
|
11254
|
+
}
|
|
11255
|
+
}
|
|
11256
|
+
function capitalize(s) {
|
|
11257
|
+
if (!s) return s;
|
|
11258
|
+
return s.charAt(0).toUpperCase() + s.slice(1);
|
|
11259
|
+
}
|
|
11260
|
+
function renderAccountHeader(account) {
|
|
11261
|
+
const lines = [];
|
|
11262
|
+
if (account.displayName) {
|
|
11263
|
+
lines.push(`**Account**: ${account.displayName}`);
|
|
11264
|
+
}
|
|
11265
|
+
if (account.id) {
|
|
11266
|
+
lines.push(`**Account ID**: \`${account.id}\``);
|
|
11267
|
+
}
|
|
11268
|
+
const meta = [];
|
|
11269
|
+
if (account.status) meta.push(`Status: **${account.status}**`);
|
|
11270
|
+
if (account.coBranding && account.coBranding !== "None" && account.coBranding !== "CO_BRANDING_UNSPECIFIED") {
|
|
11271
|
+
meta.push("Co-branded");
|
|
11272
|
+
}
|
|
11273
|
+
if (meta.length) lines.push(meta.join(" \xB7 "));
|
|
11274
|
+
if (account.createdDate) {
|
|
11275
|
+
let dateLine = `**Created**: ${formatTimestamp(account.createdDate)}`;
|
|
11276
|
+
if (account.updatedDate) {
|
|
11277
|
+
dateLine += ` \xB7 **Updated**: ${formatTimestamp(account.updatedDate)}`;
|
|
11278
|
+
}
|
|
11279
|
+
lines.push(dateLine);
|
|
11280
|
+
}
|
|
11281
|
+
return lines.length ? lines.join("\n") : "";
|
|
11282
|
+
}
|
|
11283
|
+
function renderStatusBadges(site) {
|
|
11284
|
+
const tags = [];
|
|
11285
|
+
tags.push(site.published ? "Published" : "Draft");
|
|
11286
|
+
if (site.premium) tags.push("Premium");
|
|
11287
|
+
if (site.domainConnected) tags.push("Custom Domain");
|
|
11288
|
+
if (site.editorType && site.editorType !== "EDITOR_TYPE_UNSPECIFIED" && site.editorType !== "UNKNOWN") {
|
|
11289
|
+
tags.push(capitalize(site.editorType.replace(/_/g, " ").toLowerCase()));
|
|
11290
|
+
}
|
|
11291
|
+
return tags.join(" \xB7 ");
|
|
11292
|
+
}
|
|
11293
|
+
function renderApps(apps) {
|
|
11294
|
+
const relevant = apps.filter((a) => a.appId && KNOWN_APPS[a.appId]).sort(
|
|
11295
|
+
(a, b) => (KNOWN_APPS[a.appId] ?? "").localeCompare(KNOWN_APPS[b.appId] ?? "")
|
|
11296
|
+
);
|
|
11297
|
+
if (!relevant.length) return "";
|
|
11298
|
+
const lines = [];
|
|
11299
|
+
for (const app of relevant) {
|
|
11300
|
+
let line = `- **${KNOWN_APPS[app.appId]}** (ID: \`${app.appId}\`)`;
|
|
11301
|
+
if (app.catalogVersion) {
|
|
11302
|
+
line += ` \u2014 Catalog app version: **${app.catalogVersion}**`;
|
|
11303
|
+
}
|
|
11304
|
+
lines.push(line);
|
|
11305
|
+
}
|
|
11306
|
+
return lines.join("\n");
|
|
11307
|
+
}
|
|
11308
|
+
function renderProperties(props) {
|
|
11309
|
+
const sections = [];
|
|
11310
|
+
const locale = [];
|
|
11311
|
+
if (props.language) locale.push(`- Language: **${props.language}**`);
|
|
11312
|
+
if (props.locale?.country) locale.push(`- Country: **${props.locale.country}**`);
|
|
11313
|
+
if (props.timeZone) locale.push(`- Timezone: **${props.timeZone}**`);
|
|
11314
|
+
if (props.paymentCurrency) locale.push(`- Currency: **${props.paymentCurrency}**`);
|
|
11315
|
+
if (locale.length) {
|
|
11316
|
+
sections.push(`**Locale & Region**
|
|
11317
|
+
${locale.join("\n")}`);
|
|
11318
|
+
}
|
|
11319
|
+
const contact = [];
|
|
11320
|
+
if (props.email) contact.push(`- Email: **${props.email}**`);
|
|
11321
|
+
if (props.phone) contact.push(`- Phone: **${props.phone}**`);
|
|
11322
|
+
if (contact.length) {
|
|
11323
|
+
sections.push(`**Contact**
|
|
11324
|
+
${contact.join("\n")}`);
|
|
11325
|
+
}
|
|
11326
|
+
return sections.join("\n\n");
|
|
11327
|
+
}
|
|
11328
|
+
function renderSite(site, index) {
|
|
11329
|
+
const lines = [];
|
|
11330
|
+
const heading = site.displayName ?? `Site ${index}`;
|
|
11331
|
+
lines.push(`## ${index}. ${heading}`);
|
|
11332
|
+
lines.push("");
|
|
11333
|
+
if (site.id) lines.push(`**ID**: \`${site.id}\``);
|
|
11334
|
+
if (site.url) lines.push(`**URL**: [${site.url}](${site.url})`);
|
|
11335
|
+
lines.push(`**Status**: ${renderStatusBadges(site)}`);
|
|
11336
|
+
if (site.createdDate) {
|
|
11337
|
+
let dateLine = `**Created**: ${formatTimestamp(site.createdDate)}`;
|
|
11338
|
+
if (site.updatedDate) {
|
|
11339
|
+
dateLine += ` \xB7 **Updated**: ${formatTimestamp(site.updatedDate)}`;
|
|
11340
|
+
}
|
|
11341
|
+
lines.push(dateLine);
|
|
11342
|
+
}
|
|
11343
|
+
if (site.veloEnabled !== void 0 && site.veloEnabled !== null) {
|
|
11344
|
+
lines.push(`**Velo**: ${site.veloEnabled ? "Enabled" : "Disabled"}`);
|
|
11345
|
+
}
|
|
11346
|
+
if (site.properties) {
|
|
11347
|
+
const propsContent = renderProperties(site.properties);
|
|
11348
|
+
if (propsContent) {
|
|
11349
|
+
lines.push("");
|
|
11350
|
+
lines.push("### Properties");
|
|
11351
|
+
lines.push("");
|
|
11352
|
+
lines.push(propsContent);
|
|
11353
|
+
}
|
|
11354
|
+
}
|
|
11355
|
+
const appsContent = renderApps(site.installedApps ?? []);
|
|
11356
|
+
if (appsContent) {
|
|
11357
|
+
lines.push("");
|
|
11358
|
+
lines.push("### Apps");
|
|
11359
|
+
lines.push("");
|
|
11360
|
+
lines.push(appsContent);
|
|
11361
|
+
}
|
|
11362
|
+
lines.push("");
|
|
11363
|
+
lines.push("---");
|
|
11364
|
+
lines.push("");
|
|
11365
|
+
return lines.join("\n");
|
|
11366
|
+
}
|
|
11367
|
+
function enrichDynamicContext(data) {
|
|
11368
|
+
let parsed = data;
|
|
11369
|
+
if (typeof data === "string") {
|
|
11370
|
+
try {
|
|
11371
|
+
parsed = JSON.parse(data);
|
|
11372
|
+
} catch {
|
|
11373
|
+
return data;
|
|
11374
|
+
}
|
|
11375
|
+
}
|
|
11376
|
+
if (parsed === null || parsed === void 0) return "";
|
|
11377
|
+
if (typeof parsed !== "object") return "";
|
|
11378
|
+
const response = snakeToCamel(parsed);
|
|
11379
|
+
const sections = [];
|
|
11380
|
+
sections.push("# My Wix Sites Context");
|
|
11381
|
+
sections.push("");
|
|
11382
|
+
if (response.account) {
|
|
11383
|
+
const accountSection = renderAccountHeader(response.account);
|
|
11384
|
+
if (accountSection) {
|
|
11385
|
+
sections.push(accountSection);
|
|
11386
|
+
}
|
|
11387
|
+
}
|
|
11388
|
+
const siteCount = response.sites?.length ?? 0;
|
|
11389
|
+
const hasNext = Boolean(response.pagingMetadata?.cursors?.next);
|
|
11390
|
+
let countLine = `_Showing ${siteCount} sites`;
|
|
11391
|
+
if (hasNext) countLine += " (more available)";
|
|
11392
|
+
countLine += "_";
|
|
11393
|
+
sections.push(countLine);
|
|
11394
|
+
sections.push("");
|
|
11395
|
+
sections.push("---");
|
|
11396
|
+
sections.push("");
|
|
11397
|
+
const hasCatalogVersion = response.sites?.some(
|
|
11398
|
+
(site) => site.installedApps?.some(
|
|
11399
|
+
(app) => app.appId && KNOWN_APPS[app.appId] && app.catalogVersion
|
|
11400
|
+
)
|
|
11401
|
+
);
|
|
11402
|
+
if (hasCatalogVersion) {
|
|
11403
|
+
sections.push(
|
|
11404
|
+
"> **Catalog Version**: When a site shows a Catalog app version (V1/V3), always use the APIs matching that version."
|
|
11405
|
+
);
|
|
11406
|
+
sections.push("");
|
|
11407
|
+
}
|
|
11408
|
+
if (response.sites?.length) {
|
|
11409
|
+
for (let i = 0; i < response.sites.length; i++) {
|
|
11410
|
+
sections.push(renderSite(response.sites[i], i + 1));
|
|
11411
|
+
}
|
|
11412
|
+
}
|
|
11413
|
+
if (!response.account && !siteCount) return "";
|
|
11414
|
+
return sections.join("\n");
|
|
11415
|
+
}
|
|
11416
|
+
var KNOWN_APPS;
|
|
11417
|
+
var init_enrich = __esm2({
|
|
11418
|
+
"src/enrich.ts"() {
|
|
11419
|
+
"use strict";
|
|
11420
|
+
KNOWN_APPS = {
|
|
11421
|
+
"14bcded7-0066-7c35-14d7-466cb3f09103": "Wix Bookings",
|
|
11422
|
+
"215238eb-22a5-4c36-9e7b-e7c08025e04e": "Wix Stores",
|
|
11423
|
+
"9a5d83fd-8570-482e-81ab-cfa88942ee60": "Wix Restaurants (Orders)",
|
|
11424
|
+
"b278a256-2757-4f19-9313-c05c783bec92": "Wix Restaurants (Menus)"
|
|
11425
|
+
};
|
|
11426
|
+
}
|
|
11427
|
+
});
|
|
11428
|
+
init_enrich();
|
|
11429
|
+
var DYNAMIC_CONTEXT_URL = "https://dev.wix.com/_api/dynamic-context/v1/dynamic-context";
|
|
11430
|
+
async function getDynamicContext(auth, httpClient, filter) {
|
|
11431
|
+
const { enrichDynamicContext: enrichDynamicContext2 } = await Promise.resolve().then(() => (init_enrich(), enrich_exports));
|
|
11432
|
+
try {
|
|
11433
|
+
const accountHeaders = await auth.getAccountAuthHeaders();
|
|
11434
|
+
const body = {};
|
|
11435
|
+
if (filter?.siteId) body.site_id = filter.siteId;
|
|
11436
|
+
else if (filter?.siteName) body.site_name = filter.siteName;
|
|
11437
|
+
const response = await httpClient.request({
|
|
11438
|
+
url: DYNAMIC_CONTEXT_URL,
|
|
11439
|
+
method: "POST",
|
|
11440
|
+
headers: {
|
|
11441
|
+
...accountHeaders,
|
|
11442
|
+
"Content-Type": "application/json",
|
|
11443
|
+
"Petri_ovr": "shouldReturnDynamicContextInMCP#B",
|
|
11444
|
+
"X-Wix-Office": "1"
|
|
11445
|
+
},
|
|
11446
|
+
data: body
|
|
11447
|
+
});
|
|
11448
|
+
return enrichDynamicContext2(response.data);
|
|
11449
|
+
} catch (error) {
|
|
11450
|
+
console.error(
|
|
11451
|
+
`[dynamic-context-enricher] Fetch failed: ${error.message}`
|
|
11452
|
+
);
|
|
11453
|
+
return "";
|
|
11454
|
+
}
|
|
11455
|
+
}
|
|
11456
|
+
|
|
11213
11457
|
// src/docs/get-to-know.ts
|
|
11214
|
-
import { getDynamicContext } from "@wix/dynamic-context-enricher";
|
|
11215
11458
|
async function addGetToKnowTools({
|
|
11216
11459
|
server: server2,
|
|
11217
11460
|
disableTools = [],
|