watch Command

watch Command

Watch a directory for changes and analyze HTML files in real-time.

Usage

capyseo watch <directory> [options]

Arguments

Argument Required Description
directory Yes Directory to watch

Options

Option Type Default Description
--ai flag false Enable AI suggestions
--debounce number 500 Debounce time in ms
--config string - Config file path

Examples

# Basic watch capyseo watch ./src # With AI suggestions capyseo watch ./src --ai # Faster response (300ms debounce) capyseo watch ./src --debounce 300 # Slower response (1 second debounce) capyseo watch ./src --debounce 1000 # With custom config capyseo watch ./dist --config ./custom.config.js

Behavior

What It Watches

  • All **/*.html files in the directory recursively
  • New files added (add event)
  • Modified files (change event)

What It Ignores

  • Initial existing files (only watches new changes)
  • Non-HTML files

Debouncing

The --debounce option prevents rapid re-analysis when files change quickly:

# Default: wait 500ms after last change capyseo watch ./src # Fast: respond after 100ms capyseo watch ./src --debounce 100 # Slow: wait 2 seconds capyseo watch ./src --debounce 2000

Live Checks

Live HTTP checks are disabled during watch mode for performance. Use analyze command for full link checking.

Output

👀 Watching ./src for HTML changes... [12:34:56] File changed: index.html /index.html Score: 85/100 [x] [meta-description] Missing meta description [!] [image-alt] Image missing alt: hero.jpg [12:35:12] File added: about.html /about.html Score: 92/100 [i] [open-graph] Missing og:image

Stopping

Press Ctrl+C to stop watching.

Use Cases

Development Workflow

# Terminal 1: Development server npm run dev # Terminal 2: SEO watch capyseo watch ./src --ai

Build Watch

Some build tools output to a dist folder continuously:

# Terminal 1: Build watch npm run build -- --watch # Terminal 2: SEO analysis capyseo watch ./dist

CI/CD Feedback Loop

Not typically used in CI, but useful for local development before committing:

# Watch while developing capyseo watch ./src --ai # Before commit, run full analysis capyseo analyze ./dist --ci --min-score 80

Integration with Editors

VS Code Task

{ "label": "SEO Watch", "type": "shell", "command": "npx @capyseo/cli watch ./src --ai", "problemMatcher": [], "presentation": { "reveal": "always", "panel": "dedicated" } }

npm Script

{ "scripts": { "seo:watch": "capyseo watch ./src --ai" } }