@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/README.md
CHANGED
|
@@ -16,7 +16,7 @@ DiviOps fits multiple WordPress workflows where AI-driven authoring + management
|
|
|
16
16
|
- **SCF setup + management** — provision Secure Custom Fields field groups, sync schemas, export/import field group definitions; SCF data model becomes a tool surface, not an admin-UI flow.
|
|
17
17
|
- **CPT + post population** — register custom post types via wp-cli passthrough; bulk-populate posts and pages across any post type, not just Divi-built ones.
|
|
18
18
|
- **Data model reasoning** — schema introspection across Divi modules + SCF field groups + post meta; ask Claude what fields a post type carries, what attributes a module accepts, what tokens are defined.
|
|
19
|
-
- **WordPress site auditing** — preset audits, design-token usage scans, orphan detection (presets, variables, dangling references); broader site surveys via wp-cli (`wp option list`, `wp post list --format=json`, `wp user list`).
|
|
19
|
+
- **WordPress site auditing** — preset audits, design-token usage scans, orphan detection (presets, variables, dangling references); broader site surveys via wp-cli (`wp option list`, `wp post list --format=json`, `wp post term list <id> <taxonomy> --format=json`, `wp user list`).
|
|
20
20
|
- **Hybrid sites (Divi + custom PHP)** — Divi authors the marketing pages; custom PHP templates handle dynamic ones (CPT listings, single-post views, member portals); design tokens harmonized across both surfaces via CSS custom properties driven from the Divi variable system.
|
|
21
21
|
|
|
22
22
|
## Quick start
|
|
@@ -25,9 +25,9 @@ Three steps to your first tool call.
|
|
|
25
25
|
|
|
26
26
|
### 1. Install the WordPress plugin
|
|
27
27
|
|
|
28
|
-
Download and activate the **DiviOps Agent** plugin
|
|
28
|
+
Download and activate the **DiviOps Agent** plugin from WordPress.org once it is listed there. For pre-listing test packages or a manual fallback install, use the [direct zip](https://github.com/oaris-dev/diviops/raw/main/diviops-agent.zip) or browse the [public distribution repo](https://github.com/oaris-dev/diviops). Requires Divi 5.1+ on WordPress 6.5+.
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
The npm MCP server updates through npm. WordPress.org installs of the Free plugin update through the normal WordPress plugin update flow. For pre-listing test packages or a manual fallback install, replace `diviops-agent.zip` through **WP Admin → Plugins → Add New → Upload Plugin** and choose **Replace current with uploaded**.
|
|
31
31
|
|
|
32
32
|
### 2. Create an Application Password
|
|
33
33
|
|
|
@@ -83,13 +83,14 @@ The skill enforces the Divi block format, the design system, and the response co
|
|
|
83
83
|
|
|
84
84
|
## Tools at a glance
|
|
85
85
|
|
|
86
|
-
The server exposes **
|
|
86
|
+
The server exposes **85 always-on tools** across the categories below. Each category links to representative tools; the full table lives in [server-reference.md](../docs/server-reference.md).
|
|
87
87
|
|
|
88
88
|
| Category | Use case | Tool prefixes |
|
|
89
89
|
|----------|----------|---------------|
|
|
90
90
|
| Page authoring | Create, edit, restructure pages | `page_*`, `section_*`, `module_*` |
|
|
91
91
|
| Design system | Manage colors, fonts, variables, presets | `variable_*`, `global_color_*`, `global_font_*`, `preset_*` |
|
|
92
92
|
| Library + templates | Reusable layouts + Theme Builder | `library_*`, `template_*`, `tb_*` |
|
|
93
|
+
| WordPress menus | Author reusable nav menus and theme-location assignments | `menu_*` |
|
|
93
94
|
| Schema introspection | Module attribute discovery | `schema_*` |
|
|
94
95
|
| Canvas / off-canvas | Popups, modals, menus | `canvas_*` |
|
|
95
96
|
| SCF integration | Secure Custom Fields sync | `scf_*` |
|
|
@@ -97,6 +98,8 @@ The server exposes **77 always-on tools** across the categories below. Each cate
|
|
|
97
98
|
| WP-CLI passthrough | Escape hatch for site ops | `meta_wp_cli` |
|
|
98
99
|
| Cache + meta | Connection probe, identity, icons, cache flush | `meta_*` |
|
|
99
100
|
|
|
101
|
+
Use `diviops_meta_info` as the S0 preflight before dogfooding or product work. It returns `server_version`, a numeric `tool_count`, a `tools` catalog summary (`registered_total`, always-on count, Pro possible/registered counts by target), `plugins` version records for `diviops-agent`, `diviops-agent-pro`, FluentCart, and FluentCart Pro when available, plus the existing handshake and slice state.
|
|
102
|
+
|
|
100
103
|
Additional **conditionally-registered Pro tools** appear only on sites that have the Pro plugin (`diviops-agent-pro`) active alongside the target coverage plugin:
|
|
101
104
|
|
|
102
105
|
| Category | Conditional gate | Tool names |
|
|
@@ -172,11 +175,13 @@ The MVP supports `tb_header_layout` source payloads preflighted against an
|
|
|
172
175
|
existing `tb_header_layout` target context. It reports source-domain upload URL
|
|
173
176
|
rewrites, attachment remap status, `gcid-*` target resolution including Divi
|
|
174
177
|
built-in customizer colors, resolved target global-color value evidence,
|
|
175
|
-
off-canvas/canvas refusal, and
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
178
|
+
referenced `modulePreset` target-presence status, off-canvas/canvas refusal, and
|
|
179
|
+
the required cache cleanup plan. Each report also emits a deterministic
|
|
180
|
+
`confirmation_binding` fingerprint over the reviewed source identity/checksum,
|
|
181
|
+
target identity/current target checksum, rewrite plan, cache plan,
|
|
182
|
+
blocker/operator-action codes, reference-resolution summaries, target module
|
|
183
|
+
preset resolution, and the per-`gcid` value evidence for target colors
|
|
184
|
+
referenced by the source layout.
|
|
180
185
|
The fingerprint is reviewed-plan evidence for the Pro-gated
|
|
181
186
|
`diviops_cross_env_header_apply` tool. The CLI itself still has no apply path.
|
|
182
187
|
|
|
@@ -185,8 +190,10 @@ read-only MCP tool `diviops_cross_env_source_export_get` and save the returned
|
|
|
185
190
|
`data` object as `source.json`. The export includes the source origin, header
|
|
186
191
|
layout metadata, sanitized markup, a bare SHA-256 checksum of the exported
|
|
187
192
|
markup, export metadata, and best-effort attachment inventory from upload URLs
|
|
188
|
-
and attachment IDs. It
|
|
189
|
-
|
|
193
|
+
and attachment IDs. It also inventories referenced `attrs.modulePreset` IDs
|
|
194
|
+
without exporting preset definitions. It strips query strings, fragments,
|
|
195
|
+
credentials, nonces, cookies, signed URL material, admin URLs, and local
|
|
196
|
+
filesystem paths.
|
|
190
197
|
|
|
191
198
|
The MCP server also writes the same source payload to a bounded local artifact
|
|
192
199
|
under `.diviops-tmp/cross-env-source-payloads/` and returns
|
|
@@ -207,6 +214,9 @@ to the target state without exposing the raw target content. It also includes
|
|
|
207
214
|
`global_color_value_evidence`, a deterministic SHA-256 digest map for resolved
|
|
208
215
|
user global colors and WP Customizer-backed built-ins; preflight binds only the
|
|
209
216
|
entries that are referenced by source markup.
|
|
217
|
+
It also includes target D5 module preset IDs, without preset definitions, so the
|
|
218
|
+
preflight can fail closed when source markup references a module preset the
|
|
219
|
+
target site does not have.
|
|
210
220
|
|
|
211
221
|
Workflow:
|
|
212
222
|
|
|
@@ -274,7 +284,7 @@ Every write tool accepts `dry_run: boolean` (default `false`). When `true`, the
|
|
|
274
284
|
}
|
|
275
285
|
```
|
|
276
286
|
|
|
277
|
-
`meta_wp_cli` and `scf_import` do not accept `dry_run` (raw passthrough / upstream gap respectively). For bulk preview-then-commit flows (preset reassign, preset cleanup), see [safety-patterns.md](../docs/safety-patterns.md).
|
|
287
|
+
`meta_wp_cli` and `scf_import` do not accept `dry_run` (raw passthrough / upstream gap respectively). `scf_sync` passes `dry_run` through to upstream `wp scf json sync --dry-run`, so its preview is the upstream plain-text summary rather than a plugin-built `data.plan`. For bulk preview-then-commit flows (preset reassign, preset cleanup), see [safety-patterns.md](../docs/safety-patterns.md).
|
|
278
288
|
|
|
279
289
|
### `_meta.idempotent` markers
|
|
280
290
|
|
|
@@ -308,7 +318,7 @@ Common quick fixes — full reference in [troubleshooting.md](../docs/troublesho
|
|
|
308
318
|
- **`npx` fails with "could not determine executable to run"** — use `npx -y --package @diviops/mcp-server diviops-mcp`; this explicitly selects the MCP server bin.
|
|
309
319
|
- **"Connection failed"** — verify the plugin is active by visiting `{WP_URL}/wp-json/diviops/v1/schema/settings`; test the credentials with `curl -u "user:pass" …`.
|
|
310
320
|
- **"This tool requires plugin capability"** — the plugin doesn't advertise the capability this tool needs. Update the plugin to the latest release.
|
|
311
|
-
- **Preset edits not visible on the frontend** — Divi serves frontend CSS from `wp-content/et-cache/{post_id}/`, which `wp cache flush` doesn't touch. Use `diviops_meta_flush_cache` after preset writes.
|
|
321
|
+
- **Preset edits not visible on the frontend** — Divi serves frontend CSS from `wp-content/et-cache/{post_id}/`, which `wp cache flush` doesn't touch. Use `diviops_meta_flush_cache` after preset writes; `post_id` mode also sweeps that exact directory and reports `post_dir_sweep` evidence.
|
|
312
322
|
|
|
313
323
|
## Learn more
|
|
314
324
|
|
package/dist/compatibility.d.ts
CHANGED
|
@@ -38,6 +38,15 @@ export interface HandshakeTarget {
|
|
|
38
38
|
present: boolean;
|
|
39
39
|
version?: string | null;
|
|
40
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Advisory plugin version/presence record contributed by extension plugins.
|
|
43
|
+
* This is a diagnostics/preflight surface only; capability gates continue to
|
|
44
|
+
* use the explicit capability map and target/module flags.
|
|
45
|
+
*/
|
|
46
|
+
export interface HandshakePluginInfo {
|
|
47
|
+
active: boolean;
|
|
48
|
+
version?: string | null;
|
|
49
|
+
}
|
|
41
50
|
/**
|
|
42
51
|
* Shape returned by `POST /diviops/v1/handshake`.
|
|
43
52
|
*
|
|
@@ -70,6 +79,8 @@ export interface HandshakeResult {
|
|
|
70
79
|
available_targets?: Record<string, HandshakeTarget>;
|
|
71
80
|
/** ADR-003 — per-target admin-controlled activation toggle. */
|
|
72
81
|
active_modules?: Record<string, boolean>;
|
|
82
|
+
/** Advisory installed-plugin versions for S0 preflight reports. */
|
|
83
|
+
plugins?: Record<string, HandshakePluginInfo>;
|
|
73
84
|
}
|
|
74
85
|
export declare function proToolGatesSatisfied(state: {
|
|
75
86
|
proActive: boolean;
|
|
@@ -15,6 +15,7 @@ export interface SourceLayoutPayload {
|
|
|
15
15
|
markup: string;
|
|
16
16
|
checksum?: string;
|
|
17
17
|
attachments?: SourceAttachmentInventoryItem[];
|
|
18
|
+
module_preset_ids?: unknown;
|
|
18
19
|
}
|
|
19
20
|
export interface TargetAttachmentInventoryItem {
|
|
20
21
|
id?: number;
|
|
@@ -42,6 +43,7 @@ export interface TargetLayoutContext {
|
|
|
42
43
|
global_colors?: unknown;
|
|
43
44
|
global_color_value_evidence?: unknown;
|
|
44
45
|
builtin_customizer_color_ids?: unknown;
|
|
46
|
+
module_preset_ids?: unknown;
|
|
45
47
|
cache_scope?: string;
|
|
46
48
|
}
|
|
47
49
|
export interface CrossEnvHeaderPreflightInput {
|
|
@@ -84,6 +86,10 @@ export interface OffCanvasReference {
|
|
|
84
86
|
token: string;
|
|
85
87
|
reason: string;
|
|
86
88
|
}
|
|
89
|
+
export interface ModulePresetReference {
|
|
90
|
+
id: string;
|
|
91
|
+
status: "target_module_preset" | "missing_target_context" | "missing_definition";
|
|
92
|
+
}
|
|
87
93
|
export interface CrossEnvHeaderPreflightReport {
|
|
88
94
|
type: "cross_env_header_preflight";
|
|
89
95
|
dry_run: true;
|
|
@@ -115,6 +121,7 @@ export interface CrossEnvHeaderPreflightReport {
|
|
|
115
121
|
};
|
|
116
122
|
attachments: AttachmentReference[];
|
|
117
123
|
global_colors: GcidReference[];
|
|
124
|
+
module_presets: ModulePresetReference[];
|
|
118
125
|
off_canvas: OffCanvasReference[];
|
|
119
126
|
};
|
|
120
127
|
rewrite_plan: {
|
|
@@ -462,6 +462,72 @@ function findGcidRefs(markup, target) {
|
|
|
462
462
|
return { id, status: "missing_definition" };
|
|
463
463
|
});
|
|
464
464
|
}
|
|
465
|
+
function isSafePresetId(value) {
|
|
466
|
+
return value !== "" && value !== "default" && /^[A-Za-z0-9_-]+$/.test(value);
|
|
467
|
+
}
|
|
468
|
+
function collectPresetIdsFromList(value) {
|
|
469
|
+
if (value === undefined || value === null)
|
|
470
|
+
return null;
|
|
471
|
+
const ids = new Set();
|
|
472
|
+
const add = (candidate) => {
|
|
473
|
+
if (typeof candidate === "string" && isSafePresetId(candidate)) {
|
|
474
|
+
ids.add(candidate);
|
|
475
|
+
}
|
|
476
|
+
};
|
|
477
|
+
if (Array.isArray(value)) {
|
|
478
|
+
for (const item of value)
|
|
479
|
+
add(item);
|
|
480
|
+
}
|
|
481
|
+
else if (value && typeof value === "object") {
|
|
482
|
+
for (const [key, item] of Object.entries(value)) {
|
|
483
|
+
add(key);
|
|
484
|
+
if (item && typeof item === "object") {
|
|
485
|
+
add(item.id);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
}
|
|
489
|
+
else {
|
|
490
|
+
add(value);
|
|
491
|
+
}
|
|
492
|
+
return ids;
|
|
493
|
+
}
|
|
494
|
+
function findModulePresetRefs(source, target) {
|
|
495
|
+
const refs = collectPresetIdsFromList(source.module_preset_ids) ?? new Set();
|
|
496
|
+
const decoded = decodeMarkup(source.markup);
|
|
497
|
+
if (decoded.includes('"modulePreset"')) {
|
|
498
|
+
const blockRe = /<!--\s+(?:\/)?wp:([A-Za-z0-9_-]+\/[A-Za-z0-9_-]+)(.*?)(?:\/)?-->/gs;
|
|
499
|
+
let match;
|
|
500
|
+
while ((match = blockRe.exec(decoded)) !== null) {
|
|
501
|
+
const blockName = match[1];
|
|
502
|
+
if (!blockName.startsWith("divi/"))
|
|
503
|
+
continue;
|
|
504
|
+
const attrsText = jsonObjectFromBlockCommentTail(match[2] ?? "");
|
|
505
|
+
if (!attrsText)
|
|
506
|
+
continue;
|
|
507
|
+
try {
|
|
508
|
+
const attrs = JSON.parse(attrsText);
|
|
509
|
+
const values = Array.isArray(attrs.modulePreset)
|
|
510
|
+
? attrs.modulePreset
|
|
511
|
+
: [attrs.modulePreset];
|
|
512
|
+
for (const id of values) {
|
|
513
|
+
if (typeof id === "string" && isSafePresetId(id))
|
|
514
|
+
refs.add(id);
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
catch {
|
|
518
|
+
continue;
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
}
|
|
522
|
+
const targetIds = collectPresetIdsFromList(target.module_preset_ids);
|
|
523
|
+
return uniqueSorted(refs).map((id) => {
|
|
524
|
+
if (targetIds === null)
|
|
525
|
+
return { id, status: "missing_target_context" };
|
|
526
|
+
if (targetIds.has(id))
|
|
527
|
+
return { id, status: "target_module_preset" };
|
|
528
|
+
return { id, status: "missing_definition" };
|
|
529
|
+
});
|
|
530
|
+
}
|
|
465
531
|
function findOffCanvasRefs(markup) {
|
|
466
532
|
const decoded = decodeMarkup(markup);
|
|
467
533
|
const refs = new Map();
|
|
@@ -561,6 +627,16 @@ function buildConfirmationBinding(report) {
|
|
|
561
627
|
value_evidence: color.value_evidence ?? null,
|
|
562
628
|
}))
|
|
563
629
|
.sort((a, b) => canonicalJson(a).localeCompare(canonicalJson(b))),
|
|
630
|
+
...(report.findings.module_presets.length > 0
|
|
631
|
+
? {
|
|
632
|
+
module_preset_resolution: report.findings.module_presets
|
|
633
|
+
.map((preset) => ({
|
|
634
|
+
id: preset.id,
|
|
635
|
+
status: preset.status,
|
|
636
|
+
}))
|
|
637
|
+
.sort((a, b) => canonicalJson(a).localeCompare(canonicalJson(b))),
|
|
638
|
+
}
|
|
639
|
+
: {}),
|
|
564
640
|
};
|
|
565
641
|
const schema = "diviops.cross_env.header_preflight.confirmation_binding.v1";
|
|
566
642
|
const fingerprint = sha256(canonicalJson({ schema, input }));
|
|
@@ -694,6 +770,23 @@ export function preflightCrossEnvHeaderSync(input) {
|
|
|
694
770
|
});
|
|
695
771
|
}
|
|
696
772
|
}
|
|
773
|
+
const modulePresets = findModulePresetRefs(input.source, input.target);
|
|
774
|
+
for (const preset of modulePresets) {
|
|
775
|
+
if (preset.status === "missing_target_context") {
|
|
776
|
+
operatorActions.push({
|
|
777
|
+
code: "missing_module_preset_context",
|
|
778
|
+
message: "Provide target D5 module preset IDs before apply.",
|
|
779
|
+
detail: { id: preset.id },
|
|
780
|
+
});
|
|
781
|
+
}
|
|
782
|
+
else if (preset.status === "missing_definition") {
|
|
783
|
+
operatorActions.push({
|
|
784
|
+
code: "missing_module_preset_definition",
|
|
785
|
+
message: "Referenced modulePreset is not defined on the target.",
|
|
786
|
+
detail: { id: preset.id },
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
}
|
|
697
790
|
const offCanvas = findOffCanvasRefs(input.source.markup);
|
|
698
791
|
if (offCanvas.length > 0) {
|
|
699
792
|
blockers.push({
|
|
@@ -757,6 +850,7 @@ export function preflightCrossEnvHeaderSync(input) {
|
|
|
757
850
|
},
|
|
758
851
|
attachments,
|
|
759
852
|
global_colors: globalColors,
|
|
853
|
+
module_presets: modulePresets,
|
|
760
854
|
off_canvas: offCanvas,
|
|
761
855
|
},
|
|
762
856
|
rewrite_plan: {
|