@cmo-so/mcp 0.12.3 → 0.12.4

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.
Files changed (2) hide show
  1. package/dist/cmo-mcp.mjs +77 -1
  2. package/package.json +1 -1
package/dist/cmo-mcp.mjs CHANGED
@@ -7199,7 +7199,7 @@ var require_dist = __commonJS({
7199
7199
  // package.json
7200
7200
  var package_default = {
7201
7201
  name: "@cmo-so/cli",
7202
- version: "0.12.3",
7202
+ version: "0.12.4",
7203
7203
  description: "CMO.so on the command line: your websites, ideas, blog posts, LinkedIn queue and results, plus a local MCP server for Claude Desktop, Cursor and other MCP clients.",
7204
7204
  type: "module",
7205
7205
  license: "MIT",
@@ -17148,6 +17148,81 @@ var childTools = [
17148
17148
  })
17149
17149
  })
17150
17150
  ];
17151
+ var themeTools = [
17152
+ tool({
17153
+ name: "wp_theme_updates",
17154
+ description: "Is there a newer Maggie Core for this site? The installed and latest versions, release notes link, whether this host lets it update itself, auto-updates on or off, and the earlier versions kept for rollback.",
17155
+ parameters: { type: "object", properties: {} },
17156
+ group: "site",
17157
+ need: READ,
17158
+ risk: "R0",
17159
+ gates: ["WP"],
17160
+ run: (ctx) => call(siteOf(ctx), { path: "/maggie-core/v1/update", query: { fresh: 1 } })
17161
+ }),
17162
+ tool({
17163
+ name: "wp_theme_update",
17164
+ description: "Update Maggie Core on the site to the latest version (checked against its published checksum; the current version is kept for rollback), then compare the homepage before and after (words, fonts, brand colours). If the site breaks (an error page or most of the homepage gone) it rolls back by itself. rollback_to puts an earlier kept version back instead. The site's look lives in the database and its child theme, so an update doesn't change it.",
17165
+ parameters: {
17166
+ type: "object",
17167
+ properties: { rollback_to: str2("Put this kept version back instead (from wp_theme_updates backups).") }
17168
+ },
17169
+ group: "site",
17170
+ need: WRITE,
17171
+ risk: "W3",
17172
+ gates: [...GATES],
17173
+ confirm: (a, lang) => a.rollback_to ? say(
17174
+ lang,
17175
+ `Put Maggie Core ${String(a.rollback_to)} back on your website.`,
17176
+ `\u628A\u7DB2\u7AD9\u7684 Maggie Core \u9084\u539F\u5230 ${String(a.rollback_to)}\u3002`
17177
+ ) : say(
17178
+ lang,
17179
+ "Update Maggie Core on your website to the latest version (rolled back by itself if the site breaks).",
17180
+ "\u628A\u7DB2\u7AD9\u7684 Maggie Core \u66F4\u65B0\u5230\u6700\u65B0\u7248\u672C\uFF08\u7DB2\u7AD9\u51FA\u932F\u6703\u81EA\u52D5\u9084\u539F\uFF09\u3002"
17181
+ ),
17182
+ run: async (ctx, a) => {
17183
+ const site = siteOf(ctx);
17184
+ const before = await homeShape(site);
17185
+ if (a.rollback_to) {
17186
+ const r2 = await call(site, {
17187
+ method: "POST",
17188
+ path: "/maggie-core/v1/update/rollback",
17189
+ body: { version: a.rollback_to }
17190
+ });
17191
+ return { ...r2, check: compareShapes(before, await homeShape(site)) };
17192
+ }
17193
+ const info = await call(site, { path: "/maggie-core/v1/update", query: { fresh: 1 } });
17194
+ if (!info.available)
17195
+ return {
17196
+ updated: false,
17197
+ current: info.current,
17198
+ latest: info.latest,
17199
+ note: info.check_error ?? "Already the latest Maggie Core."
17200
+ };
17201
+ if (!info.can_update)
17202
+ throw new Error(info.update_issue ?? "This host doesn't let WordPress update themes itself.");
17203
+ const r = await call(site, {
17204
+ method: "POST",
17205
+ path: "/maggie-core/v1/update"
17206
+ });
17207
+ const check2 = compareShapes(before, await homeShape(site));
17208
+ const broken = check2.checked && (check2.problems.some((p) => p.startsWith("the homepage answers")) || (check2.same_text_percent ?? 100) < 60);
17209
+ if (broken) {
17210
+ const back = await call(site, {
17211
+ method: "POST",
17212
+ path: "/maggie-core/v1/update/rollback",
17213
+ body: { version: r.before }
17214
+ }).catch((e) => ({ error: e.message }));
17215
+ return {
17216
+ ...r,
17217
+ check: check2,
17218
+ rolled_back: back,
17219
+ note: `The homepage looked broken after the update, so Maggie Core ${r.before} was put back.`
17220
+ };
17221
+ }
17222
+ return { ...r, check: check2, notes: info.notes, undo: `wp_theme_update rollback_to ${r.before}` };
17223
+ }
17224
+ })
17225
+ ];
17151
17226
  function deepMerge(a, b) {
17152
17227
  const out = { ...a };
17153
17228
  for (const [k, v] of Object.entries(b)) {
@@ -17417,6 +17492,7 @@ var wordpressTools = [
17417
17492
  ...sectionTools,
17418
17493
  ...mediaTools,
17419
17494
  ...childTools,
17495
+ ...themeTools,
17420
17496
  ...seoTools,
17421
17497
  ...elementTools
17422
17498
  ];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmo-so/mcp",
3
- "version": "0.12.3",
3
+ "version": "0.12.4",
4
4
  "description": "CMO.so's MCP server for Claude Desktop, Cursor, VS Code and other MCP clients: manage your websites, blog posts, LinkedIn queue and results with Maggie.",
5
5
  "type": "module",
6
6
  "license": "MIT",