CLI
Find the command or flag to start, inspect, stop, or script your development stack. This reference lists every devhost command, flag, and environment variable. Run any command with --help for terminal help; devhost caddy, devhost service, devhost stack, and devhost completion list their subcommands when run alone.
Stacks
Section titled “Stacks”| Command | Does |
|---|---|
devhost start [service-or-group...] | Starts the stack of the nearest devhost.toml and keeps running in your terminal; with --detach, returns once the stack is ready and leaves it running. With names, starts only those services or groups, their dependencies, and alwaysStart services. |
devhost stop | Stops the stack of the nearest devhost.toml. Waits 15 seconds, then kills what is left. |
devhost stack info | Shows this project’s running stack: name, run state, PID, foreground or detached mode, live per-service state and URLs, and fuller key-value details under AGENT=1. Works from the manifest folder or any subfolder; exits 0 only when every started service is ready. See Stack info. |
devhost stack list | Prints every running manifest-backed stack: PID, a tab, and the absolute manifest path, sorted by path. |
devhost stack find <query> | Prints the stacks whose hostname matches a URL exactly, or whose hostname, name, or manifest path contains the query (ignoring case). A path to a manifest file also matches the stack started from that file through a symlink. Same format as stack list. |
devhost stack restart [--all] | Restarts the running stack for the nearest devhost.toml using this executable. Preserves the launch selection. See Restart after upgrading. |
devhost restart | Replaces all running manifest stacks and standalone serve sessions in the selected state directory using this executable. Works from any directory. |
devhost service list | Prints the manifest’s service names, one per line, sorted. |
devhost serve | Launches a command or serves a folder or running local server over HTTPS without a manifest. |
| Flag | Commands | Meaning |
|---|---|---|
--manifest, -m <path> | start, stop, service list, stack info, stack restart | The devhost.toml to use instead of the nearest one. Also DEVHOST_MANIFEST; the flag wins. Any path to the file, including through a symlink, names the same running stack. |
--idle-timeout, -i <duration> | start | Stop the stack after this long without activity, such as 30s or 1h. Also DEVHOST_IDLE_TIMEOUT; the flag wins, and both win over the manifest. See Stop automatically when idle. |
--detach | start, serve | For command-mode serve, wait for the first HTTP route and print its session, URLs, log, and stop command; each launch is independent. For start, launch the stack in a session of its own, wait until every started service passes its health check and its routes are registered, then print its PID, URLs, and log file and exit. Repeating it while the stack runs in the same local or remote mode reports that stack. In remote mode, readiness also requires a connected relay. No short flag: -d is command-specific. Linux and macOS only; other systems reject it. See Keep a stack running after the terminal closes. |
--remote, -r | start | Require the configured remote relay. Ordinary startup already uses [remote] when present; missing enrollment or a connection failure is an error. Mutually exclusive with --local. |
--local, -l | start | Force local routing, using top-level machine domainSuffix (default .localhost) for short service labels. Mutually exclusive with --remote. |
--debug, -d | start | Show Caddy’s output for every route change. |
--worktrees, -w | stop | Stop every stack whose root manifest is in this Git repository, including linked worktrees. |
--all, -a | stack restart | Restart the whole stack for the nearest manifest. Omit --all when using --manifest or DEVHOST_MANIFEST. |
--startable, -s | service list | Leave out alwaysStart services, which start whether or not you name them. |
--domain, -d <hostname> | serve | Required for files or an existing port; command mode generates hostnames. |
--dir <path> | serve | Folder to serve; defaults to the current directory. |
--port, -p <port> | serve | Port of a running HTTP server on 127.0.0.1. Cannot be combined with --dir. |
--name <name>, -n <name> | serve | Override the inferred command app name; retain the session ID. |
--startup-timeout <duration> | serve | Positive duration to wait for the first HTTP listener; default 30s. |
--session <name> | stop, stack info | Select a manifest-free serve session. Overrides manifest discovery and DEVHOST_MANIFEST; incompatible with explicit --manifest and with stop --worktrees. |
--sessions | stack list | List serve sessions as PID, tab, name instead of manifest stacks. |
| Command | Does |
|---|---|
devhost caddy download | Downloads the Caddy binary devhost manages. Without it, devhost uses the caddy on your PATH. |
devhost caddy start | Starts the shared Caddy in the background, and installs its certificate authority when the system does not trust it yet. |
devhost caddy stop | Stops the shared Caddy. |
devhost caddy trust | Installs Caddy’s certificate authority into the system trust store. Asks for your password, or reports that it is already trusted. |
devhost caddy trust-remote <ssh-target> | macOS: fetches another machine’s Caddy root certificate over SSH, prints its fingerprint, and installs it into the System keychain. |
devhost caddy print-root-cert | Prints Caddy’s root certificate in PEM form. |
devhost caddy privileged-ports | Linux: lets the managed Caddy bind ports below 1024 without root, using setcap. Downloads Caddy first if needed. |
See Route apps over HTTPS for how these fit together.
Other commands
Section titled “Other commands”| Command | Does |
|---|---|
devhost --version, -v | Prints the version. |
devhost skill | Prints how to install the devhost skill for AI coding agents. |
devhost skill install <dir> | Uses Git to install the guide and companion files in <dir>/devhost. Creates missing parents, rejects an existing destination, and prints the installed path. |
devhost completion bash|zsh|fish|powershell | Prints a shell completion script. --no-descriptions leaves out command descriptions; devhost completion <shell> --help says where to install it. |
Load completions for the current shell session:
source <(devhost completion bash) # needs the bash-completion packagesource <(devhost completion zsh) # after compinitdevhost completion fish | sourceIn PowerShell, run devhost completion powershell | Out-String | Invoke-Expression. Regenerate installed scripts after upgrading devhost so they include the current commands and flags. Invalid arguments exit 1, write diagnostics to stderr, and point to command help.
Exit codes
Section titled “Exit codes”| Code | When |
|---|---|
0 | Success. devhost stop with no stack running, devhost stack find with no match, and devhost start --detach with the manifest’s stack already running in the same local or remote mode also exit 0. |
1, or the exit code of a tool devhost ran | The command failed; the error says why. A devhost start --detach interrupted by a signal, or devhost stack info when no stack runs or any started service is not ready, also exits 1. |
130 | A foreground stack or devhost serve session stopped by Ctrl-C. |
143 | A foreground stack or devhost serve session stopped by SIGTERM. |
A stack that cannot stop all of its services exits non-zero and lists what is still running.
devhost stack info inspects the stack resolved from the current directory, --manifest, or DEVHOST_MANIFEST, including a path to an included manifest. Services that were deliberately left stopped do not make the stack unready. A service that is starting, restarting, unhealthy, or exited makes the command exit 1.
Environment variables
Section titled “Environment variables”These change how devhost itself behaves. For the variables devhost passes to your services, see Environment variables.
| Variable | Effect |
|---|---|
AGENT | 1, true, or yes switches every command to output for agents and scripts. |
DEVHOST_MANIFEST | Supplies the manifest path for commands that take --manifest. |
DEVHOST_IDLE_TIMEOUT | Same as --idle-timeout. |
DEVHOST_STATE_DIR | The state directory. Each state directory has its own Caddy and its own set of stacks. |
XDG_STATE_HOME | The state directory becomes $XDG_STATE_HOME/devhost when DEVHOST_STATE_DIR is unset. |
DEVHOST_CONFIG_DIR | The folder holding config.toml. |
XDG_CONFIG_HOME | config.toml is read from $XDG_CONFIG_HOME/devhost when DEVHOST_CONFIG_DIR is unset. |
NO_COLOR | Any non-empty value turns off the colors devhost adds. TERM=dumb does too. |
COLUMNS | Terminal width for wrapping log lines, used when devhost cannot read the terminal’s size. |
DEVHOST_DEV_SOURCE_DIR | Development only: the devhost source checkout to serve the toolbar from. See Build from source. |
devhost reads only the environment it is started with; it does not load .env files.
Files and directories
Section titled “Files and directories”| Path | Holds |
|---|---|
~/.config/devhost/config.toml | Machine-wide settings, such as Caddy’s ports. Moved by DEVHOST_CONFIG_DIR or XDG_CONFIG_HOME. |
~/.local/state/devhost/ | The state directory: records of running stacks, hostname and port claims, and Caddy’s data. Moved by DEVHOST_STATE_DIR or XDG_STATE_HOME. |
<state>/caddy/caddy.runtime.log | Caddy’s log, rotated automatically. |
<state>/caddy/caddy.stdout.log, caddy.stderr.log | Caddy’s output from its last start. |
<state>/daemon.json, <state>/run/daemon-<pid>.sock, <state>/daemon.log | Primary shared supervisor metadata, its private 0600 Unix RPC socket inside a 0700 directory (falling back to a private per-user temporary directory when the state path is long), and append-only supervisor diagnostics. daemon.json and the socket are created on demand and removed automatically when the last stack stops; daemon.log is retained for troubleshooting. |
<state>/tmp/ | Private 0700 scratch space for running stacks: chat history files, which are unlinked as soon as they open, and the cursor state of open agent activity streams. Stacks keep these here, not in the system temporary directory, because the shared supervisor outlives the shell that started it and that shell’s temporary directory can be removed. |
<state>/logs/stack-<sha256>.log | The output of the stacks devhost start --detach starts from one manifest, named after the SHA-256 of the manifest’s path with symlinks resolved. Each detached start appends to it, and only your user can read it. |
config.toml lives under ~/.config on macOS too. Stacks with different state directories never see each other.