Pipeline Patterns
JSON mode
Section titled “JSON mode”Add --json before any command for machine-readable output:
websketch --json validate capture.jsonwebsketch --json render capture.jsonwebsketch --json fingerprint capture.jsonwebsketch --json diff before.json after.jsonSuccess: { "ok": true, ... }
Error: { "ok": false, "error": { "code": "WS_...", "message": "..." } }
Exit codes still apply in JSON mode — use $? or set -e in scripts.
CI visual regression
Section titled “CI visual regression”Use fingerprinting to detect layout regressions without maintaining pixel baselines:
# Capture the page (via extension or programmatic capture)# Then compare fingerprintsBEFORE=$(websketch fingerprint baseline.json)AFTER=$(websketch fingerprint current.json)
if [ "$BEFORE" != "$AFTER" ]; then echo "Layout changed!" websketch diff baseline.json current.json exit 1fiLLM agent workflows
Section titled “LLM agent workflows”The --llm flag on render-ascii produces output optimized for language model consumption:
websketch render-ascii --llm capture.jsonThis includes:
- Page URL and viewport dimensions in a header
- The ASCII wireframe
- A legend explaining the bracket notation (
[BTN:label],[NAV:name], etc.)
Feed this directly into an LLM context window for UI understanding without vision capabilities.
MCP server integration
Section titled “MCP server integration”For agents that use the Model Context Protocol, websketch-mcp exposes these same operations as MCP tools — no shell access required.