Skip to main content

Run in CI

Set a project API key in the environment. It names its project, so reads need nothing else.
To fail a step when a detector found something in the last hour:
A failed CLI call stops the script with the CLI’s own exit code, so you can tell an auth failure (3) from a network failure (5). jq -e exits 1 when there are findings. An API key can’t list workspaces or projects, or change resources. For those, store a session token as a secret and set TRACEROOT_TOKEN to it. It acts as your account, needs a project like a browser login, and stops working after 7 days without use. For setup, see Run without prompts.

JSON output

With --json, a command writes one JSON document to stdout. If it fails, stdout is empty and stderr gets {"error":{"code":"...","message":"..."}}. Three commands are different. doctor and setup doctor write their report to stdout and exit 1 if a check fails. setup writes one JSON event per line, ending in a result event with ok and data.trace_url. If it fails, result carries an error in setup’s own codes. Stderr gets no JSON error unless the run never started, though progress text still goes there. Without --json, all its messages, including the link to your first trace, go to stderr.

Exit codes

setup can exit 0 when it’s paused, hasn’t seen a trace yet, or you declined a question, so check for the link. It also uses these:

Send a JSON body

Commands that change something take their fields as one JSON document, named like the flags with underscores. - reads stdin. Flags override the file.
A body with a missing, unknown, or invalid field exits 2. Under a browser login, your chosen project fills in project_id, unless the file or --project-id sets it. An API key can’t make these writes, even with --project-id.

Shared flags

Every command takes these: Many commands also take these: