@cmo-so/cli 0.12.0 → 0.12.1

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.mjs +14 -2
  2. package/package.json +1 -1
package/dist/cmo.mjs CHANGED
@@ -14755,8 +14755,10 @@ function directSite(siteUrl, username, password) {
14755
14755
  fetchPage: publicFetch,
14756
14756
  async request(req) {
14757
14757
  const method = req.method ?? "GET";
14758
- const r = await fetch(`${base}/wp-json${req.path}${qs(req.query)}`, {
14758
+ const query = qs(req.query);
14759
+ const r = await fetch(`${base}/?rest_route=${encodeURIComponent(req.path)}${query ? `&${query.slice(1)}` : ""}`, {
14759
14760
  method,
14761
+ redirect: "manual",
14760
14762
  headers: {
14761
14763
  Authorization: auth,
14762
14764
  Accept: "application/json",
@@ -14812,6 +14814,12 @@ async function call(site, req) {
14812
14814
  const r = await site.request(req);
14813
14815
  if (r.status >= 200 && r.status < 300) return r.data;
14814
14816
  const body = r.data;
14817
+ if (r.status >= 300 && r.status < 400)
14818
+ throw new WpError(
14819
+ `WordPress redirected the request (HTTP ${r.status}): use the site's final address (https, with or without www).`,
14820
+ r.status,
14821
+ "redirect"
14822
+ );
14815
14823
  const msg = typeof body === "object" && body?.message ? body.message.replace(/<[^>]+>/g, "") : `HTTP ${r.status}`;
14816
14824
  const code = typeof body === "object" ? body?.code : void 0;
14817
14825
  if (r.status === 409 && code === "wp_not_connected")
@@ -16377,6 +16385,8 @@ var pageTools = [
16377
16385
  meta: meta4
16378
16386
  }
16379
16387
  });
16388
+ if (!created || typeof created.id !== "number")
16389
+ throw new Error("WordPress didn't create the page (no id came back); nothing was saved.");
16380
16390
  let menu = null;
16381
16391
  if (typeof a.menu_parent === "string") {
16382
16392
  menu = await menuSet(site, {
@@ -16547,6 +16557,8 @@ var pageTools = [
16547
16557
  }
16548
16558
  }
16549
16559
  });
16560
+ if (!created || typeof created.id !== "number")
16561
+ throw new Error("WordPress didn't create the page (no id came back); nothing was saved.");
16550
16562
  return {
16551
16563
  created: true,
16552
16564
  id: created.id,
@@ -20456,7 +20468,7 @@ var program = new Command();
20456
20468
  // package.json
20457
20469
  var package_default = {
20458
20470
  name: "@cmo-so/cli",
20459
- version: "0.12.0",
20471
+ version: "0.12.1",
20460
20472
  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.",
20461
20473
  type: "module",
20462
20474
  license: "MIT",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cmo-so/cli",
3
- "version": "0.12.0",
3
+ "version": "0.12.1",
4
4
  "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.",
5
5
  "type": "module",
6
6
  "license": "MIT",