Tooling

CLI

Terminal commands to inspect and test Surf-enabled websites

CLI#

The @surfjs/cli package provides terminal commands to inspect and test Surf-enabled websites.

bash
# Check if a site is Surf-enabled
surf ping https://shop.example.com
# โœ… https://shop.example.com is Surf-enabled (42ms)
ย 
# Inspect all commands
surf inspect https://shop.example.com
# ๐Ÿ„ My Store (Surf v1.0)
# 6 commands available:
#
# search(query: string, limit?: number)
# Search products
#
# cart.add(sku: string, quantity?: number) ๐Ÿ”
# Add item to cart
ย 
# Inspect with full parameter details
surf inspect https://shop.example.com --verbose
ย 
# Execute a command interactively
surf test https://shop.example.com search --query "laptop"
# Executing search on https://shop.example.com...
# OK
# { "results": [...], "total": 42 }
# โฑ 47ms execute / 89ms total
ย 
# Machine-readable JSON output
surf test https://shop.example.com search --query "laptop" --json
ย 
# With authentication
surf test https://shop.example.com order.create --auth sk-token --sku LAPTOP-01
ย 
# Override execute path for @surfjs/next deployments
surf test https://my-app.vercel.app search --base-path /api/surf/execute --query "laptop"

The CLI prompts for missing required parameters interactively and coerces values to the correct type.

| Flag | Description | |------|-------------| | --json | Machine-readable JSON output | | --auth <token> | Bearer token for authenticated commands | | --verbose | Show full parameter schemas (inspect only) | | --base-path <path> | Override execute path (default: /surf/execute). Use /api/surf/execute for @surfjs/next. |