@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,399 @@
1
+ /**
2
+ * AI Citation Worthiness Checks
3
+ *
4
+ * AI systems prefer to cite content that demonstrates originality and
5
+ * human expertise - things AI can't easily fake. This check analyzes
6
+ * signals that make content worthy of being cited as a source.
7
+ *
8
+ * Key insight: "If AI can easily create it, don't publish it.
9
+ * Add what AI can't fake: original data, real experience, real
10
+ * screenshots, real documentation, and real opinions."
11
+ */
12
+
13
+ import * as cheerio from 'cheerio';
14
+ import type { AuditIssue } from '../types.js';
15
+
16
+ export interface AICitationWorthinessData {
17
+ originalitySignals: {
18
+ hasOriginalData: boolean;
19
+ hasScreenshots: boolean;
20
+ hasOriginalImages: boolean;
21
+ hasDatedContent: boolean;
22
+ hasFirstPersonExperience: boolean;
23
+ };
24
+ expertiseSignals: {
25
+ hasAuthorByline: boolean;
26
+ hasAuthorCredentials: boolean;
27
+ hasExpertQuotes: boolean;
28
+ hasMethodology: boolean;
29
+ hasPrimaryResearch: boolean;
30
+ };
31
+ proofSignals: {
32
+ hasSpecificNumbers: boolean;
33
+ hasCaseStudies: boolean;
34
+ hasBeforeAfter: boolean;
35
+ hasDocumentation: boolean;
36
+ hasRealExamples: boolean;
37
+ };
38
+ citationWorthinessScore: number;
39
+ aiProofElements: string[];
40
+ }
41
+
42
+ // Patterns indicating original data/research
43
+ const ORIGINAL_DATA_PATTERNS = [
44
+ /(?:our data|our research|our study|our analysis|we found|we discovered)/i,
45
+ /(?:survey of|surveyed|interviewed|analyzed)\s+\d+/i,
46
+ /(?:based on|from)\s+\d+[,\d]*\s+(?:data points|samples|responses|users|customers)/i,
47
+ /(?:internal data|proprietary data|our database)/i,
48
+ ];
49
+
50
+ // Patterns indicating first-person experience
51
+ const EXPERIENCE_PATTERNS = [
52
+ /(?:in my experience|from my experience|i've found|i've seen|i've learned)/i,
53
+ /(?:when i|after i|before i|i personally|i tested|i tried|i used)/i,
54
+ /(?:our team|we tested|we tried|we implemented|we built)/i,
55
+ /(?:case study|real example|actual example|here's what happened)/i,
56
+ ];
57
+
58
+ // Patterns indicating expert quotes
59
+ const EXPERT_QUOTE_PATTERNS = [
60
+ /(?:according to|says|said|explains|notes)\s+[A-Z][a-z]+\s+[A-Z][a-z]+/,
61
+ /"[^"]{20,}"\s*[-–—]\s*[A-Z]/,
62
+ /[A-Z][a-z]+\s+[A-Z][a-z]+,?\s+(?:CEO|CTO|founder|director|manager|expert|analyst|researcher)/i,
63
+ ];
64
+
65
+ // Patterns for specific numbers (not generic)
66
+ const SPECIFIC_NUMBER_PATTERNS = [
67
+ /\$[\d,]+(?:\.\d{2})?(?:\s*(?:million|billion|k|m|b))?/i, // Dollar amounts
68
+ /\d+(?:\.\d+)?%/, // Percentages
69
+ /\d{1,2}\/\d{1,2}\/\d{2,4}/, // Dates
70
+ /(?:in|since|from)\s+(?:19|20)\d{2}/, // Years
71
+ /\d+(?:,\d{3})+/, // Large numbers with commas
72
+ /(?:increased|decreased|grew|dropped)\s+(?:by\s+)?\d+/i,
73
+ ];
74
+
75
+ // Stock image domains to detect
76
+ const STOCK_IMAGE_DOMAINS = [
77
+ 'unsplash.com', 'pexels.com', 'shutterstock.com', 'istockphoto.com',
78
+ 'gettyimages.com', 'stock.adobe.com', 'depositphotos.com', 'pixabay.com',
79
+ 'freepik.com', 'rawpixel.com', '123rf.com', 'stocksy.com',
80
+ ];
81
+
82
+ export function analyzeAICitationWorthiness(
83
+ html: string,
84
+ url: string
85
+ ): { issues: AuditIssue[]; data: AICitationWorthinessData } {
86
+ const issues: AuditIssue[] = [];
87
+ const $ = cheerio.load(html);
88
+
89
+ // Remove non-content elements
90
+ const $content = $('body').clone();
91
+ $content.find('nav, footer, script, style, noscript, aside').remove();
92
+ const bodyText = $content.text();
93
+
94
+ const aiProofElements: string[] = [];
95
+
96
+ // === ORIGINALITY SIGNALS ===
97
+
98
+ // Check for original data
99
+ let hasOriginalData = false;
100
+ for (const pattern of ORIGINAL_DATA_PATTERNS) {
101
+ if (pattern.test(bodyText)) {
102
+ hasOriginalData = true;
103
+ aiProofElements.push('Original data/research');
104
+ break;
105
+ }
106
+ }
107
+
108
+ // Check for screenshots
109
+ const images = $content.find('img');
110
+ let hasScreenshots = false;
111
+ let hasOriginalImages = false;
112
+ let stockImageCount = 0;
113
+ let totalImages = 0;
114
+
115
+ images.each((_, img) => {
116
+ const src = $(img).attr('src') || '';
117
+ const alt = $(img).attr('alt') || '';
118
+ const srcLower = src.toLowerCase();
119
+ const altLower = alt.toLowerCase();
120
+ totalImages++;
121
+
122
+ // Check for screenshot patterns
123
+ if (
124
+ srcLower.includes('screenshot') ||
125
+ srcLower.includes('screen-') ||
126
+ altLower.includes('screenshot') ||
127
+ srcLower.includes('capture') ||
128
+ /screen[_-]?\d+/i.test(src)
129
+ ) {
130
+ hasScreenshots = true;
131
+ aiProofElements.push('Screenshots');
132
+ }
133
+
134
+ // Check for stock images
135
+ const isStockImage = STOCK_IMAGE_DOMAINS.some(domain => srcLower.includes(domain));
136
+ if (isStockImage) {
137
+ stockImageCount++;
138
+ }
139
+ });
140
+
141
+ // If most images aren't stock photos, consider them original
142
+ if (totalImages > 0 && stockImageCount < totalImages * 0.5) {
143
+ hasOriginalImages = true;
144
+ if (totalImages >= 3 && stockImageCount === 0) {
145
+ aiProofElements.push('Original images');
146
+ }
147
+ }
148
+
149
+ // Check for dated content (shows real experience over time)
150
+ const datePatterns = [
151
+ /(?:updated|published|written|posted)\s+(?:on\s+)?(?:jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)/i,
152
+ /(?:last updated|originally published):\s*\d/i,
153
+ /<time[^>]*datetime/i,
154
+ ];
155
+ const hasDatedContent = datePatterns.some(p => p.test(html));
156
+ if (hasDatedContent) {
157
+ aiProofElements.push('Dated/timestamped content');
158
+ }
159
+
160
+ // Check for first-person experience
161
+ let hasFirstPersonExperience = false;
162
+ for (const pattern of EXPERIENCE_PATTERNS) {
163
+ if (pattern.test(bodyText)) {
164
+ hasFirstPersonExperience = true;
165
+ aiProofElements.push('First-person experience');
166
+ break;
167
+ }
168
+ }
169
+
170
+ // === EXPERTISE SIGNALS ===
171
+
172
+ // Check for author byline
173
+ const hasAuthorByline =
174
+ $('[class*="author"], [rel="author"], [itemprop="author"], .byline').length > 0 ||
175
+ /by\s+[A-Z][a-z]+\s+[A-Z][a-z]+/i.test(bodyText);
176
+
177
+ // Check for author credentials
178
+ const credentialPatterns = [
179
+ /(?:PhD|Ph\.D|MD|M\.D|MBA|CPA|JD|J\.D)/,
180
+ /(?:certified|licensed|accredited)\s+\w+/i,
181
+ /\d+\+?\s*years?\s+(?:of\s+)?experience/i,
182
+ /(?:expert|specialist|professional)\s+in/i,
183
+ ];
184
+ const hasAuthorCredentials = credentialPatterns.some(p => p.test(bodyText));
185
+ if (hasAuthorCredentials) {
186
+ aiProofElements.push('Expert credentials');
187
+ }
188
+
189
+ // Check for expert quotes
190
+ let hasExpertQuotes = false;
191
+ for (const pattern of EXPERT_QUOTE_PATTERNS) {
192
+ if (pattern.test(bodyText)) {
193
+ hasExpertQuotes = true;
194
+ aiProofElements.push('Expert quotes');
195
+ break;
196
+ }
197
+ }
198
+
199
+ // Check for methodology section
200
+ const hasMethodology =
201
+ /(?:methodology|method|approach|how we|our process)/i.test(
202
+ $('h2, h3, h4').text()
203
+ ) ||
204
+ /(?:we measured|we calculated|we analyzed|data was collected)/i.test(bodyText);
205
+
206
+ // Check for primary research indicators
207
+ const hasPrimaryResearch =
208
+ /(?:original research|primary research|we conducted|our study found)/i.test(bodyText) ||
209
+ /(?:sample size|n\s*=\s*\d+|participants|respondents)/i.test(bodyText);
210
+
211
+ if (hasPrimaryResearch) {
212
+ aiProofElements.push('Primary research');
213
+ }
214
+
215
+ // === PROOF SIGNALS ===
216
+
217
+ // Check for specific numbers
218
+ let specificNumberCount = 0;
219
+ for (const pattern of SPECIFIC_NUMBER_PATTERNS) {
220
+ const matches = bodyText.match(pattern);
221
+ if (matches) {
222
+ specificNumberCount += matches.length;
223
+ }
224
+ }
225
+ const hasSpecificNumbers = specificNumberCount >= 5;
226
+ if (hasSpecificNumbers) {
227
+ aiProofElements.push('Specific data points');
228
+ }
229
+
230
+ // Check for case studies
231
+ const hasCaseStudies =
232
+ /(?:case study|case studies|success story|client story)/i.test(bodyText) ||
233
+ $('[class*="case-study"], [id*="case-study"]').length > 0;
234
+
235
+ if (hasCaseStudies) {
236
+ aiProofElements.push('Case studies');
237
+ }
238
+
239
+ // Check for before/after comparisons
240
+ const hasBeforeAfter =
241
+ /(?:before and after|before\/after|before vs|the results)/i.test(bodyText) ||
242
+ $('[class*="before-after"], [class*="comparison"]').length > 0;
243
+
244
+ // Check for documentation/code examples
245
+ const hasDocumentation =
246
+ $('pre code, .highlight, .code-block').length > 0 ||
247
+ /```[\s\S]*?```/.test(bodyText) ||
248
+ $('[class*="documentation"]').length > 0;
249
+
250
+ if (hasDocumentation) {
251
+ aiProofElements.push('Code/documentation');
252
+ }
253
+
254
+ // Check for real examples
255
+ const hasRealExamples =
256
+ /(?:for example|here's an example|real example|actual example|let me show)/i.test(bodyText) ||
257
+ /(?:example:|e\.g\.,|such as:)/i.test(bodyText);
258
+
259
+ // === CALCULATE SCORE ===
260
+ let citationWorthinessScore = 20; // Base score
261
+
262
+ // Originality signals (up to 35 points)
263
+ if (hasOriginalData) citationWorthinessScore += 15;
264
+ if (hasScreenshots) citationWorthinessScore += 5;
265
+ if (hasOriginalImages) citationWorthinessScore += 5;
266
+ if (hasDatedContent) citationWorthinessScore += 5;
267
+ if (hasFirstPersonExperience) citationWorthinessScore += 5;
268
+
269
+ // Expertise signals (up to 25 points)
270
+ if (hasAuthorByline) citationWorthinessScore += 5;
271
+ if (hasAuthorCredentials) citationWorthinessScore += 10;
272
+ if (hasExpertQuotes) citationWorthinessScore += 5;
273
+ if (hasMethodology) citationWorthinessScore += 5;
274
+ if (hasPrimaryResearch) citationWorthinessScore += 10;
275
+
276
+ // Proof signals (up to 20 points)
277
+ if (hasSpecificNumbers) citationWorthinessScore += 5;
278
+ if (hasCaseStudies) citationWorthinessScore += 5;
279
+ if (hasBeforeAfter) citationWorthinessScore += 3;
280
+ if (hasDocumentation) citationWorthinessScore += 4;
281
+ if (hasRealExamples) citationWorthinessScore += 3;
282
+
283
+ citationWorthinessScore = Math.min(100, Math.max(0, citationWorthinessScore));
284
+
285
+ // === GENERATE ISSUES ===
286
+
287
+ // No original data or research
288
+ if (!hasOriginalData && !hasPrimaryResearch) {
289
+ issues.push({
290
+ code: 'AI_NO_ORIGINAL_DATA',
291
+ severity: 'notice',
292
+ category: 'ai-readiness',
293
+ title: 'No original data or research signals',
294
+ description: 'Content lacks original data, surveys, or research findings. AI prefers citing sources with unique, first-party data.',
295
+ impact: 'Generic content without original data is less likely to be cited as a source.',
296
+ howToFix: 'Add original data: survey results, internal analytics, case study numbers, or primary research findings. Use phrases like "Our data shows..." or "We surveyed X users...".',
297
+ affectedUrls: [url],
298
+ });
299
+ }
300
+
301
+ // No first-person experience
302
+ if (!hasFirstPersonExperience && !hasCaseStudies) {
303
+ issues.push({
304
+ code: 'AI_NO_EXPERIENCE_SIGNALS',
305
+ severity: 'notice',
306
+ category: 'ai-readiness',
307
+ title: 'No first-hand experience signals',
308
+ description: 'Content reads like it could be AI-generated. No "I tested...", "We implemented...", or case study language found.',
309
+ impact: 'AI may prefer sources that demonstrate real-world experience over generic explanations.',
310
+ howToFix: 'Add personal experience: "In my experience...", "When we tested...", "Here\'s what happened when...". Include specific scenarios you\'ve encountered.',
311
+ affectedUrls: [url],
312
+ });
313
+ }
314
+
315
+ // Stock images detected
316
+ if (stockImageCount > 0 && stockImageCount >= totalImages * 0.5) {
317
+ issues.push({
318
+ code: 'AI_STOCK_IMAGE_HEAVY',
319
+ severity: 'notice',
320
+ category: 'ai-readiness',
321
+ title: 'Heavy use of stock images',
322
+ description: `${stockImageCount} of ${totalImages} images appear to be from stock photo sites. Original visuals signal authenticity.`,
323
+ impact: 'Stock-heavy content appears less authentic and expert to both users and AI.',
324
+ howToFix: 'Replace stock photos with original screenshots, diagrams, photos, or custom graphics that AI cannot easily replicate.',
325
+ affectedUrls: [url],
326
+ details: {
327
+ stockImageCount,
328
+ totalImages,
329
+ },
330
+ });
331
+ }
332
+
333
+ // No author credentials
334
+ if (!hasAuthorByline && !hasAuthorCredentials) {
335
+ issues.push({
336
+ code: 'AI_NO_AUTHOR_EXPERTISE',
337
+ severity: 'notice',
338
+ category: 'ai-readiness',
339
+ title: 'No author expertise signals',
340
+ description: 'No author byline or credentials found. AI values content from identifiable experts.',
341
+ impact: 'Anonymous content is less trustworthy for AI citation purposes.',
342
+ howToFix: 'Add author byline with credentials: name, title, years of experience, certifications, or relevant expertise.',
343
+ affectedUrls: [url],
344
+ });
345
+ }
346
+
347
+ // Low citation worthiness
348
+ if (citationWorthinessScore < 40) {
349
+ issues.push({
350
+ code: 'AI_LOW_CITATION_WORTHINESS',
351
+ severity: 'warning',
352
+ category: 'ai-readiness',
353
+ title: 'Content lacks AI-proof originality signals',
354
+ description: `Citation worthiness score: ${citationWorthinessScore}/100. Content appears generic and could be easily replicated by AI.`,
355
+ impact: 'AI may not cite this content as it lacks unique value that AI cannot generate itself.',
356
+ howToFix: 'Add what AI can\'t fake: original data, real screenshots, dated experiences, expert quotes, case studies, and specific proof points.',
357
+ affectedUrls: [url],
358
+ details: {
359
+ citationWorthinessScore,
360
+ aiProofElements: aiProofElements.length > 0 ? aiProofElements : ['None detected'],
361
+ missing: [
362
+ !hasOriginalData && 'Original data/research',
363
+ !hasFirstPersonExperience && 'First-person experience',
364
+ !hasAuthorCredentials && 'Expert credentials',
365
+ !hasSpecificNumbers && 'Specific data points',
366
+ ].filter(Boolean),
367
+ },
368
+ });
369
+ }
370
+
371
+ return {
372
+ issues,
373
+ data: {
374
+ originalitySignals: {
375
+ hasOriginalData,
376
+ hasScreenshots,
377
+ hasOriginalImages,
378
+ hasDatedContent,
379
+ hasFirstPersonExperience,
380
+ },
381
+ expertiseSignals: {
382
+ hasAuthorByline,
383
+ hasAuthorCredentials,
384
+ hasExpertQuotes,
385
+ hasMethodology,
386
+ hasPrimaryResearch,
387
+ },
388
+ proofSignals: {
389
+ hasSpecificNumbers,
390
+ hasCaseStudies,
391
+ hasBeforeAfter,
392
+ hasDocumentation,
393
+ hasRealExamples,
394
+ },
395
+ citationWorthinessScore,
396
+ aiProofElements,
397
+ },
398
+ };
399
+ }