Skip to content

Mayank-Tripathi32/migration-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Migration Check

A CLI tool that compares two websites and generates comprehensive migration validation reports. Detects visual regressions, content changes, SEO issues, and performance differences.

Features

  • Visual Regression Testing: Screenshot comparison with pixel-level diff using Playwright + pixelmatch
  • Content Comparison: HTML structure, text content, links, and images diff
  • SEO Validation: Meta tags, Open Graph, canonical URLs, structured data
  • Performance Metrics: Load time, TTFB, LCP, CLS, FCP comparisons
  • AI Analysis: Optional OpenRouter integration for semantic visual diff analysis
  • Scalable: Handles 1000+ URLs with configurable concurrency
  • HTML Reports: Interactive dashboard to browse comparison results

Installation

# Install dependencies
npm install

# Install Playwright browser
npx playwright install chromium

# Setup environment (copy and edit with your API key)
cp .env.example .env

Environment Setup

  1. Copy .env.example to .env
  2. Add your OpenRouter API key (get one at https://openrouter.ai/)
# .env
OPENROUTER_API_KEY=sk-or-v1-your-key-here

Usage

Compare two websites

# Basic comparison using sitemap
npm run dev -- compare -s https://old-site.com -t https://new-site.com

# With options
npm run dev -- compare \
  -s https://old-site.com \
  -t https://new-site.com \
  --concurrency 20 \
  --viewports desktop mobile \
  --output ./reports/migration-2024 \
  --ai --ai-key YOUR_OPENROUTER_KEY

# Crawl mode (if no sitemap available)
npm run dev -- compare \
  -s https://old-site.com \
  -t https://new-site.com \
  --crawl \
  --max-urls 500

Generate reports

# Generate HTML report from existing data
npm run dev -- report -d ./reports -f html

# Generate JSON report
npm run dev -- report -d ./reports -f json -o ./results.json

View dashboard

npm run dev -- serve -p 3000 -d ./reports

CLI Options

compare command

Option Description Default
-s, --source <url> Source website URL (required) -
-t, --target <url> Target website URL (required) -
-c, --concurrency <n> Concurrent comparisons 10
-v, --viewports <list> Viewports: desktop, tablet, mobile, or WxH desktop
-o, --output <dir> Output directory ./reports
--threshold <n> Visual diff threshold % 0.1
--ai Enable AI analysis false
--ai-key <key> OpenRouter API key $OPENROUTER_API_KEY
--skip-visual Skip visual comparison false
--skip-content Skip content comparison false
--skip-performance Skip performance comparison false
--skip-seo Skip SEO comparison false
--crawl Crawl instead of using sitemap false
--max-urls <n> Max URLs to compare 1000

Output

Reports are saved to the output directory:

reports/
├── comparison.db        # SQLite database with all results
├── report.html          # Interactive HTML report
└── screenshots/         # Screenshot files
    └── [url-slug]/
        ├── source-desktop.png
        ├── target-desktop.png
        └── diff-desktop.png

Environment Variables

Variable Description
OPENROUTER_API_KEY API key for AI analysis via OpenRouter

Development

# Run in development mode
npm run dev -- compare -s https://example.com -t https://example.org

# Build for production
npm run build

# Run built version
npm start -- compare -s https://example.com -t https://example.org

License

MIT

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors