User wants to automatically analyze a website URL for performance metrics, accessibility, SEO, or best practices without manual Chrome DevTools interaction.
Verify prerequisites — Check Node.js (v18+) and packages installed: node --version && npm list lighthouse chrome-launcher
Run Lighthouse audit — Execute node automation-script.js <URL> [--mobile] [--output=DIR] to collect all metrics.
Extract and present metrics — Use tables for scores (0-100) and metrics with status indicators (⚪ Good, 🟡 Warning, 🔴 Critical).
Identify critical issues — Flag metrics outside thresholds: LCP>2.5s, CLS>0.1, INP>200ms, TBT>200ms, Performance<50.
Provide actionable fixes — For each issue, include specific code fixes from audit-checklist.md and metrics-reference.md.
Save results — Store JSON and HTML reports in ./results/. Ask user before saving to memory for tracking.
Handle errors gracefully — If audit fails, check troubleshooting.md for common solutions (Chrome not found, ES module errors, memory issues).
TopicFileAutomation scriptautomation-script.jsMetrics & thresholdsmetrics-reference.mdFix checklistsaudit-checklist.mdSetup guidesetup.mdQuick startquick-start.mdTroubleshootingtroubleshooting.mdMemory trackingmemory-template.md
After analysis, offer to save: URL, timestamp, scores, critical issues, report path. Always ask before saving to memory.
bash
# Quick audit (desktop)
node automation-script.js https://example.com
# Mobile emulation
node automation-script.js https://example.com --mobile
# Custom output directory
node automation-script.js https://example.com --output=./reports
# Lighthouse CLI directly
lighthouse https://example.com --output=json --output-path=report.json
ErrorSolution"lighthouse is not a function"Add "type": "module" to package.json"Chrome not found"Install Chrome or use npm install puppeteer"JavaScript heap out of memory"Run with node --max-old-space-size=4096"Port already in use"Specify different port in script config