@cmo-so/cli 0.12.13 → 0.12.14
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 +24 -12
- package/package.json +1 -1
package/dist/cmo.mjs
CHANGED
|
@@ -17656,7 +17656,7 @@ async function llmsTxt(site, o = {}) {
|
|
|
17656
17656
|
const base = (site.url ?? "").replace(/\/+$/, "");
|
|
17657
17657
|
const s = await site.request({
|
|
17658
17658
|
path: "/wp/v2/settings",
|
|
17659
|
-
query: { _fields: "title,description,page_on_front,page_for_posts" }
|
|
17659
|
+
query: { _fields: "title,description,page_on_front,page_for_posts,blog_public" }
|
|
17660
17660
|
}).then((r) => r.status === 200 ? r.data : {});
|
|
17661
17661
|
const pages = await listPages(site, { status: "publish" });
|
|
17662
17662
|
const posts2 = await all(
|
|
@@ -17665,10 +17665,20 @@ async function llmsTxt(site, o = {}) {
|
|
|
17665
17665
|
{ status: "publish", per_page: 100, _fields: "link,title,excerpt,meta", orderby: "date", order: "desc" },
|
|
17666
17666
|
o.posts ?? 25
|
|
17667
17667
|
);
|
|
17668
|
-
const
|
|
17668
|
+
const clip3 = (t, n2 = 200) => {
|
|
17669
|
+
const x = t.replace(/\s+/g, " ").trim();
|
|
17670
|
+
if (x.length <= n2) return x;
|
|
17671
|
+
const cut = x.slice(0, n2);
|
|
17672
|
+
return `${cut.slice(0, Math.max(cut.lastIndexOf(" "), n2 - 30)).replace(/[\s,;:–-]+$/, "")}\u2026`;
|
|
17673
|
+
};
|
|
17674
|
+
const desc = (m, fallback = "") => clip3(String(m?.maggie_seo_description || fallback));
|
|
17675
|
+
const isSample = (link, title) => /\/(sample-page|hello-world)\/?$/.test(link) || title === "Sample Page" || title === "Hello world!";
|
|
17669
17676
|
const home = pages.find((p) => p.id === s.page_on_front);
|
|
17670
17677
|
const noise = /privacy|terms|cookie|thank|cart|checkout|my-account|login/i;
|
|
17671
|
-
const visible = pages.filter(
|
|
17678
|
+
const visible = pages.filter(
|
|
17679
|
+
(p) => p.id !== s.page_on_front && p.id !== s.page_for_posts && !noise.test(p.link) && !isSample(p.link, titleOf(p.title))
|
|
17680
|
+
);
|
|
17681
|
+
const realPosts = posts2.filter((p) => !isSample(p.link, strip(p.title.rendered ?? "")));
|
|
17672
17682
|
const byParent = /* @__PURE__ */ new Map();
|
|
17673
17683
|
for (const p of visible) byParent.set(p.parent, [...byParent.get(p.parent) ?? [], p]);
|
|
17674
17684
|
const line = (title, url, d) => `- [${title.replace(/[[\]]/g, "")}](${url})${d ? `: ${d}` : ""}`;
|
|
@@ -17676,25 +17686,27 @@ async function llmsTxt(site, o = {}) {
|
|
|
17676
17686
|
const summary = desc(home?.meta, s.description ?? "");
|
|
17677
17687
|
if (summary) out.push(`> ${summary}`, "");
|
|
17678
17688
|
const top = byParent.get(0) ?? [];
|
|
17679
|
-
if (top.length) {
|
|
17689
|
+
if (top.length || home) {
|
|
17680
17690
|
out.push("## Pages", "");
|
|
17691
|
+
if (home) out.push(line(titleOf(home.title) || "Home", home.link, summary));
|
|
17681
17692
|
for (const p of top) {
|
|
17682
17693
|
out.push(line(titleOf(p.title), p.link, desc(p.meta)));
|
|
17683
17694
|
for (const c of byParent.get(p.id) ?? []) out.push(` ${line(titleOf(c.title), c.link, desc(c.meta))}`);
|
|
17684
17695
|
}
|
|
17685
17696
|
out.push("");
|
|
17686
17697
|
}
|
|
17687
|
-
if (
|
|
17698
|
+
if (realPosts.length) {
|
|
17688
17699
|
out.push("## Articles", "");
|
|
17689
|
-
for (const p of
|
|
17690
|
-
out.push(
|
|
17691
|
-
line(strip(p.title.rendered ?? ""), p.link, desc(p.meta, strip(p.excerpt?.rendered ?? "").slice(0, 160)))
|
|
17692
|
-
);
|
|
17700
|
+
for (const p of realPosts)
|
|
17701
|
+
out.push(line(strip(p.title.rendered ?? ""), p.link, desc(p.meta, strip(p.excerpt?.rendered ?? ""))));
|
|
17693
17702
|
out.push("");
|
|
17694
17703
|
}
|
|
17695
17704
|
const legal = pages.filter((p) => /privacy|terms/i.test(p.link));
|
|
17696
|
-
|
|
17697
|
-
|
|
17705
|
+
const optional2 = [
|
|
17706
|
+
...s.blog_public === 0 ? [] : [line("Sitemap", `${base}/wp-sitemap.xml`, "every page and article")],
|
|
17707
|
+
...legal.map((p) => line(titleOf(p.title), p.link, ""))
|
|
17708
|
+
];
|
|
17709
|
+
if (optional2.length) out.push("## Optional", "", ...optional2);
|
|
17698
17710
|
return `${out.join("\n").replace(/\n{3,}/g, "\n\n").trim()}
|
|
17699
17711
|
`;
|
|
17700
17712
|
}
|
|
@@ -23888,7 +23900,7 @@ var program = new Command();
|
|
|
23888
23900
|
// package.json
|
|
23889
23901
|
var package_default = {
|
|
23890
23902
|
name: "@cmo-so/cli",
|
|
23891
|
-
version: "0.12.
|
|
23903
|
+
version: "0.12.14",
|
|
23892
23904
|
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.",
|
|
23893
23905
|
type: "module",
|
|
23894
23906
|
license: "MIT",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cmo-so/cli",
|
|
3
|
-
"version": "0.12.
|
|
3
|
+
"version": "0.12.14",
|
|
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",
|