seo 0.17.4 → 0.17.6

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/mcp.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { createRequire as __seoCreateRequire } from 'node:module'; const require = __seoCreateRequire(import.meta.url);
2
- import { i as __toESM, n as version, r as __commonJSMin, t as load } from "./esm-LhrUicGJ.js";
2
+ import { i as __toESM, n as version, r as __commonJSMin, t as load } from "./esm-D7vj4X6E.js";
3
3
  import { createHash, randomUUID, sign } from "node:crypto";
4
4
  import { ZodOptional, z } from "zod";
5
5
  import { arch, homedir, platform, tmpdir, totalmem } from "node:os";
@@ -22024,7 +22024,7 @@ const QUERY_FLAG_METHOD = {
22024
22024
  heuristic: true,
22025
22025
  ranking: "flagged_rows_after_unflagged_rows",
22026
22026
  flags: {
22027
- "likely-automated": "Snake_case identifier tokens, 20 or more words, or 8 or more ASCII words with no common function word. Such queries often come from scripts, prompts or tools, not people.",
22027
+ "likely-automated": "A numbered prefix such as \"12264: \", snake_case identifier tokens, 20 or more words, or 8 or more ASCII words with no common function word. Such queries often come from scripts, prompts or tools, not people.",
22028
22028
  "navigational-other": "Names a domain that is not the property's host, ends with a spoken domain suffix or a login/site/app word, starts with a large platform name and adds no topic word, or is one short ASCII word that is not a brand term. Such queries usually look for another site."
22029
22029
  }
22030
22030
  };
@@ -22088,8 +22088,10 @@ const FUNCTION_WORDS$1 = /* @__PURE__ */ new Set([
22088
22088
  "und"
22089
22089
  ]);
22090
22090
  const IDENTIFIER_TOKEN = /[\p{L}\p{N}]_[\p{L}\p{N}]/u;
22091
+ const NUMBERED_PREFIX = /^\d{4,}:\s+\S/u;
22091
22092
  /** Heuristic: the query looks machine-generated rather than typed by a person. */
22092
22093
  function isLikelyAutomatedQuery(query) {
22094
+ if (NUMBERED_PREFIX.test(query.trim())) return true;
22093
22095
  if (query.trim().split(/\s+/).filter(Boolean).some((token) => IDENTIFIER_TOKEN.test(token))) return true;
22094
22096
  const tokens = tokenize(query);
22095
22097
  if (tokens.length >= 20) return true;
@@ -33358,6 +33360,7 @@ function selectRows(input) {
33358
33360
  belowMinimumRows: 0,
33359
33361
  lowActionabilityRows: 0,
33360
33362
  brandRows: 0,
33363
+ sitelinkRows: 0,
33361
33364
  eligibleRows: 0,
33362
33365
  likelyAutomatedRows: 0,
33363
33366
  navigationalOtherRows: 0,
@@ -33378,16 +33381,23 @@ function selectRows(input) {
33378
33381
  brandTerms: input.brandTerms,
33379
33382
  includeBrand: input.includeBrand
33380
33383
  })) selection.brandRows++;
33381
- else {
33382
- rows.push(row);
33383
- selection.eligibleRows++;
33384
- }
33384
+ else rows.push(row);
33385
33385
  }
33386
+ const kept = withoutSitelinkRows(rows);
33387
+ selection.sitelinkRows = rows.length - kept.length;
33388
+ selection.eligibleRows = kept.length;
33386
33389
  return {
33387
- rows,
33390
+ rows: kept,
33388
33391
  selection
33389
33392
  };
33390
33393
  }
33394
+ const SITELINK_MINIMUM_PAGES = 3;
33395
+ function withoutSitelinkRows(rows) {
33396
+ const counts = /* @__PURE__ */ new Map();
33397
+ const key = (row) => `${row.keys[0]?.trim()}\n${row.impressions}\n${row.position}`;
33398
+ for (const row of rows) counts.set(key(row), (counts.get(key(row)) ?? 0) + 1);
33399
+ return rows.filter((row) => (counts.get(key(row)) ?? 0) < SITELINK_MINIMUM_PAGES);
33400
+ }
33391
33401
  function analyzeStrikingDistanceRows(input) {
33392
33402
  const collapsed = collapseFragmentPageRows(input.rows, { pageKeyIndex: 1 });
33393
33403
  const minImpressionsPolicy = resolveMinImpressionsPolicy({
@@ -33462,6 +33472,7 @@ function analyzeStrikingDistanceRows(input) {
33462
33472
  "minimum_impressions",
33463
33473
  "query_quality",
33464
33474
  "brand",
33475
+ "sitelinks",
33465
33476
  "query_flag_ranking"
33466
33477
  ],
33467
33478
  selection: selected.selection
@@ -33625,6 +33636,7 @@ async function strikingDistanceWith(input, dependencies) {
33625
33636
  `Brand queries: ${analysis.brand.filtering}. Brand terms used: ${analysis.brand.terms.join(", ") || "none"} (${analysis.brand.source === "provided" ? "provided" : "host forms, plus the bare domain stem only when Search Console shows the site is its navigational answer"}).`,
33626
33637
  analysis.selection.fragmentRows ? `${countLabel(analysis.selection.fragmentRows, "source row")} with a #fragment URL merged into the base URL.` : "",
33627
33638
  analysis.selection.flaggedRows ? `${countLabel(analysis.selection.flaggedRows, "eligible row")} carry heuristic query flags (likely-automated or navigational-other) and rank after unflagged rows.` : "",
33639
+ analysis.selection.sitelinkRows ? `${countLabel(analysis.selection.sitelinkRows, "row")} left out as sitelinks: three or more pages for the same query with the same impressions and average position, which is one result shown with its sitelinks. A heuristic.` : "",
33628
33640
  "Position is GSC average position for the property's topmost result per impression; it does not prove a URL ranked on a literal second results page every time.",
33629
33641
  "Search Analytics exposes retained query rows only. Anonymized and lower-value queries can be absent even when pagination is exhausted.",
33630
33642
  "Priority is a demand-and-position heuristic, not an estimated click lift or proof that a change will improve rankings.",
@@ -42237,6 +42249,10 @@ const PARALLEL = [
42237
42249
  kind: "split",
42238
42250
  re: new RegExp(`${NEG}\\s+(?:${MINIMIZER}\\s+)?${BODY}[.!]\\s+${RESTATE}`, "gi")
42239
42251
  },
42252
+ {
42253
+ kind: "repeated",
42254
+ re: new RegExp(`(?<=^|[.!?]\\s+)(The\\s+(?:[\\w-]+\\s+){0,2}?[\\w-]+)\\s+(?:is|are|was|were)(?:n't|\\s+not)\\s+${BODY}[.!]\\s+\\1\\s+(?:is|are|was|were)\\b`, "gi")
42255
+ },
42240
42256
  {
42241
42257
  kind: "joined",
42242
42258
  re: new RegExp(`${NEG}\\s+${BODY}${JOIN}${RESTATE}`, "gi")
@@ -42261,14 +42277,14 @@ function negativeParallelism(ctx) {
42261
42277
  const pronoun = /^(?:but |and |so )?(?:it|this|that|they)?$/i.test(subject.replace(/(?:'s|'re)$/, ""));
42262
42278
  const firstWords = words$2(block.norm.slice(sentence.start, end)).length;
42263
42279
  let level = "warning";
42264
- if (kind === "reveal" || kind === "about") level = "error";
42280
+ if (kind === "reveal" || kind === "about" || kind === "repeated") level = "error";
42265
42281
  else if (FRAMING.test(subject)) level = "error";
42266
42282
  else if (pronoun && (kind === "joined" || firstWords <= 10)) level = "error";
42267
42283
  const after = sentenceAt(sentences, end - 1);
42268
42284
  const restate = /(?:it|this|that|they)(?:'s|'re|\s+(?:is|are|was|were))$/i.exec(found[0]);
42269
42285
  const from = restate ? end - restate[0].length : end;
42270
42286
  const second = block.text.slice(from, after.end).trim();
42271
- const fix = second ? `Drop the "isn't" half and state the claim: "${second.charAt(0).toUpperCase()}${second.slice(1)}"` : "Drop the \"isn't\" half and state the claim once.";
42287
+ const fix = kind === "repeated" ? `Drop the "isn't" sentence and keep the claim: "${block.text.slice(after.start, after.end).trim()}"` : second ? `Drop the "isn't" half and state the claim: "${second.charAt(0).toUpperCase()}${second.slice(1)}"` : "Drop the \"isn't\" half and state the claim once.";
42272
42288
  const concession = (/,\s*but\s+(?:[\w']+\s*){1,3}$/i.test(found[0]) || /^(?:while|although|though|even though)\b/i.test(subject)) && kind !== "reveal";
42273
42289
  if (level === "warning" && firstWords > 12 || concession) {
42274
42290
  ctx.review("contrast", block, sentence.start, Math.max(after.end, end), "Does this \"isn't X ... it's Y\" correct something a reader would really think? If not, state the claim once.");
@@ -42568,7 +42584,7 @@ const RHYTHM_RULES = {
42568
42584
  id: "anaphora",
42569
42585
  family: "ai",
42570
42586
  level: "error",
42571
- description: "Short sentences in a row that start with the same word: two or more \"No ...\" sentences, or three or more starting \"It's\", \"They\", \"We\" or \"You\"."
42587
+ description: "Short sentences in a row that start with the same word: two or more \"No ...\" sentences, or three or more starting \"It's\", \"They\", \"We\" or \"You\". Also a list written as prose: \"The first wall ... The second wall ... The third wall ...\"."
42572
42588
  }
42573
42589
  };
42574
42590
  function heresAnnouncement(ctx) {
@@ -42711,9 +42727,50 @@ function staccato(ctx) {
42711
42727
  report();
42712
42728
  }
42713
42729
  }
42730
+ const ORDINALS = [
42731
+ "first",
42732
+ "second",
42733
+ "third",
42734
+ "fourth",
42735
+ "fifth",
42736
+ "sixth"
42737
+ ];
42738
+ const ORDINAL_OPENER = /^(?:And |But |So )?The (first|second|third|fourth|fifth|sixth) ([a-z][\w-]*)\b/i;
42739
+ function numberedProse(ctx, rule) {
42740
+ let open = null;
42741
+ const report = (item, endBlock, end) => {
42742
+ const count = item.next;
42743
+ ctx.hit(rule, item.block, item.start, item.block === endBlock ? end : item.block.text.length, `${count} sentences open "The first ${item.noun}", "The second ${item.noun}" and so on: a list written as prose.`, "Write it as a list, or as plain prose that names each point without numbering it.", "warning");
42744
+ };
42745
+ let last = null;
42746
+ for (const block of ctx.blocks(RHYTHM_KINDS)) for (const sentence of ctx.sentences(block)) {
42747
+ const found = ORDINAL_OPENER.exec(sentence.text);
42748
+ if (!found) continue;
42749
+ const ordinal = ORDINALS.indexOf((found[1] ?? "").toLowerCase());
42750
+ const noun = (found[2] ?? "").toLowerCase();
42751
+ if (ordinal === 0) {
42752
+ if (open && open.next >= 3 && last) report(open, last.block, last.end);
42753
+ open = {
42754
+ block,
42755
+ start: sentence.start,
42756
+ next: 1,
42757
+ noun
42758
+ };
42759
+ last = null;
42760
+ } else if (open && ordinal === open.next && noun === open.noun) {
42761
+ open.next++;
42762
+ last = {
42763
+ block,
42764
+ end: sentence.end
42765
+ };
42766
+ }
42767
+ }
42768
+ if (open && open.next >= 3 && last) report(open, last.block, last.end);
42769
+ }
42714
42770
  function anaphora(ctx) {
42715
42771
  const rule = RHYTHM_RULES.anaphora;
42716
42772
  if (ctx.level(rule) === "off") return;
42773
+ numberedProse(ctx, rule);
42717
42774
  for (const block of ctx.blocks(RHYTHM_KINDS)) {
42718
42775
  const sentences = ctx.sentences(block);
42719
42776
  let i = 0;