analyze Command

analyze Command

Analyze HTML pages for SEO issues.

Usage

capyseo analyze <target> [options]

Arguments

Argument Required Description
target Yes Directory path or URL to analyze

Options

Option Type Default Description
--ai flag false Enable AI-powered suggestions
--ai-provider string auto AI provider: gemini, openai, anthropic, ollama
--ai-model string - Specific AI model to use
--ci flag false CI mode with exit codes
--min-score number 0 Minimum score for CI mode
--format string console Output format
-o, --output string stdout Output file path
--max-pages number 100 Maximum pages to analyze
--no-live flag - Disable live HTTP checks
--spa flag false Enable JavaScript rendering
--config string - Config file path

Examples

Basic Analysis

# Analyze a directory capyseo analyze ./dist # Analyze a URL capyseo analyze https://example.com

AI-Powered Analysis

# With auto-detected provider export GEMINI_API_KEY=your_key capyseo analyze ./dist --ai # With specific provider capyseo analyze ./dist --ai --ai-provider openai # With specific model capyseo analyze ./dist --ai --ai-provider gemini --ai-model gemini-2.5-pro

Output Formats

# Console (default) - human readable capyseo analyze ./dist # JSON - structured data capyseo analyze ./dist --format json -o report.json # SARIF - for CI/CD tools capyseo analyze ./dist --format sarif -o report.sarif # HTML - visual report capyseo analyze ./dist --format html -o report.html # CSV - spreadsheet compatible capyseo analyze ./dist --format csv -o report.csv

CI Mode

# Fail if score < 80 capyseo analyze ./dist --ci --min-score 80 # With SARIF for GitHub capyseo analyze ./dist --ci --min-score 80 --format sarif -o seo.sarif

Performance Options

# Limit pages analyzed capyseo analyze https://example.com --max-pages 50 # Disable live link checking (faster) capyseo analyze ./dist --no-live # Analyze SPA with JavaScript rendering capyseo analyze https://spa-site.com --spa

Custom Config

capyseo analyze ./dist --config ./custom.config.js

Output Example

Console Format

/index.html Score: 85/100 [x] [meta-description] Missing meta description Add <meta name="description" content="..."> [!] [image-alt] Image missing alt: hero.jpg Add descriptive alt text for this image [i] [open-graph] Missing og:image Add <meta property="og:image" content="..."> /about.html Score: 92/100 [!] [heading-hierarchy] Skipped heading level (h2 to h4) Use sequential heading levels ================================================== Average Score: 88.5/100 Total Pages: 2 Total Issues: 4 Errors: 1 | Warnings: 2 | Info: 1

Severity Icons

  • [x] - Error (red)
  • [!] - Warning (yellow)
  • [i] - Info (blue)

Exit Codes

Code Meaning When
0 Success Analysis completed, score OK
1 Failed Analysis error or failOn triggered
10 Score Below Min --ci mode and score < --min-score

CI/CD Integration

GitHub Actions

- name: Build run: npm run build - name: SEO Analysis run: npx @capyseo/cli analyze ./dist --ci --min-score 80 --format sarif -o seo.sarif env: GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }} - name: Upload SARIF uses: github/codeql-action/upload-sarif@v3 if: always() with: sarif_file: seo.sarif

GitLab CI

seo: stage: test script: - npm run build - npx @capyseo/cli analyze ./dist --ci --min-score 80 allow_failure: false

Live Checks

By default, analyze performs live HTTP checks for:

  • Broken links (404s, 5xx errors)
  • Redirect chains
  • Security headers

Disable with --no-live for:

  • Faster local analysis
  • Offline environments
  • Avoiding false positives

SPA Support

For JavaScript-rendered sites:

# Requires Playwright npm install -D playwright npx playwright install chromium # Then analyze capyseo analyze https://spa-site.com --spa

This renders pages with a headless browser before analysis.