Skip to main content

Configuration

Configuration, scripting and debugging.

1 min read
View MarkdownEdit on GitHub

Configuration

The CLI reads configuration in this order (first match wins):

  1. Command-line flags (--api-key, --project)
  2. Environment variables (CODESPAR_API_KEY, CODESPAR_PROJECT)
  3. The config file at ~/.codespar/config.json

Project scoping

If you have multiple CodeSpar projects, pin the CLI to one:

codespar config set project proj_abc123

Or per-command:

codespar servers list --project proj_abc123

Scripting

The CLI returns valid JSON on stdout and human-readable messages on stderr, so you can pipe output into jq:

# Servers that support Pix, as a newline-delimited list
codespar servers list --json | jq -r '.[] | select(.capabilities | contains(["pix"])) | .id'

Use --json on any command to force JSON output even in a TTY.

Debugging

Add --verbose to any command to see the underlying HTTP requests:

codespar servers list --verbose

Reset the CLI (clears cached auth, config, and completions):

codespar reset

Next steps

Configuration | CodeSpar