@ai-lighthouse/cli 1.0.1 → 1.0.3
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.
- package/README.md +126 -53
- package/dist/index.js +2788 -12
- package/package.json +10 -4
- package/.ai-lighthouse/audit_example.com_2025-12-15T12-10-43.json +0 -183
- package/.ai-lighthouse/audit_fayeed.dev_2026-01-07T19-32-28.html +0 -743
- package/.ai-lighthouse/audit_fayeed.dev_2026-01-07T19-33-02.html +0 -757
- package/.ai-lighthouse/audit_github.com_2025-12-15T11-53-21.json +0 -168
- package/.ai-lighthouse/audit_github.com_2025-12-15T12-04-06.json +0 -168
- package/.ai-lighthouse/audit_github.com_2025-12-15T12-05-10.json +0 -168
- package/.ai-lighthouse/audit_github.com_2025-12-15T12-09-45.json +0 -168
- package/.ai-lighthouse/audit_github.com_2025-12-15T12-11-07.json +0 -168
- package/.ai-lighthouse/audit_github.com_2025-12-15T12-13-28.json +0 -168
- package/.ai-lighthouse/audit_github.com_2025-12-15T12-14-59.json +0 -205
- package/.ai-lighthouse/audit_github.com_2025-12-15T12-18-07.json +0 -205
- package/.ai-lighthouse/audit_github.com_2025-12-15T12-18-44.json +0 -205
- package/.ai-lighthouse/audit_github.com_2025-12-15T12-21-38.json +0 -205
- package/.ai-lighthouse/audit_github.com_2025-12-15T12-22-21.json +0 -205
- package/.ai-lighthouse/audit_github.com_2025-12-15T12-22-46.json +0 -205
- package/.ai-lighthouse/audit_github.com_2025-12-15T12-23-18.json +0 -205
- package/.ai-lighthouse/audit_github.com_2025-12-15T12-24-43.json +0 -205
- package/.ai-lighthouse/audit_github.com_2025-12-17T12-15-08.json +0 -168
- package/.ai-lighthouse/audit_github.com_2025-12-17T12-15-57.json +0 -168
- package/.ai-lighthouse/audit_github.com_2025-12-17T12-17-11.json +0 -168
- package/.ai-lighthouse/audit_github.com_2025-12-17T12-22-17.json +0 -168
- package/.ai-lighthouse/audit_github.com_2025-12-17T12-22-42.json +0 -168
- package/.ai-lighthouse/audit_github.com_2025-12-17T12-23-56.json +0 -168
- package/.ai-lighthouse/audit_github.com_2025-12-17T12-25-24.json +0 -168
- package/.ai-lighthouse/audit_github.com_2025-12-17T12-25-40.json +0 -168
- package/.ai-lighthouse/audit_github.com_2025-12-17T12-27-02.json +0 -168
- package/.ai-lighthouse/audit_github.com_2025-12-17T12-27-20.json +0 -168
- package/.ai-lighthouse/audit_github.com_2025-12-17T12-29-56.json +0 -168
- package/.ai-lighthouse/audit_github.com_2025-12-17T12-32-27.json +0 -168
- package/.ai-lighthouse/audit_github.com_2025-12-17T12-33-00.json +0 -168
- package/.ai-lighthouse/audit_github.com_2025-12-17T12-34-49.json +0 -168
- package/.ai-lighthouse/audit_stripe.com_2025-12-15T12-11-31.json +0 -168
- package/.ai-lighthouse/audit_stripe.com_2025-12-15T12-11-45.json +0 -168
- package/.ai-lighthouse/audit_tailwindcss.com_2025-12-15T12-12-01.json +0 -169
- package/.ai-lighthouse/crawl_example.com_2025-12-15T12-03-08.json +0 -24
- package/.ai-lighthouse/crawl_example.com_2025-12-15T12-03-23.json +0 -24
- package/.ai-lighthouse/crawl_github.com_2025-12-15T11-41-34.json +0 -21
- package/.ai-lighthouse/crawl_github.com_2025-12-15T11-42-09.json +0 -21
- package/.ai-lighthouse/crawl_github.com_2025-12-15T11-42-45.json +0 -21
- package/.ai-lighthouse/crawl_github.com_2025-12-15T11-43-02.json +0 -21
- package/.ai-lighthouse/crawl_github.com_2025-12-15T11-43-26.json +0 -21
- package/.ai-lighthouse/crawl_github.com_2025-12-15T11-47-46.json +0 -906
- package/.ai-lighthouse/crawl_github.com_2025-12-15T11-50-27.json +0 -906
- package/.ai-lighthouse/crawl_github.com_2025-12-15T11-52-59.json +0 -906
- package/.ai-lighthouse/crawl_github.com_2025-12-15T12-03-33.json +0 -28
- package/CLI_UI_README.md +0 -211
- package/EXAMPLES.md +0 -87
- package/IMPLEMENTATION.md +0 -215
- package/USAGE.md +0 -264
- package/WIZARD_GUIDE.md +0 -340
- package/bin/cli.js +0 -2
- package/dist/commands/audit-interactive.d.ts +0 -2
- package/dist/commands/audit-interactive.js +0 -106
- package/dist/commands/audit-wizard.d.ts +0 -2
- package/dist/commands/audit-wizard.js +0 -110
- package/dist/commands/audit.d.ts +0 -2
- package/dist/commands/audit.js +0 -940
- package/dist/commands/crawl.d.ts +0 -2
- package/dist/commands/crawl.js +0 -267
- package/dist/commands/report.d.ts +0 -2
- package/dist/commands/report.js +0 -304
- package/dist/index.d.ts +0 -1
- package/dist/ui/AuditReportUI.d.ts +0 -10
- package/dist/ui/AuditReportUI.js +0 -76
- package/dist/ui/SetupWizard.d.ts +0 -18
- package/dist/ui/SetupWizard.js +0 -179
- package/dist/ui/components/AIUnderstandingSection.d.ts +0 -6
- package/dist/ui/components/AIUnderstandingSection.js +0 -87
- package/dist/ui/components/HallucinationSection.d.ts +0 -6
- package/dist/ui/components/HallucinationSection.js +0 -84
- package/dist/ui/components/IssuesSection.d.ts +0 -6
- package/dist/ui/components/IssuesSection.js +0 -84
- package/dist/ui/components/MessageAlignmentSection.d.ts +0 -6
- package/dist/ui/components/MessageAlignmentSection.js +0 -108
- package/dist/ui/components/OverviewSection.d.ts +0 -6
- package/dist/ui/components/OverviewSection.js +0 -107
- package/dist/ui/components/ScoreDisplay.d.ts +0 -8
- package/dist/ui/components/ScoreDisplay.js +0 -41
- package/dist/ui/components/TechnicalSection.d.ts +0 -7
- package/dist/ui/components/TechnicalSection.js +0 -110
- package/dist/utils/comprehensive-formatter.d.ts +0 -5
- package/dist/utils/comprehensive-formatter.js +0 -370
- package/src/commands/audit-interactive.ts +0 -149
- package/src/commands/audit-wizard.ts +0 -137
- package/src/commands/audit.ts +0 -1012
- package/src/commands/crawl.ts +0 -307
- package/src/commands/report.ts +0 -321
- package/src/index.ts +0 -22
- package/src/ui/AuditReportUI.tsx +0 -151
- package/src/ui/SetupWizard.tsx +0 -294
- package/src/ui/components/AIUnderstandingSection.tsx +0 -183
- package/src/ui/components/HallucinationSection.tsx +0 -172
- package/src/ui/components/IssuesSection.tsx +0 -140
- package/src/ui/components/MessageAlignmentSection.tsx +0 -203
- package/src/ui/components/OverviewSection.tsx +0 -157
- package/src/ui/components/ScoreDisplay.tsx +0 -58
- package/src/ui/components/TechnicalSection.tsx +0 -200
- package/src/utils/comprehensive-formatter.ts +0 -455
- package/test.sh +0 -31
- package/tsconfig.json +0 -25
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
import { analyzeUrlWithRules } from '@ai-lighthouse/scanner';
|
|
3
|
-
import { calculateAIReadiness, exportAuditReport } from '@ai-lighthouse/scanner';
|
|
4
|
-
import type { ScanOptions } from '@ai-lighthouse/scanner';
|
|
5
|
-
import { render } from 'ink';
|
|
6
|
-
import React from 'react';
|
|
7
|
-
import { AuditReportUI } from '../ui/AuditReportUI.js';
|
|
8
|
-
|
|
9
|
-
interface AuditOptions {
|
|
10
|
-
output?: string;
|
|
11
|
-
rules?: string;
|
|
12
|
-
depth?: number;
|
|
13
|
-
pages?: string;
|
|
14
|
-
cacheTtl?: number;
|
|
15
|
-
threshold?: number;
|
|
16
|
-
maxChunkTokens?: number;
|
|
17
|
-
chunkingStrategy?: 'auto' | 'heading-based' | 'paragraph-based';
|
|
18
|
-
enableChunking?: boolean;
|
|
19
|
-
enableExtractability?: boolean;
|
|
20
|
-
enableHallucination?: boolean;
|
|
21
|
-
enableLlm?: boolean;
|
|
22
|
-
minImpact?: number;
|
|
23
|
-
minConfidence?: number;
|
|
24
|
-
maxIssues?: number;
|
|
25
|
-
llmProvider?: string;
|
|
26
|
-
llmModel?: string;
|
|
27
|
-
llmBaseUrl?: string;
|
|
28
|
-
llmApiKey?: string;
|
|
29
|
-
interactive?: boolean;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
export function auditInteractiveCommand(program: Command) {
|
|
33
|
-
program
|
|
34
|
-
.command('audit-interactive')
|
|
35
|
-
.description('Audit a website for AI readiness with interactive UI')
|
|
36
|
-
.argument('<url>', 'URL to audit')
|
|
37
|
-
.option('-r, --rules <preset>', 'Rule preset: default, strict, minimal', 'default')
|
|
38
|
-
.option('-d, --depth <number>', 'Crawl depth (for multi-page audits)', parseInt, 1)
|
|
39
|
-
.option('-p, --pages <urls>', 'Comma-separated list of specific pages to audit')
|
|
40
|
-
.option('--cache-ttl <seconds>', 'Cache TTL in seconds to avoid re-fetching', parseInt)
|
|
41
|
-
.option('--threshold <score>', 'Minimum score threshold (exit 1 if below)', parseInt)
|
|
42
|
-
.option('--max-chunk-tokens <number>', 'Maximum tokens per content chunk', parseInt, 1200)
|
|
43
|
-
.option('--chunking-strategy <strategy>', 'Chunking strategy: auto, heading-based, paragraph-based', 'auto')
|
|
44
|
-
.option('--enable-chunking', 'Enable detailed content chunking analysis', false)
|
|
45
|
-
.option('--enable-extractability', 'Enable extractability mapping', false)
|
|
46
|
-
.option('--enable-hallucination', 'Enable hallucination detection', false)
|
|
47
|
-
.option('--enable-llm', 'Enable LLM comprehension analysis', false)
|
|
48
|
-
.option('--min-impact <number>', 'Minimum impact score to include', parseInt, 8)
|
|
49
|
-
.option('--min-confidence <number>', 'Minimum confidence to include (0-1)', parseFloat, 0.7)
|
|
50
|
-
.option('--max-issues <number>', 'Maximum issues to return', parseInt, 20)
|
|
51
|
-
.option('--llm-provider <provider>', 'LLM provider: openai, anthropic, ollama, local')
|
|
52
|
-
.option('--llm-model <model>', 'LLM model name')
|
|
53
|
-
.option('--llm-base-url <url>', 'LLM API base URL')
|
|
54
|
-
.option('--llm-api-key <key>', 'LLM API key')
|
|
55
|
-
.action(async (url: string, options: AuditOptions) => {
|
|
56
|
-
// Show loading UI
|
|
57
|
-
const { waitUntilExit, clear, rerender } = render(
|
|
58
|
-
React.createElement(AuditReportUI, {
|
|
59
|
-
url,
|
|
60
|
-
result: {},
|
|
61
|
-
aiReadiness: {},
|
|
62
|
-
loading: true,
|
|
63
|
-
currentStep: 'Starting audit...',
|
|
64
|
-
})
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
try {
|
|
68
|
-
// Validate URL
|
|
69
|
-
const urlObj = new URL(url);
|
|
70
|
-
|
|
71
|
-
// Build scan options
|
|
72
|
-
const scanOptions: ScanOptions = {
|
|
73
|
-
maxChunkTokens: options.maxChunkTokens,
|
|
74
|
-
chunkingStrategy: options.chunkingStrategy,
|
|
75
|
-
enableChunking: options.enableChunking,
|
|
76
|
-
enableExtractability: options.enableExtractability,
|
|
77
|
-
enableHallucinationDetection: options.enableHallucination,
|
|
78
|
-
enableLLM: options.enableLlm,
|
|
79
|
-
minImpactScore: options.minImpact,
|
|
80
|
-
minConfidence: options.minConfidence,
|
|
81
|
-
maxIssues: options.maxIssues,
|
|
82
|
-
};
|
|
83
|
-
|
|
84
|
-
// Configure LLM if enabled
|
|
85
|
-
if (options.enableLlm && options.llmProvider) {
|
|
86
|
-
scanOptions.llmConfig = {
|
|
87
|
-
provider: options.llmProvider as any,
|
|
88
|
-
model: options.llmModel,
|
|
89
|
-
baseUrl: options.llmBaseUrl,
|
|
90
|
-
apiKey: options.llmApiKey,
|
|
91
|
-
};
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
// Update loading step
|
|
95
|
-
rerender(
|
|
96
|
-
React.createElement(AuditReportUI, {
|
|
97
|
-
url: urlObj.href,
|
|
98
|
-
result: {},
|
|
99
|
-
aiReadiness: {},
|
|
100
|
-
loading: true,
|
|
101
|
-
currentStep: 'Scanning page...',
|
|
102
|
-
})
|
|
103
|
-
);
|
|
104
|
-
|
|
105
|
-
// Run the audit
|
|
106
|
-
const result = await analyzeUrlWithRules(url, scanOptions);
|
|
107
|
-
|
|
108
|
-
// Update loading step
|
|
109
|
-
rerender(
|
|
110
|
-
React.createElement(AuditReportUI, {
|
|
111
|
-
url: urlObj.href,
|
|
112
|
-
result,
|
|
113
|
-
aiReadiness: {},
|
|
114
|
-
loading: true,
|
|
115
|
-
currentStep: 'Calculating AI readiness scores...',
|
|
116
|
-
})
|
|
117
|
-
);
|
|
118
|
-
|
|
119
|
-
// Calculate AI readiness
|
|
120
|
-
const aiReadiness = calculateAIReadiness(result);
|
|
121
|
-
|
|
122
|
-
// Clear loading and show results
|
|
123
|
-
clear();
|
|
124
|
-
const finalRender = render(
|
|
125
|
-
React.createElement(AuditReportUI, {
|
|
126
|
-
url: urlObj.href,
|
|
127
|
-
result,
|
|
128
|
-
aiReadiness,
|
|
129
|
-
loading: false,
|
|
130
|
-
})
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
// Wait for user to exit
|
|
134
|
-
await finalRender.waitUntilExit();
|
|
135
|
-
|
|
136
|
-
// Check threshold
|
|
137
|
-
if (options.threshold !== undefined) {
|
|
138
|
-
const overallScore = aiReadiness.overall;
|
|
139
|
-
if (overallScore !== undefined && overallScore < options.threshold) {
|
|
140
|
-
process.exit(1);
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
} catch (error) {
|
|
144
|
-
clear();
|
|
145
|
-
console.error('Audit failed:', error instanceof Error ? error.message : error);
|
|
146
|
-
process.exit(1);
|
|
147
|
-
}
|
|
148
|
-
});
|
|
149
|
-
}
|
|
@@ -1,137 +0,0 @@
|
|
|
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
|
-
}
|