@diviops/mcp-server 1.5.31 → 1.5.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/README.md +23 -13
- package/dist/compatibility.d.ts +11 -0
- package/dist/cross-env-preflight/header-preflight.d.ts +7 -0
- package/dist/cross-env-preflight/header-preflight.js +94 -0
- package/dist/index.js +376 -13
- package/dist/preset-cli/cli.d.ts +1 -1
- package/dist/preset-cli/cli.js +12 -3
- package/dist/preset-cli/nav-emitter.d.ts +17 -6
- package/dist/preset-cli/nav-emitter.js +148 -36
- package/dist/wp-cli.d.ts +20 -0
- package/dist/wp-cli.js +114 -4
- package/dist/wp-client.js +5 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -12,7 +12,7 @@ import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
|
|
|
12
12
|
import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
|
|
13
13
|
import { z } from "zod";
|
|
14
14
|
import { WPClient } from "./wp-client.js";
|
|
15
|
-
import { MissingCapabilityError, proToolGatesSatisfied } from "./compatibility.js";
|
|
15
|
+
import { MissingCapabilityError, proToolGatesSatisfied, } from "./compatibility.js";
|
|
16
16
|
import { ErrorCodes, envelopeMap, recordIdempotent, serializeEnvelope, withCode, wrapResponse, } from "./envelope.js";
|
|
17
17
|
import { preflightCrossEnvHeaderSync, } from "./cross-env-preflight/header-preflight.js";
|
|
18
18
|
import { createSourcePayloadRef, loadSourcePayloadRef, } from "./cross-env-preflight/source-payload-ref.js";
|
|
@@ -88,6 +88,62 @@ const server = new McpServer({
|
|
|
88
88
|
version: SERVER_VERSION,
|
|
89
89
|
});
|
|
90
90
|
let handshakeState = { kind: "pending" };
|
|
91
|
+
const toolCatalog = [];
|
|
92
|
+
function recordToolCatalog(entry) {
|
|
93
|
+
const existing = toolCatalog.find((item) => item.name === entry.name && item.kind === entry.kind);
|
|
94
|
+
if (existing) {
|
|
95
|
+
Object.assign(existing, entry);
|
|
96
|
+
return existing;
|
|
97
|
+
}
|
|
98
|
+
toolCatalog.push(entry);
|
|
99
|
+
return entry;
|
|
100
|
+
}
|
|
101
|
+
function countTools(predicate) {
|
|
102
|
+
return toolCatalog.filter(predicate).length;
|
|
103
|
+
}
|
|
104
|
+
function registeredToolNamesFor(kind) {
|
|
105
|
+
return toolCatalog
|
|
106
|
+
.filter((entry) => entry.registered)
|
|
107
|
+
.filter((entry) => (kind ? entry.kind === kind : true))
|
|
108
|
+
.map((entry) => entry.name)
|
|
109
|
+
.sort();
|
|
110
|
+
}
|
|
111
|
+
function proTargetSummary(target) {
|
|
112
|
+
const possible = toolCatalog
|
|
113
|
+
.filter((entry) => entry.kind === "pro" && entry.target === target)
|
|
114
|
+
.sort((a, b) => a.name.localeCompare(b.name));
|
|
115
|
+
const registered = possible.filter((entry) => entry.registered);
|
|
116
|
+
return {
|
|
117
|
+
registered_tool_count: registered.length,
|
|
118
|
+
possible_tool_count: possible.length,
|
|
119
|
+
registered_tool_names: registered.map((entry) => entry.name),
|
|
120
|
+
capability_keys: registered
|
|
121
|
+
.map((entry) => entry.capability_key)
|
|
122
|
+
.filter((key) => typeof key === "string")
|
|
123
|
+
.sort(),
|
|
124
|
+
};
|
|
125
|
+
}
|
|
126
|
+
function buildToolCatalogSummary() {
|
|
127
|
+
const registeredTotal = countTools((entry) => entry.registered);
|
|
128
|
+
const registeredLocal = countTools((entry) => entry.registered && entry.kind === "server_local");
|
|
129
|
+
const registeredPlugin = countTools((entry) => entry.registered && entry.kind === "plugin");
|
|
130
|
+
const registeredPro = countTools((entry) => entry.registered && entry.kind === "pro");
|
|
131
|
+
const proTargets = Array.from(new Set(toolCatalog
|
|
132
|
+
.filter((entry) => entry.kind === "pro" && entry.target)
|
|
133
|
+
.map((entry) => entry.target))).sort();
|
|
134
|
+
return {
|
|
135
|
+
registered_total: registeredTotal,
|
|
136
|
+
possible_total: toolCatalog.length,
|
|
137
|
+
by_kind: {
|
|
138
|
+
server_local: registeredLocal,
|
|
139
|
+
plugin: registeredPlugin,
|
|
140
|
+
pro: registeredPro,
|
|
141
|
+
},
|
|
142
|
+
always_on_registered: registeredLocal + registeredPlugin,
|
|
143
|
+
registered_tool_names: registeredToolNamesFor(),
|
|
144
|
+
pro: Object.fromEntries(proTargets.map((target) => [target, proTargetSummary(target)])),
|
|
145
|
+
};
|
|
146
|
+
}
|
|
91
147
|
const BASE_META_CAPABILITIES = [
|
|
92
148
|
"pages",
|
|
93
149
|
"modules",
|
|
@@ -110,6 +166,36 @@ function enabledCapabilityKeys(prefix) {
|
|
|
110
166
|
.filter((key) => (prefix ? key.startsWith(prefix) : true))
|
|
111
167
|
.sort();
|
|
112
168
|
}
|
|
169
|
+
function buildPluginVersionSummary() {
|
|
170
|
+
if (handshakeState.kind !== "ok") {
|
|
171
|
+
return {
|
|
172
|
+
diviops_agent: { active: false, version: null },
|
|
173
|
+
diviops_agent_pro: { active: false, version: null },
|
|
174
|
+
fluent_cart: { active: false, version: null },
|
|
175
|
+
fluent_cart_pro: { active: false, version: null },
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
const plugins = handshakeState.plugins;
|
|
179
|
+
const fluentCartTarget = handshakeState.availableTargets.fluentcart;
|
|
180
|
+
return {
|
|
181
|
+
diviops_agent: {
|
|
182
|
+
active: true,
|
|
183
|
+
version: handshakeState.pluginVersion,
|
|
184
|
+
},
|
|
185
|
+
diviops_agent_pro: plugins.diviops_agent_pro ?? {
|
|
186
|
+
active: handshakeState.proActive,
|
|
187
|
+
version: handshakeState.proVersion ?? null,
|
|
188
|
+
},
|
|
189
|
+
fluent_cart: plugins.fluent_cart ?? {
|
|
190
|
+
active: fluentCartTarget?.present === true,
|
|
191
|
+
version: fluentCartTarget?.version ?? null,
|
|
192
|
+
},
|
|
193
|
+
fluent_cart_pro: plugins.fluent_cart_pro ?? {
|
|
194
|
+
active: false,
|
|
195
|
+
version: null,
|
|
196
|
+
},
|
|
197
|
+
};
|
|
198
|
+
}
|
|
113
199
|
function buildMetaInfo() {
|
|
114
200
|
const fluentCartCapabilityKeys = enabledCapabilityKeys("fluentcart_");
|
|
115
201
|
const crossEnvCapabilityKeys = enabledCapabilityKeys("cross_env_");
|
|
@@ -134,12 +220,17 @@ function buildMetaInfo() {
|
|
|
134
220
|
: [...BASE_META_CAPABILITIES];
|
|
135
221
|
if (crossEnvActive)
|
|
136
222
|
capabilities.push("cross_env");
|
|
223
|
+
const tools = buildToolCatalogSummary();
|
|
137
224
|
return {
|
|
138
225
|
brand: "DiviOps",
|
|
139
226
|
server: "diviops-mcp",
|
|
227
|
+
server_version: SERVER_VERSION,
|
|
140
228
|
version: SERVER_VERSION,
|
|
141
229
|
license: "MIT",
|
|
142
230
|
capabilities,
|
|
231
|
+
tool_count: tools.registered_total,
|
|
232
|
+
tools,
|
|
233
|
+
plugins: buildPluginVersionSummary(),
|
|
143
234
|
handshake: handshakeState.kind === "ok"
|
|
144
235
|
? {
|
|
145
236
|
state: "ok",
|
|
@@ -199,6 +290,12 @@ function requireCapability(key) {
|
|
|
199
290
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
200
291
|
function registerPluginTool(name, config, handler) {
|
|
201
292
|
const key = name.replace(/^diviops_/, "");
|
|
293
|
+
recordToolCatalog({
|
|
294
|
+
name,
|
|
295
|
+
kind: "plugin",
|
|
296
|
+
registered: true,
|
|
297
|
+
capability_key: key,
|
|
298
|
+
});
|
|
202
299
|
const wrapped = (async (args) => {
|
|
203
300
|
try {
|
|
204
301
|
requireCapability(key);
|
|
@@ -225,6 +322,7 @@ function registerPluginTool(name, config, handler) {
|
|
|
225
322
|
* can emit it on per-call responses (#597).
|
|
226
323
|
*/
|
|
227
324
|
function registerLocalTool(name, config, handler) {
|
|
325
|
+
recordToolCatalog({ name, kind: "server_local", registered: true });
|
|
228
326
|
recordIdempotent(name, config?._meta);
|
|
229
327
|
server.registerTool(name, config, handler);
|
|
230
328
|
}
|
|
@@ -266,10 +364,18 @@ function registerLocalTool(name, config, handler) {
|
|
|
266
364
|
* the resolved handshakeState.
|
|
267
365
|
*/
|
|
268
366
|
function registerProTool(name, config, handler, gates) {
|
|
367
|
+
const catalogEntry = recordToolCatalog({
|
|
368
|
+
name,
|
|
369
|
+
kind: "pro",
|
|
370
|
+
registered: false,
|
|
371
|
+
target: gates.target,
|
|
372
|
+
capability_key: gates.capabilityKey,
|
|
373
|
+
});
|
|
269
374
|
if (handshakeState.kind !== "ok")
|
|
270
375
|
return;
|
|
271
376
|
if (!proToolGatesSatisfied(handshakeState, gates))
|
|
272
377
|
return;
|
|
378
|
+
catalogEntry.registered = true;
|
|
273
379
|
recordIdempotent(name, config?._meta);
|
|
274
380
|
server.registerTool(name, config, handler);
|
|
275
381
|
}
|
|
@@ -417,6 +523,146 @@ registerPluginTool("diviops_module_get", {
|
|
|
417
523
|
],
|
|
418
524
|
};
|
|
419
525
|
});
|
|
526
|
+
registerPluginTool("diviops_menu_list", {
|
|
527
|
+
description: "List WordPress nav menus, registered theme locations, and current location assignments. Free/core, read-only. Requires the WordPress user to have edit_theme_options. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; success payload is { menus[], count, registered_locations, assigned_locations }.",
|
|
528
|
+
annotations: { idempotentHint: true },
|
|
529
|
+
_meta: { idempotent: "true" },
|
|
530
|
+
}, async () => {
|
|
531
|
+
const result = await wp.requestEnveloped("/menu/list");
|
|
532
|
+
return {
|
|
533
|
+
content: [
|
|
534
|
+
{ type: "text", text: serializeEnvelope(result, "diviops_menu_list") },
|
|
535
|
+
],
|
|
536
|
+
};
|
|
537
|
+
});
|
|
538
|
+
registerPluginTool("diviops_menu_get", {
|
|
539
|
+
description: "Fetch one WordPress nav menu with normalized flat items and a nested item tree. Free/core, read-only. Requires edit_theme_options. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; missing menu_id returns not_found.",
|
|
540
|
+
inputSchema: {
|
|
541
|
+
menu_id: z.number().int().positive().describe("WordPress nav menu term ID"),
|
|
542
|
+
},
|
|
543
|
+
annotations: { idempotentHint: true },
|
|
544
|
+
_meta: { idempotent: "true" },
|
|
545
|
+
}, async ({ menu_id }) => {
|
|
546
|
+
const result = await wp.requestEnveloped(`/menu/get/${menu_id}`);
|
|
547
|
+
return {
|
|
548
|
+
content: [
|
|
549
|
+
{ type: "text", text: serializeEnvelope(result, "diviops_menu_get") },
|
|
550
|
+
],
|
|
551
|
+
};
|
|
552
|
+
});
|
|
553
|
+
registerPluginTool("diviops_menu_create", {
|
|
554
|
+
description: "Create a WordPress nav menu by name, optionally with a requested slug. Free/core single-site menu authoring primitive. Requires edit_theme_options. Existing same-name or same-slug menus return ok:true with noop:true instead of creating duplicates. Does not assign the menu to a location; follow with diviops_menu_location_assign. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }." +
|
|
555
|
+
DRY_RUN_DESC_SUFFIX,
|
|
556
|
+
inputSchema: {
|
|
557
|
+
name: z.string().min(1).describe("Menu display name, e.g. Primary"),
|
|
558
|
+
slug: z.string().optional().describe("Optional sanitized menu slug. Omit to let WordPress derive it."),
|
|
559
|
+
dry_run: DRY_RUN_FIELD,
|
|
560
|
+
},
|
|
561
|
+
annotations: { idempotentHint: true },
|
|
562
|
+
_meta: { idempotent: "true" },
|
|
563
|
+
}, async ({ name, slug, dry_run }) => {
|
|
564
|
+
const body = { name };
|
|
565
|
+
if (slug !== undefined)
|
|
566
|
+
body.slug = slug;
|
|
567
|
+
if (dry_run)
|
|
568
|
+
body.dry_run = true;
|
|
569
|
+
const result = await wp.requestEnveloped("/menu/create", {
|
|
570
|
+
method: "POST",
|
|
571
|
+
body,
|
|
572
|
+
});
|
|
573
|
+
return {
|
|
574
|
+
content: [
|
|
575
|
+
{ type: "text", text: serializeEnvelope(result, "diviops_menu_create") },
|
|
576
|
+
],
|
|
577
|
+
};
|
|
578
|
+
});
|
|
579
|
+
registerPluginTool("diviops_menu_item_add_page", {
|
|
580
|
+
description: "Append a readable published page to an existing WordPress nav menu. Free/core single-site menu authoring primitive. Requires edit_theme_options plus read access to the page. Validates menu, page status/visibility, and optional parent menu item. Existing same page under the same parent returns noop:true; a different existing label returns conflict because item-update/reorder are deferred. No delete, reorder, or broad reconcile path. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }." +
|
|
581
|
+
DRY_RUN_DESC_SUFFIX,
|
|
582
|
+
inputSchema: {
|
|
583
|
+
menu_id: z.number().int().positive().describe("WordPress nav menu term ID"),
|
|
584
|
+
page_id: z.number().int().positive().describe("Published page ID to add"),
|
|
585
|
+
label: z.string().optional().describe("Optional menu label. Defaults to the page title."),
|
|
586
|
+
parent_item_id: z.number().int().min(0).optional().default(0).describe("Optional parent menu item ID from diviops_menu_get; 0 for top level."),
|
|
587
|
+
dry_run: DRY_RUN_FIELD,
|
|
588
|
+
},
|
|
589
|
+
annotations: { idempotentHint: true },
|
|
590
|
+
_meta: { idempotent: "true" },
|
|
591
|
+
}, async ({ menu_id, page_id, label, parent_item_id, dry_run }) => {
|
|
592
|
+
const body = {
|
|
593
|
+
menu_id,
|
|
594
|
+
page_id,
|
|
595
|
+
parent_item_id: parent_item_id ?? 0,
|
|
596
|
+
};
|
|
597
|
+
if (label !== undefined)
|
|
598
|
+
body.label = label;
|
|
599
|
+
if (dry_run)
|
|
600
|
+
body.dry_run = true;
|
|
601
|
+
const result = await wp.requestEnveloped("/menu/item/add-page", {
|
|
602
|
+
method: "POST",
|
|
603
|
+
body,
|
|
604
|
+
});
|
|
605
|
+
return {
|
|
606
|
+
content: [
|
|
607
|
+
{ type: "text", text: serializeEnvelope(result, "diviops_menu_item_add_page") },
|
|
608
|
+
],
|
|
609
|
+
};
|
|
610
|
+
});
|
|
611
|
+
registerPluginTool("diviops_menu_item_add_custom", {
|
|
612
|
+
description: "Append a custom URL item to an existing WordPress nav menu. Free/core single-site menu authoring primitive. Requires edit_theme_options. URL validation allows only http, https, root-relative paths, same-page hashes, mailto, and tel; protocol-relative/javascript/data URLs are rejected. Existing same URL under the same parent with the same label returns noop:true. No delete, reorder, or broad reconcile path. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }." +
|
|
613
|
+
DRY_RUN_DESC_SUFFIX,
|
|
614
|
+
inputSchema: {
|
|
615
|
+
menu_id: z.number().int().positive().describe("WordPress nav menu term ID"),
|
|
616
|
+
label: z.string().min(1).describe("Menu item label"),
|
|
617
|
+
url: z.string().min(1).describe("Allowed URL: http(s), root-relative path, #hash, mailto, or tel"),
|
|
618
|
+
parent_item_id: z.number().int().min(0).optional().default(0).describe("Optional parent menu item ID from diviops_menu_get; 0 for top level."),
|
|
619
|
+
dry_run: DRY_RUN_FIELD,
|
|
620
|
+
},
|
|
621
|
+
annotations: { idempotentHint: true },
|
|
622
|
+
_meta: { idempotent: "true" },
|
|
623
|
+
}, async ({ menu_id, label, url, parent_item_id, dry_run }) => {
|
|
624
|
+
const body = {
|
|
625
|
+
menu_id,
|
|
626
|
+
label,
|
|
627
|
+
url,
|
|
628
|
+
parent_item_id: parent_item_id ?? 0,
|
|
629
|
+
};
|
|
630
|
+
if (dry_run)
|
|
631
|
+
body.dry_run = true;
|
|
632
|
+
const result = await wp.requestEnveloped("/menu/item/add-custom", {
|
|
633
|
+
method: "POST",
|
|
634
|
+
body,
|
|
635
|
+
});
|
|
636
|
+
return {
|
|
637
|
+
content: [
|
|
638
|
+
{ type: "text", text: serializeEnvelope(result, "diviops_menu_item_add_custom") },
|
|
639
|
+
],
|
|
640
|
+
};
|
|
641
|
+
});
|
|
642
|
+
registerPluginTool("diviops_menu_location_assign", {
|
|
643
|
+
description: "Assign an existing WordPress nav menu to a registered theme location discovered from the current theme. Free/core single-site menu authoring primitive. Requires edit_theme_options. Rejects arbitrary location strings; call diviops_menu_list first and use data.registered_locations keys. Reassigning the same menu/location returns noop:true. No location removal path in this MVP. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }." +
|
|
644
|
+
DRY_RUN_DESC_SUFFIX,
|
|
645
|
+
inputSchema: {
|
|
646
|
+
menu_id: z.number().int().positive().describe("WordPress nav menu term ID"),
|
|
647
|
+
location: z.string().min(1).describe("Registered theme location key from diviops_menu_list"),
|
|
648
|
+
dry_run: DRY_RUN_FIELD,
|
|
649
|
+
},
|
|
650
|
+
annotations: { idempotentHint: true },
|
|
651
|
+
_meta: { idempotent: "true" },
|
|
652
|
+
}, async ({ menu_id, location, dry_run }) => {
|
|
653
|
+
const body = { menu_id, location };
|
|
654
|
+
if (dry_run)
|
|
655
|
+
body.dry_run = true;
|
|
656
|
+
const result = await wp.requestEnveloped("/menu/location/assign", {
|
|
657
|
+
method: "POST",
|
|
658
|
+
body,
|
|
659
|
+
});
|
|
660
|
+
return {
|
|
661
|
+
content: [
|
|
662
|
+
{ type: "text", text: serializeEnvelope(result, "diviops_menu_location_assign") },
|
|
663
|
+
],
|
|
664
|
+
};
|
|
665
|
+
});
|
|
420
666
|
registerPluginTool("diviops_schema_list_modules", {
|
|
421
667
|
description: "List all available Divi modules (block types) with their names, titles, and categories. Use this to discover what modules can be used in layouts. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }.",
|
|
422
668
|
annotations: { idempotentHint: true },
|
|
@@ -879,6 +1125,64 @@ registerPluginTool("diviops_page_update_content", {
|
|
|
879
1125
|
],
|
|
880
1126
|
};
|
|
881
1127
|
});
|
|
1128
|
+
registerPluginTool("diviops_page_update_meta", {
|
|
1129
|
+
description: "Update page/post metadata fields without touching post_content. Supports title, slug, parent, and menu_order; use diviops_page_update_status for status changes. Slug input must already be in sanitized WordPress post_name form. When a published post's slug changes, preserve_old_slug defaults to true and records the previous slug in _wp_old_slug so WordPress old-slug redirects can work. Returns readback fields after apply. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; missing page_id or invalid parent returns 'not_found', edit-permission failures return 'forbidden' (HTTP 403), invalid/empty slug or malformed field values return 'invalid_input' with `error.data` documenting the field and sanitized slug where relevant." +
|
|
1130
|
+
DRY_RUN_DESC_SUFFIX,
|
|
1131
|
+
inputSchema: {
|
|
1132
|
+
page_id: z.number().int().describe("WordPress post/page ID to update"),
|
|
1133
|
+
title: z
|
|
1134
|
+
.string()
|
|
1135
|
+
.optional()
|
|
1136
|
+
.describe("New post_title. Omit to leave unchanged."),
|
|
1137
|
+
slug: z
|
|
1138
|
+
.string()
|
|
1139
|
+
.optional()
|
|
1140
|
+
.describe("New post_name. Must already be sanitized, e.g. 'legal-notice'."),
|
|
1141
|
+
parent: z
|
|
1142
|
+
.number()
|
|
1143
|
+
.int()
|
|
1144
|
+
.min(0)
|
|
1145
|
+
.optional()
|
|
1146
|
+
.describe("New post_parent. Use 0 for no parent."),
|
|
1147
|
+
menu_order: z
|
|
1148
|
+
.number()
|
|
1149
|
+
.int()
|
|
1150
|
+
.min(0)
|
|
1151
|
+
.optional()
|
|
1152
|
+
.describe("New menu_order value."),
|
|
1153
|
+
preserve_old_slug: z
|
|
1154
|
+
.boolean()
|
|
1155
|
+
.optional()
|
|
1156
|
+
.default(true)
|
|
1157
|
+
.describe("When true, record the previous slug in _wp_old_slug for published posts when slug changes."),
|
|
1158
|
+
dry_run: DRY_RUN_FIELD,
|
|
1159
|
+
},
|
|
1160
|
+
annotations: { idempotentHint: true },
|
|
1161
|
+
_meta: { idempotent: "true" },
|
|
1162
|
+
}, async ({ page_id, title, slug, parent, menu_order, preserve_old_slug, dry_run }) => {
|
|
1163
|
+
const body = {
|
|
1164
|
+
preserve_old_slug: preserve_old_slug ?? true,
|
|
1165
|
+
};
|
|
1166
|
+
if (title !== undefined)
|
|
1167
|
+
body.title = title;
|
|
1168
|
+
if (slug !== undefined)
|
|
1169
|
+
body.slug = slug;
|
|
1170
|
+
if (parent !== undefined)
|
|
1171
|
+
body.parent = parent;
|
|
1172
|
+
if (menu_order !== undefined)
|
|
1173
|
+
body.menu_order = menu_order;
|
|
1174
|
+
if (dry_run)
|
|
1175
|
+
body.dry_run = true;
|
|
1176
|
+
const result = await wp.requestEnveloped(`/page/update-meta/${page_id}`, {
|
|
1177
|
+
method: "POST",
|
|
1178
|
+
body,
|
|
1179
|
+
});
|
|
1180
|
+
return {
|
|
1181
|
+
content: [
|
|
1182
|
+
{ type: "text", text: serializeEnvelope(result, "diviops_page_update_meta") },
|
|
1183
|
+
],
|
|
1184
|
+
};
|
|
1185
|
+
});
|
|
882
1186
|
registerPluginTool("diviops_render_preview", {
|
|
883
1187
|
description: "Render Divi block markup to HTML. Accepts EITHER inline `content` (string of block markup) OR `page_id` (loads `post_content` from the DB, requires edit_post capability on the page — useful for previewing shipped pages without round-tripping the markup blob). Provide exactly one. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; success payload is { rendered_html: string }. Errors map to `invalid_input` (neither/both supplied, or invalid page_id), `forbidden` (caller lacks edit_post on the page), `not_found` (page_id does not exist), or `divi_error` (parser/render exception, with truncated message and full detail in `error.data.detail`).",
|
|
884
1188
|
inputSchema: {
|
|
@@ -1120,7 +1424,7 @@ registerPluginTool("diviops_section_get", {
|
|
|
1120
1424
|
};
|
|
1121
1425
|
});
|
|
1122
1426
|
registerPluginTool("diviops_module_update", {
|
|
1123
|
-
description: 'Update specific attributes of a module. Target by auto_index (e.g. "text:5"), admin label, or text content. Uses dot notation for attribute paths. Example: {"content.decoration.headingFont.h2.font.desktop.value.color": "#ff0000"}. For paths whose key segments contain literal dots — notably Composable Settings preset slots like groupPreset["title.decoration.spacing"] — escape the inner dots with `\\.` to keep the segment intact: {"groupPreset.title\\\\.decoration\\\\.spacing.presetId": ["uuid"]}. Priority: auto_index > label > match_text. Use occurrence with label when duplicates exist. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; missing module returns code "not_found" with error.data = { target_kind: "module", target_mode, target_value, page_id }, non-array attrs returns code "invalid_input" with error.data.field = "attrs", malformed Divi block markup surfaces code "divi_error" (HTTP 500).' +
|
|
1427
|
+
description: 'Update specific attributes of a module. Target by auto_index (e.g. "text:5"), admin label, or text content. Uses dot notation for attribute paths. Example: {"content.decoration.headingFont.h2.font.desktop.value.color": "#ff0000"}. For paths whose key segments contain literal dots — notably Composable Settings preset slots like groupPreset["title.decoration.spacing"] — escape the inner dots with `\\.` to keep the segment intact: {"groupPreset.title\\\\.decoration\\\\.spacing.presetId": ["uuid"]}. Priority: auto_index > label > match_text. Use occurrence with label when duplicates exist. match_text is a convenience selector: for generic or repeated visible text, prefer auto_index from diviops_page_get_layout/module_get. Content-slot mismatches such as writing a heading `title.innerContent` path into a matched divi/text block are rejected with invalid_input instead of silently storing never-rendered attrs. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; missing module returns code "not_found" with error.data = { target_kind: "module", target_mode, target_value, page_id }, non-array attrs returns code "invalid_input" with error.data.field = "attrs", malformed Divi block markup surfaces code "divi_error" (HTTP 500).' +
|
|
1124
1428
|
DRY_RUN_DESC_SUFFIX,
|
|
1125
1429
|
inputSchema: {
|
|
1126
1430
|
page_id: z.number().describe("WordPress post/page ID"),
|
|
@@ -1381,7 +1685,7 @@ registerPluginTool("diviops_page_create", {
|
|
|
1381
1685
|
};
|
|
1382
1686
|
});
|
|
1383
1687
|
registerPluginTool("diviops_page_trash", {
|
|
1384
|
-
description: "Trash or permanently delete a page/post. Defaults to trash (reversible via WP Admin → Trash). Pass force=true to permanently delete (wp_delete_post — irreversible). Idempotent: trashing an already-trashed post returns ok:true with `data.already_trashed = true` (repeat-safe semantics for AI-agent retries). Pass dry_run=true to preview without mutating. Replaces wp-cli `post delete --force=0|1` routing for AI-agent callers (typed input, deterministic envelope). Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; missing post_id returns 'not_found', delete-permission failures return 'forbidden' (HTTP 403).
|
|
1688
|
+
description: "Trash or permanently delete a page/post. Defaults to trash (reversible via WP Admin → Trash). Pass force=true to permanently delete (wp_delete_post — irreversible). Idempotent: trashing an already-trashed post returns ok:true with `data.already_trashed = true` (repeat-safe semantics for AI-agent retries). Pass dry_run=true to preview the standard `data.plan = { summary, changes[] }` without mutating. Replaces wp-cli `post delete --force=0|1` routing for AI-agent callers (typed input, deterministic envelope). Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; missing post_id returns 'not_found', delete-permission failures return 'forbidden' (HTTP 403).",
|
|
1385
1689
|
inputSchema: {
|
|
1386
1690
|
post_id: z.number().int().describe("WordPress post/page ID"),
|
|
1387
1691
|
force: z
|
|
@@ -1412,7 +1716,7 @@ registerPluginTool("diviops_page_trash", {
|
|
|
1412
1716
|
};
|
|
1413
1717
|
});
|
|
1414
1718
|
registerPluginTool("diviops_page_update_status", {
|
|
1415
|
-
description: "Update a page's post_status. Valid statuses: publish, draft, private, pending, future. status='future' requires date_gmt (ISO 8601 UTC, must be in the future) — server writes both post_date_gmt and the site-tz post_date so WP's scheduler picks it up. status='publish' on a previously-scheduled post clears the future date so it publishes immediately. Idempotent: same-status update returns ok:true with `data.noop = true`. Pass dry_run=true to preview. Replaces wp-cli `post update --post_status=...` routing. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; missing post_id returns 'not_found', edit-permission failures return 'forbidden' (HTTP 403); status enum violations and date_gmt validation failures return 'invalid_input' with `error.data` documenting the field.
|
|
1719
|
+
description: "Update a page's post_status. Valid statuses: publish, draft, private, pending, future. status='future' requires date_gmt (ISO 8601 UTC, must be in the future) — server writes both post_date_gmt and the site-tz post_date so WP's scheduler picks it up. status='publish' on a previously-scheduled post clears the future date so it publishes immediately. Idempotent: same-status update returns ok:true with `data.noop = true`. Pass dry_run=true to preview the standard `data.plan = { summary, changes[] }` without mutating. Replaces wp-cli `post update --post_status=...` routing. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; missing post_id returns 'not_found', edit-permission failures return 'forbidden' (HTTP 403); status enum violations and date_gmt validation failures return 'invalid_input' with `error.data` documenting the field.",
|
|
1416
1720
|
inputSchema: {
|
|
1417
1721
|
post_id: z.number().int().describe("WordPress post/page ID"),
|
|
1418
1722
|
status: z
|
|
@@ -1473,7 +1777,7 @@ registerPluginTool("diviops_preset_audit_storage", {
|
|
|
1473
1777
|
};
|
|
1474
1778
|
});
|
|
1475
1779
|
registerPluginTool("diviops_preset_cleanup", {
|
|
1476
|
-
description: 'Clean up presets. Default: remove spam presets. Optional: dedup=true to also remove duplicates, action="rename_strip_prefix" with prefix to strip a name prefix, or action="remove_orphans" with scope="spam"|"all" to remove unreferenced presets. Use dry_run: true (default) to preview
|
|
1780
|
+
description: 'Clean up presets. Default: remove spam presets. Optional: dedup=true to also remove duplicates, action="rename_strip_prefix" with prefix to strip a name prefix, or action="remove_orphans" with scope="spam"|"all" to remove unreferenced presets. Use dry_run: true (default) to preview the standard `data.plan = { summary, changes[] }` without mutating; legacy removed/renamed/deduped summary arrays are preserved as sibling metadata. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }.',
|
|
1477
1781
|
inputSchema: {
|
|
1478
1782
|
dry_run: z
|
|
1479
1783
|
.boolean()
|
|
@@ -2211,6 +2515,60 @@ registerPluginTool("diviops_canvas_list", {
|
|
|
2211
2515
|
],
|
|
2212
2516
|
};
|
|
2213
2517
|
});
|
|
2518
|
+
registerPluginTool("diviops_canvas_orphan_audit", {
|
|
2519
|
+
description: "Read-only audit of et_pb_canvas posts and off-canvas reference evidence. Returns canvases[], references[], unknowns[], and summary with verdicts referenced, likely_orphan, or unknown. Ambiguous, malformed, cache-only, or weak evidence returns unknown rather than likely_orphan. No delete, cleanup, remap, cache mutation, or cross-environment apply path is performed. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }.",
|
|
2520
|
+
inputSchema: {
|
|
2521
|
+
parent_page_id: z
|
|
2522
|
+
.number()
|
|
2523
|
+
.int()
|
|
2524
|
+
.positive()
|
|
2525
|
+
.optional()
|
|
2526
|
+
.describe("Optional parent page/layout post ID filter"),
|
|
2527
|
+
include_global: z
|
|
2528
|
+
.boolean()
|
|
2529
|
+
.optional()
|
|
2530
|
+
.default(true)
|
|
2531
|
+
.describe("Include canvases without parent/context evidence (default true)"),
|
|
2532
|
+
include_context: z
|
|
2533
|
+
.boolean()
|
|
2534
|
+
.optional()
|
|
2535
|
+
.default(true)
|
|
2536
|
+
.describe("Use _divi_canvas_parent_context as reference evidence when present"),
|
|
2537
|
+
status: z
|
|
2538
|
+
.enum(["any", "publish", "draft", "pending", "private", "future", "trash"])
|
|
2539
|
+
.optional()
|
|
2540
|
+
.default("any")
|
|
2541
|
+
.describe("Canvas post_status filter"),
|
|
2542
|
+
per_page: z
|
|
2543
|
+
.number()
|
|
2544
|
+
.int()
|
|
2545
|
+
.min(1)
|
|
2546
|
+
.max(100)
|
|
2547
|
+
.optional()
|
|
2548
|
+
.default(100)
|
|
2549
|
+
.describe("Max canvas posts to audit (default 100, 1-100)"),
|
|
2550
|
+
},
|
|
2551
|
+
annotations: { idempotentHint: true },
|
|
2552
|
+
_meta: { idempotent: "true" },
|
|
2553
|
+
}, async ({ parent_page_id, include_global, include_context, status, per_page }) => {
|
|
2554
|
+
const params = {};
|
|
2555
|
+
if (parent_page_id)
|
|
2556
|
+
params.parent_page_id = String(parent_page_id);
|
|
2557
|
+
if (include_global !== undefined)
|
|
2558
|
+
params.include_global = String(include_global);
|
|
2559
|
+
if (include_context !== undefined)
|
|
2560
|
+
params.include_context = String(include_context);
|
|
2561
|
+
if (status)
|
|
2562
|
+
params.status = status;
|
|
2563
|
+
if (per_page)
|
|
2564
|
+
params.per_page = String(per_page);
|
|
2565
|
+
const result = await wp.requestEnveloped("/canvas/orphan-audit", { params });
|
|
2566
|
+
return {
|
|
2567
|
+
content: [
|
|
2568
|
+
{ type: "text", text: serializeEnvelope(result, "diviops_canvas_orphan_audit") },
|
|
2569
|
+
],
|
|
2570
|
+
};
|
|
2571
|
+
});
|
|
2214
2572
|
registerPluginTool("diviops_canvas_get", {
|
|
2215
2573
|
description: "Get a canvas's block content and metadata. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; missing canvas_post_id returns ok:false with code 'not_found' and a hint pointing to diviops_canvas_list.",
|
|
2216
2574
|
inputSchema: {
|
|
@@ -2797,7 +3155,7 @@ registerLocalTool("diviops_meta_ping", {
|
|
|
2797
3155
|
};
|
|
2798
3156
|
});
|
|
2799
3157
|
registerLocalTool("diviops_meta_info", {
|
|
2800
|
-
description: "Returns DiviOps MCP server identity,
|
|
3158
|
+
description: "Returns DiviOps MCP server identity, server_version, license type, numeric tool_count, registered tool catalog summary, active plugin version summary, WP-CLI allowlist, and plugin handshake/slice state including Pro and FluentCart target readiness. Use as the S0 preflight before dogfooding or product work. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }.",
|
|
2801
3159
|
annotations: { idempotentHint: true },
|
|
2802
3160
|
_meta: { idempotent: "true" },
|
|
2803
3161
|
}, async () => {
|
|
@@ -2944,7 +3302,7 @@ registerLocalTool("diviops_template_get", {
|
|
|
2944
3302
|
});
|
|
2945
3303
|
// ── Variable Manager CRUD ─────────────────────────────────────────────
|
|
2946
3304
|
registerPluginTool("diviops_variable_list", {
|
|
2947
|
-
description: "List all design token variables from the Divi Variable Manager. Colors (gcid-*) come from et_global_data, numbers/strings/etc (gvid-*) from et_divi_global_variables. Filter by type or ID prefix. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; invalid `type` returns ok:false with code 'invalid_input'.",
|
|
3305
|
+
description: "List all design token variables from the Divi Variable Manager. Colors (gcid-*) come from et_global_data, numbers/strings/etc (gvid-*) from et_divi_global_variables. Filter by type or stored ID prefix. The `prefix` parameter does not match labels; for semantic names such as `oa-*` labels on UUID-backed Divi variables, list by type and filter returned labels client-side. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; invalid `type` returns ok:false with code 'invalid_input'.",
|
|
2948
3306
|
inputSchema: {
|
|
2949
3307
|
type: z
|
|
2950
3308
|
.enum(["colors", "numbers", "strings", "images", "links", "fonts", "gradients"])
|
|
@@ -2953,7 +3311,7 @@ registerPluginTool("diviops_variable_list", {
|
|
|
2953
3311
|
prefix: z
|
|
2954
3312
|
.string()
|
|
2955
3313
|
.optional()
|
|
2956
|
-
.describe('Filter by ID prefix
|
|
3314
|
+
.describe('Filter by stored ID prefix only. Does not match labels; for semantic names such as "oa-*" labels, list by type and filter returned labels client-side.'),
|
|
2957
3315
|
},
|
|
2958
3316
|
annotations: { idempotentHint: true },
|
|
2959
3317
|
_meta: { idempotent: "true" },
|
|
@@ -3201,7 +3559,7 @@ registerPluginTool("diviops_variable_create_fluid_system", {
|
|
|
3201
3559
|
.boolean()
|
|
3202
3560
|
.optional()
|
|
3203
3561
|
.default(false)
|
|
3204
|
-
.describe("Preview the
|
|
3562
|
+
.describe("Preview the standard dry-run plan without persisting. The response also preserves `created`/`skipped` diagnostics so callers can audit IDs and clamp() values before committing."),
|
|
3205
3563
|
overwrite: z
|
|
3206
3564
|
.boolean()
|
|
3207
3565
|
.optional()
|
|
@@ -3302,7 +3660,7 @@ registerPluginTool("diviops_variable_used_on_page", {
|
|
|
3302
3660
|
};
|
|
3303
3661
|
});
|
|
3304
3662
|
registerPluginTool("diviops_meta_flush_cache", {
|
|
3305
|
-
description: "Flush Divi's compiled static CSS cache under wp-content/et-cache/. wp cache flush does NOT touch these files — the frontend can keep serving stale CSS after a preset/variable/module mutation until the cache is cleared. Delegates to Divi's native ET_Core_PageResource::remove_static_resources when available (response backend: \"divi_native\"), which additionally clears Theme Builder CSS scattered across other post dirs, archive/taxonomy/home/notfound CSS, the object cache, module features cache, post features cache, Google Fonts cache, dynamic assets cache, and post meta caches. Falls back to a targeted filesystem walk of numeric-named et-cache subdirs when the Divi class is absent (backend: \"fs_fallback\"). Provide exactly one selector — no site-wide default to prevent accidental full flush. Optional cleanup_dynamic_assets=true explicitly deletes and reports _divi_dynamic_assets_cached_feature_used postmeta for the selected target IDs; cleanup_canvas_refs=true also deletes _divi_dynamic_assets_canvases_used and is only appropriate when canvas/off-canvas references are affected. Dynamic-assets postmeta cleanup is supported with post_id or all (bounded to posts that already carry the selected meta keys), not after. Idempotent: missing cache root returns 200 with empty list and repeat postmeta cleanup reports absent keys. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; namespace-specific error codes: meta_flush_cache.unwritable (filesystem refused), meta_flush_cache.fs_init_failed (WP_Filesystem could not authenticate)." +
|
|
3663
|
+
description: "Flush Divi's compiled static CSS cache under wp-content/et-cache/. wp cache flush does NOT touch these files — the frontend can keep serving stale CSS after a preset/variable/module mutation until the cache is cleared. Delegates to Divi's native ET_Core_PageResource::remove_static_resources when available (response backend: \"divi_native\"), which additionally clears Theme Builder CSS scattered across other post dirs, archive/taxonomy/home/notfound CSS, the object cache, module features cache, post features cache, Google Fonts cache, dynamic assets cache, and post meta caches. In post_id native mode, DiviOps also performs a targeted WP_Filesystem sweep of wp-content/et-cache/{post_id}/ and reports post_dir_sweep evidence because Divi's native invalidation can leave that directory on disk. Falls back to a targeted filesystem walk of numeric-named et-cache subdirs when the Divi class is absent (backend: \"fs_fallback\"). Provide exactly one selector — no site-wide default to prevent accidental full flush. Optional cleanup_dynamic_assets=true explicitly deletes and reports _divi_dynamic_assets_cached_feature_used postmeta for the selected target IDs; cleanup_canvas_refs=true also deletes _divi_dynamic_assets_canvases_used and is only appropriate when canvas/off-canvas references are affected. Dynamic-assets postmeta cleanup is supported with post_id or all (bounded to posts that already carry the selected meta keys), not after. Idempotent: missing cache root returns 200 with empty list and repeat postmeta cleanup reports absent keys. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; namespace-specific error codes: meta_flush_cache.unwritable (filesystem refused), meta_flush_cache.fs_init_failed (WP_Filesystem could not authenticate)." +
|
|
3306
3664
|
DRY_RUN_DESC_SUFFIX +
|
|
3307
3665
|
" Note: in `after` mode the dry-run plan reports the cutoff only — accurate file count requires the live mtime walk.",
|
|
3308
3666
|
inputSchema: {
|
|
@@ -3311,7 +3669,7 @@ registerPluginTool("diviops_meta_flush_cache", {
|
|
|
3311
3669
|
.int()
|
|
3312
3670
|
.positive()
|
|
3313
3671
|
.optional()
|
|
3314
|
-
.describe("Flush cache for one post. Native backend
|
|
3672
|
+
.describe("Flush cache for one post. Native backend clears matching Theme Builder CSS in other post dirs and then physically sweeps wp-content/et-cache/{post_id}/; fs_fallback only clears wp-content/et-cache/{post_id}/."),
|
|
3315
3673
|
all: z
|
|
3316
3674
|
.boolean()
|
|
3317
3675
|
.optional()
|
|
@@ -3394,6 +3752,10 @@ const CrossEnvSourcePayloadSchema = z
|
|
|
3394
3752
|
.regex(/^(sha256:)?[a-fA-F0-9]{64}$/)
|
|
3395
3753
|
.describe("sha256 checksum of source_payload.markup from source export."),
|
|
3396
3754
|
attachments: z.array(CrossEnvSourceAttachmentSchema).optional(),
|
|
3755
|
+
module_preset_ids: z
|
|
3756
|
+
.array(z.string())
|
|
3757
|
+
.optional()
|
|
3758
|
+
.describe("Referenced attrs.modulePreset IDs from source export; definitions are not included."),
|
|
3397
3759
|
})
|
|
3398
3760
|
.passthrough();
|
|
3399
3761
|
const CrossEnvSourcePayloadRefSchema = z
|
|
@@ -3434,7 +3796,7 @@ function sourceHintsFromPayload(source) {
|
|
|
3434
3796
|
function registerProTools() {
|
|
3435
3797
|
// diviops_cross_env_header_apply — guarded Pro apply for reviewed header preflight
|
|
3436
3798
|
registerProTool("diviops_cross_env_header_apply", {
|
|
3437
|
-
description: "Apply a reviewed cross-environment Theme Builder header payload into an existing target header layout (Pro tier; requires the cross_env Pro module). This first MVP is intentionally narrow: it requires `confirm_apply: true`, either an inline source export payload or a bounded `source_payload_ref` returned by diviops_cross_env_source_export_get, an existing target `destination_id`, and the reviewed `confirmation_binding.fingerprint` from `diviops-cross-env-preflight`. Large real headers should use `source_payload_ref`; inline `source_payload` remains supported for small/disposable tests. The server loads referenced payload bytes from its own `.diviops-tmp/cross-env-source-payloads/` artifact store, verifies checksum, re-exports current target context, reruns the TypeScript preflight engine, refuses fingerprint mismatch, unsafe verdicts, destination checksum drift, missing/ambiguous attachment remaps, missing global-color value evidence, and off-canvas/canvas references, then calls the Pro route with the verified plan. The Pro route re-loads the destination post, verifies the current checksum again, builds content only from source-origin upload URL rewrites and proven attachment-ID remaps, writes with readback/rollback evidence, and runs Divi static-resource cleanup plus explicit _divi_dynamic_assets_cached_feature_used cleanup. No media upload/import, global-color creation/import, new layout creation, off-canvas reconcile, public/store/license change, or live-site smoke is performed by this tool. Returns the standardized envelope { ok, data?, error: { code, message, hint?, data? } }. Error codes include cross_env.confirmation_required, cross_env.source_payload_ref_invalid, cross_env.fingerprint_mismatch, cross_env.preflight_not_safe, cross_env.destination_checksum_drift, cross_env.source_checksum_mismatch, cross_env.content_write_corruption, invalid_input, not_found, forbidden, and wp_error.",
|
|
3799
|
+
description: "Apply a reviewed cross-environment Theme Builder header payload into an existing target header layout (Pro tier; requires the cross_env Pro module). This first MVP is intentionally narrow: it requires `confirm_apply: true`, either an inline source export payload or a bounded `source_payload_ref` returned by diviops_cross_env_source_export_get, an existing target `destination_id`, and the reviewed `confirmation_binding.fingerprint` from `diviops-cross-env-preflight`. Large real headers should use `source_payload_ref`; inline `source_payload` remains supported for small/disposable tests. The server loads referenced payload bytes from its own `.diviops-tmp/cross-env-source-payloads/` artifact store, verifies checksum, re-exports current target context, reruns the TypeScript preflight engine, refuses fingerprint mismatch, unsafe verdicts, destination checksum drift, missing/ambiguous attachment remaps, missing global-color value evidence, missing target module preset definitions, and off-canvas/canvas references, then calls the Pro route with the verified plan. The Pro route re-loads the destination post, verifies the current checksum again, builds content only from source-origin upload URL rewrites and proven attachment-ID remaps, writes with readback/rollback evidence, and runs Divi static-resource cleanup plus explicit _divi_dynamic_assets_cached_feature_used cleanup. No media upload/import, global-color creation/import, preset import/clone, new layout creation, off-canvas reconcile, public/store/license change, or live-site smoke is performed by this tool. Returns the standardized envelope { ok, data?, error: { code, message, hint?, data? } }. Error codes include cross_env.confirmation_required, cross_env.source_payload_ref_invalid, cross_env.fingerprint_mismatch, cross_env.preflight_not_safe, cross_env.destination_checksum_drift, cross_env.source_checksum_mismatch, cross_env.content_write_corruption, invalid_input, not_found, forbidden, and wp_error.",
|
|
3438
3800
|
inputSchema: {
|
|
3439
3801
|
source_payload: CrossEnvSourcePayloadSchema.optional().describe("The `data` object returned by diviops_cross_env_source_export_get on the source site. Use source_payload_ref instead for large real headers."),
|
|
3440
3802
|
source_payload_ref: CrossEnvSourcePayloadRefSchema.optional().describe("Bounded server-local artifact reference returned as data.source_payload_ref by diviops_cross_env_source_export_get. Preferred for large real headers because it avoids inlining full markup through the model."),
|
|
@@ -3811,7 +4173,7 @@ function registerProTools() {
|
|
|
3811
4173
|
// no license activation flow, no update-ZIP / readme / banner config.
|
|
3812
4174
|
// diviops_fc_variation_list — POST /diviops/v1/pro/fluentcart/products/{id}/variations
|
|
3813
4175
|
registerProTool("diviops_fc_variation_list", {
|
|
3814
|
-
description: "List FluentCart Pro variations for a product (Pro tier; V3; requires FluentCart Pro installed + activated). Read-only. Returns every variation row attached to the product with its subscription shape (payment_type, other_info.repeat_interval/times/trial_days/manage_setup_fee) and a license-settings projection when ProductMeta.license_settings is configured. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; success payload is { product_id, variation_type, default_variation_id, variations: VariationRow[], variations_count }. Each VariationRow carries { id, post_id, variation_title, sku, payment_type, item_price, compare_price, fulfillment_type, stock_status, manage_stock, available, other_info: { ...all stored keys... }, license: { activation_limit, validity: { unit, value } } | null }. Unit convention: item_price and compare_price are stored cents (e.g. 1900 = $19.00). compare_price is null when FCP stores the no-compare sentinel 0; sku is null when the column is SQL NULL OR an empty string. license is null when the product has no license_settings; otherwise activation_limit is null/'' (unset), 0 (unlimited per FluentCart Pro License::getActivationLimit), or a positive integer (max activations). validity.unit is one of: lifetime/day/week/month/year. Error codes: invalid_input (400) when id is not a positive integer; not_found (404) when the product does not exist; fluentcart.module_inactive (412); fluentcart.query_failed (500). Idempotency: read-only.",
|
|
4176
|
+
description: "List FluentCart Pro variations for a product (Pro tier; V3; requires FluentCart Pro installed + activated). Read-only. Returns every variation row attached to the product with its subscription shape (payment_type, other_info.repeat_interval/times/trial_days/manage_setup_fee) and a license-settings projection when ProductMeta.license_settings is configured. For FluentCart 1.5 advanced_variations products, also resolves attribute relation metadata into VariationRow.attributes[] while preserving raw other_info.variant term IDs; each attribute row carries { group_id, group_title, group_slug, group_type, term_id, term_title, term_slug, term_settings }. Returns the standardized envelope { ok, data?, error: { code, message, hint? } }; success payload is { product_id, variation_type, default_variation_id, variations: VariationRow[], variations_count }. Each VariationRow carries { id, post_id, variation_title, sku, payment_type, item_price, compare_price, fulfillment_type, stock_status, manage_stock, available, other_info: { ...all stored keys... }, attributes?: AttributeRow[], license: { activation_limit, validity: { unit, value } } | null }. Unit convention: item_price and compare_price are stored cents (e.g. 1900 = $19.00). compare_price is null when FCP stores the no-compare sentinel 0; sku is null when the column is SQL NULL OR an empty string. license is null when the product has no license_settings; otherwise activation_limit is null/'' (unset), 0 (unlimited per FluentCart Pro License::getActivationLimit), or a positive integer (max activations). validity.unit is one of: lifetime/day/week/month/year. Advanced Variations authoring remains out of scope; write tools still refuse non-simple shapes with fluentcart.unsupported_product_shape. Error codes: invalid_input (400) when id is not a positive integer; not_found (404) when the product does not exist; fluentcart.module_inactive (412); fluentcart.query_failed (500). Idempotency: read-only.",
|
|
3815
4177
|
inputSchema: {
|
|
3816
4178
|
product_id: z
|
|
3817
4179
|
.number()
|
|
@@ -4649,6 +5011,7 @@ async function main() {
|
|
|
4649
5011
|
proActive: hs.pro_active === true,
|
|
4650
5012
|
availableTargets: hs.available_targets ?? {},
|
|
4651
5013
|
activeModules: hs.active_modules ?? {},
|
|
5014
|
+
plugins: hs.plugins ?? {},
|
|
4652
5015
|
};
|
|
4653
5016
|
const diviInfo = hs.divi.active
|
|
4654
5017
|
? `Divi ${hs.divi.version ?? "unknown"}`
|
package/dist/preset-cli/cli.d.ts
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Usage:
|
|
10
10
|
* diviops-preset button [options] Emit a divi/button group preset
|
|
11
|
-
* diviops-preset nav [options] Emit
|
|
11
|
+
* diviops-preset nav [options] Emit Divi nav block skeletons
|
|
12
12
|
* diviops-preset --help Show help
|
|
13
13
|
*
|
|
14
14
|
* Modes:
|
package/dist/preset-cli/cli.js
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* Usage:
|
|
10
10
|
* diviops-preset button [options] Emit a divi/button group preset
|
|
11
|
-
* diviops-preset nav [options] Emit
|
|
11
|
+
* diviops-preset nav [options] Emit Divi nav block skeletons
|
|
12
12
|
* diviops-preset --help Show help
|
|
13
13
|
*
|
|
14
14
|
* Modes:
|
|
@@ -53,8 +53,8 @@ USAGE
|
|
|
53
53
|
for divi/text (Pattern A only)
|
|
54
54
|
diviops-preset spacing [options] Emit a divi/spacing group preset
|
|
55
55
|
(currently divi/section only)
|
|
56
|
-
diviops-preset nav [options] Emit
|
|
57
|
-
|
|
56
|
+
diviops-preset nav [options] Emit Divi nav block-markup
|
|
57
|
+
skeletons
|
|
58
58
|
diviops-preset --help Show this help
|
|
59
59
|
|
|
60
60
|
MODE
|
|
@@ -169,6 +169,8 @@ nav OPTIONS (dry-run block markup only; --apply is refused)
|
|
|
169
169
|
--spec <json> Compact nav spec JSON. Mutually exclusive with
|
|
170
170
|
--spec-file.
|
|
171
171
|
--spec-file <path> Read compact nav spec JSON from disk.
|
|
172
|
+
--responsive-split Emit sibling desktop/mobile nav units using native
|
|
173
|
+
Divi disabledOn visibility. Default is one drawer.
|
|
172
174
|
|
|
173
175
|
Spec shape:
|
|
174
176
|
{"label":"Menu","idPrefix":"main-nav","items":[
|
|
@@ -270,6 +272,10 @@ export function parseArgs(argv) {
|
|
|
270
272
|
parsed.options.set(tok, true);
|
|
271
273
|
continue;
|
|
272
274
|
}
|
|
275
|
+
if (tok === "--responsive-split") {
|
|
276
|
+
parsed.options.set(tok, true);
|
|
277
|
+
continue;
|
|
278
|
+
}
|
|
273
279
|
if (VALUE_FLAGS.has(tok)) {
|
|
274
280
|
const val = argv[i + 1];
|
|
275
281
|
if (val === undefined || val.startsWith("--")) {
|
|
@@ -554,6 +560,9 @@ export function buildNavInput(parsed) {
|
|
|
554
560
|
return {
|
|
555
561
|
name,
|
|
556
562
|
spec: parseNavSpecJson(specJson),
|
|
563
|
+
mode: parsed.options.has("--responsive-split")
|
|
564
|
+
? "responsive_split"
|
|
565
|
+
: "drawer",
|
|
557
566
|
};
|
|
558
567
|
}
|
|
559
568
|
/**
|