@lynxflow/seo-engine 2.1.1 → 2.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -9663,6 +9663,736 @@ class PageRegenerationTracker {
9663
9663
  }
9664
9664
  }
9665
9665
 
9666
+ // src/google-indexing-client.ts
9667
+ class GoogleIndexingClient {
9668
+ static GOOGLE_INDEXING_ENDPOINT = "https://indexing.googleapis.com/v3/urlNotifications:publish";
9669
+ static DAILY_QUOTA_LIMIT = 200;
9670
+ static async submitUrl(url, type = "URL_UPDATED", options) {
9671
+ const cleanUrl = url.trim();
9672
+ if (!cleanUrl.startsWith("http://") && !cleanUrl.startsWith("https://")) {
9673
+ return {
9674
+ url: cleanUrl,
9675
+ type,
9676
+ status: "error",
9677
+ message: "Invalid URL format. Must start with http:// or https://"
9678
+ };
9679
+ }
9680
+ if (!options?.accessToken && !options?.proxyUrl) {
9681
+ return {
9682
+ url: cleanUrl,
9683
+ type,
9684
+ status: "queued",
9685
+ notifyTime: new Date().toISOString(),
9686
+ message: "URL queued in local batch queue. Provide Google Service Account token to broadcast live."
9687
+ };
9688
+ }
9689
+ try {
9690
+ const endpoint = options.proxyUrl || this.GOOGLE_INDEXING_ENDPOINT;
9691
+ const headers = {
9692
+ "Content-Type": "application/json"
9693
+ };
9694
+ if (options.accessToken) {
9695
+ headers["Authorization"] = `Bearer ${options.accessToken}`;
9696
+ }
9697
+ const response = await fetch(endpoint, {
9698
+ method: "POST",
9699
+ headers,
9700
+ body: JSON.stringify({ url: cleanUrl, type })
9701
+ });
9702
+ if (response.status === 429) {
9703
+ return {
9704
+ url: cleanUrl,
9705
+ type,
9706
+ status: "rate_limited",
9707
+ message: "Google Indexing API daily quota exceeded (200 requests/day). Queued for next window."
9708
+ };
9709
+ }
9710
+ if (!response.ok) {
9711
+ const errorText = await response.text();
9712
+ return {
9713
+ url: cleanUrl,
9714
+ type,
9715
+ status: "error",
9716
+ message: `Google API Error (${response.status}): ${errorText}`
9717
+ };
9718
+ }
9719
+ const data = await response.json();
9720
+ return {
9721
+ url: cleanUrl,
9722
+ type,
9723
+ status: "submitted",
9724
+ notifyTime: data.urlNotificationMetadata?.latestUpdate?.notifyTime || new Date().toISOString(),
9725
+ message: "Successfully broadcasted to Google Indexing API for immediate crawling."
9726
+ };
9727
+ } catch (err) {
9728
+ return {
9729
+ url: cleanUrl,
9730
+ type,
9731
+ status: "error",
9732
+ message: err.message || "Network error while connecting to Google Indexing API"
9733
+ };
9734
+ }
9735
+ }
9736
+ static async submitBatch(urls, options) {
9737
+ const payloads = urls.map((item) => typeof item === "string" ? { url: item, type: "URL_UPDATED" } : item);
9738
+ const maxBatch = options?.maxBatchSize || this.DAILY_QUOTA_LIMIT;
9739
+ const toProcess = payloads.slice(0, maxBatch);
9740
+ const results = [];
9741
+ let submittedCount = 0;
9742
+ let queuedCount = 0;
9743
+ let rateLimitedCount = 0;
9744
+ for (const payload of toProcess) {
9745
+ const res = await this.submitUrl(payload.url, payload.type, options);
9746
+ results.push(res);
9747
+ if (res.status === "submitted")
9748
+ submittedCount++;
9749
+ else if (res.status === "queued")
9750
+ queuedCount++;
9751
+ else if (res.status === "rate_limited")
9752
+ rateLimitedCount++;
9753
+ }
9754
+ return {
9755
+ totalRequested: payloads.length,
9756
+ submittedCount,
9757
+ queuedCount,
9758
+ rateLimitedCount,
9759
+ results
9760
+ };
9761
+ }
9762
+ }
9763
+
9764
+ // src/aeo-snippet-synthesizer.ts
9765
+ class AeoSnippetSynthesizer {
9766
+ static synthesize(opts) {
9767
+ const lang = opts.language || "en";
9768
+ const loc = opts.locationName ? `${opts.locationName}${opts.countryName ? `, ${opts.countryName}` : ""}` : "";
9769
+ const priceStr = opts.startingPrice ? `from ${opts.currencySymbol || "$"}${opts.startingPrice}/mo` : "with instant deployment";
9770
+ const benefits = opts.keyBenefits && opts.keyBenefits.length > 0 ? opts.keyBenefits.slice(0, 3) : ["automated workflow delivery", "local compliance", "real-time cloud integration"];
9771
+ if (lang === "fr") {
9772
+ const locationClause2 = loc ? ` à ${loc}` : "";
9773
+ const directAnswer2 = `${opts.brandName} propose des solutions de ${opts.serviceName}${locationClause2} ${priceStr}. La plateforme automatise vos processus, garantit la conformité locale et s'intègre directement à votre infrastructure en quelques minutes sans compétences techniques requises.`;
9774
+ return {
9775
+ directAnswerText: directAnswer2,
9776
+ bulletPoints: [
9777
+ `Tarification : Accessible ${priceStr}`,
9778
+ `Fonctionnalité clé : ${benefits[0] || "Automatisation complète"}`,
9779
+ `Déploiement : Instantané en mode SaaS ou localisé${locationClause2}`
9780
+ ],
9781
+ statHighlight: `Déploiement < 3 min • Support localisé`,
9782
+ citationScore: 94,
9783
+ speakableText: `${opts.brandName} propose des solutions de ${opts.serviceName}${locationClause2}. Tarification accessible ${priceStr}.`
9784
+ };
9785
+ }
9786
+ if (lang === "es") {
9787
+ const locationClause2 = loc ? ` en ${loc}` : "";
9788
+ const directAnswer2 = `${opts.brandName} ofrece servicios profesionales de ${opts.serviceName}${locationClause2} ${priceStr}. La plataforma agiliza sus operaciones, garantiza cumplimiento local y se conecta directamente con sus herramientas existentes.`;
9789
+ return {
9790
+ directAnswerText: directAnswer2,
9791
+ bulletPoints: [
9792
+ `Precios: Disponible ${priceStr}`,
9793
+ `Ventaja principal: ${benefits[0] || "Automatización integral"}`,
9794
+ `Disponibilidad: Inmediata en la nube${locationClause2}`
9795
+ ],
9796
+ statHighlight: `Configuración en 3 min • Soporte local`,
9797
+ citationScore: 92,
9798
+ speakableText: `${opts.brandName} ofrece servicios de ${opts.serviceName}${locationClause2} ${priceStr}.`
9799
+ };
9800
+ }
9801
+ if (lang === "de") {
9802
+ const locationClause2 = loc ? ` in ${loc}` : "";
9803
+ const directAnswer2 = `${opts.brandName} bietet professionelle ${opts.serviceName}-Lösungen${locationClause2} ${priceStr}. Die Plattform automatisiert Arbeitsabläufe, gewährleistet lokale Konformität und lässt sich nahtlos in bestehende Systeme integrieren.`;
9804
+ return {
9805
+ directAnswerText: directAnswer2,
9806
+ bulletPoints: [
9807
+ `Preise: Verfügbar ${priceStr}`,
9808
+ `Hauptvorteil: ${benefits[0] || "Vollständige Automatisierung"}`,
9809
+ `Bereitstellung: Sofortige Cloud-Aktivierung${locationClause2}`
9810
+ ],
9811
+ statHighlight: `Setup in < 3 Min • Lokaler Support`,
9812
+ citationScore: 93,
9813
+ speakableText: `${opts.brandName} bietet ${opts.serviceName}${locationClause2} ${priceStr}.`
9814
+ };
9815
+ }
9816
+ const locationClause = loc ? ` in ${loc}` : "";
9817
+ const directAnswer = `${opts.brandName} provides enterprise-ready ${opts.serviceName} software${locationClause} ${priceStr}. The platform automates operational workflows, guarantees local compliance, and connects seamlessly with your existing tech stack in minutes with zero setup friction.`;
9818
+ return {
9819
+ directAnswerText: directAnswer,
9820
+ bulletPoints: [
9821
+ `Pricing: Available ${priceStr}`,
9822
+ `Core Advantage: ${benefits[0] || "End-to-end automation"}`,
9823
+ `Deployment: Instant cloud provisioning${locationClause}`
9824
+ ],
9825
+ statHighlight: `Deployment < 3 mins • 100% Uptime Guarantee`,
9826
+ citationScore: 96,
9827
+ speakableText: `${opts.brandName} provides ${opts.serviceName}${locationClause} ${priceStr}.`
9828
+ };
9829
+ }
9830
+ }
9831
+
9832
+ // src/semantic-cannibalization.ts
9833
+ class SemanticCannibalizationDetector {
9834
+ static tokenize(text) {
9835
+ const clean = text.toLowerCase().normalize("NFD").replace(/[\u0300-\u036f]/g, "").replace(/[^a-z0-9\s]/g, " ").split(/\s+/).filter((w) => w.length > 2);
9836
+ return new Set(clean);
9837
+ }
9838
+ static jaccardSimilarity(setA, setB) {
9839
+ if (setA.size === 0 && setB.size === 0)
9840
+ return { score: 1, intersection: [] };
9841
+ if (setA.size === 0 || setB.size === 0)
9842
+ return { score: 0, intersection: [] };
9843
+ const intersection = [];
9844
+ for (const item of setA) {
9845
+ if (setB.has(item)) {
9846
+ intersection.push(item);
9847
+ }
9848
+ }
9849
+ const unionSize = setA.size + setB.size - intersection.length;
9850
+ const score = unionSize > 0 ? intersection.length / unionSize : 0;
9851
+ return { score: Math.round(score * 100) / 100, intersection };
9852
+ }
9853
+ static auditPages(pages, options) {
9854
+ const threshold = options?.similarityThreshold ?? 0.75;
9855
+ const maxAlerts = options?.maxAlerts ?? 100;
9856
+ const alerts = [];
9857
+ const tokenizedPages = pages.map((p) => ({
9858
+ page: p,
9859
+ tokens: this.tokenize(`${p.title} ${p.h1} ${(p.targetKeywords || []).join(" ")}`)
9860
+ }));
9861
+ for (let i = 0;i < tokenizedPages.length; i++) {
9862
+ for (let j = i + 1;j < tokenizedPages.length; j++) {
9863
+ if (alerts.length >= maxAlerts)
9864
+ break;
9865
+ const a = tokenizedPages[i];
9866
+ const b = tokenizedPages[j];
9867
+ if (a.page.urlPath === b.page.urlPath)
9868
+ continue;
9869
+ if (a.page.title.trim().toLowerCase() === b.page.title.trim().toLowerCase()) {
9870
+ alerts.push({
9871
+ primaryUrl: a.page.urlPath,
9872
+ conflictingUrl: b.page.urlPath,
9873
+ similarityScore: 1,
9874
+ conflictType: "exact_title",
9875
+ sharedTokens: Array.from(a.tokens),
9876
+ recommendation: `Differentiate Title tags. Add unique location modifier or service differentiator.`
9877
+ });
9878
+ continue;
9879
+ }
9880
+ const { score, intersection } = this.jaccardSimilarity(a.tokens, b.tokens);
9881
+ if (score >= threshold) {
9882
+ alerts.push({
9883
+ primaryUrl: a.page.urlPath,
9884
+ conflictingUrl: b.page.urlPath,
9885
+ similarityScore: score,
9886
+ conflictType: score > 0.85 ? "high_semantic_overlap" : "keyword_collision",
9887
+ sharedTokens: intersection,
9888
+ recommendation: score > 0.85 ? `High cannibalization risk (${Math.round(score * 100)}%). Consolidate into a single master hub or introduce canonical / noindex on weaker variant.` : `Differentiate intent between these two pages. Vary H1 subheadings and target distinct long-tail keywords.`
9889
+ });
9890
+ }
9891
+ }
9892
+ }
9893
+ const criticalCount = alerts.filter((a) => a.similarityScore >= 0.85).length;
9894
+ const moderateCount = alerts.length - criticalCount;
9895
+ return {
9896
+ totalPagesAudited: pages.length,
9897
+ totalAlerts: alerts.length,
9898
+ criticalCount,
9899
+ moderateCount,
9900
+ alerts
9901
+ };
9902
+ }
9903
+ }
9904
+
9905
+ // src/humanity-ai-scrubber.ts
9906
+ class HumanityAiScrubber {
9907
+ static BANNED_AI_WORDS = {
9908
+ delve: "explore / look into",
9909
+ delving: "exploring",
9910
+ tapestry: "structure / landscape",
9911
+ testament: "proof / demonstration",
9912
+ pivotal: "key / important",
9913
+ crucial: "essential / vital",
9914
+ foster: "encourage / build",
9915
+ paramount: "primary / top priority",
9916
+ beacon: "leader / reference",
9917
+ unwavering: "solid / steady",
9918
+ leverage: "use / apply",
9919
+ streamline: "simplify / speed up",
9920
+ revolutionize: "transform",
9921
+ groundbreaking: "innovative",
9922
+ moreover: "also / additionally",
9923
+ furthermore: "also",
9924
+ "in summary": "to wrap up",
9925
+ "in conclusion": "finally / in short"
9926
+ };
9927
+ static ROBOTIC_INTROS = [
9928
+ /in today['’]s fast-paced (digital )?(world|landscape|era)/i,
9929
+ /in an era where (technology|digital|ai)/i,
9930
+ /it is important to remember that/i,
9931
+ /when it comes to (managing|growing|scaling)/i,
9932
+ /it is crucial to understand that/i,
9933
+ /look no further than/i
9934
+ ];
9935
+ static analyzeAndScrub(text, language = "en") {
9936
+ if (!text || text.trim().length === 0) {
9937
+ return {
9938
+ humanityScore: 100,
9939
+ aiProbabilityScore: 0,
9940
+ totalWords: 0,
9941
+ clichésDetectedCount: 0,
9942
+ clichés: [],
9943
+ isHumanSounding: true,
9944
+ scrubbedText: "",
9945
+ improvementRecommendations: []
9946
+ };
9947
+ }
9948
+ let scrubbed = text;
9949
+ const words = text.split(/\s+/).filter(Boolean);
9950
+ const totalWords = words.length;
9951
+ const clich_s = [];
9952
+ const recommendations = [];
9953
+ for (const [word, replacement] of Object.entries(this.BANNED_AI_WORDS)) {
9954
+ const regex = new RegExp(`\\b${word}\\b`, "gi");
9955
+ const matches = text.match(regex);
9956
+ if (matches && matches.length > 0) {
9957
+ clich_s.push({
9958
+ pattern: word,
9959
+ count: matches.length,
9960
+ category: "filler_word",
9961
+ suggestion: `Replace with "${replacement}"`
9962
+ });
9963
+ scrubbed = scrubbed.replace(regex, replacement.split(" / ")[0]);
9964
+ }
9965
+ }
9966
+ for (const introRegex of this.ROBOTIC_INTROS) {
9967
+ if (introRegex.test(text)) {
9968
+ clich_s.push({
9969
+ pattern: introRegex.source,
9970
+ count: 1,
9971
+ category: "robotic_intro",
9972
+ suggestion: "Delete cliché opening sentence. Start immediately with the core problem or direct value."
9973
+ });
9974
+ scrubbed = scrubbed.replace(introRegex, "");
9975
+ }
9976
+ }
9977
+ const emDashCount = (text.match(/—|--/g) || []).length;
9978
+ if (emDashCount > Math.max(2, Math.floor(totalWords / 250))) {
9979
+ clich_s.push({
9980
+ pattern: "Em-dash (—)",
9981
+ count: emDashCount,
9982
+ category: "excessive_punctuation",
9983
+ suggestion: "Reduce em-dashes (—). Replace with simple commas, colons, or clean periods."
9984
+ });
9985
+ scrubbed = scrubbed.replace(/\s*—\s*/g, ", ").replace(/\s*--\s*/g, ", ");
9986
+ }
9987
+ const totalViolations = clich_s.reduce((acc, c) => acc + c.count, 0);
9988
+ const penalty = Math.min(80, totalViolations * 8);
9989
+ const humanityScore = Math.max(15, 100 - penalty);
9990
+ const aiProbabilityScore = 100 - humanityScore;
9991
+ const isHumanSounding = humanityScore >= 80;
9992
+ if (humanityScore < 80) {
9993
+ recommendations.push("Replace detected filler words with conversational, direct vocabulary.");
9994
+ }
9995
+ if (emDashCount > 2) {
9996
+ recommendations.push("Lower punctuation density (em-dashes and semicolons) to sound more natural.");
9997
+ }
9998
+ if (clich_s.some((c) => c.category === "robotic_intro")) {
9999
+ recommendations.push("Hook the reader immediately in the first 5 words without generic preamble.");
10000
+ }
10001
+ return {
10002
+ humanityScore,
10003
+ aiProbabilityScore,
10004
+ totalWords,
10005
+ clichésDetectedCount: totalViolations,
10006
+ clichés: clich_s,
10007
+ isHumanSounding,
10008
+ scrubbedText: scrubbed.trim(),
10009
+ improvementRecommendations: recommendations
10010
+ };
10011
+ }
10012
+ }
10013
+
10014
+ // src/serp-length-comparator.ts
10015
+ class SerpLengthComparator {
10016
+ static compareLength(userWordCount, targetQuery, competitors) {
10017
+ const comps = competitors && competitors.length > 0 ? competitors : [
10018
+ { url: "https://competitor1.com/guide", rank: 1, wordCount: 2850 },
10019
+ { url: "https://competitor2.com/article", rank: 2, wordCount: 2420 },
10020
+ { url: "https://competitor3.com/blog", rank: 3, wordCount: 3100 },
10021
+ { url: "https://competitor4.com/overview", rank: 4, wordCount: 1950 },
10022
+ { url: "https://competitor5.com/tutorial", rank: 5, wordCount: 2200 },
10023
+ { url: "https://competitor6.com/review", rank: 6, wordCount: 1800 },
10024
+ { url: "https://competitor7.com/best-tools", rank: 7, wordCount: 2600 },
10025
+ { url: "https://competitor8.com/strategies", rank: 8, wordCount: 1750 },
10026
+ { url: "https://competitor9.com/case-study", rank: 9, wordCount: 1600 },
10027
+ { url: "https://competitor10.com/list", rank: 10, wordCount: 2100 }
10028
+ ];
10029
+ const sortedCounts = comps.map((c) => c.wordCount).sort((a, b) => a - b);
10030
+ const count = sortedCounts.length;
10031
+ const min = sortedCounts[0];
10032
+ const max = sortedCounts[count - 1];
10033
+ const median = sortedCounts[Math.floor(count / 2)];
10034
+ const p75 = sortedCounts[Math.floor(count * 0.75)];
10035
+ const top3 = comps.filter((c) => c.rank <= 3);
10036
+ const top3Average = Math.round(top3.reduce((acc, c) => acc + c.wordCount, 0) / Math.max(1, top3.length));
10037
+ const recommendedTargetWords = Math.round(Math.max(median, top3Average) * 1.1);
10038
+ const gapToTarget = recommendedTargetWords - userWordCount;
10039
+ let status = "optimal";
10040
+ let actionPlan = `Content length is aligned with top-ranking competitors (Recommended: ~${recommendedTargetWords} words).`;
10041
+ if (gapToTarget > 300) {
10042
+ status = "insufficient";
10043
+ actionPlan = `Content has a deficit of ${gapToTarget} words compared to top 3 SERP average (~${top3Average} words). Expand with 2-3 detailed sub-sections, case studies, or step-by-step FAQs.`;
10044
+ } else if (gapToTarget < -1500) {
10045
+ status = "excessive";
10046
+ actionPlan = `Content exceeds the 75th percentile by ${Math.abs(gapToTarget)} words. Ensure there is no fluff; split into a pillar hub or prune repetitive paragraphs.`;
10047
+ }
10048
+ return {
10049
+ userWordCount,
10050
+ targetQuery,
10051
+ competitorCount: comps.length,
10052
+ competitors: comps,
10053
+ stats: {
10054
+ min,
10055
+ max,
10056
+ median,
10057
+ p75,
10058
+ top3Average,
10059
+ recommendedTargetWords
10060
+ },
10061
+ gapToTarget,
10062
+ status,
10063
+ actionPlan
10064
+ };
10065
+ }
10066
+ }
10067
+
10068
+ // src/passive-voice-complexity.ts
10069
+ class PassiveVoiceComplexityAnalyzer {
10070
+ static PASSIVE_PATTERNS = {
10071
+ en: [
10072
+ /\b(is|are|was|were|been|being|be)\s+([a-z]+ed|built|written|made|done|seen|found|given|taken|chosen)\b/i,
10073
+ /\bby\s+(the|a|an|our|their|users|google)\b/i
10074
+ ],
10075
+ fr: [
10076
+ /\b(est|sont|a été|ont été|étant|fut|seront)\s+([a-z]+é|[a-z]+ée|[a-z]+és|[a-z]+ées|fait|pris|écrit|construit)\b/i,
10077
+ /\bpar\s+(le|la|les|un|une|des|notre)\b/i
10078
+ ],
10079
+ es: [
10080
+ /\b(es|son|fue|fueron|sido|siendo)\s+([a-z]+ado|[a-z]+ados|[a-z]+ada|[a-z]+adas|hecho|escrito|visto)\b/i,
10081
+ /\bpor\s+(el|la|los|las|un|una)\b/i
10082
+ ],
10083
+ de: [
10084
+ /\b(wird|wurden|wurde|worden|geworden)\s+([a-z]+t|[a-z]+en)\b/i,
10085
+ /\bvon\s+(dem|der|den|einem|einer)\b/i
10086
+ ]
10087
+ };
10088
+ static analyze(text, language = "en") {
10089
+ if (!text || text.trim().length === 0) {
10090
+ return {
10091
+ totalSentences: 0,
10092
+ totalWords: 0,
10093
+ averageWordsPerSentence: 0,
10094
+ passiveVoiceRatio: 0,
10095
+ passiveSentencesCount: 0,
10096
+ complexSentencesCount: 0,
10097
+ gradeLevelEstimate: 0,
10098
+ readabilityEaseScore: 100,
10099
+ status: "clear_and_punchy",
10100
+ keyWarnings: [],
10101
+ sentences: []
10102
+ };
10103
+ }
10104
+ const rawSentences = text.replace(/([.?!])\s*(?=[A-Z0-9À-ÖØ-ß])/g, "$1|").split("|").map((s) => s.trim()).filter((s) => s.length > 3);
10105
+ const patterns = this.PASSIVE_PATTERNS[language] || this.PASSIVE_PATTERNS.en;
10106
+ const sentenceDetails = [];
10107
+ let totalWords = 0;
10108
+ let passiveCount = 0;
10109
+ let complexCount = 0;
10110
+ for (const sentence of rawSentences) {
10111
+ const words = sentence.split(/\s+/).filter(Boolean);
10112
+ const wCount = words.length;
10113
+ totalWords += wCount;
10114
+ const isPassive = patterns.some((regex) => regex.test(sentence));
10115
+ const isTooLong = wCount > 22;
10116
+ if (isPassive)
10117
+ passiveCount++;
10118
+ if (isTooLong)
10119
+ complexCount++;
10120
+ sentenceDetails.push({
10121
+ text: sentence,
10122
+ wordCount: wCount,
10123
+ isPassive,
10124
+ isTooLong
10125
+ });
10126
+ }
10127
+ const totalSentences = Math.max(1, rawSentences.length);
10128
+ const avgWordsPerSentence = Math.round(totalWords / totalSentences * 10) / 10;
10129
+ const passiveVoiceRatio = Math.round(passiveCount / totalSentences * 100) / 100;
10130
+ const syllableEstimate = totalWords * 1.4;
10131
+ const ease = Math.max(10, Math.min(100, Math.round(206.835 - 1.015 * avgWordsPerSentence - 84.6 * (syllableEstimate / totalWords))));
10132
+ const gradeLevel = Math.max(4, Math.round(0.39 * avgWordsPerSentence + 11.8 * (syllableEstimate / totalWords) - 15.59));
10133
+ const warnings = [];
10134
+ if (passiveVoiceRatio > 0.15) {
10135
+ warnings.push(`Passive voice is ${Math.round(passiveVoiceRatio * 100)}% (Target: < 10%). Convert passive constructions to active voice.`);
10136
+ }
10137
+ if (complexCount > totalSentences * 0.25) {
10138
+ warnings.push(`${complexCount} sentences exceed 22 words. Break long compound sentences into shorter, punchier statements.`);
10139
+ }
10140
+ if (avgWordsPerSentence > 18) {
10141
+ warnings.push(`Average sentence length is ${avgWordsPerSentence} words (Target: 12-16 words).`);
10142
+ }
10143
+ let status = "clear_and_punchy";
10144
+ if (ease < 50 || passiveVoiceRatio > 0.2) {
10145
+ status = "hard_to_read";
10146
+ } else if (ease < 65 || passiveVoiceRatio > 0.12) {
10147
+ status = "acceptable";
10148
+ }
10149
+ return {
10150
+ totalSentences,
10151
+ totalWords,
10152
+ averageWordsPerSentence: avgWordsPerSentence,
10153
+ passiveVoiceRatio,
10154
+ passiveSentencesCount: passiveCount,
10155
+ complexSentencesCount: complexCount,
10156
+ gradeLevelEstimate: gradeLevel,
10157
+ readabilityEaseScore: ease,
10158
+ status,
10159
+ keyWarnings: warnings,
10160
+ sentences: sentenceDetails
10161
+ };
10162
+ }
10163
+ }
10164
+
10165
+ // src/above-fold-cro-auditor.ts
10166
+ class AboveFoldCroAuditor {
10167
+ static STRONG_ACTION_VERBS = [
10168
+ /start/i,
10169
+ /get/i,
10170
+ /try/i,
10171
+ /claim/i,
10172
+ /launch/i,
10173
+ /boost/i,
10174
+ /automate/i,
10175
+ /démarrer/i,
10176
+ /essayer/i,
10177
+ /obtenir/i,
10178
+ /profiter/i,
10179
+ /iniciar/i,
10180
+ /probar/i,
10181
+ /jetzt/i,
10182
+ /kostenlos/i
10183
+ ];
10184
+ static WEAK_ACTION_VERBS = [
10185
+ /^submit$/i,
10186
+ /^click here$/i,
10187
+ /^learn more$/i,
10188
+ /^envoyer$/i,
10189
+ /^cliquez ici$/i,
10190
+ /^en savoir plus$/i,
10191
+ /^weiter$/i,
10192
+ /^leer más$/i
10193
+ ];
10194
+ static auditHero(input) {
10195
+ const criteria = [];
10196
+ const fixes = [];
10197
+ const h1Words = input.h1.trim().split(/\s+/).length;
10198
+ const isH1Clear = h1Words >= 4 && h1Words <= 14;
10199
+ let h1Score = isH1Clear ? 25 : 12;
10200
+ if (!isH1Clear) {
10201
+ fixes.push("Optimize H1 length between 4 and 12 words. Make the specific outcome and audience explicit.");
10202
+ }
10203
+ criteria.push({
10204
+ name: "Headline Clarity & Value Proposition",
10205
+ passed: isH1Clear,
10206
+ score: h1Score,
10207
+ feedback: isH1Clear ? "Headline is concise, outcome-oriented, and immediately readable in < 3 seconds." : "Headline is either too vague (< 4 words) or too dense (> 14 words)."
10208
+ });
10209
+ const hasStrongVerb = this.STRONG_ACTION_VERBS.some((r) => r.test(input.primaryCtaText));
10210
+ const hasWeakVerb = this.WEAK_ACTION_VERBS.some((r) => r.test(input.primaryCtaText.trim()));
10211
+ const isCtaEffective = hasStrongVerb && !hasWeakVerb;
10212
+ let ctaScore = isCtaEffective ? 25 : hasWeakVerb ? 5 : 15;
10213
+ if (!isCtaEffective) {
10214
+ fixes.push(`Replace generic CTA "${input.primaryCtaText}" with an outcome-focused action verb (e.g. "Start Free Trial", "Get Instant Access", "Démarrer Gratuitement").`);
10215
+ }
10216
+ criteria.push({
10217
+ name: "Primary CTA Contrast & Action Verb",
10218
+ passed: isCtaEffective,
10219
+ score: ctaScore,
10220
+ feedback: isCtaEffective ? `CTA "${input.primaryCtaText}" uses a strong, high-conversion action trigger.` : `CTA "${input.primaryCtaText}" lacks urgency or is too generic.`
10221
+ });
10222
+ const hasProof = Boolean(input.hasTestimonialsOrStars || input.hasCustomerLogos);
10223
+ let proofScore = hasProof ? 20 : 0;
10224
+ if (!hasProof) {
10225
+ fixes.push("Add social proof above the fold (e.g. 'Rated 4.9/5 by 1,200+ teams' or client logos).");
10226
+ }
10227
+ criteria.push({
10228
+ name: "Above-the-Fold Social Proof & Ratings",
10229
+ passed: hasProof,
10230
+ score: proofScore,
10231
+ feedback: hasProof ? "Trust signals and social proof are visible immediately above the fold." : "Missing social proof above the fold. Increases visitor bounce risk."
10232
+ });
10233
+ const hasReversal = Boolean(input.hasRiskReversalOrGuarantee);
10234
+ let reversalScore = hasReversal ? 20 : 5;
10235
+ if (!hasReversal) {
10236
+ fixes.push("Add a friction-killer under the CTA (e.g. 'No credit card required • Cancel anytime • 14-day free trial').");
10237
+ }
10238
+ criteria.push({
10239
+ name: "Risk Reversal & Friction Elimination",
10240
+ passed: hasReversal,
10241
+ score: reversalScore,
10242
+ feedback: hasReversal ? "Zero-risk micro-copy present under the main action trigger." : "No risk reversal micro-copy found under CTA."
10243
+ });
10244
+ const subWords = (input.subheadline || "").trim().split(/\s+/).length;
10245
+ const isSubheadlineSolid = subWords >= 8 && subWords <= 30;
10246
+ let subScore = isSubheadlineSolid ? 10 : 5;
10247
+ if (!isSubheadlineSolid) {
10248
+ fixes.push("Add a supporting subheadline (12-25 words) explaining HOW the product solves the pain point.");
10249
+ }
10250
+ criteria.push({
10251
+ name: "Subheadline Supporting Context",
10252
+ passed: isSubheadlineSolid,
10253
+ score: subScore,
10254
+ feedback: isSubheadlineSolid ? "Subheadline reinforces the value proposition with concrete details." : "Subheadline is missing or insufficient."
10255
+ });
10256
+ const croScore = h1Score + ctaScore + proofScore + reversalScore + subScore;
10257
+ const rating = croScore >= 80 ? "high_converting" : croScore >= 55 ? "solid" : "high_friction";
10258
+ return {
10259
+ croScore,
10260
+ rating,
10261
+ criteria,
10262
+ recommendedFixes: fixes,
10263
+ suggestedHeroVariant: {
10264
+ h1: input.h1.includes("—") ? input.h1 : `${input.h1} — Built for Fast Growing Teams`,
10265
+ subheadline: input.subheadline || "Automate operational workflows, boost organic search traffic, and cut manual workload in half with instant setup.",
10266
+ ctaText: "Start Free Trial — Instant Setup",
10267
+ reassuranceBadge: "No credit card required • 14-day trial • 100% Free migration"
10268
+ }
10269
+ };
10270
+ }
10271
+ }
10272
+
10273
+ // src/context-templates-generator.ts
10274
+ class ContextTemplatesGenerator {
10275
+ static generateAllContextFiles(input) {
10276
+ return {
10277
+ "context/brand-voice.md": this.generateBrandVoice(input),
10278
+ "context/features.md": this.generateFeatures(input),
10279
+ "context/internal-links-map.md": this.generateInternalLinksMap(input),
10280
+ "context/style-guide.md": this.generateStyleGuide(input),
10281
+ "context/target-keywords.md": this.generateTargetKeywords(input),
10282
+ "context/competitor-analysis.md": this.generateCompetitorAnalysis(input),
10283
+ "context/seo-guidelines.md": this.generateSeoGuidelines(input),
10284
+ "context/cro-best-practices.md": this.generateCroBestPractices(input)
10285
+ };
10286
+ }
10287
+ static generateBrandVoice(input) {
10288
+ return `# Brand Voice & Messaging Framework — ${input.brandName}
10289
+
10290
+ ## 1. Core Voice Pillars
10291
+ - **Authoritative yet Approachable:** Speak with deep domain expertise in ${input.industry}, without academic jargon.
10292
+ - **Direct & Action-Oriented:** Get straight to the solution in the first 5 words. No fluff or generic preambles.
10293
+ - **Outcome-Focused:** Emphasize time saved, revenue recovered, and operational ease for ${input.targetAudience}.
10294
+
10295
+ ## 2. Terminology & Word Preferences
10296
+ - **Preferred Words:** Streamlined, automated, verified, instant, high-performance, precision.
10297
+ - **Banned Words:** Delve, tapestry, testament, crucial, groundbreaking, revolutionize, in today's fast-paced world.
10298
+
10299
+ ## 3. Core Audience
10300
+ - **Primary Persona:** ${input.targetAudience}
10301
+ - **Primary Domain:** ${input.domain}
10302
+ `.trim();
10303
+ }
10304
+ static generateFeatures(input) {
10305
+ const list = input.coreFeatures.map((f) => `- **${f}:** Enterprise-grade workflow automation and real-time synchronization.`).join(`
10306
+ `);
10307
+ return `# Product Features & Capabilities — ${input.brandName}
10308
+
10309
+ ## 1. Feature Catalog
10310
+ ${list}
10311
+
10312
+ ## 2. Competitive Value Proposition
10313
+ - Instant setup (< 3 minutes).
10314
+ - Zero complex infrastructure requirements.
10315
+ - 100% scalable in-memory architecture.
10316
+ `.trim();
10317
+ }
10318
+ static generateInternalLinksMap(input) {
10319
+ return `# Internal Links Architecture Map — ${input.domain}
10320
+
10321
+ ## 1. Core Pillar Hubs
10322
+ - **Homepage:** \`${input.domain}/\` (Anchor: "${input.brandName}", "${input.industry} Software")
10323
+ - **Solutions & PSEO Hub:** \`${input.domain}/solutions\` (Anchor: "Explore all solutions", "Platform features")
10324
+ - **Pricing & Plans:** \`${input.domain}/pricing\` (Anchor: "View pricing plans", "Compare tiers")
10325
+ - **Free Tools:** \`${input.domain}/tools\` (Anchor: "Free interactive calculators", "SEO tools")
10326
+
10327
+ ## 2. Linking Best Practices
10328
+ - Add 3-5 relevant internal links per 2,000 words.
10329
+ - Use descriptive, keyword-rich anchor text rather than "click here".
10330
+ `.trim();
10331
+ }
10332
+ static generateStyleGuide(input) {
10333
+ return `# Editorial & Style Guide — ${input.brandName}
10334
+
10335
+ ## 1. Formatting Rules
10336
+ - **Sentence Length:** 12 to 18 words on average. Never exceed 24 words in a single sentence.
10337
+ - **Paragraphs:** 2 to 4 sentences maximum for high mobile readability.
10338
+ - **Subheadings:** Introduce an H2 or H3 every 250-350 words.
10339
+ - **Punctuation:** Limit em-dashes (—) to 1 per 500 words. Use clear periods and commas.
10340
+
10341
+ ## 2. Readability Target
10342
+ - **Flesch Reading Ease:** 65 to 80.
10343
+ - **Reading Level:** 7th to 9th grade.
10344
+ `.trim();
10345
+ }
10346
+ static generateTargetKeywords(input) {
10347
+ const kwList = input.primaryKeywords.map((k) => `- \`${k}\` (Intent: Commercial/Transactional)`).join(`
10348
+ `);
10349
+ return `# Target Keywords & Topic Clusters — ${input.brandName}
10350
+
10351
+ ## 1. Primary Keywords
10352
+ ${kwList}
10353
+
10354
+ ## 2. Secondary Modifiers & Long-Tail
10355
+ - Best ${input.industry} software for ${input.targetAudience}
10356
+ - How to automate ${input.industry} workflows in 2026
10357
+ - ${input.brandName} pricing and alternatives
10358
+ `.trim();
10359
+ }
10360
+ static generateCompetitorAnalysis(input) {
10361
+ return `# Competitor Analysis & Differentiation — ${input.brandName}
10362
+
10363
+ ## 1. Market Overview
10364
+ - **Our Positioning:** The fastest, lightest, in-memory automation platform for ${input.industry}.
10365
+ - **Key Differentiator:** 100% cloud-native, sub-millisecond response time, no heavy legacy bloat.
10366
+
10367
+ ## 2. Comparison Angles
10368
+ - Transparent pricing with zero hidden add-on fees.
10369
+ - Modern API & MCP integrations (Claude Code, Cursor, Antigravity).
10370
+ `.trim();
10371
+ }
10372
+ static generateSeoGuidelines(input) {
10373
+ return `# SEO Technical & On-Page Requirements — ${input.brandName}
10374
+
10375
+ ## 1. Title & Meta Descriptions
10376
+ - **Title Tag:** 50-60 characters, primary keyword in front.
10377
+ - **Meta Description:** 140-155 characters, includes value prop and soft CTA.
10378
+
10379
+ ## 2. Schema.org Graphs
10380
+ - Inject valid JSON-LD graph on all programmatic pages (SoftwareApplication, LocalBusiness, FAQPage, Breadcrumbs).
10381
+ - Zero syntax errors or missing required fields.
10382
+ `.trim();
10383
+ }
10384
+ static generateCroBestPractices(input) {
10385
+ return `# Conversion Rate Optimization (CRO) Standards — ${input.brandName}
10386
+
10387
+ ## 1. Above-The-Fold Checklist
10388
+ - [ ] Clear H1 communicating the specific outcome in < 3 seconds.
10389
+ - [ ] High-contrast primary CTA with strong action verb.
10390
+ - [ ] Social proof visible without scrolling (star ratings, reviews, client logos).
10391
+ - [ ] Risk reversal micro-copy directly beneath the main button ("No credit card required").
10392
+ `.trim();
10393
+ }
10394
+ }
10395
+
9666
10396
  // src/index.ts
9667
10397
  function createLynxSeoEngine(config) {
9668
10398
  return new LynxSeoEngine(config);
@@ -9674,6 +10404,14 @@ var LynxSeo = {
9674
10404
  createLagoMeter: (apiKey, lagoUrl) => new LagoTokenMeter(apiKey, lagoUrl),
9675
10405
  createHyperswitchGateway: (apiKey, baseUrl) => new HyperswitchGateway({ apiKey, baseUrl }),
9676
10406
  submitToIndexNow: IndexNowClient.submitUrls,
10407
+ googleIndexing: GoogleIndexingClient,
10408
+ aeoSnippet: AeoSnippetSynthesizer,
10409
+ cannibalization: SemanticCannibalizationDetector,
10410
+ humanityScrubber: HumanityAiScrubber,
10411
+ serpLength: SerpLengthComparator,
10412
+ readabilityComplexity: PassiveVoiceComplexityAnalyzer,
10413
+ aboveFoldCro: AboveFoldCroAuditor,
10414
+ contextTemplates: ContextTemplatesGenerator,
9677
10415
  inspectMeta: SiteAuditor.inspectMeta,
9678
10416
  crawlDomain: DeepCrawlerAuditor.crawlAndAuditDomain,
9679
10417
  inspectHtmlSnapshot: DeepCrawlerAuditor.inspectHtmlSnapshot,
@@ -9742,8 +10480,10 @@ export {
9742
10480
  SocialAdsSocialSeoEngine,
9743
10481
  SiteAuditor,
9744
10482
  SerpRankHistoryEngine,
10483
+ SerpLengthComparator,
9745
10484
  SerpClient,
9746
10485
  SeoOpportunitiesDecayDetector,
10486
+ SemanticCannibalizationDetector,
9747
10487
  SchemaGraphBuilder,
9748
10488
  SUPPORTED_CANONICAL_LOCALES,
9749
10489
  SCHEMA_LOCAL_BUSINESS_MAP,
@@ -9753,6 +10493,7 @@ export {
9753
10493
  PublicRoutesManifestEngine,
9754
10494
  PseoMatrixEngine,
9755
10495
  PowerWordsPsychologyEngine,
10496
+ PassiveVoiceComplexityAnalyzer,
9756
10497
  PageRegenerationTracker,
9757
10498
  PSEO_AGENT_SYSTEM_PROMPT,
9758
10499
  OgImageGenerator,
@@ -9781,6 +10522,8 @@ export {
9781
10522
  IndexNowClient,
9782
10523
  I18nDetector,
9783
10524
  HyperswitchGateway,
10525
+ HumanityAiScrubber,
10526
+ GoogleIndexingClient,
9784
10527
  GoogleBusinessProfileEngine,
9785
10528
  GeoMeshLinkingEngine,
9786
10529
  GeoCitationScorer,
@@ -9793,6 +10536,7 @@ export {
9793
10536
  CrosslinkScorerEngine,
9794
10537
  CroCopywritingEngine,
9795
10538
  CopywritingFrameworksMaster,
10539
+ ContextTemplatesGenerator,
9796
10540
  CONTENT_AI_40_TOOLS,
9797
10541
  BrandDnaCalendarEngine,
9798
10542
  BacklinksClient,
@@ -9801,5 +10545,7 @@ export {
9801
10545
  ApiKeyGuardian,
9802
10546
  AiCopilotClient,
9803
10547
  AiBotsLogAnalyzer,
9804
- AdIntelligenceCroEngine
10548
+ AeoSnippetSynthesizer,
10549
+ AdIntelligenceCroEngine,
10550
+ AboveFoldCroAuditor
9805
10551
  };