seo 0.17.4 → 0.17.5

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-lrKCsK_C.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";
@@ -42237,6 +42237,10 @@ const PARALLEL = [
42237
42237
  kind: "split",
42238
42238
  re: new RegExp(`${NEG}\\s+(?:${MINIMIZER}\\s+)?${BODY}[.!]\\s+${RESTATE}`, "gi")
42239
42239
  },
42240
+ {
42241
+ kind: "repeated",
42242
+ 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")
42243
+ },
42240
42244
  {
42241
42245
  kind: "joined",
42242
42246
  re: new RegExp(`${NEG}\\s+${BODY}${JOIN}${RESTATE}`, "gi")
@@ -42261,14 +42265,14 @@ function negativeParallelism(ctx) {
42261
42265
  const pronoun = /^(?:but |and |so )?(?:it|this|that|they)?$/i.test(subject.replace(/(?:'s|'re)$/, ""));
42262
42266
  const firstWords = words$2(block.norm.slice(sentence.start, end)).length;
42263
42267
  let level = "warning";
42264
- if (kind === "reveal" || kind === "about") level = "error";
42268
+ if (kind === "reveal" || kind === "about" || kind === "repeated") level = "error";
42265
42269
  else if (FRAMING.test(subject)) level = "error";
42266
42270
  else if (pronoun && (kind === "joined" || firstWords <= 10)) level = "error";
42267
42271
  const after = sentenceAt(sentences, end - 1);
42268
42272
  const restate = /(?:it|this|that|they)(?:'s|'re|\s+(?:is|are|was|were))$/i.exec(found[0]);
42269
42273
  const from = restate ? end - restate[0].length : end;
42270
42274
  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.";
42275
+ 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
42276
  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
42277
  if (level === "warning" && firstWords > 12 || concession) {
42274
42278
  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 +42572,7 @@ const RHYTHM_RULES = {
42568
42572
  id: "anaphora",
42569
42573
  family: "ai",
42570
42574
  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\"."
42575
+ 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
42576
  }
42573
42577
  };
42574
42578
  function heresAnnouncement(ctx) {
@@ -42711,9 +42715,50 @@ function staccato(ctx) {
42711
42715
  report();
42712
42716
  }
42713
42717
  }
42718
+ const ORDINALS = [
42719
+ "first",
42720
+ "second",
42721
+ "third",
42722
+ "fourth",
42723
+ "fifth",
42724
+ "sixth"
42725
+ ];
42726
+ const ORDINAL_OPENER = /^(?:And |But |So )?The (first|second|third|fourth|fifth|sixth) ([a-z][\w-]*)\b/i;
42727
+ function numberedProse(ctx, rule) {
42728
+ let open = null;
42729
+ const report = (item, endBlock, end) => {
42730
+ const count = item.next;
42731
+ 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");
42732
+ };
42733
+ let last = null;
42734
+ for (const block of ctx.blocks(RHYTHM_KINDS)) for (const sentence of ctx.sentences(block)) {
42735
+ const found = ORDINAL_OPENER.exec(sentence.text);
42736
+ if (!found) continue;
42737
+ const ordinal = ORDINALS.indexOf((found[1] ?? "").toLowerCase());
42738
+ const noun = (found[2] ?? "").toLowerCase();
42739
+ if (ordinal === 0) {
42740
+ if (open && open.next >= 3 && last) report(open, last.block, last.end);
42741
+ open = {
42742
+ block,
42743
+ start: sentence.start,
42744
+ next: 1,
42745
+ noun
42746
+ };
42747
+ last = null;
42748
+ } else if (open && ordinal === open.next && noun === open.noun) {
42749
+ open.next++;
42750
+ last = {
42751
+ block,
42752
+ end: sentence.end
42753
+ };
42754
+ }
42755
+ }
42756
+ if (open && open.next >= 3 && last) report(open, last.block, last.end);
42757
+ }
42714
42758
  function anaphora(ctx) {
42715
42759
  const rule = RHYTHM_RULES.anaphora;
42716
42760
  if (ctx.level(rule) === "off") return;
42761
+ numberedProse(ctx, rule);
42717
42762
  for (const block of ctx.blocks(RHYTHM_KINDS)) {
42718
42763
  const sentences = ctx.sentences(block);
42719
42764
  let i = 0;