Builds the site and serves it locally with live reload.
Usage
mix cherry.serve [--source DIR] [--out DIR] [--port N] [--name NAME] [--json]Drafts are included (this is your writing loop). Edits to content,
static files, themes, or cherry.exs rebuild automatically and reload
connected browsers; a broken edit keeps the last good output serving
and prints its diagnostics.
--port defaults to the PORT environment variable when set (what
proxy runners hand out), then 4000. --port 0 binds an ephemeral
free port — handy for agents and CI, where a fixed port may already
be taken; the port actually bound is in the banner and the --json
envelope.
--name NAME registers the bound port with a running
cherrypicker daemon, so the
site also answers at a stable http://NAME.localhost URL. No daemon
running simply means the port URL, never a failed serve.
A site with a base_path serves under that prefix, exactly as
production will: the banner URL carries it, the bare root redirects
to it, and an unprefixed path that would 404 on the real host 404s
here too.
The server listens on both IPv4 and IPv6 (falling back to IPv4-only
where IPv6 is unavailable), so localhost never stalls on hosts that
resolve it to ::1 first. --verbose logs every request: method,
path, status, and how long the response took.
When no file-watcher backend is available (on Linux this means
inotify-tools is not installed), the site still serves — just without
live reload. The banner says so and the envelope carries
live_reload: false.
Summary
Functions
@spec doc() :: String.t()
The single-sourced doc text, reused as the mix task's @moduledoc.