CLI Reference

The relay-core-cli binary provides a full-featured command-line interface for running the proxy and managing flows, rules, and certificates.

Commands

run

Start the proxy server.

relay-core-cli run [options]

Options:
  --port <PORT>          Proxy port (default: 8080)
  --ui                   Enable TUI interface
  --config <PATH>        Config file path
  --verbose              Enable verbose logging

ca

Manage CA certificates for HTTPS interception.

relay-core-cli ca <subcommand>

Subcommands:
  init                   Generate new CA certificate
  install                Install CA system-wide
  status                 Show CA certificate status
  export <path>          Export CA certificate to file
  uninstall              Remove installed CA

rules

Manage interception rules.

relay-core-cli rules <subcommand>

Subcommands:
  list                   List all rules
  validate <file>        Validate rule file
  export                 Export rules to YAML
  import <file>          Import rules from YAML

flows

Query captured flows.

relay-core-cli flows [options]

Options:
  --filter <EXPR>       Filter expression
  --limit <N>            Max results (default: 50)
  --offset <N>           Pagination offset
  --format <json|table>  Output format

metrics

Display runtime metrics.

relay-core-cli metrics [options]

Options:
  --format <json|prometheus>  Output format (default: table)
  --reset                     Reset counters after display

scripts

Manage Deno scripts for request/response modification.

relay-core-cli scripts <subcommand>

Subcommands:
  list                     List loaded scripts
  load <path>              Load a script
  unload <name>            Unload a script

Filter Expressions

Filter flows using expressive filter syntax:

# By method
method:GET
method:POST

# By host (supports wildcards)
host:example.com
host:*.example.com

# By path
path:/api/users
path:/api/v2/*

# By status code
status:200
status:[200 TO 299]
status:[400 TO 499]

# Combine with AND/OR
method:GET AND host:*.example.com
method:POST OR method:PUT

# Negate
NOT method:OPTIONS

Configuration File

Create ~/.relay-core/config.toml:

[proxy]
port = 8080
bind_address = "0.0.0.0"
upstream_proxy = "http://parent-proxy:8080"  # Optional

[storage]
sqlite_path = "~/.relay-core/flows.db"
max_flows = 10000
flow_ttl_hours = 24

[logging]
level = "info"  # debug, info, warn, error
access_log = true

[mcp]
enabled = true
port = 25519

[tls]
insecure_skip_verify = false
cert_cache_size = 100

Environment Variables

RELAY_CORE_CONFIG      # Config file path
RELAY_CORE_PORT         # Proxy port
RELAY_CORE_LOG_LEVEL    # Logging level
RELAY_CORE_DATA_DIR     # Data directory (default: ~/.relay-core)