seo 0.17.3 → 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/cli.js +4 -4
- package/dist/cli.js.map +1 -1
- package/dist/{dist-CSPI6SOD.js → dist-B8nuX_b-.js} +66 -66
- package/dist/dist-B8nuX_b-.js.map +1 -0
- package/dist/{dist-BNTdDj1i.js → dist-BBn_q4HK.js} +1 -1
- package/dist/{esm-HKeFfXOD.js → esm-lrKCsK_C.js} +2 -2
- package/dist/{esm-HKeFfXOD.js.map → esm-lrKCsK_C.js.map} +1 -1
- package/dist/index.js +426 -298
- package/dist/index.js.map +1 -1
- package/dist/mcp.js +443 -312
- package/dist/mcp.js.map +1 -1
- package/package.json +32 -4
- package/skills/seo/SKILL.md +1 -1
- package/dist/dist-CSPI6SOD.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __seoCreateRequire } from 'node:module'; const require = __seoCreateRequire(import.meta.url);
|
|
2
|
-
import { n as version, t as load } from "./esm-
|
|
2
|
+
import { n as version, t as load } from "./esm-lrKCsK_C.js";
|
|
3
3
|
import { SEO_PROVIDER_API_VERSION } from "./provider-sdk.js";
|
|
4
4
|
import crypto$1, { createHash, randomUUID, sign } from "node:crypto";
|
|
5
5
|
import { z } from "zod";
|
|
@@ -31243,6 +31243,17 @@ const PROSE = [
|
|
|
31243
31243
|
"quote",
|
|
31244
31244
|
"prop"
|
|
31245
31245
|
];
|
|
31246
|
+
const SENTENCE_KINDS = [
|
|
31247
|
+
"paragraph",
|
|
31248
|
+
"quote",
|
|
31249
|
+
"prop",
|
|
31250
|
+
"list"
|
|
31251
|
+
];
|
|
31252
|
+
const RHYTHM_KINDS = [
|
|
31253
|
+
"paragraph",
|
|
31254
|
+
"quote",
|
|
31255
|
+
"prop"
|
|
31256
|
+
];
|
|
31246
31257
|
const ALL = [
|
|
31247
31258
|
"paragraph",
|
|
31248
31259
|
"list",
|
|
@@ -31496,7 +31507,7 @@ const PHRASE_RULES = [
|
|
|
31496
31507
|
id: "significance-inflation",
|
|
31497
31508
|
family: "ai",
|
|
31498
31509
|
level: "error",
|
|
31499
|
-
description: "Importance puffery: \"plays a crucial role\", \"marks a pivotal moment\", \"a testament to\".",
|
|
31510
|
+
description: "Importance puffery: \"plays a crucial role\", \"marks a pivotal moment\", \"a testament to\", \"the part that really matters\".",
|
|
31500
31511
|
patterns: [
|
|
31501
31512
|
/\bplays? an? (?:crucial|pivotal|vital|key|significant|critical|central|important|major) role\b/gi,
|
|
31502
31513
|
/\b(?:marks?|marking|represents?|signals?) an? (?:pivotal|significant|important|major|defining|watershed|key) (?:moment|shift|turning point|milestone|step)\b/gi,
|
|
@@ -31515,8 +31526,11 @@ const PHRASE_RULES = [
|
|
|
31515
31526
|
/\b(?:a|another) (?:major|key|significant|important|huge|big|proud) milestone\b/gi,
|
|
31516
31527
|
/\bbuilding a better (?:future|world|tomorrow)\b/gi,
|
|
31517
31528
|
/\bthe implications are (?:profound|significant|enormous|huge|far-reaching)\b/gi,
|
|
31518
|
-
/\b(?:is|was) an (?:event|experience|attraction) in itself\b/gi
|
|
31529
|
+
/\b(?:is|was) an (?:event|experience|attraction) in itself\b/gi,
|
|
31530
|
+
/\b(?:answers|asks|addresses) the (?:actual|real) question\b/gi,
|
|
31531
|
+
/\bthe (?:one |only )?(?:part|bit|thing|piece|step|number|leg|detail|line|row) that (?:actually|really|truly) (?:matters|counts)\b/gi
|
|
31519
31532
|
],
|
|
31533
|
+
levelFor: (match) => /question|that (?:actually|really|truly)/i.test(match.text) ? "warning" : void 0,
|
|
31520
31534
|
message: "It inflates importance without saying what changed.",
|
|
31521
31535
|
fix: "Cut it, or name the concrete effect the text already states. Do not add a number that is not there."
|
|
31522
31536
|
},
|
|
@@ -31524,9 +31538,9 @@ const PHRASE_RULES = [
|
|
|
31524
31538
|
id: "participle-tail",
|
|
31525
31539
|
family: "ai",
|
|
31526
31540
|
level: "error",
|
|
31527
|
-
description: "A sentence that ends on \", highlighting/underscoring/
|
|
31541
|
+
description: "A sentence that ends on \", highlighting/underscoring/suggesting ...\" commentary.",
|
|
31528
31542
|
kinds: PROSE,
|
|
31529
|
-
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],
|
|
31543
|
+
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],
|
|
31530
31544
|
levelFor: (match) => /^,\s+(?:reflecting|ensuring|marking|contributing|demonstrating|illustrating|giving|freeing|making|creating|delivering)/i.test(match.text) ? "warning" : void 0,
|
|
31531
31545
|
message: "The \", highlighting ...\" tail comments on the sentence instead of adding a fact.",
|
|
31532
31546
|
fix: "End the sentence at the comma. If the tail holds a real fact, give it its own sentence with a subject and verb."
|
|
@@ -31639,6 +31653,7 @@ const PHRASE_RULES = [
|
|
|
31639
31653
|
/\bpunch(?:es|ing)? (?:well )?above (?:its|their|his|her) weight\b/gi,
|
|
31640
31654
|
/\b(?:thrilled|delighted) to (?:announce|share|introduce|unveil)\b/gi,
|
|
31641
31655
|
/\bthe (?:whole|entire) point\b/gi,
|
|
31656
|
+
/\bthe only (?:[\w-]+ ){1,3}(?:I|we) (?:actually |really |still )?trust\b/gi,
|
|
31642
31657
|
/,? which is (?:the (?:whole |real |entire )?point|exactly the point|kind of the point)\b/gi
|
|
31643
31658
|
],
|
|
31644
31659
|
message: (match) => `"${match.text}" is a stock phrase that would fit any page.`,
|
|
@@ -31763,6 +31778,16 @@ const PHRASE_RULES = [
|
|
|
31763
31778
|
message: "Two hedges where one, or none, would do.",
|
|
31764
31779
|
fix: "Keep one qualifier, or state what the evidence shows."
|
|
31765
31780
|
},
|
|
31781
|
+
{
|
|
31782
|
+
id: "false-range",
|
|
31783
|
+
family: "ai",
|
|
31784
|
+
level: "error",
|
|
31785
|
+
kinds: PROSE,
|
|
31786
|
+
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\".",
|
|
31787
|
+
patterns: [/\bfrom [^,.;:!?\n]{1,40} to [^,.;:!?\n]{1,40},\s+(?:and )?from [^,.;:!?\n]{1,40} to [^,.;:!?\n]{1,40}/gi],
|
|
31788
|
+
message: "Two \"from X to Y\" ranges in a row cover everything and say nothing.",
|
|
31789
|
+
fix: "Name the specific things the text covers, or cut the ranges."
|
|
31790
|
+
},
|
|
31766
31791
|
{
|
|
31767
31792
|
id: "colon-reveal",
|
|
31768
31793
|
family: "ai",
|
|
@@ -31821,27 +31846,30 @@ const PHRASE_RULES = [
|
|
|
31821
31846
|
family: "ai",
|
|
31822
31847
|
level: "error",
|
|
31823
31848
|
kinds: PROSE,
|
|
31824
|
-
description: "A one-line denial used as a beat: \"It isn't.\" \"Not quite.\" \"
|
|
31849
|
+
description: "A one-line denial used as a beat: \"It isn't.\" \"Not quite.\" \"The sixth is not.\" \"; the data didn't.\"",
|
|
31825
31850
|
patterns: [
|
|
31826
31851
|
/(?:^|[.!?:]\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,
|
|
31827
31852
|
/(?:^|[.!?:]\s+)(?:Not quite|Not even close|Not really|Not anymore|Not any more)\.(?=\s|$)/g,
|
|
31828
|
-
/(?:^|[.!?:]\s+)(?:But|And) only (?:part|half|some|partly)\.(?=\s|$)/g
|
|
31853
|
+
/(?:^|[.!?:]\s+)(?:But|And) only (?:part|half|some|partly)\.(?=\s|$)/g,
|
|
31854
|
+
/(?:^|[.!?]\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,
|
|
31855
|
+
/;\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
|
|
31829
31856
|
],
|
|
31830
|
-
message: "A
|
|
31831
|
-
fix: "Join it to the sentence before, so the point is stated once."
|
|
31857
|
+
message: "A bare denial used for rhythm. It makes the reader wait.",
|
|
31858
|
+
fix: "Join it to the sentence before and name the thing, so the point is stated once."
|
|
31832
31859
|
},
|
|
31833
31860
|
{
|
|
31834
31861
|
id: "strawman",
|
|
31835
31862
|
family: "ai",
|
|
31836
31863
|
level: "error",
|
|
31837
31864
|
kinds: PROSE,
|
|
31838
|
-
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\".",
|
|
31865
|
+
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\".",
|
|
31839
31866
|
patterns: [
|
|
31840
31867
|
/(?:^|[.!?:]\s+)(?:It|This|That|Nothing|No \w+)(?:'s| is|'s not| isn't| is not| wasn't| was not) (?:not )?perfect\.(?=\s|$)/g,
|
|
31841
31868
|
/\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,
|
|
31842
31869
|
/(?:^|[.!?]\s)None of this means\b/g,
|
|
31843
31870
|
/(?:^|[.!?]\s)(?:This|That|It)(?: isn't| is not|'s not) (?:just |really |only )?about\b/g,
|
|
31844
|
-
/\b(?:isn't|is not|ain't) rocket science\b/gi
|
|
31871
|
+
/\b(?:isn't|is not|ain't) rocket science\b/gi,
|
|
31872
|
+
/\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
|
|
31845
31873
|
],
|
|
31846
31874
|
message: "It answers a doubt the reader did not raise.",
|
|
31847
31875
|
fix: "Cut it, or state the limit or the point plainly as a fact."
|
|
@@ -32102,7 +32130,7 @@ const SEO_RULES = {
|
|
|
32102
32130
|
family: "copy",
|
|
32103
32131
|
level: "error",
|
|
32104
32132
|
presets: { docs: "warning" },
|
|
32105
|
-
description: "Headings that label instead of telling: \"Overview\", \"Key takeaways\", \"Why it matters\", \"
|
|
32133
|
+
description: "Headings that label instead of telling, or tease: \"Overview\", \"Key takeaways\", \"Why it matters\", 'What \"exhausted\" means', \"X is dead\"."
|
|
32106
32134
|
},
|
|
32107
32135
|
emoji: {
|
|
32108
32136
|
id: "emoji",
|
|
@@ -32174,6 +32202,7 @@ function lengths(ctx) {
|
|
|
32174
32202
|
}
|
|
32175
32203
|
}
|
|
32176
32204
|
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;
|
|
32205
|
+
const HEADING_COY = /^(?:what "[^"]{1,40}" (?:really |actually )?means$|[^?]{1,60} is dead$|the one [\w-]+ (?:that|which|you|we)\b)/i;
|
|
32177
32206
|
function headings(ctx) {
|
|
32178
32207
|
const list = ctx.blocks(["heading"]);
|
|
32179
32208
|
const h1s = list.filter((block) => block.level === 1);
|
|
@@ -32183,7 +32212,8 @@ function headings(ctx) {
|
|
|
32183
32212
|
const level = block.level ?? 2;
|
|
32184
32213
|
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.`);
|
|
32185
32214
|
previous = level;
|
|
32186
|
-
|
|
32215
|
+
const coy = HEADING_COY.test(block.norm);
|
|
32216
|
+
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\".");
|
|
32187
32217
|
}
|
|
32188
32218
|
}
|
|
32189
32219
|
const EMOJI = /^\p{Extended_Pictographic}/u;
|
|
@@ -32300,94 +32330,8 @@ function runSeoRules(ctx) {
|
|
|
32300
32330
|
heroLength(ctx);
|
|
32301
32331
|
reviews(ctx);
|
|
32302
32332
|
}
|
|
32303
|
-
// packages/core/src/lint/rules-
|
|
32304
|
-
const
|
|
32305
|
-
"paragraph",
|
|
32306
|
-
"quote",
|
|
32307
|
-
"prop",
|
|
32308
|
-
"list"
|
|
32309
|
-
];
|
|
32310
|
-
const RHYTHM_KINDS = [
|
|
32311
|
-
"paragraph",
|
|
32312
|
-
"quote",
|
|
32313
|
-
"prop"
|
|
32314
|
-
];
|
|
32315
|
-
const STRUCTURE_RULES = {
|
|
32316
|
-
negativeParallelism: {
|
|
32317
|
-
id: "negative-parallelism",
|
|
32318
|
-
family: "ai",
|
|
32319
|
-
level: "error",
|
|
32320
|
-
description: "\"It isn't X, it's Y\" and \"isn't just X. It's Y.\" reframes."
|
|
32321
|
-
},
|
|
32322
|
-
contrastReframe: {
|
|
32323
|
-
id: "contrast-reframe",
|
|
32324
|
-
family: "ai",
|
|
32325
|
-
level: "error",
|
|
32326
|
-
presets: { docs: "warning" },
|
|
32327
|
-
description: "A trailing \", not X\" or \"rather than X\" contrast added for drama: \"The fix is in the template, not in 600 posts.\""
|
|
32328
|
-
},
|
|
32329
|
-
heresAnnouncement: {
|
|
32330
|
-
id: "heres-announcement",
|
|
32331
|
-
family: "ai",
|
|
32332
|
-
level: "error",
|
|
32333
|
-
presets: { docs: "off" },
|
|
32334
|
-
description: "A short \"Here's the X\" sentence that announces what comes next instead of saying it."
|
|
32335
|
-
},
|
|
32336
|
-
pithyFragment: {
|
|
32337
|
-
id: "pithy-fragment",
|
|
32338
|
-
family: "ai",
|
|
32339
|
-
level: "error",
|
|
32340
|
-
description: "Verbless slogan fragments: \"Same essay, two titles.\", \"Every month. No exceptions.\", \"$299 per month. That's it.\""
|
|
32341
|
-
},
|
|
32342
|
-
stockCloser: {
|
|
32343
|
-
id: "stock-closer",
|
|
32344
|
-
family: "ai",
|
|
32345
|
-
level: "error",
|
|
32346
|
-
description: "A stock kicker line: \"That's a real win.\" \"That is what makes this interesting.\""
|
|
32347
|
-
},
|
|
32348
|
-
negativeReframe: {
|
|
32349
|
-
id: "negative-reframe",
|
|
32350
|
-
family: "ai",
|
|
32351
|
-
level: "warning",
|
|
32352
|
-
description: "A short \"That's not how/what ...\" dismissal."
|
|
32353
|
-
},
|
|
32354
|
-
figurativeWorth: {
|
|
32355
|
-
id: "figurative-worth",
|
|
32356
|
-
family: "ai",
|
|
32357
|
-
level: "error",
|
|
32358
|
-
description: "A \"worth + -ing\" idiom that mixes its metaphor or points at the reader: \"a fight worth picking\", \"worth noting\"."
|
|
32359
|
-
},
|
|
32360
|
-
anaphora: {
|
|
32361
|
-
id: "anaphora",
|
|
32362
|
-
family: "ai",
|
|
32363
|
-
level: "error",
|
|
32364
|
-
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\"."
|
|
32365
|
-
},
|
|
32366
|
-
vocabularyCluster: {
|
|
32367
|
-
id: "ai-vocabulary-cluster",
|
|
32368
|
-
family: "ai",
|
|
32369
|
-
level: "warning",
|
|
32370
|
-
description: "Two or more words such as crucial, pivotal, foster, landscape or journey in one paragraph."
|
|
32371
|
-
},
|
|
32372
|
-
triad: {
|
|
32373
|
-
id: "triad",
|
|
32374
|
-
family: "ai",
|
|
32375
|
-
level: "warning",
|
|
32376
|
-
presets: { docs: "off" },
|
|
32377
|
-
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."
|
|
32378
|
-
},
|
|
32379
|
-
inventedLabel: {
|
|
32380
|
-
id: "invented-label",
|
|
32381
|
-
family: "ai",
|
|
32382
|
-
level: "warning",
|
|
32383
|
-
description: "Two or more coined labels such as \"the integration tax\" or \"the supervision paradox\"."
|
|
32384
|
-
},
|
|
32385
|
-
pseudoCleft: {
|
|
32386
|
-
id: "pseudo-cleft",
|
|
32387
|
-
family: "ai",
|
|
32388
|
-
level: "warning",
|
|
32389
|
-
description: "Repeated \"What makes this work is ...\" or \"The problem is that ...\" setups."
|
|
32390
|
-
},
|
|
32333
|
+
// packages/core/src/lint/rules-bold.ts
|
|
32334
|
+
const BOLD_RULES = {
|
|
32391
32335
|
boldEmphasis: {
|
|
32392
32336
|
id: "bold-emphasis",
|
|
32393
32337
|
family: "ai",
|
|
@@ -32403,7 +32347,87 @@ const STRUCTURE_RULES = {
|
|
|
32403
32347
|
family: "ai",
|
|
32404
32348
|
level: "warning",
|
|
32405
32349
|
presets: { docs: "off" },
|
|
32406
|
-
description: "Three or more list items in a row that open with a bold label
|
|
32350
|
+
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.\""
|
|
32351
|
+
}
|
|
32352
|
+
};
|
|
32353
|
+
const RESTATED = /^\s*(?:[-*+]|\d{1,9}[.)])\s+(?:\*\*|__)(?:[^*_\n]{0,30}\s)?([a-z]{4})[^*_\s]*(?:\*\*|__)\s*[:.]?\s+\1/i;
|
|
32354
|
+
function boldLabels(ctx) {
|
|
32355
|
+
const rule = BOLD_RULES.boldLabels;
|
|
32356
|
+
if (ctx.level(rule) === "off") return;
|
|
32357
|
+
if (ctx.doc.format !== "md" && ctx.doc.format !== "mdx") return;
|
|
32358
|
+
const lists = ctx.blocks(["list"]);
|
|
32359
|
+
let run = [];
|
|
32360
|
+
const report = () => {
|
|
32361
|
+
if (run.length >= 3) {
|
|
32362
|
+
const first = run[0];
|
|
32363
|
+
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.");
|
|
32364
|
+
}
|
|
32365
|
+
run = [];
|
|
32366
|
+
};
|
|
32367
|
+
let previous = null;
|
|
32368
|
+
for (const block of lists) {
|
|
32369
|
+
const offset = block.map[0] ?? 0;
|
|
32370
|
+
const line = ctx.doc.source.lastIndexOf("\n", offset) + 1;
|
|
32371
|
+
const raw = ctx.doc.source.slice(line, offset + 4);
|
|
32372
|
+
const bold = /^\s*(?:[-*+]|\d{1,9}[.)])\s+(?:\*\*|__)/.test(raw);
|
|
32373
|
+
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.");
|
|
32374
|
+
const adjacent = previous !== null && ctx.doc.blocks.indexOf(block) === ctx.doc.blocks.indexOf(previous) + 1;
|
|
32375
|
+
if (!bold || !adjacent) report();
|
|
32376
|
+
if (bold) run.push(block);
|
|
32377
|
+
previous = block;
|
|
32378
|
+
}
|
|
32379
|
+
report();
|
|
32380
|
+
}
|
|
32381
|
+
function boldEmphasis(ctx) {
|
|
32382
|
+
const rule = BOLD_RULES.boldEmphasis;
|
|
32383
|
+
if (ctx.level(rule) === "off") return;
|
|
32384
|
+
const markdown = ctx.doc.format === "md" || ctx.doc.format === "mdx";
|
|
32385
|
+
const re = markdown ? /(\*\*|__)(?=\S)[^*_\n]+?\1/g : /<(strong|b)\b[^>]*>[^<]{1,200}<\/\1>/gi;
|
|
32386
|
+
const prose = ctx.blocks([
|
|
32387
|
+
"paragraph",
|
|
32388
|
+
"list",
|
|
32389
|
+
"quote",
|
|
32390
|
+
"prop"
|
|
32391
|
+
]);
|
|
32392
|
+
const spans = [];
|
|
32393
|
+
for (const found of ctx.doc.source.matchAll(re)) {
|
|
32394
|
+
const open = markdown ? 2 : found[0].indexOf(">") + 1;
|
|
32395
|
+
const from = (found.index ?? 0) + open;
|
|
32396
|
+
const to = (found.index ?? 0) + found[0].length - (markdown ? 2 : found[0].length - found[0].lastIndexOf("<"));
|
|
32397
|
+
for (const block of prose) {
|
|
32398
|
+
const first = block.map[0] ?? 0;
|
|
32399
|
+
const last = block.map[block.map.length - 1] ?? 0;
|
|
32400
|
+
if (from < first || from > last) continue;
|
|
32401
|
+
const start = block.map.indexOf(from);
|
|
32402
|
+
if (start <= 0 && block.kind === "list") break;
|
|
32403
|
+
if (start < 0) break;
|
|
32404
|
+
let end = start;
|
|
32405
|
+
while (end < block.map.length && (block.map[end] ?? 0) < to) end++;
|
|
32406
|
+
spans.push({
|
|
32407
|
+
block,
|
|
32408
|
+
start,
|
|
32409
|
+
end
|
|
32410
|
+
});
|
|
32411
|
+
break;
|
|
32412
|
+
}
|
|
32413
|
+
}
|
|
32414
|
+
if (spans.length < 3 || spans.length * 100 <= ctx.proseWords) return;
|
|
32415
|
+
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.");
|
|
32416
|
+
}
|
|
32417
|
+
// packages/core/src/lint/rules-contrast.ts
|
|
32418
|
+
const CONTRAST_RULES = {
|
|
32419
|
+
negativeParallelism: {
|
|
32420
|
+
id: "negative-parallelism",
|
|
32421
|
+
family: "ai",
|
|
32422
|
+
level: "error",
|
|
32423
|
+
description: "\"It isn't X, it's Y\" and \"isn't just X. It's Y.\" reframes."
|
|
32424
|
+
},
|
|
32425
|
+
contrastReframe: {
|
|
32426
|
+
id: "contrast-reframe",
|
|
32427
|
+
family: "ai",
|
|
32428
|
+
level: "error",
|
|
32429
|
+
presets: { docs: "warning" },
|
|
32430
|
+
description: "A trailing \", not X\" or \"rather than X\" contrast added for drama: \"The fix is in the template, not in 600 posts.\""
|
|
32407
32431
|
}
|
|
32408
32432
|
};
|
|
32409
32433
|
const NEG = "(?:\\b(?:is|are|was|were)(?:n't|\\s+not)\\b|\\b(?:it|this|that|they|we|you)(?:'s|'re)\\s+not\\b)";
|
|
@@ -32424,6 +32448,10 @@ const PARALLEL = [
|
|
|
32424
32448
|
kind: "split",
|
|
32425
32449
|
re: new RegExp(`${NEG}\\s+(?:${MINIMIZER}\\s+)?${BODY}[.!]\\s+${RESTATE}`, "gi")
|
|
32426
32450
|
},
|
|
32451
|
+
{
|
|
32452
|
+
kind: "repeated",
|
|
32453
|
+
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")
|
|
32454
|
+
},
|
|
32427
32455
|
{
|
|
32428
32456
|
kind: "joined",
|
|
32429
32457
|
re: new RegExp(`${NEG}\\s+${BODY}${JOIN}${RESTATE}`, "gi")
|
|
@@ -32431,7 +32459,7 @@ const PARALLEL = [
|
|
|
32431
32459
|
];
|
|
32432
32460
|
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;
|
|
32433
32461
|
function negativeParallelism(ctx) {
|
|
32434
|
-
const rule =
|
|
32462
|
+
const rule = CONTRAST_RULES.negativeParallelism;
|
|
32435
32463
|
for (const block of ctx.blocks(SENTENCE_KINDS)) {
|
|
32436
32464
|
const sentences = ctx.sentences(block);
|
|
32437
32465
|
const taken = [];
|
|
@@ -32448,14 +32476,14 @@ function negativeParallelism(ctx) {
|
|
|
32448
32476
|
const pronoun = /^(?:but |and |so )?(?:it|this|that|they)?$/i.test(subject.replace(/(?:'s|'re)$/, ""));
|
|
32449
32477
|
const firstWords = words$2(block.norm.slice(sentence.start, end)).length;
|
|
32450
32478
|
let level = "warning";
|
|
32451
|
-
if (kind === "reveal" || kind === "about") level = "error";
|
|
32479
|
+
if (kind === "reveal" || kind === "about" || kind === "repeated") level = "error";
|
|
32452
32480
|
else if (FRAMING.test(subject)) level = "error";
|
|
32453
32481
|
else if (pronoun && (kind === "joined" || firstWords <= 10)) level = "error";
|
|
32454
32482
|
const after = sentenceAt(sentences, end - 1);
|
|
32455
32483
|
const restate = /(?:it|this|that|they)(?:'s|'re|\s+(?:is|are|was|were))$/i.exec(found[0]);
|
|
32456
32484
|
const from = restate ? end - restate[0].length : end;
|
|
32457
32485
|
const second = block.text.slice(from, after.end).trim();
|
|
32458
|
-
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.";
|
|
32486
|
+
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.";
|
|
32459
32487
|
const concession = (/,\s*but\s+(?:[\w']+\s*){1,3}$/i.test(found[0]) || /^(?:while|although|though|even though)\b/i.test(subject)) && kind !== "reveal";
|
|
32460
32488
|
if (level === "warning" && firstWords > 12 || concession) {
|
|
32461
32489
|
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.");
|
|
@@ -32495,7 +32523,7 @@ function gerund(word) {
|
|
|
32495
32523
|
}
|
|
32496
32524
|
const NOT_JUST = /,\s+not (?:just|merely|simply) [^,.;:!?]{1,50}[.!?]?$|\bnot (?:just|merely|simply) [^,.;:!?]{1,50},? but\b/i;
|
|
32497
32525
|
function contrastReframe(ctx) {
|
|
32498
|
-
const rule =
|
|
32526
|
+
const rule = CONTRAST_RULES.contrastReframe;
|
|
32499
32527
|
if (ctx.level(rule) === "off") return;
|
|
32500
32528
|
for (const block of ctx.blocks([...SENTENCE_KINDS, "heading"])) for (const sentence of ctx.sentences(block)) {
|
|
32501
32529
|
const text = sentence.text;
|
|
@@ -32539,8 +32567,227 @@ function contrastReframe(ctx) {
|
|
|
32539
32567
|
}
|
|
32540
32568
|
}
|
|
32541
32569
|
}
|
|
32570
|
+
// packages/core/src/lint/rules-counted.ts
|
|
32571
|
+
const COUNTED_RULES = {
|
|
32572
|
+
vocabularyCluster: {
|
|
32573
|
+
id: "ai-vocabulary-cluster",
|
|
32574
|
+
family: "ai",
|
|
32575
|
+
level: "warning",
|
|
32576
|
+
description: "Two or more words such as crucial, pivotal, foster, landscape or journey in one paragraph."
|
|
32577
|
+
},
|
|
32578
|
+
triad: {
|
|
32579
|
+
id: "triad",
|
|
32580
|
+
family: "ai",
|
|
32581
|
+
level: "warning",
|
|
32582
|
+
presets: { docs: "off" },
|
|
32583
|
+
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."
|
|
32584
|
+
},
|
|
32585
|
+
inventedLabel: {
|
|
32586
|
+
id: "invented-label",
|
|
32587
|
+
family: "ai",
|
|
32588
|
+
level: "warning",
|
|
32589
|
+
description: "Two or more coined labels such as \"the integration tax\" or \"the supervision paradox\"."
|
|
32590
|
+
},
|
|
32591
|
+
colonDensity: {
|
|
32592
|
+
id: "colon-density",
|
|
32593
|
+
family: "ai",
|
|
32594
|
+
level: "warning",
|
|
32595
|
+
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."
|
|
32596
|
+
},
|
|
32597
|
+
pseudoCleft: {
|
|
32598
|
+
id: "pseudo-cleft",
|
|
32599
|
+
family: "ai",
|
|
32600
|
+
level: "warning",
|
|
32601
|
+
description: "Repeated \"What makes this work is ...\" or \"The problem is that ...\" setups."
|
|
32602
|
+
}
|
|
32603
|
+
};
|
|
32604
|
+
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;
|
|
32605
|
+
const TECHNICAL = /^(?:comprehensive|ecosystem|streamlin|navigat)/i;
|
|
32606
|
+
function vocabularyCluster(ctx) {
|
|
32607
|
+
const rule = COUNTED_RULES.vocabularyCluster;
|
|
32608
|
+
if (ctx.level(rule) === "off") return;
|
|
32609
|
+
for (const block of ctx.blocks([
|
|
32610
|
+
"paragraph",
|
|
32611
|
+
"list",
|
|
32612
|
+
"quote",
|
|
32613
|
+
"prop",
|
|
32614
|
+
"heading",
|
|
32615
|
+
"description",
|
|
32616
|
+
"title"
|
|
32617
|
+
])) {
|
|
32618
|
+
const seen = /* @__PURE__ */ new Map();
|
|
32619
|
+
TIER2.lastIndex = 0;
|
|
32620
|
+
for (const found of block.norm.matchAll(TIER2)) {
|
|
32621
|
+
const word = found[0].toLowerCase();
|
|
32622
|
+
if (ctx.preset === "docs" && TECHNICAL.test(word)) continue;
|
|
32623
|
+
const stem = word.slice(0, 6);
|
|
32624
|
+
const start = found.index ?? 0;
|
|
32625
|
+
if (ctx.preset === "landing" || ctx.preset === "meta") {
|
|
32626
|
+
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.");
|
|
32627
|
+
continue;
|
|
32628
|
+
}
|
|
32629
|
+
if (!seen.has(stem)) seen.set(stem, start);
|
|
32630
|
+
if (seen.size === 2 && !seen.has(`${stem}!`)) {
|
|
32631
|
+
seen.set(`${stem}!`, start);
|
|
32632
|
+
const listed = [...seen.keys()].filter((key) => !key.endsWith("!"));
|
|
32633
|
+
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.");
|
|
32634
|
+
}
|
|
32635
|
+
}
|
|
32636
|
+
}
|
|
32637
|
+
}
|
|
32638
|
+
const SERIES = /\b[\w'$-]+(?: [\w'$-]+){0,5}(?:, [\w'$-]+(?: [\w'$-]+){0,5}){1,3},? (?:and|or) [\w'$-]+(?: [\w'$-]+){0,5}/g;
|
|
32639
|
+
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;
|
|
32640
|
+
const ECHO = new Set("to our your their my his her its every each more less no it they we you".split(" "));
|
|
32641
|
+
const COPULA = /\b(?:is|are|was|were|'s|feels?|felt|looks?|stays?|remains?|seems?)\s+$/i;
|
|
32642
|
+
function formulaTriad(items, before) {
|
|
32643
|
+
const firsts = items.map((item) => words$2(item)[0]?.toLowerCase() ?? "");
|
|
32644
|
+
const echo = firsts[0] ?? "";
|
|
32645
|
+
if (ECHO.has(echo) && firsts.every((first) => first === echo)) return `Each item opens with "${echo}".`;
|
|
32646
|
+
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.";
|
|
32647
|
+
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\".";
|
|
32648
|
+
if (items.every((item) => /^\w+ed\b/i.test(item) && words$2(item).length <= 3)) return "A string of past participles.";
|
|
32649
|
+
return null;
|
|
32650
|
+
}
|
|
32651
|
+
function triads(ctx) {
|
|
32652
|
+
const rule = COUNTED_RULES.triad;
|
|
32653
|
+
if (ctx.level(rule) === "off") return;
|
|
32654
|
+
for (const block of ctx.blocks([
|
|
32655
|
+
"paragraph",
|
|
32656
|
+
"quote",
|
|
32657
|
+
"prop",
|
|
32658
|
+
"list"
|
|
32659
|
+
])) {
|
|
32660
|
+
const taken = [];
|
|
32661
|
+
ABSTRACT_TRIAD.lastIndex = 0;
|
|
32662
|
+
for (const match of block.norm.matchAll(ABSTRACT_TRIAD)) {
|
|
32663
|
+
const start = match.index ?? 0;
|
|
32664
|
+
taken.push([start, start + match[0].length]);
|
|
32665
|
+
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.");
|
|
32666
|
+
}
|
|
32667
|
+
for (const sentence of ctx.sentences(block)) {
|
|
32668
|
+
SERIES.lastIndex = 0;
|
|
32669
|
+
for (const match of sentence.text.matchAll(SERIES)) {
|
|
32670
|
+
let from = match.index ?? 0;
|
|
32671
|
+
const raw = match[0].split(/,\s*(?:(?:and|or)\s+)?|\s+(?:and|or)\s+(?=[^,]*$)/);
|
|
32672
|
+
if (raw.length < 3) continue;
|
|
32673
|
+
const items = [...raw];
|
|
32674
|
+
const head = raw[0] ?? "";
|
|
32675
|
+
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);
|
|
32676
|
+
if (lead && words$2(head.slice(lead[0].length)).length) {
|
|
32677
|
+
items[0] = head.slice(lead[0].length);
|
|
32678
|
+
from += lead[0].length;
|
|
32679
|
+
}
|
|
32680
|
+
const end = sentence.start + (match.index ?? 0) + match[0].length;
|
|
32681
|
+
const before = block.norm.slice(sentence.start, sentence.start + from);
|
|
32682
|
+
const echo = words$2(raw[1] ?? "")[0]?.toLowerCase() ?? "";
|
|
32683
|
+
const inFirst = new RegExp(`\\b${echo}\\b(?!.*\\b${echo}\\b)`, "i").exec(head);
|
|
32684
|
+
if (ECHO.has(echo) && inFirst && inFirst.index > 0) {
|
|
32685
|
+
items[0] = head.slice(inFirst.index);
|
|
32686
|
+
from = (match.index ?? 0) + inFirst.index;
|
|
32687
|
+
}
|
|
32688
|
+
const plain = formulaTriad(raw, "");
|
|
32689
|
+
const why = plain ?? formulaTriad(items, before);
|
|
32690
|
+
if (!why) continue;
|
|
32691
|
+
if (plain) from = match.index ?? 0;
|
|
32692
|
+
const start = sentence.start + from;
|
|
32693
|
+
if (taken.some(([a, b]) => start < b && end > a)) continue;
|
|
32694
|
+
taken.push([start, end]);
|
|
32695
|
+
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.");
|
|
32696
|
+
}
|
|
32697
|
+
}
|
|
32698
|
+
}
|
|
32699
|
+
}
|
|
32700
|
+
function countedPatterns(ctx) {
|
|
32701
|
+
const labels = COUNTED_RULES.inventedLabel;
|
|
32702
|
+
const clefts = COUNTED_RULES.pseudoCleft;
|
|
32703
|
+
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]]) {
|
|
32704
|
+
if (ctx.level(rule) === "off") continue;
|
|
32705
|
+
const found = [];
|
|
32706
|
+
for (const block of ctx.blocks(RHYTHM_KINDS)) {
|
|
32707
|
+
re.lastIndex = 0;
|
|
32708
|
+
for (const match of block.norm.matchAll(re)) {
|
|
32709
|
+
let start = match.index ?? 0;
|
|
32710
|
+
while (/[\s.!?]/.test(block.norm[start] ?? "")) start++;
|
|
32711
|
+
found.push({
|
|
32712
|
+
block,
|
|
32713
|
+
start,
|
|
32714
|
+
end: (match.index ?? 0) + match[0].length
|
|
32715
|
+
});
|
|
32716
|
+
}
|
|
32717
|
+
}
|
|
32718
|
+
if (found.length < 2) continue;
|
|
32719
|
+
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.");
|
|
32720
|
+
}
|
|
32721
|
+
}
|
|
32722
|
+
function colonDensity(ctx) {
|
|
32723
|
+
const rule = COUNTED_RULES.colonDensity;
|
|
32724
|
+
if (ctx.level(rule) === "off") return;
|
|
32725
|
+
const found = [];
|
|
32726
|
+
for (const block of ctx.blocks(SENTENCE_KINDS)) {
|
|
32727
|
+
const sentences = ctx.sentences(block);
|
|
32728
|
+
for (const match of block.norm.matchAll(/:\s+(?=\S)/g)) {
|
|
32729
|
+
const at = match.index ?? 0;
|
|
32730
|
+
const after = block.norm.slice(at + match[0].length);
|
|
32731
|
+
if (/^["'(]/.test(after)) continue;
|
|
32732
|
+
const lead = block.norm.slice(sentenceAt(sentences, at).start, at);
|
|
32733
|
+
if (words$2(lead).length <= 4 && verbless(lead)) continue;
|
|
32734
|
+
const source = block.map[at] ?? -1;
|
|
32735
|
+
if (/^(?:\*\*|__)/.test(ctx.doc.source.slice(source + 1, source + 3)) || /(?:\*\*|__)$/.test(ctx.doc.source.slice(source - 2, source))) continue;
|
|
32736
|
+
if (block.links.some((link) => link.start <= at && link.end > at)) continue;
|
|
32737
|
+
if (insideQuotes(block.norm, at, at + 1)) continue;
|
|
32738
|
+
const clause = after.match(/^(?:[^.!?;]|[.!?](?=\S)){0,60}/)?.[0] ?? "";
|
|
32739
|
+
found.push({
|
|
32740
|
+
block,
|
|
32741
|
+
start: at,
|
|
32742
|
+
end: at + match[0].length + clause.trimEnd().length
|
|
32743
|
+
});
|
|
32744
|
+
}
|
|
32745
|
+
}
|
|
32746
|
+
if (found.length < 4 || found.length * 1e3 < 3 * ctx.proseWords) return;
|
|
32747
|
+
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.");
|
|
32748
|
+
}
|
|
32749
|
+
// packages/core/src/lint/rules-rhythm.ts
|
|
32750
|
+
const RHYTHM_RULES = {
|
|
32751
|
+
heresAnnouncement: {
|
|
32752
|
+
id: "heres-announcement",
|
|
32753
|
+
family: "ai",
|
|
32754
|
+
level: "error",
|
|
32755
|
+
presets: { docs: "off" },
|
|
32756
|
+
description: "A short \"Here's the X\" sentence that announces what comes next instead of saying it."
|
|
32757
|
+
},
|
|
32758
|
+
pithyFragment: {
|
|
32759
|
+
id: "pithy-fragment",
|
|
32760
|
+
family: "ai",
|
|
32761
|
+
level: "error",
|
|
32762
|
+
description: "Verbless slogan fragments: \"Same essay, two titles.\", \"Every month. No exceptions.\", \"$299 per month. That's it.\""
|
|
32763
|
+
},
|
|
32764
|
+
stockCloser: {
|
|
32765
|
+
id: "stock-closer",
|
|
32766
|
+
family: "ai",
|
|
32767
|
+
level: "error",
|
|
32768
|
+
description: "A stock kicker line: \"That's a real win.\" \"That is what makes this interesting.\" \"That's why X mattered.\""
|
|
32769
|
+
},
|
|
32770
|
+
negativeReframe: {
|
|
32771
|
+
id: "negative-reframe",
|
|
32772
|
+
family: "ai",
|
|
32773
|
+
level: "warning",
|
|
32774
|
+
description: "A short \"That's not how/what ...\" dismissal."
|
|
32775
|
+
},
|
|
32776
|
+
figurativeWorth: {
|
|
32777
|
+
id: "figurative-worth",
|
|
32778
|
+
family: "ai",
|
|
32779
|
+
level: "error",
|
|
32780
|
+
description: "A \"worth + -ing\" idiom that mixes its metaphor or points at the reader: \"a fight worth picking\", \"worth noting\"."
|
|
32781
|
+
},
|
|
32782
|
+
anaphora: {
|
|
32783
|
+
id: "anaphora",
|
|
32784
|
+
family: "ai",
|
|
32785
|
+
level: "error",
|
|
32786
|
+
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 ...\"."
|
|
32787
|
+
}
|
|
32788
|
+
};
|
|
32542
32789
|
function heresAnnouncement(ctx) {
|
|
32543
|
-
const rule =
|
|
32790
|
+
const rule = RHYTHM_RULES.heresAnnouncement;
|
|
32544
32791
|
if (ctx.level(rule) === "off") return;
|
|
32545
32792
|
for (const block of ctx.blocks([
|
|
32546
32793
|
"paragraph",
|
|
@@ -32595,7 +32842,7 @@ function fragmentRuns(ctx, rule) {
|
|
|
32595
32842
|
}
|
|
32596
32843
|
}
|
|
32597
32844
|
function pithyFragment(ctx) {
|
|
32598
|
-
const rule =
|
|
32845
|
+
const rule = RHYTHM_RULES.pithyFragment;
|
|
32599
32846
|
if (ctx.level(rule) === "off") return;
|
|
32600
32847
|
fragmentRuns(ctx, rule);
|
|
32601
32848
|
for (const block of ctx.blocks(RHYTHM_KINDS)) for (const sentence of ctx.sentences(block)) {
|
|
@@ -32618,11 +32865,12 @@ const CLOSERS = [
|
|
|
32618
32865
|
/^(?: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,
|
|
32619
32866
|
/^(?:and |but |so )?(?:that|this)(?:'s| is) (?:why|where|how) (?:it|this|that) (?:matters|counts|works)\.$/i,
|
|
32620
32867
|
/^(?:and |but )?that distinction matters\.$/i,
|
|
32868
|
+
/^(?:and |but |so )?(?:that|this)(?:'s| is| was) (?:why|what|how) [^.]{1,80} (?:mattered|made (?:all )?the difference|paid off)\.$/i,
|
|
32621
32869
|
/^(?:and |but )?(?:that|this)(?:'s| is) (?:huge|everything|the whole thing|what matters|all that matters)\.$/i
|
|
32622
32870
|
];
|
|
32623
32871
|
function stockCloser(ctx) {
|
|
32624
|
-
const rule =
|
|
32625
|
-
const reframe =
|
|
32872
|
+
const rule = RHYTHM_RULES.stockCloser;
|
|
32873
|
+
const reframe = RHYTHM_RULES.negativeReframe;
|
|
32626
32874
|
for (const block of ctx.blocks(RHYTHM_KINDS)) for (const sentence of ctx.sentences(block)) {
|
|
32627
32875
|
const text = sentence.text;
|
|
32628
32876
|
if (CLOSERS.some((re) => re.test(text))) {
|
|
@@ -32634,7 +32882,7 @@ function stockCloser(ctx) {
|
|
|
32634
32882
|
}
|
|
32635
32883
|
const FIGURATIVE_NOUNS = "fights?|battles?|hills?|wars?|bets?|gambles?|races?|risks?|horses?|roads?|bridges?|doors?|games?|ships?|cards?";
|
|
32636
32884
|
function figurativeWorth(ctx) {
|
|
32637
|
-
const rule =
|
|
32885
|
+
const rule = RHYTHM_RULES.figurativeWorth;
|
|
32638
32886
|
const strong = new RegExp(`\\b(?:${FIGURATIVE_NOUNS}) worth \\w+ing\\b`, "gi");
|
|
32639
32887
|
const reader = /\bworth (?:noting|mentioning|knowing|highlighting|calling out|pointing out|flagging|a (?:closer |second )?look)\b/gi;
|
|
32640
32888
|
const any = /\b(\w+) worth (\w+ing)\b/gi;
|
|
@@ -32678,9 +32926,50 @@ function staccato(ctx) {
|
|
|
32678
32926
|
report();
|
|
32679
32927
|
}
|
|
32680
32928
|
}
|
|
32929
|
+
const ORDINALS = [
|
|
32930
|
+
"first",
|
|
32931
|
+
"second",
|
|
32932
|
+
"third",
|
|
32933
|
+
"fourth",
|
|
32934
|
+
"fifth",
|
|
32935
|
+
"sixth"
|
|
32936
|
+
];
|
|
32937
|
+
const ORDINAL_OPENER = /^(?:And |But |So )?The (first|second|third|fourth|fifth|sixth) ([a-z][\w-]*)\b/i;
|
|
32938
|
+
function numberedProse(ctx, rule) {
|
|
32939
|
+
let open = null;
|
|
32940
|
+
const report = (item, endBlock, end) => {
|
|
32941
|
+
const count = item.next;
|
|
32942
|
+
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");
|
|
32943
|
+
};
|
|
32944
|
+
let last = null;
|
|
32945
|
+
for (const block of ctx.blocks(RHYTHM_KINDS)) for (const sentence of ctx.sentences(block)) {
|
|
32946
|
+
const found = ORDINAL_OPENER.exec(sentence.text);
|
|
32947
|
+
if (!found) continue;
|
|
32948
|
+
const ordinal = ORDINALS.indexOf((found[1] ?? "").toLowerCase());
|
|
32949
|
+
const noun = (found[2] ?? "").toLowerCase();
|
|
32950
|
+
if (ordinal === 0) {
|
|
32951
|
+
if (open && open.next >= 3 && last) report(open, last.block, last.end);
|
|
32952
|
+
open = {
|
|
32953
|
+
block,
|
|
32954
|
+
start: sentence.start,
|
|
32955
|
+
next: 1,
|
|
32956
|
+
noun
|
|
32957
|
+
};
|
|
32958
|
+
last = null;
|
|
32959
|
+
} else if (open && ordinal === open.next && noun === open.noun) {
|
|
32960
|
+
open.next++;
|
|
32961
|
+
last = {
|
|
32962
|
+
block,
|
|
32963
|
+
end: sentence.end
|
|
32964
|
+
};
|
|
32965
|
+
}
|
|
32966
|
+
}
|
|
32967
|
+
if (open && open.next >= 3 && last) report(open, last.block, last.end);
|
|
32968
|
+
}
|
|
32681
32969
|
function anaphora(ctx) {
|
|
32682
|
-
const rule =
|
|
32970
|
+
const rule = RHYTHM_RULES.anaphora;
|
|
32683
32971
|
if (ctx.level(rule) === "off") return;
|
|
32972
|
+
numberedProse(ctx, rule);
|
|
32684
32973
|
for (const block of ctx.blocks(RHYTHM_KINDS)) {
|
|
32685
32974
|
const sentences = ctx.sentences(block);
|
|
32686
32975
|
let i = 0;
|
|
@@ -32708,186 +32997,24 @@ function anaphora(ctx) {
|
|
|
32708
32997
|
}
|
|
32709
32998
|
}
|
|
32710
32999
|
}
|
|
32711
|
-
|
|
32712
|
-
const
|
|
32713
|
-
|
|
32714
|
-
|
|
32715
|
-
|
|
32716
|
-
|
|
32717
|
-
|
|
32718
|
-
|
|
32719
|
-
|
|
32720
|
-
|
|
32721
|
-
|
|
32722
|
-
|
|
32723
|
-
|
|
32724
|
-
|
|
32725
|
-
|
|
32726
|
-
|
|
32727
|
-
|
|
32728
|
-
|
|
32729
|
-
if (ctx.preset === "docs" && TECHNICAL.test(word)) continue;
|
|
32730
|
-
const stem = word.slice(0, 6);
|
|
32731
|
-
const start = found.index ?? 0;
|
|
32732
|
-
if (ctx.preset === "landing" || ctx.preset === "meta") {
|
|
32733
|
-
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.");
|
|
32734
|
-
continue;
|
|
32735
|
-
}
|
|
32736
|
-
if (!seen.has(stem)) seen.set(stem, start);
|
|
32737
|
-
if (seen.size === 2 && !seen.has(`${stem}!`)) {
|
|
32738
|
-
seen.set(`${stem}!`, start);
|
|
32739
|
-
const listed = [...seen.keys()].filter((key) => !key.endsWith("!"));
|
|
32740
|
-
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.");
|
|
32741
|
-
}
|
|
32742
|
-
}
|
|
32743
|
-
}
|
|
32744
|
-
}
|
|
32745
|
-
const SERIES = /\b[\w'$-]+(?: [\w'$-]+){0,5}(?:, [\w'$-]+(?: [\w'$-]+){0,5}){1,3},? (?:and|or) [\w'$-]+(?: [\w'$-]+){0,5}/g;
|
|
32746
|
-
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;
|
|
32747
|
-
const ECHO = new Set("to our your their my his her its every each more less no it they we you".split(" "));
|
|
32748
|
-
const COPULA = /\b(?:is|are|was|were|'s|feels?|felt|looks?|stays?|remains?|seems?)\s+$/i;
|
|
32749
|
-
function formulaTriad(items, before) {
|
|
32750
|
-
const firsts = items.map((item) => words$2(item)[0]?.toLowerCase() ?? "");
|
|
32751
|
-
const echo = firsts[0] ?? "";
|
|
32752
|
-
if (ECHO.has(echo) && firsts.every((first) => first === echo)) return `Each item opens with "${echo}".`;
|
|
32753
|
-
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.";
|
|
32754
|
-
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\".";
|
|
32755
|
-
if (items.every((item) => /^\w+ed\b/i.test(item) && words$2(item).length <= 3)) return "A string of past participles.";
|
|
32756
|
-
return null;
|
|
32757
|
-
}
|
|
32758
|
-
function triads(ctx) {
|
|
32759
|
-
const rule = STRUCTURE_RULES.triad;
|
|
32760
|
-
if (ctx.level(rule) === "off") return;
|
|
32761
|
-
for (const block of ctx.blocks([
|
|
32762
|
-
"paragraph",
|
|
32763
|
-
"quote",
|
|
32764
|
-
"prop",
|
|
32765
|
-
"list"
|
|
32766
|
-
])) {
|
|
32767
|
-
const taken = [];
|
|
32768
|
-
ABSTRACT_TRIAD.lastIndex = 0;
|
|
32769
|
-
for (const match of block.norm.matchAll(ABSTRACT_TRIAD)) {
|
|
32770
|
-
const start = match.index ?? 0;
|
|
32771
|
-
taken.push([start, start + match[0].length]);
|
|
32772
|
-
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.");
|
|
32773
|
-
}
|
|
32774
|
-
for (const sentence of ctx.sentences(block)) {
|
|
32775
|
-
SERIES.lastIndex = 0;
|
|
32776
|
-
for (const match of sentence.text.matchAll(SERIES)) {
|
|
32777
|
-
let from = match.index ?? 0;
|
|
32778
|
-
const raw = match[0].split(/,\s*(?:(?:and|or)\s+)?|\s+(?:and|or)\s+(?=[^,]*$)/);
|
|
32779
|
-
if (raw.length < 3) continue;
|
|
32780
|
-
const items = [...raw];
|
|
32781
|
-
const head = raw[0] ?? "";
|
|
32782
|
-
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);
|
|
32783
|
-
if (lead && words$2(head.slice(lead[0].length)).length) {
|
|
32784
|
-
items[0] = head.slice(lead[0].length);
|
|
32785
|
-
from += lead[0].length;
|
|
32786
|
-
}
|
|
32787
|
-
const end = sentence.start + (match.index ?? 0) + match[0].length;
|
|
32788
|
-
const before = block.norm.slice(sentence.start, sentence.start + from);
|
|
32789
|
-
const echo = words$2(raw[1] ?? "")[0]?.toLowerCase() ?? "";
|
|
32790
|
-
const inFirst = new RegExp(`\\b${echo}\\b(?!.*\\b${echo}\\b)`, "i").exec(head);
|
|
32791
|
-
if (ECHO.has(echo) && inFirst && inFirst.index > 0) {
|
|
32792
|
-
items[0] = head.slice(inFirst.index);
|
|
32793
|
-
from = (match.index ?? 0) + inFirst.index;
|
|
32794
|
-
}
|
|
32795
|
-
const plain = formulaTriad(raw, "");
|
|
32796
|
-
const why = plain ?? formulaTriad(items, before);
|
|
32797
|
-
if (!why) continue;
|
|
32798
|
-
if (plain) from = match.index ?? 0;
|
|
32799
|
-
const start = sentence.start + from;
|
|
32800
|
-
if (taken.some(([a, b]) => start < b && end > a)) continue;
|
|
32801
|
-
taken.push([start, end]);
|
|
32802
|
-
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.");
|
|
32803
|
-
}
|
|
32804
|
-
}
|
|
32805
|
-
}
|
|
32806
|
-
}
|
|
32807
|
-
function countedPatterns(ctx) {
|
|
32808
|
-
const labels = STRUCTURE_RULES.inventedLabel;
|
|
32809
|
-
const clefts = STRUCTURE_RULES.pseudoCleft;
|
|
32810
|
-
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]]) {
|
|
32811
|
-
if (ctx.level(rule) === "off") continue;
|
|
32812
|
-
const found = [];
|
|
32813
|
-
for (const block of ctx.blocks(RHYTHM_KINDS)) {
|
|
32814
|
-
re.lastIndex = 0;
|
|
32815
|
-
for (const match of block.norm.matchAll(re)) {
|
|
32816
|
-
let start = match.index ?? 0;
|
|
32817
|
-
while (/[\s.!?]/.test(block.norm[start] ?? "")) start++;
|
|
32818
|
-
found.push({
|
|
32819
|
-
block,
|
|
32820
|
-
start,
|
|
32821
|
-
end: (match.index ?? 0) + match[0].length
|
|
32822
|
-
});
|
|
32823
|
-
}
|
|
32824
|
-
}
|
|
32825
|
-
if (found.length < 2) continue;
|
|
32826
|
-
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.");
|
|
32827
|
-
}
|
|
32828
|
-
}
|
|
32829
|
-
function boldLabels(ctx) {
|
|
32830
|
-
const rule = STRUCTURE_RULES.boldLabels;
|
|
32831
|
-
if (ctx.level(rule) === "off") return;
|
|
32832
|
-
if (ctx.doc.format !== "md" && ctx.doc.format !== "mdx") return;
|
|
32833
|
-
const lists = ctx.blocks(["list"]);
|
|
32834
|
-
let run = [];
|
|
32835
|
-
const report = () => {
|
|
32836
|
-
if (run.length >= 3) {
|
|
32837
|
-
const first = run[0];
|
|
32838
|
-
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.");
|
|
32839
|
-
}
|
|
32840
|
-
run = [];
|
|
32841
|
-
};
|
|
32842
|
-
let previous = null;
|
|
32843
|
-
for (const block of lists) {
|
|
32844
|
-
const offset = block.map[0] ?? 0;
|
|
32845
|
-
const line = ctx.doc.source.lastIndexOf("\n", offset) + 1;
|
|
32846
|
-
const raw = ctx.doc.source.slice(line, offset + 4);
|
|
32847
|
-
const bold = /^\s*(?:[-*+]|\d{1,9}[.)])\s+(?:\*\*|__)/.test(raw);
|
|
32848
|
-
const adjacent = previous !== null && ctx.doc.blocks.indexOf(block) === ctx.doc.blocks.indexOf(previous) + 1;
|
|
32849
|
-
if (!bold || !adjacent) report();
|
|
32850
|
-
if (bold) run.push(block);
|
|
32851
|
-
previous = block;
|
|
32852
|
-
}
|
|
32853
|
-
report();
|
|
32854
|
-
}
|
|
32855
|
-
function boldEmphasis(ctx) {
|
|
32856
|
-
const rule = STRUCTURE_RULES.boldEmphasis;
|
|
32857
|
-
if (ctx.level(rule) === "off") return;
|
|
32858
|
-
const markdown = ctx.doc.format === "md" || ctx.doc.format === "mdx";
|
|
32859
|
-
const re = markdown ? /(\*\*|__)(?=\S)[^*_\n]+?\1/g : /<(strong|b)\b[^>]*>[^<]{1,200}<\/\1>/gi;
|
|
32860
|
-
const prose = ctx.blocks([
|
|
32861
|
-
"paragraph",
|
|
32862
|
-
"list",
|
|
32863
|
-
"quote",
|
|
32864
|
-
"prop"
|
|
32865
|
-
]);
|
|
32866
|
-
const spans = [];
|
|
32867
|
-
for (const found of ctx.doc.source.matchAll(re)) {
|
|
32868
|
-
const open = markdown ? 2 : found[0].indexOf(">") + 1;
|
|
32869
|
-
const from = (found.index ?? 0) + open;
|
|
32870
|
-
const to = (found.index ?? 0) + found[0].length - (markdown ? 2 : found[0].length - found[0].lastIndexOf("<"));
|
|
32871
|
-
for (const block of prose) {
|
|
32872
|
-
const first = block.map[0] ?? 0;
|
|
32873
|
-
const last = block.map[block.map.length - 1] ?? 0;
|
|
32874
|
-
if (from < first || from > last) continue;
|
|
32875
|
-
const start = block.map.indexOf(from);
|
|
32876
|
-
if (start <= 0 && block.kind === "list") break;
|
|
32877
|
-
if (start < 0) break;
|
|
32878
|
-
let end = start;
|
|
32879
|
-
while (end < block.map.length && (block.map[end] ?? 0) < to) end++;
|
|
32880
|
-
spans.push({
|
|
32881
|
-
block,
|
|
32882
|
-
start,
|
|
32883
|
-
end
|
|
32884
|
-
});
|
|
32885
|
-
break;
|
|
32886
|
-
}
|
|
32887
|
-
}
|
|
32888
|
-
if (spans.length < 3 || spans.length * 100 <= ctx.proseWords) return;
|
|
32889
|
-
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.");
|
|
32890
|
-
}
|
|
33000
|
+
// packages/core/src/lint/rules-structure.ts
|
|
33001
|
+
const STRUCTURE_RULES = {
|
|
33002
|
+
negativeParallelism: CONTRAST_RULES.negativeParallelism,
|
|
33003
|
+
contrastReframe: CONTRAST_RULES.contrastReframe,
|
|
33004
|
+
heresAnnouncement: RHYTHM_RULES.heresAnnouncement,
|
|
33005
|
+
pithyFragment: RHYTHM_RULES.pithyFragment,
|
|
33006
|
+
stockCloser: RHYTHM_RULES.stockCloser,
|
|
33007
|
+
negativeReframe: RHYTHM_RULES.negativeReframe,
|
|
33008
|
+
figurativeWorth: RHYTHM_RULES.figurativeWorth,
|
|
33009
|
+
anaphora: RHYTHM_RULES.anaphora,
|
|
33010
|
+
vocabularyCluster: COUNTED_RULES.vocabularyCluster,
|
|
33011
|
+
triad: COUNTED_RULES.triad,
|
|
33012
|
+
inventedLabel: COUNTED_RULES.inventedLabel,
|
|
33013
|
+
colonDensity: COUNTED_RULES.colonDensity,
|
|
33014
|
+
pseudoCleft: COUNTED_RULES.pseudoCleft,
|
|
33015
|
+
boldEmphasis: BOLD_RULES.boldEmphasis,
|
|
33016
|
+
boldLabels: BOLD_RULES.boldLabels
|
|
33017
|
+
};
|
|
32891
33018
|
function runStructureRules(ctx) {
|
|
32892
33019
|
negativeParallelism(ctx);
|
|
32893
33020
|
contrastReframe(ctx);
|
|
@@ -32900,6 +33027,7 @@ function runStructureRules(ctx) {
|
|
|
32900
33027
|
vocabularyCluster(ctx);
|
|
32901
33028
|
triads(ctx);
|
|
32902
33029
|
countedPatterns(ctx);
|
|
33030
|
+
colonDensity(ctx);
|
|
32903
33031
|
boldLabels(ctx);
|
|
32904
33032
|
boldEmphasis(ctx);
|
|
32905
33033
|
}
|
|
@@ -35143,7 +35271,7 @@ async function analyticsBeside(access, site, range, before, pages) {
|
|
|
35143
35271
|
}
|
|
35144
35272
|
// packages/core/src/commands/audit.ts
|
|
35145
35273
|
const AUDIT_SECTION = "weekly-audit";
|
|
35146
|
-
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
|
|
35274
|
+
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.";
|
|
35147
35275
|
const AUDIT_RULES = {
|
|
35148
35276
|
link_to_error: "Internal links to a page that returns an error",
|
|
35149
35277
|
link_to_redirect: "Internal links to a redirect",
|
|
@@ -39232,11 +39360,11 @@ async function runAllSites(deps, sites) {
|
|
|
39232
39360
|
if (!data && sites) {
|
|
39233
39361
|
const list = await sites();
|
|
39234
39362
|
return {
|
|
39235
|
-
text: `No site given. Pick one below and send it: ${deps.call("report", { site: "<site>" })}. The summary of every site is for accounts
|
|
39363
|
+
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}`,
|
|
39236
39364
|
data: list.data
|
|
39237
39365
|
};
|
|
39238
39366
|
}
|
|
39239
|
-
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
|
|
39367
|
+
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.`);
|
|
39240
39368
|
const startMs = Date.parse(`${data.start}T00:00:00Z`);
|
|
39241
39369
|
const endMs = Date.parse(`${data.end}T00:00:00Z`) + DAY_MS;
|
|
39242
39370
|
const urgency = (site) => issues(site, startMs, endMs)[0]?.rank ?? Number.POSITIVE_INFINITY;
|
|
@@ -39331,9 +39459,9 @@ const SHARED_TOOLS = [
|
|
|
39331
39459
|
name: "seo_report",
|
|
39332
39460
|
command: "report",
|
|
39333
39461
|
title: "Search Console report",
|
|
39334
|
-
description: `Start here. Without site: a short summary of every site in the person's weekly site audit
|
|
39462
|
+
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.`,
|
|
39335
39463
|
input: z.object({
|
|
39336
|
-
site: site.optional().describe("Leave it out for the summary of every
|
|
39464
|
+
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."),
|
|
39337
39465
|
section: z.enum([
|
|
39338
39466
|
...SECTION_IDS,
|
|
39339
39467
|
ISSUES_SECTION,
|
|
@@ -39582,7 +39710,7 @@ function indexFromStore(shared) {
|
|
|
39582
39710
|
const paged = "detail" in shared.input.shape;
|
|
39583
39711
|
return {
|
|
39584
39712
|
...shared,
|
|
39585
|
-
description: `${shared.description} For a site in the weekly site audit
|
|
39713
|
+
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.`,
|
|
39586
39714
|
run: async (surface, parsed) => {
|
|
39587
39715
|
const input = parsed;
|
|
39588
39716
|
const audit = surface.deps.audit;
|