seo-supervisor 1.2.0 → 2.0.0
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/.claude-plugin/icon.png +0 -0
- package/.claude-plugin/marketplace.json +2 -2
- package/.claude-plugin/plugin.json +16 -3
- package/CHANGELOG.md +430 -0
- package/NOTICE +7 -0
- package/README.md +230 -25
- package/agents/seo-auditor.md +16 -0
- package/agents/seo-reviewer.md +16 -0
- package/bin/agents.mjs +194 -29
- package/bin/extras.mjs +422 -0
- package/bin/prompt.mjs +34 -14
- package/bin/seo-supervisor.mjs +386 -53
- package/commands/seo-audit.md +29 -3
- package/commands/seo-brief.md +28 -0
- package/commands/seo-connect.md +27 -0
- package/commands/seo-fix.md +24 -3
- package/commands/seo-grow.md +26 -0
- package/commands/seo-launch.md +17 -3
- package/commands/seo-review.md +13 -1
- package/commands/seo-rewrite.md +25 -0
- package/commands/seo-setup.md +17 -1
- package/commands/seo-watch.md +28 -0
- package/hooks/hooks.json +117 -0
- package/package.json +20 -7
- package/skills/seo-supervisor/NOTICE +7 -0
- package/skills/seo-supervisor/SKILL.md +302 -21
- package/skills/seo-supervisor/audience.md +61 -0
- package/skills/seo-supervisor/examples/drafts/security.md +41 -0
- package/skills/seo-supervisor/examples/hooks/README.md +28 -0
- package/skills/seo-supervisor/examples/hooks/claude-code-settings.json +15 -0
- package/skills/seo-supervisor/examples/hooks/codex-hooks.json +17 -0
- package/skills/seo-supervisor/examples/hooks/copilot-hooks.json +15 -0
- package/skills/seo-supervisor/examples/hooks/cursor-hooks.json +11 -0
- package/skills/seo-supervisor/examples/hooks/github-actions.yml +21 -0
- package/skills/seo-supervisor/examples/hooks/pre-commit +17 -0
- package/skills/seo-supervisor/examples/hooks/reading-ease.yml +24 -0
- package/skills/seo-supervisor/examples/sample-audit.json +94 -2
- package/skills/seo-supervisor/examples/sample-report.html +111 -61
- package/skills/seo-supervisor/examples/sample-report.md +147 -44
- package/skills/seo-supervisor/examples/scheduled-runs.md +89 -0
- package/skills/seo-supervisor/examples/snippets.md +648 -1
- package/skills/seo-supervisor/grow.md +342 -0
- package/skills/seo-supervisor/og-images.md +85 -0
- package/skills/seo-supervisor/page-types.md +124 -0
- package/skills/seo-supervisor/planning.md +19 -7
- package/skills/seo-supervisor/profile-template.md +41 -0
- package/skills/seo-supervisor/report-format.md +177 -10
- package/skills/seo-supervisor/rewrite.md +59 -0
- package/skills/seo-supervisor/rules/ai-search.md +65 -12
- package/skills/seo-supervisor/rules/content.md +33 -9
- package/skills/seo-supervisor/rules/crawl-index.md +33 -6
- package/skills/seo-supervisor/rules/internal-linking.md +49 -6
- package/skills/seo-supervisor/rules/launch-monitoring.md +17 -8
- package/skills/seo-supervisor/rules/media.md +13 -1
- package/skills/seo-supervisor/rules/metadata.md +41 -9
- package/skills/seo-supervisor/rules/performance.md +50 -5
- package/skills/seo-supervisor/rules/rendering.md +39 -2
- package/skills/seo-supervisor/rules/search-intent.md +32 -0
- package/skills/seo-supervisor/rules/sitemaps-robots.md +24 -12
- package/skills/seo-supervisor/rules/structured-data.md +37 -14
- package/skills/seo-supervisor/rules/trust-security.md +25 -2
- package/skills/seo-supervisor/rules/urls.md +10 -2
- package/skills/seo-supervisor/scripts/ai-answers.mjs +314 -0
- package/skills/seo-supervisor/scripts/backlinks.mjs +412 -0
- package/skills/seo-supervisor/scripts/change-check.mjs +281 -0
- package/skills/seo-supervisor/scripts/checks/agents.mjs +488 -0
- package/skills/seo-supervisor/scripts/checks/assets.mjs +404 -0
- package/skills/seo-supervisor/scripts/checks/bots.mjs +146 -0
- package/skills/seo-supervisor/scripts/checks/business-type.mjs +193 -0
- package/skills/seo-supervisor/scripts/checks/content.mjs +391 -0
- package/skills/seo-supervisor/scripts/checks/coverage.mjs +184 -0
- package/skills/seo-supervisor/scripts/checks/crawl.mjs +95 -0
- package/skills/seo-supervisor/scripts/checks/hreflang.mjs +396 -0
- package/skills/seo-supervisor/scripts/checks/hygiene.mjs +227 -0
- package/skills/seo-supervisor/scripts/checks/lighthouse.mjs +271 -0
- package/skills/seo-supervisor/scripts/checks/link-strength.mjs +59 -0
- package/skills/seo-supervisor/scripts/checks/links.mjs +360 -0
- package/skills/seo-supervisor/scripts/checks/local.mjs +101 -0
- package/skills/seo-supervisor/scripts/checks/media.mjs +194 -0
- package/skills/seo-supervisor/scripts/checks/outbound.mjs +53 -0
- package/skills/seo-supervisor/scripts/checks/page.mjs +223 -0
- package/skills/seo-supervisor/scripts/checks/probes.mjs +130 -0
- package/skills/seo-supervisor/scripts/checks/render.mjs +552 -0
- package/skills/seo-supervisor/scripts/checks/robots.mjs +144 -0
- package/skills/seo-supervisor/scripts/checks/schema.mjs +206 -0
- package/skills/seo-supervisor/scripts/checks/site-agents.mjs +79 -0
- package/skills/seo-supervisor/scripts/checks/site-content.mjs +135 -0
- package/skills/seo-supervisor/scripts/checks/site-hygiene.mjs +202 -0
- package/skills/seo-supervisor/scripts/checks/site-pages.mjs +474 -0
- package/skills/seo-supervisor/scripts/checks/site-security.mjs +102 -0
- package/skills/seo-supervisor/scripts/checks/sitemap.mjs +473 -0
- package/skills/seo-supervisor/scripts/checks/speed.mjs +267 -0
- package/skills/seo-supervisor/scripts/checks/technical.mjs +368 -0
- package/skills/seo-supervisor/scripts/checks/tls.mjs +297 -0
- package/skills/seo-supervisor/scripts/checks/trust.mjs +421 -0
- package/skills/seo-supervisor/scripts/checks/visual.mjs +1132 -0
- package/skills/seo-supervisor/scripts/checks/writing.mjs +192 -0
- package/skills/seo-supervisor/scripts/commoncrawl.mjs +452 -0
- package/skills/seo-supervisor/scripts/connect-keys.mjs +422 -0
- package/skills/seo-supervisor/scripts/content-scan.mjs +515 -158
- package/skills/seo-supervisor/scripts/crawl/catalog.mjs +1248 -0
- package/skills/seo-supervisor/scripts/crawl/fetch.mjs +362 -0
- package/skills/seo-supervisor/scripts/crawl/page.mjs +741 -0
- package/skills/seo-supervisor/scripts/crawl/queue.mjs +190 -0
- package/skills/seo-supervisor/scripts/dashboard.mjs +140 -0
- package/skills/seo-supervisor/scripts/data/ai-bots.json +38 -0
- package/skills/seo-supervisor/scripts/data/build-schema-vocab.mjs +57 -0
- package/skills/seo-supervisor/scripts/data/business-types.json +338 -0
- package/skills/seo-supervisor/scripts/data/google-rich-results.json +79 -0
- package/skills/seo-supervisor/scripts/data/schema-vocab.json +1 -0
- package/skills/seo-supervisor/scripts/deploy-check.mjs +462 -0
- package/skills/seo-supervisor/scripts/disavow.mjs +176 -0
- package/skills/seo-supervisor/scripts/doctor.mjs +174 -0
- package/skills/seo-supervisor/scripts/geo-grid.mjs +371 -0
- package/skills/seo-supervisor/scripts/google/search-console.mjs +151 -0
- package/skills/seo-supervisor/scripts/google/session.mjs +167 -0
- package/skills/seo-supervisor/scripts/google-updates.mjs +189 -0
- package/skills/seo-supervisor/scripts/google.mjs +1341 -0
- package/skills/seo-supervisor/scripts/gsc-import.mjs +298 -0
- package/skills/seo-supervisor/scripts/guard/adapters/claude-code.mjs +149 -0
- package/skills/seo-supervisor/scripts/guard/adapters/cline.mjs +28 -0
- package/skills/seo-supervisor/scripts/guard/adapters/codex.mjs +26 -0
- package/skills/seo-supervisor/scripts/guard/adapters/copilot.mjs +36 -0
- package/skills/seo-supervisor/scripts/guard/adapters/cursor.mjs +33 -0
- package/skills/seo-supervisor/scripts/guard/adapters/devin.mjs +25 -0
- package/skills/seo-supervisor/scripts/guard/adapters/edits.mjs +124 -0
- package/skills/seo-supervisor/scripts/guard/mode.mjs +37 -0
- package/skills/seo-supervisor/scripts/guard/rules.mjs +931 -0
- package/skills/seo-supervisor/scripts/guard.mjs +74 -0
- package/skills/seo-supervisor/scripts/images.mjs +408 -0
- package/skills/seo-supervisor/scripts/indexnow.mjs +300 -0
- package/skills/seo-supervisor/scripts/issues.mjs +217 -0
- package/skills/seo-supervisor/scripts/keys/authority.mjs +135 -0
- package/skills/seo-supervisor/scripts/keys/bing.mjs +239 -0
- package/skills/seo-supervisor/scripts/keys/clarity.mjs +137 -0
- package/skills/seo-supervisor/scripts/keys/dataforseo.mjs +57 -0
- package/skills/seo-supervisor/scripts/keys/googleplaces.mjs +26 -0
- package/skills/seo-supervisor/scripts/keys/http.mjs +212 -0
- package/skills/seo-supervisor/scripts/keys/matomo.mjs +138 -0
- package/skills/seo-supervisor/scripts/keys/openai.mjs +26 -0
- package/skills/seo-supervisor/scripts/keys/perplexity.mjs +26 -0
- package/skills/seo-supervisor/scripts/keys/posthog.mjs +165 -0
- package/skills/seo-supervisor/scripts/keys/semrush.mjs +25 -0
- package/skills/seo-supervisor/scripts/keys/services.mjs +41 -0
- package/skills/seo-supervisor/scripts/keys/store.mjs +140 -0
- package/skills/seo-supervisor/scripts/keys/visits.mjs +58 -0
- package/skills/seo-supervisor/scripts/keys/youtube.mjs +84 -0
- package/skills/seo-supervisor/scripts/keyword-data.mjs +316 -0
- package/skills/seo-supervisor/scripts/keyword-ideas.mjs +503 -0
- package/skills/seo-supervisor/scripts/lib/args.mjs +56 -0
- package/skills/seo-supervisor/scripts/lib/business.mjs +27 -0
- package/skills/seo-supervisor/scripts/lib/cdp.mjs +242 -0
- package/skills/seo-supervisor/scripts/lib/cli.mjs +56 -0
- package/skills/seo-supervisor/scripts/lib/csv.mjs +38 -0
- package/skills/seo-supervisor/scripts/lib/findings.mjs +100 -0
- package/skills/seo-supervisor/scripts/lib/google-client.mjs +9 -0
- package/skills/seo-supervisor/scripts/lib/html.mjs +146 -0
- package/skills/seo-supervisor/scripts/lib/http.mjs +28 -0
- package/skills/seo-supervisor/scripts/lib/image-size.mjs +78 -0
- package/skills/seo-supervisor/scripts/lib/is-main.mjs +13 -0
- package/skills/seo-supervisor/scripts/lib/net.mjs +116 -0
- package/skills/seo-supervisor/scripts/lib/proxy.mjs +47 -0
- package/skills/seo-supervisor/scripts/lib/recheck.mjs +106 -0
- package/skills/seo-supervisor/scripts/lib/redact.mjs +78 -0
- package/skills/seo-supervisor/scripts/lib/robots.mjs +73 -0
- package/skills/seo-supervisor/scripts/lib/score.mjs +266 -0
- package/skills/seo-supervisor/scripts/lib/settings-dir.mjs +81 -0
- package/skills/seo-supervisor/scripts/links-import.mjs +603 -0
- package/skills/seo-supervisor/scripts/log-scan.mjs +597 -0
- package/skills/seo-supervisor/scripts/og-card.mjs +273 -0
- package/skills/seo-supervisor/scripts/osm.mjs +359 -0
- package/skills/seo-supervisor/scripts/rdap.mjs +164 -0
- package/skills/seo-supervisor/scripts/render-report.mjs +324 -690
- package/skills/seo-supervisor/scripts/report/client.js +37 -0
- package/skills/seo-supervisor/scripts/report/diff.mjs +264 -0
- package/skills/seo-supervisor/scripts/report/findings.mjs +165 -0
- package/skills/seo-supervisor/scripts/report/format.mjs +111 -0
- package/skills/seo-supervisor/scripts/report/markdown.mjs +250 -0
- package/skills/seo-supervisor/scripts/report/model.mjs +171 -0
- package/skills/seo-supervisor/scripts/report/overview-lines.mjs +158 -0
- package/skills/seo-supervisor/scripts/report/overview.mjs +224 -0
- package/skills/seo-supervisor/scripts/report/page.mjs +127 -0
- package/skills/seo-supervisor/scripts/report/panel.mjs +172 -0
- package/skills/seo-supervisor/scripts/report/panels/ai.mjs +211 -0
- package/skills/seo-supervisor/scripts/report/panels/connections.mjs +139 -0
- package/skills/seo-supervisor/scripts/report/panels/content.mjs +204 -0
- package/skills/seo-supervisor/scripts/report/panels/data-search.mjs +379 -0
- package/skills/seo-supervisor/scripts/report/panels/data-site.mjs +44 -0
- package/skills/seo-supervisor/scripts/report/panels/links.mjs +380 -0
- package/skills/seo-supervisor/scripts/report/panels/local.mjs +221 -0
- package/skills/seo-supervisor/scripts/report/panels/site.mjs +359 -0
- package/skills/seo-supervisor/scripts/report/panels/speed-media.mjs +267 -0
- package/skills/seo-supervisor/scripts/report/sources.mjs +163 -0
- package/skills/seo-supervisor/scripts/report/styles.css +223 -0
- package/skills/seo-supervisor/scripts/report/traffic.mjs +264 -0
- package/skills/seo-supervisor/scripts/report-plan.mjs +112 -33
- package/skills/seo-supervisor/scripts/schema-check.mjs +717 -0
- package/skills/seo-supervisor/scripts/seo-crawl.mjs +1086 -638
- package/skills/seo-supervisor/scripts/seo-diff.mjs +584 -0
- package/skills/seo-supervisor/scripts/update-check.mjs +82 -0
- package/skills/seo-supervisor/site-types/content.md +34 -1
- package/skills/seo-supervisor/site-types/ecommerce.md +38 -1
- package/skills/seo-supervisor/site-types/local-business.md +96 -6
- package/skills/seo-supervisor/site-types/services.md +46 -0
- package/skills/seo-supervisor/site-types/tools.md +3 -3
- package/skills/seo-supervisor/strategy.md +232 -0
- package/skills/seo-supervisor/troubleshooting.md +56 -0
|
@@ -1,15 +1,24 @@
|
|
|
1
|
-
//
|
|
2
|
-
//
|
|
1
|
+
// @ts-check
|
|
2
|
+
// The report's /seo-setup plan section as stats, HTML and Markdown. The plan's shape is in report-format.md.
|
|
3
|
+
import { safeHref, cellMd, mdSafe, noteMd } from "./report/format.mjs";
|
|
3
4
|
|
|
4
5
|
const STATUSES = ["exists", "to-build", "built", "to-create"];
|
|
5
6
|
const LABEL = { exists: "Already right", "to-build": "To build", built: "Built", "to-create": "To create" };
|
|
6
|
-
const PLAN_LABEL = {
|
|
7
|
+
const PLAN_LABEL = {
|
|
8
|
+
proposed: "Proposed: waiting for your approval",
|
|
9
|
+
approved: "Approved: being built",
|
|
10
|
+
built: "Built",
|
|
11
|
+
};
|
|
7
12
|
const NEEDS = { copy: "Copy", facts: "Facts", decision: "A decision", yes: "Your yes" };
|
|
8
13
|
|
|
9
14
|
const key = r => r.url || r.pattern || "";
|
|
10
15
|
const isDone = r => r.status === "exists" || r.status === "built";
|
|
11
16
|
const ownerOpen = r => r.owner && r.owner.done !== true && r.owner.declined !== true;
|
|
12
17
|
const yesOpen = y => y.approved !== true && y.declined !== true;
|
|
18
|
+
// Only an http(s) URL or a plain relative path (drafts/privacy.md) is linked. Anything else (javascript:, data:,
|
|
19
|
+
// //host, \\server) shows as text, so a click can't run a script in the report. Paths with spaces or non-ASCII letters
|
|
20
|
+
// are text too; widen the pattern if real drafts need them.
|
|
21
|
+
const draftHref = d => (typeof d === "string" ? safeHref(d) || (/^[\w.~-][\w.~%+/-]*$/.test(d) ? d : null) : null);
|
|
13
22
|
|
|
14
23
|
export function planStats(plan) {
|
|
15
24
|
const pages = Array.isArray(plan?.pages) ? plan.pages : [];
|
|
@@ -30,7 +39,11 @@ export function planStats(plan) {
|
|
|
30
39
|
};
|
|
31
40
|
}
|
|
32
41
|
|
|
33
|
-
|
|
42
|
+
/**
|
|
43
|
+
* @param {any} plan
|
|
44
|
+
* @param {{ esc: (s: any) => string, inl: (s: any) => string, num: (n: any) => string, traffic?: (url: string) => string | null }} helpers
|
|
45
|
+
*/
|
|
46
|
+
export function planHtml(plan, { esc, inl, num, traffic = () => null }) {
|
|
34
47
|
const pages = Array.isArray(plan?.pages) ? plan.pages : [];
|
|
35
48
|
const s = planStats(plan);
|
|
36
49
|
const chip = st => `<span class="pchip s-${esc(st)}">${esc(LABEL[st] || st)}</span>`;
|
|
@@ -40,40 +53,72 @@ export function planHtml(plan, { esc, inl, num }) {
|
|
|
40
53
|
<p class="plan-n"><span class="n">${s.progress}%</span>of the agent's work is done</p>
|
|
41
54
|
<div class="pbar" role="img" aria-label="Plan progress: ${s.progress}% of the agent's work is done"><i style="width:${s.progress}%"></i></div>
|
|
42
55
|
</div>
|
|
43
|
-
<ul class="plan-counts">${STATUSES.filter(st => s.byStatus[st])
|
|
56
|
+
<ul class="plan-counts">${STATUSES.filter(st => s.byStatus[st])
|
|
57
|
+
.map(st => `<li>${chip(st)}<b>${num(s.byStatus[st])}</b></li>`)
|
|
58
|
+
.join("")}${s.ownerOpen ? `<li><span class="own">Needs you</span><b>${num(s.ownerOpen)}</b></li>` : ""}</ul>
|
|
44
59
|
${plan.summary ? `<p class="plan-summary">${inl(plan.summary)}</p>` : ""}
|
|
45
|
-
${fixesLine(
|
|
60
|
+
${fixesLine(
|
|
61
|
+
plan,
|
|
62
|
+
n => num(n),
|
|
63
|
+
ids => ids.map(id => `<a href="#${esc(id)}">${esc(id)}</a>`).join(", "),
|
|
64
|
+
)}
|
|
46
65
|
</section>`;
|
|
47
|
-
if (!pages.length)
|
|
66
|
+
if (!pages.length)
|
|
67
|
+
return `<div class="plan">${head}<section class="panel empty-state"><h2>No pages in this plan yet</h2><p>Run /seo-setup to propose one.</p></section></div>`;
|
|
48
68
|
|
|
49
69
|
const yes = [
|
|
50
|
-
...(plan.yes || [])
|
|
51
|
-
|
|
70
|
+
...(plan.yes || [])
|
|
71
|
+
.filter(yesOpen)
|
|
72
|
+
.map(
|
|
73
|
+
y =>
|
|
74
|
+
`<li><b>${esc(y.id || "")}</b> ${inl(y.what)}${y.why ? `<span class="quiet"> · ${inl(y.why)}</span>` : ""}</li>`,
|
|
75
|
+
),
|
|
76
|
+
...pages
|
|
77
|
+
.filter(r => ownerOpen(r) && r.owner.needs === "yes")
|
|
78
|
+
.map(r => `<li><code>${esc(key(r))}</code> ${inl(r.owner.what || "")}</li>`),
|
|
52
79
|
];
|
|
53
|
-
const declined = [
|
|
54
|
-
...
|
|
55
|
-
|
|
80
|
+
const declined = [
|
|
81
|
+
...(plan.yes || []).filter(y => y.declined === true).map(y => `<b>${esc(y.id || "")}</b> ${inl(y.what)}`),
|
|
82
|
+
...pages
|
|
83
|
+
.filter(r => r.owner && r.owner.declined === true)
|
|
84
|
+
.map(r => `<code>${esc(key(r))}</code> ${inl(r.owner.what || "")}`),
|
|
85
|
+
];
|
|
86
|
+
const yesHtml =
|
|
87
|
+
yes.length || declined.length
|
|
88
|
+
? `<section class="panel plan-yes" aria-labelledby="h-yes"><h2 id="h-yes">Needs your yes</h2>
|
|
56
89
|
${yes.length ? `<p class="quiet">Each of these changes needs its own yes before the agent makes it. Approving the plan doesn't cover them.</p><ol>${yes.join("")}</ol>` : `<p class="quiet">Nothing is waiting for your yes.</p>`}
|
|
57
|
-
${declined.length ? `<p class="plan-declined"><span class="quiet">Declined by you, so the agent won't make these changes:</span> ${declined.join("; ")}</p>` : ""}</section>`
|
|
90
|
+
${declined.length ? `<p class="plan-declined"><span class="quiet">Declined by you, so the agent won't make these changes:</span> ${declined.join("; ")}</p>` : ""}</section>`
|
|
91
|
+
: "";
|
|
58
92
|
|
|
59
93
|
// Site structure from `parent`; rows whose parent isn't in the plan are roots.
|
|
60
94
|
const keys = new Set(pages.map(key));
|
|
61
95
|
const kids = new Map();
|
|
62
|
-
for (const r of pages) {
|
|
96
|
+
for (const r of pages) {
|
|
97
|
+
const p = keys.has(r.parent) && r.parent !== key(r) ? r.parent : "";
|
|
98
|
+
(kids.get(p) || kids.set(p, []).get(p)).push(r);
|
|
99
|
+
}
|
|
63
100
|
const seen = new Set();
|
|
64
101
|
const tree = parent => {
|
|
65
102
|
const list = (kids.get(parent) || []).filter(r => !seen.has(key(r)));
|
|
66
103
|
if (!list.length) return "";
|
|
67
|
-
return `<ul>${list
|
|
104
|
+
return `<ul>${list
|
|
105
|
+
.map(r => {
|
|
106
|
+
seen.add(key(r));
|
|
107
|
+
return `<li><code>${esc(key(r))}</code>${r.pattern ? ` <span class="pcount">×${num(r.count || 0)}</span>` : ""} ${chip(r.status)}${tree(key(r))}</li>`;
|
|
108
|
+
})
|
|
109
|
+
.join("")}</ul>`;
|
|
68
110
|
};
|
|
69
111
|
const treeHtml = `<section class="panel plan-tree" aria-labelledby="h-tree"><h2 id="h-tree">Site structure</h2>${tree("")}</section>`;
|
|
70
112
|
|
|
71
|
-
const field = (label, v) =>
|
|
113
|
+
const field = (label, v) =>
|
|
114
|
+
v == null || v === "" || (Array.isArray(v) && !v.length)
|
|
115
|
+
? ""
|
|
116
|
+
: `<dt>${label}</dt><dd>${Array.isArray(v) ? v.map(x => inl(x)).join(", ") : inl(v)}</dd>`;
|
|
72
117
|
const row = r => {
|
|
73
118
|
const o = r.owner;
|
|
74
119
|
return `<details class="prow" data-status="${esc(r.status)}">
|
|
75
120
|
<summary><span class="pu"><code>${esc(key(r))}</code>${r.pattern ? ` <span class="pcount">×${num(r.count || 0)}</span>` : ""}</span><span class="pt">${r.target ? esc(r.target) : `<span class="quiet">—</span>`}</span><span class="ptype">${esc(r.type || "")}</span><span class="pst">${chip(r.status)}${ownerOpen(r) ? `<span class="own">Needs you</span>` : ""}</span></summary>
|
|
76
|
-
<dl class="pd">${field("Intent", r.intent)}${field("Other targets", r.secondary)}${field(r.pattern ? "Title template" : "Title", r.title)}${field(r.pattern ? "Description template" : "Description", r.description)}${field(r.pattern ? "H1 template" : "H1", r.h1)}${field("Intro", r.intro)}${field("Schema", r.schema)}${field("Parent", r.parent)}${field("Links to", r.linksTo)}${r.from ? field("Moves from", `${r.from} → ${key(r)}`) : ""}${r.pattern && r.count ? field("Built", `${num(r.status === "built" || r.status === "exists" ? r.count : Number(r.built) || 0)} of ${num(r.count)}`) : ""}${(r.samples || []).length ? `<dt>Examples</dt><dd><ul class="psamples">${r.samples.map(x => `<li><code>${esc(x.url)}</code>${x.title ? ` ${esc(x.title)}` : ""}</li>`).join("")}</ul></dd>` : ""}${o ? `<dt>${o.done === true ? "Done by you" : "Needs you"}</dt><dd>${esc(NEEDS[o.needs] || o.needs || "")}: ${inl(o.what || "")}${o.draft ? ` · <a href="${esc(o.draft)}">Read the draft</a>` : ""}</dd>` : ""}${r.finding ? `<dt>Finding</dt><dd><a href="#${esc(r.finding)}">${esc(r.finding)}</a></dd>` : ""}</dl>
|
|
121
|
+
<dl class="pd">${field("Intent", r.intent)}${r.url ? field("Search traffic", traffic(r.url)) : ""}${field("Other targets", r.secondary)}${field(r.pattern ? "Title template" : "Title", r.title)}${field(r.pattern ? "Description template" : "Description", r.description)}${field(r.pattern ? "H1 template" : "H1", r.h1)}${field("Intro", r.intro)}${field("Schema", r.schema)}${field("Parent", r.parent)}${field("Links to", r.linksTo)}${r.from ? field("Moves from", `${r.from} → ${key(r)}`) : ""}${r.pattern && r.count ? field("Built", `${num(r.status === "built" || r.status === "exists" ? r.count : Number(r.built) || 0)} of ${num(r.count)}`) : ""}${(r.samples || []).length ? `<dt>Examples</dt><dd><ul class="psamples">${r.samples.map(x => `<li><code>${esc(x.url)}</code>${x.title ? ` ${esc(x.title)}` : ""}</li>`).join("")}</ul></dd>` : ""}${o ? `<dt>${o.done === true ? "Done by you" : "Needs you"}</dt><dd>${esc(NEEDS[o.needs] || o.needs || "")}: ${inl(o.what || "")}${o.draft ? (draftHref(o.draft) ? ` · <a href="${esc(draftHref(o.draft))}">Read the draft</a>` : ` · Draft: <code>${esc(o.draft)}</code>`) : ""}</dd>` : ""}${r.finding ? `<dt>Finding</dt><dd><a href="#${esc(r.finding)}">${esc(r.finding)}</a></dd>` : ""}</dl>
|
|
77
122
|
</details>`;
|
|
78
123
|
};
|
|
79
124
|
const present = STATUSES.filter(st => s.byStatus[st]);
|
|
@@ -128,35 +173,69 @@ function fixesLine(plan, count, list, html = true) {
|
|
|
128
173
|
const ids = Array.isArray(plan.alsoFixes) ? plan.alsoFixes : [];
|
|
129
174
|
if (!ids.length) return "";
|
|
130
175
|
const what = `${count(ids.length)} audit finding${ids.length === 1 ? "" : "s"} in code`;
|
|
131
|
-
const text =
|
|
176
|
+
const text =
|
|
177
|
+
plan.status === "built"
|
|
178
|
+
? `Setup also fixed ${what}: ${list(ids)}`
|
|
179
|
+
: `After the build, setup also fixes ${what}: ${list(ids)}`;
|
|
132
180
|
return html ? `<p class="plan-fixes">${text}</p>` : `${text}.`;
|
|
133
181
|
}
|
|
134
182
|
|
|
135
|
-
|
|
183
|
+
// Escaped like the rest of the report: mdSafe keeps `code` spans as inl does and makes URLs code spans; cellMd also
|
|
184
|
+
// escapes a table cell's pipes and line breaks.
|
|
185
|
+
const cell = v => cellMd(mdSafe(Array.isArray(v) ? v.join(", ") : v));
|
|
186
|
+
const item = (id, what) => `${id ? `${noteMd(id)}: ` : ""}${mdSafe(what)}`;
|
|
136
187
|
|
|
137
188
|
export function planMarkdown(plan) {
|
|
138
189
|
const pages = Array.isArray(plan?.pages) ? plan.pages : [];
|
|
139
190
|
const s = planStats(plan);
|
|
140
191
|
const L = ["## SEO plan", ""];
|
|
141
|
-
L.push(
|
|
142
|
-
|
|
192
|
+
L.push(
|
|
193
|
+
`Status: ${noteMd(PLAN_LABEL[plan.status] || plan.status || "?")}${plan.approvedOn ? ` (approved ${noteMd(plan.approvedOn)})` : ""} · Progress: ${s.progress}% · ${
|
|
194
|
+
STATUSES.filter(st => s.byStatus[st])
|
|
195
|
+
.map(st => `${s.byStatus[st]} ${LABEL[st].toLowerCase()}`)
|
|
196
|
+
.join(", ") || "no pages"
|
|
197
|
+
}${s.ownerOpen ? ` · ${s.ownerOpen} need you` : ""}`,
|
|
198
|
+
"",
|
|
199
|
+
);
|
|
200
|
+
if (plan.summary) L.push(mdSafe(plan.summary), "");
|
|
143
201
|
const fixes = fixesLine(plan, String, ids => ids.join(", "), false);
|
|
144
|
-
if (fixes) L.push(fixes, "");
|
|
145
|
-
const yes = [
|
|
146
|
-
...
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
202
|
+
if (fixes) L.push(mdSafe(fixes), "");
|
|
203
|
+
const yes = [
|
|
204
|
+
...(plan.yes || []).filter(yesOpen).map(y => `- ${item(y.id, y.what)}${y.why ? ` (${mdSafe(y.why)})` : ""}`),
|
|
205
|
+
...pages.filter(r => ownerOpen(r) && r.owner.needs === "yes").map(r => `- ${item(key(r), r.owner.what || "")}`),
|
|
206
|
+
];
|
|
207
|
+
if (yes.length)
|
|
208
|
+
L.push("### Needs your yes", "", "Each needs its own yes; approving the plan doesn't cover them.", "", ...yes, "");
|
|
209
|
+
for (const y of (plan.yes || []).filter(y => y.declined === true)) L.push(`Declined: ${item(y.id, y.what)}`);
|
|
210
|
+
for (const r of pages.filter(r => r.owner && r.owner.declined === true))
|
|
211
|
+
L.push(`Declined: ${item(key(r), r.owner.what || "")}`);
|
|
212
|
+
if ((plan.yes || []).some(y => y.declined === true) || pages.some(r => r.owner && r.owner.declined === true))
|
|
213
|
+
L.push("");
|
|
214
|
+
if (!pages.length) {
|
|
215
|
+
L.push("No pages in this plan yet.", "");
|
|
216
|
+
return L;
|
|
217
|
+
}
|
|
218
|
+
L.push(
|
|
219
|
+
"| Page | Type | Status | Target | Title | Description | H1 | Schema | Parent | Needs you |",
|
|
220
|
+
"| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |",
|
|
221
|
+
);
|
|
153
222
|
for (const r of pages) {
|
|
154
223
|
const page = r.pattern ? `${r.pattern} ×${r.count || 0}` : r.url;
|
|
155
|
-
const owner = ownerOpen(r)
|
|
156
|
-
|
|
224
|
+
const owner = ownerOpen(r)
|
|
225
|
+
? `${NEEDS[r.owner.needs] || r.owner.needs}: ${r.owner.what || ""}${r.owner.draft ? ` (draft: ${r.owner.draft})` : ""}`
|
|
226
|
+
: "";
|
|
227
|
+
L.push(
|
|
228
|
+
`| ${cell(page)} | ${cell(r.type)} | ${cell(LABEL[r.status] || r.status)} | ${cell(r.target)} | ${cell(r.title)} | ${cell(r.description)} | ${cell(r.h1)} | ${cell(r.schema)} | ${cell(r.parent)} | ${cell(owner)} |`,
|
|
229
|
+
);
|
|
157
230
|
}
|
|
158
231
|
L.push("");
|
|
159
232
|
const intros = pages.filter(r => r.intro);
|
|
160
|
-
if (intros.length)
|
|
233
|
+
if (intros.length)
|
|
234
|
+
L.push(
|
|
235
|
+
"Intros for new pages (approving the plan approves these words):",
|
|
236
|
+
"",
|
|
237
|
+
...intros.map(r => `- ${item(key(r), r.intro)}`),
|
|
238
|
+
"",
|
|
239
|
+
);
|
|
161
240
|
return L;
|
|
162
241
|
}
|