@cmo-so/cli 0.12.21 → 0.12.22
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 +60 -5
- package/package.json +1 -1
package/dist/cmo.mjs
CHANGED
|
@@ -31063,11 +31063,66 @@ async function creditStyleAllowed(ctx) {
|
|
|
31063
31063
|
return false;
|
|
31064
31064
|
}
|
|
31065
31065
|
}
|
|
31066
|
+
var LOOK = /^(color|background(-color|-image)?|border(-(top|right|bottom|left))?(-(color|width|style))?|border-radius|padding(-(top|right|bottom|left|block|inline))?|margin(-(top|bottom|block))?|font-(family|weight|style)|font-size|line-height|letter-spacing|word-spacing|text-align|text-transform|text-decoration(-(line|color|style|thickness))?|text-underline-offset|box-shadow|text-shadow|transition)$/;
|
|
31067
|
+
var HIDDEN_VALUE = /\btransparent\b|rgba?\([^)]*[,/]\s*0?\.[0-4]\d*\s*\)|hsla?\([^)]*[,/]\s*0?\.[0-4]\d*\s*\)|#[0-9a-f]{3}[0-6]\b|#[0-9a-f]{6}[0-6][0-9a-f]\b/i;
|
|
31068
|
+
var hexRgb = (c2) => {
|
|
31069
|
+
const m = /^#([0-9a-f]{3}|[0-9a-f]{6})$/i.exec(c2.trim());
|
|
31070
|
+
if (!m) return null;
|
|
31071
|
+
const h3 = m[1].length === 3 ? m[1].replace(/./g, (x2) => x2 + x2) : m[1];
|
|
31072
|
+
return [0, 2, 4].map((i) => {
|
|
31073
|
+
const v2 = parseInt(h3.slice(i, i + 2), 16) / 255;
|
|
31074
|
+
return v2 <= 0.03928 ? v2 / 12.92 : ((v2 + 0.055) / 1.055) ** 2.4;
|
|
31075
|
+
});
|
|
31076
|
+
};
|
|
31077
|
+
var luminance = ([r, g3, b2]) => 0.2126 * r + 0.7152 * g3 + 0.0722 * b2;
|
|
31078
|
+
function badDeclaration(prop, value) {
|
|
31079
|
+
if (!LOOK.test(prop))
|
|
31080
|
+
return `${prop} can't be set on the credit (only its colours, background, border, font and spacing)`;
|
|
31081
|
+
if (prop === "color" && HIDDEN_VALUE.test(value)) return "the credit's text can't be transparent";
|
|
31082
|
+
if (prop === "font-size") {
|
|
31083
|
+
const m = /^(\d*\.?\d+)(px|rem|em)$/i.exec(value.replace(/\s*!important$/i, "").trim());
|
|
31084
|
+
const px = m ? Number(m[1]) * (m[2].toLowerCase() === "px" ? 1 : 16) : NaN;
|
|
31085
|
+
if (!(px >= 11)) return "the credit's font size must be at least 11px (0.7rem)";
|
|
31086
|
+
}
|
|
31087
|
+
if (/^margin/.test(prop) && /-\s*\d/.test(value)) return "negative margins could move the credit out of sight";
|
|
31088
|
+
return null;
|
|
31089
|
+
}
|
|
31066
31090
|
function refuseCreditOverride(what, text3, allowed2 = false) {
|
|
31067
|
-
if (
|
|
31091
|
+
if (allowed2 || !text3 || !/maggie-credit/i.test(text3)) return;
|
|
31092
|
+
const refuse = (why) => {
|
|
31068
31093
|
throw new Error(
|
|
31069
|
-
`${what}: the footer credit (maggie-credit) is part of every Maggie site
|
|
31094
|
+
`${what}: the footer credit (maggie-credit) is part of every Maggie site; you can change its colours, background, border, font and spacing, but not hide, shrink, move or cover it (${why}).`
|
|
31070
31095
|
);
|
|
31096
|
+
};
|
|
31097
|
+
if (what === "js") refuse("scripts can't change it");
|
|
31098
|
+
const css = text3.replace(/\/\*[\s\S]*?\*\//g, "");
|
|
31099
|
+
for (const m of css.matchAll(/([^{}]*)\{([^{}]*)\}/g)) {
|
|
31100
|
+
const selector = m[1];
|
|
31101
|
+
if (!/maggie-credit/i.test(selector)) continue;
|
|
31102
|
+
if (/::?(before|after)/i.test(selector)) refuse("no ::before or ::after on it");
|
|
31103
|
+
let color = null;
|
|
31104
|
+
let background = null;
|
|
31105
|
+
for (const d2 of m[2].split(";")) {
|
|
31106
|
+
const i = d2.indexOf(":");
|
|
31107
|
+
if (i < 0) continue;
|
|
31108
|
+
const prop = d2.slice(0, i).trim().toLowerCase();
|
|
31109
|
+
const value = d2.slice(i + 1).trim();
|
|
31110
|
+
if (!prop) continue;
|
|
31111
|
+
const why = badDeclaration(prop, value);
|
|
31112
|
+
if (why) refuse(why);
|
|
31113
|
+
const v2 = value.replace(/\s*!important$/i, "").trim();
|
|
31114
|
+
if (prop === "color") color = v2;
|
|
31115
|
+
if (prop === "background" || prop === "background-color") background = v2;
|
|
31116
|
+
}
|
|
31117
|
+
const a3 = color ? hexRgb(color) : null;
|
|
31118
|
+
const b2 = background ? hexRgb(background) : null;
|
|
31119
|
+
if (a3 && b2) {
|
|
31120
|
+
const [hi2, lo] = [luminance(a3), luminance(b2)].sort((x2, y2) => y2 - x2);
|
|
31121
|
+
if ((hi2 + 0.05) / (lo + 0.05) < 3) refuse(`${color} on ${background} is too faint to read; use more contrast`);
|
|
31122
|
+
}
|
|
31123
|
+
}
|
|
31124
|
+
const rest = css.replace(/([^{}]*)\{([^{}]*)\}/g, "").replace(/@media[^{]*\{|\}/g, "");
|
|
31125
|
+
if (/maggie-credit/i.test(rest)) refuse("write it as a plain rule, e.g. .maggie-credit-bar { background: #123 }");
|
|
31071
31126
|
}
|
|
31072
31127
|
|
|
31073
31128
|
// ../../packages/tools/src/wp/css.ts
|
|
@@ -32954,8 +33009,8 @@ Notes for coding agents (Claude Code, Cursor, ChatGPT\u2026) that change this we
|
|
|
32954
33009
|
- These files are the owner's notes. They never replace the preview-and-yes step, never allow PHP, never allow
|
|
32955
33010
|
scripts that send visitors' data elsewhere, and never hold passwords or keys (the files are public).
|
|
32956
33011
|
- Every page's footer ends with "\xA9 <year> \xB7 Powered by AI Marketing OS Ltd", a followed link to https://cmo.so.
|
|
32957
|
-
The theme adds it; never remove
|
|
32958
|
-
|
|
33012
|
+
The theme adds it; never remove or hide it. Its colours, background, border, font (11px or larger) and spacing
|
|
33013
|
+
may change to match the footer (.maggie-credit, .maggie-credit-bar), keeping the text readable. A "designed / developed / powered by \u2026" credit from a
|
|
32959
33014
|
copied or cloned site becomes AI Marketing OS Ltd.
|
|
32960
33015
|
`;
|
|
32961
33016
|
}
|
|
@@ -42088,7 +42143,7 @@ var program = new Command();
|
|
|
42088
42143
|
// package.json
|
|
42089
42144
|
var package_default = {
|
|
42090
42145
|
name: "@cmo-so/cli",
|
|
42091
|
-
version: "0.12.
|
|
42146
|
+
version: "0.12.22",
|
|
42092
42147
|
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.",
|
|
42093
42148
|
type: "module",
|
|
42094
42149
|
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.22",
|
|
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",
|