@rankcli/agent-runtime 0.0.15 → 0.0.17

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 (203) hide show
  1. package/README.md +5 -4
  2. package/dist/index.d.mts +44 -393
  3. package/dist/index.d.ts +44 -393
  4. package/dist/index.js +22098 -26131
  5. package/dist/index.mjs +11834 -15857
  6. package/package.json +10 -4
  7. package/scripts/build-deno.ts +0 -134
  8. package/src/analyzers/core-web-vitals-analyzer.test.ts +0 -236
  9. package/src/analyzers/core-web-vitals-analyzer.ts +0 -557
  10. package/src/analyzers/geo-analyzer.test.ts +0 -310
  11. package/src/analyzers/geo-analyzer.ts +0 -814
  12. package/src/analyzers/image-optimization-analyzer.test.ts +0 -145
  13. package/src/analyzers/image-optimization-analyzer.ts +0 -348
  14. package/src/analyzers/index.ts +0 -233
  15. package/src/analyzers/internal-linking-analyzer.test.ts +0 -141
  16. package/src/analyzers/internal-linking-analyzer.ts +0 -419
  17. package/src/analyzers/mobile-seo-analyzer.test.ts +0 -140
  18. package/src/analyzers/mobile-seo-analyzer.ts +0 -455
  19. package/src/analyzers/security-headers-analyzer.test.ts +0 -115
  20. package/src/analyzers/security-headers-analyzer.ts +0 -318
  21. package/src/analyzers/structured-data-analyzer.test.ts +0 -210
  22. package/src/analyzers/structured-data-analyzer.ts +0 -590
  23. package/src/audit/ai/analyzer.ts +0 -347
  24. package/src/audit/ai/index.ts +0 -29
  25. package/src/audit/ai/prompts/content-analysis.ts +0 -271
  26. package/src/audit/ai/types.ts +0 -179
  27. package/src/audit/checks/additional-checks.ts +0 -439
  28. package/src/audit/checks/agent-experience.ts +0 -108
  29. package/src/audit/checks/ai-citation-worthiness.ts +0 -399
  30. package/src/audit/checks/ai-content-structure.ts +0 -325
  31. package/src/audit/checks/ai-readiness.ts +0 -406
  32. package/src/audit/checks/anchor-text.ts +0 -179
  33. package/src/audit/checks/answer-conciseness.ts +0 -322
  34. package/src/audit/checks/asset-minification.ts +0 -270
  35. package/src/audit/checks/bing-optimization.ts +0 -206
  36. package/src/audit/checks/brand-mention-optimization.ts +0 -349
  37. package/src/audit/checks/caching-headers.ts +0 -305
  38. package/src/audit/checks/canonical-advanced.ts +0 -150
  39. package/src/audit/checks/canonical-domain.ts +0 -196
  40. package/src/audit/checks/citation-quality.ts +0 -358
  41. package/src/audit/checks/client-rendering.ts +0 -542
  42. package/src/audit/checks/color-contrast.ts +0 -342
  43. package/src/audit/checks/content-freshness.ts +0 -170
  44. package/src/audit/checks/content-science.ts +0 -589
  45. package/src/audit/checks/conversion-elements.ts +0 -526
  46. package/src/audit/checks/crawlability.ts +0 -220
  47. package/src/audit/checks/directory-listing.ts +0 -172
  48. package/src/audit/checks/dom-analysis.ts +0 -191
  49. package/src/audit/checks/dom-size.ts +0 -246
  50. package/src/audit/checks/duplicate-content.ts +0 -194
  51. package/src/audit/checks/eeat-signals.ts +0 -990
  52. package/src/audit/checks/entity-seo.ts +0 -396
  53. package/src/audit/checks/featured-snippet.ts +0 -473
  54. package/src/audit/checks/freshness-signals.ts +0 -443
  55. package/src/audit/checks/funnel-intent.ts +0 -463
  56. package/src/audit/checks/hreflang.ts +0 -174
  57. package/src/audit/checks/html-compliance.ts +0 -302
  58. package/src/audit/checks/image-dimensions.ts +0 -167
  59. package/src/audit/checks/images.ts +0 -160
  60. package/src/audit/checks/indexnow.ts +0 -275
  61. package/src/audit/checks/interactive-tools.ts +0 -475
  62. package/src/audit/checks/internal-link-graph.ts +0 -436
  63. package/src/audit/checks/keyword-analysis.ts +0 -239
  64. package/src/audit/checks/keyword-cannibalization.ts +0 -385
  65. package/src/audit/checks/keyword-placement.ts +0 -471
  66. package/src/audit/checks/links.ts +0 -273
  67. package/src/audit/checks/llms-txt.ts +0 -224
  68. package/src/audit/checks/local-seo.ts +0 -296
  69. package/src/audit/checks/mobile.ts +0 -167
  70. package/src/audit/checks/modern-images.ts +0 -226
  71. package/src/audit/checks/navboost-signals.ts +0 -395
  72. package/src/audit/checks/on-page.ts +0 -209
  73. package/src/audit/checks/page-resources.ts +0 -285
  74. package/src/audit/checks/pagination.ts +0 -180
  75. package/src/audit/checks/performance.ts +0 -153
  76. package/src/audit/checks/platform-presence.ts +0 -580
  77. package/src/audit/checks/rag-chunk-readiness.test.ts +0 -159
  78. package/src/audit/checks/rag-chunk-readiness.ts +0 -163
  79. package/src/audit/checks/redirect-analysis.ts +0 -153
  80. package/src/audit/checks/redirect-chain.ts +0 -389
  81. package/src/audit/checks/resource-hints.ts +0 -420
  82. package/src/audit/checks/responsive-css.ts +0 -247
  83. package/src/audit/checks/responsive-images.ts +0 -396
  84. package/src/audit/checks/review-ecosystem.ts +0 -415
  85. package/src/audit/checks/robots-validation.ts +0 -373
  86. package/src/audit/checks/security-headers.ts +0 -188
  87. package/src/audit/checks/security.ts +0 -144
  88. package/src/audit/checks/serp-preview.ts +0 -251
  89. package/src/audit/checks/site-maturity.ts +0 -453
  90. package/src/audit/checks/social-meta.test.ts +0 -275
  91. package/src/audit/checks/social-meta.ts +0 -134
  92. package/src/audit/checks/soft-404.ts +0 -151
  93. package/src/audit/checks/structured-data.ts +0 -238
  94. package/src/audit/checks/tech-detection.ts +0 -496
  95. package/src/audit/checks/topical-clusters.ts +0 -435
  96. package/src/audit/checks/tracker-bloat.ts +0 -462
  97. package/src/audit/checks/tracking-verification.test.ts +0 -371
  98. package/src/audit/checks/tracking-verification.ts +0 -636
  99. package/src/audit/checks/url-safety.ts +0 -682
  100. package/src/audit/deno-entry.ts +0 -66
  101. package/src/audit/discovery/index.ts +0 -15
  102. package/src/audit/discovery/link-crawler.ts +0 -233
  103. package/src/audit/discovery/repo-routes.ts +0 -347
  104. package/src/audit/engine.ts +0 -633
  105. package/src/audit/fixes/index.ts +0 -209
  106. package/src/audit/fixes/social-meta-fixes.test.ts +0 -329
  107. package/src/audit/fixes/social-meta-fixes.ts +0 -463
  108. package/src/audit/index.ts +0 -74
  109. package/src/audit/runner.test.ts +0 -299
  110. package/src/audit/runner.ts +0 -130
  111. package/src/audit/types.ts +0 -1987
  112. package/src/content/featured-snippet.ts +0 -367
  113. package/src/content/generator.test.ts +0 -534
  114. package/src/content/generator.ts +0 -501
  115. package/src/content/headline.ts +0 -317
  116. package/src/content/index.ts +0 -62
  117. package/src/content/intent.ts +0 -258
  118. package/src/content/keyword-density.ts +0 -349
  119. package/src/content/readability.ts +0 -262
  120. package/src/executor.ts +0 -336
  121. package/src/fixer/framework-fixes.test.ts +0 -489
  122. package/src/fixer/framework-fixes.ts +0 -5287
  123. package/src/fixer/index.ts +0 -6
  124. package/src/fixer/schemas.ts +0 -971
  125. package/src/fixer.ts +0 -642
  126. package/src/frameworks/detector.test.ts +0 -248
  127. package/src/frameworks/detector.ts +0 -899
  128. package/src/frameworks/index.ts +0 -68
  129. package/src/frameworks/recipes/angular.yaml +0 -171
  130. package/src/frameworks/recipes/astro.yaml +0 -206
  131. package/src/frameworks/recipes/django.yaml +0 -180
  132. package/src/frameworks/recipes/laravel.yaml +0 -137
  133. package/src/frameworks/recipes/nextjs.yaml +0 -268
  134. package/src/frameworks/recipes/nuxt.yaml +0 -175
  135. package/src/frameworks/recipes/rails.yaml +0 -188
  136. package/src/frameworks/recipes/react.yaml +0 -202
  137. package/src/frameworks/recipes/sveltekit.yaml +0 -154
  138. package/src/frameworks/recipes/vue.yaml +0 -137
  139. package/src/frameworks/recipes/wordpress.yaml +0 -209
  140. package/src/frameworks/suggestion-engine.ts +0 -357
  141. package/src/geo/geo-content.test.ts +0 -305
  142. package/src/geo/geo-content.ts +0 -266
  143. package/src/geo/geo-history.test.ts +0 -473
  144. package/src/geo/geo-history.ts +0 -433
  145. package/src/geo/geo-tracker.test.ts +0 -359
  146. package/src/geo/geo-tracker.ts +0 -411
  147. package/src/geo/index.ts +0 -11
  148. package/src/geo/llm-citation-checker.ts +0 -188
  149. package/src/git/commit-helper.test.ts +0 -261
  150. package/src/git/commit-helper.ts +0 -329
  151. package/src/git/index.ts +0 -12
  152. package/src/git/pr-helper.test.ts +0 -284
  153. package/src/git/pr-helper.ts +0 -307
  154. package/src/index.ts +0 -76
  155. package/src/keywords/ai-keyword-engine.ts +0 -1062
  156. package/src/keywords/ai-summarizer.ts +0 -387
  157. package/src/keywords/ci-mode.ts +0 -555
  158. package/src/keywords/engine.ts +0 -359
  159. package/src/keywords/index.ts +0 -151
  160. package/src/keywords/llm-judge.ts +0 -357
  161. package/src/keywords/nlp-analysis.ts +0 -706
  162. package/src/keywords/prioritizer.ts +0 -295
  163. package/src/keywords/site-crawler.ts +0 -342
  164. package/src/keywords/sources/autocomplete.ts +0 -139
  165. package/src/keywords/sources/competitive-search.ts +0 -450
  166. package/src/keywords/sources/competitor-analysis.ts +0 -374
  167. package/src/keywords/sources/dataforseo.ts +0 -206
  168. package/src/keywords/sources/free-sources.ts +0 -294
  169. package/src/keywords/sources/gsc.ts +0 -123
  170. package/src/keywords/topic-grouping.ts +0 -327
  171. package/src/keywords/types.ts +0 -144
  172. package/src/keywords/wizard.ts +0 -457
  173. package/src/loader.ts +0 -40
  174. package/src/ranking/index.ts +0 -5
  175. package/src/ranking/serp-client.ts +0 -348
  176. package/src/ranking/tracker.ts +0 -380
  177. package/src/ranking/types.ts +0 -123
  178. package/src/reports/index.ts +0 -7
  179. package/src/reports/report-generator.test.ts +0 -293
  180. package/src/reports/report-generator.ts +0 -713
  181. package/src/scheduler/alerts.test.ts +0 -458
  182. package/src/scheduler/alerts.ts +0 -328
  183. package/src/scheduler/index.ts +0 -8
  184. package/src/scheduler/scheduled-audit.test.ts +0 -377
  185. package/src/scheduler/scheduled-audit.ts +0 -149
  186. package/src/test/integration-test.ts +0 -325
  187. package/src/tools/analyzer.ts +0 -373
  188. package/src/tools/crawl.ts +0 -293
  189. package/src/tools/files.ts +0 -301
  190. package/src/tools/h1-fixer.ts +0 -249
  191. package/src/tools/index.ts +0 -67
  192. package/src/tracking/github-action.ts +0 -326
  193. package/src/tracking/google-analytics.ts +0 -265
  194. package/src/tracking/index.ts +0 -45
  195. package/src/tracking/report-generator.ts +0 -386
  196. package/src/tracking/search-console.ts +0 -335
  197. package/src/types.ts +0 -148
  198. package/src/utils/http.ts +0 -302
  199. package/src/wasm-adapter.ts +0 -297
  200. package/src/wasm-entry.ts +0 -14
  201. package/tsconfig.json +0 -17
  202. package/tsup.wasm.config.ts +0 -26
  203. package/vitest.config.ts +0 -15
@@ -1,555 +0,0 @@
1
- /**
2
- * CI Mode for Keyword Research
3
- *
4
- * Handles automated keyword research in CI/CD pipelines.
5
- * - If confidence is high enough, adds keywords to PR
6
- * - If uncertainty is high, skips and warns user
7
- * - Provides clear instructions for what to do next
8
- */
9
-
10
- import {
11
- runAIKeywordResearch,
12
- type PaidKeywordResult,
13
- type FreeKeywordResult,
14
- type KeywordRecommendation,
15
- type PlanTier,
16
- } from './ai-keyword-engine.js';
17
- import type { SiteSummary } from './ai-summarizer.js';
18
-
19
- export interface CIKeywordOptions {
20
- url: string;
21
- tier: PlanTier;
22
- openaiApiKey?: string;
23
- /** Minimum confidence to proceed (default: 0.7) */
24
- minConfidence?: number;
25
- /** Maximum keywords to include in PR */
26
- maxKeywords?: number;
27
- /** Branch name for context */
28
- branchName?: string;
29
- /** PR number if applicable */
30
- prNumber?: number;
31
- /** Site ID for dashboard link */
32
- siteId?: string;
33
- }
34
-
35
- export interface CIKeywordResult {
36
- /** Whether keywords can be added to the PR */
37
- canAddToPR: boolean;
38
- /** Keywords to add (if canAddToPR is true) */
39
- keywords: KeywordRecommendation[];
40
- /** Warning messages to display */
41
- warnings: string[];
42
- /** Error messages (if any) */
43
- errors: string[];
44
- /** Info messages */
45
- info: string[];
46
- /** Actions user needs to take */
47
- requiredActions: CIAction[];
48
- /** PR comment body */
49
- prCommentBody: string;
50
- /** Exit code (0 = success, 1 = needs action, 2 = error) */
51
- exitCode: 0 | 1 | 2;
52
- /** Detailed explanation */
53
- explanation: string;
54
- /** Raw result for debugging */
55
- rawResult?: PaidKeywordResult | FreeKeywordResult;
56
- }
57
-
58
- export interface CIAction {
59
- title: string;
60
- description: string;
61
- command?: string;
62
- webUrl?: string;
63
- priority: 'high' | 'medium' | 'low';
64
- }
65
-
66
- const CI_CONFIDENCE_THRESHOLD = 0.7;
67
- const MAX_KEYWORDS_IN_PR = 10;
68
-
69
- /**
70
- * Run keyword research in CI mode
71
- */
72
- export async function runCIKeywordResearch(
73
- options: CIKeywordOptions
74
- ): Promise<CIKeywordResult> {
75
- const {
76
- url,
77
- tier,
78
- openaiApiKey,
79
- minConfidence = CI_CONFIDENCE_THRESHOLD,
80
- maxKeywords = MAX_KEYWORDS_IN_PR,
81
- siteId,
82
- } = options;
83
-
84
- const warnings: string[] = [];
85
- const errors: string[] = [];
86
- const info: string[] = [];
87
- const actions: CIAction[] = [];
88
-
89
- console.log('đŸ”Ŧ Running keyword research in CI mode...');
90
-
91
- // Free tier gets limited results and upgrade prompt
92
- if (tier === 'free') {
93
- return handleFreeTierCI(url, siteId);
94
- }
95
-
96
- // Paid tier - require API key
97
- if (!openaiApiKey) {
98
- errors.push('OpenAI API key required for keyword research in CI mode');
99
- return {
100
- canAddToPR: false,
101
- keywords: [],
102
- warnings,
103
- errors,
104
- info,
105
- requiredActions: [
106
- {
107
- title: 'Add OpenAI API Key',
108
- description: 'Set OPENAI_API_KEY in your GitHub secrets',
109
- command: 'gh secret set OPENAI_API_KEY',
110
- priority: 'high',
111
- },
112
- ],
113
- prCommentBody: generateErrorPRComment(errors),
114
- exitCode: 2,
115
- explanation: 'Missing required OpenAI API key for AI-powered keyword research.',
116
- };
117
- }
118
-
119
- try {
120
- // Run the keyword research
121
- const result = await runAIKeywordResearch({
122
- url,
123
- tier,
124
- openaiApiKey,
125
- ciMode: true,
126
- });
127
-
128
- // Handle paid tier result
129
- if ('uncertainty' in result) {
130
- return handlePaidTierCI(result, {
131
- minConfidence,
132
- maxKeywords,
133
- siteId,
134
- warnings,
135
- info,
136
- });
137
- }
138
-
139
- // Shouldn't happen, but handle just in case
140
- return handleFreeTierCI(url, siteId);
141
- } catch (error) {
142
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
143
- errors.push(`Keyword research failed: ${errorMessage}`);
144
-
145
- return {
146
- canAddToPR: false,
147
- keywords: [],
148
- warnings,
149
- errors,
150
- info,
151
- requiredActions: [
152
- {
153
- title: 'Check Configuration',
154
- description: 'Verify your API keys and site URL are correct',
155
- priority: 'high',
156
- },
157
- ],
158
- prCommentBody: generateErrorPRComment(errors),
159
- exitCode: 2,
160
- explanation: `Keyword research encountered an error: ${errorMessage}`,
161
- };
162
- }
163
- }
164
-
165
- /**
166
- * Handle free tier CI results
167
- */
168
- function handleFreeTierCI(url: string, siteId?: string): CIKeywordResult {
169
- const dashboardUrl = siteId
170
- ? `https://rankcli.dev/dashboard/projects/${siteId}/keywords`
171
- : 'https://rankcli.dev/pricing';
172
-
173
- return {
174
- canAddToPR: false,
175
- keywords: [],
176
- warnings: [
177
- 'Keyword research requires a paid plan for CI automation',
178
- ],
179
- errors: [],
180
- info: [
181
- `Found potential keyword opportunities for ${url}`,
182
- 'Upgrade to Solo plan or higher for automated keyword research in CI',
183
- ],
184
- requiredActions: [
185
- {
186
- title: 'Upgrade to Solo Plan',
187
- description: 'Get AI-powered keyword research with CI/CD automation',
188
- webUrl: 'https://rankcli.dev/pricing',
189
- priority: 'medium',
190
- },
191
- {
192
- title: 'Run Manual Keyword Research',
193
- description: 'Use the CLI wizard to get keyword recommendations',
194
- command: 'rankcli keywords --wizard',
195
- priority: 'low',
196
- },
197
- ],
198
- prCommentBody: generateFreeTierPRComment(url, dashboardUrl),
199
- exitCode: 1,
200
- explanation: 'Free tier does not support automated keyword research in CI. Upgrade for this feature.',
201
- };
202
- }
203
-
204
- /**
205
- * Handle paid tier CI results
206
- */
207
- function handlePaidTierCI(
208
- result: PaidKeywordResult,
209
- options: {
210
- minConfidence: number;
211
- maxKeywords: number;
212
- siteId?: string;
213
- warnings: string[];
214
- info: string[];
215
- }
216
- ): CIKeywordResult {
217
- const { minConfidence, maxKeywords, siteId, warnings, info } = options;
218
- const { uncertainty, recommendations, siteSummary, freeToolIdeas } = result;
219
-
220
- const dashboardUrl = siteId
221
- ? `https://rankcli.dev/dashboard/projects/${siteId}/keywords`
222
- : 'https://rankcli.dev/dashboard';
223
-
224
- const wizardUrl = siteId
225
- ? `https://rankcli.dev/dashboard/projects/${siteId}/keywords/wizard`
226
- : 'https://rankcli.dev/dashboard';
227
-
228
- // Check confidence level
229
- if (uncertainty.overallConfidence < minConfidence) {
230
- // High uncertainty - cannot automate
231
- const questionsNeeded = uncertainty.questionsToAsk.slice(0, 5);
232
-
233
- return {
234
- canAddToPR: false,
235
- keywords: [],
236
- warnings: [
237
- `Confidence level (${Math.round(uncertainty.overallConfidence * 100)}%) is below threshold (${Math.round(minConfidence * 100)}%)`,
238
- 'Keyword recommendations skipped due to uncertainty',
239
- ],
240
- errors: [],
241
- info: [
242
- `Site analyzed: ${siteSummary.productName}`,
243
- `Industry detected: ${siteSummary.industry}`,
244
- `Found ${recommendations.length} potential keyword opportunities`,
245
- ],
246
- requiredActions: [
247
- {
248
- title: 'Run Keyword Wizard',
249
- description: `Answer ${questionsNeeded.length} questions to improve accuracy`,
250
- command: 'rankcli keywords --wizard',
251
- webUrl: wizardUrl,
252
- priority: 'high',
253
- },
254
- {
255
- title: 'Provide Product Context',
256
- description: 'Add product description to reduce uncertainty',
257
- command: 'rankcli keywords --context "Your product description"',
258
- priority: 'medium',
259
- },
260
- ],
261
- prCommentBody: generateUncertaintyPRComment(
262
- siteSummary,
263
- uncertainty,
264
- questionsNeeded,
265
- wizardUrl
266
- ),
267
- exitCode: 1,
268
- explanation: uncertainty.explanation,
269
- rawResult: result,
270
- };
271
- }
272
-
273
- // High enough confidence - include keywords
274
- const keywordsToAdd = recommendations
275
- .filter((r) => r.action !== 'needs-input' && r.action !== 'skip')
276
- .slice(0, maxKeywords);
277
-
278
- if (keywordsToAdd.length === 0) {
279
- warnings.push('No actionable keywords found meeting criteria');
280
- return {
281
- canAddToPR: false,
282
- keywords: [],
283
- warnings,
284
- errors: [],
285
- info: [
286
- `Site: ${siteSummary.productName}`,
287
- `Industry: ${siteSummary.industry}`,
288
- 'Consider expanding search criteria or running wizard',
289
- ],
290
- requiredActions: [
291
- {
292
- title: 'Run Keyword Wizard',
293
- description: 'Get personalized keyword recommendations',
294
- command: 'rankcli keywords --wizard',
295
- webUrl: wizardUrl,
296
- priority: 'medium',
297
- },
298
- ],
299
- prCommentBody: generateNoKeywordsPRComment(siteSummary, dashboardUrl),
300
- exitCode: 0,
301
- explanation: 'Analysis complete but no keywords met the criteria for automation.',
302
- rawResult: result,
303
- };
304
- }
305
-
306
- // Success - keywords can be added
307
- info.push(`Confidence: ${Math.round(uncertainty.overallConfidence * 100)}%`);
308
- info.push(`Adding ${keywordsToAdd.length} keyword recommendations`);
309
-
310
- return {
311
- canAddToPR: true,
312
- keywords: keywordsToAdd,
313
- warnings,
314
- errors: [],
315
- info,
316
- requiredActions: [],
317
- prCommentBody: generateSuccessPRComment(
318
- siteSummary,
319
- keywordsToAdd,
320
- freeToolIdeas.slice(0, 5),
321
- uncertainty.overallConfidence,
322
- dashboardUrl
323
- ),
324
- exitCode: 0,
325
- explanation: `Successfully analyzed ${siteSummary.productName}. ${keywordsToAdd.length} keyword recommendations ready.`,
326
- rawResult: result,
327
- };
328
- }
329
-
330
- // PR Comment Generators
331
-
332
- function generateErrorPRComment(errors: string[]): string {
333
- return `## 🔑 Keyword Research - Error
334
-
335
- ❌ **Keyword research could not complete**
336
-
337
- ${errors.map((e) => `- ${e}`).join('\n')}
338
-
339
- ### Next Steps
340
- 1. Check your configuration and API keys
341
- 2. Run \`rankcli keywords --debug\` locally to diagnose
342
- 3. See [documentation](https://rankcli.dev/docs/keywords) for help
343
-
344
- ---
345
- *Generated by [RankCLI](https://rankcli.dev)*`;
346
- }
347
-
348
- function generateFreeTierPRComment(url: string, upgradeUrl: string): string {
349
- return `## 🔑 Keyword Research
350
-
351
- 📊 **Keyword opportunities detected for ${url}**
352
-
353
- Automated keyword research in CI requires a paid plan.
354
-
355
- ### What You Get with Solo Plan ($9/mo):
356
- - ✅ AI-powered keyword discovery
357
- - ✅ Automated CI/CD integration
358
- - ✅ Keyword clustering & prioritization
359
- - ✅ Free tool ideas with CTAs
360
- - ✅ Competitive analysis
361
-
362
- ### Run Manually
363
- \`\`\`bash
364
- rankcli keywords --wizard
365
- \`\`\`
366
-
367
- [Upgrade to unlock →](${upgradeUrl})
368
-
369
- ---
370
- *Generated by [RankCLI](https://rankcli.dev)*`;
371
- }
372
-
373
- function generateUncertaintyPRComment(
374
- summary: SiteSummary,
375
- uncertainty: any,
376
- questions: any[],
377
- wizardUrl: string
378
- ): string {
379
- const questionsList = questions
380
- .map((q, i) => `${i + 1}. ${q.question}`)
381
- .join('\n');
382
-
383
- return `## 🔑 Keyword Research - Needs Input
384
-
385
- âš ī¸ **Confidence: ${Math.round(uncertainty.overallConfidence * 100)}%** - Too low for automation
386
-
387
- ### What We Detected
388
- - **Product:** ${summary.productName}
389
- - **Industry:** ${summary.industry}
390
- - **Audience:** ${summary.targetAudience}
391
-
392
- ### Questions to Answer
393
- To improve accuracy, please answer these questions:
394
-
395
- ${questionsList}
396
-
397
- ### How to Proceed
398
-
399
- **Option 1: Run the wizard (recommended)**
400
- \`\`\`bash
401
- rankcli keywords --wizard
402
- \`\`\`
403
-
404
- **Option 2: Use the web wizard**
405
- [Open Keyword Wizard →](${wizardUrl})
406
-
407
- **Option 3: Provide context directly**
408
- \`\`\`bash
409
- rankcli keywords --context "Your product description here"
410
- \`\`\`
411
-
412
- ### Why This Matters
413
- Low confidence means our recommendations might not be relevant to your business. Taking 2 minutes to answer questions will significantly improve results.
414
-
415
- ---
416
- *Generated by [RankCLI](https://rankcli.dev)*`;
417
- }
418
-
419
- function generateNoKeywordsPRComment(summary: SiteSummary, dashboardUrl: string): string {
420
- return `## 🔑 Keyword Research - Complete
421
-
422
- ✅ **Analysis complete for ${summary.productName}**
423
-
424
- No keywords currently meet the automation criteria (low difficulty + high volume + high relevance).
425
-
426
- ### What This Means
427
- - Your niche may be competitive
428
- - Consider longer-tail keywords
429
- - Try the wizard for personalized recommendations
430
-
431
- ### Next Steps
432
- 1. Run \`rankcli keywords --wizard\` for guided research
433
- 2. View full analysis in [dashboard](${dashboardUrl})
434
-
435
- ---
436
- *Generated by [RankCLI](https://rankcli.dev)*`;
437
- }
438
-
439
- function generateSuccessPRComment(
440
- summary: SiteSummary,
441
- keywords: KeywordRecommendation[],
442
- toolIdeas: any[],
443
- confidence: number,
444
- dashboardUrl: string
445
- ): string {
446
- const keywordTable = keywords
447
- .map((k, i) => `| ${i + 1} | ${k.keyword} | ${k.action} | ${k.impact} | ${k.effort} |`)
448
- .join('\n');
449
-
450
- const toolList = toolIdeas
451
- .map((t) => `- **${t.toolName}** (${t.volume} searches/mo, KD: ${t.difficulty})`)
452
- .join('\n');
453
-
454
- return `## 🔑 Keyword Research - Success
455
-
456
- ✅ **Confidence: ${Math.round(confidence * 100)}%**
457
-
458
- ### Site Analysis
459
- - **Product:** ${summary.productName}
460
- - **Industry:** ${summary.industry}
461
- - **Target:** ${summary.targetAudience}
462
-
463
- ### Top Keyword Recommendations
464
-
465
- | # | Keyword | Action | Impact | Effort |
466
- |---|---------|--------|--------|--------|
467
- ${keywordTable}
468
-
469
- ### Free Tool Ideas (Engineering as Marketing)
470
- ${toolList || 'No tool ideas generated'}
471
-
472
- ### Next Steps
473
- 1. Review recommendations in [dashboard](${dashboardUrl})
474
- 2. Start with high-impact, low-effort keywords
475
- 3. Build free tools to capture search traffic
476
-
477
- ---
478
- *Generated by [RankCLI](https://rankcli.dev) â€ĸ [View Full Report](${dashboardUrl})*`;
479
- }
480
-
481
- /**
482
- * Format CI result for console output
483
- */
484
- export function formatCIResult(result: CIKeywordResult): string {
485
- const lines: string[] = [];
486
-
487
- lines.push('');
488
- lines.push('═'.repeat(70));
489
- lines.push(' KEYWORD RESEARCH - CI MODE');
490
- lines.push('═'.repeat(70));
491
- lines.push('');
492
-
493
- // Status
494
- if (result.canAddToPR) {
495
- lines.push('✅ STATUS: Keywords ready to add to PR');
496
- } else if (result.exitCode === 2) {
497
- lines.push('❌ STATUS: Error occurred');
498
- } else {
499
- lines.push('âš ī¸ STATUS: Needs user input');
500
- }
501
- lines.push('');
502
-
503
- // Errors
504
- if (result.errors.length > 0) {
505
- lines.push('ERRORS:');
506
- result.errors.forEach((e) => lines.push(` ❌ ${e}`));
507
- lines.push('');
508
- }
509
-
510
- // Warnings
511
- if (result.warnings.length > 0) {
512
- lines.push('WARNINGS:');
513
- result.warnings.forEach((w) => lines.push(` âš ī¸ ${w}`));
514
- lines.push('');
515
- }
516
-
517
- // Info
518
- if (result.info.length > 0) {
519
- lines.push('INFO:');
520
- result.info.forEach((i) => lines.push(` â„šī¸ ${i}`));
521
- lines.push('');
522
- }
523
-
524
- // Keywords
525
- if (result.keywords.length > 0) {
526
- lines.push('KEYWORDS:');
527
- result.keywords.forEach((k, i) => {
528
- lines.push(` ${i + 1}. "${k.keyword}" - ${k.action} (${k.impact} impact, ${k.effort} effort)`);
529
- });
530
- lines.push('');
531
- }
532
-
533
- // Required Actions
534
- if (result.requiredActions.length > 0) {
535
- lines.push('REQUIRED ACTIONS:');
536
- result.requiredActions.forEach((a) => {
537
- lines.push(` 📌 ${a.title}`);
538
- lines.push(` ${a.description}`);
539
- if (a.command) {
540
- lines.push(` Command: ${a.command}`);
541
- }
542
- if (a.webUrl) {
543
- lines.push(` URL: ${a.webUrl}`);
544
- }
545
- lines.push('');
546
- });
547
- }
548
-
549
- // Explanation
550
- lines.push('─'.repeat(70));
551
- lines.push(` ${result.explanation}`);
552
- lines.push('═'.repeat(70));
553
-
554
- return lines.join('\n');
555
- }