seo 0.17.2 → 0.17.4

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-BR8_7rhM.js";
2
+ import { i as __toESM, n as version, r as __commonJSMin, t as load } from "./esm-LhrUicGJ.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";
@@ -32,7 +32,7 @@ import { ZodFirstPartyTypeKind } from "zod/v3";
32
32
  import * as z4mini from "zod/v4-mini";
33
33
  import * as z$1 from "zod/v4";
34
34
  import process$1 from "node:process";
35
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
35
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-compat.js
36
36
  function isZ4Schema(s) {
37
37
  return !!s._zod;
38
38
  }
@@ -154,7 +154,7 @@ function getLiteralValue(schema) {
154
154
  const directValue = schema.value;
155
155
  if (directValue !== void 0) return directValue;
156
156
  }
157
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
157
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/types.js
158
158
  const LATEST_PROTOCOL_VERSION = "2025-11-25";
159
159
  const SUPPORTED_PROTOCOL_VERSIONS = [
160
160
  LATEST_PROTOCOL_VERSION,
@@ -2099,7 +2099,7 @@ var UrlElicitationRequiredError = class extends McpError {
2099
2099
  return this.data?.elicitations ?? [];
2100
2100
  }
2101
2101
  };
2102
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
2102
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/interfaces.js
2103
2103
  /**
2104
2104
  * Experimental task interfaces for MCP SDK.
2105
2105
  * WARNING: These APIs are experimental and may change without notice.
@@ -3156,7 +3156,7 @@ const zodToJsonSchema = (schema, options) => {
3156
3156
  if (refs.target === "openAi" && ("anyOf" in combined || "oneOf" in combined || "allOf" in combined || "type" in combined && Array.isArray(combined.type))) console.warn("Warning: OpenAI may not support schemas with unions as roots! Try wrapping it in an object property.");
3157
3157
  return combined;
3158
3158
  };
3159
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
3159
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/zod-json-schema-compat.js
3160
3160
  function mapMiniTarget(t) {
3161
3161
  if (!t) return "draft-7";
3162
3162
  if (t === "jsonSchema7" || t === "draft-7") return "draft-7";
@@ -10636,7 +10636,7 @@ var require_dist = /* @__PURE__ */ __commonJSMin(((exports, module) => {
10636
10636
  Object.defineProperty(exports, "__esModule", { value: true });
10637
10637
  exports.default = formatsPlugin;
10638
10638
  }));
10639
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
10639
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/validation/ajv-provider.js
10640
10640
  var import_ajv = /* @__PURE__ */ __toESM(require_ajv(), 1);
10641
10641
  var import_dist = /* @__PURE__ */ __toESM(require_dist(), 1);
10642
10642
  function createDefaultAjvInstance() {
@@ -10711,7 +10711,7 @@ var AjvJsonSchemaValidator = class {
10711
10711
  };
10712
10712
  }
10713
10713
  };
10714
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
10714
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/server.js
10715
10715
  /**
10716
10716
  * Experimental server task features for MCP SDK.
10717
10717
  * WARNING: These APIs are experimental and may change without notice.
@@ -10928,7 +10928,7 @@ var ExperimentalServerTasks = class {
10928
10928
  return this._server.cancelTask({ taskId }, options);
10929
10929
  }
10930
10930
  };
10931
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
10931
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/helpers.js
10932
10932
  /**
10933
10933
  * Experimental task capability assertion helpers.
10934
10934
  * WARNING: These APIs are experimental and may change without notice.
@@ -10972,7 +10972,7 @@ function assertClientRequestTaskCapability(requests, method, entityName) {
10972
10972
  case "elicitation/create": if (!requests.elicitation?.create) throw new Error(`${entityName} does not support task creation for elicitation/create (required for ${method})`);
10973
10973
  }
10974
10974
  }
10975
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
10975
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/index.js
10976
10976
  /**
10977
10977
  * An MCP server on top of a pluggable transport.
10978
10978
  *
@@ -11294,7 +11294,7 @@ var Server = class extends Protocol {
11294
11294
  return this.notification({ method: "notifications/prompts/list_changed" });
11295
11295
  }
11296
11296
  };
11297
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
11297
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/completable.js
11298
11298
  const COMPLETABLE_SYMBOL = Symbol.for("mcp.completable");
11299
11299
  /**
11300
11300
  * Checks if a schema is completable (has completion metadata).
@@ -11312,7 +11312,7 @@ var McpZodTypeKind;
11312
11312
  (function(McpZodTypeKind) {
11313
11313
  McpZodTypeKind["Completable"] = "McpCompletable";
11314
11314
  })(McpZodTypeKind || (McpZodTypeKind = {}));
11315
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
11315
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/shared/toolNameValidation.js
11316
11316
  /**
11317
11317
  * Tool name validation utilities according to SEP: Specify Format for Tool Names
11318
11318
  *
@@ -11382,7 +11382,7 @@ function validateAndWarnToolName(name) {
11382
11382
  issueToolNameWarning(name, result.warnings);
11383
11383
  return result.isValid;
11384
11384
  }
11385
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
11385
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/experimental/tasks/mcp-server.js
11386
11386
  /**
11387
11387
  * Experimental McpServer task features for MCP SDK.
11388
11388
  * WARNING: These APIs are experimental and may change without notice.
@@ -11412,7 +11412,7 @@ var ExperimentalMcpServerTasks = class {
11412
11412
  return this._mcpServer._createRegisteredTool(name, config.title, config.description, config.inputSchema, config.outputSchema, config.annotations, execution, config._meta, handler);
11413
11413
  }
11414
11414
  };
11415
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
11415
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/mcp.js
11416
11416
  function toolInputElementCount(value, max) {
11417
11417
  let count = 0;
11418
11418
  const stack = [value];
@@ -11454,6 +11454,9 @@ var McpServer = class {
11454
11454
  this._promptHandlersInitialized = false;
11455
11455
  this.server = new Server(serverInfo, options);
11456
11456
  this._maxToolInputElements = resolveMaxToolInputElements(options?.maxToolInputElements);
11457
+ if (options?.capabilities?.tools) this.setToolRequestHandlers();
11458
+ if (options?.capabilities?.resources) this.setResourceRequestHandlers();
11459
+ if (options?.capabilities?.prompts) this.setPromptRequestHandlers();
11457
11460
  }
11458
11461
  /**
11459
11462
  * Access experimental features.
@@ -12095,7 +12098,7 @@ function deserializeMessage(line) {
12095
12098
  function serializeMessage(message) {
12096
12099
  return JSON.stringify(message) + "\n";
12097
12100
  }
12098
- // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.1_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
12101
+ // node_modules/.pnpm/@modelcontextprotocol+sdk@1.32.2_zod@4.6.7/node_modules/@modelcontextprotocol/sdk/dist/esm/server/stdio.js
12099
12102
  /**
12100
12103
  * Server transport for stdio: this communicates with an MCP client by reading from the current process' stdin and writing to stdout.
12101
12104
  *
@@ -41029,6 +41032,17 @@ const PROSE = [
41029
41032
  "quote",
41030
41033
  "prop"
41031
41034
  ];
41035
+ const SENTENCE_KINDS = [
41036
+ "paragraph",
41037
+ "quote",
41038
+ "prop",
41039
+ "list"
41040
+ ];
41041
+ const RHYTHM_KINDS = [
41042
+ "paragraph",
41043
+ "quote",
41044
+ "prop"
41045
+ ];
41032
41046
  const ALL = [
41033
41047
  "paragraph",
41034
41048
  "list",
@@ -41282,7 +41296,7 @@ const PHRASE_RULES = [
41282
41296
  id: "significance-inflation",
41283
41297
  family: "ai",
41284
41298
  level: "error",
41285
- description: "Importance puffery: \"plays a crucial role\", \"marks a pivotal moment\", \"a testament to\".",
41299
+ description: "Importance puffery: \"plays a crucial role\", \"marks a pivotal moment\", \"a testament to\", \"the part that really matters\".",
41286
41300
  patterns: [
41287
41301
  /\bplays? an? (?:crucial|pivotal|vital|key|significant|critical|central|important|major) role\b/gi,
41288
41302
  /\b(?:marks?|marking|represents?|signals?) an? (?:pivotal|significant|important|major|defining|watershed|key) (?:moment|shift|turning point|milestone|step)\b/gi,
@@ -41301,8 +41315,11 @@ const PHRASE_RULES = [
41301
41315
  /\b(?:a|another) (?:major|key|significant|important|huge|big|proud) milestone\b/gi,
41302
41316
  /\bbuilding a better (?:future|world|tomorrow)\b/gi,
41303
41317
  /\bthe implications are (?:profound|significant|enormous|huge|far-reaching)\b/gi,
41304
- /\b(?:is|was) an (?:event|experience|attraction) in itself\b/gi
41318
+ /\b(?:is|was) an (?:event|experience|attraction) in itself\b/gi,
41319
+ /\b(?:answers|asks|addresses) the (?:actual|real) question\b/gi,
41320
+ /\bthe (?:one |only )?(?:part|bit|thing|piece|step|number|leg|detail|line|row) that (?:actually|really|truly) (?:matters|counts)\b/gi
41305
41321
  ],
41322
+ levelFor: (match) => /question|that (?:actually|really|truly)/i.test(match.text) ? "warning" : void 0,
41306
41323
  message: "It inflates importance without saying what changed.",
41307
41324
  fix: "Cut it, or name the concrete effect the text already states. Do not add a number that is not there."
41308
41325
  },
@@ -41310,9 +41327,9 @@ const PHRASE_RULES = [
41310
41327
  id: "participle-tail",
41311
41328
  family: "ai",
41312
41329
  level: "error",
41313
- description: "A sentence that ends on \", highlighting/underscoring/showcasing ...\" commentary.",
41330
+ description: "A sentence that ends on \", highlighting/underscoring/suggesting ...\" commentary.",
41314
41331
  kinds: PROSE,
41315
- patterns: [/,\s+(?:highlighting|underscoring|emphasi[sz]ing|showcasing|symboli[sz]ing|solidifying|cementing|signall?ing|reinforcing|fostering|cultivating|paving the way|setting the stage|demonstrating|illustrating|reflecting|ensuring|marking|contributing to)\b[^.!?]{0,120}[.!?]?/gi, /,\s+(?:giving (?:users|teams|customers|small teams|every \w+|people) (?:a|an|the|more)\b|freeing (?:you|them|up)\b|making it (?:easy|easier|simple|simpler|effortless|possible) (?:for|to)\b|creating an? (?:[\w-]+ )?(?:experience|panorama|atmosphere|sense)\b|delivering (?:real-time|accurate|predictions|reliable|a seamless|an intuitive)\b)[^.!?]{0,120}[.!?]?/gi],
41332
+ patterns: [/,\s+(?:highlighting|underscoring|emphasi[sz]ing|showcasing|symboli[sz]ing|solidifying|cementing|signall?ing|reinforcing|fostering|cultivating|paving the way|setting the stage|suggesting|demonstrating|illustrating|reflecting|ensuring|marking|contributing to)\b[^.!?]{0,120}[.!?]?/gi, /,\s+(?:giving (?:users|teams|customers|small teams|every \w+|people) (?:a|an|the|more)\b|freeing (?:you|them|up)\b|making it (?:easy|easier|simple|simpler|effortless|possible) (?:for|to)\b|creating an? (?:[\w-]+ )?(?:experience|panorama|atmosphere|sense)\b|delivering (?:real-time|accurate|predictions|reliable|a seamless|an intuitive)\b)[^.!?]{0,120}[.!?]?/gi],
41316
41333
  levelFor: (match) => /^,\s+(?:reflecting|ensuring|marking|contributing|demonstrating|illustrating|giving|freeing|making|creating|delivering)/i.test(match.text) ? "warning" : void 0,
41317
41334
  message: "The \", highlighting ...\" tail comments on the sentence instead of adding a fact.",
41318
41335
  fix: "End the sentence at the comma. If the tail holds a real fact, give it its own sentence with a subject and verb."
@@ -41425,6 +41442,7 @@ const PHRASE_RULES = [
41425
41442
  /\bpunch(?:es|ing)? (?:well )?above (?:its|their|his|her) weight\b/gi,
41426
41443
  /\b(?:thrilled|delighted) to (?:announce|share|introduce|unveil)\b/gi,
41427
41444
  /\bthe (?:whole|entire) point\b/gi,
41445
+ /\bthe only (?:[\w-]+ ){1,3}(?:I|we) (?:actually |really |still )?trust\b/gi,
41428
41446
  /,? which is (?:the (?:whole |real |entire )?point|exactly the point|kind of the point)\b/gi
41429
41447
  ],
41430
41448
  message: (match) => `"${match.text}" is a stock phrase that would fit any page.`,
@@ -41549,6 +41567,16 @@ const PHRASE_RULES = [
41549
41567
  message: "Two hedges where one, or none, would do.",
41550
41568
  fix: "Keep one qualifier, or state what the evidence shows."
41551
41569
  },
41570
+ {
41571
+ id: "false-range",
41572
+ family: "ai",
41573
+ level: "error",
41574
+ kinds: PROSE,
41575
+ description: "Stacked \"from X to Y\" ranges that sound broad but name no scale: \"from the Big Bang to the cosmic web, from stars to dark matter\".",
41576
+ patterns: [/\bfrom [^,.;:!?\n]{1,40} to [^,.;:!?\n]{1,40},\s+(?:and )?from [^,.;:!?\n]{1,40} to [^,.;:!?\n]{1,40}/gi],
41577
+ message: "Two \"from X to Y\" ranges in a row cover everything and say nothing.",
41578
+ fix: "Name the specific things the text covers, or cut the ranges."
41579
+ },
41552
41580
  {
41553
41581
  id: "colon-reveal",
41554
41582
  family: "ai",
@@ -41607,27 +41635,30 @@ const PHRASE_RULES = [
41607
41635
  family: "ai",
41608
41636
  level: "error",
41609
41637
  kinds: PROSE,
41610
- description: "A one-line denial used as a beat: \"It isn't.\" \"Not quite.\" \"But only part.\"",
41638
+ description: "A one-line denial used as a beat: \"It isn't.\" \"Not quite.\" \"The sixth is not.\" \"; the data didn't.\"",
41611
41639
  patterns: [
41612
41640
  /(?:^|[.!?:]\s+)(?:It|That|This|They|He|She|We) (?:isn't|wasn't|doesn't|didn't|won't|aren't|weren't|is not|was not|does not|did not)\.(?=\s|$)/g,
41613
41641
  /(?:^|[.!?:]\s+)(?:Not quite|Not even close|Not really|Not anymore|Not any more)\.(?=\s|$)/g,
41614
- /(?:^|[.!?:]\s+)(?:But|And) only (?:part|half|some|partly)\.(?=\s|$)/g
41642
+ /(?:^|[.!?:]\s+)(?:But|And) only (?:part|half|some|partly)\.(?=\s|$)/g,
41643
+ /(?:^|[.!?]\s+)The (?:[\w-]+ ){0,1}[\w-]+ (?:isn't|wasn't|doesn't|didn't|won't|aren't|weren't|hasn't|haven't|is not|was not|does not|did not|are not|were not|has not)\.(?=\s|$)/g,
41644
+ /;\s+(?:the|its|their|our|your) (?:[\w-]+ ){0,1}[\w-]+ (?:isn't|wasn't|doesn't|didn't|won't|aren't|weren't|hasn't|haven't|is not|was not|does not|did not|are not|were not|has not)\.(?=\s|$)/gi
41615
41645
  ],
41616
- message: "A two-word denial used for rhythm. It makes the reader wait.",
41617
- fix: "Join it to the sentence before, so the point is stated once."
41646
+ message: "A bare denial used for rhythm. It makes the reader wait.",
41647
+ fix: "Join it to the sentence before and name the thing, so the point is stated once."
41618
41648
  },
41619
41649
  {
41620
41650
  id: "strawman",
41621
41651
  family: "ai",
41622
41652
  level: "error",
41623
41653
  kinds: PROSE,
41624
- description: "An answer to an objection nobody raised: \"It isn't perfect.\", \"doesn't have to be stressful\", \"None of this means\", \"This isn't about\".",
41654
+ description: "An answer to an objection nobody raised: \"It isn't perfect.\", \"doesn't have to be stressful\", \"None of this means\", \"This isn't about\", \"is the obvious reading, and it is wrong\".",
41625
41655
  patterns: [
41626
41656
  /(?:^|[.!?:]\s+)(?:It|This|That|Nothing|No \w+)(?:'s| is|'s not| isn't| is not| wasn't| was not) (?:not )?perfect\.(?=\s|$)/g,
41627
41657
  /\b(?:doesn't|does not|don't|do not|needn't|need not) (?:have to |need to )?be (?:so )?(?:stressful|hard|complicated|difficult|painful|expensive|overwhelming|a chore|scary|intimidating|daunting|confusing|a headache)\b/gi,
41628
41658
  /(?:^|[.!?]\s)None of this means\b/g,
41629
41659
  /(?:^|[.!?]\s)(?:This|That|It)(?: isn't| is not|'s not) (?:just |really |only )?about\b/g,
41630
- /\b(?:isn't|is not|ain't) rocket science\b/gi
41660
+ /\b(?:isn't|is not|ain't) rocket science\b/gi,
41661
+ /\bis the (?:obvious|natural|easy|tempting|intuitive|common|usual|first) (?:reading|answer|interpretation|explanation|assumption|guess|conclusion|take)(?:,)? (?:and|but) (?:it(?:'s| is| was)|that(?:'s| is)) (?:wrong|mistaken|backwards|not (?:quite )?right)\b/gi
41631
41662
  ],
41632
41663
  message: "It answers a doubt the reader did not raise.",
41633
41664
  fix: "Cut it, or state the limit or the point plainly as a fact."
@@ -41888,7 +41919,7 @@ const SEO_RULES = {
41888
41919
  family: "copy",
41889
41920
  level: "error",
41890
41921
  presets: { docs: "warning" },
41891
- description: "Headings that label instead of telling: \"Overview\", \"Key takeaways\", \"Why it matters\", \"The ultimate guide\"."
41922
+ description: "Headings that label instead of telling, or tease: \"Overview\", \"Key takeaways\", \"Why it matters\", 'What \"exhausted\" means', \"X is dead\"."
41892
41923
  },
41893
41924
  emoji: {
41894
41925
  id: "emoji",
@@ -41960,6 +41991,7 @@ function lengths(ctx) {
41960
41991
  }
41961
41992
  }
41962
41993
  const HEADING_CLICHE = /^(?:a )?(?:deep dive|under the hood|demystifying\b|why (?:it|this|that) matters|a closer look|the ultimate guide|everything you need to know|mastering\b|unlocking\b|the power of\b|the future of\b|what you'll learn|key takeaways|final thoughts|wrapping up|conclusion|in conclusion|tl;?dr|overview|introduction|the road ahead|looking ahead|challenges and (?:legacy|opportunities|future)|future outlook|the bottom line|let's dive in|get started today|(?:the )?(?:challenge|solution|results?)$|at a glance$|first impressions$|a note of thanks$)/i;
41994
+ const HEADING_COY = /^(?:what "[^"]{1,40}" (?:really |actually )?means$|[^?]{1,60} is dead$|the one [\w-]+ (?:that|which|you|we)\b)/i;
41963
41995
  function headings(ctx) {
41964
41996
  const list = ctx.blocks(["heading"]);
41965
41997
  const h1s = list.filter((block) => block.level === 1);
@@ -41969,7 +42001,8 @@ function headings(ctx) {
41969
42001
  const level = block.level ?? 2;
41970
42002
  if (previous && level > previous + 1) ctx.hit(SEO_RULES.headingSkip, block, 0, block.text.length, `This H${level} follows an H${previous}.`, `Make it an H${previous + 1}, or add the missing level above it.`);
41971
42003
  previous = level;
41972
- if (HEADING_CLICHE.test(block.norm)) ctx.hit(SEO_RULES.headingCliche, block, 0, block.text.length, "A heading that labels the section instead of saying what is in it.", "Name what the section tells the reader, such as \"Check coverage before trusting the count\".");
42004
+ const coy = HEADING_COY.test(block.norm);
42005
+ if (coy || HEADING_CLICHE.test(block.norm)) ctx.hit(SEO_RULES.headingCliche, block, 0, block.text.length, coy ? "A heading that teases or announces a verdict instead of saying what is in the section." : "A heading that labels the section instead of saying what is in it.", "Name what the section tells the reader, such as \"Check coverage before trusting the count\".");
41973
42006
  }
41974
42007
  }
41975
42008
  const EMOJI = /^\p{Extended_Pictographic}/u;
@@ -42086,94 +42119,8 @@ function runSeoRules(ctx) {
42086
42119
  heroLength(ctx);
42087
42120
  reviews(ctx);
42088
42121
  }
42089
- // packages/core/dist/lint/rules-structure.js
42090
- const SENTENCE_KINDS = [
42091
- "paragraph",
42092
- "quote",
42093
- "prop",
42094
- "list"
42095
- ];
42096
- const RHYTHM_KINDS = [
42097
- "paragraph",
42098
- "quote",
42099
- "prop"
42100
- ];
42101
- const STRUCTURE_RULES = {
42102
- negativeParallelism: {
42103
- id: "negative-parallelism",
42104
- family: "ai",
42105
- level: "error",
42106
- description: "\"It isn't X, it's Y\" and \"isn't just X. It's Y.\" reframes."
42107
- },
42108
- contrastReframe: {
42109
- id: "contrast-reframe",
42110
- family: "ai",
42111
- level: "error",
42112
- presets: { docs: "warning" },
42113
- description: "A trailing \", not X\" or \"rather than X\" contrast added for drama: \"The fix is in the template, not in 600 posts.\""
42114
- },
42115
- heresAnnouncement: {
42116
- id: "heres-announcement",
42117
- family: "ai",
42118
- level: "error",
42119
- presets: { docs: "off" },
42120
- description: "A short \"Here's the X\" sentence that announces what comes next instead of saying it."
42121
- },
42122
- pithyFragment: {
42123
- id: "pithy-fragment",
42124
- family: "ai",
42125
- level: "error",
42126
- description: "Verbless slogan fragments: \"Same essay, two titles.\", \"Every month. No exceptions.\", \"$299 per month. That's it.\""
42127
- },
42128
- stockCloser: {
42129
- id: "stock-closer",
42130
- family: "ai",
42131
- level: "error",
42132
- description: "A stock kicker line: \"That's a real win.\" \"That is what makes this interesting.\""
42133
- },
42134
- negativeReframe: {
42135
- id: "negative-reframe",
42136
- family: "ai",
42137
- level: "warning",
42138
- description: "A short \"That's not how/what ...\" dismissal."
42139
- },
42140
- figurativeWorth: {
42141
- id: "figurative-worth",
42142
- family: "ai",
42143
- level: "error",
42144
- description: "A \"worth + -ing\" idiom that mixes its metaphor or points at the reader: \"a fight worth picking\", \"worth noting\"."
42145
- },
42146
- anaphora: {
42147
- id: "anaphora",
42148
- family: "ai",
42149
- level: "error",
42150
- 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\"."
42151
- },
42152
- vocabularyCluster: {
42153
- id: "ai-vocabulary-cluster",
42154
- family: "ai",
42155
- level: "warning",
42156
- description: "Two or more words such as crucial, pivotal, foster, landscape or journey in one paragraph."
42157
- },
42158
- triad: {
42159
- id: "triad",
42160
- family: "ai",
42161
- level: "warning",
42162
- presets: { docs: "off" },
42163
- description: "Formula triads: three parallel clauses (\"It is cheap, it is reversible, and it works\"), three items that open with the same word, three adjectives after \"is\", or three abstract nouns. Plain lists of three are left alone."
42164
- },
42165
- inventedLabel: {
42166
- id: "invented-label",
42167
- family: "ai",
42168
- level: "warning",
42169
- description: "Two or more coined labels such as \"the integration tax\" or \"the supervision paradox\"."
42170
- },
42171
- pseudoCleft: {
42172
- id: "pseudo-cleft",
42173
- family: "ai",
42174
- level: "warning",
42175
- description: "Repeated \"What makes this work is ...\" or \"The problem is that ...\" setups."
42176
- },
42122
+ // packages/core/dist/lint/rules-bold.js
42123
+ const BOLD_RULES = {
42177
42124
  boldEmphasis: {
42178
42125
  id: "bold-emphasis",
42179
42126
  family: "ai",
@@ -42189,7 +42136,87 @@ const STRUCTURE_RULES = {
42189
42136
  family: "ai",
42190
42137
  level: "warning",
42191
42138
  presets: { docs: "off" },
42192
- description: "Three or more list items in a row that open with a bold label."
42139
+ description: "Three or more list items in a row that open with a bold label, or one whose label the item then repeats: \"**Performance:** Performance has been improved.\""
42140
+ }
42141
+ };
42142
+ const RESTATED = /^\s*(?:[-*+]|\d{1,9}[.)])\s+(?:\*\*|__)(?:[^*_\n]{0,30}\s)?([a-z]{4})[^*_\s]*(?:\*\*|__)\s*[:.]?\s+\1/i;
42143
+ function boldLabels(ctx) {
42144
+ const rule = BOLD_RULES.boldLabels;
42145
+ if (ctx.level(rule) === "off") return;
42146
+ if (ctx.doc.format !== "md" && ctx.doc.format !== "mdx") return;
42147
+ const lists = ctx.blocks(["list"]);
42148
+ let run = [];
42149
+ const report = () => {
42150
+ if (run.length >= 3) {
42151
+ const first = run[0];
42152
+ ctx.hit(rule, first, 0, Math.min(first.text.length, 60), `${run.length} list items in a row open with a bold label.`, "Drop the bold labels and write each item as one plain sentence, or use a table if the items really are parallel.");
42153
+ }
42154
+ run = [];
42155
+ };
42156
+ let previous = null;
42157
+ for (const block of lists) {
42158
+ const offset = block.map[0] ?? 0;
42159
+ const line = ctx.doc.source.lastIndexOf("\n", offset) + 1;
42160
+ const raw = ctx.doc.source.slice(line, offset + 4);
42161
+ const bold = /^\s*(?:[-*+]|\d{1,9}[.)])\s+(?:\*\*|__)/.test(raw);
42162
+ if (bold && RESTATED.test(ctx.doc.source.slice(line, line + 200))) ctx.hit(rule, block, 0, Math.min(block.text.length, 60), "The item repeats its bold label.", "Drop the label and keep the sentence, or cut the repeat.");
42163
+ const adjacent = previous !== null && ctx.doc.blocks.indexOf(block) === ctx.doc.blocks.indexOf(previous) + 1;
42164
+ if (!bold || !adjacent) report();
42165
+ if (bold) run.push(block);
42166
+ previous = block;
42167
+ }
42168
+ report();
42169
+ }
42170
+ function boldEmphasis(ctx) {
42171
+ const rule = BOLD_RULES.boldEmphasis;
42172
+ if (ctx.level(rule) === "off") return;
42173
+ const markdown = ctx.doc.format === "md" || ctx.doc.format === "mdx";
42174
+ const re = markdown ? /(\*\*|__)(?=\S)[^*_\n]+?\1/g : /<(strong|b)\b[^>]*>[^<]{1,200}<\/\1>/gi;
42175
+ const prose = ctx.blocks([
42176
+ "paragraph",
42177
+ "list",
42178
+ "quote",
42179
+ "prop"
42180
+ ]);
42181
+ const spans = [];
42182
+ for (const found of ctx.doc.source.matchAll(re)) {
42183
+ const open = markdown ? 2 : found[0].indexOf(">") + 1;
42184
+ const from = (found.index ?? 0) + open;
42185
+ const to = (found.index ?? 0) + found[0].length - (markdown ? 2 : found[0].length - found[0].lastIndexOf("<"));
42186
+ for (const block of prose) {
42187
+ const first = block.map[0] ?? 0;
42188
+ const last = block.map[block.map.length - 1] ?? 0;
42189
+ if (from < first || from > last) continue;
42190
+ const start = block.map.indexOf(from);
42191
+ if (start <= 0 && block.kind === "list") break;
42192
+ if (start < 0) break;
42193
+ let end = start;
42194
+ while (end < block.map.length && (block.map[end] ?? 0) < to) end++;
42195
+ spans.push({
42196
+ block,
42197
+ start,
42198
+ end
42199
+ });
42200
+ break;
42201
+ }
42202
+ }
42203
+ if (spans.length < 3 || spans.length * 100 <= ctx.proseWords) return;
42204
+ for (const span of spans) ctx.hit(rule, span.block, span.start, span.end, `${spans.length} bold phrases in ${ctx.proseWords.toLocaleString("en-US")} words of prose. Bold this often stops meaning "important".`, "Remove the bold here. Keep bold, if any, for the one thing a skimming reader must not miss.");
42205
+ }
42206
+ // packages/core/dist/lint/rules-contrast.js
42207
+ const CONTRAST_RULES = {
42208
+ negativeParallelism: {
42209
+ id: "negative-parallelism",
42210
+ family: "ai",
42211
+ level: "error",
42212
+ description: "\"It isn't X, it's Y\" and \"isn't just X. It's Y.\" reframes."
42213
+ },
42214
+ contrastReframe: {
42215
+ id: "contrast-reframe",
42216
+ family: "ai",
42217
+ level: "error",
42218
+ presets: { docs: "warning" },
42219
+ description: "A trailing \", not X\" or \"rather than X\" contrast added for drama: \"The fix is in the template, not in 600 posts.\""
42193
42220
  }
42194
42221
  };
42195
42222
  const NEG = "(?:\\b(?:is|are|was|were)(?:n't|\\s+not)\\b|\\b(?:it|this|that|they|we|you)(?:'s|'re)\\s+not\\b)";
@@ -42217,7 +42244,7 @@ const PARALLEL = [
42217
42244
  ];
42218
42245
  const FRAMING = /^(?:the |this |that |our |my |your )?(?:real )?(?:problem|question|answer|issue|point|goal|story|bottleneck|fix|difference|trick|lesson|catch|risk|gap|win|work|job|key|opportunity|plan|idea|value)\b/i;
42219
42246
  function negativeParallelism(ctx) {
42220
- const rule = STRUCTURE_RULES.negativeParallelism;
42247
+ const rule = CONTRAST_RULES.negativeParallelism;
42221
42248
  for (const block of ctx.blocks(SENTENCE_KINDS)) {
42222
42249
  const sentences = ctx.sentences(block);
42223
42250
  const taken = [];
@@ -42281,7 +42308,7 @@ function gerund(word) {
42281
42308
  }
42282
42309
  const NOT_JUST = /,\s+not (?:just|merely|simply) [^,.;:!?]{1,50}[.!?]?$|\bnot (?:just|merely|simply) [^,.;:!?]{1,50},? but\b/i;
42283
42310
  function contrastReframe(ctx) {
42284
- const rule = STRUCTURE_RULES.contrastReframe;
42311
+ const rule = CONTRAST_RULES.contrastReframe;
42285
42312
  if (ctx.level(rule) === "off") return;
42286
42313
  for (const block of ctx.blocks([...SENTENCE_KINDS, "heading"])) for (const sentence of ctx.sentences(block)) {
42287
42314
  const text = sentence.text;
@@ -42325,8 +42352,227 @@ function contrastReframe(ctx) {
42325
42352
  }
42326
42353
  }
42327
42354
  }
42355
+ // packages/core/dist/lint/rules-counted.js
42356
+ const COUNTED_RULES = {
42357
+ vocabularyCluster: {
42358
+ id: "ai-vocabulary-cluster",
42359
+ family: "ai",
42360
+ level: "warning",
42361
+ description: "Two or more words such as crucial, pivotal, foster, landscape or journey in one paragraph."
42362
+ },
42363
+ triad: {
42364
+ id: "triad",
42365
+ family: "ai",
42366
+ level: "warning",
42367
+ presets: { docs: "off" },
42368
+ description: "Formula triads: three parallel clauses (\"It is cheap, it is reversible, and it works\"), three items that open with the same word, three adjectives after \"is\", or three abstract nouns. Plain lists of three are left alone."
42369
+ },
42370
+ inventedLabel: {
42371
+ id: "invented-label",
42372
+ family: "ai",
42373
+ level: "warning",
42374
+ description: "Two or more coined labels such as \"the integration tax\" or \"the supervision paradox\"."
42375
+ },
42376
+ colonDensity: {
42377
+ id: "colon-density",
42378
+ family: "ai",
42379
+ level: "warning",
42380
+ description: "Colons used mid-sentence as a pause or lead-in, three or more per 1,000 words. One is ordinary; a piece full of them reads as AI."
42381
+ },
42382
+ pseudoCleft: {
42383
+ id: "pseudo-cleft",
42384
+ family: "ai",
42385
+ level: "warning",
42386
+ description: "Repeated \"What makes this work is ...\" or \"The problem is that ...\" setups."
42387
+ }
42388
+ };
42389
+ const TIER2 = /\b(?:crucial(?:ly)?|pivotal|vibrant|comprehensive|enhanc(?:e|es|ed|ing|ement)|foster(?:s|ed|ing)?|harness(?:es|ed|ing)?|navigat(?:e|es|ed|ing)|streamlin(?:e|es|ed|ing)|empower(?:s|ed|ing|ment)?|elevat(?:e|es|ed|ing)|unleash(?:es|ed|ing)?|transformative|nuanced?|myriad|plethora|encompass(?:es|ed|ing)?|cultivat(?:e|es|ed|ing)|resonat(?:e|es|ed|ing)|cornerstone|poised|burgeoning|nascent|quintessential|overarching|actionable|impactful|landscape|ecosystem|journey|additionally|notably|moreover|furthermore|profound(?:ly)?|quietly|fundamentally|remarkabl[ey]|arguably|invaluable|deeply (?:rooted|committed|integrated|personal|meaningful))\b/gi;
42390
+ const TECHNICAL = /^(?:comprehensive|ecosystem|streamlin|navigat)/i;
42391
+ function vocabularyCluster(ctx) {
42392
+ const rule = COUNTED_RULES.vocabularyCluster;
42393
+ if (ctx.level(rule) === "off") return;
42394
+ for (const block of ctx.blocks([
42395
+ "paragraph",
42396
+ "list",
42397
+ "quote",
42398
+ "prop",
42399
+ "heading",
42400
+ "description",
42401
+ "title"
42402
+ ])) {
42403
+ const seen = /* @__PURE__ */ new Map();
42404
+ TIER2.lastIndex = 0;
42405
+ for (const found of block.norm.matchAll(TIER2)) {
42406
+ const word = found[0].toLowerCase();
42407
+ if (ctx.preset === "docs" && TECHNICAL.test(word)) continue;
42408
+ const stem = word.slice(0, 6);
42409
+ const start = found.index ?? 0;
42410
+ if (ctx.preset === "landing" || ctx.preset === "meta") {
42411
+ ctx.hit(rule, block, start, start + found[0].length, `"${found[0]}" is filler in short copy.`, "Use the plain word, or the concrete thing it stands for.");
42412
+ continue;
42413
+ }
42414
+ if (!seen.has(stem)) seen.set(stem, start);
42415
+ if (seen.size === 2 && !seen.has(`${stem}!`)) {
42416
+ seen.set(`${stem}!`, start);
42417
+ const listed = [...seen.keys()].filter((key) => !key.endsWith("!"));
42418
+ ctx.hit(rule, block, start, start + found[0].length, `This paragraph stacks words common in AI text (${listed.length} of them, ending with "${found[0]}").`, "Rewrite with plain words: \"important\" for crucial, \"help\" for foster, \"field\" for landscape, or cut them.");
42419
+ }
42420
+ }
42421
+ }
42422
+ }
42423
+ const SERIES = /\b[\w'$-]+(?: [\w'$-]+){0,5}(?:, [\w'$-]+(?: [\w'$-]+){0,5}){1,3},? (?:and|or) [\w'$-]+(?: [\w'$-]+){0,5}/g;
42424
+ const ABSTRACT_TRIAD = /\b[a-z]+(?:tion|sion|ity|ness|ment|ence|ance|ism), (?:and )?[a-z]+(?:tion|sion|ity|ness|ment|ence|ance|ism),? and [a-z]+(?:tion|sion|ity|ness|ment|ence|ance|ism)\b/gi;
42425
+ const ECHO = new Set("to our your their my his her its every each more less no it they we you".split(" "));
42426
+ const COPULA = /\b(?:is|are|was|were|'s|feels?|felt|looks?|stays?|remains?|seems?)\s+$/i;
42427
+ function formulaTriad(items, before) {
42428
+ const firsts = items.map((item) => words$2(item)[0]?.toLowerCase() ?? "");
42429
+ const echo = firsts[0] ?? "";
42430
+ if (ECHO.has(echo) && firsts.every((first) => first === echo)) return `Each item opens with "${echo}".`;
42431
+ if (items.every((item) => /^(?:the|their|our|your|its|it|they|we|you|he|she)\b/i.test(item) && words$2(item).length >= 3 && words$2(item).length <= 7 && !verbless(item))) return "Three parallel clauses in a row.";
42432
+ if (items.every((item) => /^[a-z]/.test(item) && words$2(item).length <= 2 && !PREPOSITIONS.has(words$2(item)[0] ?? "")) && COPULA.test(before)) return "A string of adjectives after \"is\".";
42433
+ if (items.every((item) => /^\w+ed\b/i.test(item) && words$2(item).length <= 3)) return "A string of past participles.";
42434
+ return null;
42435
+ }
42436
+ function triads(ctx) {
42437
+ const rule = COUNTED_RULES.triad;
42438
+ if (ctx.level(rule) === "off") return;
42439
+ for (const block of ctx.blocks([
42440
+ "paragraph",
42441
+ "quote",
42442
+ "prop",
42443
+ "list"
42444
+ ])) {
42445
+ const taken = [];
42446
+ ABSTRACT_TRIAD.lastIndex = 0;
42447
+ for (const match of block.norm.matchAll(ABSTRACT_TRIAD)) {
42448
+ const start = match.index ?? 0;
42449
+ taken.push([start, start + match[0].length]);
42450
+ ctx.hit(rule, block, start, start + match[0].length, "Three abstract nouns in a row sound weighty but say little.", "Keep the one that matters and give an example of it.");
42451
+ }
42452
+ for (const sentence of ctx.sentences(block)) {
42453
+ SERIES.lastIndex = 0;
42454
+ for (const match of sentence.text.matchAll(SERIES)) {
42455
+ let from = match.index ?? 0;
42456
+ const raw = match[0].split(/,\s*(?:(?:and|or)\s+)?|\s+(?:and|or)\s+(?=[^,]*$)/);
42457
+ if (raw.length < 3) continue;
42458
+ const items = [...raw];
42459
+ const head = raw[0] ?? "";
42460
+ const lead = /^.*\b(?:is|are|was|were|'s|feels?|looks?|stays?|remains?|seems?|of|for|to|with|by|from|on|in|like|including|as)\s+/i.exec(head);
42461
+ if (lead && words$2(head.slice(lead[0].length)).length) {
42462
+ items[0] = head.slice(lead[0].length);
42463
+ from += lead[0].length;
42464
+ }
42465
+ const end = sentence.start + (match.index ?? 0) + match[0].length;
42466
+ const before = block.norm.slice(sentence.start, sentence.start + from);
42467
+ const echo = words$2(raw[1] ?? "")[0]?.toLowerCase() ?? "";
42468
+ const inFirst = new RegExp(`\\b${echo}\\b(?!.*\\b${echo}\\b)`, "i").exec(head);
42469
+ if (ECHO.has(echo) && inFirst && inFirst.index > 0) {
42470
+ items[0] = head.slice(inFirst.index);
42471
+ from = (match.index ?? 0) + inFirst.index;
42472
+ }
42473
+ const plain = formulaTriad(raw, "");
42474
+ const why = plain ?? formulaTriad(items, before);
42475
+ if (!why) continue;
42476
+ if (plain) from = match.index ?? 0;
42477
+ const start = sentence.start + from;
42478
+ if (taken.some(([a, b]) => start < b && end > a)) continue;
42479
+ taken.push([start, end]);
42480
+ ctx.hit(rule, block, start, end, `A list of ${items.length} that reads as a formula. ${why}`, "Keep the items the reader needs. If all of them are needed, write them plainly or as two sentences; if one was added for rhythm, cut it.");
42481
+ }
42482
+ }
42483
+ }
42484
+ }
42485
+ function countedPatterns(ctx) {
42486
+ const labels = COUNTED_RULES.inventedLabel;
42487
+ const clefts = COUNTED_RULES.pseudoCleft;
42488
+ for (const [rule, re] of [[labels, /\bthe [a-z]+(?:-[a-z]+)? (?:paradox|trap|tax|creep|divide|vacuum|inversion|cliff|treadmill|illusion|fallacy|flywheel|moat)\b/gi], [clefts, /(?:^|[.!?]\s+)(?:What (?:makes|made|matters|changed|really|actually|you get|this means|I (?:like|love|learned|found))\b[^.!?]{0,40}\s+(?:is|was)\b|The (?:problem|difference|catch|key|trick|point|reason) is that\b)/g]]) {
42489
+ if (ctx.level(rule) === "off") continue;
42490
+ const found = [];
42491
+ for (const block of ctx.blocks(RHYTHM_KINDS)) {
42492
+ re.lastIndex = 0;
42493
+ for (const match of block.norm.matchAll(re)) {
42494
+ let start = match.index ?? 0;
42495
+ while (/[\s.!?]/.test(block.norm[start] ?? "")) start++;
42496
+ found.push({
42497
+ block,
42498
+ start,
42499
+ end: (match.index ?? 0) + match[0].length
42500
+ });
42501
+ }
42502
+ }
42503
+ if (found.length < 2) continue;
42504
+ for (const item of found) ctx.hit(rule, item.block, item.start, item.end, rule === labels ? `${found.length} coined labels in one piece. Each asks the reader to learn a term.` : `${found.length} "What X is" or "The problem is that" setups in one piece.`, rule === labels ? "Describe the thing in plain words instead of naming it." : "Start with the subject and say the thing directly.");
42505
+ }
42506
+ }
42507
+ function colonDensity(ctx) {
42508
+ const rule = COUNTED_RULES.colonDensity;
42509
+ if (ctx.level(rule) === "off") return;
42510
+ const found = [];
42511
+ for (const block of ctx.blocks(SENTENCE_KINDS)) {
42512
+ const sentences = ctx.sentences(block);
42513
+ for (const match of block.norm.matchAll(/:\s+(?=\S)/g)) {
42514
+ const at = match.index ?? 0;
42515
+ const after = block.norm.slice(at + match[0].length);
42516
+ if (/^["'(]/.test(after)) continue;
42517
+ const lead = block.norm.slice(sentenceAt(sentences, at).start, at);
42518
+ if (words$2(lead).length <= 4 && verbless(lead)) continue;
42519
+ const source = block.map[at] ?? -1;
42520
+ if (/^(?:\*\*|__)/.test(ctx.doc.source.slice(source + 1, source + 3)) || /(?:\*\*|__)$/.test(ctx.doc.source.slice(source - 2, source))) continue;
42521
+ if (block.links.some((link) => link.start <= at && link.end > at)) continue;
42522
+ if (insideQuotes(block.norm, at, at + 1)) continue;
42523
+ const clause = after.match(/^(?:[^.!?;]|[.!?](?=\S)){0,60}/)?.[0] ?? "";
42524
+ found.push({
42525
+ block,
42526
+ start: at,
42527
+ end: at + match[0].length + clause.trimEnd().length
42528
+ });
42529
+ }
42530
+ }
42531
+ if (found.length < 4 || found.length * 1e3 < 3 * ctx.proseWords) return;
42532
+ for (const item of found) ctx.hit(rule, item.block, item.start, item.end, `${found.length} mid-sentence colons in ${ctx.proseWords.toLocaleString("en-US")} words. A colon used as a pause in sentence after sentence is a common AI habit.`, "Use a full stop, or join the two parts with a plain word such as \"because\" or \"so\". Keep colons that introduce a list or a quotation.");
42533
+ }
42534
+ // packages/core/dist/lint/rules-rhythm.js
42535
+ const RHYTHM_RULES = {
42536
+ heresAnnouncement: {
42537
+ id: "heres-announcement",
42538
+ family: "ai",
42539
+ level: "error",
42540
+ presets: { docs: "off" },
42541
+ description: "A short \"Here's the X\" sentence that announces what comes next instead of saying it."
42542
+ },
42543
+ pithyFragment: {
42544
+ id: "pithy-fragment",
42545
+ family: "ai",
42546
+ level: "error",
42547
+ description: "Verbless slogan fragments: \"Same essay, two titles.\", \"Every month. No exceptions.\", \"$299 per month. That's it.\""
42548
+ },
42549
+ stockCloser: {
42550
+ id: "stock-closer",
42551
+ family: "ai",
42552
+ level: "error",
42553
+ description: "A stock kicker line: \"That's a real win.\" \"That is what makes this interesting.\" \"That's why X mattered.\""
42554
+ },
42555
+ negativeReframe: {
42556
+ id: "negative-reframe",
42557
+ family: "ai",
42558
+ level: "warning",
42559
+ description: "A short \"That's not how/what ...\" dismissal."
42560
+ },
42561
+ figurativeWorth: {
42562
+ id: "figurative-worth",
42563
+ family: "ai",
42564
+ level: "error",
42565
+ description: "A \"worth + -ing\" idiom that mixes its metaphor or points at the reader: \"a fight worth picking\", \"worth noting\"."
42566
+ },
42567
+ anaphora: {
42568
+ id: "anaphora",
42569
+ family: "ai",
42570
+ 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\"."
42572
+ }
42573
+ };
42328
42574
  function heresAnnouncement(ctx) {
42329
- const rule = STRUCTURE_RULES.heresAnnouncement;
42575
+ const rule = RHYTHM_RULES.heresAnnouncement;
42330
42576
  if (ctx.level(rule) === "off") return;
42331
42577
  for (const block of ctx.blocks([
42332
42578
  "paragraph",
@@ -42381,7 +42627,7 @@ function fragmentRuns(ctx, rule) {
42381
42627
  }
42382
42628
  }
42383
42629
  function pithyFragment(ctx) {
42384
- const rule = STRUCTURE_RULES.pithyFragment;
42630
+ const rule = RHYTHM_RULES.pithyFragment;
42385
42631
  if (ctx.level(rule) === "off") return;
42386
42632
  fragmentRuns(ctx, rule);
42387
42633
  for (const block of ctx.blocks(RHYTHM_KINDS)) for (const sentence of ctx.sentences(block)) {
@@ -42404,11 +42650,12 @@ const CLOSERS = [
42404
42650
  /^(?:and |but |so )?(?:that|this)(?:'s| is| was) (?:exactly )?what makes [^.]{1,60}(?:interesting|special|different|powerful|unique|useful|valuable|effective|work|works|matter|compelling|worth \w+)\.$/i,
42405
42651
  /^(?:and |but |so )?(?:that|this)(?:'s| is) (?:why|where|how) (?:it|this|that) (?:matters|counts|works)\.$/i,
42406
42652
  /^(?:and |but )?that distinction matters\.$/i,
42653
+ /^(?:and |but |so )?(?:that|this)(?:'s| is| was) (?:why|what|how) [^.]{1,80} (?:mattered|made (?:all )?the difference|paid off)\.$/i,
42407
42654
  /^(?:and |but )?(?:that|this)(?:'s| is) (?:huge|everything|the whole thing|what matters|all that matters)\.$/i
42408
42655
  ];
42409
42656
  function stockCloser(ctx) {
42410
- const rule = STRUCTURE_RULES.stockCloser;
42411
- const reframe = STRUCTURE_RULES.negativeReframe;
42657
+ const rule = RHYTHM_RULES.stockCloser;
42658
+ const reframe = RHYTHM_RULES.negativeReframe;
42412
42659
  for (const block of ctx.blocks(RHYTHM_KINDS)) for (const sentence of ctx.sentences(block)) {
42413
42660
  const text = sentence.text;
42414
42661
  if (CLOSERS.some((re) => re.test(text))) {
@@ -42420,7 +42667,7 @@ function stockCloser(ctx) {
42420
42667
  }
42421
42668
  const FIGURATIVE_NOUNS = "fights?|battles?|hills?|wars?|bets?|gambles?|races?|risks?|horses?|roads?|bridges?|doors?|games?|ships?|cards?";
42422
42669
  function figurativeWorth(ctx) {
42423
- const rule = STRUCTURE_RULES.figurativeWorth;
42670
+ const rule = RHYTHM_RULES.figurativeWorth;
42424
42671
  const strong = new RegExp(`\\b(?:${FIGURATIVE_NOUNS}) worth \\w+ing\\b`, "gi");
42425
42672
  const reader = /\bworth (?:noting|mentioning|knowing|highlighting|calling out|pointing out|flagging|a (?:closer |second )?look)\b/gi;
42426
42673
  const any = /\b(\w+) worth (\w+ing)\b/gi;
@@ -42465,7 +42712,7 @@ function staccato(ctx) {
42465
42712
  }
42466
42713
  }
42467
42714
  function anaphora(ctx) {
42468
- const rule = STRUCTURE_RULES.anaphora;
42715
+ const rule = RHYTHM_RULES.anaphora;
42469
42716
  if (ctx.level(rule) === "off") return;
42470
42717
  for (const block of ctx.blocks(RHYTHM_KINDS)) {
42471
42718
  const sentences = ctx.sentences(block);
@@ -42494,186 +42741,24 @@ function anaphora(ctx) {
42494
42741
  }
42495
42742
  }
42496
42743
  }
42497
- const TIER2 = /\b(?:crucial(?:ly)?|pivotal|vibrant|comprehensive|enhanc(?:e|es|ed|ing|ement)|foster(?:s|ed|ing)?|harness(?:es|ed|ing)?|navigat(?:e|es|ed|ing)|streamlin(?:e|es|ed|ing)|empower(?:s|ed|ing|ment)?|elevat(?:e|es|ed|ing)|unleash(?:es|ed|ing)?|transformative|nuanced?|myriad|plethora|encompass(?:es|ed|ing)?|cultivat(?:e|es|ed|ing)|resonat(?:e|es|ed|ing)|cornerstone|poised|burgeoning|nascent|quintessential|overarching|actionable|impactful|landscape|ecosystem|journey|additionally|notably|moreover|furthermore|profound(?:ly)?|quietly|fundamentally|remarkabl[ey]|arguably|invaluable|deeply (?:rooted|committed|integrated|personal|meaningful))\b/gi;
42498
- const TECHNICAL = /^(?:comprehensive|ecosystem|streamlin|navigat)/i;
42499
- function vocabularyCluster(ctx) {
42500
- const rule = STRUCTURE_RULES.vocabularyCluster;
42501
- if (ctx.level(rule) === "off") return;
42502
- for (const block of ctx.blocks([
42503
- "paragraph",
42504
- "list",
42505
- "quote",
42506
- "prop",
42507
- "heading",
42508
- "description",
42509
- "title"
42510
- ])) {
42511
- const seen = /* @__PURE__ */ new Map();
42512
- TIER2.lastIndex = 0;
42513
- for (const found of block.norm.matchAll(TIER2)) {
42514
- const word = found[0].toLowerCase();
42515
- if (ctx.preset === "docs" && TECHNICAL.test(word)) continue;
42516
- const stem = word.slice(0, 6);
42517
- const start = found.index ?? 0;
42518
- if (ctx.preset === "landing" || ctx.preset === "meta") {
42519
- ctx.hit(rule, block, start, start + found[0].length, `"${found[0]}" is filler in short copy.`, "Use the plain word, or the concrete thing it stands for.");
42520
- continue;
42521
- }
42522
- if (!seen.has(stem)) seen.set(stem, start);
42523
- if (seen.size === 2 && !seen.has(`${stem}!`)) {
42524
- seen.set(`${stem}!`, start);
42525
- const listed = [...seen.keys()].filter((key) => !key.endsWith("!"));
42526
- ctx.hit(rule, block, start, start + found[0].length, `This paragraph stacks words common in AI text (${listed.length} of them, ending with "${found[0]}").`, "Rewrite with plain words: \"important\" for crucial, \"help\" for foster, \"field\" for landscape, or cut them.");
42527
- }
42528
- }
42529
- }
42530
- }
42531
- const SERIES = /\b[\w'$-]+(?: [\w'$-]+){0,5}(?:, [\w'$-]+(?: [\w'$-]+){0,5}){1,3},? (?:and|or) [\w'$-]+(?: [\w'$-]+){0,5}/g;
42532
- const ABSTRACT_TRIAD = /\b[a-z]+(?:tion|sion|ity|ness|ment|ence|ance|ism), (?:and )?[a-z]+(?:tion|sion|ity|ness|ment|ence|ance|ism),? and [a-z]+(?:tion|sion|ity|ness|ment|ence|ance|ism)\b/gi;
42533
- const ECHO = new Set("to our your their my his her its every each more less no it they we you".split(" "));
42534
- const COPULA = /\b(?:is|are|was|were|'s|feels?|felt|looks?|stays?|remains?|seems?)\s+$/i;
42535
- function formulaTriad(items, before) {
42536
- const firsts = items.map((item) => words$2(item)[0]?.toLowerCase() ?? "");
42537
- const echo = firsts[0] ?? "";
42538
- if (ECHO.has(echo) && firsts.every((first) => first === echo)) return `Each item opens with "${echo}".`;
42539
- if (items.every((item) => /^(?:the|their|our|your|its|it|they|we|you|he|she)\b/i.test(item) && words$2(item).length >= 3 && words$2(item).length <= 7 && !verbless(item))) return "Three parallel clauses in a row.";
42540
- if (items.every((item) => /^[a-z]/.test(item) && words$2(item).length <= 2 && !PREPOSITIONS.has(words$2(item)[0] ?? "")) && COPULA.test(before)) return "A string of adjectives after \"is\".";
42541
- if (items.every((item) => /^\w+ed\b/i.test(item) && words$2(item).length <= 3)) return "A string of past participles.";
42542
- return null;
42543
- }
42544
- function triads(ctx) {
42545
- const rule = STRUCTURE_RULES.triad;
42546
- if (ctx.level(rule) === "off") return;
42547
- for (const block of ctx.blocks([
42548
- "paragraph",
42549
- "quote",
42550
- "prop",
42551
- "list"
42552
- ])) {
42553
- const taken = [];
42554
- ABSTRACT_TRIAD.lastIndex = 0;
42555
- for (const match of block.norm.matchAll(ABSTRACT_TRIAD)) {
42556
- const start = match.index ?? 0;
42557
- taken.push([start, start + match[0].length]);
42558
- ctx.hit(rule, block, start, start + match[0].length, "Three abstract nouns in a row sound weighty but say little.", "Keep the one that matters and give an example of it.");
42559
- }
42560
- for (const sentence of ctx.sentences(block)) {
42561
- SERIES.lastIndex = 0;
42562
- for (const match of sentence.text.matchAll(SERIES)) {
42563
- let from = match.index ?? 0;
42564
- const raw = match[0].split(/,\s*(?:(?:and|or)\s+)?|\s+(?:and|or)\s+(?=[^,]*$)/);
42565
- if (raw.length < 3) continue;
42566
- const items = [...raw];
42567
- const head = raw[0] ?? "";
42568
- const lead = /^.*\b(?:is|are|was|were|'s|feels?|looks?|stays?|remains?|seems?|of|for|to|with|by|from|on|in|like|including|as)\s+/i.exec(head);
42569
- if (lead && words$2(head.slice(lead[0].length)).length) {
42570
- items[0] = head.slice(lead[0].length);
42571
- from += lead[0].length;
42572
- }
42573
- const end = sentence.start + (match.index ?? 0) + match[0].length;
42574
- const before = block.norm.slice(sentence.start, sentence.start + from);
42575
- const echo = words$2(raw[1] ?? "")[0]?.toLowerCase() ?? "";
42576
- const inFirst = new RegExp(`\\b${echo}\\b(?!.*\\b${echo}\\b)`, "i").exec(head);
42577
- if (ECHO.has(echo) && inFirst && inFirst.index > 0) {
42578
- items[0] = head.slice(inFirst.index);
42579
- from = (match.index ?? 0) + inFirst.index;
42580
- }
42581
- const plain = formulaTriad(raw, "");
42582
- const why = plain ?? formulaTriad(items, before);
42583
- if (!why) continue;
42584
- if (plain) from = match.index ?? 0;
42585
- const start = sentence.start + from;
42586
- if (taken.some(([a, b]) => start < b && end > a)) continue;
42587
- taken.push([start, end]);
42588
- ctx.hit(rule, block, start, end, `A list of ${items.length} that reads as a formula. ${why}`, "Keep the items the reader needs. If all of them are needed, write them plainly or as two sentences; if one was added for rhythm, cut it.");
42589
- }
42590
- }
42591
- }
42592
- }
42593
- function countedPatterns(ctx) {
42594
- const labels = STRUCTURE_RULES.inventedLabel;
42595
- const clefts = STRUCTURE_RULES.pseudoCleft;
42596
- for (const [rule, re] of [[labels, /\bthe [a-z]+(?:-[a-z]+)? (?:paradox|trap|tax|creep|divide|vacuum|inversion|cliff|treadmill|illusion|fallacy|flywheel|moat)\b/gi], [clefts, /(?:^|[.!?]\s+)(?:What (?:makes|made|matters|changed|really|actually|you get|this means|I (?:like|love|learned|found))\b[^.!?]{0,40}\s+(?:is|was)\b|The (?:problem|difference|catch|key|trick|point|reason) is that\b)/g]]) {
42597
- if (ctx.level(rule) === "off") continue;
42598
- const found = [];
42599
- for (const block of ctx.blocks(RHYTHM_KINDS)) {
42600
- re.lastIndex = 0;
42601
- for (const match of block.norm.matchAll(re)) {
42602
- let start = match.index ?? 0;
42603
- while (/[\s.!?]/.test(block.norm[start] ?? "")) start++;
42604
- found.push({
42605
- block,
42606
- start,
42607
- end: (match.index ?? 0) + match[0].length
42608
- });
42609
- }
42610
- }
42611
- if (found.length < 2) continue;
42612
- for (const item of found) ctx.hit(rule, item.block, item.start, item.end, rule === labels ? `${found.length} coined labels in one piece. Each asks the reader to learn a term.` : `${found.length} "What X is" or "The problem is that" setups in one piece.`, rule === labels ? "Describe the thing in plain words instead of naming it." : "Start with the subject and say the thing directly.");
42613
- }
42614
- }
42615
- function boldLabels(ctx) {
42616
- const rule = STRUCTURE_RULES.boldLabels;
42617
- if (ctx.level(rule) === "off") return;
42618
- if (ctx.doc.format !== "md" && ctx.doc.format !== "mdx") return;
42619
- const lists = ctx.blocks(["list"]);
42620
- let run = [];
42621
- const report = () => {
42622
- if (run.length >= 3) {
42623
- const first = run[0];
42624
- ctx.hit(rule, first, 0, Math.min(first.text.length, 60), `${run.length} list items in a row open with a bold label.`, "Drop the bold labels and write each item as one plain sentence, or use a table if the items really are parallel.");
42625
- }
42626
- run = [];
42627
- };
42628
- let previous = null;
42629
- for (const block of lists) {
42630
- const offset = block.map[0] ?? 0;
42631
- const line = ctx.doc.source.lastIndexOf("\n", offset) + 1;
42632
- const raw = ctx.doc.source.slice(line, offset + 4);
42633
- const bold = /^\s*(?:[-*+]|\d{1,9}[.)])\s+(?:\*\*|__)/.test(raw);
42634
- const adjacent = previous !== null && ctx.doc.blocks.indexOf(block) === ctx.doc.blocks.indexOf(previous) + 1;
42635
- if (!bold || !adjacent) report();
42636
- if (bold) run.push(block);
42637
- previous = block;
42638
- }
42639
- report();
42640
- }
42641
- function boldEmphasis(ctx) {
42642
- const rule = STRUCTURE_RULES.boldEmphasis;
42643
- if (ctx.level(rule) === "off") return;
42644
- const markdown = ctx.doc.format === "md" || ctx.doc.format === "mdx";
42645
- const re = markdown ? /(\*\*|__)(?=\S)[^*_\n]+?\1/g : /<(strong|b)\b[^>]*>[^<]{1,200}<\/\1>/gi;
42646
- const prose = ctx.blocks([
42647
- "paragraph",
42648
- "list",
42649
- "quote",
42650
- "prop"
42651
- ]);
42652
- const spans = [];
42653
- for (const found of ctx.doc.source.matchAll(re)) {
42654
- const open = markdown ? 2 : found[0].indexOf(">") + 1;
42655
- const from = (found.index ?? 0) + open;
42656
- const to = (found.index ?? 0) + found[0].length - (markdown ? 2 : found[0].length - found[0].lastIndexOf("<"));
42657
- for (const block of prose) {
42658
- const first = block.map[0] ?? 0;
42659
- const last = block.map[block.map.length - 1] ?? 0;
42660
- if (from < first || from > last) continue;
42661
- const start = block.map.indexOf(from);
42662
- if (start <= 0 && block.kind === "list") break;
42663
- if (start < 0) break;
42664
- let end = start;
42665
- while (end < block.map.length && (block.map[end] ?? 0) < to) end++;
42666
- spans.push({
42667
- block,
42668
- start,
42669
- end
42670
- });
42671
- break;
42672
- }
42673
- }
42674
- if (spans.length < 3 || spans.length * 100 <= ctx.proseWords) return;
42675
- for (const span of spans) ctx.hit(rule, span.block, span.start, span.end, `${spans.length} bold phrases in ${ctx.proseWords.toLocaleString("en-US")} words of prose. Bold this often stops meaning "important".`, "Remove the bold here. Keep bold, if any, for the one thing a skimming reader must not miss.");
42676
- }
42744
+ // packages/core/dist/lint/rules-structure.js
42745
+ const STRUCTURE_RULES = {
42746
+ negativeParallelism: CONTRAST_RULES.negativeParallelism,
42747
+ contrastReframe: CONTRAST_RULES.contrastReframe,
42748
+ heresAnnouncement: RHYTHM_RULES.heresAnnouncement,
42749
+ pithyFragment: RHYTHM_RULES.pithyFragment,
42750
+ stockCloser: RHYTHM_RULES.stockCloser,
42751
+ negativeReframe: RHYTHM_RULES.negativeReframe,
42752
+ figurativeWorth: RHYTHM_RULES.figurativeWorth,
42753
+ anaphora: RHYTHM_RULES.anaphora,
42754
+ vocabularyCluster: COUNTED_RULES.vocabularyCluster,
42755
+ triad: COUNTED_RULES.triad,
42756
+ inventedLabel: COUNTED_RULES.inventedLabel,
42757
+ colonDensity: COUNTED_RULES.colonDensity,
42758
+ pseudoCleft: COUNTED_RULES.pseudoCleft,
42759
+ boldEmphasis: BOLD_RULES.boldEmphasis,
42760
+ boldLabels: BOLD_RULES.boldLabels
42761
+ };
42677
42762
  function runStructureRules(ctx) {
42678
42763
  negativeParallelism(ctx);
42679
42764
  contrastReframe(ctx);
@@ -42686,6 +42771,7 @@ function runStructureRules(ctx) {
42686
42771
  vocabularyCluster(ctx);
42687
42772
  triads(ctx);
42688
42773
  countedPatterns(ctx);
42774
+ colonDensity(ctx);
42689
42775
  boldLabels(ctx);
42690
42776
  boldEmphasis(ctx);
42691
42777
  }
@@ -44924,7 +45010,7 @@ async function analyticsBeside(access, site, range, before, pages) {
44924
45010
  }
44925
45011
  // packages/core/dist/commands/audit.js
44926
45012
  const AUDIT_SECTION = "weekly-audit";
44927
- const AUDIT_SECTION_TEXT = "What the weekly crawl of the site found (broken and redirected internal links, missing, empty or duplicate titles and descriptions, missing H1s, noindex for Google, canonicals to another page, sitemap URLs that do not return 200, thin pages, tags that JavaScript changes), with what is new, back or resolved since the crawl before. Only for sites added to the weekly site audit beta.";
45013
+ const AUDIT_SECTION_TEXT = "What the weekly crawl of the site found (broken and redirected internal links, missing, empty or duplicate titles and descriptions, missing H1s, noindex for Google, canonicals to another page, sitemap URLs that do not return 200, thin pages, tags that JavaScript changes), with what is new, back or resolved since the crawl before. Only for sites in the weekly site audit.";
44928
45014
  const AUDIT_RULES = {
44929
45015
  link_to_error: "Internal links to a page that returns an error",
44930
45016
  link_to_redirect: "Internal links to a redirect",
@@ -48041,6 +48127,46 @@ async function saveResearch(store, key, saved) {
48041
48127
  if (!store) return;
48042
48128
  await store.put(key, JSON.stringify(saved), RESEARCH_TTL_SECONDS).catch(() => void 0);
48043
48129
  }
48130
+ // packages/core/dist/commands/research-installed.js
48131
+ async function installedSerpResearch(provider, input, serp) {
48132
+ if (!serp) throw new CommandError("INVALID_INPUT", `${provider} is not a built-in provider. Here the providers are dataforseo and ahrefs; installed provider packages run only in the seo CLI and the local MCP server (seo mcp serve).`);
48133
+ if (input.keywords.length === 0) throw new CommandError("INVALID_INPUT", "serp needs keywords.");
48134
+ const keywords = input.keywords.slice(0, serpKeywords(input));
48135
+ const language = dataForSeoMarket(input.country, null).language_code;
48136
+ const missed = [];
48137
+ const warnings = [];
48138
+ let costMicros = 0;
48139
+ let partial = false;
48140
+ let depth = serpDepth(input);
48141
+ const rows = await eachKeyword(keywords, missed, async (keyword) => {
48142
+ const got = await serp({
48143
+ provider,
48144
+ keyword,
48145
+ country: input.country,
48146
+ language,
48147
+ device: input.device ?? "desktop",
48148
+ depth: serpDepth(input)
48149
+ });
48150
+ depth = Math.min(depth, got.depth);
48151
+ costMicros = costMicros === null || got.costMicros === null ? null : costMicros + got.costMicros;
48152
+ partial ||= got.partial;
48153
+ warnings.push(...got.warnings.map((warning) => `${keyword}: ${warning}`));
48154
+ return got.rows.map((row) => ({
48155
+ keyword,
48156
+ ...row
48157
+ }));
48158
+ });
48159
+ const answered = new Set(rows.map((row) => row.keyword));
48160
+ if (depth < serpDepth(input)) warnings.unshift(`The package reads at most ${depth} results a keyword, so this read ${depth} of the ${serpDepth(input)} asked for.`);
48161
+ return {
48162
+ rows,
48163
+ costUsd: costMicros === null ? null : Number((costMicros / 1e6).toFixed(6)),
48164
+ partial,
48165
+ missed,
48166
+ noData: keywords.filter((keyword) => !missed.includes(keyword) && !answered.has(keyword)),
48167
+ warnings
48168
+ };
48169
+ }
48044
48170
  // packages/core/dist/commands/research.js
48045
48171
  const RESEARCH_ACTIONS = [
48046
48172
  "keyword_metrics",
@@ -48057,7 +48183,7 @@ const RESEARCH_ACTIONS = [
48057
48183
  "index_check"
48058
48184
  ];
48059
48185
  const RESEARCH_PROVIDERS = ["dataforseo", "ahrefs"];
48060
- const RESEARCH_HELP = `provider is optional: without it the call uses the saved key, DataForSEO when both are saved. The target is a domain (the whole site), a path ending in / such as example.com/blog/ (every URL under it), or one page; scope overrides that. keyword_metrics (keywords: volume, difficulty, CPC), keyword_ideas (up to 5 seed keywords: searches that contain each seed, by volume), ranked_keywords (target: keywords a site, subfolder or page ranks for, with the provider's traffic total for the whole target), top_pages (target: the pages with the most estimated organic traffic), serp (keywords, up to 5: the ranking pages with their organic position beside DataForSEO's rank_absolute, which also counts AI Overviews and other blocks, plus the AI Overview's sources; device desktop or mobile, DataForSEO only; each with its domain's authority: DataForSEO domain_rank 0 to 100, Ahrefs domain_rating; depth sets results per keyword, default 20; rows run position by position across the keywords), index_check (DataForSEO only; target: one page URL; keywords: up to 2 exact phrases from the page, default its H1 or title. Searches Google for site:<url> and each "<phrase>" on desktop and mobile, retries failed searches, treats Google's fallback to unrelated sites as no match, and says indexed, not found or unknown with each search's evidence; about $0.01 a page), serp_overlap (2 to 10 keywords: for each pair, how many of their top 10 pages and sites are the same, to decide one page or several; results without a real page are counted, not compared), competitors (target: domains that share keywords), backlinks (target: referring domains), pages_by_backlinks (target: the pages with the most referring domains), link_gap (target and 2 to 5 competitors: referring domains that link to two or more competitors and not the target, highest authority first, from each site's top 1,000 referring domains; costs one backlinks call per site), ai_answers (DataForSEO only; target: the site. Without keywords it takes the site’s top 10 chat-style and long questions from Search Console’s AI-shaped queries itself. With up to 10 questions in keywords it asks those instead, and the target can be any domain, such as a competitor's. Each answer row also lists the other sites it cites, and the notes rank them. Answers come from DataForSEO's queue: answers not ready after about 40 seconds are returned as tasks, already paid for; call again with the same target and those tasks to read them at no cost. It asks ChatGPT search, Google AI Mode and Google AI Overviews each one and says whether the answer cites or mentions the site. DataForSEO’s queue prices are about $0.0072 a question across the three engines, so about $0.07 a run: tell the person before running it). Rows with a domain, and the target, get a free Ahrefs domain_rating column. Numbers are provider estimates, not Search Console data.`;
48186
+ const RESEARCH_HELP = `provider is optional: without it the call uses the saved key, DataForSEO when both are saved. In the CLI and the local MCP server, serp can also use a provider package installed on this machine that supplies live search results: pass its id as provider. The target is a domain (the whole site), a path ending in / such as example.com/blog/ (every URL under it), or one page; scope overrides that. keyword_metrics (keywords: volume, difficulty, CPC), keyword_ideas (up to 5 seed keywords: searches that contain each seed, by volume), ranked_keywords (target: keywords a site, subfolder or page ranks for, with the provider's traffic total for the whole target), top_pages (target: the pages with the most estimated organic traffic), serp (keywords, up to 5: the ranking pages with their organic position beside DataForSEO's rank_absolute, which also counts AI Overviews and other blocks, plus the AI Overview's sources; device desktop or mobile, DataForSEO only; each with its domain's authority: DataForSEO domain_rank 0 to 100, Ahrefs domain_rating; depth sets results per keyword, default 20; rows run position by position across the keywords), index_check (DataForSEO only; target: one page URL; keywords: up to 2 exact phrases from the page, default its H1 or title. Searches Google for site:<url> and each "<phrase>" on desktop and mobile, retries failed searches, treats Google's fallback to unrelated sites as no match, and says indexed, not found or unknown with each search's evidence; about $0.01 a page), serp_overlap (2 to 10 keywords: for each pair, how many of their top 10 pages and sites are the same, to decide one page or several; results without a real page are counted, not compared), competitors (target: domains that share keywords), backlinks (target: referring domains), pages_by_backlinks (target: the pages with the most referring domains), link_gap (target and 2 to 5 competitors: referring domains that link to two or more competitors and not the target, highest authority first, from each site's top 1,000 referring domains; costs one backlinks call per site), ai_answers (DataForSEO only; target: the site. Without keywords it takes the site’s top 10 chat-style and long questions from Search Console’s AI-shaped queries itself. With up to 10 questions in keywords it asks those instead, and the target can be any domain, such as a competitor's. Each answer row also lists the other sites it cites, and the notes rank them. Answers come from DataForSEO's queue: answers not ready after about 40 seconds are returned as tasks, already paid for; call again with the same target and those tasks to read them at no cost. It asks ChatGPT search, Google AI Mode and Google AI Overviews each one and says whether the answer cites or mentions the site. DataForSEO’s queue prices are about $0.0072 a question across the three engines, so about $0.07 a run: tell the person before running it). Rows with a domain, and the target, get a free Ahrefs domain_rating column. Numbers are provider estimates, not Search Console data.`;
48061
48187
  const GENERIC_PLATFORMS = [
48062
48188
  "youtube.com",
48063
48189
  "facebook.com",
@@ -48119,6 +48245,8 @@ async function runResearch(input, keys, options) {
48119
48245
  const offset = input.offset ?? 0;
48120
48246
  if (input.action === "ai_answers") throw new CommandError("INVALID_INPUT", "ai_answers runs on its own.");
48121
48247
  const provider = chooseProvider(input.provider, keys);
48248
+ const builtIn = RESEARCH_PROVIDERS.includes(provider) ? provider : null;
48249
+ if (!builtIn && input.action !== "serp") throw new CommandError("INVALID_INPUT", `An installed provider answers serp only; ${input.action} needs a built-in provider.`);
48122
48250
  if (input.action === "index_check") {
48123
48251
  if (provider === "ahrefs") throw new CommandError("INVALID_INPUT", "index_check uses DataForSEO: it runs live Google searches, which Ahrefs does not offer.");
48124
48252
  return runIndexCheck({
@@ -48151,20 +48279,23 @@ async function runResearch(input, keys, options) {
48151
48279
  const store = options.store ?? workersResearchStore();
48152
48280
  const key = await researchKey([
48153
48281
  provider,
48154
- provider === "dataforseo" ? keys.get("x-dataforseo-login") : keys.get("x-ahrefs-key"),
48282
+ builtIn ? keys.get(KEY_HEADER[builtIn]) : null,
48155
48283
  request
48156
48284
  ]);
48157
48285
  const saved = await readResearch(store, key, limit);
48158
- const result = saved?.result ?? await research(provider, keys, {
48286
+ const result = saved?.result ?? (builtIn ? await research(builtIn, keys, {
48159
48287
  ...request,
48160
48288
  limit
48161
- });
48289
+ }) : await installedSerpResearch(provider, {
48290
+ ...request,
48291
+ limit
48292
+ }, options.installedSerp));
48162
48293
  if (!saved) await saveResearch(store, key, {
48163
48294
  limit,
48164
48295
  savedAt: (/* @__PURE__ */ new Date()).toISOString(),
48165
48296
  result
48166
48297
  });
48167
- const { rows: fetched, costUsd: paid, partial, missed, noData, floor, leftOut, available, siteTotal, rankFailed, compared, aiOverviews } = result;
48298
+ const { rows: fetched, costUsd: paid, partial, missed, noData, floor, leftOut, available, siteTotal, rankFailed, compared, aiOverviews, warnings } = result;
48168
48299
  const costUsd = saved ? 0 : paid;
48169
48300
  const order = new Map(request.keywords.map((word, index) => [word, index]));
48170
48301
  const found = input.action === "serp" && request.keywords.length > 1 ? [...fetched].sort((a, b) => Number(a.position ?? 0) - Number(b.position ?? 0) || (order.get(String(a.keyword)) ?? 0) - (order.get(String(b.keyword)) ?? 0)) : fetched;
@@ -48193,18 +48324,19 @@ async function runResearch(input, keys, options) {
48193
48324
  notes: [
48194
48325
  `${provider} estimates, in the provider’s own units.`,
48195
48326
  ...compared ? [`Compared: ${compared.withPage} of ${compared.results} top results had a real page, so shared_pages counts only those; ${compared.results - compared.withPage} came back as Google redirect links and could not be compared by page. ${compared.withSite} had a known site for shared_sites. Unique pages and sites are counted per keyword.${compared.withPage < compared.results / 2 && provider === "dataforseo" ? " With this few pages, shared_pages cannot settle one page or several; provider ahrefs returns real pages." : ""}`] : [],
48196
- ...VOLUME_ACTIONS.includes(input.action) ? [`Volume model: ${VOLUME_MODEL[provider]} ${VOLUMES_DIFFER}`] : [],
48327
+ ...VOLUME_ACTIONS.includes(input.action) && builtIn ? [`Volume model: ${VOLUME_MODEL[builtIn]} ${VOLUMES_DIFFER}`] : [],
48197
48328
  ...input.action === "serp" || input.action === "ranked_keywords" ? [positionNote(provider)] : [],
48198
48329
  ...aiOverviews?.length ? [aiOverviewNote(aiOverviews, request.keywords.length)] : input.action === "serp" && provider === "dataforseo" && rows.length ? ["No AI Overview on these results pages."] : [],
48199
48330
  ...perKeyword ? [`Results per keyword: ${Object.entries(perKeyword).map(([word, count]) => `${word} ${count}`).join(", ")}. Rows run position by position across the keywords.`] : [],
48200
- ...siteTotal ? [siteTotalNote(provider, siteTotal, rows.length)] : [],
48331
+ ...siteTotal && builtIn ? [siteTotalNote(builtIn, siteTotal, rows.length)] : [],
48201
48332
  ...available !== void 0 && available > found.length ? [`Capped: ${provider} has ${available.toLocaleString("en-US")} rows for this; this read the first ${found.length.toLocaleString("en-US")} in its order.`] : [],
48202
48333
  ...!found.length && scope ? [emptyNote(provider, input.action)] : [],
48203
48334
  ...input.action === "serp" && provider === "dataforseo" ? [rankFailed ? "domain_rank is missing: the DataForSEO rank call failed, so it is unknown, not zero." : "domain_rank is DataForSEO's own authority score for the domain, 0 to 100. It is not Ahrefs' Domain Rating."] : [],
48204
48335
  ...input.action === "serp" && !drKey && provider === "dataforseo" ? ["No domain_rating column: Domain Rating by Ahrefs needs an Ahrefs key (or the hosted MCP at https://seoskill.dev/mcp, which adds it)."] : [],
48205
48336
  ...store && rated.rows.length > 50 ? ["The result is kept for a day, so the next pages, and the same rows in full, cost nothing more."] : [],
48206
- ...saved ? [`Read from the result saved at ${saved.savedAt}, at no new cost${paid ? ` (it cost $${paid} then)` : ""}. Results are kept for a day.`] : costUsd !== null ? [`DataForSEO cost: $${costUsd}.`] : [],
48207
- ...partial ? ["Partial: DataForSEO could not fetch some pages of results, so rows may be missing."] : [],
48337
+ ...saved ? [`Read from the result saved at ${saved.savedAt}, at no new cost${paid ? ` (it cost $${paid} then)` : ""}. Results are kept for a day.`] : costUsd !== null ? [builtIn ? `DataForSEO cost: $${costUsd}.` : `Cost the ${provider} package reports: $${costUsd}.`] : [],
48338
+ ...partial ? [`Partial: ${builtIn ? "DataForSEO" : provider} could not fetch some pages of results, so rows may be missing.`] : [],
48339
+ ...warnings?.length ? [`${provider} warnings: ${warnings.join(" ")}`] : [],
48208
48340
  ...missed.length ? [`Partial: ${provider} failed for ${missed.join(", ")}, so those keywords have no rows. Ask for them again.`] : [],
48209
48341
  ...noData.length ? [noDataNote(provider, input.action, noData)] : [],
48210
48342
  ...byDr ? [rows.length > GAP_RATED ? `Sorted by Domain Rating for the top ${GAP_RATED} rows by DataForSEO rank; the ${rows.length - GAP_RATED} rows after them follow by rank, with no Domain Rating.` : "Sorted by Domain Rating, then DataForSEO rank."] : [],
@@ -48222,9 +48354,9 @@ async function runResearch(input, keys, options) {
48222
48354
  action: input.action,
48223
48355
  target: target || null,
48224
48356
  scope,
48225
- siteTotal: siteTotal ? {
48357
+ siteTotal: siteTotal && builtIn ? {
48226
48358
  ...siteTotal,
48227
- model: TRAFFIC_MODEL[provider]
48359
+ model: TRAFFIC_MODEL[builtIn]
48228
48360
  } : null,
48229
48361
  available: available ?? null,
48230
48362
  country,
@@ -48239,6 +48371,7 @@ async function runResearch(input, keys, options) {
48239
48371
  partial,
48240
48372
  missedKeywords: missed,
48241
48373
  noDataKeywords: noData,
48374
+ ...warnings?.length ? { warnings } : {},
48242
48375
  ...input.action === "link_gap" ? {
48243
48376
  competitors: input.competitors ?? [],
48244
48377
  cutAt: floor ?? null,
@@ -48255,6 +48388,7 @@ async function runResearch(input, keys, options) {
48255
48388
  };
48256
48389
  }
48257
48390
  function positionNote(provider) {
48391
+ if (provider !== "dataforseo" && provider !== "ahrefs") return `position is the organic position the ${provider} package reports (its rankGroup); rank_absolute is its rank among every block on the page, and type is featured_snippet for a featured snippet, which has no organic position.`;
48258
48392
  return provider === "dataforseo" ? "position is the organic position: the nth organic link (DataForSEO rank_group). rank_absolute counts every block on the page from the top, AI Overviews, People Also Ask, videos and images included, so it is higher. A featured snippet has type featured_snippet and no organic position." : "position is the organic position: the nth row Ahrefs marks organic. ahrefs_position is Ahrefs' own position field, and type lists what each row is.";
48259
48393
  }
48260
48394
  function aiOverviewNote(overviews, keywords) {
@@ -49052,11 +49186,11 @@ async function runAllSites(deps, sites) {
49052
49186
  if (!data && sites) {
49053
49187
  const list = await sites();
49054
49188
  return {
49055
- text: `No site given. Pick one below and send it: ${deps.call("report", { site: "<site>" })}. The summary of every site is for accounts in the weekly site audit beta.\n\n${list.text}`,
49189
+ text: `No site given. Pick one below and send it: ${deps.call("report", { site: "<site>" })}. The summary of every site is for accounts with the weekly site audit.\n\n${list.text}`,
49056
49190
  data: list.data
49057
49191
  };
49058
49192
  }
49059
- if (!data) throw new CommandError("INVALID_INPUT", `No site given. Name one: ${deps.call("report", { site: "<site>" })}. The summary of every site is for accounts in the weekly site audit beta.`);
49193
+ if (!data) throw new CommandError("INVALID_INPUT", `No site given. Name one: ${deps.call("report", { site: "<site>" })}. The summary of every site is for accounts with the weekly site audit.`);
49060
49194
  const startMs = Date.parse(`${data.start}T00:00:00Z`);
49061
49195
  const endMs = Date.parse(`${data.end}T00:00:00Z`) + DAY_MS;
49062
49196
  const urgency = (site) => issues(site, startMs, endMs)[0]?.rank ?? Number.POSITIVE_INFINITY;
@@ -49151,9 +49285,9 @@ const SHARED_TOOLS = [
49151
49285
  name: "seo_report",
49152
49286
  command: "report",
49153
49287
  title: "Search Console report",
49154
- description: `Start here. Without site: a short summary of every site in the person's weekly site audit (beta) for last week, with each site's Google index, weekly crawl and search clicks, sites with changes first, ending with the site to ask about next; an account outside that beta gets its site list to pick from. With site: the main report for that Search Console property, the overview plus each section's row count and top rows. With site and section: that section's rows; page sections also check their top 20 URLs live. Sections:\n${Object.entries(SECTIONS).map(([id, text]) => `- ${id}: ${text}`).join("\n")}\n- ${ISSUES_SECTION}: ${ISSUES_SECTION_TEXT}\n- ${UPDATES_SECTION}: ${UPDATES_SECTION_TEXT}\nWith site, mark and issues: records what the person decided about those issue ids (fixed, ignored, or open to undo) and runs no checks.`,
49288
+ description: `Start here. Without site: a short summary of every site in the person's weekly site audit for last week, with each site's Google index, weekly crawl and search clicks, sites with changes first, ending with the site to ask about next; an account without the audit gets its site list to pick from. With site: the main report for that Search Console property, the overview plus each section's row count and top rows. With site and section: that section's rows; page sections also check their top 20 URLs live. Sections:\n${Object.entries(SECTIONS).map(([id, text]) => `- ${id}: ${text}`).join("\n")}\n- ${ISSUES_SECTION}: ${ISSUES_SECTION_TEXT}\n- ${UPDATES_SECTION}: ${UPDATES_SECTION_TEXT}\nWith site, mark and issues: records what the person decided about those issue ids (fixed, ignored, or open to undo) and runs no checks.`,
49155
49289
  input: z.object({
49156
- site: site.optional().describe("Leave it out for the summary of every audited site (weekly site audit beta). Otherwise a Search Console property or site, such as sc-domain:example.com, https://example.com/ or example.com."),
49290
+ site: site.optional().describe("Leave it out for the summary of every site in the weekly site audit. Otherwise a Search Console property or site, such as sc-domain:example.com, https://example.com/ or example.com."),
49157
49291
  section: z.enum([
49158
49292
  ...SECTION_IDS,
49159
49293
  ISSUES_SECTION,
@@ -49271,7 +49405,7 @@ const SHARED_TOOLS = [
49271
49405
  title: "Keyword, competitor, backlink and AI answer data",
49272
49406
  description: `Data from the person’s own DataForSEO or Ahrefs account, which costs them credits. It uses the key the person saved on their seoskill.dev account (or on this machine for the CLI). Actions: ${RESEARCH_HELP}`,
49273
49407
  input: z.object({
49274
- provider: z.enum(RESEARCH_PROVIDERS).optional().describe("Optional. Without it, the saved key; DataForSEO when both are saved."),
49408
+ provider: z.string().max(64).regex(/^[a-z0-9]+(?:-[a-z0-9]+)*$/).optional().describe(`${RESEARCH_PROVIDERS.join(" or ")}. Optional: without it, the saved key; DataForSEO when both are saved. For serp in the CLI and the local MCP server it can also be the id of an installed provider package with live search results.`),
49275
49409
  action: z.enum(RESEARCH_ACTIONS),
49276
49410
  keywords: z.array(z.string().min(1)).max(100).default([]),
49277
49411
  target: z.string().default("").describe("Domain (the whole site), a path ending in / for every URL under it, such as example.com/blog/, or one page."),
@@ -49288,7 +49422,7 @@ const SHARED_TOOLS = [
49288
49422
  run: async (surface, input) => {
49289
49423
  const more = (offset) => `seo_research with the same input, detail "rows", offset ${offset}`;
49290
49424
  if (input.action === "ai_answers") {
49291
- if (input.provider === "ahrefs") throw new CommandError("INVALID_INPUT", "ai_answers uses dataforseo.");
49425
+ if (input.provider && input.provider !== "dataforseo") throw new CommandError("INVALID_INPUT", "ai_answers uses dataforseo.");
49292
49426
  return runAiAnswers({
49293
49427
  site: input.keywords.length || input.tasks.length ? input.target : await surface.resolveSite(input.target),
49294
49428
  country: input.country,
@@ -49303,6 +49437,7 @@ const SHARED_TOOLS = [
49303
49437
  return runResearch(input, await surface.keys(), {
49304
49438
  drKey: surface.drKey,
49305
49439
  store: surface.researchStore,
49440
+ installedSerp: surface.installedSerp,
49306
49441
  call: more
49307
49442
  });
49308
49443
  }
@@ -49401,7 +49536,7 @@ function indexFromStore(shared) {
49401
49536
  const paged = "detail" in shared.input.shape;
49402
49537
  return {
49403
49538
  ...shared,
49404
- description: `${shared.description} For a site in the weekly site audit beta it answers at once from the URL Inspection results this server keeps for the site, checked in the background each day, and says how many URLs are covered, how many are queued and the time left.`,
49539
+ description: `${shared.description} For a site in the weekly site audit it answers at once from the URL Inspection results this server keeps for the site, checked in the background each day, and says how many URLs are covered, how many are queued and the time left.`,
49405
49540
  run: async (surface, parsed) => {
49406
49541
  const input = parsed;
49407
49542
  const audit = surface.deps.audit;
@@ -49473,7 +49608,7 @@ const MCP_SERVER_INFO = {
49473
49608
  };
49474
49609
  const MCP_INSTRUCTIONS = `SEO Skill reads the person's own Search Console, Google Analytics, Bing Webmaster Tools, Clicky and optional keyword accounts, and returns facts with their dates and limits. It gives no advice.
49475
49610
  1. seo_sites: the properties the connected accounts can read.
49476
- 2. seo_report: start here. Without site it summarises last week across every site in the weekly site audit (beta) and names the site to ask about next. With site it shows that property's overview and every section's count and top rows; then ask for the one section you need. Section issues keeps a list of what it found for the site between sessions; mark records which the person fixed or wants ignored.
49611
+ 2. seo_report: start here. Without site it summarises last week across every site in the weekly site audit and names the site to ask about next. With site it shows that property's overview and every section's count and top rows; then ask for the one section you need. Section issues keeps a list of what it found for the site between sessions; mark records which the person fixed or wants ignored.
49477
49612
  3. seo_page for one URL, seo_compare for before and after a date, seo_index for Google's indexing reasons and pages that lost their clicks, seo_research for keyword, competitor and backlink data, and whether AI answers cite the site, from the DataForSEO or Ahrefs key the person saved, seo_data for raw rows, including Google Analytics, Bing and Clicky.
49478
49613
  4. seo_lint checks copy you are writing or editing (a landing page, blog post, title or meta description) for patterns common in AI-written text and for title and description length. It reads only the text or files you give it.`;
49479
49614
  const mcpCall = (command, args) => {
@@ -50265,6 +50400,133 @@ z.object({ packages: z.record(z.string(), z.object({
50265
50400
  version: providerExactVersionSchema.optional(),
50266
50401
  integrity: providerIntegritySchema.optional()
50267
50402
  }).passthrough()) }).passthrough();
50403
+ // packages/core/dist/provider-extensions/serp.js
50404
+ const nullableText = z.string().max(5e4).nullable();
50405
+ const serpSnapshotResultSchema = z.object({
50406
+ observedAt: z.string().max(100),
50407
+ effectiveKeyword: z.string().trim().min(1).max(1e3),
50408
+ searchEngineDomain: z.string().max(253).nullable(),
50409
+ checkUrl: z.url().max(8192).nullable(),
50410
+ resultCount: z.number().int().nonnegative().safe().nullable(),
50411
+ pagesCount: z.number().int().nonnegative().max(100).safe().nullable(),
50412
+ features: z.array(z.string().trim().min(1).max(100)).max(100),
50413
+ organicResults: z.array(z.object({
50414
+ rankGroup: z.number().int().positive().safe(),
50415
+ rankAbsolute: z.number().int().positive().safe(),
50416
+ page: z.number().int().positive().max(100).safe(),
50417
+ domain: z.string().trim().min(1).max(253),
50418
+ url: z.url().max(8192),
50419
+ title: z.string().max(1e4).nullable(),
50420
+ description: nullableText,
50421
+ isFeaturedSnippet: z.boolean().nullable()
50422
+ }).strict()).max(100),
50423
+ localPack: z.object({
50424
+ present: z.boolean(),
50425
+ returnedRows: z.number().int().nonnegative().max(100).safe(),
50426
+ retainedRows: z.number().int().nonnegative().max(100).safe(),
50427
+ invalidRows: z.number().int().nonnegative().max(100).safe(),
50428
+ results: z.array(z.unknown()).max(100)
50429
+ }).strict(),
50430
+ coverage: z.object({
50431
+ returnedRows: z.number().int().nonnegative().max(1e4).safe(),
50432
+ retainedRows: z.number().int().nonnegative().max(100).safe(),
50433
+ invalidRows: z.number().int().nonnegative().max(1e4).safe(),
50434
+ providerTotalRows: z.number().int().nonnegative().safe().nullable(),
50435
+ completeness: z.enum([
50436
+ "complete",
50437
+ "partial",
50438
+ "capped"
50439
+ ]),
50440
+ nextCursor: z.string().max(500).nullable()
50441
+ }).strict(),
50442
+ request: z.object({
50443
+ endpoint: z.string().trim().min(1).max(500),
50444
+ filters: z.record(z.string().min(1).max(100), z.union([
50445
+ z.string().max(1e3),
50446
+ z.number().finite(),
50447
+ z.boolean()
50448
+ ])),
50449
+ sort: z.array(z.string().min(1).max(200)).max(20)
50450
+ }).strict(),
50451
+ cost: z.object({
50452
+ estimatedMicros: z.number().int().nonnegative().safe().nullable(),
50453
+ actualMicros: z.number().int().nonnegative().safe().nullable(),
50454
+ taskIds: z.array(z.string().min(1).max(500)).max(20),
50455
+ native: z.object({
50456
+ unit: z.string().trim().min(1).max(100),
50457
+ estimatedUnits: z.number().finite().nonnegative().nullable(),
50458
+ actualUnits: z.number().finite().nonnegative().nullable(),
50459
+ remainingBefore: z.number().finite().nonnegative().nullable()
50460
+ }).strict().optional()
50461
+ }).strict(),
50462
+ qualityWarnings: z.array(z.object({
50463
+ code: z.string().trim().min(1).max(100),
50464
+ message: z.string().trim().min(1).max(500),
50465
+ field: z.string().max(200).optional(),
50466
+ row: z.number().int().positive().safe().optional()
50467
+ }).strict()).max(50)
50468
+ }).strict();
50469
+ const same = (list, value) => !list || list.some((item) => item.toLowerCase() === value.toLowerCase());
50470
+ function supports(capability, market) {
50471
+ return capability.markets.some((entry) => same(entry.searchEngines, market.searchEngine) && same(entry.countryCodes, market.countryCode) && same(entry.languageCodes, market.languageCode) && same(entry.devices, market.device ?? "desktop"));
50472
+ }
50473
+ const installedProviderSerp = async (input) => {
50474
+ const loaded = await loadProviderExtensions();
50475
+ const provider = loaded.registry.get(input.provider);
50476
+ if (!provider) throw new CommandError("INVALID_INPUT", `No provider ${input.provider} is installed. The built-in providers are dataforseo and ahrefs; \`seo providers list\` shows installed packages.`);
50477
+ const capability = loaded.registry.capability(provider.id, "serp-snapshot");
50478
+ if (!capability) throw new CommandError("INVALID_INPUT", `${provider.displayName} has no live search results (serp-snapshot), so it cannot answer serp. \`seo providers describe ${provider.id}\` lists its own actions.`);
50479
+ const market = {
50480
+ searchEngine: "google",
50481
+ countryCode: input.country.toUpperCase(),
50482
+ languageCode: input.language,
50483
+ device: input.device
50484
+ };
50485
+ if (!supports(capability, market)) throw new CommandError("INVALID_INPUT", `${provider.displayName} has no ${input.device} Google results for country ${input.country} in language ${input.language}.`);
50486
+ let account;
50487
+ let credentials;
50488
+ try {
50489
+ account = normalizeProviderExtensionAccount(provider, readProviderExtensionAccount(provider.id));
50490
+ credentials = await readProviderExtensionCredentials({
50491
+ providerId: provider.id,
50492
+ account,
50493
+ fields: provider.connection.fields
50494
+ });
50495
+ } catch (error) {
50496
+ throw new CommandError("NO_KEY", `${error instanceof Error ? error.message : String(error)} Connect it with \`seo providers connect ${provider.id}\`.`);
50497
+ }
50498
+ const depth = Math.min(input.depth, capability.maxDepth);
50499
+ let raw;
50500
+ try {
50501
+ raw = await capability.run({
50502
+ account,
50503
+ credentials,
50504
+ keyword: input.keyword,
50505
+ market,
50506
+ depth
50507
+ }, runtimeForProvider(provider.id, { maxRequests: capability.maxRequests }));
50508
+ } catch (error) {
50509
+ throw new CommandError("PROVIDER_ERROR", safeProviderAdapterError(provider.id, error, credentials).message);
50510
+ }
50511
+ const parsed = serpSnapshotResultSchema.safeParse(raw);
50512
+ if (!parsed.success) throw new CommandError("PROVIDER_ERROR", `${provider.displayName} returned a results page that does not match the serp-snapshot shape.`);
50513
+ const result = parsed.data;
50514
+ const warnings = result.qualityWarnings.map((warning) => warning.message);
50515
+ return {
50516
+ rows: [...result.organicResults].sort((a, b) => a.rankAbsolute - b.rankAbsolute || (a.url < b.url ? -1 : 1)).map((item) => ({
50517
+ position: item.isFeaturedSnippet ? null : item.rankGroup,
50518
+ rank_absolute: item.rankAbsolute,
50519
+ type: item.isFeaturedSnippet ? "featured_snippet" : "organic",
50520
+ url: item.url,
50521
+ domain: item.domain,
50522
+ title: item.title
50523
+ })),
50524
+ costMicros: result.cost.actualMicros,
50525
+ partial: result.coverage.completeness === "partial",
50526
+ warnings,
50527
+ depth
50528
+ };
50529
+ };
50268
50530
  z.object({ limits_and_usage: z.object({
50269
50531
  api_key_expiration_date: z.string().trim().min(1).max(100),
50270
50532
  subscription: z.string().trim().min(1).max(200),
@@ -53054,6 +53316,7 @@ function registerSharedTools(server, options = {}) {
53054
53316
  refreshClicky: localRefreshClicky,
53055
53317
  drKey: null,
53056
53318
  researchStore: localResearchStore(),
53319
+ installedSerp: installedProviderSerp,
53057
53320
  accounts: localAccounts,
53058
53321
  signIn: LOCAL_SIGN_IN.signIn,
53059
53322
  connect: "run `seo login` to use your seoskill.dev account (Google, Bing and keys in one place), or `seo auth login`, `seo providers bing connect` and `seo providers dataforseo connect` or `seo providers ahrefs connect` on this machine only.",