@diviops/mcp-server 1.5.48 → 1.5.49
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 +67 -7
- package/dist/cross-env-preflight/cli.js +1 -1
- package/dist/cross-env-preflight/layout-capability.d.ts +2 -2
- package/dist/cross-env-preflight/layout-capability.js +6 -3
- package/dist/cross-env-preflight/layout-preflight.d.ts +7 -2
- package/dist/cross-env-preflight/layout-preflight.js +19 -0
- package/dist/cross-env-preflight/staff-body.d.ts +16 -0
- package/dist/cross-env-preflight/staff-body.js +74 -0
- package/dist/index.js +41 -15
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,6 +8,35 @@ The Node.js MCP server inside the DiviOps harness. It gives Claude Code, Codex,
|
|
|
8
8
|
Claude Code <-> MCP Server (stdio) <-> WordPress REST API <-> DiviOps Agent plugin
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## 1.5.49 candidate release note
|
|
12
|
+
|
|
13
|
+
- Adds bounded staff-body source/target evidence and preflight, plus guarded Pro
|
|
14
|
+
apply dispatch to one existing isolated target body. Target records supply
|
|
15
|
+
their own title, portrait, biography and plain-text role; records, fields and
|
|
16
|
+
assignments are not created or changed. General body migration and arbitrary
|
|
17
|
+
CPT/field mapping remain unsupported.
|
|
18
|
+
- Forwards an optional create-only product `slug` independently of SKU when Pro
|
|
19
|
+
advertises `fluentcart_product_create_slug`. Omission retains the existing
|
|
20
|
+
create workflow. Dry-run reports intent without reserving a URL; read stored
|
|
21
|
+
`product.slug` after creation and later publication. Changed product titles
|
|
22
|
+
still regenerate slugs; no slug update, URL preservation or redirects are added.
|
|
23
|
+
|
|
24
|
+
Selected source metadata is MCP `1.5.49`, Free `1.5.18`, Pro `1.0.14-beta` and
|
|
25
|
+
FluentCart skill `0.14`. Staff-body evidence requires Free's
|
|
26
|
+
`cross_env_staff_body_evidence`; apply also requires Pro's
|
|
27
|
+
`cross_env_staff_body_apply` and existing Pro/module gates. Component versions
|
|
28
|
+
remain independent: Free's minimum MCP requirement and Pro's existing Free
|
|
29
|
+
floor are unchanged. Restart MCP after supported updates to refresh capabilities.
|
|
30
|
+
|
|
31
|
+
This is source-only candidate preparation, not publication or packaged proof.
|
|
32
|
+
The prior bounded staff-body technical proof passed, but user visual acceptance
|
|
33
|
+
remains pending; no Visual Builder save or executed rollback was tested. That
|
|
34
|
+
proof does not qualify FluentCart creation or live WordPress slug collisions.
|
|
35
|
+
New-package inventories, build, production-only startup and runtime qualification
|
|
36
|
+
remain separate validation work. SCF `1.1`, builder, Free primer, Design and
|
|
37
|
+
launcher are unchanged; modern health remains default-disabled and repository-only,
|
|
38
|
+
and the setup prototype remains uninstalled and unqualified.
|
|
39
|
+
|
|
11
40
|
## Use cases
|
|
12
41
|
|
|
13
42
|
DiviOps fits multiple WordPress workflows where AI-driven authoring + management is the value:
|
|
@@ -169,6 +198,7 @@ Additional **conditionally-registered Pro tools** appear only on sites that have
|
|
|
169
198
|
|----------|------------------|------------|
|
|
170
199
|
| FluentCart reads (V1) | Pro plugin + FluentCart installed + module enabled | `diviops_fc_product_list`, `diviops_fc_product_get` |
|
|
171
200
|
| FluentCart simple product writes (V2) | Pro plugin + FluentCart installed + module enabled | `diviops_fc_product_create`, `diviops_fc_product_update`, `diviops_fc_product_delete` |
|
|
201
|
+
| Optional product-create slug | Existing create tool; supplying `slug` additionally requires Pro capability `fluentcart_product_create_slug` from a fresh startup handshake | Native WordPress normalization/collision handling; dry-run reports intent without reservation, apply reads stored `product.slug`. Omission stays compatible; changed product titles still regenerate slugs. No slug-update/redirect support. |
|
|
172
202
|
| FluentCart variation read/write (V3) | Pro plugin + FluentCart installed + module enabled | `diviops_fc_variation_list`, `diviops_fc_variation_update` |
|
|
173
203
|
| FluentCart license-settings read/write, incl. update-file pointer + readiness (V3/V3.3) | Pro plugin + FluentCart Pro installed + module enabled | `diviops_fc_license_settings_get`, `diviops_fc_license_settings_update` |
|
|
174
204
|
| FluentCart managed downloads + license changelog (V3.4) | Pro plugin + FluentCart installed + module enabled | `diviops_fc_download_list`, `diviops_fc_download_attach`, `diviops_fc_license_changelog_get`, `diviops_fc_license_changelog_update` |
|
|
@@ -236,9 +266,10 @@ diviops-cross-env-preflight --source source.json --target target.json --dry-run
|
|
|
236
266
|
|
|
237
267
|
This command reads two secret-free JSON files and prints a report. It does not
|
|
238
268
|
connect to WordPress, does not accept credentials, and has no write/apply path.
|
|
239
|
-
The CLI supports `tb_header_layout` and
|
|
240
|
-
|
|
241
|
-
|
|
269
|
+
The CLI supports `tb_header_layout`, `tb_footer_layout`, and the bounded
|
|
270
|
+
staff-detail `tb_body_layout` recipe described below, preflighted against existing
|
|
271
|
+
same-kind targets. Header-only inputs retain the
|
|
272
|
+
shipped header-v1 report/fingerprint; footer and supported body inputs use the generic layout-v1
|
|
242
273
|
binding by default. Pass `--contract layout-v1` to emit the generic binding for
|
|
243
274
|
a header rollout through `diviops_cross_env_layout_apply`; `--contract
|
|
244
275
|
header-v1` explicitly selects the compatibility contract and accepts header
|
|
@@ -260,10 +291,38 @@ The Free plugin advertises `cross_env_footer_layout_evidence` when its source
|
|
|
260
291
|
export and target-context routes support footer kinds. The server selects those
|
|
261
292
|
two tools' public enums only after handshake: older or unproven plugins retain
|
|
262
293
|
the shipped header-only schemas instead of advertising unsupported footer input.
|
|
294
|
+
Body evidence requires `cross_env_staff_body_evidence`; body apply additionally
|
|
295
|
+
requires `cross_env_staff_body_apply` alongside the existing Pro/module gates.
|
|
296
|
+
The existing footer/generic-apply flags alone do not authorize body promotion.
|
|
297
|
+
|
|
298
|
+
The body exception is limited to the existing `diviops_staff` recipe: native
|
|
299
|
+
current-post title, featured image, Post Content and the unchanged
|
|
300
|
+
`custom_meta_diviops_staff_role` binding with raw HTML off. The target must have
|
|
301
|
+
the registered CPT, one active applicable top-level text field named
|
|
302
|
+
`diviops_staff_role` with key `field_diviops_staff_role`, and one enabled,
|
|
303
|
+
non-default existing body assignment for all singular staff posts, with no
|
|
304
|
+
exclusions or conflicting same-condition assignment. Source/proposed content
|
|
305
|
+
must match this recipe; the existing target body can be replaced without already
|
|
306
|
+
containing it. Field definitions, target staff records and assignments are not
|
|
307
|
+
changed. Other CPTs/selectors, fixed-post/loop contexts, missing or ambiguous
|
|
308
|
+
fields, and prerequisite drift refuse. There is no general body migration or
|
|
309
|
+
field mapping. Source and target exports include a `staff_body` proof with
|
|
310
|
+
versioned evidence and a SHA-256 digest; the generic body confirmation binds both.
|
|
311
|
+
The field group must contain a standalone `post_type == diviops_staff` location
|
|
312
|
+
branch; other OR branches are allowed and remain part of the reviewed evidence.
|
|
313
|
+
Current prerequisite evidence is bound into confirmation and
|
|
314
|
+
independently recomputed by the target apply route. Source tests do not certify
|
|
315
|
+
a live cross-site rollout or authorize installation/release.
|
|
316
|
+
|
|
317
|
+
For this body recipe, `diviops_cross_env_layout_apply` accepts `dry_run: true`
|
|
318
|
+
with the reviewed fingerprint and confirmation to validate without mutation.
|
|
319
|
+
That option refuses non-body requests rather than silently applying them.
|
|
320
|
+
A real body write retains a snapshot through the existing Free recovery store;
|
|
321
|
+
dry-run and already-converged requests create no snapshot.
|
|
263
322
|
|
|
264
323
|
To collect the source JSON from the source WordPress site, call the Free/core
|
|
265
324
|
read-only MCP tool `diviops_cross_env_source_export_get` and save the returned
|
|
266
|
-
`data` object as `source.json`. The export includes the source origin,
|
|
325
|
+
`data` object as `source.json`. The export includes the source origin, same-kind
|
|
267
326
|
layout metadata, sanitized markup, a bare SHA-256 checksum of the exported
|
|
268
327
|
markup, export metadata, and best-effort attachment inventory from upload URLs
|
|
269
328
|
and attachment IDs. It also inventories referenced `attrs.modulePreset` IDs
|
|
@@ -295,11 +354,12 @@ entries that are referenced by source markup.
|
|
|
295
354
|
It also includes target D5 module preset IDs, without preset definitions, so the
|
|
296
355
|
preflight can fail closed when source markup references a module preset the
|
|
297
356
|
target site does not have.
|
|
298
|
-
For
|
|
357
|
+
For generic layout preflight it also includes exact target post type and
|
|
299
358
|
a canonical template-linkage digest over the active Theme Builder master ID,
|
|
300
359
|
its exact `_et_template` order, and linked-template slot, enabled, condition,
|
|
301
|
-
and exclusion evidence.
|
|
302
|
-
`links: []`;
|
|
360
|
+
and exclusion evidence. Header/footer empty linkage uses `master_template_ids: []`
|
|
361
|
+
and `links: []`; bounded staff bodies require the isolated assignment above.
|
|
362
|
+
Assignment state is evidence only and is never mutated by rollout.
|
|
303
363
|
|
|
304
364
|
Workflow:
|
|
305
365
|
|
|
@@ -19,7 +19,7 @@ OPTIONS
|
|
|
19
19
|
--apply Refused. No write/apply path exists in this MVP.
|
|
20
20
|
--help Show this help.
|
|
21
21
|
|
|
22
|
-
Supported kinds are tb_header_layout and
|
|
22
|
+
Supported kinds are tb_header_layout, tb_footer_layout, and proof-gated native staff tb_body_layout. Existing header-only
|
|
23
23
|
inputs retain the shipped header-v1 report and fingerprint contract unless
|
|
24
24
|
--contract layout-v1 is explicitly selected.`;
|
|
25
25
|
function parseArgs(argv) {
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
export declare const CROSS_ENV_FOOTER_LAYOUT_EVIDENCE_CAPABILITY: "cross_env_footer_layout_evidence";
|
|
2
|
-
export type CrossEnvEvidenceLayoutKind = "tb_header_layout" | "tb_footer_layout";
|
|
3
|
-
export declare function crossEnvEvidenceLayoutKinds(capabilities: Record<string, boolean>): [
|
|
2
|
+
export type CrossEnvEvidenceLayoutKind = "tb_header_layout" | "tb_footer_layout" | "tb_body_layout";
|
|
3
|
+
export declare function crossEnvEvidenceLayoutKinds(capabilities: Record<string, boolean>): [CrossEnvEvidenceLayoutKind, ...CrossEnvEvidenceLayoutKind[]];
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export const CROSS_ENV_FOOTER_LAYOUT_EVIDENCE_CAPABILITY = "cross_env_footer_layout_evidence";
|
|
2
2
|
export function crossEnvEvidenceLayoutKinds(capabilities) {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
const kinds = ["tb_header_layout"];
|
|
4
|
+
if (capabilities[CROSS_ENV_FOOTER_LAYOUT_EVIDENCE_CAPABILITY] === true)
|
|
5
|
+
kinds.push("tb_footer_layout");
|
|
6
|
+
if (capabilities.cross_env_staff_body_evidence === true)
|
|
7
|
+
kinds.push("tb_body_layout");
|
|
8
|
+
return kinds;
|
|
6
9
|
}
|
|
@@ -2,12 +2,17 @@ import { type CrossEnvVerdict, type GcidReference, type ModulePresetReference, t
|
|
|
2
2
|
export declare const THEME_BUILDER_LAYOUT_KIND_POST_TYPES: {
|
|
3
3
|
readonly tb_header_layout: "et_header_layout";
|
|
4
4
|
readonly tb_footer_layout: "et_footer_layout";
|
|
5
|
+
readonly tb_body_layout: "et_body_layout";
|
|
5
6
|
};
|
|
6
7
|
export type CrossEnvThemeBuilderLayoutKind = keyof typeof THEME_BUILDER_LAYOUT_KIND_POST_TYPES;
|
|
7
8
|
export declare const THEME_BUILDER_LAYOUT_VALIDATOR_VERSION: "diviops.cross_env.theme_builder_layout.validator.v1";
|
|
8
9
|
export interface CrossEnvThemeBuilderLayoutPreflightInput {
|
|
9
|
-
source: SourceLayoutPayload
|
|
10
|
-
|
|
10
|
+
source: SourceLayoutPayload & {
|
|
11
|
+
staff_body?: unknown;
|
|
12
|
+
};
|
|
13
|
+
target: TargetLayoutContext & {
|
|
14
|
+
staff_body?: unknown;
|
|
15
|
+
};
|
|
11
16
|
}
|
|
12
17
|
export interface CrossEnvThemeBuilderLayoutPreflightReport {
|
|
13
18
|
type: "cross_env_theme_builder_layout_preflight";
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { createHash } from "node:crypto";
|
|
2
|
+
import { staffCanonical, staffSourceProof, validStaffTarget } from "./staff-body.js";
|
|
2
3
|
import { preflightCrossEnvHeaderSync, } from "./header-preflight.js";
|
|
3
4
|
export const THEME_BUILDER_LAYOUT_KIND_POST_TYPES = {
|
|
4
5
|
tb_header_layout: "et_header_layout",
|
|
5
6
|
tb_footer_layout: "et_footer_layout",
|
|
7
|
+
tb_body_layout: "et_body_layout",
|
|
6
8
|
};
|
|
7
9
|
export const THEME_BUILDER_LAYOUT_VALIDATOR_VERSION = "diviops.cross_env.theme_builder_layout.validator.v1";
|
|
8
10
|
function sha256(value) {
|
|
@@ -54,6 +56,20 @@ export function preflightCrossEnvThemeBuilderLayoutSync(input) {
|
|
|
54
56
|
const targetKind = String(input.target.destination_kind ?? "");
|
|
55
57
|
const sourceExpectedType = expectedPostType(sourceKind);
|
|
56
58
|
const targetExpectedType = expectedPostType(targetKind);
|
|
59
|
+
const body = sourceKind === "tb_body_layout" || targetKind === "tb_body_layout";
|
|
60
|
+
if (body) {
|
|
61
|
+
try {
|
|
62
|
+
if (staffCanonical(staffSourceProof(input.source.markup)) !== staffCanonical(input.source.staff_body))
|
|
63
|
+
throw Error("missing or mismatched source proof");
|
|
64
|
+
if (!validStaffTarget(input.target.staff_body, input.target.template_linkage, input.target.destination_id))
|
|
65
|
+
throw Error("missing or unsupported target proof");
|
|
66
|
+
if (input.target.template_linkage_digest?.computed !== sha256(staffCanonical(input.target.template_linkage)))
|
|
67
|
+
throw Error("linkage digest mismatch");
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
blockers.push({ code: "staff_body_proof_invalid", message: "Body promotion requires the native staff recipe and versioned isolated target prerequisite evidence." });
|
|
71
|
+
}
|
|
72
|
+
}
|
|
57
73
|
if (!sourceExpectedType) {
|
|
58
74
|
blockers.push({
|
|
59
75
|
code: "unsupported_source_kind",
|
|
@@ -132,6 +148,7 @@ export function preflightCrossEnvThemeBuilderLayoutSync(input) {
|
|
|
132
148
|
...base.source,
|
|
133
149
|
object_kind: sourceKind,
|
|
134
150
|
object_post_type: input.source.object_post_type,
|
|
151
|
+
...(body ? { staff_body: input.source.staff_body } : {}),
|
|
135
152
|
},
|
|
136
153
|
target: {
|
|
137
154
|
...base.target,
|
|
@@ -139,6 +156,7 @@ export function preflightCrossEnvThemeBuilderLayoutSync(input) {
|
|
|
139
156
|
destination_post_type: input.target.destination_post_type,
|
|
140
157
|
template_linkage: input.target.template_linkage,
|
|
141
158
|
template_linkage_digest: input.target.template_linkage_digest,
|
|
159
|
+
...(body ? { staff_body: input.target.staff_body } : {}),
|
|
142
160
|
},
|
|
143
161
|
findings: base.findings,
|
|
144
162
|
source_origin_rule: sourceOriginRule,
|
|
@@ -153,6 +171,7 @@ export function preflightCrossEnvThemeBuilderLayoutSync(input) {
|
|
|
153
171
|
],
|
|
154
172
|
};
|
|
155
173
|
const bindingInput = {
|
|
174
|
+
...(body ? { staff_body: { source: input.source.staff_body, target: input.target.staff_body } } : {}),
|
|
156
175
|
source: {
|
|
157
176
|
origin: reportWithoutBinding.source.origin,
|
|
158
177
|
object_kind: sourceKind,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare function staffCanonical(value: unknown): string;
|
|
2
|
+
export declare function staffProof(evidence: Record<string, unknown>): {
|
|
3
|
+
evidence: Record<string, unknown>;
|
|
4
|
+
digest: {
|
|
5
|
+
algorithm: string;
|
|
6
|
+
computed: string;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare function staffSourceProof(markup: string): {
|
|
10
|
+
evidence: Record<string, unknown>;
|
|
11
|
+
digest: {
|
|
12
|
+
algorithm: string;
|
|
13
|
+
computed: string;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare function validStaffTarget(proof: any, linkage: any, destinationId: unknown): boolean;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
2
|
+
export function staffCanonical(value) {
|
|
3
|
+
const sort = (v) => Array.isArray(v) ? v.map(sort) : v && typeof v === "object"
|
|
4
|
+
? Object.fromEntries(Object.keys(v).sort().map(k => [k, sort(v[k])])) : v;
|
|
5
|
+
return JSON.stringify(sort(value));
|
|
6
|
+
}
|
|
7
|
+
export function staffProof(evidence) {
|
|
8
|
+
return { evidence, digest: { algorithm: "sha256", computed: createHash("sha256").update(staffCanonical(evidence)).digest("hex") } };
|
|
9
|
+
}
|
|
10
|
+
const expected = {
|
|
11
|
+
"divi/image:image.innerContent.desktop.value.src": { type: "content", value: { name: "post_featured_image", settings: { thumbnail_size: "large" } } },
|
|
12
|
+
"divi/heading:title.innerContent.desktop.value": { type: "content", value: { name: "post_title", settings: { before: "", after: "" } } },
|
|
13
|
+
"divi/text:content.innerContent.desktop.value": { type: "content", value: { name: "post_meta_key", settings: { before: "", after: "", select_meta_key: "custom_meta_diviops_staff_role", meta_key: "", date_format: "default", custom_date_format: "", enable_html: "off" } } },
|
|
14
|
+
};
|
|
15
|
+
// Uses the same serialized Divi comment/JSON contract as the existing hazard scanner.
|
|
16
|
+
// PHP independently repeats this check with WordPress's real block parser.
|
|
17
|
+
export function staffSourceProof(markup) {
|
|
18
|
+
const found = {};
|
|
19
|
+
const counts = {};
|
|
20
|
+
const stack = [];
|
|
21
|
+
let end = 0;
|
|
22
|
+
const walk = (v, path, name) => {
|
|
23
|
+
if (v && typeof v === "object") {
|
|
24
|
+
for (const [key, nested] of Object.entries(v)) {
|
|
25
|
+
if (/loop|post.?id|context|dynamic|modulePreset|groupPreset|globalModule/i.test(key))
|
|
26
|
+
throw Error("unsupported staff context");
|
|
27
|
+
walk(nested, path ? `${path}.${key}` : key, name);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
else if (typeof v === "string" && v.includes("$variable")) {
|
|
31
|
+
const key = `${name}:${path}`;
|
|
32
|
+
const token = v.startsWith("$variable(") && v.endsWith(")$") ? JSON.parse(v.slice(10, -2)) : null;
|
|
33
|
+
if (!(key in expected) || key in found || staffCanonical(token) !== staffCanonical(expected[key]))
|
|
34
|
+
throw Error("unsupported staff binding");
|
|
35
|
+
found[key] = token;
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
for (const match of markup.matchAll(/<!--\s+(\/)?wp:([A-Za-z0-9_-]+\/[A-Za-z0-9_-]+)(.*?)(\/)?-->/gs)) {
|
|
39
|
+
if (markup.slice(end, match.index).trim())
|
|
40
|
+
throw Error("unsupported staff content");
|
|
41
|
+
end = match.index + match[0].length;
|
|
42
|
+
const [, close, name, tail, selfClose] = match;
|
|
43
|
+
if (!["divi/placeholder", "divi/section", "divi/row", "divi/column", "divi/group", "divi/image", "divi/heading", "divi/text", "divi/post-content"].includes(name))
|
|
44
|
+
throw Error("unsupported staff module");
|
|
45
|
+
if (close) {
|
|
46
|
+
if (stack.pop() !== name)
|
|
47
|
+
throw Error("unbalanced staff body");
|
|
48
|
+
continue;
|
|
49
|
+
}
|
|
50
|
+
if (!selfClose)
|
|
51
|
+
stack.push(name);
|
|
52
|
+
counts[name] = (counts[name] ?? 0) + 1;
|
|
53
|
+
walk(tail.trim() ? JSON.parse(tail.trim()) : {}, "", name);
|
|
54
|
+
}
|
|
55
|
+
if (stack.length || markup.slice(end).trim() || ["divi/image", "divi/heading", "divi/text", "divi/post-content"].some(n => counts[n] !== 1) || staffCanonical(found) !== staffCanonical(expected))
|
|
56
|
+
throw Error("unsupported staff recipe");
|
|
57
|
+
return staffProof({ schema: "diviops.cross_env.staff_body.source.v1", context: "current_post", bindings: expected, post_content_count: 1 });
|
|
58
|
+
}
|
|
59
|
+
export function validStaffTarget(proof, linkage, destinationId) {
|
|
60
|
+
if (!proof?.evidence || staffCanonical(proof) !== staffCanonical(staffProof(proof.evidence)))
|
|
61
|
+
return false;
|
|
62
|
+
const e = proof.evidence, f = e.field, link = e.linkage?.links?.[0];
|
|
63
|
+
return e.schema === "diviops.cross_env.staff_body.target.v1" && e.post_type === "diviops_staff" && e.registered === true
|
|
64
|
+
&& f?.key === "field_diviops_staff_role" && f.name === "diviops_staff_role" && f.type === "text"
|
|
65
|
+
&& f.selector === "custom_meta_diviops_staff_role" && f.group_active === true && typeof f.group_key === "string" && f.group_key.length > 0
|
|
66
|
+
&& Array.isArray(f.location) && f.location.some((branch) => staffCanonical(branch) === staffCanonical([{ param: "post_type", operator: "==", value: "diviops_staff" }]))
|
|
67
|
+
&& staffCanonical(e.linkage) === staffCanonical(linkage) && e.linkage.destination_id === destinationId
|
|
68
|
+
&& e.linkage.destination_kind === "tb_body_layout" && e.linkage.destination_post_type === "et_body_layout"
|
|
69
|
+
&& e.linkage.active_master_id > 0 && e.linkage.links.length === 1
|
|
70
|
+
&& link?.slot === "body" && link.layout_id === destinationId && link.layout_enabled === true && link.template_enabled === true && link.template_default === false
|
|
71
|
+
&& staffCanonical(link.conditions) === '["singular:post_type:diviops_staff:all"]' && staffCanonical(link.exclusions) === "[]"
|
|
72
|
+
&& e.slots?.body?.id === destinationId && e.slots.body.enabled === "1" && e.slots.body.global !== "1"
|
|
73
|
+
&& !!e.slots.header && !!e.slots.footer;
|
|
74
|
+
}
|
package/dist/index.js
CHANGED
|
@@ -2539,10 +2539,12 @@ registerPluginTool("diviops_tb_layout_get", {
|
|
|
2539
2539
|
function registerCrossEnvEvidenceTools() {
|
|
2540
2540
|
const capabilities = handshakeState.kind === "ok" ? handshakeState.capabilities : {};
|
|
2541
2541
|
const layoutKinds = crossEnvEvidenceLayoutKinds(capabilities);
|
|
2542
|
-
const supportsFooter = layoutKinds.
|
|
2543
|
-
const
|
|
2542
|
+
const supportsFooter = layoutKinds.includes("tb_footer_layout");
|
|
2543
|
+
const supportsStaffBody = layoutKinds.includes("tb_body_layout");
|
|
2544
|
+
const layoutLabel = ["header", ...(supportsFooter ? ["footer"] : []), ...(supportsStaffBody ? ["bounded staff body"] : [])].join(" or ");
|
|
2545
|
+
const staffNote = supportsStaffBody ? " Staff body promotion requires the native current-post recipe, existing role field, and an isolated target body assignment." : "";
|
|
2544
2546
|
registerPluginTool("diviops_cross_env_target_context_get", {
|
|
2545
|
-
description: `Export read-only, secret-free target-site context for an offline cross-environment Theme Builder ${
|
|
2547
|
+
description: `Export read-only, secret-free target-site context for an offline cross-environment Theme Builder ${layoutLabel} preflight. Returns exact kind/post-type identity, the current post_content checksum without content exposure, canonical template-linkage evidence/digest, dependency evidence, and cache scope. Free/core and read-only: no content, assignment, dependency, or cache mutation.${staffNote}`,
|
|
2546
2548
|
inputSchema: {
|
|
2547
2549
|
destination_id: z
|
|
2548
2550
|
.number()
|
|
@@ -2553,9 +2555,7 @@ function registerCrossEnvEvidenceTools() {
|
|
|
2553
2555
|
.enum(layoutKinds)
|
|
2554
2556
|
.optional()
|
|
2555
2557
|
.default("tb_header_layout")
|
|
2556
|
-
.describe(
|
|
2557
|
-
? "Destination kind. Header and footer existing-layout evidence is supported."
|
|
2558
|
-
: "Destination kind. This connected plugin proves header evidence only; update it to expose footer support."),
|
|
2558
|
+
.describe(`Destination kind. Existing ${layoutLabel} layout evidence is supported.${staffNote}`),
|
|
2559
2559
|
source_asset_hints: z
|
|
2560
2560
|
.array(z.string())
|
|
2561
2561
|
.optional()
|
|
@@ -2604,7 +2604,7 @@ function registerCrossEnvEvidenceTools() {
|
|
|
2604
2604
|
};
|
|
2605
2605
|
});
|
|
2606
2606
|
registerPluginTool("diviops_cross_env_source_export_get", {
|
|
2607
|
-
description: `Export read-only, secret-free source-site payload for an offline cross-environment Theme Builder ${
|
|
2607
|
+
description: `Export read-only, secret-free source-site payload for an offline cross-environment Theme Builder ${layoutLabel} preflight. Returns exact kind/post-type identity, sanitized markup and checksum, dependency inventories, and a bounded source_payload_ref. Free/core and read-only: no WordPress content, assignment, dependency, or cache mutation.${staffNote}`,
|
|
2608
2608
|
inputSchema: {
|
|
2609
2609
|
source_id: z
|
|
2610
2610
|
.number()
|
|
@@ -2615,9 +2615,7 @@ function registerCrossEnvEvidenceTools() {
|
|
|
2615
2615
|
.enum(layoutKinds)
|
|
2616
2616
|
.optional()
|
|
2617
2617
|
.default("tb_header_layout")
|
|
2618
|
-
.describe(
|
|
2619
|
-
? "Source kind. Header and footer existing-layout evidence is supported."
|
|
2620
|
-
: "Source kind. This connected plugin proves header evidence only; update it to expose footer support."),
|
|
2618
|
+
.describe(`Source kind. Existing ${layoutLabel} layout evidence is supported.${staffNote}`),
|
|
2621
2619
|
dry_run: z
|
|
2622
2620
|
.boolean()
|
|
2623
2621
|
.optional()
|
|
@@ -4197,6 +4195,16 @@ const ManagedRecoveryConfirmationSchema = {
|
|
|
4197
4195
|
.describe("Short-lived signed token returned by the matching preview operation."),
|
|
4198
4196
|
};
|
|
4199
4197
|
function registerProTools() {
|
|
4198
|
+
const staffBodyApply = handshakeState.kind === "ok"
|
|
4199
|
+
&& handshakeState.capabilities.cross_env_staff_body_evidence === true
|
|
4200
|
+
&& handshakeState.capabilities.cross_env_staff_body_apply === true;
|
|
4201
|
+
const rolloutKinds = ["tb_header_layout", "tb_footer_layout"];
|
|
4202
|
+
if (staffBodyApply)
|
|
4203
|
+
rolloutKinds.push("tb_body_layout");
|
|
4204
|
+
const rolloutSourceSchema = staffBodyApply ? CrossEnvSourcePayloadSchema.extend({
|
|
4205
|
+
object_kind: z.enum(rolloutKinds),
|
|
4206
|
+
object_post_type: z.enum(["et_header_layout", "et_footer_layout", "et_body_layout"]).optional(),
|
|
4207
|
+
}) : CrossEnvSourcePayloadSchema;
|
|
4200
4208
|
registerProTool("diviops_managed_recovery_policy_get", {
|
|
4201
4209
|
description: "Inspect the effective/default one-site managed recovery policy and complete metadata-only rollback snapshot inventory (Pro Phase 1A; managed_recovery module). Returns policy checksum/version, inventory checksum/count/bytes, corruption/readiness warnings, and the entitlement-independent Free recovery-data promise. Never returns snapshot payload content, raw historical post-meta, credentials, or confirmation material and never mutates state.",
|
|
4202
4210
|
inputSchema: {},
|
|
@@ -4378,13 +4386,14 @@ function registerProTools() {
|
|
|
4378
4386
|
};
|
|
4379
4387
|
}, { target: "cross_env", capabilityKey: "cross_env_header_apply" });
|
|
4380
4388
|
registerProTool("diviops_cross_env_layout_apply", {
|
|
4381
|
-
description: "Apply one reviewed Theme Builder header or footer payload to one existing same-kind target layout (Pro tier; cross_env module). Requires fresh Free source/target evidence, the generic versioned confirmation fingerprint, and confirm_apply: true. Independently refuses kind/post-type mismatch, checksum or template-linkage drift, unsafe dependency evidence, off-canvas wiring, foreign CSS variables, invalid serialization, and readback mismatch before claiming success. A converged target returns already_converged without a write or cache mutation; successful mutation returns rollout_applied with readback, checksums, rollback, supported-meta, and cache evidence. Never creates layouts, mutates template assignment, or reconciles dependencies.",
|
|
4389
|
+
description: "Apply one reviewed Theme Builder header or footer payload to one existing same-kind target layout (Pro tier; cross_env module). Requires fresh Free source/target evidence, the generic versioned confirmation fingerprint, and confirm_apply: true. Independently refuses kind/post-type mismatch, checksum or template-linkage drift, unsafe dependency evidence, off-canvas wiring, foreign CSS variables, invalid serialization, and readback mismatch before claiming success. A converged target returns already_converged without a write or cache mutation; successful mutation returns rollout_applied with readback, checksums, rollback, supported-meta, and cache evidence. Never creates layouts, mutates template assignment, or reconciles dependencies." + (staffBodyApply ? " Also supports the exact current-post native diviops_staff body recipe with same-selector text role, raw HTML off, and an existing isolated body assignment. Body-only dry_run validates current proof without mutation; real body writes retain a recovery snapshot." : ""),
|
|
4382
4390
|
inputSchema: {
|
|
4383
|
-
|
|
4391
|
+
...(staffBodyApply ? { dry_run: z.boolean().optional().describe("Body only: validate the reviewed staff proof without writing. True refuses header/footer requests.") } : {}),
|
|
4392
|
+
source_payload: rolloutSourceSchema.optional().describe("Free source export payload. Use source_payload_ref for large layouts."),
|
|
4384
4393
|
source_payload_ref: CrossEnvSourcePayloadRefSchema.optional().describe("Bounded server-local artifact reference from diviops_cross_env_source_export_get."),
|
|
4385
4394
|
destination_id: z.number().int().positive().describe("Existing target Theme Builder layout post ID."),
|
|
4386
4395
|
destination_kind: z
|
|
4387
|
-
.enum(
|
|
4396
|
+
.enum(rolloutKinds)
|
|
4388
4397
|
.describe("Exact target kind; must match source_payload.object_kind."),
|
|
4389
4398
|
reviewed_fingerprint: z
|
|
4390
4399
|
.string()
|
|
@@ -4394,8 +4403,14 @@ function registerProTools() {
|
|
|
4394
4403
|
},
|
|
4395
4404
|
annotations: { idempotentHint: false },
|
|
4396
4405
|
_meta: { idempotent: "conditional" },
|
|
4397
|
-
}, async ({ source_payload, source_payload_ref, destination_id, destination_kind, reviewed_fingerprint, confirm_apply, }) => {
|
|
4406
|
+
}, async ({ source_payload, source_payload_ref, destination_id, destination_kind, reviewed_fingerprint, confirm_apply, dry_run, }) => {
|
|
4398
4407
|
const result = await wrapResponse(async () => {
|
|
4408
|
+
if (dry_run === true && destination_kind !== "tb_body_layout") {
|
|
4409
|
+
withCode("invalid_input", "dry_run is supported only for the bounded staff body.");
|
|
4410
|
+
}
|
|
4411
|
+
if (destination_kind === "tb_body_layout" && !staffBodyApply) {
|
|
4412
|
+
withCode("capability_missing", "Affirmative Free and Pro staff body capabilities are required.");
|
|
4413
|
+
}
|
|
4399
4414
|
if (confirm_apply !== true) {
|
|
4400
4415
|
withCode("cross_env.confirmation_required", "confirm_apply: true is required before a Theme Builder layout rollout can mutate content.", "Review the generic preflight report, then retry with confirm_apply: true.");
|
|
4401
4416
|
}
|
|
@@ -4467,6 +4482,7 @@ function registerProTools() {
|
|
|
4467
4482
|
source_checksum: resolvedSourcePayload.checksum,
|
|
4468
4483
|
destination_checksum: report.target.destination_checksum,
|
|
4469
4484
|
template_linkage_digest: report.target.template_linkage_digest,
|
|
4485
|
+
...(destination_kind === "tb_body_layout" ? { dry_run: dry_run === true } : {}),
|
|
4470
4486
|
reviewed_fingerprint: reviewed,
|
|
4471
4487
|
preflight_report: report,
|
|
4472
4488
|
},
|
|
@@ -4787,6 +4803,7 @@ function registerProTools() {
|
|
|
4787
4803
|
.min(1)
|
|
4788
4804
|
.max(200)
|
|
4789
4805
|
.describe("Product title (post_title). 1-200 chars. Used verbatim as the default variation's variation_title."),
|
|
4806
|
+
slug: z.string().min(1).max(200).optional().describe("Create-only requested product slug, normalized by WordPress; must normalize nonempty and not to \"0\". Requires Pro capability fluentcart_product_create_slug. Omit to derive from title. Dry-run reports intent, not a reservation; WordPress owns collision handling and product.slug returns the stored result. Later product_update title changes regenerate the slug; no slug update or redirect support."),
|
|
4790
4807
|
status: z
|
|
4791
4808
|
.enum(["draft", "publish", "pending", "private"])
|
|
4792
4809
|
.optional()
|
|
@@ -4821,8 +4838,17 @@ function registerProTools() {
|
|
|
4821
4838
|
},
|
|
4822
4839
|
annotations: { idempotentHint: false },
|
|
4823
4840
|
_meta: { idempotent: "false" },
|
|
4824
|
-
}, async ({ title, status, content, excerpt, fulfillment_type, price, compare_price, sku, dry_run, }) => {
|
|
4841
|
+
}, async ({ title, slug, status, content, excerpt, fulfillment_type, price, compare_price, sku, dry_run, }) => {
|
|
4842
|
+
if (slug !== undefined && handshakeState.kind === "ok" && !handshakeState.capabilities["fluentcart_product_create_slug"]) {
|
|
4843
|
+
const err = new MissingCapabilityError("fluentcart_product_create_slug", handshakeState.proVersion, "pro");
|
|
4844
|
+
return missingCapabilityEnvelope(err, "diviops_fc_product_create", {
|
|
4845
|
+
serverVersion: SERVER_VERSION,
|
|
4846
|
+
hint: capabilityUpgradeHint(err.capability, err.pluginComponent, "Omit slug only when title-derived URLs are intended."),
|
|
4847
|
+
});
|
|
4848
|
+
}
|
|
4825
4849
|
const body = { title };
|
|
4850
|
+
if (slug !== undefined)
|
|
4851
|
+
body.slug = slug;
|
|
4826
4852
|
if (status !== undefined)
|
|
4827
4853
|
body.status = status;
|
|
4828
4854
|
if (content !== undefined)
|