@lynxflow/seo-engine 1.4.0 โ†’ 1.5.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.
Files changed (86) hide show
  1. package/README.md +84 -339
  2. package/TUTORIEL_INTEGRATION_SITE.md +283 -0
  3. package/connectors/wordpress/lynxseo-connector.php +5 -5
  4. package/connectors/wordpress/lynxseo-connector.zip +0 -0
  5. package/dist/ad-intelligence-cro.d.ts +58 -0
  6. package/dist/ai-bots-log-analyzer.d.ts +36 -0
  7. package/dist/analytics-client.d.ts +48 -11
  8. package/dist/auth-key.d.ts +9 -0
  9. package/dist/brand-dna-calendar.d.ts +35 -0
  10. package/dist/copy-frameworks-master.d.ts +56 -0
  11. package/dist/cro-copywriting-engine.d.ts +46 -0
  12. package/dist/crosslink-scorer.d.ts +33 -0
  13. package/dist/embeddable-seo-widget.d.ts +12 -0
  14. package/dist/engine.d.ts +32 -1
  15. package/dist/engine.test.d.ts +1 -0
  16. package/dist/extended-schemas.d.ts +106 -0
  17. package/dist/geo-mesh-linking.d.ts +33 -0
  18. package/dist/index.d.ts +88 -0
  19. package/dist/index.js +4164 -130
  20. package/dist/index.mjs +4092 -100
  21. package/dist/instant-matrix-search.d.ts +19 -0
  22. package/dist/isr-cache-manager.d.ts +35 -0
  23. package/dist/knowledge-graph-linker.d.ts +29 -0
  24. package/dist/legal-disclaimers.d.ts +46 -0
  25. package/dist/llm-content-cleaner.d.ts +16 -0
  26. package/dist/llm-prompt.d.ts +13 -0
  27. package/dist/master-marketing-engine.d.ts +114 -0
  28. package/dist/matrix-engine.d.ts +201 -0
  29. package/dist/mcp-seo-server.d.ts +21 -0
  30. package/dist/ngram-density-analyzer.d.ts +35 -0
  31. package/dist/rank-math-parity.d.ts +58 -0
  32. package/dist/real-reviews-sync.d.ts +73 -0
  33. package/dist/rss-syndication-feed.d.ts +25 -0
  34. package/dist/schema-builder.d.ts +6 -0
  35. package/dist/seo-opportunities-decay.d.ts +54 -0
  36. package/dist/serp-history-alerts.d.ts +27 -0
  37. package/dist/slug-engine.d.ts +32 -0
  38. package/dist/social-ads-seo.d.ts +77 -0
  39. package/dist/social-growth-suite.d.ts +125 -0
  40. package/dist/social-trend-seo.d.ts +38 -0
  41. package/dist/social-video-seo.d.ts +62 -0
  42. package/dist/team-rbac.d.ts +17 -0
  43. package/dist/technical-rules-auditor.d.ts +50 -0
  44. package/dist/types.d.ts +4 -44
  45. package/dist/yoast-parity.d.ts +45 -0
  46. package/package.json +8 -5
  47. package/src/ad-intelligence-cro.ts +140 -0
  48. package/src/ai-bots-log-analyzer.ts +127 -0
  49. package/src/analytics-client.ts +222 -48
  50. package/src/auth-key.ts +60 -1
  51. package/src/brand-dna-calendar.ts +120 -0
  52. package/src/copy-frameworks-master.ts +89 -0
  53. package/src/cro-copywriting-engine.ts +105 -0
  54. package/src/crosslink-scorer.ts +101 -0
  55. package/src/embeddable-seo-widget.ts +57 -0
  56. package/src/engine.test.ts +136 -0
  57. package/src/engine.ts +229 -28
  58. package/src/extended-schemas.ts +279 -0
  59. package/src/geo-mesh-linking.ts +93 -0
  60. package/src/index.ts +89 -0
  61. package/src/instant-matrix-search.ts +48 -0
  62. package/src/isr-cache-manager.ts +78 -0
  63. package/src/knowledge-graph-linker.ts +81 -0
  64. package/src/legal-disclaimers.ts +407 -0
  65. package/src/llm-content-cleaner.ts +64 -0
  66. package/src/llm-prompt.ts +70 -0
  67. package/src/master-marketing-engine.ts +314 -0
  68. package/src/matrix-engine.ts +818 -0
  69. package/src/mcp-seo-server.ts +108 -0
  70. package/src/ngram-density-analyzer.ts +108 -0
  71. package/src/rank-math-parity.ts +235 -0
  72. package/src/real-reviews-sync.ts +207 -0
  73. package/src/rss-syndication-feed.ts +56 -0
  74. package/src/schema-builder.ts +71 -24
  75. package/src/seo-opportunities-decay.ts +154 -0
  76. package/src/serp-history-alerts.ts +75 -0
  77. package/src/slug-engine.ts +183 -0
  78. package/src/social-ads-seo.ts +211 -0
  79. package/src/social-growth-suite.ts +310 -0
  80. package/src/social-trend-seo.ts +103 -0
  81. package/src/social-video-seo.ts +100 -0
  82. package/src/team-rbac.ts +61 -0
  83. package/src/technical-rules-auditor.ts +171 -0
  84. package/src/types.ts +22 -47
  85. package/src/yoast-parity.ts +161 -0
  86. package/tsconfig.json +2 -1
@@ -0,0 +1,407 @@
1
+ /**
2
+ * Global Legal Compliance & Editorial Disclaimer Engine for B2B pSEO
3
+ * Multilingual compliance and anti-disparagement verification across 10+ languages.
4
+ */
5
+
6
+ export type DisclaimerType =
7
+ | "comparison"
8
+ | "pricing"
9
+ | "feature"
10
+ | "exclusivity"
11
+ | "statistics"
12
+ | "alternative"
13
+ | "listicle";
14
+
15
+ export interface DisclaimerTemplate {
16
+ type: DisclaimerType;
17
+ label: string;
18
+ templateText: string;
19
+ }
20
+
21
+ /**
22
+ * Multilingual Disclaimer Templates (English Default + Localized Fallbacks)
23
+ */
24
+ export const MULTILINGUAL_DISCLAIMERS: Record<string, Record<DisclaimerType, DisclaimerTemplate>> = {
25
+ // ๐Ÿ‡ฌ๐Ÿ‡ง English (Default)
26
+ en: {
27
+ comparison: {
28
+ type: "comparison",
29
+ label: "Standard Comparison Notice",
30
+ templateText:
31
+ "Editorial note: We research and verify all claims in our comparison articles using publicly available documentation. Pricing and features are subject to change by each provider. Report any inaccuracies to {correctionsEmail}.",
32
+ },
33
+ pricing: {
34
+ type: "pricing",
35
+ label: "Pricing Transparency Disclaimer",
36
+ templateText:
37
+ "Pricing disclaimer: All competitor pricing and plan details were verified on {lastVerifiedDate}. Providers may update their rates at any time without notice. Please verify current rates on the official provider website before making purchasing decisions.",
38
+ },
39
+ feature: {
40
+ type: "feature",
41
+ label: "Feature Capability Note",
42
+ templateText:
43
+ "Feature comparison note: Feature availability and tier limits were verified on {lastVerifiedDate}. Software updates occur continuously; consult each vendor's documentation for live specifications.",
44
+ },
45
+ exclusivity: {
46
+ type: "exclusivity",
47
+ label: "Exclusivity Distinction Claim",
48
+ templateText:
49
+ "Distinction note: To the best of our knowledge as of {lastVerifiedDate}, this architectural capability distinction is accurate based on public benchmarks.",
50
+ },
51
+ statistics: {
52
+ type: "statistics",
53
+ label: "Public Data & Statistics Note",
54
+ templateText:
55
+ "Data note: Statistics and benchmarks cited in this article are derived from public industry reports and official platform metrics as of {lastVerifiedDate}.",
56
+ },
57
+ alternative: {
58
+ type: "alternative",
59
+ label: "Alternative Directory Notice",
60
+ templateText:
61
+ "Editorial note: This page compares software alternatives objectively based on public specifications, user feedback, and architectural differences to help buyers make informed decisions.",
62
+ },
63
+ listicle: {
64
+ type: "listicle",
65
+ label: "Curated Directory & Review Notice",
66
+ templateText:
67
+ "Editorial note: Rankings and software evaluations reflect our objective editorial criteria and testing methodology. Inaccuracies can be flagged to {correctionsEmail}.",
68
+ },
69
+ },
70
+
71
+ // ๐Ÿ‡ซ๐Ÿ‡ท French
72
+ fr: {
73
+ comparison: {
74
+ type: "comparison",
75
+ label: "Note ร‰ditoriale de Comparatif",
76
+ templateText:
77
+ "Note รฉditoriale : Nous vรฉrifions scrupuleusement les informations sur la base des documentations publiques. Les fonctionnalitรฉs et tarifs รฉvoluent rรฉguliรจrement. Signalez toute inexactitude ร  {correctionsEmail}.",
78
+ },
79
+ pricing: {
80
+ type: "pricing",
81
+ label: "Avertissement sur les Tarifs",
82
+ templateText:
83
+ "Avertissement tarifaire : Les prix et offres ont รฉtรฉ relevรฉs le {lastVerifiedDate}. Les รฉditeurs peuvent modifier leurs conditions sans prรฉavis. Vรฉrifiez les tarifs officiels avant toute souscription.",
84
+ },
85
+ feature: {
86
+ type: "feature",
87
+ label: "Vรฉrification des Fonctionnalitรฉs",
88
+ templateText:
89
+ "Note sur les fonctionnalitรฉs : La disponibilitรฉ des options a รฉtรฉ vรฉrifiรฉe le {lastVerifiedDate}. Consultez les sites รฉditeurs pour les spรฉcifications en direct.",
90
+ },
91
+ exclusivity: {
92
+ type: "exclusivity",
93
+ label: "Revendication d'Exclusivitรฉ",
94
+ templateText:
95
+ "Note d'exclusivitรฉ : Selon nos informations vรฉrifiรฉes au {lastVerifiedDate}, cette capacitรฉ technique est exclusive ร  notre plateforme.",
96
+ },
97
+ statistics: {
98
+ type: "statistics",
99
+ label: "Donnรฉes et Statistiques Publiques",
100
+ templateText:
101
+ "Source des donnรฉes : Les mรฉtriques citรฉes proviennent de rapports sectoriels publics au {lastVerifiedDate}.",
102
+ },
103
+ alternative: {
104
+ type: "alternative",
105
+ label: "Annuaire des Alternatives",
106
+ templateText:
107
+ "Note รฉditoriale : Cette sรฉlection compare objectivement les solutions du marchรฉ pour รฉclairer le choix des dรฉcideurs.",
108
+ },
109
+ listicle: {
110
+ type: "listicle",
111
+ label: "Mรฉthodologie de Classement",
112
+ templateText:
113
+ "Note รฉditoriale : Ce classement reflรจte notre analyse technique indรฉpendante. Contact : {correctionsEmail}.",
114
+ },
115
+ },
116
+
117
+ // ๐Ÿ‡ฉ๐Ÿ‡ช German
118
+ de: {
119
+ comparison: {
120
+ type: "comparison",
121
+ label: "Redaktioneller Vergleichshinweis",
122
+ templateText:
123
+ "Redaktioneller Hinweis: Wir recherchieren und prรผfen alle Angaben anhand รถffentlich zugรคnglicher Dokumentationen. Preise und Funktionen kรถnnen sich รคndern. Bitte melden Sie Unstimmigkeiten an {correctionsEmail}.",
124
+ },
125
+ pricing: {
126
+ type: "pricing",
127
+ label: "Preistransparenz-Hinweis",
128
+ templateText:
129
+ "Preishinweis: Alle Preisangaben wurden am {lastVerifiedDate} รผberprรผft. Anbieter kรถnnen ihre Preise jederzeit anpassen. Bitte prรผfen Sie die offiziellen Anbieterseiten.",
130
+ },
131
+ feature: {
132
+ type: "feature",
133
+ label: "Funktionshinweis",
134
+ templateText:
135
+ "Funktionshinweis: Die Verfรผgbarkeit von Funktionen wurde am {lastVerifiedDate} verifiziert.",
136
+ },
137
+ exclusivity: {
138
+ type: "exclusivity",
139
+ label: "Exklusivitรคtsangabe",
140
+ templateText:
141
+ "Hinweis: Nach unserem Kenntnisstand vom {lastVerifiedDate} ist dieses Merkmal eine spezifische Eigenschaft unserer Lรถsung.",
142
+ },
143
+ statistics: {
144
+ type: "statistics",
145
+ label: "Statistikhinweis",
146
+ templateText:
147
+ "Datenhinweis: Die genannten Statistiken basieren auf รถffentlich zugรคnglichen Branchenberichten mit Stand vom {lastVerifiedDate}.",
148
+ },
149
+ alternative: {
150
+ type: "alternative",
151
+ label: "Alternativen-Verzeichnis",
152
+ templateText:
153
+ "Redaktioneller Hinweis: Dieser Vergleich bietet eine objektive Gegenรผberstellung moderner Software-Alternativen.",
154
+ },
155
+ listicle: {
156
+ type: "listicle",
157
+ label: "Bewertungshinweis",
158
+ templateText:
159
+ "Redaktioneller Hinweis: Bewertungen basieren auf unserer unabhรคngigen Testmethodik. Feedback an {correctionsEmail}.",
160
+ },
161
+ },
162
+
163
+ // ๐Ÿ‡ช๐Ÿ‡ธ Spanish
164
+ es: {
165
+ comparison: {
166
+ type: "comparison",
167
+ label: "Nota Editorial Comparativa",
168
+ templateText:
169
+ "Nota editorial: Investigamos y verificamos la informaciรณn con datos pรบblicos. Los precios y funciones pueden variar. Notifique cualquier error a {correctionsEmail}.",
170
+ },
171
+ pricing: {
172
+ type: "pricing",
173
+ label: "Aviso sobre Precios",
174
+ templateText:
175
+ "Aviso de precios: Toda la informaciรณn de precios fue verificada el {lastVerifiedDate}. Los proveedores pueden cambiar sus tarifas sin previo aviso.",
176
+ },
177
+ feature: {
178
+ type: "feature",
179
+ label: "Nota de Funcionalidades",
180
+ templateText:
181
+ "Nota de funciones: La disponibilidad de funciones fue verificada el {lastVerifiedDate}.",
182
+ },
183
+ exclusivity: {
184
+ type: "exclusivity",
185
+ label: "Distinciรณn Exclusiva",
186
+ templateText:
187
+ "Nota de exclusividad: Segรบn los datos verificados al {lastVerifiedDate}, esta capacidad es รบnica de nuestra plataforma.",
188
+ },
189
+ statistics: {
190
+ type: "statistics",
191
+ label: "Datos Estadรญsticos",
192
+ templateText:
193
+ "Nota de datos: Las estadรญsticas provienen de informes sectoriales pรบblicos al {lastVerifiedDate}.",
194
+ },
195
+ alternative: {
196
+ type: "alternative",
197
+ label: "Directorio de Alternativas",
198
+ templateText:
199
+ "Nota editorial: Esta pรกgina compara alternativas de software de forma objetiva para ayudar en la toma de decisiones.",
200
+ },
201
+ listicle: {
202
+ type: "listicle",
203
+ label: "Metodologรญa del Ranking",
204
+ templateText:
205
+ "Nota editorial: Las recomendaciones se basan en nuestro anรกlisis objetivo. Contacto: {correctionsEmail}.",
206
+ },
207
+ },
208
+ };
209
+
210
+ /**
211
+ * Multilingual Banned & Disparaging Words Dictionary across 10 Languages
212
+ */
213
+ export const MULTILINGUAL_BANNED_DISPARAGING_WORDS: Record<string, string[]> = {
214
+ // ๐Ÿ‡ฌ๐Ÿ‡ง English
215
+ en: [
216
+ "is a scam",
217
+ "fraudulent",
218
+ "worst software",
219
+ "useless product",
220
+ "terrible company",
221
+ "don't trust",
222
+ "rip-off",
223
+ "garbage software",
224
+ "incompetent",
225
+ ],
226
+
227
+ // ๐Ÿ‡ซ๐Ÿ‡ท French
228
+ fr: [
229
+ "est une arnaque",
230
+ "frauduleux",
231
+ "pire logiciel",
232
+ "produit inutile",
233
+ "entreprise malhonnรชte",
234
+ "ne faites pas confiance",
235
+ "escroquerie",
236
+ "logiciel poubelle",
237
+ "incompรฉtent",
238
+ ],
239
+
240
+ // ๐Ÿ‡ฉ๐Ÿ‡ช German
241
+ de: [
242
+ "ist ein betrug",
243
+ "betrรผgerisch",
244
+ "schlechteste software",
245
+ "nutzloses produkt",
246
+ "unseriรถse firma",
247
+ "nicht vertrauen",
248
+ "abzocke",
249
+ "mรผll software",
250
+ "inkompetent",
251
+ ],
252
+
253
+ // ๐Ÿ‡ช๐Ÿ‡ธ Spanish
254
+ es: [
255
+ "es una estafa",
256
+ "fraudulento",
257
+ "peor software",
258
+ "producto inutil",
259
+ "empresa deshonesta",
260
+ "no confie",
261
+ "timo",
262
+ "software basura",
263
+ "incompetente",
264
+ ],
265
+
266
+ // ๐Ÿ‡ฎ๐Ÿ‡น Italian
267
+ it: [
268
+ "e una truffa",
269
+ "fraudolento",
270
+ "peggior software",
271
+ "prodotto inutile",
272
+ "azienda disonesta",
273
+ "non fidarti",
274
+ "fregatura",
275
+ "software spazzatura",
276
+ ],
277
+
278
+ // ๐Ÿ‡ต๐Ÿ‡น Portuguese
279
+ pt: [
280
+ "e um golpe",
281
+ "fraudulento",
282
+ "pior software",
283
+ "produto inutil",
284
+ "empresa desonesta",
285
+ "nao confie",
286
+ "engranacao",
287
+ "software lixo",
288
+ ],
289
+
290
+ // ๐Ÿ‡ณ๐Ÿ‡ฑ Dutch
291
+ nl: [
292
+ "is oplichterij",
293
+ "frauduleus",
294
+ "slechtste software",
295
+ "nutteloos product",
296
+ "onbetrouwbaar bedrijf",
297
+ "niet vertrouwen",
298
+ ],
299
+
300
+ // ๐Ÿ‡ท๐Ÿ‡บ Russian (Latinized)
301
+ ru: [
302
+ "eto moshennichestvo",
303
+ "hudshiy soft",
304
+ "bespoleznyy produkt",
305
+ "obman",
306
+ ],
307
+
308
+ // ๐Ÿ‡ธ๐Ÿ‡ช Swedish
309
+ sv: [
310
+ "ar en bluff",
311
+ "bedraglig",
312
+ "samsta mjukvaran",
313
+ "vardelos produkt",
314
+ "lita inte pa",
315
+ ],
316
+
317
+ // ๐Ÿ‡ต๐Ÿ‡ฑ Polish
318
+ pl: [
319
+ "to oszustwo",
320
+ "najgorsze oprogramowanie",
321
+ "bezuzyteczny produkt",
322
+ "nie ufaj",
323
+ ],
324
+ };
325
+
326
+ export interface LegalEngineOptions {
327
+ companyName?: string;
328
+ correctionsEmail?: string;
329
+ dataStalenessDays?: number;
330
+ language?: string;
331
+ }
332
+
333
+ export class LegalDisclaimerEngine {
334
+ private companyName: string;
335
+ private correctionsEmail: string;
336
+ private dataStalenessDays: number;
337
+ private defaultLanguage: string;
338
+
339
+ constructor(options: LegalEngineOptions = {}) {
340
+ this.companyName = options.companyName || "Our Platform";
341
+ this.correctionsEmail = options.correctionsEmail || "compliance@platform.com";
342
+ this.dataStalenessDays = options.dataStalenessDays ?? 90;
343
+ this.defaultLanguage = options.language || "en";
344
+ }
345
+
346
+ /**
347
+ * Generates a fully resolved disclaimer note in the target language (defaults to English).
348
+ */
349
+ getDisclaimer(type: DisclaimerType, lastVerifiedDate?: string, language?: string): string {
350
+ const lang = language || this.defaultLanguage;
351
+ const langTemplates = MULTILINGUAL_DISCLAIMERS[lang] || MULTILINGUAL_DISCLAIMERS.en;
352
+ const template = langTemplates[type]?.templateText || MULTILINGUAL_DISCLAIMERS.en.comparison.templateText;
353
+ const dateStr = lastVerifiedDate || new Date().toISOString().split("T")[0];
354
+
355
+ return template
356
+ .replace(/{companyName}/g, this.companyName)
357
+ .replace(/{correctionsEmail}/g, this.correctionsEmail)
358
+ .replace(/{lastVerifiedDate}/g, dateStr);
359
+ }
360
+
361
+ /**
362
+ * Evaluates if competitor pricing or feature claim data is older than the allowed staleness window (default: 90 days).
363
+ */
364
+ isDataStale(lastVerifiedDateStr?: string): boolean {
365
+ if (!lastVerifiedDateStr) return true;
366
+ const verified = new Date(lastVerifiedDateStr).getTime();
367
+ if (isNaN(verified)) return true;
368
+
369
+ const diffDays = (Date.now() - verified) / (1000 * 60 * 60 * 24);
370
+ return diffDays > this.dataStalenessDays;
371
+ }
372
+
373
+ /**
374
+ * Validates content against disparaging or legally hazardous statements across all supported languages.
375
+ */
376
+ validateCompliance(content: string, competitorName: string, language: string = "all"): { isCompliant: boolean; warnings: string[] } {
377
+ const warnings: string[] = [];
378
+ const lowerContent = content.toLowerCase();
379
+ const lowerComp = competitorName.toLowerCase();
380
+
381
+ // Check banned phrases in target language or across all languages
382
+ const activeLanguages = language === "all"
383
+ ? Object.keys(MULTILINGUAL_BANNED_DISPARAGING_WORDS)
384
+ : [language];
385
+
386
+ for (const lang of activeLanguages) {
387
+ const phrases = MULTILINGUAL_BANNED_DISPARAGING_WORDS[lang] || [];
388
+ for (const phrase of phrases) {
389
+ if (lowerContent.includes(phrase)) {
390
+ warnings.push(`[${lang.toUpperCase()}] Hazardous disparaging claim detected: "${phrase}". Maintain objective technical framing.`);
391
+ }
392
+ }
393
+ }
394
+
395
+ // Mention frequency check (prevent trademark keyword stuffing)
396
+ const regex = new RegExp(`\\b${lowerComp}\\b`, "gi");
397
+ const count = (lowerContent.match(regex) || []).length;
398
+ if (count > 25) {
399
+ warnings.push(`Excessive competitor trademark mentions (${count} times). Reduce to under 20 to avoid trademark dilution flags.`);
400
+ }
401
+
402
+ return {
403
+ isCompliant: warnings.length === 0,
404
+ warnings,
405
+ };
406
+ }
407
+ }
@@ -0,0 +1,64 @@
1
+ /**
2
+ * ๐Ÿงน Boilerplate Stripper & Clean Markdown Extractor for LLMs (Inspiration: openserp/extract)
3
+ *
4
+ * Strips navigation, headers, footers, cookie banners, and advertisements from raw HTML
5
+ * to produce clean, high-density markdown text for AI search ingestion (/llms.txt & ChatGPT).
6
+ */
7
+
8
+ export class LlmContentCleaner {
9
+ /**
10
+ * Alias: Cleans text or markdown for LLMs.
11
+ */
12
+ static cleanForLlm(content: string): string {
13
+ return this.htmlToCleanMarkdown(content);
14
+ }
15
+
16
+ /**
17
+ * Cleans raw HTML and returns pure readable markdown content.
18
+ */
19
+ static htmlToCleanMarkdown(rawHtml: string): string {
20
+ if (!rawHtml) return "";
21
+
22
+ let cleaned = rawHtml
23
+ // Remove scripts, styles, iframes, SVGs
24
+ .replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi, " ")
25
+ .replace(/<style\b[^<]*(?:(?!<\/style>)<[^<]*)*<\/style>/gi, " ")
26
+ .replace(/<svg\b[^<]*(?:(?!<\/svg>)<[^<]*)*<\/svg>/gi, " ")
27
+ .replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi, " ")
28
+ // Remove navigation, headers, footers, modals, cookie banners
29
+ .replace(/<nav\b[^<]*(?:(?!<\/nav>)<[^<]*)*<\/nav>/gi, " ")
30
+ .replace(/<footer\b[^<]*(?:(?!<\/footer>)<[^<]*)*<\/footer>/gi, " ")
31
+ .replace(/<header\b[^<]*(?:(?!<\/header>)<[^<]*)*<\/header>/gi, " ")
32
+ .replace(/<aside\b[^<]*(?:(?!<\/aside>)<[^<]*)*<\/aside>/gi, " ")
33
+ // Convert headings
34
+ .replace(/<h1[^>]*>([\s\S]*?)<\/h1>/gi, "\n# $1\n")
35
+ .replace(/<h2[^>]*>([\s\S]*?)<\/h2>/gi, "\n## $1\n")
36
+ .replace(/<h3[^>]*>([\s\S]*?)<\/h3>/gi, "\n### $1\n")
37
+ .replace(/<h4[^>]*>([\s\S]*?)<\/h4>/gi, "\n#### $1\n")
38
+ // Convert lists
39
+ .replace(/<li[^>]*>([\s\S]*?)<\/li>/gi, "\n* $1")
40
+ // Convert paragraphs and line breaks
41
+ .replace(/<p[^>]*>([\s\S]*?)<\/p>/gi, "\n$1\n")
42
+ .replace(/<br\s*[\/]?>/gi, "\n")
43
+ // Convert links
44
+ .replace(/<a[^>]*href=["']([^"']*)["'][^>]*>([\s\S]*?)<\/a>/gi, "[$2]($1)")
45
+ // Strip remaining HTML tags
46
+ .replace(/<[^>]+>/g, " ")
47
+ // Decode basic HTML entities
48
+ .replace(/&nbsp;/g, " ")
49
+ .replace(/&amp;/g, "&")
50
+ .replace(/&lt;/g, "<")
51
+ .replace(/&gt;/g, ">")
52
+ .replace(/&quot;/g, '"')
53
+ .replace(/&#39;/g, "'");
54
+
55
+ // Clean whitespace and repeated linebreaks
56
+ cleaned = cleaned
57
+ .split("\n")
58
+ .map((line) => line.trim())
59
+ .filter((line, i, arr) => line !== "" || (i > 0 && arr[i - 1] !== ""))
60
+ .join("\n");
61
+
62
+ return cleaned.trim();
63
+ }
64
+ }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Built-in AI Agent & LLM System Prompt Guide
3
+ * Provides complete operational context for autonomous coding agents (Claude, Cursor, Copilot, ChatGPT, Antigravity)
4
+ * to interact with the SDK without exposing proprietary internal algorithms in public documentation.
5
+ */
6
+
7
+ export const PSEO_AGENT_SYSTEM_PROMPT = `
8
+ You are the Programmatic SEO Implementation Specialist powered by @lynxflow/seo-engine (v1.5.0).
9
+ Your goal is to configure, manage, and scale programmatic SEO pages, XML sitemaps, structured JSON-LD graphs, and compliance rules.
10
+
11
+ ### ๐ŸŽฏ Architecture: 10 Root Pillars & 50+ Specialized Sub-Matrices
12
+
13
+ 1. **10 Canonical Root Pillars:**
14
+ - Comparisons: \`/vs/{competitor}\` (or \`/comparatif/{competitor}\` in FR)
15
+ - Alternatives: \`/alternatives/{competitor}\` (Clean canonical, zero keyword stuttering)
16
+ - Pricing: \`/pricing/{competitor}\` (or \`/tarifs/{competitor}\` in FR)
17
+ - Audiences: \`/for/{target}\` (or \`/pour/{target}\` in FR - Unified industry/role mapping)
18
+ - Integrations: \`/integrations/{app}\` (Clean slug without stop words)
19
+ - Use Cases: \`/use-cases/{useCase}\` (Actionable workflows with HowTo JSON-LD)
20
+ - Templates: \`/templates/{slug}\` (High-converting spreadsheet/notion lead magnets)
21
+ - Glossary: \`/glossary/{term}\` (Topic authority cluster hub)
22
+ - Tools: \`/tools/{calculator}\` (Interactive ROI & value estimators)
23
+ - Local Geo: \`/solutions/{service}/{country}/{city}\` (Tiered Indexing & Mesh Links)
24
+
25
+ 2. **50+ Specialized Sub-Matrix Dimensions:**
26
+ - **Industry & Regulatory Matrices (12):** Sector ร— Compliance (e.g., GDPR Law Firm, HIPAA Dental), Sector ร— Team Size (Freelance, Mid-Market, Enterprise).
27
+ - **Role & Workflow KPI Matrices (10):** Role ร— Core KPI (e.g., Sales Director Revenue, Support Lead SLA), Role ร— Daily Toolchain.
28
+ - **Multi-Format Template Matrices (8):** Subject ร— Format (Excel .xlsx, Notion, Google Sheets, Word .docx, Interactive PDF).
29
+ - **Ecosystem & Integration Matrices (10):** Module ร— App (e.g., CRM ร— Shopify), Connector ร— Real-Time Webhook Trigger, Bi-Directional Data Sync.
30
+ - **Problem-Solving Playbook Matrices (8):** Pain Point ร— Step-by-Step Workflow, Operational Bottleneck ร— Expected ROI.
31
+ - **Interactive Calculators (6):** Hours Saved Simulator, Revenue Uplift Estimator, CAC Payback Calculator.
32
+ - **Topic Authority Clusters (6):** Financial Metrics (MRR, ARR, Churn, LTV), Technical Standards (OAuth, Webhooks, REST API).
33
+
34
+ 3. **Strict URL Slug Rules (6 Golden Rules across 10+ Languages):**
35
+ - Always enforce cleanSeoSlug(text, { language }) to remove stop words (EN, FR, DE, ES, IT, PT, NL, RU, SV, PL), accents, and transient dates (e.g. 2026).
36
+ - Slugs must only use lowercase alphanumeric characters and single hyphen (-) delimiters.
37
+
38
+ 4. **Schema.org Rich Data Generation (50+ Google Types):**
39
+ - Use ExtendedSchemaGraphBuilder to inject official Google-compliant structured data:
40
+ - SoftwareApplication & WebApplication
41
+ - LocalBusiness (50+ specialized subtypes like Plumber, Dentist, LegalService, HVACBusiness)
42
+ - Organization (with Wikidata/LinkedIn sameAs Entity links)
43
+ - HowTo with step-by-step HowToStep array
44
+ - FAQPage with Question/Answer pairs
45
+ - BreadcrumbList navigation hierarchy
46
+
47
+ 5. **Legal Compliance & Disclaimer Verification (SeedRank Standard):**
48
+ - Use LegalDisclaimerEngine to verify data staleness (flags competitor claims older than 90 days).
49
+ - Attach mandatory objective disclaimers to comparison, pricing, and alternative pages.
50
+ - Ensure anti-disparagement compliance across international markets.
51
+
52
+ 6. **Runtime Resolution & Zero-Latency Performance:**
53
+ - PseoMatrixEngine resolves all matrices in-memory in < 0.05ms with 0 SQL database bottlenecks.
54
+ - Sitemaps are partitioned at 45,000 URLs max per XML chunk with an index sitemap.
55
+ `.trim();
56
+
57
+ /**
58
+ * Returns the complete LLM guidance prompt for AI agents and developer copilots.
59
+ */
60
+ export function getSeoAgentPrompt(customContext?: { brandName?: string; domain?: string }): string {
61
+ if (!customContext) return PSEO_AGENT_SYSTEM_PROMPT;
62
+
63
+ return `
64
+ ${PSEO_AGENT_SYSTEM_PROMPT}
65
+
66
+ ### ๐Ÿข Current Project Context:
67
+ - Brand Name: ${customContext.brandName || "Our Platform"}
68
+ - Domain: ${customContext.domain || "https://example.com"}
69
+ `.trim();
70
+ }