@cmo-so/cli 0.12.6 → 0.12.8
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/dist/cmo.mjs +632 -7
- package/package.json +1 -1
package/dist/cmo.mjs
CHANGED
|
@@ -16844,6 +16844,9 @@ var sectionTools = [
|
|
|
16844
16844
|
section: str2("Section id from wp_page_get (s2, m4) or its type (faq)."),
|
|
16845
16845
|
edits: EDITS,
|
|
16846
16846
|
slots: obj("Complete new content for the section (same type unless type is given)."),
|
|
16847
|
+
markup: str2(
|
|
16848
|
+
"Replace the section with this block markup (one top-level block; written by a coding agent; PHP never)."
|
|
16849
|
+
),
|
|
16847
16850
|
type: str2("With slots: change the section to this type."),
|
|
16848
16851
|
faq: obj("FAQ changes.", {
|
|
16849
16852
|
add: arr("Questions to add.", obj("", { q: str2(""), a: str2("") })),
|
|
@@ -16875,6 +16878,10 @@ var sectionTools = [
|
|
|
16875
16878
|
if (type !== "faq") throw new Error(`Section ${ref} is a ${type} section, not the FAQ.`);
|
|
16876
16879
|
next = editFaq(target.block, a.faq, kit);
|
|
16877
16880
|
note = { questions: describe2({ ...target, block: next }, kit.syncedTitles).counts?.questions };
|
|
16881
|
+
} else if (typeof a.markup === "string") {
|
|
16882
|
+
const bl = checkMarkup(a.markup, "markup").filter((b) => b.name);
|
|
16883
|
+
if (bl.length !== 1) throw new Error("markup: give exactly one top-level block (wrap several in a group).");
|
|
16884
|
+
next = bl[0];
|
|
16878
16885
|
} else if (a.slots) {
|
|
16879
16886
|
const t = String(a.type ?? type);
|
|
16880
16887
|
const keepName = target.block.attrs.metadata?.name;
|
|
@@ -16895,7 +16902,7 @@ var sectionTools = [
|
|
|
16895
16902
|
);
|
|
16896
16903
|
next = r.block;
|
|
16897
16904
|
note = { changed: r.changed };
|
|
16898
|
-
} else throw new Error("Give edits, slots or faq.");
|
|
16905
|
+
} else throw new Error("Give edits, slots, markup or faq.");
|
|
16899
16906
|
return { blocks: replace(blocks, ref, next, kit.syncedTitles), note };
|
|
16900
16907
|
})
|
|
16901
16908
|
}),
|
|
@@ -17297,7 +17304,7 @@ var childTools = [
|
|
|
17297
17304
|
files[`assets/fonts/${name}`] = btoa(bin);
|
|
17298
17305
|
let fam = fams.find((x) => x.slug === f.slug);
|
|
17299
17306
|
const stack = `"${f.family}", ${f.fallback || "sans-serif"}`;
|
|
17300
|
-
if (!fam
|
|
17307
|
+
if (!fam?.fontFamily.includes(`"${f.family}"`)) {
|
|
17301
17308
|
const keep = fam ? fams.indexOf(fam) : -1;
|
|
17302
17309
|
fam = { slug: f.slug, name: f.family, fontFamily: stack, fontFace: [] };
|
|
17303
17310
|
if (keep >= 0) fams[keep] = fam;
|
|
@@ -17787,7 +17794,560 @@ var elementTools = [
|
|
|
17787
17794
|
}
|
|
17788
17795
|
})
|
|
17789
17796
|
];
|
|
17797
|
+
function checkMarkup(markup, what) {
|
|
17798
|
+
if (typeof markup !== "string" || !markup.trim()) throw new Error(`${what}: give block markup (<!-- wp:\u2026 -->).`);
|
|
17799
|
+
if (/<\?(php|=)?/i.test(markup)) throw new Error(`${what}: PHP isn't allowed.`);
|
|
17800
|
+
const blocks = parse(markup);
|
|
17801
|
+
if (!blocks.some((b) => b.name)) throw new Error(`${what}: give block markup (<!-- wp:\u2026 -->), not plain HTML.`);
|
|
17802
|
+
return blocks;
|
|
17803
|
+
}
|
|
17804
|
+
var POST_FIELDS = "id,title,slug,link,status,date,modified,categories,tags,featured_media,excerpt,meta";
|
|
17805
|
+
async function termIds(site, taxonomy, names) {
|
|
17806
|
+
if (!Array.isArray(names)) return void 0;
|
|
17807
|
+
const ids3 = [];
|
|
17808
|
+
for (const n2 of names) {
|
|
17809
|
+
if (typeof n2 === "number") {
|
|
17810
|
+
ids3.push(n2);
|
|
17811
|
+
continue;
|
|
17812
|
+
}
|
|
17813
|
+
const name = String(n2).trim();
|
|
17814
|
+
if (!name) continue;
|
|
17815
|
+
const found = await call(site, {
|
|
17816
|
+
path: `/wp/v2/${taxonomy}`,
|
|
17817
|
+
query: { search: name, per_page: 20, _fields: "id,name" }
|
|
17818
|
+
});
|
|
17819
|
+
const hit = found.find((t) => t.name.toLowerCase() === name.toLowerCase());
|
|
17820
|
+
ids3.push(
|
|
17821
|
+
hit ? hit.id : (await call(site, { method: "POST", path: `/wp/v2/${taxonomy}`, body: { name } })).id
|
|
17822
|
+
);
|
|
17823
|
+
}
|
|
17824
|
+
return ids3;
|
|
17825
|
+
}
|
|
17826
|
+
var fullTools = [
|
|
17827
|
+
tool({
|
|
17828
|
+
name: "wp_page_markup_get",
|
|
17829
|
+
description: "A page's full block markup (Gutenberg), for coding agents that edit blocks directly; with section, only that section's markup. Pair with wp_page_markup_set or wp_section_update markup.",
|
|
17830
|
+
parameters: {
|
|
17831
|
+
type: "object",
|
|
17832
|
+
properties: { page: PAGE, section: str2("Only this section (id or type).") },
|
|
17833
|
+
required: ["page"]
|
|
17834
|
+
},
|
|
17835
|
+
group: "site",
|
|
17836
|
+
need: READ,
|
|
17837
|
+
risk: "R0",
|
|
17838
|
+
gates: ["WP"],
|
|
17839
|
+
run: async (ctx, a) => {
|
|
17840
|
+
const site = siteOf(ctx);
|
|
17841
|
+
const p = await findPage(site, a.page, true);
|
|
17842
|
+
const raw = p.content?.raw ?? "";
|
|
17843
|
+
if (a.section) {
|
|
17844
|
+
const kit = await siteKit(site);
|
|
17845
|
+
const l = sectionAt(parse(raw), String(a.section), kit.syncedTitles);
|
|
17846
|
+
return { id: p.id, path: path(p.link), modified: p.modified, section: l.id, markup: serialize([l.block]) };
|
|
17847
|
+
}
|
|
17848
|
+
return { id: p.id, path: path(p.link), modified: p.modified, template: p.template || "default", markup: raw };
|
|
17849
|
+
}
|
|
17850
|
+
}),
|
|
17851
|
+
tool({
|
|
17852
|
+
name: "wp_page_markup_set",
|
|
17853
|
+
description: "Replace a page's whole content with block markup a coding agent wrote (Gutenberg blocks, Maggie Core classes and Tailwind classes allowed; PHP never). Read it first with wp_page_markup_get and pass its modified as expect_modified. preview shows the sections before and after without saving. wp_page_undo goes back.",
|
|
17854
|
+
parameters: {
|
|
17855
|
+
type: "object",
|
|
17856
|
+
properties: {
|
|
17857
|
+
page: PAGE,
|
|
17858
|
+
markup: str2("The page's new block markup."),
|
|
17859
|
+
expect_modified: EXPECT,
|
|
17860
|
+
preview: PREVIEW
|
|
17861
|
+
},
|
|
17862
|
+
required: ["page", "markup"]
|
|
17863
|
+
},
|
|
17864
|
+
group: "site",
|
|
17865
|
+
need: WRITE,
|
|
17866
|
+
risk: "W3",
|
|
17867
|
+
gates: [...GATES],
|
|
17868
|
+
confirm: (a, lang) => say(
|
|
17869
|
+
lang,
|
|
17870
|
+
`Replace the content of page ${q2(a.page, "")} with new block markup.`,
|
|
17871
|
+
`\u7528\u65B0\u7684\u5340\u584A\u5167\u5BB9\u53D6\u4EE3\u9801\u9762 ${q2(a.page, "")}\u3002`
|
|
17872
|
+
),
|
|
17873
|
+
run: (ctx, a) => changePage(ctx, a, () => ({ blocks: checkMarkup(a.markup, "markup") }))
|
|
17874
|
+
}),
|
|
17875
|
+
tool({
|
|
17876
|
+
name: "wp_posts_list",
|
|
17877
|
+
description: "Blog posts on the site (newest first): id, title, path, status, date, categories and tags. Search words, status, category.",
|
|
17878
|
+
parameters: {
|
|
17879
|
+
type: "object",
|
|
17880
|
+
properties: {
|
|
17881
|
+
search: str2("Words in the title or content."),
|
|
17882
|
+
status: { type: "string", enum: ["publish", "draft", "future", "private", "any"], description: "Default any." },
|
|
17883
|
+
category: str2("Category name or id."),
|
|
17884
|
+
limit: int2("How many (default 30, at most 100).")
|
|
17885
|
+
}
|
|
17886
|
+
},
|
|
17887
|
+
group: "site",
|
|
17888
|
+
need: READ,
|
|
17889
|
+
risk: "R0",
|
|
17890
|
+
gates: ["WP"],
|
|
17891
|
+
run: async (ctx, a) => {
|
|
17892
|
+
const site = siteOf(ctx);
|
|
17893
|
+
const cat = a.category ? (await termIds(site, "categories", [a.category]).catch(() => void 0))?.[0] : void 0;
|
|
17894
|
+
const rows = await call(site, {
|
|
17895
|
+
path: "/wp/v2/posts",
|
|
17896
|
+
query: {
|
|
17897
|
+
context: "edit",
|
|
17898
|
+
search: a.search || void 0,
|
|
17899
|
+
status: a.status && a.status !== "any" ? String(a.status) : "publish,draft,future,private,pending",
|
|
17900
|
+
categories: cat,
|
|
17901
|
+
per_page: Math.min(100, Math.max(1, Number(a.limit) || 30)),
|
|
17902
|
+
_fields: "id,title,link,status,date,categories,tags"
|
|
17903
|
+
}
|
|
17904
|
+
});
|
|
17905
|
+
return {
|
|
17906
|
+
count: rows.length,
|
|
17907
|
+
items: rows.map((r) => ({
|
|
17908
|
+
id: r.id,
|
|
17909
|
+
title: r.title.raw ?? r.title.rendered,
|
|
17910
|
+
path: path(r.link),
|
|
17911
|
+
status: r.status,
|
|
17912
|
+
date: r.date,
|
|
17913
|
+
categories: r.categories,
|
|
17914
|
+
tags: r.tags
|
|
17915
|
+
}))
|
|
17916
|
+
};
|
|
17917
|
+
}
|
|
17918
|
+
}),
|
|
17919
|
+
tool({
|
|
17920
|
+
name: "wp_post_get",
|
|
17921
|
+
description: "One blog post in full: title, slug, status, dates, categories, tags, featured image, excerpt, SEO fields and its content (block markup or HTML).",
|
|
17922
|
+
parameters: { type: "object", properties: { post: int2("The post id (wp_posts_list).") }, required: ["post"] },
|
|
17923
|
+
group: "site",
|
|
17924
|
+
need: READ,
|
|
17925
|
+
risk: "R0",
|
|
17926
|
+
gates: ["WP"],
|
|
17927
|
+
run: async (ctx, a) => {
|
|
17928
|
+
const p = await call(siteOf(ctx), {
|
|
17929
|
+
path: `/wp/v2/posts/${Number(a.post)}`,
|
|
17930
|
+
query: { context: "edit", _fields: `${POST_FIELDS},content` }
|
|
17931
|
+
});
|
|
17932
|
+
return {
|
|
17933
|
+
...p,
|
|
17934
|
+
title: p.title.raw,
|
|
17935
|
+
path: path(p.link),
|
|
17936
|
+
excerpt: p.excerpt?.raw ?? "",
|
|
17937
|
+
content: p.content?.raw ?? ""
|
|
17938
|
+
};
|
|
17939
|
+
}
|
|
17940
|
+
}),
|
|
17941
|
+
tool({
|
|
17942
|
+
name: "wp_post_save",
|
|
17943
|
+
description: "Create a blog post (no post id) or change one (post id): title, content (block markup or HTML), excerpt, slug (a published post's old address gets a 301), status (draft, publish, private, future with date), date, categories and tags (names; new ones are created), featured_media, SEO title/description. New posts are drafts unless status says otherwise. CMO.so's blog autopilot keeps writing its own posts; this is for the owner's own changes.",
|
|
17944
|
+
parameters: {
|
|
17945
|
+
type: "object",
|
|
17946
|
+
properties: {
|
|
17947
|
+
post: int2("The post to change (leave out to create one)."),
|
|
17948
|
+
title: str2(""),
|
|
17949
|
+
content: str2("Block markup or HTML."),
|
|
17950
|
+
excerpt: str2(""),
|
|
17951
|
+
slug: str2(""),
|
|
17952
|
+
status: { type: "string", enum: ["draft", "publish", "private", "future"], description: "" },
|
|
17953
|
+
date: str2("Publish date (ISO 8601), for scheduled posts."),
|
|
17954
|
+
categories: arr("Category names (or ids).", { type: "string" }),
|
|
17955
|
+
tags: arr("Tag names (or ids).", { type: "string" }),
|
|
17956
|
+
featured_media: int2("Media id (wp_media_upload)."),
|
|
17957
|
+
seo_title: str2(""),
|
|
17958
|
+
seo_description: str2(""),
|
|
17959
|
+
expect_modified: EXPECT
|
|
17960
|
+
}
|
|
17961
|
+
},
|
|
17962
|
+
group: "site",
|
|
17963
|
+
need: WRITE,
|
|
17964
|
+
risk: "W3",
|
|
17965
|
+
gates: [...GATES],
|
|
17966
|
+
confirm: (a, lang) => a.post ? say(
|
|
17967
|
+
lang,
|
|
17968
|
+
`Change blog post #${String(a.post)} on your website${a.status === "publish" ? " (published)" : ""}.`,
|
|
17969
|
+
`\u4FEE\u6539\u7DB2\u7AD9\u4E0A\u7684\u6587\u7AE0 #${String(a.post)}\u3002`
|
|
17970
|
+
) : say(
|
|
17971
|
+
lang,
|
|
17972
|
+
`Create the blog post ${q2(a.title, "")} on your website (${a.status === "publish" ? "published" : "as a draft"}).`,
|
|
17973
|
+
`\u5728\u7DB2\u7AD9\u4E0A\u5EFA\u7ACB\u6587\u7AE0 ${q2(a.title, "")}\u3002`
|
|
17974
|
+
),
|
|
17975
|
+
run: async (ctx, a) => {
|
|
17976
|
+
const site = siteOf(ctx);
|
|
17977
|
+
const body = {};
|
|
17978
|
+
for (const k of ["title", "excerpt", "slug", "status", "date"])
|
|
17979
|
+
if (typeof a[k] === "string" && a[k] !== "") body[k] = a[k];
|
|
17980
|
+
if (typeof a.content === "string") {
|
|
17981
|
+
if (/<\?(php|=)?/i.test(a.content)) throw new Error("content: PHP isn't allowed.");
|
|
17982
|
+
body.content = a.content;
|
|
17983
|
+
}
|
|
17984
|
+
if (typeof a.featured_media === "number") body.featured_media = a.featured_media;
|
|
17985
|
+
const cats = await termIds(site, "categories", a.categories);
|
|
17986
|
+
const tags = await termIds(site, "tags", a.tags);
|
|
17987
|
+
if (cats) body.categories = cats;
|
|
17988
|
+
if (tags) body.tags = tags;
|
|
17989
|
+
const meta4 = {};
|
|
17990
|
+
if (typeof a.seo_title === "string") meta4.maggie_seo_title = a.seo_title;
|
|
17991
|
+
if (typeof a.seo_description === "string") meta4.maggie_seo_description = a.seo_description;
|
|
17992
|
+
if (Object.keys(meta4).length) body.meta = meta4;
|
|
17993
|
+
if (!a.post) {
|
|
17994
|
+
if (!body.title) throw new Error("A new post needs a title.");
|
|
17995
|
+
body.status = body.status ?? "draft";
|
|
17996
|
+
const p2 = await call(site, {
|
|
17997
|
+
method: "POST",
|
|
17998
|
+
path: "/wp/v2/posts",
|
|
17999
|
+
query: { _fields: "id,link,status,modified" },
|
|
18000
|
+
body
|
|
18001
|
+
});
|
|
18002
|
+
if (!p2?.id) throw new Error("WordPress didn't create the post.");
|
|
18003
|
+
return { created: true, id: p2.id, path: path(p2.link), status: p2.status, modified: p2.modified };
|
|
18004
|
+
}
|
|
18005
|
+
const before = await call(site, {
|
|
18006
|
+
path: `/wp/v2/posts/${Number(a.post)}`,
|
|
18007
|
+
query: { context: "edit", _fields: "id,link,status,modified" }
|
|
18008
|
+
});
|
|
18009
|
+
if (a.expect_modified && before.modified !== a.expect_modified)
|
|
18010
|
+
throw new Error(
|
|
18011
|
+
`The post changed in WordPress since you read it (${before.modified}). Read it again and redo the change.`
|
|
18012
|
+
);
|
|
18013
|
+
if (!Object.keys(body).length) throw new Error("Nothing to change.");
|
|
18014
|
+
const p = await call(site, {
|
|
18015
|
+
method: "POST",
|
|
18016
|
+
path: `/wp/v2/posts/${Number(a.post)}`,
|
|
18017
|
+
query: { _fields: "id,link,status,modified" },
|
|
18018
|
+
body
|
|
18019
|
+
});
|
|
18020
|
+
let redirect = null;
|
|
18021
|
+
if (before.status === "publish" && path(p.link) !== path(before.link))
|
|
18022
|
+
redirect = (await redirectsSet(site, { set: [{ from: path(before.link), to: path(p.link), code: 301 }] })).items.find((r) => r.from === path(before.link));
|
|
18023
|
+
return { saved: true, id: p.id, path: path(p.link), status: p.status, modified: p.modified, redirect };
|
|
18024
|
+
}
|
|
18025
|
+
}),
|
|
18026
|
+
tool({
|
|
18027
|
+
name: "wp_post_delete",
|
|
18028
|
+
description: "Move a blog post to the WordPress trash (restorable for 30 days) and redirect its address (301) to another page, by default the blog list or the homepage.",
|
|
18029
|
+
parameters: {
|
|
18030
|
+
type: "object",
|
|
18031
|
+
properties: {
|
|
18032
|
+
post: int2("The post id."),
|
|
18033
|
+
redirect_to: str2('Where its visitors go (path); default /. "410" = gone.')
|
|
18034
|
+
},
|
|
18035
|
+
required: ["post"]
|
|
18036
|
+
},
|
|
18037
|
+
group: "site",
|
|
18038
|
+
need: WRITE,
|
|
18039
|
+
risk: "W3",
|
|
18040
|
+
gates: [...GATES],
|
|
18041
|
+
confirm: (a, lang) => say(
|
|
18042
|
+
lang,
|
|
18043
|
+
`Move blog post #${String(a.post)} to the trash and redirect its address.`,
|
|
18044
|
+
`\u628A\u6587\u7AE0 #${String(a.post)} \u79FB\u5230\u5783\u573E\u6876\u4E26\u8F49\u5740\u3002`
|
|
18045
|
+
),
|
|
18046
|
+
run: async (ctx, a) => {
|
|
18047
|
+
const site = siteOf(ctx);
|
|
18048
|
+
const p = await call(site, {
|
|
18049
|
+
path: `/wp/v2/posts/${Number(a.post)}`,
|
|
18050
|
+
query: { context: "edit", _fields: "id,link,status" }
|
|
18051
|
+
});
|
|
18052
|
+
await call(site, { method: "DELETE", path: `/wp/v2/posts/${p.id}`, query: { _fields: "id,status" } });
|
|
18053
|
+
const to = String(a.redirect_to ?? "/");
|
|
18054
|
+
const from = path(p.link);
|
|
18055
|
+
const r = p.status === "publish" ? await redirectsSet(site, { set: to === "410" ? [{ from, code: 410 }] : [{ from, to, code: 301 }] }) : null;
|
|
18056
|
+
return {
|
|
18057
|
+
trashed: true,
|
|
18058
|
+
id: p.id,
|
|
18059
|
+
path: from,
|
|
18060
|
+
redirect: r ? to === "410" ? { from, code: 410 } : { from, to, code: 301 } : null
|
|
18061
|
+
};
|
|
18062
|
+
}
|
|
18063
|
+
}),
|
|
18064
|
+
tool({
|
|
18065
|
+
name: "wp_terms_list",
|
|
18066
|
+
description: "The blog's categories or tags: id, name, slug, description, post count.",
|
|
18067
|
+
parameters: {
|
|
18068
|
+
type: "object",
|
|
18069
|
+
properties: {
|
|
18070
|
+
taxonomy: { type: "string", enum: ["categories", "tags"], description: "Default categories." },
|
|
18071
|
+
search: str2("")
|
|
18072
|
+
}
|
|
18073
|
+
},
|
|
18074
|
+
group: "site",
|
|
18075
|
+
need: READ,
|
|
18076
|
+
risk: "R0",
|
|
18077
|
+
gates: ["WP"],
|
|
18078
|
+
run: async (ctx, a) => {
|
|
18079
|
+
const tax = a.taxonomy === "tags" ? "tags" : "categories";
|
|
18080
|
+
const rows = await all(
|
|
18081
|
+
siteOf(ctx),
|
|
18082
|
+
`/wp/v2/${tax}`,
|
|
18083
|
+
{ search: a.search || void 0, _fields: "id,name,slug,description,count,parent" },
|
|
18084
|
+
500
|
|
18085
|
+
);
|
|
18086
|
+
return { count: rows.length, items: rows };
|
|
18087
|
+
}
|
|
18088
|
+
}),
|
|
18089
|
+
tool({
|
|
18090
|
+
name: "wp_term_save",
|
|
18091
|
+
description: "Create a category or tag (no id) or change one (id): name, slug, description, parent (categories). The theme shows the description on its archive page.",
|
|
18092
|
+
parameters: {
|
|
18093
|
+
type: "object",
|
|
18094
|
+
properties: {
|
|
18095
|
+
taxonomy: { type: "string", enum: ["categories", "tags"], description: "Default categories." },
|
|
18096
|
+
id: int2("The term to change."),
|
|
18097
|
+
name: str2(""),
|
|
18098
|
+
slug: str2(""),
|
|
18099
|
+
description: str2(""),
|
|
18100
|
+
parent: int2("Parent category id.")
|
|
18101
|
+
}
|
|
18102
|
+
},
|
|
18103
|
+
group: "site",
|
|
18104
|
+
need: WRITE,
|
|
18105
|
+
risk: "W3",
|
|
18106
|
+
gates: [...GATES],
|
|
18107
|
+
confirm: (a, lang) => say(
|
|
18108
|
+
lang,
|
|
18109
|
+
`${a.id ? "Change" : "Create"} the ${a.taxonomy === "tags" ? "tag" : "category"} ${q2(a.name, a.id ? `#${String(a.id)}` : "")} on your website.`,
|
|
18110
|
+
`${a.id ? "\u4FEE\u6539" : "\u5EFA\u7ACB"}\u7DB2\u7AD9\u7684${a.taxonomy === "tags" ? "\u6A19\u7C64" : "\u5206\u985E"} ${q2(a.name, "")}\u3002`
|
|
18111
|
+
),
|
|
18112
|
+
run: async (ctx, a) => {
|
|
18113
|
+
const tax = a.taxonomy === "tags" ? "tags" : "categories";
|
|
18114
|
+
const body = {};
|
|
18115
|
+
for (const k of ["name", "slug", "description"]) if (typeof a[k] === "string") body[k] = a[k];
|
|
18116
|
+
if (typeof a.parent === "number" && tax === "categories") body.parent = a.parent;
|
|
18117
|
+
if (!a.id && !body.name) throw new Error("A new term needs a name.");
|
|
18118
|
+
return call(siteOf(ctx), {
|
|
18119
|
+
method: "POST",
|
|
18120
|
+
path: a.id ? `/wp/v2/${tax}/${Number(a.id)}` : `/wp/v2/${tax}`,
|
|
18121
|
+
query: { _fields: "id,name,slug,description,count,link" },
|
|
18122
|
+
body
|
|
18123
|
+
});
|
|
18124
|
+
}
|
|
18125
|
+
}),
|
|
18126
|
+
tool({
|
|
18127
|
+
name: "wp_term_delete",
|
|
18128
|
+
description: "Delete a category or tag by id. Posts keep their other terms; posts left without a category go to the default category, which can't be deleted. Terms have no trash: the result gives name, slug and description to recreate it with wp_term_save.",
|
|
18129
|
+
parameters: {
|
|
18130
|
+
type: "object",
|
|
18131
|
+
properties: {
|
|
18132
|
+
taxonomy: { type: "string", enum: ["categories", "tags"], description: "Default categories." },
|
|
18133
|
+
id: int2("The term to delete (from wp_terms_list).")
|
|
18134
|
+
},
|
|
18135
|
+
required: ["id"]
|
|
18136
|
+
},
|
|
18137
|
+
group: "site",
|
|
18138
|
+
need: WRITE,
|
|
18139
|
+
risk: "W3",
|
|
18140
|
+
gates: [...GATES],
|
|
18141
|
+
confirm: (a, lang) => say(
|
|
18142
|
+
lang,
|
|
18143
|
+
`Delete the ${a.taxonomy === "tags" ? "tag" : "category"} #${String(a.id)} from your website (posts stay; it can be recreated, not restored).`,
|
|
18144
|
+
`\u522A\u9664\u7DB2\u7AD9\u7684${a.taxonomy === "tags" ? "\u6A19\u7C64" : "\u5206\u985E"} #${String(a.id)}\uFF08\u6587\u7AE0\u4FDD\u7559\uFF1B\u53EF\u91CD\u65B0\u5EFA\u7ACB\uFF0C\u7121\u6CD5\u9084\u539F\uFF09\u3002`
|
|
18145
|
+
),
|
|
18146
|
+
run: async (ctx, a) => {
|
|
18147
|
+
const site = siteOf(ctx);
|
|
18148
|
+
const tax = a.taxonomy === "tags" ? "tags" : "categories";
|
|
18149
|
+
const id = Number(a.id);
|
|
18150
|
+
if (!Number.isInteger(id) || id <= 0) throw new Error("id: the term id from wp_terms_list.");
|
|
18151
|
+
if (tax === "categories") {
|
|
18152
|
+
const st = await call(site, {
|
|
18153
|
+
path: "/wp/v2/settings",
|
|
18154
|
+
query: { _fields: "default_category" }
|
|
18155
|
+
});
|
|
18156
|
+
if (Number(st.default_category ?? 1) === id)
|
|
18157
|
+
throw new Error("That is the default category; it can't be deleted.");
|
|
18158
|
+
}
|
|
18159
|
+
const before = await call(site, { path: `/wp/v2/${tax}/${id}`, query: { _fields: "id,name,slug,description,count,parent" } });
|
|
18160
|
+
await call(site, { method: "DELETE", path: `/wp/v2/${tax}/${id}`, query: { force: "true" } });
|
|
18161
|
+
return {
|
|
18162
|
+
deleted: true,
|
|
18163
|
+
taxonomy: tax,
|
|
18164
|
+
...before,
|
|
18165
|
+
undo: `wp_term_save ${tax} name "${before.name}" slug ${before.slug}`
|
|
18166
|
+
};
|
|
18167
|
+
}
|
|
18168
|
+
}),
|
|
18169
|
+
tool({
|
|
18170
|
+
name: "wp_settings_get",
|
|
18171
|
+
description: "The site's general settings: title, tagline, search-engine visibility, language, timezone, date and time formats, start of week, posts per page, homepage and posts page, logo and icon.",
|
|
18172
|
+
parameters: { type: "object", properties: {} },
|
|
18173
|
+
group: "site",
|
|
18174
|
+
need: READ,
|
|
18175
|
+
risk: "R0",
|
|
18176
|
+
gates: ["WP"],
|
|
18177
|
+
run: (ctx) => call(siteOf(ctx), {
|
|
18178
|
+
path: "/wp/v2/settings",
|
|
18179
|
+
query: {
|
|
18180
|
+
_fields: "title,description,url,blog_public,language,timezone,date_format,time_format,start_of_week,posts_per_page,show_on_front,page_on_front,page_for_posts,site_logo,site_icon"
|
|
18181
|
+
}
|
|
18182
|
+
})
|
|
18183
|
+
}),
|
|
18184
|
+
tool({
|
|
18185
|
+
name: "wp_settings_set",
|
|
18186
|
+
description: "Change the site's general settings: title, tagline (description), search_engines (true = let Google index the site, false = discourage it), timezone (e.g. Europe/London), date_format, time_format, start_of_week (0 Sunday \u2026 6), posts_per_page, site_logo and site_icon (media ids). Returns before and after. Homepage and posts page: wp_site_home_set.",
|
|
18187
|
+
parameters: {
|
|
18188
|
+
type: "object",
|
|
18189
|
+
properties: {
|
|
18190
|
+
title: str2("Site title."),
|
|
18191
|
+
description: str2("Tagline."),
|
|
18192
|
+
search_engines: bool("true: visible to search engines; false: ask them not to index the site."),
|
|
18193
|
+
timezone: str2("e.g. Europe/London."),
|
|
18194
|
+
date_format: str2("e.g. j F Y."),
|
|
18195
|
+
time_format: str2("e.g. H:i."),
|
|
18196
|
+
start_of_week: int2("0 Sunday \u2026 6 Saturday."),
|
|
18197
|
+
posts_per_page: int2("Posts on blog pages."),
|
|
18198
|
+
site_logo: int2("Media id of the logo."),
|
|
18199
|
+
site_icon: int2("Media id of the site icon (512\xD7512).")
|
|
18200
|
+
}
|
|
18201
|
+
},
|
|
18202
|
+
group: "site",
|
|
18203
|
+
need: WRITE,
|
|
18204
|
+
risk: "W3",
|
|
18205
|
+
gates: [...GATES],
|
|
18206
|
+
confirm: (a, lang) => a.search_engines === true ? say(
|
|
18207
|
+
lang,
|
|
18208
|
+
"Change your website's settings and let search engines index it.",
|
|
18209
|
+
"\u4FEE\u6539\u7DB2\u7AD9\u8A2D\u5B9A\uFF0C\u4E26\u5141\u8A31\u641C\u5C0B\u5F15\u64CE\u6536\u9304\u3002"
|
|
18210
|
+
) : a.search_engines === false ? say(
|
|
18211
|
+
lang,
|
|
18212
|
+
"Change your website's settings and ask search engines not to index it.",
|
|
18213
|
+
"\u4FEE\u6539\u7DB2\u7AD9\u8A2D\u5B9A\uFF0C\u4E26\u8981\u6C42\u641C\u5C0B\u5F15\u64CE\u4E0D\u8981\u6536\u9304\u3002"
|
|
18214
|
+
) : say(lang, "Change your website's general settings.", "\u4FEE\u6539\u7DB2\u7AD9\u7684\u4E00\u822C\u8A2D\u5B9A\u3002"),
|
|
18215
|
+
run: async (ctx, a) => {
|
|
18216
|
+
const site = siteOf(ctx);
|
|
18217
|
+
const body = {};
|
|
18218
|
+
for (const k of ["title", "description", "date_format", "time_format", "timezone"])
|
|
18219
|
+
if (typeof a[k] === "string") body[k] = a[k];
|
|
18220
|
+
for (const k of ["start_of_week", "posts_per_page", "site_logo", "site_icon"])
|
|
18221
|
+
if (typeof a[k] === "number") body[k] = a[k];
|
|
18222
|
+
if (typeof a.search_engines === "boolean") body.blog_public = a.search_engines ? 1 : 0;
|
|
18223
|
+
if (!Object.keys(body).length) throw new Error("Nothing to change.");
|
|
18224
|
+
const fields = Object.keys(body).join(",");
|
|
18225
|
+
const before = await call(site, { path: "/wp/v2/settings", query: { _fields: fields } });
|
|
18226
|
+
if ("blog_public" in body && !("blog_public" in before))
|
|
18227
|
+
throw new Error(
|
|
18228
|
+
"This site's theme doesn't expose search-engine visibility yet: update Maggie Core (wp_theme_update) to 0.11.4 or later."
|
|
18229
|
+
);
|
|
18230
|
+
const after = await call(site, {
|
|
18231
|
+
method: "POST",
|
|
18232
|
+
path: "/wp/v2/settings",
|
|
18233
|
+
query: { _fields: fields },
|
|
18234
|
+
body
|
|
18235
|
+
});
|
|
18236
|
+
return { before, after };
|
|
18237
|
+
}
|
|
18238
|
+
}),
|
|
18239
|
+
tool({
|
|
18240
|
+
name: "wp_plugins_list",
|
|
18241
|
+
description: "The site's plugins: name, version, active or not, and whether an update is waiting.",
|
|
18242
|
+
parameters: { type: "object", properties: {} },
|
|
18243
|
+
group: "site",
|
|
18244
|
+
need: READ,
|
|
18245
|
+
risk: "R0",
|
|
18246
|
+
gates: ["WP"],
|
|
18247
|
+
run: async (ctx) => {
|
|
18248
|
+
const rows = await call(siteOf(ctx), { path: "/wp/v2/plugins", query: { _fields: "plugin,name,version,status" } });
|
|
18249
|
+
return { count: rows.length, items: rows };
|
|
18250
|
+
}
|
|
18251
|
+
}),
|
|
18252
|
+
tool({
|
|
18253
|
+
name: "wp_plugin_set",
|
|
18254
|
+
description: "Install a plugin from WordPress.org by its slug (e.g. wpforms-lite), and/or activate, deactivate or delete an installed one (plugin id from wp_plugins_list, e.g. akismet/akismet; only an inactive plugin can be deleted, and its settings may go with it). Installing runs the plugin's code on the site: only well-known plugins the owner asked for.",
|
|
18255
|
+
parameters: {
|
|
18256
|
+
type: "object",
|
|
18257
|
+
properties: {
|
|
18258
|
+
install: str2("WordPress.org slug to install."),
|
|
18259
|
+
plugin: str2("Installed plugin id (folder/file) to change."),
|
|
18260
|
+
status: {
|
|
18261
|
+
type: "string",
|
|
18262
|
+
enum: ["active", "inactive", "deleted"],
|
|
18263
|
+
description: "Activate, deactivate (after installing, default inactive), or deleted: remove an inactive plugin's files (deactivate it first; Maggie Press can't be removed here)."
|
|
18264
|
+
}
|
|
18265
|
+
}
|
|
18266
|
+
},
|
|
18267
|
+
group: "site",
|
|
18268
|
+
need: WRITE,
|
|
18269
|
+
risk: "W3",
|
|
18270
|
+
gates: [...GATES],
|
|
18271
|
+
confirm: (a, lang) => a.install ? say(
|
|
18272
|
+
lang,
|
|
18273
|
+
`Install the plugin ${q2(a.install, "")} from WordPress.org on your website${a.status === "active" ? " and activate it" : ""}.`,
|
|
18274
|
+
`\u5728\u7DB2\u7AD9\u4E0A\u5B89\u88DD WordPress.org \u63D2\u4EF6 ${q2(a.install, "")}${a.status === "active" ? "\u4E26\u555F\u7528" : ""}\u3002`
|
|
18275
|
+
) : a.status === "deleted" ? say(
|
|
18276
|
+
lang,
|
|
18277
|
+
`Delete the plugin ${q2(a.plugin, "")} from your website (its files are removed; reinstall it from WordPress.org to undo, its settings may be lost).`,
|
|
18278
|
+
`\u5F9E\u7DB2\u7AD9\u522A\u9664\u63D2\u4EF6 ${q2(a.plugin, "")}\uFF08\u6A94\u6848\u6703\u88AB\u79FB\u9664\uFF1B\u53EF\u5F9E WordPress.org \u91CD\u65B0\u5B89\u88DD\uFF0C\u8A2D\u5B9A\u53EF\u80FD\u907A\u5931\uFF09\u3002`
|
|
18279
|
+
) : say(
|
|
18280
|
+
lang,
|
|
18281
|
+
`${a.status === "active" ? "Activate" : "Deactivate"} the plugin ${q2(a.plugin, "")} on your website.`,
|
|
18282
|
+
`${a.status === "active" ? "\u555F\u7528" : "\u505C\u7528"}\u7DB2\u7AD9\u4E0A\u7684\u63D2\u4EF6 ${q2(a.plugin, "")}\u3002`
|
|
18283
|
+
),
|
|
18284
|
+
run: async (ctx, a) => {
|
|
18285
|
+
const site = siteOf(ctx);
|
|
18286
|
+
if (a.install) {
|
|
18287
|
+
if (!/^[a-z0-9-]{2,80}$/.test(String(a.install)))
|
|
18288
|
+
throw new Error("install: a WordPress.org plugin slug, e.g. wpforms-lite.");
|
|
18289
|
+
return call(site, {
|
|
18290
|
+
method: "POST",
|
|
18291
|
+
path: "/wp/v2/plugins",
|
|
18292
|
+
query: { _fields: "plugin,name,version,status" },
|
|
18293
|
+
body: { slug: a.install, status: a.status === "active" ? "active" : "inactive" }
|
|
18294
|
+
});
|
|
18295
|
+
}
|
|
18296
|
+
if (!a.plugin || !a.status) throw new Error("Give install (a slug), or plugin and status.");
|
|
18297
|
+
if (!/^[a-z0-9._-]+(\/[a-z0-9._-]+)?$/i.test(String(a.plugin)))
|
|
18298
|
+
throw new Error("plugin: the id from wp_plugins_list, e.g. akismet/akismet.");
|
|
18299
|
+
const id = String(a.plugin).replace(/\.php$/, "");
|
|
18300
|
+
if (a.status === "deleted") {
|
|
18301
|
+
if (/^maggie-?press\//i.test(id))
|
|
18302
|
+
throw new Error("Maggie Press runs the site's styles; it can't be deleted here.");
|
|
18303
|
+
const cur = await call(site, {
|
|
18304
|
+
path: `/wp/v2/plugins/${id}`,
|
|
18305
|
+
query: { _fields: "plugin,name,version,status" }
|
|
18306
|
+
});
|
|
18307
|
+
if (cur.status !== "inactive")
|
|
18308
|
+
throw new Error(`${cur.name} is ${cur.status}: deactivate it first (status inactive), then delete it.`);
|
|
18309
|
+
await call(site, { method: "DELETE", path: `/wp/v2/plugins/${id}` });
|
|
18310
|
+
const slug = id.split("/")[0];
|
|
18311
|
+
return {
|
|
18312
|
+
deleted: true,
|
|
18313
|
+
plugin: cur.plugin,
|
|
18314
|
+
name: cur.name,
|
|
18315
|
+
version: cur.version,
|
|
18316
|
+
undo: `wp_plugin_set install ${slug}`
|
|
18317
|
+
};
|
|
18318
|
+
}
|
|
18319
|
+
return call(site, {
|
|
18320
|
+
method: "POST",
|
|
18321
|
+
path: `/wp/v2/plugins/${id}`,
|
|
18322
|
+
query: { _fields: "plugin,name,version,status" },
|
|
18323
|
+
body: { status: a.status }
|
|
18324
|
+
});
|
|
18325
|
+
}
|
|
18326
|
+
}),
|
|
18327
|
+
tool({
|
|
18328
|
+
name: "wp_api_read",
|
|
18329
|
+
description: "Read any WordPress REST route the site builder may use (GET only), for coding agents exploring a site: e.g. /wp/v2/types, /wp/v2/taxonomies, /wp/v2/templates, /wp/v2/block-patterns/patterns, /wp/v2/global-styles/themes/maggie-core, /maggie-core/v1/site. Results are trimmed to 60 items.",
|
|
18330
|
+
parameters: {
|
|
18331
|
+
type: "object",
|
|
18332
|
+
properties: { route: str2("The REST route under /wp-json, e.g. /wp/v2/types."), query: obj("Query parameters.") },
|
|
18333
|
+
required: ["route"]
|
|
18334
|
+
},
|
|
18335
|
+
group: "site",
|
|
18336
|
+
need: READ,
|
|
18337
|
+
risk: "R0",
|
|
18338
|
+
gates: ["WP"],
|
|
18339
|
+
run: async (ctx, a) => {
|
|
18340
|
+
const r = await siteOf(ctx).request({
|
|
18341
|
+
path: String(a.route),
|
|
18342
|
+
query: a.query ?? {}
|
|
18343
|
+
});
|
|
18344
|
+
const data = Array.isArray(r.data) ? r.data.slice(0, 60) : r.data;
|
|
18345
|
+
return { status: r.status, total: r.total ?? null, data };
|
|
18346
|
+
}
|
|
18347
|
+
})
|
|
18348
|
+
];
|
|
17790
18349
|
var wordpressTools = [
|
|
18350
|
+
...fullTools,
|
|
17791
18351
|
...siteTools,
|
|
17792
18352
|
...pageTools,
|
|
17793
18353
|
...sectionTools,
|
|
@@ -21206,7 +21766,7 @@ var program = new Command();
|
|
|
21206
21766
|
// package.json
|
|
21207
21767
|
var package_default = {
|
|
21208
21768
|
name: "@cmo-so/cli",
|
|
21209
|
-
version: "0.12.
|
|
21769
|
+
version: "0.12.8",
|
|
21210
21770
|
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.",
|
|
21211
21771
|
type: "module",
|
|
21212
21772
|
license: "MIT",
|
|
@@ -32365,6 +32925,71 @@ ${table(r.issues, ["severity", "code", "path", "detail"])}`;
|
|
|
32365
32925
|
theme.command("status", { isDefault: true }).description("installed and latest version, rollback versions").action((_o, c) => run(g(c), "wp_theme_updates", {}));
|
|
32366
32926
|
theme.command("update").description("update to the latest (homepage checked; rolled back by itself if it breaks)").action((_o, c) => run(g(c), "wp_theme_update", {}));
|
|
32367
32927
|
theme.command("rollback <version>").description("put a kept earlier version back").action((version2, _o, c) => run(g(c), "wp_theme_update", { rollback_to: version2 }));
|
|
32928
|
+
wp.command("markup <page>").description(
|
|
32929
|
+
"a page's block markup (Gutenberg); --set replaces it from a file, --section reads or sets one section"
|
|
32930
|
+
).option("--section <id>", "one section (id or type)").option("--set <file>", "replace with this block markup (- for stdin)").option("--preview", "show the sections before and after, save nothing").action(async (p, o, c) => {
|
|
32931
|
+
if (!o.set)
|
|
32932
|
+
return run(
|
|
32933
|
+
g(c),
|
|
32934
|
+
"wp_page_markup_get",
|
|
32935
|
+
{ page: p, section: o.section },
|
|
32936
|
+
(v) => String(v.markup)
|
|
32937
|
+
);
|
|
32938
|
+
const markup = o.set === "-" ? await readStdin() : await readFile2(o.set, "utf8");
|
|
32939
|
+
if (o.section)
|
|
32940
|
+
return run(g(c), "wp_section_update", { page: p, section: o.section, markup, preview: !!o.preview });
|
|
32941
|
+
return run(g(c), "wp_page_markup_set", { page: p, markup, preview: !!o.preview });
|
|
32942
|
+
});
|
|
32943
|
+
const posts2 = wp.command("posts").description("blog posts on the site");
|
|
32944
|
+
posts2.command("ls", { isDefault: true }).option("--search <words>").option("--status <status>", "publish, draft, future, private or any").option("--category <name>").option("-n, --limit <n>", "how many", "30").action(
|
|
32945
|
+
(o, c) => run(g(c), "wp_posts_list", { search: o.search, status: o.status, category: o.category, limit: Number(o.limit) })
|
|
32946
|
+
);
|
|
32947
|
+
posts2.command("get <id>").action((id, _o, c) => run(g(c), "wp_post_get", { post: Number(id) }));
|
|
32948
|
+
posts2.command("save [id]").description(
|
|
32949
|
+
"create (no id) or change a post: JSON file with title, content, excerpt, slug, status, categories, tags\u2026"
|
|
32950
|
+
).requiredOption("--from <file>", "JSON (- for stdin)").action(
|
|
32951
|
+
async (id, o, c) => run(g(c), "wp_post_save", { ...await json(o.from), ...id ? { post: Number(id) } : {} })
|
|
32952
|
+
);
|
|
32953
|
+
posts2.command("delete <id>").description("move to the trash and redirect its address").option("--redirect-to <path>").action(
|
|
32954
|
+
(id, o, c) => run(g(c), "wp_post_delete", { post: Number(id), redirect_to: o.redirectTo })
|
|
32955
|
+
);
|
|
32956
|
+
const terms = wp.command("terms").description("categories and tags");
|
|
32957
|
+
terms.command("ls", { isDefault: true }).option("--tags", "tags instead of categories").option("--search <words>").action(
|
|
32958
|
+
(o, c) => run(g(c), "wp_terms_list", { taxonomy: o.tags ? "tags" : "categories", search: o.search })
|
|
32959
|
+
);
|
|
32960
|
+
terms.command("save [id]").option("--tags", "a tag instead of a category").option("--name <name>").option("--slug <slug>").option("--description <text>").action(
|
|
32961
|
+
(id, o, c) => run(g(c), "wp_term_save", {
|
|
32962
|
+
taxonomy: o.tags ? "tags" : "categories",
|
|
32963
|
+
id: id ? Number(id) : void 0,
|
|
32964
|
+
name: o.name,
|
|
32965
|
+
slug: o.slug,
|
|
32966
|
+
description: o.description
|
|
32967
|
+
})
|
|
32968
|
+
);
|
|
32969
|
+
terms.command("delete <id>").option("--tags", "a tag instead of a category").action(
|
|
32970
|
+
(id, o, c) => run(g(c), "wp_term_delete", { taxonomy: o.tags ? "tags" : "categories", id: Number(id) })
|
|
32971
|
+
);
|
|
32972
|
+
const settings2 = wp.command("settings").description("the site's general settings");
|
|
32973
|
+
settings2.command("get", { isDefault: true }).action((_o, c) => run(g(c), "wp_settings_get", {}));
|
|
32974
|
+
settings2.command("set [fields...]").description(
|
|
32975
|
+
"title=\u2026 description=\u2026 timezone=Europe/London date_format=\u2026 posts_per_page=10 search_engines=true|false"
|
|
32976
|
+
).action(async (fields, _o, c) => {
|
|
32977
|
+
const args = {};
|
|
32978
|
+
for (const [k, v] of pairs(fields))
|
|
32979
|
+
args[k] = /^(true|false)$/.test(v) ? v === "true" : /^\d+$/.test(v) && k !== "title" && k !== "description" ? Number(v) : v;
|
|
32980
|
+
await run(g(c), "wp_settings_set", args);
|
|
32981
|
+
});
|
|
32982
|
+
const plugins = wp.command("plugins").description("plugins: list, install from WordPress.org, activate, deactivate, delete (inactive only)");
|
|
32983
|
+
plugins.command("ls", { isDefault: true }).action((_o, c) => run(g(c), "wp_plugins_list", {}));
|
|
32984
|
+
plugins.command("install <slug>").option("--activate").action(
|
|
32985
|
+
(slug, o, c) => run(g(c), "wp_plugin_set", { install: slug, status: o.activate ? "active" : "inactive" })
|
|
32986
|
+
);
|
|
32987
|
+
plugins.command("activate <plugin>").action((p, _o, c) => run(g(c), "wp_plugin_set", { plugin: p, status: "active" }));
|
|
32988
|
+
plugins.command("deactivate <plugin>").action((p, _o, c) => run(g(c), "wp_plugin_set", { plugin: p, status: "inactive" }));
|
|
32989
|
+
plugins.command("delete <plugin>").description("remove an inactive plugin's files (reinstall from WordPress.org to undo)").action((p, _o, c) => run(g(c), "wp_plugin_set", { plugin: p, status: "deleted" }));
|
|
32990
|
+
wp.command("api <route>").description("read any allowed WordPress REST route (GET), e.g. /wp/v2/types").option("--query <json>", "query parameters as JSON").action(
|
|
32991
|
+
(route, o, c) => run(g(c), "wp_api_read", { route, query: o.query ? JSON.parse(o.query) : void 0 })
|
|
32992
|
+
);
|
|
32368
32993
|
const child = wp.command("child").description("the site's Maggie child theme, on the site itself (data files only, backups kept)");
|
|
32369
32994
|
child.command("status [slug]", { isDefault: true }).description("child themes, their files and backups; with a slug, its files in full").action((slug, _o, c) => run(g(c), "wp_child_theme_status", { slug }));
|
|
32370
32995
|
child.command("create <slug>").description("create maggie-<name> from the site's current look").requiredOption("--name <name>").option("--empty", "start empty instead of from the site").option("--activate", "switch the site to it (checks the homepage looks the same)").action(
|
|
@@ -32395,7 +33020,7 @@ ${table(r.issues, ["severity", "code", "path", "detail"])}`;
|
|
|
32395
33020
|
const opts = g(c);
|
|
32396
33021
|
const colors = Object.fromEntries(pairs(o.color));
|
|
32397
33022
|
const fonts = Object.fromEntries(pairs(o.font));
|
|
32398
|
-
let
|
|
33023
|
+
let settings3;
|
|
32399
33024
|
let styles;
|
|
32400
33025
|
const fontFiles = {};
|
|
32401
33026
|
let header;
|
|
@@ -32403,9 +33028,9 @@ ${table(r.issues, ["severity", "code", "path", "detail"])}`;
|
|
|
32403
33028
|
if (o.fromSite) {
|
|
32404
33029
|
const site = await siteFor(opts);
|
|
32405
33030
|
const s = await styleGet(site);
|
|
32406
|
-
|
|
33031
|
+
settings3 = structuredClone(s._user.settings ?? {});
|
|
32407
33032
|
styles = s._user.styles ?? {};
|
|
32408
|
-
const families =
|
|
33033
|
+
const families = settings3.typography?.fontFamilies?.theme ?? [];
|
|
32409
33034
|
for (const f of families)
|
|
32410
33035
|
for (const face of f.fontFace ?? []) {
|
|
32411
33036
|
const srcs = Array.isArray(face.src) ? face.src : [face.src];
|
|
@@ -32424,7 +33049,7 @@ ${table(r.issues, ["severity", "code", "path", "detail"])}`;
|
|
|
32424
33049
|
footer = (await partGet(site, "footer").catch(() => null))?.content;
|
|
32425
33050
|
}
|
|
32426
33051
|
const files = {
|
|
32427
|
-
...childThemeFiles({ slug, name: o.name, colors, fonts, header, footer, settings:
|
|
33052
|
+
...childThemeFiles({ slug, name: o.name, colors, fonts, header, footer, settings: settings3, styles }),
|
|
32428
33053
|
...fontFiles
|
|
32429
33054
|
};
|
|
32430
33055
|
const dir = o.out ?? slug;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmo-so/cli",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.8",
|
|
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",
|