@ai-lighthouse/cli 1.0.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 (103) hide show
  1. package/.ai-lighthouse/audit_example.com_2025-12-15T12-10-43.json +183 -0
  2. package/.ai-lighthouse/audit_fayeed.dev_2026-01-07T19-32-28.html +743 -0
  3. package/.ai-lighthouse/audit_fayeed.dev_2026-01-07T19-33-02.html +757 -0
  4. package/.ai-lighthouse/audit_github.com_2025-12-15T11-53-21.json +168 -0
  5. package/.ai-lighthouse/audit_github.com_2025-12-15T12-04-06.json +168 -0
  6. package/.ai-lighthouse/audit_github.com_2025-12-15T12-05-10.json +168 -0
  7. package/.ai-lighthouse/audit_github.com_2025-12-15T12-09-45.json +168 -0
  8. package/.ai-lighthouse/audit_github.com_2025-12-15T12-11-07.json +168 -0
  9. package/.ai-lighthouse/audit_github.com_2025-12-15T12-13-28.json +168 -0
  10. package/.ai-lighthouse/audit_github.com_2025-12-15T12-14-59.json +205 -0
  11. package/.ai-lighthouse/audit_github.com_2025-12-15T12-18-07.json +205 -0
  12. package/.ai-lighthouse/audit_github.com_2025-12-15T12-18-44.json +205 -0
  13. package/.ai-lighthouse/audit_github.com_2025-12-15T12-21-38.json +205 -0
  14. package/.ai-lighthouse/audit_github.com_2025-12-15T12-22-21.json +205 -0
  15. package/.ai-lighthouse/audit_github.com_2025-12-15T12-22-46.json +205 -0
  16. package/.ai-lighthouse/audit_github.com_2025-12-15T12-23-18.json +205 -0
  17. package/.ai-lighthouse/audit_github.com_2025-12-15T12-24-43.json +205 -0
  18. package/.ai-lighthouse/audit_github.com_2025-12-17T12-15-08.json +168 -0
  19. package/.ai-lighthouse/audit_github.com_2025-12-17T12-15-57.json +168 -0
  20. package/.ai-lighthouse/audit_github.com_2025-12-17T12-17-11.json +168 -0
  21. package/.ai-lighthouse/audit_github.com_2025-12-17T12-22-17.json +168 -0
  22. package/.ai-lighthouse/audit_github.com_2025-12-17T12-22-42.json +168 -0
  23. package/.ai-lighthouse/audit_github.com_2025-12-17T12-23-56.json +168 -0
  24. package/.ai-lighthouse/audit_github.com_2025-12-17T12-25-24.json +168 -0
  25. package/.ai-lighthouse/audit_github.com_2025-12-17T12-25-40.json +168 -0
  26. package/.ai-lighthouse/audit_github.com_2025-12-17T12-27-02.json +168 -0
  27. package/.ai-lighthouse/audit_github.com_2025-12-17T12-27-20.json +168 -0
  28. package/.ai-lighthouse/audit_github.com_2025-12-17T12-29-56.json +168 -0
  29. package/.ai-lighthouse/audit_github.com_2025-12-17T12-32-27.json +168 -0
  30. package/.ai-lighthouse/audit_github.com_2025-12-17T12-33-00.json +168 -0
  31. package/.ai-lighthouse/audit_github.com_2025-12-17T12-34-49.json +168 -0
  32. package/.ai-lighthouse/audit_stripe.com_2025-12-15T12-11-31.json +168 -0
  33. package/.ai-lighthouse/audit_stripe.com_2025-12-15T12-11-45.json +168 -0
  34. package/.ai-lighthouse/audit_tailwindcss.com_2025-12-15T12-12-01.json +169 -0
  35. package/.ai-lighthouse/crawl_example.com_2025-12-15T12-03-08.json +24 -0
  36. package/.ai-lighthouse/crawl_example.com_2025-12-15T12-03-23.json +24 -0
  37. package/.ai-lighthouse/crawl_github.com_2025-12-15T11-41-34.json +21 -0
  38. package/.ai-lighthouse/crawl_github.com_2025-12-15T11-42-09.json +21 -0
  39. package/.ai-lighthouse/crawl_github.com_2025-12-15T11-42-45.json +21 -0
  40. package/.ai-lighthouse/crawl_github.com_2025-12-15T11-43-02.json +21 -0
  41. package/.ai-lighthouse/crawl_github.com_2025-12-15T11-43-26.json +21 -0
  42. package/.ai-lighthouse/crawl_github.com_2025-12-15T11-47-46.json +906 -0
  43. package/.ai-lighthouse/crawl_github.com_2025-12-15T11-50-27.json +906 -0
  44. package/.ai-lighthouse/crawl_github.com_2025-12-15T11-52-59.json +906 -0
  45. package/.ai-lighthouse/crawl_github.com_2025-12-15T12-03-33.json +28 -0
  46. package/CLI_UI_README.md +211 -0
  47. package/EXAMPLES.md +87 -0
  48. package/IMPLEMENTATION.md +215 -0
  49. package/README.md +166 -0
  50. package/USAGE.md +264 -0
  51. package/WIZARD_GUIDE.md +340 -0
  52. package/bin/cli.js +2 -0
  53. package/dist/commands/audit-interactive.d.ts +2 -0
  54. package/dist/commands/audit-interactive.js +106 -0
  55. package/dist/commands/audit-wizard.d.ts +2 -0
  56. package/dist/commands/audit-wizard.js +110 -0
  57. package/dist/commands/audit.d.ts +2 -0
  58. package/dist/commands/audit.js +940 -0
  59. package/dist/commands/crawl.d.ts +2 -0
  60. package/dist/commands/crawl.js +267 -0
  61. package/dist/commands/report.d.ts +2 -0
  62. package/dist/commands/report.js +304 -0
  63. package/dist/index.d.ts +1 -0
  64. package/dist/index.js +16 -0
  65. package/dist/ui/AuditReportUI.d.ts +10 -0
  66. package/dist/ui/AuditReportUI.js +76 -0
  67. package/dist/ui/SetupWizard.d.ts +18 -0
  68. package/dist/ui/SetupWizard.js +179 -0
  69. package/dist/ui/components/AIUnderstandingSection.d.ts +6 -0
  70. package/dist/ui/components/AIUnderstandingSection.js +87 -0
  71. package/dist/ui/components/HallucinationSection.d.ts +6 -0
  72. package/dist/ui/components/HallucinationSection.js +84 -0
  73. package/dist/ui/components/IssuesSection.d.ts +6 -0
  74. package/dist/ui/components/IssuesSection.js +84 -0
  75. package/dist/ui/components/MessageAlignmentSection.d.ts +6 -0
  76. package/dist/ui/components/MessageAlignmentSection.js +108 -0
  77. package/dist/ui/components/OverviewSection.d.ts +6 -0
  78. package/dist/ui/components/OverviewSection.js +107 -0
  79. package/dist/ui/components/ScoreDisplay.d.ts +8 -0
  80. package/dist/ui/components/ScoreDisplay.js +41 -0
  81. package/dist/ui/components/TechnicalSection.d.ts +7 -0
  82. package/dist/ui/components/TechnicalSection.js +110 -0
  83. package/dist/utils/comprehensive-formatter.d.ts +5 -0
  84. package/dist/utils/comprehensive-formatter.js +370 -0
  85. package/package.json +49 -0
  86. package/src/commands/audit-interactive.ts +149 -0
  87. package/src/commands/audit-wizard.ts +137 -0
  88. package/src/commands/audit.ts +1012 -0
  89. package/src/commands/crawl.ts +307 -0
  90. package/src/commands/report.ts +321 -0
  91. package/src/index.ts +22 -0
  92. package/src/ui/AuditReportUI.tsx +151 -0
  93. package/src/ui/SetupWizard.tsx +294 -0
  94. package/src/ui/components/AIUnderstandingSection.tsx +183 -0
  95. package/src/ui/components/HallucinationSection.tsx +172 -0
  96. package/src/ui/components/IssuesSection.tsx +140 -0
  97. package/src/ui/components/MessageAlignmentSection.tsx +203 -0
  98. package/src/ui/components/OverviewSection.tsx +157 -0
  99. package/src/ui/components/ScoreDisplay.tsx +58 -0
  100. package/src/ui/components/TechnicalSection.tsx +200 -0
  101. package/src/utils/comprehensive-formatter.ts +455 -0
  102. package/test.sh +31 -0
  103. package/tsconfig.json +25 -0
@@ -0,0 +1,455 @@
1
+ import chalk from 'chalk';
2
+
3
+ /**
4
+ * Comprehensive CLI formatter that displays all data shown on the website
5
+ */
6
+
7
+ export function formatComprehensiveReport(result: any, aiReadiness: any): string {
8
+ const sections: string[] = [];
9
+
10
+ // LLM/AI Understanding Section
11
+ if (result.llm) {
12
+ sections.push(formatLLMSection(result.llm));
13
+ }
14
+
15
+ // Chunking Section
16
+ if (result.chunking) {
17
+ sections.push(formatChunkingSection(result.chunking));
18
+ }
19
+
20
+ // Extractability Section
21
+ if (result.extractability) {
22
+ sections.push(formatExtractabilitySection(result.extractability));
23
+ }
24
+
25
+ // Hallucination Risk Section
26
+ if (result.hallucinationReport) {
27
+ sections.push(formatHallucinationSection(result.hallucinationReport));
28
+ }
29
+
30
+ // Mirror Report Section
31
+ if (result.mirrorReport) {
32
+ sections.push(formatMirrorReportSection(result.mirrorReport));
33
+ }
34
+
35
+ // Dimension Scores
36
+ if (aiReadiness?.dimensions) {
37
+ sections.push(formatDimensionsSection(aiReadiness.dimensions));
38
+ }
39
+
40
+ // Quick Wins
41
+ if (aiReadiness?.quickWins && aiReadiness.quickWins.length > 0) {
42
+ sections.push(formatQuickWinsSection(aiReadiness.quickWins));
43
+ }
44
+
45
+ return sections.join('\n\n');
46
+ }
47
+
48
+ function formatLLMSection(llm: any): string {
49
+ const lines: string[] = [];
50
+
51
+ lines.push(chalk.bold.blue('📝 AI Understanding Analysis'));
52
+ lines.push('─'.repeat(70));
53
+
54
+ if (llm.summary) {
55
+ lines.push(chalk.bold('Summary:'));
56
+ lines.push(` ${llm.summary}`);
57
+ lines.push('');
58
+ }
59
+
60
+ if (llm.pageType) {
61
+ lines.push(chalk.bold('Inferred Page Type:'));
62
+ lines.push(` ${chalk.magenta.bold(llm.pageType)}`);
63
+
64
+ if (llm.pageTypeInsights && llm.pageTypeInsights.length > 0) {
65
+ lines.push('');
66
+ lines.push(chalk.bold('💡 AI-Generated Insights:'));
67
+ llm.pageTypeInsights.forEach((insight: string) => {
68
+ lines.push(` ${chalk.cyan('•')} ${insight}`);
69
+ });
70
+ }
71
+ lines.push('');
72
+ }
73
+
74
+ if (llm.keyTopics && llm.keyTopics.length > 0) {
75
+ lines.push(chalk.bold('Key Topics:'));
76
+ lines.push(` ${llm.keyTopics.map((t: string) => chalk.blue(t)).join(', ')}`);
77
+ lines.push('');
78
+ }
79
+
80
+ const metadata = [];
81
+ if (llm.readingLevel) {
82
+ metadata.push(`Reading Level: ${llm.readingLevel.description}`);
83
+ }
84
+ if (llm.sentiment) {
85
+ metadata.push(`Sentiment: ${llm.sentiment}`);
86
+ }
87
+ if (llm.technicalDepth) {
88
+ metadata.push(`Technical Depth: ${llm.technicalDepth}`);
89
+ }
90
+
91
+ if (metadata.length > 0) {
92
+ lines.push(chalk.bold('Metadata:'));
93
+ metadata.forEach(m => lines.push(` ${m}`));
94
+ lines.push('');
95
+ }
96
+
97
+ if (llm.topEntities && llm.topEntities.length > 0) {
98
+ lines.push(chalk.bold('🔍 Key Entities:'));
99
+ llm.topEntities.slice(0, 5).forEach((entity: any) => {
100
+ const relevance = entity.relevance ? ` - ${Math.round(entity.relevance * 100)}% relevance` : '';
101
+ lines.push(` ${chalk.cyan('•')} ${chalk.bold(entity.name)} ${chalk.dim(`(${entity.type})${relevance}`)}`);
102
+ });
103
+ lines.push('');
104
+ }
105
+
106
+ if (llm.questions && llm.questions.length > 0) {
107
+ lines.push(chalk.bold('❓ Questions AI Can Answer:'));
108
+ llm.questions.slice(0, 5).forEach((q: any, idx: number) => {
109
+ const difficulty = chalk.dim(`[${q.difficulty.toUpperCase()}]`);
110
+ lines.push(` ${idx + 1}. ${difficulty} ${q.question}`);
111
+ });
112
+ lines.push('');
113
+ }
114
+
115
+ if (llm.suggestedFAQ && llm.suggestedFAQ.length > 0) {
116
+ lines.push(chalk.bold('💡 Suggested FAQs:'));
117
+ llm.suggestedFAQ
118
+ .filter((f: any) => f.importance === 'high')
119
+ .slice(0, 3)
120
+ .forEach((faq: any, idx: number) => {
121
+ lines.push(` ${idx + 1}. Q: ${chalk.yellow(faq.question)}`);
122
+ lines.push(` A: ${chalk.dim(faq.suggestedAnswer)}`);
123
+ });
124
+ }
125
+
126
+ return lines.join('\n');
127
+ }
128
+
129
+ function formatChunkingSection(chunking: any): string {
130
+ const lines: string[] = [];
131
+
132
+ lines.push(chalk.bold.green('📄 Content Chunking Analysis'));
133
+ lines.push('─'.repeat(70));
134
+
135
+ const grid = [
136
+ ['Strategy', chunking.chunkingStrategy],
137
+ ['Total Chunks', chunking.totalChunks.toString()],
138
+ ['Avg Tokens/Chunk', chunking.averageTokensPerChunk.toString()],
139
+ ['Avg Noise Ratio', `${(chunking.averageNoiseRatio * 100).toFixed(1)}%`],
140
+ ];
141
+
142
+ grid.forEach(([label, value]) => {
143
+ lines.push(` ${chalk.bold(label + ':').padEnd(25)} ${chalk.cyan(value)}`);
144
+ });
145
+
146
+ if (chunking.chunkingStrategy === 'heading-based') {
147
+ lines.push('');
148
+ lines.push(chalk.green(' ✓ Heading-based chunking is ideal for AI comprehension'));
149
+ } else if (chunking.chunkingStrategy === 'paragraph-based') {
150
+ lines.push('');
151
+ lines.push(chalk.yellow(' ⚠ Consider adding headings for better semantic structure'));
152
+ }
153
+
154
+ if (chunking.chunks && chunking.chunks.length > 0) {
155
+ lines.push('');
156
+ lines.push(chalk.bold('Chunk Distribution:'));
157
+
158
+ // Show token distribution
159
+ const tokenCounts = chunking.chunks.map((c: any) => c.tokenCount);
160
+ const min = Math.min(...tokenCounts);
161
+ const max = Math.max(...tokenCounts);
162
+ const avg = tokenCounts.reduce((a: number, b: number) => a + b, 0) / tokenCounts.length;
163
+
164
+ lines.push(` Min Tokens: ${min}, Max Tokens: ${max}, Avg: ${avg.toFixed(0)}`);
165
+
166
+ // Show noise distribution
167
+ const noiseRatios = chunking.chunks.map((c: any) => c.noiseRatio);
168
+ const avgNoise = noiseRatios.reduce((a: number, b: number) => a + b, 0) / noiseRatios.length;
169
+ lines.push(` Avg Noise per Chunk: ${(avgNoise * 100).toFixed(1)}%`);
170
+ }
171
+
172
+ return lines.join('\n');
173
+ }
174
+
175
+ function formatExtractabilitySection(extractability: any): string {
176
+ const lines: string[] = [];
177
+
178
+ lines.push(chalk.bold.yellow('🔄 Extractability Analysis'));
179
+ lines.push('─'.repeat(70));
180
+
181
+ const grid = [
182
+ ['Overall Score', `${extractability.score.extractabilityScore}/100`],
183
+ ['Server-Rendered', `${extractability.score.serverRenderedPercent}%`],
184
+ ];
185
+
186
+ grid.forEach(([label, value]) => {
187
+ lines.push(` ${chalk.bold(label + ':').padEnd(25)} ${chalk.cyan(value)}`);
188
+ });
189
+
190
+ lines.push('');
191
+ lines.push(chalk.bold('Content Type Extractability:'));
192
+
193
+ Object.entries(extractability.contentTypes).forEach(([type, data]: [string, any]) => {
194
+ const percentage = data.percentage;
195
+ const color = percentage >= 80 ? chalk.green : percentage >= 50 ? chalk.yellow : chalk.red;
196
+ lines.push(` ${chalk.bold(type.charAt(0).toUpperCase() + type.slice(1) + ':').padEnd(15)} ${color(`${percentage}%`)} (${data.extractable}/${data.total})`);
197
+ });
198
+
199
+ const overallScore = extractability.score.extractabilityScore;
200
+ if (overallScore >= 80) {
201
+ lines.push('');
202
+ lines.push(chalk.green(' ✓ Good extractability - AI can easily read your content'));
203
+ } else if (overallScore < 50) {
204
+ lines.push('');
205
+ lines.push(chalk.red(' ⚠ Low extractability - Consider server-side rendering'));
206
+ }
207
+
208
+ return lines.join('\n');
209
+ }
210
+
211
+ function formatHallucinationSection(report: any): string {
212
+ const lines: string[] = [];
213
+
214
+ lines.push(chalk.bold.red('⚠️ Hallucination Risk Assessment'));
215
+ lines.push('─'.repeat(70));
216
+
217
+ const riskScore = report.hallucinationRiskScore;
218
+ const riskColor = riskScore >= 70 ? chalk.red : riskScore >= 40 ? chalk.yellow : chalk.green;
219
+ lines.push(` ${chalk.bold('Risk Score:')} ${riskColor.bold(`${riskScore}/100`)}`);
220
+
221
+ if (report.factCheckSummary) {
222
+ lines.push('');
223
+ lines.push(chalk.bold('Fact Check Summary:'));
224
+ const summary = report.factCheckSummary;
225
+ lines.push(` Total Facts: ${chalk.cyan(summary.totalFacts)}`);
226
+ lines.push(` Verified: ${chalk.green(summary.verifiedFacts)}`);
227
+ lines.push(` Unverified: ${chalk.yellow(summary.unverifiedFacts)}`);
228
+ lines.push(` Contradictions: ${chalk.red(summary.contradictions)}`);
229
+ if (summary.ambiguities !== undefined) {
230
+ lines.push(` Ambiguities: ${chalk.yellow(summary.ambiguities)}`);
231
+ }
232
+ }
233
+
234
+ if (report.factCheckSummary && report.factCheckSummary.unverifiedFacts > 0) {
235
+ lines.push('');
236
+ lines.push(chalk.yellow('💡 Tip: Add citations and links to verify claims and reduce AI hallucination risk'));
237
+ }
238
+
239
+ if (report.triggers && report.triggers.length > 0) {
240
+ const highSeverityTriggers = report.triggers.filter(
241
+ (t: any) => t.severity === 'high' || t.severity === 'critical'
242
+ );
243
+
244
+ if (highSeverityTriggers.length > 0) {
245
+ lines.push('');
246
+ lines.push(chalk.bold('🚨 High-Risk Triggers:'));
247
+ highSeverityTriggers.slice(0, 5).forEach((trigger: any, idx: number) => {
248
+ lines.push(` ${idx + 1}. ${chalk.red(`[${trigger.severity.toUpperCase()}]`)} ${trigger.type}`);
249
+ lines.push(` ${chalk.dim(trigger.description)}`);
250
+ if (trigger.confidence) {
251
+ lines.push(` ${chalk.dim(`Confidence: ${Math.round(trigger.confidence * 100)}%`)}`);
252
+ }
253
+ });
254
+ }
255
+ }
256
+
257
+ if (report.recommendations && report.recommendations.length > 0) {
258
+ lines.push('');
259
+ lines.push(chalk.bold('💡 Recommendations:'));
260
+ report.recommendations.slice(0, 3).forEach((rec: string, idx: number) => {
261
+ lines.push(` ${idx + 1}. ${rec}`);
262
+ });
263
+ }
264
+
265
+ return lines.join('\n');
266
+ }
267
+
268
+ function formatMirrorReportSection(report: any): string {
269
+ const lines: string[] = [];
270
+
271
+ lines.push(chalk.bold.magenta('🔍 AI Misunderstanding Check'));
272
+ lines.push('─'.repeat(70));
273
+
274
+ const alignmentColor = report.summary.alignmentScore >= 80 ? chalk.green :
275
+ report.summary.alignmentScore >= 60 ? chalk.yellow : chalk.red;
276
+ const clarityColor = report.summary.clarityScore >= 80 ? chalk.green :
277
+ report.summary.clarityScore >= 60 ? chalk.yellow : chalk.red;
278
+
279
+ lines.push(` ${chalk.bold('Alignment Score:').padEnd(25)} ${alignmentColor.bold(`${report.summary.alignmentScore}/100`)}`);
280
+ lines.push(` ${chalk.bold('Clarity Score:').padEnd(25)} ${clarityColor.bold(`${report.summary.clarityScore}/100`)}`);
281
+ lines.push(` ${chalk.bold('Critical Issues:').padEnd(25)} ${chalk.red(report.summary.critical)}`);
282
+ lines.push(` ${chalk.bold('Major Issues:').padEnd(25)} ${chalk.yellow(report.summary.major)}`);
283
+
284
+ // AI Interpretation - What AI Actually Understood
285
+ if (report.llmInterpretation) {
286
+ lines.push('');
287
+ lines.push(chalk.bold.blue('🤖 What AI Actually Understood'));
288
+ lines.push(chalk.dim(` (${Math.round(report.llmInterpretation.confidence * 100)}% confident)`));
289
+
290
+ if (report.llmInterpretation.productName) {
291
+ lines.push(` ${chalk.bold('Product:')} ${report.llmInterpretation.productName}`);
292
+ }
293
+
294
+ if (report.llmInterpretation.purpose) {
295
+ lines.push(` ${chalk.bold('Purpose:')} ${report.llmInterpretation.purpose}`);
296
+ }
297
+
298
+ if (report.llmInterpretation.valueProposition) {
299
+ lines.push(` ${chalk.bold.magenta('💎 Value:')} ${report.llmInterpretation.valueProposition}`);
300
+ }
301
+
302
+ if (report.llmInterpretation.keyBenefits && report.llmInterpretation.keyBenefits.length > 0) {
303
+ lines.push(` ${chalk.bold('Benefits:')}`);
304
+ report.llmInterpretation.keyBenefits.forEach((benefit: string) => {
305
+ lines.push(` • ${benefit}`);
306
+ });
307
+ }
308
+
309
+ if (report.llmInterpretation.keyFeatures && report.llmInterpretation.keyFeatures.length > 0) {
310
+ lines.push(` ${chalk.bold('Features:')}`);
311
+ report.llmInterpretation.keyFeatures.slice(0, 3).forEach((feature: string) => {
312
+ lines.push(` • ${feature}`);
313
+ });
314
+ }
315
+
316
+ if (report.llmInterpretation.targetAudience) {
317
+ lines.push(` ${chalk.bold('Audience:')} ${report.llmInterpretation.targetAudience}`);
318
+ }
319
+ }
320
+
321
+ if (report.mismatches && report.mismatches.length > 0) {
322
+ const priorityMismatches = report.mismatches.filter(
323
+ (m: any) => m.severity === 'critical' || m.severity === 'major'
324
+ );
325
+
326
+ if (priorityMismatches.length > 0) {
327
+ lines.push('');
328
+ lines.push(chalk.bold('Priority Mismatches:'));
329
+ priorityMismatches.slice(0, 5).forEach((mismatch: any, idx: number) => {
330
+ const icon = mismatch.severity === 'critical' ? '🔴' : '🟡';
331
+ lines.push(` ${icon} ${idx + 1}. ${chalk.bold(mismatch.field)}`);
332
+ lines.push(` ${chalk.dim(mismatch.description)}`);
333
+ lines.push(` ${chalk.cyan('→')} ${mismatch.recommendation}`);
334
+ });
335
+ }
336
+ }
337
+
338
+ if (report.recommendations && report.recommendations.length > 0) {
339
+ lines.push('');
340
+ lines.push(chalk.bold('💡 Top Recommendations:'));
341
+ report.recommendations.slice(0, 3).forEach((rec: string, idx: number) => {
342
+ lines.push(` ${idx + 1}. ${rec}`);
343
+ });
344
+ }
345
+
346
+ return lines.join('\n');
347
+ }
348
+
349
+ function formatDimensionsSection(dimensions: any): string {
350
+ const lines: string[] = [];
351
+
352
+ lines.push(chalk.bold.cyan('🎯 Dimension Analysis'));
353
+ lines.push('─'.repeat(70));
354
+
355
+ const dimensionDescriptions: Record<string, string> = {
356
+ technical: '⚙️ Technical',
357
+ contentQuality: '📝 Content Quality',
358
+ crawlability: '🕷️ Crawlability',
359
+ discoverability: '🔍 Discoverability',
360
+ knowledge: '🧠 Knowledge',
361
+ extractability: '🔄 Extractability',
362
+ comprehensibility: '💡 Comprehensibility',
363
+ trustworthiness: '✅ Trustworthiness',
364
+ accessibility: '♿ Accessibility',
365
+ };
366
+
367
+ Object.entries(dimensions).forEach(([key, dim]: [string, any]) => {
368
+ const name = dimensionDescriptions[key] || key;
369
+ const scoreColor = dim.score >= 90 ? chalk.green :
370
+ dim.score >= 75 ? chalk.yellow :
371
+ dim.score >= 60 ? chalk.hex('#FFA500') : chalk.red;
372
+
373
+ lines.push('');
374
+ lines.push(`${name}: ${scoreColor.bold(`${Math.round(dim.score)}/100`)} ${chalk.dim(`(${dim.status})`)}`);
375
+
376
+ if (dim.strengths && dim.strengths.length > 0) {
377
+ lines.push(` ${chalk.green('Strengths:')} ${dim.strengths.join(', ')}`);
378
+ }
379
+ if (dim.weaknesses && dim.weaknesses.length > 0) {
380
+ lines.push(` ${chalk.yellow('Weaknesses:')} ${dim.weaknesses.join(', ')}`);
381
+ }
382
+ if (dim.recommendation) {
383
+ lines.push(` ${chalk.cyan('→')} ${dim.recommendation}`);
384
+ }
385
+ });
386
+
387
+ return lines.join('\n');
388
+ }
389
+
390
+ function formatQuickWinsSection(quickWins: any[]): string {
391
+ const lines: string[] = [];
392
+
393
+ lines.push(chalk.bold.yellow('⚡ Quick Wins (High Impact, Low Effort)'));
394
+ lines.push('─'.repeat(70));
395
+
396
+ quickWins.slice(0, 5).forEach((win: any, idx: number) => {
397
+ lines.push('');
398
+ lines.push(`${chalk.bold(`${idx + 1}.`)} ${chalk.yellow(win.issue)}`);
399
+ lines.push(` ${chalk.dim(`Impact: ${win.impact} · Effort: ${win.effort}`)}`);
400
+ lines.push(` ${chalk.cyan('→')} ${win.fix}`);
401
+ });
402
+
403
+ return lines.join('\n');
404
+ }
405
+
406
+ export function formatDetailedIssues(issues: any[]): string {
407
+ const lines: string[] = [];
408
+
409
+ lines.push(chalk.bold('⚠️ All Issues'));
410
+ lines.push('─'.repeat(70));
411
+
412
+ // Group by severity
413
+ const grouped = {
414
+ critical: issues.filter(i => i.severity === 'critical'),
415
+ high: issues.filter(i => i.severity === 'high'),
416
+ medium: issues.filter(i => i.severity === 'medium'),
417
+ low: issues.filter(i => i.severity === 'low'),
418
+ };
419
+
420
+ // Stats
421
+ lines.push('');
422
+ lines.push(chalk.bold('Issue Count by Severity:'));
423
+ lines.push(` Critical: ${chalk.red.bold(grouped.critical.length)}`);
424
+ lines.push(` High: ${chalk.yellow.bold(grouped.high.length)}`);
425
+ lines.push(` Medium: ${chalk.blue.bold(grouped.medium.length)}`);
426
+ lines.push(` Low: ${chalk.dim(grouped.low.length)}`);
427
+
428
+ // Show all issues by severity
429
+ for (const [severity, severityIssues] of Object.entries(grouped)) {
430
+ if (severityIssues.length === 0) continue;
431
+
432
+ lines.push('');
433
+ lines.push(chalk.bold(`${severity.toUpperCase()} Issues:`));
434
+
435
+ severityIssues.forEach((issue: any, idx: number) => {
436
+ const icon = severity === 'critical' ? '🔴' :
437
+ severity === 'high' ? '🟠' :
438
+ severity === 'medium' ? '🟡' : '🔵';
439
+
440
+ lines.push('');
441
+ lines.push(`${icon} ${idx + 1}. ${chalk.bold(issue.message || issue.title)}`);
442
+ lines.push(` ${chalk.dim(`Category: ${issue.category} · Impact: ${issue.impact}`)}`);
443
+ if (issue.evidence) {
444
+ const evidenceText = typeof issue.evidence === 'string' ? issue.evidence : issue.evidence.join(', ');
445
+ lines.push(` ${chalk.dim(evidenceText.substring(0, 100))}${evidenceText.length > 100 ? '...' : ''}`);
446
+ }
447
+ if (issue.element) {
448
+ lines.push(` ${chalk.dim(issue.element.substring(0, 100))}${issue.element.length > 100 ? '...' : ''}`);
449
+ }
450
+ lines.push(` ${chalk.cyan('💡 Fix:')} ${issue.suggested_fix || issue.remediation}`);
451
+ });
452
+ }
453
+
454
+ return lines.join('\n');
455
+ }
package/test.sh ADDED
@@ -0,0 +1,31 @@
1
+ #!/bin/bash
2
+
3
+ # AI Lighthouse CLI Test Script
4
+
5
+ echo "=== Testing AI Lighthouse CLI ==="
6
+ echo ""
7
+
8
+ # Test 1: Show help
9
+ echo "1. Testing --help..."
10
+ pnpm dev --help
11
+ echo ""
12
+
13
+ # Test 2: Show audit command help
14
+ echo "2. Testing audit --help..."
15
+ pnpm dev audit --help
16
+ echo ""
17
+
18
+ # Test 3: Show crawl command help
19
+ echo "3. Testing crawl --help..."
20
+ pnpm dev crawl --help
21
+ echo ""
22
+
23
+ # Test 4: Show report command help
24
+ echo "4. Testing report --help..."
25
+ pnpm dev report --help
26
+ echo ""
27
+
28
+ echo "=== All tests passed! ==="
29
+ echo ""
30
+ echo "To run a real audit, try:"
31
+ echo " pnpm dev audit https://example.com --output html"
package/tsconfig.json ADDED
@@ -0,0 +1,25 @@
1
+ {
2
+ "compilerOptions": {
3
+ "target": "ES2022",
4
+ "module": "ES2022",
5
+ "lib": ["ES2022"],
6
+ "moduleResolution": "bundler",
7
+ "esModuleInterop": true,
8
+ "allowSyntheticDefaultImports": true,
9
+ "strict": false,
10
+ "skipLibCheck": true,
11
+ "forceConsistentCasingInFileNames": true,
12
+ "resolveJsonModule": true,
13
+ "declaration": true,
14
+ "declarationMap": true,
15
+ "sourceMap": true,
16
+ "outDir": "./dist",
17
+ "baseUrl": ".",
18
+ "jsx": "react",
19
+ "paths": {
20
+ "@ai-lighthouse/scanner": ["../../packages/scanner/src/exports.ts"]
21
+ }
22
+ },
23
+ "include": ["src/**/*"],
24
+ "exclude": ["node_modules", "dist"]
25
+ }