Skip to content

Command line

Command What it does
specbook init Scaffolds the config, the #api/* import and an environments folder.
specbook add <service> --spec <path or url> Registers a spec and generates its code. An address is downloaded to openapi/ and recorded in openapi/sources.json.
specbook add --refresh [service...] Downloads the recorded addresses again, reports what changed and regenerates.
specbook generate [service...] Generates types, operations, examples and metadata from the specs. dev, build and test do it when needed.
specbook dev [--port n] Opens the docs, a play panel and a credential proxy, so you can run requests as you write them.
specbook build [--out dir] [--minimal] [--viewer] Builds a static docs site and specbook.js. --minimal publishes only what your requests and flows use, and --viewer adds the spec viewer.
specbook test [glob...] Runs requests and flows against an environment.
specbook bundle [--out file] [--tag t] Compiles the tests into one .mjs that runs with just node.
specbook check Validates specs, generated code drift, imported operations, placeholders and environment files.
specbook secrets [--env name] Shows where each secret resolves from.
specbook preview <url or file> Opens any OpenAPI document in the UI, with no project.
Flag What it does
--env <name> Chooses the environment. The default is mock, for development.
--tag <tag>, --grep <re>, --grep-invert <re> Choose what runs, by tag or by file and title.
--list Prints what would run.
--shard i/n, --bail n Splits a run into parts, or stops after n failed flows.
--retries n Runs a failed flow again. A pass on a retry is marked flaky and exits 0.
--timeout ms, --global-timeout ms Limit each request (default: the config’s timeoutMs, else 30000; 0 waits), and the whole run.
--safe Refuses requests that may change data. Use it against production.
--reporter list|json|junit|github|ndjson[:path] Chooses reporters. Repeat the flag to use several.
--input k=v, --var k=v Sets a flow input, or a variable. A variable can override an address.

Exit codes: 0 when everything passed, 1 when a flow failed or errored, 2 when the run could not start (missing secrets, a missing spec, an import that is not an operation) and 3 for a usage error.