@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,137 @@
1
+ import { Command } from 'commander';
2
+ import { render } from 'ink';
3
+ import React from 'react';
4
+ import { SetupWizard, type AuditConfig } from '../ui/SetupWizard.js';
5
+ import { AuditReportUI } from '../ui/AuditReportUI.js';
6
+ import { analyzeUrlWithRules, calculateAIReadiness } from '@ai-lighthouse/scanner';
7
+ import type { ScanOptions } from '@ai-lighthouse/scanner';
8
+
9
+ export function auditWizardCommand(program: Command) {
10
+ program
11
+ .command('wizard')
12
+ .alias('w')
13
+ .description('Interactive wizard to configure and run an audit')
14
+ .argument('[url]', 'Optional URL to audit (will prompt if not provided)')
15
+ .action(async (url?: string) => {
16
+ // Suppress console.error and console.warn for cleaner UI
17
+ const originalConsoleError = console.error;
18
+ const originalConsoleWarn = console.warn;
19
+ console.error = () => {};
20
+ console.warn = () => {};
21
+
22
+ let auditConfig: AuditConfig | null = null;
23
+
24
+ // Show setup wizard
25
+ const wizardRender = render(
26
+ React.createElement(SetupWizard, {
27
+ initialUrl: url,
28
+ onComplete: (config: AuditConfig) => {
29
+ auditConfig = config;
30
+ },
31
+ })
32
+ );
33
+
34
+ // Wait for wizard to complete
35
+ await wizardRender.waitUntilExit();
36
+
37
+ if (!auditConfig) {
38
+ console.error = originalConsoleError;
39
+ console.warn = originalConsoleWarn;
40
+ console.log('\nAudit cancelled.');
41
+ process.exit(0);
42
+ }
43
+
44
+ // Start the audit with the configured options
45
+ const { clear, rerender } = render(
46
+ React.createElement(AuditReportUI, {
47
+ url: auditConfig.url,
48
+ result: {},
49
+ aiReadiness: {},
50
+ loading: true,
51
+ currentStep: 'Starting audit...',
52
+ })
53
+ );
54
+
55
+ try {
56
+ // Build scan options from config
57
+ const scanOptions: ScanOptions = {
58
+ maxChunkTokens: 1200,
59
+ chunkingStrategy: 'auto',
60
+ enableChunking: auditConfig.enableChunking,
61
+ enableExtractability: auditConfig.enableExtractability,
62
+ enableHallucinationDetection: auditConfig.enableHallucination,
63
+ enableLLM: auditConfig.enableLlm,
64
+ minImpactScore: 8,
65
+ minConfidence: 0.7,
66
+ maxIssues: 20,
67
+ };
68
+
69
+ // Configure LLM if enabled
70
+ if (auditConfig.enableLlm && auditConfig.llmProvider) {
71
+ scanOptions.llmConfig = {
72
+ provider: auditConfig.llmProvider as any,
73
+ model: auditConfig.llmModel,
74
+ baseUrl: auditConfig.llmBaseUrl,
75
+ apiKey: auditConfig.llmApiKey,
76
+ };
77
+ }
78
+
79
+ // Update loading step
80
+ rerender(
81
+ React.createElement(AuditReportUI, {
82
+ url: auditConfig.url,
83
+ result: {},
84
+ aiReadiness: {},
85
+ loading: true,
86
+ currentStep: 'Scanning page...',
87
+ })
88
+ );
89
+
90
+ // Run the audit
91
+ const result = await analyzeUrlWithRules(auditConfig.url, scanOptions);
92
+
93
+ // Update loading step
94
+ rerender(
95
+ React.createElement(AuditReportUI, {
96
+ url: auditConfig.url,
97
+ result,
98
+ aiReadiness: {},
99
+ loading: true,
100
+ currentStep: 'Calculating AI readiness scores...',
101
+ })
102
+ );
103
+
104
+ // Calculate AI readiness
105
+ const aiReadiness = calculateAIReadiness(result);
106
+
107
+ // Clear loading and show results
108
+ clear();
109
+ const finalRender = render(
110
+ React.createElement(AuditReportUI, {
111
+ url: auditConfig.url,
112
+ result,
113
+ aiReadiness,
114
+ loading: false,
115
+ })
116
+ );
117
+
118
+ // Wait for user to exit
119
+ await finalRender.waitUntilExit();
120
+
121
+ // Restore console methods
122
+ console.error = originalConsoleError;
123
+ console.warn = originalConsoleWarn;
124
+ } catch (error) {
125
+ // Restore console methods before showing error
126
+ console.error = originalConsoleError;
127
+ console.warn = originalConsoleWarn;
128
+
129
+ clear();
130
+ console.log('\n\x1b[1m\x1b[31m❌ Audit Failed\x1b[0m');
131
+ console.log('\x1b[31m' + '─'.repeat(70) + '\x1b[0m');
132
+ console.log('\x1b[31m' + (error instanceof Error ? error.message : String(error)) + '\x1b[0m');
133
+ console.log('\n\x1b[2mPlease check the URL and your configuration.\x1b[0m');
134
+ process.exit(1);
135
+ }
136
+ });
137
+ }