seo-supervisor 0.0.0-stage → 1.2.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.
Files changed (54) hide show
  1. package/.claude-plugin/marketplace.json +16 -0
  2. package/.claude-plugin/plugin.json +14 -0
  3. package/CHANGELOG.md +31 -0
  4. package/LICENSE +25 -0
  5. package/README.md +197 -2
  6. package/bin/agents.mjs +65 -0
  7. package/bin/prompt.mjs +76 -0
  8. package/bin/seo-supervisor.mjs +144 -0
  9. package/commands/seo-audit.md +7 -0
  10. package/commands/seo-fix.md +13 -0
  11. package/commands/seo-launch.md +7 -0
  12. package/commands/seo-review.md +7 -0
  13. package/commands/seo-setup.md +19 -0
  14. package/package.json +45 -4
  15. package/skills/seo-supervisor/SKILL.md +199 -0
  16. package/skills/seo-supervisor/examples/sample-audit.json +440 -0
  17. package/skills/seo-supervisor/examples/sample-report.html +654 -0
  18. package/skills/seo-supervisor/examples/sample-report.md +257 -0
  19. package/skills/seo-supervisor/examples/security-tools-profile.md +73 -0
  20. package/skills/seo-supervisor/examples/snippets.md +134 -0
  21. package/skills/seo-supervisor/frameworks/nextjs.md +98 -0
  22. package/skills/seo-supervisor/frameworks/rails.md +34 -0
  23. package/skills/seo-supervisor/frameworks/spa.md +14 -0
  24. package/skills/seo-supervisor/planning.md +145 -0
  25. package/skills/seo-supervisor/profile-template.md +55 -0
  26. package/skills/seo-supervisor/report-format.md +146 -0
  27. package/skills/seo-supervisor/rules/ai-search.md +40 -0
  28. package/skills/seo-supervisor/rules/content.md +60 -0
  29. package/skills/seo-supervisor/rules/crawl-index.md +65 -0
  30. package/skills/seo-supervisor/rules/internal-linking.md +61 -0
  31. package/skills/seo-supervisor/rules/launch-monitoring.md +48 -0
  32. package/skills/seo-supervisor/rules/media.md +30 -0
  33. package/skills/seo-supervisor/rules/metadata.md +39 -0
  34. package/skills/seo-supervisor/rules/performance.md +33 -0
  35. package/skills/seo-supervisor/rules/rendering.md +42 -0
  36. package/skills/seo-supervisor/rules/sitemaps-robots.md +37 -0
  37. package/skills/seo-supervisor/rules/structured-data.md +75 -0
  38. package/skills/seo-supervisor/rules/trust-security.md +25 -0
  39. package/skills/seo-supervisor/rules/urls.md +46 -0
  40. package/skills/seo-supervisor/scripts/content-scan.mjs +173 -0
  41. package/skills/seo-supervisor/scripts/fonts/OFL-BricolageGrotesque.txt +93 -0
  42. package/skills/seo-supervisor/scripts/fonts/OFL-Geist.txt +93 -0
  43. package/skills/seo-supervisor/scripts/fonts/OFL-GeistMono.txt +93 -0
  44. package/skills/seo-supervisor/scripts/fonts/bricolage-grotesque.woff2 +0 -0
  45. package/skills/seo-supervisor/scripts/fonts/geist-mono.woff2 +0 -0
  46. package/skills/seo-supervisor/scripts/fonts/geist.woff2 +0 -0
  47. package/skills/seo-supervisor/scripts/render-report.mjs +706 -0
  48. package/skills/seo-supervisor/scripts/report-plan.mjs +162 -0
  49. package/skills/seo-supervisor/scripts/seo-crawl.mjs +703 -0
  50. package/skills/seo-supervisor/site-types/content.md +22 -0
  51. package/skills/seo-supervisor/site-types/ecommerce.md +27 -0
  52. package/skills/seo-supervisor/site-types/local-business.md +28 -0
  53. package/skills/seo-supervisor/site-types/services.md +22 -0
  54. package/skills/seo-supervisor/site-types/tools.md +127 -0
@@ -0,0 +1,162 @@
1
+ // report-plan.mjs: the SEO plan that /seo-setup proposes and builds, as numbers, HTML and Markdown.
2
+ // Used by render-report.mjs when the audit JSON has a `plan`. The shape is in report-format.md.
3
+
4
+ const STATUSES = ["exists", "to-build", "built", "to-create"];
5
+ const LABEL = { exists: "Already right", "to-build": "To build", built: "Built", "to-create": "To create" };
6
+ const PLAN_LABEL = { proposed: "Proposed: waiting for your approval", approved: "Approved: being built", built: "Built" };
7
+ const NEEDS = { copy: "Copy", facts: "Facts", decision: "A decision", yes: "Your yes" };
8
+
9
+ const key = r => r.url || r.pattern || "";
10
+ const isDone = r => r.status === "exists" || r.status === "built";
11
+ const ownerOpen = r => r.owner && r.owner.done !== true && r.owner.declined !== true;
12
+ const yesOpen = y => y.approved !== true && y.declined !== true;
13
+
14
+ export function planStats(plan) {
15
+ const pages = Array.isArray(plan?.pages) ? plan.pages : [];
16
+ const byStatus = Object.fromEntries(STATUSES.map(s => [s, 0]));
17
+ let done = 0;
18
+ for (const r of pages) {
19
+ if (r.status in byStatus) byStatus[r.status]++;
20
+ if (isDone(r)) done += 1;
21
+ else if (r.pattern && r.count > 0) done += Math.min(1, Math.max(0, (Number(r.built) || 0) / r.count));
22
+ }
23
+ const yesItems = (plan?.yes || []).filter(yesOpen).length;
24
+ return {
25
+ rows: pages.length,
26
+ byStatus,
27
+ progress: pages.length ? Math.round((100 * done) / pages.length) : 0,
28
+ ownerOpen: pages.filter(ownerOpen).length,
29
+ yesOpen: yesItems + pages.filter(r => ownerOpen(r) && r.owner.needs === "yes").length,
30
+ };
31
+ }
32
+
33
+ export function planHtml(plan, { esc, inl, num }) {
34
+ const pages = Array.isArray(plan?.pages) ? plan.pages : [];
35
+ const s = planStats(plan);
36
+ const chip = st => `<span class="pchip s-${esc(st)}">${esc(LABEL[st] || st)}</span>`;
37
+ const head = `<section class="panel plan-sum" aria-labelledby="h-plan">
38
+ <div class="ph"><h2 id="h-plan">SEO plan</h2><span class="sub">${esc(PLAN_LABEL[plan.status] || plan.status || "")}${plan.approvedOn ? ` · approved ${esc(plan.approvedOn)}` : ""}</span></div>
39
+ <div class="plan-prog">
40
+ <p class="plan-n"><span class="n">${s.progress}%</span>of the agent's work is done</p>
41
+ <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
+ </div>
43
+ <ul class="plan-counts">${STATUSES.filter(st => s.byStatus[st]).map(st => `<li>${chip(st)}<b>${num(s.byStatus[st])}</b></li>`).join("")}${s.ownerOpen ? `<li><span class="own">Needs you</span><b>${num(s.ownerOpen)}</b></li>` : ""}</ul>
44
+ ${plan.summary ? `<p class="plan-summary">${inl(plan.summary)}</p>` : ""}
45
+ ${fixesLine(plan, n => num(n), ids => ids.map(id => `<a href="#${esc(id)}">${esc(id)}</a>`).join(", "))}
46
+ </section>`;
47
+ if (!pages.length) 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
+
49
+ const yes = [
50
+ ...(plan.yes || []).filter(yesOpen).map(y => `<li><b>${esc(y.id || "")}</b> ${inl(y.what)}${y.why ? `<span class="quiet"> · ${inl(y.why)}</span>` : ""}</li>`),
51
+ ...pages.filter(r => ownerOpen(r) && r.owner.needs === "yes").map(r => `<li><code>${esc(key(r))}</code> ${inl(r.owner.what || "")}</li>`),
52
+ ];
53
+ const declined = [...(plan.yes || []).filter(y => y.declined === true).map(y => `<b>${esc(y.id || "")}</b> ${inl(y.what)}`),
54
+ ...pages.filter(r => r.owner && r.owner.declined === true).map(r => `<code>${esc(key(r))}</code> ${inl(r.owner.what || "")}`)];
55
+ const yesHtml = yes.length || declined.length ? `<section class="panel plan-yes" aria-labelledby="h-yes"><h2 id="h-yes">Needs your yes</h2>
56
+ ${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>` : "";
58
+
59
+ // Site structure from `parent`; rows whose parent isn't in the plan are roots.
60
+ const keys = new Set(pages.map(key));
61
+ const kids = new Map();
62
+ for (const r of pages) { const p = keys.has(r.parent) && r.parent !== key(r) ? r.parent : ""; (kids.get(p) || kids.set(p, []).get(p)).push(r); }
63
+ const seen = new Set();
64
+ const tree = parent => {
65
+ const list = (kids.get(parent) || []).filter(r => !seen.has(key(r)));
66
+ if (!list.length) return "";
67
+ return `<ul>${list.map(r => { seen.add(key(r)); return `<li><code>${esc(key(r))}</code>${r.pattern ? ` <span class="pcount">×${num(r.count || 0)}</span>` : ""} ${chip(r.status)}${tree(key(r))}</li>`; }).join("")}</ul>`;
68
+ };
69
+ const treeHtml = `<section class="panel plan-tree" aria-labelledby="h-tree"><h2 id="h-tree">Site structure</h2>${tree("")}</section>`;
70
+
71
+ const field = (label, v) => (v == null || v === "" || (Array.isArray(v) && !v.length) ? "" : `<dt>${label}</dt><dd>${Array.isArray(v) ? v.map(x => inl(x)).join(", ") : inl(v)}</dd>`);
72
+ const row = r => {
73
+ const o = r.owner;
74
+ return `<details class="prow" data-status="${esc(r.status)}">
75
+ <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>
77
+ </details>`;
78
+ };
79
+ const present = STATUSES.filter(st => s.byStatus[st]);
80
+ const tableHtml = `<section class="panel plan-pages" aria-labelledby="h-pages">
81
+ <div class="ph"><h2 id="h-pages">Pages</h2><div class="seg" role="group" aria-label="Filter pages by status"><button type="button" class="segb" data-pstatus="all" aria-pressed="true">All</button>${present.map(st => `<button type="button" class="segb" data-pstatus="${st}" aria-pressed="false">${LABEL[st]}<span class="mono">${s.byStatus[st]}</span></button>`).join("")}</div></div>
82
+ <div class="prow-h" aria-hidden="true"><span>Page</span><span>Targets</span><span>Type</span><span>Status</span></div>
83
+ ${pages.map(row).join("")}
84
+ </section>`;
85
+ return `<div class="plan">${head}${yesHtml}${treeHtml}${tableHtml}</div>`;
86
+ }
87
+
88
+ export const PLAN_CSS = `
89
+ .plan{display:grid;gap:18px}
90
+ .plan-prog{display:grid;gap:8px;margin-top:14px}
91
+ .plan-n{color:var(--mute);font-size:13.5px}.plan-n .n{font:700 34px/1 var(--display);letter-spacing:-.02em;color:var(--ink);margin-right:8px}
92
+ .pbar{height:10px;border-radius:5px;background:var(--line2);overflow:hidden}.pbar i{display:block;height:100%;background:var(--pass)}
93
+ .plan-counts{list-style:none;margin:14px 0 0;padding:0;display:flex;flex-wrap:wrap;gap:8px 18px;font-size:13.5px}
94
+ .plan-counts li{display:inline-flex;align-items:center;gap:6px}.plan-counts b{font:600 13px var(--mono);color:var(--ink)}
95
+ .plan-summary{margin-top:14px;color:var(--ink2);max-width:78ch}
96
+ .plan-fixes{margin-top:10px;color:var(--ink2);font-size:14px}
97
+ .pchip{display:inline-block;font:600 12px/1.6 var(--sans);padding:0 9px;border-radius:999px;border:1px solid transparent;white-space:nowrap}
98
+ .pchip.s-exists{color:var(--mute);border-color:var(--line2)}
99
+ .pchip.s-to-build{color:var(--blue);background:var(--blue-soft)}
100
+ .pchip.s-built{color:var(--b5-ink);background:var(--ok-soft)}
101
+ .pchip.s-to-create{color:var(--ink2);border-color:var(--ink2)}
102
+ .plan-yes ol{margin:12px 0 0;padding-left:22px;display:grid;gap:8px}
103
+ .plan-declined{margin-top:12px;font-size:14px}
104
+ .plan-tree ul{list-style:none;margin:0;padding-left:20px;border-left:1px solid var(--line)}
105
+ .plan-tree h2+ul{padding-left:0;border-left:0;margin-top:10px}
106
+ .plan-tree li{padding:4px 0}.plan-tree li>ul{margin-top:4px}
107
+ .plan-tree code,.pu code,.psamples code{font:500 13px var(--mono);overflow-wrap:anywhere}
108
+ .pcount{font:500 12px var(--mono);color:var(--mute)}
109
+ .plan-pages .ph{flex-wrap:wrap;gap:10px}
110
+ .prow-h,.prow>summary{display:grid;grid-template-columns:minmax(0,2fr) minmax(0,2fr) minmax(0,1.3fr) minmax(150px,auto);gap:12px;align-items:center}
111
+ .prow-h span:last-child{text-align:right}
112
+ .prow-h{margin-top:12px;padding:8px 12px;font-size:12px;font-weight:600;color:var(--mute);border-bottom:1px solid var(--line)}
113
+ .prow{border-bottom:1px solid var(--line)}.prow[hidden]{display:none}
114
+ .prow>summary{padding:12px;cursor:pointer;list-style:none;border-radius:6px}
115
+ .prow>summary::-webkit-details-marker{display:none}
116
+ .prow>summary:hover{background:var(--bg)}
117
+ .prow>summary:focus-visible{outline:2px solid var(--blue);outline-offset:-2px}
118
+ .pu{min-width:0}.pt{min-width:0;color:var(--ink2);font-size:14px;overflow-wrap:anywhere}.ptype{color:var(--mute);font-size:13.5px}
119
+ .pst{display:flex;gap:6px;flex-wrap:wrap;justify-content:flex-end}
120
+ .pd{display:grid;grid-template-columns:150px minmax(0,1fr);gap:6px 16px;margin:0;padding:4px 12px 16px;font-size:14px}
121
+ .pd dt{color:var(--mute);font-weight:600;font-size:12.5px;padding-top:2px}.pd dd{margin:0;overflow-wrap:anywhere}
122
+ .psamples{list-style:none;margin:0;padding:0;display:grid;gap:4px}
123
+ @media (max-width:560px){.prow-h{display:none}.prow>summary{grid-template-columns:minmax(0,1fr);gap:4px}.pst{justify-content:flex-start}.pd{grid-template-columns:minmax(0,1fr);gap:2px}.pd dt{margin-top:8px}}
124
+ `;
125
+
126
+ // The audit findings setup fixes in code after approval (plan.alsoFixes), as one sentence.
127
+ function fixesLine(plan, count, list, html = true) {
128
+ const ids = Array.isArray(plan.alsoFixes) ? plan.alsoFixes : [];
129
+ if (!ids.length) return "";
130
+ const what = `${count(ids.length)} audit finding${ids.length === 1 ? "" : "s"} in code`;
131
+ const text = plan.status === "built" ? `Setup also fixed ${what}: ${list(ids)}` : `After the build, setup also fixes ${what}: ${list(ids)}`;
132
+ return html ? `<p class="plan-fixes">${text}</p>` : `${text}.`;
133
+ }
134
+
135
+ const cell = v => String(Array.isArray(v) ? v.join(", ") : v ?? "").replace(/\|/g, "\\|").replace(/\s*\n\s*/g, " ");
136
+
137
+ export function planMarkdown(plan) {
138
+ const pages = Array.isArray(plan?.pages) ? plan.pages : [];
139
+ const s = planStats(plan);
140
+ const L = ["## SEO plan", ""];
141
+ L.push(`Status: ${PLAN_LABEL[plan.status] || plan.status || "?"}${plan.approvedOn ? ` (approved ${plan.approvedOn})` : ""} · Progress: ${s.progress}% · ${STATUSES.filter(st => s.byStatus[st]).map(st => `${s.byStatus[st]} ${LABEL[st].toLowerCase()}`).join(", ") || "no pages"}${s.ownerOpen ? ` · ${s.ownerOpen} need you` : ""}`, "");
142
+ if (plan.summary) L.push(plan.summary, "");
143
+ const fixes = fixesLine(plan, String, ids => ids.join(", "), false);
144
+ if (fixes) L.push(fixes, "");
145
+ const yes = [...(plan.yes || []).filter(yesOpen).map(y => `- ${y.id ? `${y.id}: ` : ""}${y.what}${y.why ? ` (${y.why})` : ""}`),
146
+ ...pages.filter(r => ownerOpen(r) && r.owner.needs === "yes").map(r => `- ${key(r)}: ${r.owner.what || ""}`)];
147
+ if (yes.length) L.push("### Needs your yes", "", "Each needs its own yes; approving the plan doesn't cover them.", "", ...yes, "");
148
+ for (const y of (plan.yes || []).filter(y => y.declined === true)) L.push(`Declined: ${y.id ? `${y.id}: ` : ""}${y.what}`);
149
+ for (const r of pages.filter(r => r.owner && r.owner.declined === true)) L.push(`Declined: ${key(r)}: ${r.owner.what || ""}`);
150
+ if ((plan.yes || []).some(y => y.declined === true) || pages.some(r => r.owner && r.owner.declined === true)) L.push("");
151
+ if (!pages.length) { L.push("No pages in this plan yet.", ""); return L; }
152
+ L.push("| Page | Type | Status | Target | Title | Description | H1 | Schema | Parent | Needs you |", "| --- | --- | --- | --- | --- | --- | --- | --- | --- | --- |");
153
+ for (const r of pages) {
154
+ const page = r.pattern ? `${r.pattern} ×${r.count || 0}` : r.url;
155
+ const owner = ownerOpen(r) ? `${NEEDS[r.owner.needs] || r.owner.needs}: ${r.owner.what || ""}${r.owner.draft ? ` (draft: ${r.owner.draft})` : ""}` : "";
156
+ L.push(`| ${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)} |`);
157
+ }
158
+ L.push("");
159
+ const intros = pages.filter(r => r.intro);
160
+ if (intros.length) L.push("Intros for new pages (approving the plan approves these words):", "", ...intros.map(r => `- ${key(r)}: ${r.intro}`), "");
161
+ return L;
162
+ }