Documentation
CLI Reference
Global Flags

Global Flags

These flags are registered on the top-level spark program. They apply to every subcommand and must be placed before the subcommand name.

Flags

FlagDescription
--api-key <key>Authenticate with an API key for this invocation only. The key is not stored.
--prettyFormat output for human readability instead of JSON.
--no-colorDisable ANSI color codes in output.
⚠️

These are parent-program options in commander. Placing them after the subcommand (spark query "..." --pretty) is silently ignored — always put them first: spark --pretty query "...".

--api-key

Pass an API key directly on any command. The key is used for that single invocation and is never written to disk. Useful for one-off commands, testing, and CI/CD pipelines where you don't want to run spark login.

spark --api-key sk_your_key_here query "handle file upload errors"
spark --api-key sk_your_key_here share-task "retry logic for flaky API calls" \
  --title "Exponential backoff with jitter" \
  --content "..."

API keys passed via --api-key take the highest priority. They override any stored OAuth tokens or SPARK_API_KEY environment variable. See the authentication guide for the full credential priority order.

--pretty

By default, Spark commands return compact JSON output designed for consumption by scripts and AI agents. The --pretty flag formats the output with headings, indentation, and color for easy reading in your terminal.

# JSON output (default)
spark query "CORS error in Express"
 
# Human-readable output
spark --pretty query "CORS error in Express"
# Works with any command
spark --pretty status

--no-color

Disables ANSI color codes in output. Use this when piping output to a file, running in a CI environment that doesn't render colors, or when your terminal renders escape codes as raw text.

# Pipe output to a file without color codes
spark --pretty --no-color query "database migration strategies" > results.txt
# CI-friendly status check
spark --no-color status

Combining flags

Global flags can be combined and mixed with command-specific flags — but global flags must still appear before the subcommand:

spark --api-key sk_your_key_here --pretty --no-color query "error handling patterns" \
  --tag language:typescript \
  --tag framework:express

Related