Skip to main content

Scripting and CI

The CLI is designed to be driven by scripts, CI pipelines and AI agents. For agent setup, see Using the CLI from an Agent.

Describe every command​

gameflow schema prints the whole CLI as JSON. Use it instead of parsing --help. For every command it includes:

  • Its flags, with type, default and whether each is required
  • An example
  • A description of its output
  • The role it needs
  • Whether it is read-only or destructive

It also lists the global flags, the environment variables and the exit codes.

Preview a change​

Every command that changes something accepts --dry-run, except builds create, which is several requests. It prints the request the CLI would send and sends nothing:

gameflow games update --game-id GAME_ID --title "New name" --dry-run
gameflow builds delete --game-id GAME_ID --build-id BUILD_ID --dry-run

Send a JSON body​

Commands that create or update a resource take their fields as flags, or as a JSON body with --from-file or --stdin:

gameflow games create --from-file game.json
cat flow.json | gameflow matchmakers flow save --matchmaker-id ID --stdin
  • The body is sent as it is and replaces the flags.
  • On an update, the body must carry its own updateMask naming the fields to change.
  • Flags build that mask for you, so prefer them for small updates.

Errors and exit codes​

A failure prints one JSON object to stdout and exits with a non-zero code:

{"error": "api error (404): game not found", "code": "not_found", "status": 404}

status is present only when the error came from the API. Branch on code or on the exit code:

CodeExit codeMeaning
internal1Unexpected failure.
usage, invalid_argument2Bad flags, or the API rejected the input.
unauthenticated, permission_denied, role_too_low, session_required3The credential is missing or was rejected, your role is too low for the command, or the endpoint needs a browser login (gameflow login) and not an API key.
not_found4The game, build, server or ticket does not exist.
network5The API could not be reached.
build_failed6builds create finished with a failed build. Its result is still printed, with the buildId.
timeout7--timeout elapsed. The message says what you were waiting for and whether the action was still requested.
rate_limited8Too many requests. Retry later.
unavailable9The API had a temporary failure. Retrying is safe for reads.
server_failed10servers launch --wait saw the server fail instead of becoming ready.

Example: deploy from CI​

export GAMEFLOW_API_KEY="$GAMEFLOW_KEY"

gameflow builds create \
--game-id "$GAME_ID" \
--file server.zip \
--version "$GIT_SHA" \
--tag stable \
--timeout 30m

The step fails the pipeline if the build fails (exit code 6) or does not finish in time (exit code 7). See Authentication for how the CLI picks up the key.