Files
browser/src/help.zon
T
Karl Seguin db258bfec4 breaking: disable worker and iframe loading by default
By default, iframes and workers no longer loaded. Use `--load-resources iframe`
and `--load-resources worker` to restore the previous behavior. The disabling
makes resource loading more consistent.

To further make things more consistent, Config seems the following changes:

1. remove  `--timeout` from `serve` which does nothing but has printed a
   deprecation warning for a long time

2. added .deprecated field to CLI config flags which now logs the specified
   deprecated warning when used

3. `--log-filter-scopes` is deprecated in favor of `--log-scopes`

4. `--disable_subframes` is deprecated. Iframe loading is disabled by default,
    use `--load-resources iframe` to enable iframe loading

5. `--disable_workers` is deprecated. Worker loading is disabled by default,
    use `--load-resources worker` to enable worker loading

6. `--enable_external_stylesheets`  is deprecated. Stylesheets remain disabled
    by default. Use `--load-resources stylesheet` to enable loading external
    stylesheets

CLI log parameters now alter the logger behavior on parse. This helps minimze
the window where default log settings are in-play. It also means things like
this work:

```
./lightpanda --log-level fatal --disable_subframes --log-level warn
```

More seriously, there's now an optional `beforeParse` fired once the mode is
known. This is used by mcp to set the default log level to logfmt. Previously
this was done much later and could easily result in a mix of pretty and logfmt
logs.
2026-08-27 17:25:42 +08:00

487 lines
24 KiB
Zig

.{
// MAX_HELP_LEN|
.general =
\\usage: {0s} <command> [arguments]
\\
\\The commands are:
\\ agent starts an interactive AI agent that can browse the web
\\ fetch fetches the specified URL
\\ help displays this message
\\ mcp starts an MCP (Model Context Protocol) server (stdio or HTTP)
\\ run runs a saved script (no LLM), then exits
\\ serve starts a WebSocket CDP server
\\ version displays the version of {0s}
\\
\\Use "{0s} help <command>" for more information about a command.
,
.serve =
\\usage: {0s} serve [OPTIONS] [COMMON_OPTIONS]
\\
\\Starts a WebSocket CDP server.
\\
\\options:
\\ --advertise-host <HOST>
\\ The host to advertise, e.g. in the /json/version response. Useful,
\\ for example, when --host is 0.0.0.0.
\\ Defaults to --host value.
\\ --cdp-max-connections <INT>
\\ Maximum number of simultaneous CDP connections.
\\ Defaults to 16.
\\ --cdp-max-http-message-size <INT>
\\ Maximum allowed HTTP request size
\\ Defaults to 4096 (maximum allowed: 16383)
\\ --cdp-max-message-size <INT>
\\ Maximum allowed incoming websocket message size.
\\ Defaults to 1048576 (1MB)
\\ --cdp-max-pending-connections <INT>
\\ Maximum pending connections in the accept queue.
\\ Defaults to 128.
\\ --cookie <PATH>
\\ Path to a JSON file to load cookies from (read-only).
\\ Defaults to no cookie loading.
\\ --disable-metrics
\\ Disables the /metrics endpoint (Prometheus text format).
\\ Defaults to false (the endpoint is exposed).
\\ --host <HOST>
\\ Host of the CDP server.
\\ Defaults to "127.0.0.1".
\\ --port <INT>
\\ Port of the CDP server.
\\ Defaults to 9222.
,
.fetch =
\\usage: {0s} fetch <url>... [OPTIONS] [COMMON_OPTIONS]
\\
\\Fetches one or more URLs. Each URL is loaded in its own page. Passing more
\\than one URL requires --json.
\\
\\options:
\\ --cookie <PATH>
\\ Path to a JSON file to load cookies from (read-only).
\\ Defaults to no cookie loading.
\\ --cookie-jar <PATH>
\\ Path to a JSON file to save cookies to on exit (write-only).
\\ Defaults to no cookie saving.
\\ --dump <DUMP>
\\ Dumps the document to stdout.
\\ Defaults to no dump.
\\ Allowed values:
\\ html Serialized HTML of the DOM.
\\ markdown Converts content to Markdown.
\\ png Text-only rendering of the page as a
\\ PNG image (base64 with --json).
\\ semantic_tree JSON-serialized semantic tree.
\\ semantic_tree_text Pruned plain-text semantic tree.
\\ --dump-max-bytes <INT>
\\ Soft cap on the dumped html or markdown, in bytes. Output is cut
\\ at a UTF-8 boundary and a '[truncated]' marker is appended.
\\ Defaults to no cap.
\\ --dump-selector <QUERY>
\\ Dump only the first element matching the CSS selector instead
\\ of the whole document. Fails if nothing matches.
\\ --fail-on-http-error
\\ Exit with code 22 when any page's HTTP status is 400 or above.
\\ The dump is still written. Navigation and wait failures exit
\\ with code 1 regardless of this flag.
\\ Defaults to false.
\\ --inject-script <EXPR>
\\ JavaScript to execute as the document's <head> is parsed, before any
\\ other scripts in the page run. Can be passed multiple times; scripts
\\ run in order.
\\ --inject-script-file <PATH>
\\ Like --inject-script, but reads the script from a file. Can be passed
\\ multiple times; can be mixed with --inject-script and runs in CLI order.
\\ --json
\\ Capture and print the status of the fetch as JSON. A single URL
\\ prints one object; multiple URLs print {{"results": [ ... ]}} with
\\ one object per URL. When used with --dump <MODE> the dumped
\\ content is wrapped within each object. Each object carries an
\\ "error" field: null, or the name of the navigation, wait or
\\ dump failure for that URL. One failed URL does not stop the
\\ others; the process exits 1 if any URL failed.
\\ --metrics
\\ Write metrics (Prometheus text format) to stdout on exit, after
\\ any --dump output.
\\ Defaults to false.
\\ --strip-mode <STRIP>
\\ Tag group to remove from dump. Can be passed multiple times.
\\ In markdown only 'ui' changes the output: scripts, styles and
\\ hidden elements are never rendered.
\\ Defaults to no-strip.
\\ Allowed values:
\\ js Script and link[as=script, rel=preload].
\\ ui Includes img, picture, video, CSS and SVG.
\\ css Includes style and link[rel=stylesheet].
\\ invisible Best-effort (e.g. display:none) hidden elements
\\ full Strip everything.
\\ --terminate-ms <INT>
\\ Hard deadline in milliseconds. After this time elapses, JavaScript
\\ execution is forcibly terminated (e.g. for pages with endless scripts).
\\ Unlike --wait-ms, which only stops waiting, --terminate-ms aborts the
\\ page.
\\ Defaults to no terminate.
\\ --wait-ms <INT>
\\ Wait time in milliseconds. Supersedes all other --wait parameters.
\\ Defaults to 5000.
\\ --wait-script <EXPR>
\\ Wait for a JavaScript expression to return truthy. Checked after
\\ --wait-until condition is met.
\\ --wait-script-file <PATH>
\\ Like --wait-script, but reads the script from a file.
\\ --wait-selector <QUERY>
\\ Wait for an element matching the CSS selector to appear. Checked after
\\ --wait-until condition is met.
\\ --wait-until <UNTIL>
\\ Wait until the specified event. Checked before other --wait-* options.
\\ Defaults to 'load'. If --wait-selector, --wait-script or
\\ --wait-script-file specified, defaults to none.
\\ Allowed values: "load", "domcontentloaded", "networkalmostidle",
\\ "networkidle", "done".
\\ 'done' waits for full quiescence (no pending scripts or network);
\\ pages with constant background activity never reach it and run
\\ to --wait-ms.
\\ --with-base
\\ Add a <base> tag in dump.
\\ Defaults to false.
\\ --with-frames
\\ Includes the contents of iframes.
\\ Defaults to false.
,
.mcp =
\\usage: {0s} mcp [OPTIONS] [COMMON_OPTIONS]
\\
\\Starts an MCP (Model Context Protocol) server. Defaults to stdio; pass
\\--port to serve over HTTP with an independent browsing session per client.
\\
\\options:
\\ --cdp-port <INT>
\\ Also run a CDP (WebSocket) server on this port. Cannot be
\\ combined with --port (they share one network listener).
\\ Defaults to disabled.
\\ --cookie <PATH>
\\ Path to a JSON file to load cookies from (read-only).
\\ Defaults to no cookie loading.
\\ --cookie-jar <PATH>
\\ Path to a JSON file to save cookies to on exit (write-only).
\\ Defaults to no cookie saving.
\\ --host <HOST>
\\ Host to bind when --port is set (e.g. 0.0.0.0 for all interfaces).
\\ Defaults to "127.0.0.1".
\\ --port <INT>
\\ Serve MCP over HTTP on this port instead of stdio. Clients POST
\\ JSON-RPC to /mcp; route requests to a session with the
\\ Mcp-Session-Id header.
\\ Defaults to stdio (no HTTP server).
,
.agent =
\\agent command
\\Starts an interactive AI agent that can browse the web.
\\
\\Usage:
\\ {0s} agent [SCRIPT] [OPTIONS] [COMMON_OPTIONS]
\\
\\Examples:
\\ {0s} agent (auto-detects API key from env)
\\ {0s} agent --provider anthropic --model claude-sonnet-4-6
\\ {0s} agent --provider huggingface (HF serverless router, HF_TOKEN)
\\ {0s} agent --provider ollama --model qwen3.5:latest
\\ {0s} agent --no-llm (basic slash-command-only REPL)
\\ {0s} run script.js (replay a saved script; see `run`)
\\ {0s} agent --task "..." --save out.js (synthesize a replayable script)
\\
\\Arguments:
\\[SCRIPT]
\\ Optional path to a .js script. Runs the script (no LLM calls) and
\\ exits; `{0s} run SCRIPT` is the preferred spelling. With no script
\\ and no --task, the REPL starts; from there /load runs a script and
\\ /save exports the session to a file.
\\ Caution: .js files can contain evaluate(...) calls that run
\\ arbitrary JavaScript in the page. Only run scripts you trust, the
\\ same way you would a shell script.
\\
\\Options:
\\ -a, --attach <PATH>
\\ Feed a local file to the model alongside --task. Repeatable, one
\\ file per flag. Text files are inlined (max 512 KiB each);
\\ images/audio/pdf are base64-encoded (max 20 MiB each).
\\ Requires --task.
\\ --base-url <URL>
\\ Override the API base URL for the provider. Defaults to the
\\ provider's standard endpoint.
\\ Ollama default: http://localhost:11434/v1.
\\ llama.cpp default: http://localhost:8080/v1.
\\ Hugging Face default is the serverless router
\\ (https://router.huggingface.co/v1);
\\ point this at a dedicated Inference Endpoint to use one.
\\ --effort <LEVEL>
\\ Per-turn reasoning budget, mapped to each provider's native
\\ thinking/reasoning knob. Default: low in the REPL (snappy turns),
\\ medium in one-shot --task mode, unless the provider sets its own
\\ default (Mistral defaults to none, as its default model rejects
\\ effort). In the REPL, use /effort to change it.
\\ Allowed values: none, minimal, low, medium, high, xhigh.
\\ --list-models
\\ Print the model IDs usable with `agent` for --provider, one per
\\ line, sorted, and exit. Auto-detects the provider from env when
\\ --provider is omitted.
\\ --model <MODEL>
\\ The model name to use. Defaults to a sensible default per
\\ provider. In the REPL, use /model to list and change models for
\\ the active provider.
\\ --no-llm
\\ Force the basic REPL even when an API key is present or
\\ --provider is set. Useful for testing slash commands without
\\ burning tokens, or for disabling the LLM in a saved command
\\ without editing the existing flags. Wins over --provider.
\\ --provider <PROVIDER>
\\ The AI provider. When omitted, lightpanda auto-detects an API
\\ key from your environment (ANTHROPIC_API_KEY, OPENAI_API_KEY,
\\ GOOGLE_API_KEY/GEMINI_API_KEY, HF_TOKEN, AI_GATEWAY_API_KEY,
\\ MISTRAL_API_KEY). With exactly one key set: that provider is
\\ used. With multiple keys on a TTY: you'll be prompted to pick;
\\ in non-interactive contexts, pass --provider explicitly. With
\\ no keys set: falls back to the basic REPL (slash commands only,
\\ no natural-language input, no LOGIN / ACCEPT_COOKIES keywords).
\\
\\ Local servers (ollama, llama_cpp) are never auto-detected (they
\\ need no key); select them explicitly with --provider ollama /
\\ --provider llama_cpp.
\\
\\ Allowed values: "anthropic", "openai", "gemini", "huggingface",
\\ "vercel", "mistral", "ollama", "llama_cpp".
\\ In the REPL, use /provider to list and change providers.
\\ --save <PATH>
\\ Synthesize a replayable .js script from the --task run and write
\\ it to PATH, instead of printing the answer. Replay it later with
\\ `run PATH` (no LLM calls). Overwrites PATH if it exists.
\\ Requires --task.
\\ --system-prompt <STRING>
\\ Override the default system prompt.
\\ --task <STRING>
\\ One-shot mode: run a single user turn, print the final answer
\\ to stdout, and exit. Conflicts with the positional script. With
\\ --save, the answer is suppressed and a script is written instead.
\\ --verbosity <LEVEL>
\\ Stderr chatter level. Default: high when --task captures stderr
\\ to a pipe or file; low otherwise. low/medium also raise
\\ --log-level to err (mutes page-side console.error spam) unless
\\ --log-level is set explicitly.
\\ Allowed values:
\\ low silent in --task mode (final answer to stdout only);
\\ spinner + summary in REPL.
\\ medium + one `● [tool: ...]` line per call.
\\ high + the matching `[result: ...]` body (required by the
\\ benchmarks harness).
\\
\\The provider, model, effort, and verbosity you choose in the REPL are
\\remembered per-directory in .lp-agent.zon and reused on the next run.
\\
\\API keys are read from the environment: ANTHROPIC_API_KEY, OPENAI_API_KEY,
\\GOOGLE_API_KEY/GEMINI_API_KEY, HF_TOKEN, AI_GATEWAY_API_KEY, or
\\MISTRAL_API_KEY. The local servers (Ollama, llama.cpp) do not require an
\\API key.
,
.run =
\\run command
\\Runs a saved script, then exits. No LLM calls, no API key needed.
\\
\\Usage:
\\ {0s} run <SCRIPT> [COMMON_OPTIONS]
\\
\\Examples:
\\ {0s} run script.js (replay a saved script)
\\
\\Arguments:
\\<SCRIPT>
\\ Path to a .js script to run, then exit. Produce one with
\\ `{0s} agent --task "..." --save script.js`, or `/save` from the
\\ agent REPL.
\\ Caution: .js files can contain evaluate(...) calls that run
\\ arbitrary JavaScript in the page. Only run scripts you trust, the
\\ same way you would a shell script.
,
.version =
\\usage: {0s} version [OPTIONS]
\\
\\Displays the version of {0s}.
\\
\\options:
\\ --check
\\ Checks whether a newer release of {0s} is available. When one is
\\ found, prints the running version, the latest release, and how to
\\ update.
,
.help =
\\usage: {0s} help
\\
\\Displays help message for a command.
,
.common_options =
\\common options:
\\ --adblock-lists <LIST>
\\ EasyList-syntax filter files to load. Can be passed multiple times.
\\ Requests to a hostname blocked by any list are failed before they leave.
\\ e.g. --adblock-lists easylist.txt --adblock-lists easyprivacy.txt
\\ --block-cidrs <CIDR>
\\ Additional CIDR ranges to block. Can be passed multiple times.
\\ Prefix with '-' to allow (exempt from blocking).
\\ e.g. --block-cidrs 10.0.0.0/8 --block-cidrs -10.0.0.42/32
\\ Can be combined with --block-private-networks.
\\ --block-urls <PATTERN>
\\ URL patterns to block. Can be passed multiple times.
\\ Patterns are matched case-insensitively against the full URL and '*'
\\ is a wildcard.
\\ e.g. --block-urls "*doubleclick*" --block-urls "*://*/*.png"
\\ --block-private-networks
\\ Block HTTP requests to private/internal IP addresses after DNS
\\ resolution.
\\ Defaults to false.
\\ --ca-cert <PATH>
\\ Load TLS root certificates from a PEM file. Can be passed
\\ multiple times. When any --ca-cert or --ca-path is given, the
\\ system trust store is replaced by these certificates.
\\ --ca-path <PATH>
\\ Load TLS root certificates from every file in a directory. Unlike
\\ openssl, the directory does not need to be c_rehash'ed. Can be
\\ passed multiple times. When any --ca-cert or --ca-path is given,
\\ the system trust store is replaced by these certificates.
\\ --cookie <PATH>
\\ Path to a JSON file to load cookies from (read-only).
\\ Defaults to no cookie loading.
\\ --cookie-jar <PATH>
\\ Path to a JSON file to save cookies to on exit (write-only).
\\ Defaults to no cookie saving.
\\ --load-resources <RESOURCE>
\\ Sub-resource to actually request. Can be passed multiple times.
\\ Defaults to requesting none of them.
\\ Allowed values:
\\ iframe When enabled, <iframe> elements are fully loaded.
\\
\\ image <img> sources, so that load/error reflects the real
\\ HTTP status. Only the response headers are read;
\\ images are never decoded, so naturalWidth and
\\ naturalHeight stay 0. Delays the window load event.
\\
\\ stylesheet Fetch external <link rel=stylesheet> resources so
\\ their rules contribute to computed styles (and
\\ therefore to visibility checks like display,
\\ visibility, opacity, pointer-events).
\\
\\ worker Enable loading dedicated and shared workers. When
\\ disabled, the Worker constructor still returns a
\\ Worker, but no script fetch is initiated and the
\\ Worker never runs.
\\ --http-cache-dir <PATH>
\\ Directory used as a filesystem cache for network resources. Omitting
\\ this disables caching.
\\ Defaults to no caching.
\\ --http-cache-entry-limit <INT>
\\ Maximum number of entries kept in the HTTP cache. The limit is
\\ soft: it is enforced at startup and when a browser session ends.
\\ The cache can temporarily exceed it. 0 means no limit.
\\ Defaults to 1000.
\\ --http-connect-timeout <INT>
\\ Time in ms to establish an HTTP connection before timing out. 0 means
\\ never.
\\ Defaults to 0.
\\ --http-header <HEADER>
\\ Extra custom header added to every outgoing HTTP request, including redirections,
\\ in "Name: Value" form. Can be passed multiple times. The last one is used.
\\ Note that if you add a custom header that has the same name as one of the
\\ internal ones Lightpanda would use, your set header is always used instead of the
\\ internal one. You should not replace internally set headers without knowing
\\ perfectly well what you are doing.
\\ Script set headers via CDP or JS can't override a CLI set header.
\\ --http-max-concurrent <INT>
\\ Maximum number of concurrent HTTP requests.
\\ Defaults to 40.
\\ --http-max-host-open <INT>
\\ Maximum open connections to a given host:port.
\\ Defaults to 6.
\\ --http-max-response-size <INT>
\\ Limits the acceptable response size for any request
\\ e.g. XHR, fetch, script loading.
\\ Defaults to 1 GiB.
\\ --http-nav-burst <INT>
\\ Number of top-level navigations to an idle host allowed to
\\ start without waiting for --http-nav-delay. After a burst,
\\ navigations are spaced by --http-nav-delay again.
\\ Defaults to 1.
\\ --http-nav-delay <INT>
\\ Minimum time in ms between two top-level navigations to the same
\\ host (see --http-nav-burst). Disable by setting to 0.
\\ Defaults to 0.
\\ --http-proxy <URL>
\\ HTTP proxy for all HTTP requests.
\\ username:password may be included for basic auth.
\\ Defaults to none.
\\ --http-timeout <INT>
\\ Maximum time in ms the transfer is allowed to complete. 0 means never.
\\ Defaults to 10000.
\\ --insecure-disable-tls-host-verification
\\ Disables host verification on all HTTP requests.
\\ Only set this if you understand and accept the risk.
\\ --log-filter <SCOPE>
\\ Filter logs per scope, applied first-to-last. Can be passed multiple times.
\\ "-X" (or bare "X") filters out a scope, "+X" filters it in, and
\\ "all" targets every scope.
\\ e.g. --log-filter http --log-filter unknown_prop
\\ hides those two.
\\ --log-filter -all --log-filter +cdp
\\ hides everything except cdp.
\\ --log-format <FORMAT>
\\ The log format.
\\ Defaults to {2s}.
\\ Allowed values: "pretty", "logfmt".
\\ --log-level <LEVEL>
\\ The log level.
\\ Defaults to {1s}.
\\ Allowed values: "debug", "info", "warn", "error", "fatal".
\\ --obey-robots
\\ Fetches and obeys robots.txt of the target page.
\\ Defaults to false.
\\ --proxy-bearer-token <TOKEN>
\\ Token sent for bearer authentication with the proxy:
\\ Proxy-Authorization: Bearer <token>.
\\ --storage-engine <ENGINE>
\\ The storage engine to use.
\\ Defaults to none.
\\ Allowed values: "none", "sqlite".
\\ --storage-sqlite-path <PATH>
\\ Path to the SQLite database file for persistent storage.
\\ Use ":memory:" for in-memory storage.
\\ --user-agent <STRING>
\\ Override the User-Agent header entirely. Must not impersonate other
\\ browsers; any value containing "Mozilla" is forbidden. The browser
\\ still sends Sec-Ch-Ua. Incompatible with --user-agent-suffix.
\\ --user-agent-suffix <STRING>
\\ Suffix appended to the Lightpanda/X.Y User-Agent.
\\ --v8-flags-unsafe <FLAGS>
\\ Flags passed as-is to the V8 JavaScript engine, space-separated.
\\ e.g. --v8-flags-unsafe "--expose-gc --stack-size 1000".
\\ Unsupported escape hatch: V8 does not validate flags against the
\\ prebuilt snapshot, so an incompatible flag can misbehave or
\\ crash at any point.
\\ --v8-max-heap-mb <INT>
\\ Maximum V8 heap size in megabytes, per browser instance. Values
\\ below ~16 are clamped by V8 and all behave the same.
\\ Defaults to the V8 default (based on available memory).
\\ --watchdog-ms <INT>
\\ Terminates JavaScript when the browser stalls — stays busy for
\\ this long without returning to its network poll (e.g. a page
\\ stuck in an endless script loop). In serve mode the CDP
\\ connection is then closed. Unlike fetch's --terminate-ms, an idle
\\ or normally-working page never trips this.
\\ Defaults to [a very generous] 30000, disable by setting to 0.
\\ --web-bot-auth-domain <DOMAIN>
\\ Your domain, e.g. yourdomain.com.
\\ --web-bot-auth-key-file <PATH>
\\ Path to the Ed25519 private key PEM file.
\\ --web-bot-auth-keyid <STRING>
\\ The JWK thumbprint of your public key.
\\ --ws-max-concurrent <INT>
\\ Maximum number of concurrent WebSocket connections.
\\ Defaults to 8.
,
}