CLI Reference (OSS Proxy)
The gostly host CLI belongs to the open-source proxy. It has six commands: start, mode, status, stop, export and logs. Start runs the proxy; mode, status and export make HTTP requests to a running local proxy. Stop and logs use local processes or files.
Which product has a CLI
Choose the instructions for the product you run:
OSS proxy
host CLIThis reference covers the standalone gostly binary and its six host commands. Use the command-specific port, data-directory and pidfile options below for your local instance.
Licensed stack
Docker ComposeThe licensed product runs as a separate Docker Compose stack, operated through its local dashboard and control-plane API. Lite is the default installation; Full optionally adds AI services. It does not use this host CLI.
Operating the licensed stack
For configuration and service diagnostics, use the licensed stack's operator health checks. These run inside a container; the OSS commands below remain separate.
Synopsis
Running gostly without a subcommand starts the proxy with the default start values. The mode, status and export commands connect to a running proxy on localhost.
gostly [COMMAND] [OPTIONS] Commands: start Run the proxy (default if no subcommand is given) mode Set proxy mode (LEARN, MOCK, PASSTHROUGH) status Print proxy health JSON stop Signal a locally running proxy export Print raw library JSON with a format label logs Read or follow a local proxy log file Run gostly <command> --help for command-specific options.
gostly --version prints the package version, build commit and OSS flavor. The GOSTLY_CLI_PORT environment variable applies to mode, status and export; each also accepts its own --port option. Stop and logs have independent file options. Use gostly --help and command-specific help for your installed binary's options. The public CLI source defines this command interface.
gostly start
Runs the proxy process. Start applies its port, data-directory and initial-mode values to the process environment, including defaults. Without explicit flags, port 8080 and directory ./data replace the corresponding existing port and path settings. An upstream supplied through --upstream or BACKEND_URL selects the forwarding destination.
gostly start [OPTIONS]
Options:
--upstream <URL> Upstream URL (env: BACKEND_URL)
--port <PORT> Proxy port (default: 8080)
--data-dir <DIR> Proxy data directory (default: ./data)
--mode <MODE> Initial mode: learn | mock | passthrough
(default: learn)The data directory holds the mock library, sequence, mode and traffic files, saved resource state and the pidfile. A valid saved mode takes precedence over --mode; otherwise the selected initial mode is used. When no upstream is configured, the default is http://127.0.0.1:3000. The inbound proxy listener uses plain HTTP. The TLS interception guide describes the separate licensed stack.
# Use an upstream you can reach from this machine gostly start --upstream http://localhost:3000 --mode learn
gostly mode
Sets the running proxy's global mode to learn, mock or passthrough by posting to /ghost/mode. Use gostly status to read back the current global mode.
gostly mode <MODE> [OPTIONS] Arguments: <MODE> learn | mock | passthrough Options: --port <PORT> Proxy port (default: 8080, env: GOSTLY_CLI_PORT)
gostly mode mock gostly status
gostly status
Reads /health and prints its JSON response: status, current global mode, mock_count and the number of services in services.
gostly status [OPTIONS] Options: --port <PORT> Proxy port (default: 8080, env: GOSTLY_CLI_PORT)
Health and your replay check
gostly stop
Reads a local pidfile and sends SIGTERM on Unix. If the pidfile is unavailable, it looks for a process named gostly-agent. It reports when no process is found. If start used a custom directory, pass that instance's pidfile explicitly:--pidfile <dir>/gostly.pid.
gostly stop [OPTIONS] Options: --pidfile <PATH> Path to the pidfile (default: data/gostly.pid)
Platform behavior
gostly export
Prints the proxy's raw mock-library response with a format label. Accepted labels are openapi (default), postman and har.
gostly export [OPTIONS] Options: --format <FORMAT> openapi | postman | har (default: openapi) --port <PORT> Proxy port (default: 8080, env: GOSTLY_CLI_PORT)
The format label does not convert the library
/ghost/mocks and wraps the entire response as library, alongside the selected format. The library contains count and mocks. The label does not turn this wrapper into an OpenAPI document, Postman collection or HAR.gostly export --format openapi > mocks.json
Import examples in the licensed stack
The OSS CLI has no import subcommand. The licensed stack has separate dashboard and authenticated API workflows for loading saved examples; these do not add a command to the standalone binary.
Start with Seeding for the supported upload workflow. For a worked source file and a request you can check, choose the guide that matches your input:
gostly logs
Reads <data-dir>/proxy.log on the local filesystem. Without --follow, it prints the whole file; with the option, it runs tail -F to follow the file. Logging does not create this file automatically: redirect the proxy's stdout/stderr if you want to read it through this command.
gostly logs [OPTIONS] Options: --follow Follow the local file with tail -F --data-dir <DIR> Directory holding proxy.log (default: ./data)
Use the same data directory you selected for start. Logs defaults to ./data independently of that earlier invocation.
# Redirect output to a file, then follow that same directory mkdir -p ./data gostly start --upstream http://localhost:3000 --data-dir ./data 2>&1 | tee ./data/proxy.log & gostly logs --data-dir ./data --follow
Observing the proxy
Use status for the health JSON, logs for a local output file and export for the raw mock library. The public proxy also exposes /metrics as an HTTP endpoint; it is not another CLI subcommand.
Keep the operating guides separate