A comprehensive tool for analyzing Core Web Vitals (CWV) performance and generating actionable optimization suggestions with AI-powered insights.
- π Performance Data Collection: Automated CrUX data, PSI audits, and HAR file generation
- π€ AI-Powered Analysis: Generate detailed optimization recommendations using advanced LLM models
- π± Multi-Device Support: Analyze both mobile and desktop performance
- π― Interactive Review: Built-in MCP reviewer for Cursor IDE integration
- βοΈ SpaceCat Integration: Direct upload of approved suggestions to SpaceCat platform
- π Flexible Caching: Smart caching to avoid redundant API calls
npm installCreate a .env file with your API keys:
# Core APIs
GOOGLE_CRUX_API_KEY=your_crux_api_key
GOOGLE_PAGESPEED_INSIGHTS_API_KEY=your_psi_api_key
# For Gemini
GOOGLE_APPLICATION_CREDENTIALS=path/to/credentials.json
# OpenAI Models
AZURE_OPENAI_API_DEPLOYMENT_NAME=...
AZURE_OPENAI_API_INSTANCE_NAME=...
AZURE_OPENAI_API_KEY=...
AZURE_OPENAI_API_VERSION=...# Quick analysis with AI suggestions
node index.js --action prompt --url "https://example.com"
# Collect raw performance data
node index.js --action collect --url "https://example.com" --device mobile
# Start interactive MCP reviewer, but cursor should do it for you automatically
node index.js --action mcp-reviewer| Action | Description | Example |
|---|---|---|
collect |
Collect raw performance data (CrUX, PSI, HAR) | --action collect --url example.com |
prompt |
Generate AI-powered optimization suggestions | --action prompt --url example.com |
rules |
Apply predefined performance rules | --action rules --url example.com |
agent |
Run the full AI agent workflow (multi-agent) | --action agent --url example.com |
mcp-reviewer |
Start interactive suggestion reviewer | --action mcp-reviewer |
node index.js [options]
Options:
--action, -a Action to perform [collect|prompt|rules|agent|mcp-reviewer]
--url, -u URL to analyze
--urls Path to JSON file with multiple URLs
--device, -d Device type [mobile|desktop] (default: mobile)
--skip-cache, -s Skip cached data and force new collection
--model, -m LLM model to use (default: gemini-2.5-pro-preview-05-06)
--output-suffix Suffix for output files
--block-requests Block specific requests (comma-separated)
--help Show helpgemini-2.5-pro-preview-05-06(default, recommended)gemini-2.5-flash-preview-05-20(faster, less detailed)
gpt-5(latest GPT-5 model)gpt-4o(GPT-4 model)gpt-4.1(previous version)
claude-3-7-sonnet-20250219(coming soon)
The CWV Agent includes a powerful MCP (Model Context Protocol) reviewer for interactive suggestion management within Cursor IDE.
π For complete setup instructions, see: MCP-REVIEWER-GUIDE.md
# Complete analysis workflow
node index.js --action prompt --url "https://www.qualcomm.com" --device mobile# Conditional multi-agent (PSI-gated; only runs heavy agents like HAR/Coverage/Code when needed)
node index.js --action agent --url "https://example.com" --device mobileCreate urls.json:
[
"https://example.com",
"https://example.org",
"https://example.net"
]Run batch analysis:
node index.js --action prompt --urls urls.json --device mobile# Skip cache and collect new data
node index.js --action prompt --url "https://example.com" --skip-cacheThe tool generates files in the .cache/ directory:
| File Type | Description | Example |
|---|---|---|
*.performance.json |
Raw performance data | example-com.mobile.performance.json |
*.suggestions.*.json |
AI-generated suggestions | example-com.mobile.suggestions.gemini25pro.json |
*.report.*.summary.md |
AI-generated markdown report | example-com.mobile.report.agent.gpt5.summary.md |
*.har |
HTTP Archive files | example-com.mobile.har |
*.report.json |
Complete analysis reports | example-com.mobile.report.json |
# Use different AI model
node index.js --action prompt --url example.com --model gpt-4o# Block analytics and ads during collection
node index.js --action collect --url example.com --block-requests "google-analytics,facebook"# Start local server for report visualization
npx live-server --mount=/.cache:./.cache
# Open visualization UI
open http://127.0.0.1:8080/ui/index.html?report=/.cache/example-com.mobile.report.json- CrUX Data: Real user experience metrics from Chrome UX Report
- PSI Audit: PageSpeed Insights performance audit
- HAR Files: Complete HTTP archive of page load
- Performance Entries: Browser performance API data
- First-Party Code: JavaScript and CSS files for analysis
- Results cached by URL and device type
- Use
--skip-cacheto force fresh data collection - Cache files stored in
.cache/directory
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes and test thoroughly
- Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request
Built with β€οΈ for better web performance