@rankcli/agent-runtime 0.0.1

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 (178) hide show
  1. package/README.md +242 -0
  2. package/dist/analyzer-2CSWIQGD.mjs +6 -0
  3. package/dist/chunk-YNZYHEYM.mjs +774 -0
  4. package/dist/index.d.mts +4012 -0
  5. package/dist/index.d.ts +4012 -0
  6. package/dist/index.js +29672 -0
  7. package/dist/index.mjs +28602 -0
  8. package/package.json +53 -0
  9. package/scripts/build-deno.ts +134 -0
  10. package/src/audit/ai/analyzer.ts +347 -0
  11. package/src/audit/ai/index.ts +29 -0
  12. package/src/audit/ai/prompts/content-analysis.ts +271 -0
  13. package/src/audit/ai/types.ts +179 -0
  14. package/src/audit/checks/additional-checks.ts +439 -0
  15. package/src/audit/checks/ai-citation-worthiness.ts +399 -0
  16. package/src/audit/checks/ai-content-structure.ts +325 -0
  17. package/src/audit/checks/ai-readiness.ts +339 -0
  18. package/src/audit/checks/anchor-text.ts +179 -0
  19. package/src/audit/checks/answer-conciseness.ts +322 -0
  20. package/src/audit/checks/asset-minification.ts +270 -0
  21. package/src/audit/checks/bing-optimization.ts +206 -0
  22. package/src/audit/checks/brand-mention-optimization.ts +349 -0
  23. package/src/audit/checks/caching-headers.ts +305 -0
  24. package/src/audit/checks/canonical-advanced.ts +150 -0
  25. package/src/audit/checks/canonical-domain.ts +196 -0
  26. package/src/audit/checks/citation-quality.ts +358 -0
  27. package/src/audit/checks/client-rendering.ts +542 -0
  28. package/src/audit/checks/color-contrast.ts +342 -0
  29. package/src/audit/checks/content-freshness.ts +170 -0
  30. package/src/audit/checks/content-science.ts +589 -0
  31. package/src/audit/checks/conversion-elements.ts +526 -0
  32. package/src/audit/checks/crawlability.ts +220 -0
  33. package/src/audit/checks/directory-listing.ts +172 -0
  34. package/src/audit/checks/dom-analysis.ts +191 -0
  35. package/src/audit/checks/dom-size.ts +246 -0
  36. package/src/audit/checks/duplicate-content.ts +194 -0
  37. package/src/audit/checks/eeat-signals.ts +990 -0
  38. package/src/audit/checks/entity-seo.ts +396 -0
  39. package/src/audit/checks/featured-snippet.ts +473 -0
  40. package/src/audit/checks/freshness-signals.ts +443 -0
  41. package/src/audit/checks/funnel-intent.ts +463 -0
  42. package/src/audit/checks/hreflang.ts +174 -0
  43. package/src/audit/checks/html-compliance.ts +302 -0
  44. package/src/audit/checks/image-dimensions.ts +167 -0
  45. package/src/audit/checks/images.ts +160 -0
  46. package/src/audit/checks/indexnow.ts +275 -0
  47. package/src/audit/checks/interactive-tools.ts +475 -0
  48. package/src/audit/checks/internal-link-graph.ts +436 -0
  49. package/src/audit/checks/keyword-analysis.ts +239 -0
  50. package/src/audit/checks/keyword-cannibalization.ts +385 -0
  51. package/src/audit/checks/keyword-placement.ts +471 -0
  52. package/src/audit/checks/links.ts +203 -0
  53. package/src/audit/checks/llms-txt.ts +224 -0
  54. package/src/audit/checks/local-seo.ts +296 -0
  55. package/src/audit/checks/mobile.ts +167 -0
  56. package/src/audit/checks/modern-images.ts +226 -0
  57. package/src/audit/checks/navboost-signals.ts +395 -0
  58. package/src/audit/checks/on-page.ts +209 -0
  59. package/src/audit/checks/page-resources.ts +285 -0
  60. package/src/audit/checks/pagination.ts +180 -0
  61. package/src/audit/checks/performance.ts +153 -0
  62. package/src/audit/checks/platform-presence.ts +580 -0
  63. package/src/audit/checks/redirect-analysis.ts +153 -0
  64. package/src/audit/checks/redirect-chain.ts +389 -0
  65. package/src/audit/checks/resource-hints.ts +420 -0
  66. package/src/audit/checks/responsive-css.ts +247 -0
  67. package/src/audit/checks/responsive-images.ts +396 -0
  68. package/src/audit/checks/review-ecosystem.ts +415 -0
  69. package/src/audit/checks/robots-validation.ts +373 -0
  70. package/src/audit/checks/security-headers.ts +172 -0
  71. package/src/audit/checks/security.ts +144 -0
  72. package/src/audit/checks/serp-preview.ts +251 -0
  73. package/src/audit/checks/site-maturity.ts +444 -0
  74. package/src/audit/checks/social-meta.test.ts +275 -0
  75. package/src/audit/checks/social-meta.ts +134 -0
  76. package/src/audit/checks/soft-404.ts +151 -0
  77. package/src/audit/checks/structured-data.ts +238 -0
  78. package/src/audit/checks/tech-detection.ts +496 -0
  79. package/src/audit/checks/topical-clusters.ts +435 -0
  80. package/src/audit/checks/tracker-bloat.ts +462 -0
  81. package/src/audit/checks/tracking-verification.test.ts +371 -0
  82. package/src/audit/checks/tracking-verification.ts +636 -0
  83. package/src/audit/checks/url-safety.ts +682 -0
  84. package/src/audit/deno-entry.ts +66 -0
  85. package/src/audit/discovery/index.ts +15 -0
  86. package/src/audit/discovery/link-crawler.ts +232 -0
  87. package/src/audit/discovery/repo-routes.ts +347 -0
  88. package/src/audit/engine.ts +620 -0
  89. package/src/audit/fixes/index.ts +209 -0
  90. package/src/audit/fixes/social-meta-fixes.test.ts +329 -0
  91. package/src/audit/fixes/social-meta-fixes.ts +463 -0
  92. package/src/audit/index.ts +74 -0
  93. package/src/audit/runner.test.ts +299 -0
  94. package/src/audit/runner.ts +130 -0
  95. package/src/audit/types.ts +1953 -0
  96. package/src/content/featured-snippet.ts +367 -0
  97. package/src/content/generator.test.ts +534 -0
  98. package/src/content/generator.ts +501 -0
  99. package/src/content/headline.ts +317 -0
  100. package/src/content/index.ts +62 -0
  101. package/src/content/intent.ts +258 -0
  102. package/src/content/keyword-density.ts +349 -0
  103. package/src/content/readability.ts +262 -0
  104. package/src/executor.ts +336 -0
  105. package/src/fixer.ts +416 -0
  106. package/src/frameworks/detector.test.ts +248 -0
  107. package/src/frameworks/detector.ts +371 -0
  108. package/src/frameworks/index.ts +68 -0
  109. package/src/frameworks/recipes/angular.yaml +171 -0
  110. package/src/frameworks/recipes/astro.yaml +206 -0
  111. package/src/frameworks/recipes/django.yaml +180 -0
  112. package/src/frameworks/recipes/laravel.yaml +137 -0
  113. package/src/frameworks/recipes/nextjs.yaml +268 -0
  114. package/src/frameworks/recipes/nuxt.yaml +175 -0
  115. package/src/frameworks/recipes/rails.yaml +188 -0
  116. package/src/frameworks/recipes/react.yaml +202 -0
  117. package/src/frameworks/recipes/sveltekit.yaml +154 -0
  118. package/src/frameworks/recipes/vue.yaml +137 -0
  119. package/src/frameworks/recipes/wordpress.yaml +209 -0
  120. package/src/frameworks/suggestion-engine.ts +320 -0
  121. package/src/geo/geo-content.test.ts +305 -0
  122. package/src/geo/geo-content.ts +266 -0
  123. package/src/geo/geo-history.test.ts +473 -0
  124. package/src/geo/geo-history.ts +433 -0
  125. package/src/geo/geo-tracker.test.ts +359 -0
  126. package/src/geo/geo-tracker.ts +411 -0
  127. package/src/geo/index.ts +10 -0
  128. package/src/git/commit-helper.test.ts +261 -0
  129. package/src/git/commit-helper.ts +329 -0
  130. package/src/git/index.ts +12 -0
  131. package/src/git/pr-helper.test.ts +284 -0
  132. package/src/git/pr-helper.ts +307 -0
  133. package/src/index.ts +66 -0
  134. package/src/keywords/ai-keyword-engine.ts +1062 -0
  135. package/src/keywords/ai-summarizer.ts +387 -0
  136. package/src/keywords/ci-mode.ts +555 -0
  137. package/src/keywords/engine.ts +359 -0
  138. package/src/keywords/index.ts +151 -0
  139. package/src/keywords/llm-judge.ts +357 -0
  140. package/src/keywords/nlp-analysis.ts +706 -0
  141. package/src/keywords/prioritizer.ts +295 -0
  142. package/src/keywords/site-crawler.ts +342 -0
  143. package/src/keywords/sources/autocomplete.ts +139 -0
  144. package/src/keywords/sources/competitive-search.ts +450 -0
  145. package/src/keywords/sources/competitor-analysis.ts +374 -0
  146. package/src/keywords/sources/dataforseo.ts +206 -0
  147. package/src/keywords/sources/free-sources.ts +294 -0
  148. package/src/keywords/sources/gsc.ts +123 -0
  149. package/src/keywords/topic-grouping.ts +327 -0
  150. package/src/keywords/types.ts +144 -0
  151. package/src/keywords/wizard.ts +457 -0
  152. package/src/loader.ts +40 -0
  153. package/src/reports/index.ts +7 -0
  154. package/src/reports/report-generator.test.ts +293 -0
  155. package/src/reports/report-generator.ts +713 -0
  156. package/src/scheduler/alerts.test.ts +458 -0
  157. package/src/scheduler/alerts.ts +328 -0
  158. package/src/scheduler/index.ts +8 -0
  159. package/src/scheduler/scheduled-audit.test.ts +377 -0
  160. package/src/scheduler/scheduled-audit.ts +149 -0
  161. package/src/test/integration-test.ts +325 -0
  162. package/src/tools/analyzer.ts +373 -0
  163. package/src/tools/crawl.ts +293 -0
  164. package/src/tools/files.ts +301 -0
  165. package/src/tools/h1-fixer.ts +249 -0
  166. package/src/tools/index.ts +67 -0
  167. package/src/tracking/github-action.ts +326 -0
  168. package/src/tracking/google-analytics.ts +265 -0
  169. package/src/tracking/index.ts +45 -0
  170. package/src/tracking/report-generator.ts +386 -0
  171. package/src/tracking/search-console.ts +335 -0
  172. package/src/types.ts +134 -0
  173. package/src/utils/http.ts +302 -0
  174. package/src/wasm-adapter.ts +297 -0
  175. package/src/wasm-entry.ts +14 -0
  176. package/tsconfig.json +17 -0
  177. package/tsup.wasm.config.ts +26 -0
  178. package/vitest.config.ts +15 -0
@@ -0,0 +1,463 @@
1
+ /**
2
+ * Social Meta Tag Fix Generator
3
+ *
4
+ * Generates code fixes for missing Twitter Cards, Open Graph tags, and other social meta.
5
+ * Supports multiple frameworks: HTML, React, Next.js, Astro, Remix, SvelteKit.
6
+ */
7
+
8
+ import type { SocialMetaData } from '../checks/social-meta.js';
9
+
10
+ export interface SocialMetaFix {
11
+ issueCode: string;
12
+ filePath: string;
13
+ framework: string;
14
+ before?: string;
15
+ after: string;
16
+ explanation: string;
17
+ }
18
+
19
+ export interface SocialMetaConfig {
20
+ title: string;
21
+ description: string;
22
+ image: string;
23
+ url: string;
24
+ siteName?: string;
25
+ twitterSite?: string;
26
+ twitterCreator?: string;
27
+ type?: 'website' | 'article' | 'product';
28
+ locale?: string;
29
+ }
30
+
31
+ type Framework = 'html' | 'react' | 'nextjs-app' | 'nextjs-pages' | 'astro' | 'remix' | 'sveltekit' | 'vite-react';
32
+
33
+ /**
34
+ * Detects the framework based on project files
35
+ */
36
+ export function detectFramework(files: string[]): Framework {
37
+ const fileSet = new Set(files.map(f => f.toLowerCase()));
38
+
39
+ if (fileSet.has('next.config.js') || fileSet.has('next.config.ts') || fileSet.has('next.config.mjs')) {
40
+ // Check for app directory
41
+ if (files.some(f => f.includes('/app/') || f.includes('\\app\\'))) {
42
+ return 'nextjs-app';
43
+ }
44
+ return 'nextjs-pages';
45
+ }
46
+ if (fileSet.has('astro.config.mjs') || fileSet.has('astro.config.ts')) {
47
+ return 'astro';
48
+ }
49
+ if (fileSet.has('remix.config.js') || fileSet.has('remix.config.ts')) {
50
+ return 'remix';
51
+ }
52
+ if (fileSet.has('svelte.config.js') || fileSet.has('svelte.config.ts')) {
53
+ return 'sveltekit';
54
+ }
55
+ if (fileSet.has('vite.config.ts') || fileSet.has('vite.config.js')) {
56
+ if (files.some(f => f.endsWith('.tsx') || f.endsWith('.jsx'))) {
57
+ return 'vite-react';
58
+ }
59
+ }
60
+ if (files.some(f => f.endsWith('.tsx') || f.endsWith('.jsx'))) {
61
+ return 'react';
62
+ }
63
+ return 'html';
64
+ }
65
+
66
+ /**
67
+ * Generates complete social meta tags for HTML
68
+ */
69
+ export function generateHTMLSocialMeta(config: SocialMetaConfig): string {
70
+ const lines: string[] = [
71
+ '<!-- Primary Meta Tags -->',
72
+ `<title>${config.title}</title>`,
73
+ `<meta name="title" content="${config.title}" />`,
74
+ `<meta name="description" content="${config.description}" />`,
75
+ '',
76
+ '<!-- Open Graph / Facebook -->',
77
+ `<meta property="og:type" content="${config.type || 'website'}" />`,
78
+ `<meta property="og:url" content="${config.url}" />`,
79
+ `<meta property="og:title" content="${config.title}" />`,
80
+ `<meta property="og:description" content="${config.description}" />`,
81
+ `<meta property="og:image" content="${config.image}" />`,
82
+ ];
83
+
84
+ if (config.siteName) {
85
+ lines.push(`<meta property="og:site_name" content="${config.siteName}" />`);
86
+ }
87
+ if (config.locale) {
88
+ lines.push(`<meta property="og:locale" content="${config.locale}" />`);
89
+ }
90
+
91
+ lines.push(
92
+ '',
93
+ '<!-- Twitter -->',
94
+ '<meta name="twitter:card" content="summary_large_image" />',
95
+ `<meta name="twitter:url" content="${config.url}" />`,
96
+ `<meta name="twitter:title" content="${config.title}" />`,
97
+ `<meta name="twitter:description" content="${config.description}" />`,
98
+ `<meta name="twitter:image" content="${config.image}" />`
99
+ );
100
+
101
+ if (config.twitterSite) {
102
+ lines.push(`<meta name="twitter:site" content="${config.twitterSite}" />`);
103
+ }
104
+ if (config.twitterCreator) {
105
+ lines.push(`<meta name="twitter:creator" content="${config.twitterCreator}" />`);
106
+ }
107
+
108
+ return lines.join('\n');
109
+ }
110
+
111
+ /**
112
+ * Generates React Helmet / react-helmet-async component
113
+ */
114
+ export function generateReactHelmetSocialMeta(config: SocialMetaConfig): string {
115
+ return `import { Helmet } from 'react-helmet-async';
116
+
117
+ export function SEO({
118
+ title = "${config.title}",
119
+ description = "${config.description}",
120
+ image = "${config.image}",
121
+ url = "${config.url}",
122
+ }) {
123
+ return (
124
+ <Helmet>
125
+ {/* Primary Meta Tags */}
126
+ <title>{title}</title>
127
+ <meta name="title" content={title} />
128
+ <meta name="description" content={description} />
129
+
130
+ {/* Open Graph / Facebook */}
131
+ <meta property="og:type" content="${config.type || 'website'}" />
132
+ <meta property="og:url" content={url} />
133
+ <meta property="og:title" content={title} />
134
+ <meta property="og:description" content={description} />
135
+ <meta property="og:image" content={image} />
136
+ ${config.siteName ? `<meta property="og:site_name" content="${config.siteName}" />` : ''}
137
+
138
+ {/* Twitter */}
139
+ <meta name="twitter:card" content="summary_large_image" />
140
+ <meta name="twitter:url" content={url} />
141
+ <meta name="twitter:title" content={title} />
142
+ <meta name="twitter:description" content={description} />
143
+ <meta name="twitter:image" content={image} />
144
+ ${config.twitterSite ? `<meta name="twitter:site" content="${config.twitterSite}" />` : ''}
145
+ </Helmet>
146
+ );
147
+ }`;
148
+ }
149
+
150
+ /**
151
+ * Generates Next.js App Router metadata export
152
+ */
153
+ export function generateNextAppMetadata(config: SocialMetaConfig): string {
154
+ return `import type { Metadata } from 'next';
155
+
156
+ export const metadata: Metadata = {
157
+ title: "${config.title}",
158
+ description: "${config.description}",
159
+ openGraph: {
160
+ type: '${config.type || 'website'}',
161
+ url: '${config.url}',
162
+ title: '${config.title}',
163
+ description: '${config.description}',
164
+ images: [
165
+ {
166
+ url: '${config.image}',
167
+ width: 1200,
168
+ height: 630,
169
+ alt: '${config.title}',
170
+ },
171
+ ],
172
+ ${config.siteName ? `siteName: '${config.siteName}',` : ''}
173
+ ${config.locale ? `locale: '${config.locale}',` : ''}
174
+ },
175
+ twitter: {
176
+ card: 'summary_large_image',
177
+ title: '${config.title}',
178
+ description: '${config.description}',
179
+ images: ['${config.image}'],
180
+ ${config.twitterSite ? `site: '${config.twitterSite}',` : ''}
181
+ ${config.twitterCreator ? `creator: '${config.twitterCreator}',` : ''}
182
+ },
183
+ };`;
184
+ }
185
+
186
+ /**
187
+ * Generates Next.js Pages Router Head component
188
+ */
189
+ export function generateNextPagesHead(config: SocialMetaConfig): string {
190
+ return `import Head from 'next/head';
191
+
192
+ export default function Page() {
193
+ return (
194
+ <>
195
+ <Head>
196
+ <title>${config.title}</title>
197
+ <meta name="title" content="${config.title}" />
198
+ <meta name="description" content="${config.description}" />
199
+
200
+ {/* Open Graph / Facebook */}
201
+ <meta property="og:type" content="${config.type || 'website'}" />
202
+ <meta property="og:url" content="${config.url}" />
203
+ <meta property="og:title" content="${config.title}" />
204
+ <meta property="og:description" content="${config.description}" />
205
+ <meta property="og:image" content="${config.image}" />
206
+ ${config.siteName ? `<meta property="og:site_name" content="${config.siteName}" />` : ''}
207
+
208
+ {/* Twitter */}
209
+ <meta name="twitter:card" content="summary_large_image" />
210
+ <meta name="twitter:url" content="${config.url}" />
211
+ <meta name="twitter:title" content="${config.title}" />
212
+ <meta name="twitter:description" content="${config.description}" />
213
+ <meta name="twitter:image" content="${config.image}" />
214
+ ${config.twitterSite ? `<meta name="twitter:site" content="${config.twitterSite}" />` : ''}
215
+ </Head>
216
+ {/* Page content */}
217
+ </>
218
+ );
219
+ }`;
220
+ }
221
+
222
+ /**
223
+ * Generates Astro frontmatter and BaseHead usage
224
+ */
225
+ export function generateAstroMeta(config: SocialMetaConfig): string {
226
+ return `---
227
+ // src/components/BaseHead.astro
228
+ export interface Props {
229
+ title: string;
230
+ description: string;
231
+ image?: string;
232
+ url?: string;
233
+ }
234
+
235
+ const {
236
+ title = "${config.title}",
237
+ description = "${config.description}",
238
+ image = "${config.image}",
239
+ url = Astro.url.href,
240
+ } = Astro.props;
241
+ ---
242
+
243
+ <!-- Primary Meta Tags -->
244
+ <title>{title}</title>
245
+ <meta name="title" content={title} />
246
+ <meta name="description" content={description} />
247
+
248
+ <!-- Open Graph / Facebook -->
249
+ <meta property="og:type" content="${config.type || 'website'}" />
250
+ <meta property="og:url" content={url} />
251
+ <meta property="og:title" content={title} />
252
+ <meta property="og:description" content={description} />
253
+ <meta property="og:image" content={image} />
254
+ ${config.siteName ? `<meta property="og:site_name" content="${config.siteName}" />` : ''}
255
+
256
+ <!-- Twitter -->
257
+ <meta name="twitter:card" content="summary_large_image" />
258
+ <meta name="twitter:url" content={url} />
259
+ <meta name="twitter:title" content={title} />
260
+ <meta name="twitter:description" content={description} />
261
+ <meta name="twitter:image" content={image} />
262
+ ${config.twitterSite ? `<meta name="twitter:site" content="${config.twitterSite}" />` : ''}`;
263
+ }
264
+
265
+ /**
266
+ * Generates Remix meta function
267
+ */
268
+ export function generateRemixMeta(config: SocialMetaConfig): string {
269
+ return `import type { MetaFunction } from "@remix-run/node";
270
+
271
+ export const meta: MetaFunction = () => {
272
+ return [
273
+ { title: "${config.title}" },
274
+ { name: "description", content: "${config.description}" },
275
+
276
+ // Open Graph
277
+ { property: "og:type", content: "${config.type || 'website'}" },
278
+ { property: "og:url", content: "${config.url}" },
279
+ { property: "og:title", content: "${config.title}" },
280
+ { property: "og:description", content: "${config.description}" },
281
+ { property: "og:image", content: "${config.image}" },
282
+ ${config.siteName ? `{ property: "og:site_name", content: "${config.siteName}" },` : ''}
283
+
284
+ // Twitter
285
+ { name: "twitter:card", content: "summary_large_image" },
286
+ { name: "twitter:url", content: "${config.url}" },
287
+ { name: "twitter:title", content: "${config.title}" },
288
+ { name: "twitter:description", content: "${config.description}" },
289
+ { name: "twitter:image", content: "${config.image}" },
290
+ ${config.twitterSite ? `{ name: "twitter:site", content: "${config.twitterSite}" },` : ''}
291
+ ];
292
+ };`;
293
+ }
294
+
295
+ /**
296
+ * Generates SvelteKit +page.ts and svelte:head usage
297
+ */
298
+ export function generateSvelteKitMeta(config: SocialMetaConfig): string {
299
+ return `<!-- +page.svelte -->
300
+ <script>
301
+ export let data;
302
+ </script>
303
+
304
+ <svelte:head>
305
+ <title>${config.title}</title>
306
+ <meta name="title" content="${config.title}" />
307
+ <meta name="description" content="${config.description}" />
308
+
309
+ <!-- Open Graph / Facebook -->
310
+ <meta property="og:type" content="${config.type || 'website'}" />
311
+ <meta property="og:url" content="${config.url}" />
312
+ <meta property="og:title" content="${config.title}" />
313
+ <meta property="og:description" content="${config.description}" />
314
+ <meta property="og:image" content="${config.image}" />
315
+ ${config.siteName ? `<meta property="og:site_name" content="${config.siteName}" />` : ''}
316
+
317
+ <!-- Twitter -->
318
+ <meta name="twitter:card" content="summary_large_image" />
319
+ <meta name="twitter:url" content="${config.url}" />
320
+ <meta name="twitter:title" content="${config.title}" />
321
+ <meta name="twitter:description" content="${config.description}" />
322
+ <meta name="twitter:image" content="${config.image}" />
323
+ ${config.twitterSite ? `<meta name="twitter:site" content="${config.twitterSite}" />` : ''}
324
+ </svelte:head>`;
325
+ }
326
+
327
+ /**
328
+ * Generates fix for a specific missing social meta tag
329
+ */
330
+ export function generateSocialMetaFix(
331
+ issueCode: string,
332
+ framework: Framework,
333
+ existingData: SocialMetaData,
334
+ pageData: { title?: string; description?: string; url: string }
335
+ ): SocialMetaFix {
336
+ // Use existing data or defaults
337
+ const config: SocialMetaConfig = {
338
+ title: existingData.openGraph.title || pageData.title || 'Page Title',
339
+ description: existingData.openGraph.description || pageData.description || 'Page description goes here.',
340
+ image: existingData.openGraph.image || existingData.twitter.image || 'https://example.com/og-image.png',
341
+ url: existingData.openGraph.url || pageData.url,
342
+ siteName: existingData.openGraph.siteName,
343
+ twitterSite: existingData.twitter.site,
344
+ twitterCreator: existingData.twitter.creator,
345
+ type: (existingData.openGraph.type as 'website' | 'article' | 'product') || 'website',
346
+ };
347
+
348
+ const fixes: Record<string, { explanation: string; tag: string }> = {
349
+ OG_TITLE_MISSING: {
350
+ explanation: 'Add Open Graph title for better social media previews',
351
+ tag: `<meta property="og:title" content="${config.title}" />`,
352
+ },
353
+ OG_DESCRIPTION_MISSING: {
354
+ explanation: 'Add Open Graph description for social media previews',
355
+ tag: `<meta property="og:description" content="${config.description}" />`,
356
+ },
357
+ OG_IMAGE_MISSING: {
358
+ explanation: 'Add Open Graph image (1200x630px recommended) for social previews',
359
+ tag: `<meta property="og:image" content="${config.image}" />`,
360
+ },
361
+ OG_URL_MISSING: {
362
+ explanation: 'Add Open Graph URL to specify the canonical URL for sharing',
363
+ tag: `<meta property="og:url" content="${config.url}" />`,
364
+ },
365
+ OG_TYPE_MISSING: {
366
+ explanation: 'Add Open Graph type to specify the content type',
367
+ tag: `<meta property="og:type" content="${config.type}" />`,
368
+ },
369
+ TWITTER_CARD_MISSING: {
370
+ explanation: 'Add Twitter Card meta tag for better Twitter previews',
371
+ tag: '<meta name="twitter:card" content="summary_large_image" />',
372
+ },
373
+ TWITTER_IMAGE_MISSING: {
374
+ explanation: 'Add Twitter image for Twitter Card previews',
375
+ tag: `<meta name="twitter:image" content="${config.image}" />`,
376
+ },
377
+ };
378
+
379
+ const fix = fixes[issueCode];
380
+ if (!fix) {
381
+ throw new Error(`Unknown issue code: ${issueCode}`);
382
+ }
383
+
384
+ // Determine file path based on framework
385
+ const filePaths: Record<Framework, string> = {
386
+ 'html': 'index.html',
387
+ 'react': 'src/components/SEO.tsx',
388
+ 'vite-react': 'index.html',
389
+ 'nextjs-app': 'app/layout.tsx',
390
+ 'nextjs-pages': 'pages/_app.tsx',
391
+ 'astro': 'src/components/BaseHead.astro',
392
+ 'remix': 'app/root.tsx',
393
+ 'sveltekit': 'src/routes/+layout.svelte',
394
+ };
395
+
396
+ return {
397
+ issueCode,
398
+ filePath: filePaths[framework],
399
+ framework,
400
+ after: fix.tag,
401
+ explanation: fix.explanation,
402
+ };
403
+ }
404
+
405
+ /**
406
+ * Generates complete social meta setup for a project
407
+ */
408
+ export function generateCompleteSocialMetaSetup(
409
+ framework: Framework,
410
+ config: SocialMetaConfig
411
+ ): { filePath: string; content: string; explanation: string } {
412
+ const generators: Record<Framework, () => string> = {
413
+ 'html': () => generateHTMLSocialMeta(config),
414
+ 'react': () => generateReactHelmetSocialMeta(config),
415
+ 'vite-react': () => generateReactHelmetSocialMeta(config),
416
+ 'nextjs-app': () => generateNextAppMetadata(config),
417
+ 'nextjs-pages': () => generateNextPagesHead(config),
418
+ 'astro': () => generateAstroMeta(config),
419
+ 'remix': () => generateRemixMeta(config),
420
+ 'sveltekit': () => generateSvelteKitMeta(config),
421
+ };
422
+
423
+ const filePaths: Record<Framework, string> = {
424
+ 'html': 'index.html (inside <head>)',
425
+ 'react': 'src/components/SEO.tsx',
426
+ 'vite-react': 'src/components/SEO.tsx',
427
+ 'nextjs-app': 'app/layout.tsx',
428
+ 'nextjs-pages': 'pages/_document.tsx or pages/_app.tsx',
429
+ 'astro': 'src/components/BaseHead.astro',
430
+ 'remix': 'app/root.tsx',
431
+ 'sveltekit': 'src/routes/+layout.svelte',
432
+ };
433
+
434
+ return {
435
+ filePath: filePaths[framework],
436
+ content: generators[framework](),
437
+ explanation: `Complete social meta tags setup for ${framework}. This includes Open Graph tags for Facebook/LinkedIn, Twitter Card tags, and primary meta tags for SEO.`,
438
+ };
439
+ }
440
+
441
+ /**
442
+ * OG Image recommendations based on platform requirements
443
+ */
444
+ export const OG_IMAGE_SPECS = {
445
+ recommended: {
446
+ width: 1200,
447
+ height: 630,
448
+ aspectRatio: '1.91:1',
449
+ format: ['PNG', 'JPG', 'WebP'],
450
+ maxSize: '8MB',
451
+ },
452
+ twitter: {
453
+ summary: { width: 120, height: 120 },
454
+ summary_large_image: { width: 1200, height: 600 },
455
+ },
456
+ facebook: {
457
+ minimum: { width: 200, height: 200 },
458
+ recommended: { width: 1200, height: 630 },
459
+ },
460
+ linkedin: {
461
+ recommended: { width: 1200, height: 627 },
462
+ },
463
+ };
@@ -0,0 +1,74 @@
1
+ // Comprehensive SEO Audit Module - 280+ checks
2
+
3
+ // Types
4
+ export * from './types.js';
5
+
6
+ // Main engine
7
+ export { runFullAudit, formatReport } from './engine.js';
8
+ export type { AuditOptions } from './engine.js';
9
+
10
+ // Individual check modules (for granular use)
11
+ export { runCrawlabilityChecks, checkRobotsTxt, checkSitemap, checkRedirects } from './checks/crawlability.js';
12
+ export { analyzeOnPage } from './checks/on-page.js';
13
+ export { analyzeLinks } from './checks/links.js';
14
+ export { analyzeImages } from './checks/images.js';
15
+ export { analyzePerformance, fetchCoreWebVitals } from './checks/performance.js';
16
+ export { analyzeSecurity, checkCertificate } from './checks/security.js';
17
+ export { analyzeStructuredData, suggestSchemaTypes } from './checks/structured-data.js';
18
+ export { analyzeMobile, checkMobileResources } from './checks/mobile.js';
19
+
20
+ // Advanced check modules
21
+ export { analyzeHreflang } from './checks/hreflang.js';
22
+ export { analyzeSocialMeta } from './checks/social-meta.js';
23
+ export { detectSoft404 } from './checks/soft-404.js';
24
+ export { analyzeAnchorText } from './checks/anchor-text.js';
25
+ export { analyzeCanonicalAdvanced } from './checks/canonical-advanced.js';
26
+ export { extractContentHash, detectDuplicates, generateDuplicateIssues } from './checks/duplicate-content.js';
27
+ export { analyzePagination } from './checks/pagination.js';
28
+ export { analyzeRedirects, checkInternalRedirects } from './checks/redirect-analysis.js';
29
+
30
+ // New competitor-parity check modules
31
+ export { runAIReadinessChecks, checkLlmsTxt, checkAIBotBlocking, checkJSRenderingRatio } from './checks/ai-readiness.js';
32
+ export { analyzeSERPPreview } from './checks/serp-preview.js';
33
+ export { analyzeLocalSEO } from './checks/local-seo.js';
34
+ export { analyzeSecurityHeaders } from './checks/security-headers.js';
35
+ export { analyzeContentFreshness } from './checks/content-freshness.js';
36
+ export { analyzeDOMStructure } from './checks/dom-analysis.js';
37
+ export { analyzeModernImages } from './checks/modern-images.js';
38
+ export { detectTechnologies } from './checks/tech-detection.js';
39
+ export { analyzeKeywords } from './checks/keyword-analysis.js';
40
+ export { runAdditionalChecks, checkAdsTxt, checkDMARC, checkSPF, checkAMP, checkPlaintextEmails, checkAppleTouchIcon } from './checks/additional-checks.js';
41
+
42
+ // Checks from Technical SEO for Developers & Best SEO Strategies 2025
43
+ export { analyzeTrackerBloat } from './checks/tracker-bloat.js';
44
+ export { analyzeClientRendering } from './checks/client-rendering.js';
45
+ export { analyzeRedirectChain } from './checks/redirect-chain.js';
46
+ export { analyzeResponsiveImages } from './checks/responsive-images.js';
47
+
48
+ // 2026 SEO checks (Nathan Gotch & Neil Patel research)
49
+ export { analyzeConversionElements } from './checks/conversion-elements.js';
50
+ export { analyzeKeywordPlacement } from './checks/keyword-placement.js';
51
+ export { analyzeTopicalClusters } from './checks/topical-clusters.js';
52
+ export { analyzePlatformPresence } from './checks/platform-presence.js';
53
+ // Advanced SEO Tips 2026 & React SEO
54
+ export { analyzeInteractiveTools } from './checks/interactive-tools.js';
55
+ export { analyzeFunnelIntent } from './checks/funnel-intent.js';
56
+ // Cutting-edge differentiating checks (Google leak, Entity SEO, QDF)
57
+ export { analyzeNavBoostSignals } from './checks/navboost-signals.js';
58
+ export { analyzeEntitySEO } from './checks/entity-seo.js';
59
+ export { analyzeFreshnessSignals } from './checks/freshness-signals.js';
60
+
61
+ // URL Safety (local hash database - Google Safe Browsing style)
62
+ export { analyzeUrlSafety, urlSafetyDatabase } from './checks/url-safety.js';
63
+
64
+ // Page discovery (multi-page crawling)
65
+ export { discoverPagesFromLinks, parseSitemap, mergePages } from './discovery/link-crawler.js';
66
+ export { discoverRoutesFromRepo, detectFramework, routesToUrls } from './discovery/repo-routes.js';
67
+ export type { DiscoveredPage } from './discovery/link-crawler.js';
68
+ export type { RouteInfo } from './discovery/repo-routes.js';
69
+
70
+ // Fix generators
71
+ export * from './fixes/index.js';
72
+
73
+ // High-level runner
74
+ export * from './runner.js';